@udecode/plate-selection
Advanced tools
Comparing version 18.13.0 to 18.14.3
@@ -1,2 +0,2 @@ | ||
import { createStore, useEditorRef, findNodePath, isInline, getPluginOptions, queryNode, deselectEditor, createComponentAs, createElementAs, getNodeEntries, withoutNormalizing, select, getStartPoint, getEndPoint, deselect, isBlock, focusEditor, isElementEmpty, insertNodes, insertData, findNode, removeNodes, createPluginFactory } from '@udecode/plate-core'; | ||
import { createStore, useEditorRef, findNodePath, isInline, getPluginOptions, queryNode, deselectEditor, createComponentAs, createElementAs, getNodeEntries, withoutNormalizing, select, getStartPoint, getEndPoint, deselect, isBlock, focusEditor, isElementEmpty, insertNodes, insertData, isEditorReadOnly, findNode, removeNodes, createPluginFactory } from '@udecode/plate-core'; | ||
import React, { useMemo, useEffect, createRef } from 'react'; | ||
@@ -667,2 +667,4 @@ import VanillaSelectionArea from '@viselect/vanilla'; | ||
const isReadonly = isEditorReadOnly(editor); | ||
if (isSelecting) { | ||
@@ -715,3 +717,3 @@ const input = document.createElement('input'); | ||
if (isHotkey(['backspace', 'delete'])(e)) { | ||
if (isHotkey(['backspace', 'delete'])(e) && !isReadonly) { | ||
removeNodes(editor, { | ||
@@ -739,6 +741,9 @@ at: [], | ||
copySelectedBlocks(editor); | ||
removeNodes(editor, { | ||
at: [], | ||
match: n => blockSelectionSelectors.selectedIds().has(n.id) | ||
}); | ||
if (!isReadonly) { | ||
removeNodes(editor, { | ||
at: [], | ||
match: n => blockSelectionSelectors.selectedIds().has(n.id) | ||
}); | ||
} | ||
} | ||
@@ -749,3 +754,6 @@ }; | ||
e.preventDefault(); | ||
pasteSelectedBlocks(editor, e); | ||
if (!isReadonly) { | ||
pasteSelectedBlocks(editor, e); | ||
} | ||
}; | ||
@@ -752,0 +760,0 @@ |
@@ -677,2 +677,4 @@ 'use strict'; | ||
const isReadonly = plateCore.isEditorReadOnly(editor); | ||
if (isSelecting) { | ||
@@ -725,3 +727,3 @@ const input = document.createElement('input'); | ||
if (isHotkey(['backspace', 'delete'])(e)) { | ||
if (isHotkey(['backspace', 'delete'])(e) && !isReadonly) { | ||
plateCore.removeNodes(editor, { | ||
@@ -749,6 +751,9 @@ at: [], | ||
copySelectedBlocks(editor); | ||
plateCore.removeNodes(editor, { | ||
at: [], | ||
match: n => blockSelectionSelectors.selectedIds().has(n.id) | ||
}); | ||
if (!isReadonly) { | ||
plateCore.removeNodes(editor, { | ||
at: [], | ||
match: n => blockSelectionSelectors.selectedIds().has(n.id) | ||
}); | ||
} | ||
} | ||
@@ -759,3 +764,6 @@ }; | ||
e.preventDefault(); | ||
pasteSelectedBlocks(editor, e); | ||
if (!isReadonly) { | ||
pasteSelectedBlocks(editor, e); | ||
} | ||
}; | ||
@@ -762,0 +770,0 @@ |
{ | ||
"name": "@udecode/plate-selection", | ||
"version": "18.13.0", | ||
"version": "18.14.3", | ||
"description": "Plate plugin to add a visual way of selecting blocks", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
158836
1578
20168
6