diff --git a/frontend/src/plate/plugins/paste.ts b/frontend/src/plate/plugins/paste.ts index 8a4e89438..c529a38c9 100644 --- a/frontend/src/plate/plugins/paste.ts +++ b/frontend/src/plate/plugins/paste.ts @@ -13,9 +13,6 @@ import { ParagraphPlugin, createPlatePlugin } from '@udecode/plate-core/react'; import { HEADING_KEYS } from '@udecode/plate-heading'; import { ListItemContentPlugin } from '@udecode/plate-list/react'; -const HTML_PREFIX = ''; -const HTML_PREFIX_LENGTH = HTML_PREFIX.length; - export const PastePlugin = createPlatePlugin({ key: 'paste', handlers: { @@ -36,7 +33,8 @@ export const PastePlugin = createPlatePlugin({ const html = event.clipboardData.getData('text/html'); // HTML content from PDFs in Chrome is equal to the plain text, with prepended. - if (html.length - HTML_PREFIX_LENGTH > plainText.length) { + // Some browsers and OS will wrap the plain text in pain text. + if (html.includes(plainText)) { // Pasted HTML not from PDF. return false; }