I have a problem with a plugin that was written for version 5. I found the cause, but I don't know how to fix this problem. In version 5 * during initialization eg.
tinymce.init ({
selector: '#textarea',
language: 'pl',
external_filemanager_path: "test / test"
})
I was able to download the data via "editor.settings.external_filemanager_path". It doesn't work at this point. I tried to use "editor.options.get ('external_filemanager_path')" but it throws me "undefined". I don't only have access to "my" data. I can download typical data for tinymce without any problems.
Sorry for my English (PL).
EDIT.
I have one more problem. Unable to get data while executing functions during initialization, e.g.
tinymce.init({
***
external_filemanager_path: 'xyz',
file_picker_callback: function (cb, value, meta) {
openmanager();
}
});
function openmanager() {
***
const test = tinymce.options.get('external_filemanager_path');
}
* .options does not work
In TinyMCE 6 the settings have to be registered before you can get them.
For example in your plugin you should have:
editor.options.register('external_filemanager_path', {
processor: 'string',
default: ''
});
After that point you should be able to call editor.options.get('external_filemanager_path') to get the value of the setting.
The processor can be one of the possible options ('string', 'number', 'boolean', 'array', 'function', 'object', 'string[]', 'object[]', 'regexp') which allows that type, or it can be a function that takes in the value and return a boolean indicating if it is valid, or it can be a function that takes in the value and returns an object with a valid boolean property and a value property if it is valid or an message string property if it is invalid.
The typescript types for this are visible at the top of this file:
https://github.com/tinymce/tinymce/blob/develop/modules/tinymce/src/core/main/ts/api/EditorOptions.ts#L6-L52
At the moment the docs are a bit lacking however this will eventually be fully documented on the page:
https://www.tiny.cloud/docs/tinymce/6/apis/tinymce.editoroptions/