From 82af07593e26287997c7d0d1efbfd7170a1f3b40 Mon Sep 17 00:00:00 2001 From: Yedda Wang Date: Fri, 14 Mar 2025 16:18:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=9B=A0=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=B9=B3=E5=8F=B0=E7=BC=96=E8=BE=91=E5=99=A8?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=80=8C=E5=AF=BC=E8=87=B4=E7=9A=84=E6=96=B0?= =?UTF-8?q?=E5=85=AC=E5=BC=8F=E6=8F=92=E5=85=A5=E5=A4=B1=E8=B4=A5=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=88#11=EF=BC=89=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mpMath/assets/js/mpm-inject.js | 10 +++++++++- mpMath/manifest.json | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/mpMath/assets/js/mpm-inject.js b/mpMath/assets/js/mpm-inject.js index fa903eb..dc51b97 100644 --- a/mpMath/assets/js/mpm-inject.js +++ b/mpMath/assets/js/mpm-inject.js @@ -24,7 +24,15 @@ var readyStateCheckInterval = setInterval(function() { editing.innerHTML = event.data.text.substring(beg, end); editingMode = false; // 还原为非编辑模式 } else { - window.UE.getEditor('js_editor').execCommand('insertHTML', '\xA0' + event.data.text + '\xA0'); + window.__MP_Editor_JSAPI__.invoke({ + apiName: 'mp_editor_insert_html', + apiParam: { + html: '\xA0' + event.data.text + '\xA0', + isSelect: false + }, + sucCb: (res) => {console.log('设置成功', res)}, + errCb: (err) => {console.log('设置失败', err)} + }) } } } diff --git a/mpMath/manifest.json b/mpMath/manifest.json index 884f6cb..bf0678e 100644 --- a/mpMath/manifest.json +++ b/mpMath/manifest.json @@ -4,7 +4,7 @@ "description": "微信公众号公式插件.", "permissions": ["storage", "declarativeContent", "activeTab", "scripting"], "background": { - "background.service_worker": "assets/js/background.js", + "service_worker": "assets/js/background.js", "type": "module" }, "action": {