Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Small refactoring, docs fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
szymonkups committed Oct 20, 2017
1 parent b456008 commit 8832628
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/view/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,9 @@ export default class Renderer {
return false;
}

// Block adding inline filler inside elements with contenteditable=false.
// Prevent adding inline filler inside elements with contenteditable=false.
// https://github.com/ckeditor/ckeditor5-engine/issues/1170
if ( _isNotEditable( selectionParent ) ) {
if ( !_isEditable( selectionParent ) ) {
return false;
}

Expand Down Expand Up @@ -715,17 +715,17 @@ export default class Renderer {

mix( Renderer, ObservableMixin );

// Checks if contents inside provided element are not editable.
// Checks if provided element is editable.
//
// @private
// @param {module:engine/view/element~Element} element
// @returns {Boolean}
function _isNotEditable( element ) {
function _isEditable( element ) {
if ( element.getAttribute( 'contenteditable' ) == 'false' ) {
return true;
return false;
}

const parent = element.findAncestor( element => element.hasAttribute( 'contenteditable' ) );

return parent && parent.getAttribute( 'contenteditable' ) == 'false';
return !parent || parent.getAttribute( 'contenteditable' ) == 'true';
}

0 comments on commit 8832628

Please sign in to comment.