Skip to content

Instantly share code, notes, and snippets.

@jordanburke
Last active December 4, 2017 14:27
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jordanburke/9532bf28f884802d4055 to your computer and use it in GitHub Desktop.
Save jordanburke/9532bf28f884802d4055 to your computer and use it in GitHub Desktop.
WYSIWYG directive for xeditable using textAngular
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();
});
}
});
}
});
}]);
@jjgonver
Copy link

Hi. Any documentation with instructions how to use it? Thanks

@jjgonver
Copy link

image

@jjgonver
Copy link

jjgonver commented Sep 1, 2016

Hi.
The text container goes to infinity in edit mode.
Do you know how to resolve this?
Thanks

@uofmmike
Copy link

uofmmike commented Sep 7, 2017

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