From 1130521e4b2e5f5f06bab458767224dca44b3b33 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 25 Oct 2023 18:07:12 +0200 Subject: [PATCH] Fix WebContextMenus --- src/plugins/webContextMenus.web/index.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/plugins/webContextMenus.web/index.ts b/src/plugins/webContextMenus.web/index.ts index 26ae19c5..cd31e7aa 100644 --- a/src/plugins/webContextMenus.web/index.ts +++ b/src/plugins/webContextMenus.web/index.ts @@ -98,8 +98,8 @@ export default definePlugin({ replacement: [ { // if (!IS_WEB || null == - match: /if\(!\i\.\i\|\|null==/, - replace: "if(null==" + match: /!\i\.isPlatformEmbedded/, + replace: "false" }, { match: /return\s*?\[\i\.\i\.canCopyImage\(\)/, @@ -132,23 +132,22 @@ export default definePlugin({ find: '"interactionUsernameProfile"', predicate: () => settings.store.addBack, replacement: { - match: /if\("A"===\i\.tagName&&""!==\i\.textContent\)/, - replace: "if(false)" + match: /if\((?="A"===\i\.tagName&&""!==\i\.textContent)/, + replace: "if(false&&" } }, // Add back slate / text input context menu { - find: '"slate-toolbar"', + find: 'getElementById("slate-toolbar"', predicate: () => settings.store.addBack, replacement: { - match: /(?<=\.handleContextMenu=.+?"bottom";)\i\.\i\?/, - replace: "true?" + match: /(?<=handleContextMenu\(\i\)\{.{0,200}isPlatformEmbedded)\?/, + replace: "||true?" } }, { find: 'navId:"textarea-context"', - all: true, predicate: () => settings.store.addBack, replacement: [ { @@ -167,7 +166,7 @@ export default definePlugin({ find: '"add-to-dictionary"', predicate: () => settings.store.addBack, replacement: { - match: /var \i=\i\.text,/, + match: /let\{text:\i=""/, replace: "return [null,null];$&" } }