Skip to content

Option to set form (or part of the form) disabled while initializing the editor. #662

Open
@royalpinto

Description

@royalpinto

Is there any option available to set form (or part of the form) disabled while initializing the editor rather than calling disable function on editor (or part of the editor) ? Currently I have added disable: true option to my schema and then recursively disabling parts of the form (where disable: true) after the initialization, by following code snippet(corner cases are not handled).

/*
 * Recursively disbale editor sections by checking the flag.
 */
var disableForm = function(editor, schema, path) {
    // Disable current path if disable property is set.
    if (schema.disable) {
        editor.getEditor(path).disable();
    } else {
        // Otherwise recursively check if properties are disabled.
        for (var key in schema.properties) {
            if (schema.properties.hasOwnProperty(key)) {
                disableForm(editor, schema.properties[key], path + '.' + key);
            }
        }
    }
};

disableForm(editor, schema, 'root');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions