WebContextMenus: Fix copying and saving images (#3459)

This commit is contained in:
Elvyra 2025-06-05 02:18:20 +02:00 committed by GitHub
parent 0e90bda3c7
commit db0bcf7da3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -122,10 +122,16 @@ export default definePlugin({
{
find: "Copy image not supported",
replacement: {
match: /(?<=(?:canSaveImage|canCopyImage)\(\i?\)\{.{0,50})!\i\.isPlatformEmbedded/g,
replacement: [
{
match: /(?<=(?:canSaveImage|canCopyImage)\(.{0,120}?)!\i\.isPlatformEmbedded/g,
replace: "false"
},
{
match: /canCopyImage\(.+?(?=return"function"==typeof \i\.clipboard\.copyImage)/,
replace: "$&return true;"
}
]
},
// Add back Copy & Save Image
{
@ -137,7 +143,7 @@ export default definePlugin({
replace: "false"
},
{
match: /return\s*?\[.{0,50}?(?=\?.{0,100}?id:"copy-image")/,
match: /return\s*?\[.{0,50}?(?=\?\(0,\i\.jsxs?.{0,100}?id:"copy-image")/,
replace: "return [true"
},
{