Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Check for inline boundary character in textContent
  • Loading branch information
tg-ephox committed Jan 4, 2018
commit 44339b8cde53c0faaa94768075724f5278f739e6
8 changes: 3 additions & 5 deletions blocks/editable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ function createTinyMCEElement( type, props, ...children ) {
);
}

function isLinkBoundary( fragment ) {
return fragment.childNodes && fragment.childNodes.length === 1 &&
fragment.childNodes[ 0 ].nodeName === 'A' && fragment.childNodes[ 0 ].text.length === 1 &&
fragment.childNodes[ 0 ].text[ 0 ] === '\uFEFF';
function isInlineBoundary( fragment ) {
return fragment.textContent === '\uFEFF';
}

function getFormatProperties( formatName, parents ) {
Expand Down Expand Up @@ -615,7 +613,7 @@ export default class Editable extends Component {
const afterFragment = afterRange.extractContents();

const beforeElement = nodeListToReact( beforeFragment.childNodes, createTinyMCEElement );
const afterElement = isLinkBoundary( afterFragment ) ? [] : nodeListToReact( afterFragment.childNodes, createTinyMCEElement );
const afterElement = isInlineBoundary( afterFragment ) ? [] : nodeListToReact( afterFragment.childNodes, createTinyMCEElement );

this.setContent( beforeElement );
this.props.onSplit( beforeElement, afterElement, ...blocks );
Expand Down