Skip to content

Commit 5e1b7e0

Browse files
committed
feat: 解决跨域抓取问题
1 parent dc0843e commit 5e1b7e0

5 files changed

Lines changed: 5 additions & 5 deletions

File tree

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/preview.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@slimkit/plus-editor",
3-
"version": "1.2.5",
3+
"version": "1.2.6",
44
"description": "rich-text editor for plus",
55
"main": "dist/main.bundle.js",
66
"repository": "git@github.com:mutoe/plus-editor.git",

src/caller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function callMethod(fnName: string, params: any = undefined) {
3030
}
3131
} else {
3232
// not in webview
33-
// tryHijackUploadCall(fnName, params)
33+
tryHijackUploadCall(fnName, params)
3434
return false
3535
}
3636

src/uploader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ async function uploadRemoteImage(params: {
327327
})
328328
img.addEventListener('error', () => reject())
329329
img.crossOrigin = 'anonymous'
330-
img.src = params.src
330+
img.src = `${apiV2BaseUrl.replace(/\/+/, '')}/crawl?url=${encodeURIComponent(params.src)}`
331331
})
332332

333333
const spark = new Spark.ArrayBuffer()

0 commit comments

Comments
 (0)