KillerCodeMonkey/ng-quill

How can I set "bounds" to be the current element

chenlijun99 opened this issue · 8 comments

In order to fix this issue I need to set "bounds" to the current element.

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.

is this working for you?

Sorry I haven't tried yet.
This evening I should have time to test it.

I'll let you know.

I've tried but it doesn't work

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];
		};
	}
}

try the latest release 3.6.0 and pass bounds="self" to the editor tag

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 "@".

jarp, you are right :)