I am trying to disable some toolbar and menu options of tinyMce but I could not find a proper way to do it, base on what i found I came up with something like this:
const buttons = this.editor.ui.registry.getAll().menuItems;
for (let id in buttons) {
if (buttons.hasOwnProperty(id)) {
let button = buttons[id];
button.disabled = !enabled;
}
}
Based on the code of tinymce below disabled is a valid property on the button but it does not do anything when i set it to true, any ideas?
interface BaseToolbarButtonSpec<I extends BaseToolbarButtonInstanceApi> {
disabled?: boolean;
tooltip?: string;
icon?: string;
text?: string;
onSetup?: (api: I) => (api: I) => void;
}

You need to use the Button API, almost every API in TinyMCE is unstable so you will have to figure out the exact methods around
disabledorenableddepending on your specific version.TinyMCE 5 is not supported so I will answer for 6: Reference: https://www.tiny.cloud/docs/tinymce/6/custom-basic-toolbar-button/#api
Something like:
Do not set properties directly.