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
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/FormattingToolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export default class FormatToolbar extends React.Component {
const { editor, pluginManager, lockText } = this.props;
const { value } = editor;

if (!lockText || pluginManager.isEditable(editor, type)) {
if (!lockText || pluginManager.isEditable(editor, type) && !action.isOnlyLink(editor)) {
event.preventDefault();
if (action.isClickBlockQuote(type)) {
action.isSelectionList(value)
Expand Down
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