Hello

I used Asset 7.x-1.x and CKEditor 4.4.7 and I've got JS error
Uncaught TypeError: Cannot read property 'getAttribute' of null
when I've pasted gallery into the WYSIWYG and have moved mouse over the gallery.

Please look at the screenshot

error

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

eugene.ilyin’s picture

Status: Active » Needs review
FileSize
471 bytes

This situation occured due the fact that the function from CKEditor returned 'null' if this property is set.
Code in CKEditor doesn't check that this property contains false or true, because it takes it as text. It returns null if we have something in property "data-cke-editable". So we don't need this property for our wrapper in module asset.

// Returns the closest ancestor that has contenteditable attribute.
// Such ancestor is the limit of (non-)editable DOM branch that element
// belongs to. This method omits editor editable.
function getClosestEditableLimit( element, includeSelf ) {
	if ( element.data( 'cke-editable' ) )
		return null;

	if ( !includeSelf )
		element = element.getParent();

	while ( element ) {
		if ( element.data( 'cke-editable' ) )
			return null;

		if ( element.hasAttribute( 'contenteditable' ) )
			return element;

		element = element.getParent();
	}

	return null;
}

I prepared the patch to solve this problem

IRuslan’s picture

Actually this attribute was required to avoid edition of of Asset's content, probably in newer version of CKEditor this problem should be solved without this attribute.
As i see for recent version it works, but we need someone to test it with older version of CKEditor first (as we have no separate branch for 4.3+ CKEditor versions).

eugene.ilyin’s picture

This problem is still actual for ckeditor 4.5.3 (last version for now).

eugene.ilyin’s picture

I've checked this problem with ckeditor 4.3.1 and problem is reproduced.
Seems you mean issue #1905278. I've checked it too and my correction doesn't affect this issue.

So, I think we should commit this patch.

  • IRuslan committed 4a7eb3c on 7.x-1.x authored by eugene.ilyin
    Issue #2508745 by eugene.ilyin, IRuslan: JS error in CKEditor when I...
IRuslan’s picture

Status: Needs review » Fixed

Thanks for work. Pushed to dev branch.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.