1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-31 15:24:31 +03:00

Added UI components of page autosaving

This commit is contained in:
Dan Brown
2016-03-12 15:52:19 +00:00
parent 93ebdf724b
commit 30214fde74
12 changed files with 237 additions and 35 deletions

View File

@ -162,7 +162,7 @@ module.exports = function (ngApp, events) {
};
}]);
ngApp.directive('tinymce', [function() {
ngApp.directive('tinymce', ['$timeout', function($timeout) {
return {
restrict: 'A',
scope: {
@ -173,14 +173,24 @@ module.exports = function (ngApp, events) {
link: function (scope, element, attrs) {
function tinyMceSetup(editor) {
editor.on('keyup', (e) => {
editor.on('ExecCommand change NodeChange ObjectResized', (e) => {
var content = editor.getContent();
console.log(content);
scope.$apply(() => {
$timeout(() => {
scope.mceModel = content;
});
scope.mceChange(content);
});
editor.on('init', (e) => {
scope.mceModel = editor.getContent();
});
scope.$on('html-update', (event, value) => {
editor.setContent(value);
editor.selection.select(editor.getBody(), true);
editor.selection.collapse(false);
scope.mceModel = editor.getContent();
});
}
scope.tinymce.extraSetups.push(tinyMceSetup);