kopia lustrzana https://github.com/Tldraw/Tldraw
Merge d7a8e7999b
into c9af23c921
commit
cc7f799d0d
|
@ -74,13 +74,12 @@ const INPUTS = ['input', 'select', 'textarea']
|
|||
* @param editor - The editor instance.
|
||||
* @internal
|
||||
*/
|
||||
function disallowClipboardEvents(editor: Editor) {
|
||||
function disallowClipboardEvents() {
|
||||
const { activeElement } = document
|
||||
return (
|
||||
editor.getIsMenuOpen() ||
|
||||
(activeElement &&
|
||||
(activeElement.getAttribute('contenteditable') ||
|
||||
INPUTS.indexOf(activeElement.tagName.toLowerCase()) > -1))
|
||||
activeElement &&
|
||||
(activeElement.getAttribute('contenteditable') ||
|
||||
INPUTS.indexOf(activeElement.tagName.toLowerCase()) > -1)
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -584,7 +583,7 @@ export function useMenuClipboardEvents() {
|
|||
// If we're editing a shape, or we are focusing an editable input, then
|
||||
// we would want the user's paste interaction to go to that element or
|
||||
// input instead; e.g. when pasting text into a text shape's content
|
||||
if (editor.getEditingShapeId() !== null || disallowClipboardEvents(editor)) return
|
||||
if (editor.getEditingShapeId() !== null || disallowClipboardEvents()) return
|
||||
|
||||
if (Array.isArray(data) && data[0] instanceof ClipboardItem) {
|
||||
handlePasteFromClipboardApi(editor, data, point)
|
||||
|
@ -621,7 +620,7 @@ export function useNativeClipboardEvents() {
|
|||
if (
|
||||
editor.getSelectedShapeIds().length === 0 ||
|
||||
editor.getEditingShapeId() !== null ||
|
||||
disallowClipboardEvents(editor)
|
||||
disallowClipboardEvents()
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
@ -635,7 +634,7 @@ export function useNativeClipboardEvents() {
|
|||
if (
|
||||
editor.getSelectedShapeIds().length === 0 ||
|
||||
editor.getEditingShapeId() !== null ||
|
||||
disallowClipboardEvents(editor)
|
||||
disallowClipboardEvents()
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
@ -664,7 +663,7 @@ export function useNativeClipboardEvents() {
|
|||
// If we're editing a shape, or we are focusing an editable input, then
|
||||
// we would want the user's paste interaction to go to that element or
|
||||
// input instead; e.g. when pasting text into a text shape's content
|
||||
if (editor.getEditingShapeId() !== null || disallowClipboardEvents(editor)) return
|
||||
if (editor.getEditingShapeId() !== null || disallowClipboardEvents()) return
|
||||
|
||||
// First try to use the clipboard data on the event
|
||||
if (e.clipboardData && !editor.inputs.shiftKey) {
|
||||
|
|
Ładowanie…
Reference in New Issue