Event callback should fire when switching to html view.
Event does not fire when switching to html view.
import FroalaEditor from "froala-editor"
import "froala-editor/js/plugins/code_view.min.js"
const editor = new FroalaEditor(node, {
events: {
"codeView.update": () => {
debugger
}
}
})
CodeMirror is not used.
[email protected] (via NPM)
All OSes
All Browsers
Just an observation -> the event fires when you switch to fullscreen mode.
I just recently figured that out as well. It seems that event name is used to indicate the desired side-effect which is an anti-pattern. Event names should indicate what is happening, not what their intended effect should be.
Had the same issue. Workaround: Listen to the 'commands.after' event, it will fire when clicking the code view button (cmd === 'html') and the fullscreen button (cmd === 'fullscreen').
Any update on this?
..as mentioned above, we end up forcing fullscreen on code view:
events: {
'commands.after': function (cmd) {
if (cmd == 'html' && this.codeView.isActive() && !this.fullscreen.isActive()) {
this.fullscreen.toggle();
}
}
}
I have updated code to fire event when you switch from code view to html view. It will be available in 3.0.7 release