Moved page editing to angular controller and started work on update drafts

This commit is contained in:
Dan Brown
2016-03-09 22:32:07 +00:00
parent 1d6137f7e2
commit 59ce228c2e
14 changed files with 202 additions and 32 deletions

View File

@ -162,5 +162,31 @@ module.exports = function (ngApp, events) {
};
}]);
ngApp.directive('tinymce', [function() {
return {
restrict: 'A',
scope: {
tinymce: '=',
ngModel: '=',
ngChange: '='
},
link: function (scope, element, attrs) {
function tinyMceSetup(editor) {
editor.on('keyup', (e) => {
var content = editor.getContent();
scope.$apply(() => {
scope.ngModel = content;
});
scope.ngChange(content);
});
}
scope.tinymce.extraSetups.push(tinyMceSetup);
tinymce.init(scope.tinymce);
}
}
}])
};