From 373540f7a5aaf3ca61b4fb3de89f7002fc883bdb Mon Sep 17 00:00:00 2001 From: Botho <1258870+elbotho@users.noreply.github.com> Date: Thu, 19 Dec 2024 13:59:30 +0100 Subject: [PATCH 1/2] fix(editor): skip other checks if we found editor state in paste --- .../text/hooks/use-editable-paste-handler.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/editor/src/plugins/text/hooks/use-editable-paste-handler.tsx b/packages/editor/src/plugins/text/hooks/use-editable-paste-handler.tsx index fda7e3af89..a514febf60 100644 --- a/packages/editor/src/plugins/text/hooks/use-editable-paste-handler.tsx +++ b/packages/editor/src/plugins/text/hooks/use-editable-paste-handler.tsx @@ -87,12 +87,14 @@ export const useEditablePasteHandler = (args: UseEditablePasteHandlerArgs) => { // Exit if not allowed to manipulate siblings if (!mayManipulateSiblings) return - // Iterate through all plugins and try to process clipboard data - for (const { plugin, type } of editorPlugins.getAllWithData()) { - const state = plugin.onFiles?.(files) ?? (await plugin.onText?.(text)) - if (state?.state) { - media = { state: state.state as unknown, pluginType: type } - break + if (!media) { + // Iterate through all plugins and try to process clipboard data + for (const { plugin, type } of editorPlugins.getAllWithData()) { + const state = plugin.onFiles?.(files) ?? (await plugin.onText?.(text)) + if (state?.state) { + media = { state: state.state as unknown, pluginType: type } + break + } } } From 735fe1030461242def245d5e38e7a49a5dfe2353 Mon Sep 17 00:00:00 2001 From: Botho <1258870+elbotho@users.noreply.github.com> Date: Thu, 19 Dec 2024 14:05:33 +0100 Subject: [PATCH 2/2] fix(editor): make video regex stricter and simplify for now --- packages/editor/src/plugins/video/renderer.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/editor/src/plugins/video/renderer.tsx b/packages/editor/src/plugins/video/renderer.tsx index a6345cb8d6..c7700c216c 100644 --- a/packages/editor/src/plugins/video/renderer.tsx +++ b/packages/editor/src/plugins/video/renderer.tsx @@ -58,7 +58,8 @@ export function parseVideoUrl( `https://player.vimeo.com/video/${vimeo[3]}?autoplay=1`, VideoType.Vimeo, ] - const serloAssetRegex = /^(https?:\/\/)?(.*?assets\.serlo\.org\/)(.+)/ + const serloAssetRegex = + /^(https:\/\/assets\.serlo\.org\/wikimedia\/)(.+)(webm)$/ const serloAsset = serloAssetRegex.exec(inputSrc) if (serloAsset) return [inputSrc, VideoType.SerloAsset]