After Configuring the TinyMce Editor and some Functions I want now to Warn the User if he did changes but did not save them.
For that Iam Checking the Dirty Flag at Blur. But its always set false
.
controller.js
this.$scope.tinymceOptions = {
selector: 'textarea',
menubar: false,
plugins: 'save',
save_enablewhendirty: true,
save_onsavecallback: (editor) => {
doing here my save stuff
},
setup: function(editor) {
editor.on('dirty', () => {
console.log('dirty woop')//if i do edits its triggered
})
editor.on('blur', function(e) {
console.log(tinyMCE.activeEditor.isDirty());//its triggered but after edits it says dirty=false
//wanna do here some warning output as info
});
editor.on('change', function(e) {
editor.setDirty(true);//seting dirty true if changes appear
console.log(tinyMCE.activeEditor.isDirty());//dirty output = true
});
},
height: 100,
width: 250,
toolbar1: ' undo redo | bold underline italic',
toolbar2: 'save'
};
Why is it always set to false if I leave the Editor after changes?
Using TinyMce 4.4.x
Angular 1.5.x
Angular-ui-TinyMce 0.0.17
Edit
It seems it is somehow reseting the Flag somewhere in a Cycle Loop?
If I write something and wait more than ~1sec it is set always to false. If I write something and immediately move out the dirtyFlag
is set true.
How can I set the Flag Dirty by writing something and say wait till its saved be always Dirty
?