Skip to content

Commit 1537cb6

Browse files
authored
fix: handle line breaks in clipboard comparison #1275
Ensure consistent comparison of clipboard text by normalizing line breaks before checking against editor clipboard data
1 parent 8c6b6ce commit 1537cb6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/editor/core/event/handlers/paste.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,11 @@ export async function pasteByApi(host: CanvasEvent, options?: IPasteOption) {
179179
// 优先读取编辑器内部粘贴板数据
180180
const clipboardText = await navigator.clipboard.readText()
181181
const editorClipboardData = getClipboardData()
182-
if (clipboardText === editorClipboardData?.text) {
182+
if (
183+
editorClipboardData &&
184+
normalizeLineBreak(clipboardText) ===
185+
normalizeLineBreak(editorClipboardData.text)
186+
) {
183187
pasteElement(host, editorClipboardData.elementList)
184188
return
185189
}

0 commit comments

Comments
 (0)