Skip to content

Commit 70ad878

Browse files
committed
Prioritize pasting text/plain if both text/plain and text/image are copied into the clipboard
1 parent a0fb884 commit 70ad878

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/components/Editor/CustomExtensions/Image/ExtensionConfig.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,14 @@ export default Node.create({
182182
$anchor: { pos },
183183
},
184184
} = view.state;
185+
186+
// Microsoft Excel and a few other products might copy content as
187+
// both `text/plain` and `text/html`. If `text/plain` exists,
188+
// an early return will ensure that it fallbacks to tiptap's
189+
// default paste behavior.
190+
const text = event?.clipboardData?.getData("text/plain");
191+
if (text) return;
192+
185193
const hasFiles = event.clipboardData?.files?.length;
186194

187195
if (!hasFiles) return;

0 commit comments

Comments
 (0)