Skip to content

Instantly share code, notes, and snippets.

@dimaShin
Created November 4, 2015 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimaShin/bbae09a6f9172d47ff1f to your computer and use it in GitHub Desktop.
Save dimaShin/bbae09a6f9172d47ff1f to your computer and use it in GitHub Desktop.
.directive('summernote', [function() {
'use strict';
return {
restrict: 'EA',
transclude: 'element',
replace: true,
require: ['summernote', '?ngModel'],
controller: 'SummernoteController',
scope: {
summernoteConfig: '=config',
editable: '=',
editor: '=',
init: '&onInit',
enter: '&onEnter',
focus: '&onFocus',
blur: '&onBlur',
paste: '&onPaste',
keyup: '&onKeyup',
keydown: '&onKeydown',
change: '&onChange',
toolbarClick: '&onToolbarClick',
imageUpload: '&onImageUpload',
ctrl: '=',
ngModel: '='
},
template: '<div class="summernote"></div>',
link: function(scope, element, attrs, ctrls, transclude) {
var summernoteController = ctrls[0],
ngModel = ctrls[1];
transclude(scope, function(clone, scope) {
// to prevent binding to angular scope (It require `tranclude: 'element'`)
element.append(clone.html());
});
summernoteController.activate(scope, element, ngModel);
}
};
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment