in src/component/handlers/edit/commands/keyCommandPlainBackspace.js [25:52]
function keyCommandPlainBackspace(editorState: EditorState): EditorState {
const afterRemoval = removeTextWithStrategy(
editorState,
strategyState => {
const selection = strategyState.getSelection();
const content = strategyState.getCurrentContent();
const key = selection.getAnchorKey();
const offset = selection.getAnchorOffset();
const charBehind = content.getBlockForKey(key).getText()[offset - 1];
return moveSelectionBackward(
strategyState,
charBehind ? UnicodeUtils.getUTF16Length(charBehind, 0) : 1,
);
},
'backward',
);
if (afterRemoval === editorState.getCurrentContent()) {
return editorState;
}
const selection = editorState.getSelection();
return EditorState.push(
editorState,
afterRemoval.setSelectionBefore(selection),
selection.isCollapsed() ? 'backspace-character' : 'remove-range',
);
}