@wenyan-md/core 3.0.9 → 3.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.js +9 -0
- package/dist/wechat.js +5 -1
- package/dist/wrapper.js +4 -2
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -996,6 +996,15 @@ function wechatPostRender(element) {
|
|
|
996
996
|
}
|
|
997
997
|
li.appendChild(section);
|
|
998
998
|
});
|
|
999
|
+
const nestedLists = element.querySelectorAll(
|
|
1000
|
+
"li > section > ul, li > section > ol"
|
|
1001
|
+
);
|
|
1002
|
+
nestedLists.forEach((nestedList) => {
|
|
1003
|
+
const li = nestedList.closest("li");
|
|
1004
|
+
if (li) {
|
|
1005
|
+
li.insertAdjacentElement("afterend", nestedList);
|
|
1006
|
+
}
|
|
1007
|
+
});
|
|
999
1008
|
element.style.color = "rgb(0, 0, 0)";
|
|
1000
1009
|
element.style.caretColor = "rgb(0, 0, 0)";
|
|
1001
1010
|
}
|
package/dist/wechat.js
CHANGED
|
@@ -40,9 +40,13 @@ function createWechatClient(httpAdapter) {
|
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
+
const WECHAT_ERROR_HINTS = {
|
|
44
|
+
45166: "内容超长。小绿书模式有内容长度限制,请精简正文后重试。"
|
|
45
|
+
};
|
|
43
46
|
function assertWechatSuccess(data) {
|
|
44
47
|
if ("errcode" in data) {
|
|
45
|
-
|
|
48
|
+
const hint = WECHAT_ERROR_HINTS[data.errcode];
|
|
49
|
+
throw new Error(hint ? `${data.errcode}: ${hint} (${data.errmsg})` : `${data.errcode}: ${data.errmsg}`);
|
|
46
50
|
}
|
|
47
51
|
}
|
|
48
52
|
export {
|
package/dist/wrapper.js
CHANGED
|
@@ -269,7 +269,8 @@ function needUpload(url) {
|
|
|
269
269
|
return !/^(https?:\/\/|data:|asset:\/\/)/i.test(url);
|
|
270
270
|
}
|
|
271
271
|
async function uploadLocalImage(originalUrl, serverUrl, headers, relativePath) {
|
|
272
|
-
const
|
|
272
|
+
const decodedUrl = decodeURIComponent(originalUrl);
|
|
273
|
+
const imagePath = RuntimeEnv.resolveLocalPath(decodedUrl, relativePath);
|
|
273
274
|
let fileBuffer;
|
|
274
275
|
try {
|
|
275
276
|
fileBuffer = await readBinaryFile(imagePath);
|
|
@@ -435,7 +436,8 @@ async function uploadImage(imageUrl, accessToken, fileName, relativePath, appId)
|
|
|
435
436
|
const contentType = response.headers.get("content-type") || "image/jpeg";
|
|
436
437
|
fileData = new Blob([arrayBuffer], { type: contentType });
|
|
437
438
|
} else {
|
|
438
|
-
const
|
|
439
|
+
const decodedUrl = decodeURIComponent(imageUrl);
|
|
440
|
+
const resolvedPath = RuntimeEnv.resolveLocalPath(decodedUrl, relativePath);
|
|
439
441
|
const stats = await stat(resolvedPath);
|
|
440
442
|
if (stats.size === 0) {
|
|
441
443
|
throw new Error(`本地图片大小为0,无法上传: ${resolvedPath}`);
|
package/package.json
CHANGED