[Question] - How we can hide RTE for editable components ?
HI We have a requirement, where we don't want to show rte on editable components. how we can achieve that ?
editor.on('component:selected', cmp => {
cmp.set({
editable: false,
propagate: ['editable']
})
})
We don't want to make component non editable, component needs to be editable, we just don't want to show rte tool bar on that component.
You can try on these codes
editor.setCustomRte({
disable: function(el, rte) {
el.contentEditable = false;
if (rte && rte.focusManager) {
rte.focusManager.blur(true);
}
}
});
You can also extend the Text component View and change onActive method
editor.Components.addType('text', {
view: {
onActive() {} // do nothing
}
});
I allow myself to add what I think might be closer to what OP's trying to achieve, from @artf's answer:
editor.DomComponents.addType('text', {
extendFnView: ['onActive'],
model: {
defaults: {
disableRte: false
}
},
view: {
onActive() {
if (this.model.get('disableRte')) {
this.rte.getToolbarEl().style.display = 'none';
}
}
}
}
Toggling the disableRte property allows to hide the RTE toolbar, while keeping the text editable, on a per-component basis.
Hope this helps :)