How can I set "bounds" to be the current element
chenlijun99 opened this issue · 8 comments
chenlijun99 commented
In order to fix this issue I need to set "bounds" to the current element.
KillerCodeMonkey commented
it is not possible for now. to set this initially, because the element is created on the fly.
you can simply try to wrap the quill-editor in another div (without special stylings) and set the bounds to that element.
KillerCodeMonkey commented
is this working for you?
chenlijun99 commented
Sorry I haven't tried yet.
This evening I should have time to test it.
I'll let you know.
chenlijun99 commented
I've tried but it doesn't work
chenlijun99 commented
This is the code of the directive
var app = angular.module("myModule")
.directive("richEdit", RichEditDirective);
function RichEditDirective() {
return {
restrict: "E",
templateUrl: "views/RichEdit.html",
compile: compile,
scope: true,
};
function compile($element) {
// pass all attributes to the inner ng-quill-editor we're encapsulating
// get the actual dom element from the jqLite object $element
var domElement = $element[0];
var editor = $element.find("ng-quill-editor");
// copy all the attributes to ng-quill-editor
angular.forEach(domElement.attributes, function(attribute) {
editor.attr(attribute.name, attribute.value);
});
editor.attr("bounds", "$element");
// remove all the attributes on current element
while(domElement.attributes.length > 0) {
domElement.removeAttribute(domElement.attributes[0].name);
}
return function($scope, $element) {
$scope.$element = editor[0];
};
}
}
KillerCodeMonkey commented
try the latest release 3.6.0 and pass bounds="self"
to the editor tag
chenlijun99 commented
Thank you very much. I've tried and it works!
I only want to point out that it should be bounds="'self'"
, since its a binding of type "<" and not "@".
KillerCodeMonkey commented
jarp, you are right :)