Fix WebContextMenus

This commit is contained in:
Vendicated 2023-10-25 18:07:12 +02:00
parent 3bd657611c
commit 1130521e4b
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18

View file

@ -98,8 +98,8 @@ export default definePlugin({
replacement: [ replacement: [
{ {
// if (!IS_WEB || null == // if (!IS_WEB || null ==
match: /if\(!\i\.\i\|\|null==/, match: /!\i\.isPlatformEmbedded/,
replace: "if(null==" replace: "false"
}, },
{ {
match: /return\s*?\[\i\.\i\.canCopyImage\(\)/, match: /return\s*?\[\i\.\i\.canCopyImage\(\)/,
@ -132,23 +132,22 @@ export default definePlugin({
find: '"interactionUsernameProfile"', find: '"interactionUsernameProfile"',
predicate: () => settings.store.addBack, predicate: () => settings.store.addBack,
replacement: { replacement: {
match: /if\("A"===\i\.tagName&&""!==\i\.textContent\)/, match: /if\((?="A"===\i\.tagName&&""!==\i\.textContent)/,
replace: "if(false)" replace: "if(false&&"
} }
}, },
// Add back slate / text input context menu // Add back slate / text input context menu
{ {
find: '"slate-toolbar"', find: 'getElementById("slate-toolbar"',
predicate: () => settings.store.addBack, predicate: () => settings.store.addBack,
replacement: { replacement: {
match: /(?<=\.handleContextMenu=.+?"bottom";)\i\.\i\?/, match: /(?<=handleContextMenu\(\i\)\{.{0,200}isPlatformEmbedded)\?/,
replace: "true?" replace: "||true?"
} }
}, },
{ {
find: 'navId:"textarea-context"', find: 'navId:"textarea-context"',
all: true,
predicate: () => settings.store.addBack, predicate: () => settings.store.addBack,
replacement: [ replacement: [
{ {
@ -167,7 +166,7 @@ export default definePlugin({
find: '"add-to-dictionary"', find: '"add-to-dictionary"',
predicate: () => settings.store.addBack, predicate: () => settings.store.addBack,
replacement: { replacement: {
match: /var \i=\i\.text,/, match: /let\{text:\i=""/,
replace: "return [null,null];$&" replace: "return [null,null];$&"
} }
} }