From 38940c14ccc0080dde6ae81582f60cd787920aba Mon Sep 17 00:00:00 2001 From: Andrew Fan Date: Wed, 24 Oct 2018 19:14:05 +0300 Subject: [PATCH] always unstick styles when cursor position is in the beginning of the line following after style --- src/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 2324c92..8e48931 100755 --- a/src/index.js +++ b/src/index.js @@ -205,9 +205,6 @@ function checkReturnForState(config, editorState, ev) { const unstickyInlineStyles = (character, editorState) => { const selection = editorState.getSelection(); if (!selection.isCollapsed()) return editorState; - if (editorState.getLastChangeType() !== "md-to-inline-style") { - return editorState; - } const startOffset = selection.getStartOffset(); const content = editorState.getCurrentContent(); @@ -225,6 +222,9 @@ const unstickyInlineStyles = (character, editorState) => { ); if (previousBlockStyle.size === 0) return editorState; } else { + if (editorState.getLastChangeType() !== "md-to-inline-style") { + return editorState; + } const style = block.getInlineStyleAt(startOffset - 1); if (style.size === 0) return editorState; }