Last active
December 4, 2017 14:27
-
-
Save jordanburke/9532bf28f884802d4055 to your computer and use it in GitHub Desktop.
WYSIWYG directive for xeditable using textAngular
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('xeditable').directive('editableTextAngular', ['editableDirectiveFactory', | |
function (editableDirectiveFactory) { | |
return editableDirectiveFactory({ | |
directiveName: 'editableTextAngular', | |
inputTpl: '<div text-angular></div>', | |
addListeners: function () { | |
var self = this; | |
self.parent.addListeners.call(self); | |
// submit textarea by ctrl+enter even with buttons | |
if (self.single && self.buttons !== 'no') { | |
self.autosubmit(); | |
} | |
}, | |
autosubmit: function () { | |
var self = this; | |
self.inputEl.bind('keydown', function (e) { | |
if ((e.ctrlKey || e.metaKey) && (e.keyCode === 13)) { | |
self.scope.$apply(function () { | |
self.scope.$form.$submit(); | |
}); | |
} | |
}); | |
} | |
}); | |
}]); |
Hi.
The text container goes to infinity in edit mode.
Do you know how to resolve this?
Thanks
Just wanted to give some thanks, great little directive you've given here! 🙌
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi. Any documentation with instructions how to use it? Thanks