Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Added option updateOnBlurOnly to update ngmodel only on editor blur #274

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions src/tinymce.js
Original file line number Diff line number Diff line change
@@ -87,19 +87,21 @@ angular.module('ui.tinymce', [])
}
});

// Update model when:
// - a button has been clicked [ExecCommand]
// - the editor content has been modified [change]
// - the node has changed [NodeChange]
// - an object has been resized (table, image) [ObjectResized]
ed.on('ExecCommand change NodeChange ObjectResized', function() {
if (!options.debounce) {
ed.save();
updateView(ed);
return;
}
debouncedUpdate(ed);
});
if (!options.updateOnBlurOnly) {
// Update model when:
// - a button has been clicked [ExecCommand]
// - the editor content has been modified [change]
// - the node has changed [NodeChange]
// - an object has been resized (table, image) [ObjectResized]
ed.on('ExecCommand change NodeChange ObjectResized', function() {
if (!options.debounce) {
ed.save();
updateView(ed);
return;
}
debouncedUpdate(ed);
});
}

ed.on('blur', function() {
element[0].blur();