2

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 ?

AkAk47
  • 291
  • 4
  • 18
  • I think that your issue is possibly related to my issue as well. I am trying to use the Autosave plugin, which also uses the dirtyFlag to determine if it should autosave the content. The autosave plugin does not seem to work for the same reason. https://stackoverflow.com/questions/44780101/tinymce-and-angular-ui-tinymce-with-autosave-plugin. Did you manage to find a solution to your issue? – Andy Jun 27 '17 at 13:08
  • 1
    Its a Problem from ui-TinyMce I think. I did a workaround with creating own Variables and set/unset them myself if I did some changes to Something. Then Checking them if set/unset and throwing Error or something else what you want to achieve. – AkAk47 Jun 28 '17 at 11:16

0 Answers0