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

fix(ToolbarMethods) Selecting list/quote option while link popup is open crashes demo - #266 #268

Closed
wants to merge 4 commits into from
Closed
Changes from 3 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
6 changes: 4 additions & 2 deletions src/FormattingToolbar/toolbarMethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,10 @@ export const transformListToBlockQuote = (editor, type, value) => {
*/
/* eslint no-unused-expressions: 0 */
export const transformPtoBQSwap = (editor, type) => {
isSelectionInput(editor.value, CONST.BLOCK_QUOTE)
!isOnlyLink(editor)&&
(isSelectionInput(editor.value, CONST.BLOCK_QUOTE)
? editor.unwrapBlock(CONST.BLOCK_QUOTE)
: editor.wrapBlock({ type, data: { tight: true } });
: editor.wrapBlock({ type, data: { tight: true } }));
};

/**
Expand Down Expand Up @@ -240,6 +241,7 @@ export const transformBlockQuoteToList = (editor, type) => {
* A trigger to the Slate editor to make a paragraph into a list_item.
*/
export const transformParagraphToList = (editor, type) => {
!isOnlyLink(editor)&&
editor.withoutNormalizing(() => {
editor.wrapBlock({ type, data: { tight: true } }).wrapBlock(CONST.LIST_ITEM);
});
Expand Down