Open brettz9 opened 9 years ago
Looking more carefully, I see the source of the problem.
In defaults.js, there is this code:
for(var i in JSONEditor.defaults.editors) {
if(!JSONEditor.defaults.editors.hasOwnProperty(i)) continue;
JSONEditor.defaults.editors[i].options = JSONEditor.defaults.editors.options || {};
}
One problem is that it runs immediately so that it is not possible for anyone to add to JSONEditor.defaults.editors.options
whether before or after the jsoneditor.js file loads.
And since this runs before the JSONEditor is accessible, one's own editor plugins must therefore remember to add the options object themselves.
I'd therefore suggest either a class method like say JSONEditor.setDefaultEditorOptions()
(or a registration API for third-party editors) or jsoneditor.js checking for an already set global like JSONEditorDefaultEditorOptions
or such.
And to be clear, I was trying to set this after my editor plugin code, but before instantiating my JSONEditor object:
JSONEditor.defaults.editors.splitter.options.wysiwyg = true;
Hi,
I was looking to build my own code editor type (where one could dump formatted text into an SCEditor instance, and then my code would split this up automatically into separate form fields and hide the field for dumping).
However, when I do a simple extend and successfully register my new type, SCEditor doesn't get applied, despite my new type not overriding a single method.
I would expect that an extension of the string type (or any other type) would behave in the same way as the base type unless one has overridden a method.