diff --git a/scripts/preset-editor.js b/scripts/preset-editor.js index 24b2fe12..0ea6b4dd 100644 --- a/scripts/preset-editor.js +++ b/scripts/preset-editor.js @@ -16,16 +16,24 @@ const { distFolder, sleep } = require('./common'); const LAKE_EDITOR_VERSION = '1.11.0'; +const lakeIconURL = 'https://mdn.alipayobjects.com/design_kitchencore/afts/file/HWy0Q7LuuV0AAAAAAAAAAAAADhulAQBr'; + const remoteAssetsUrls = { lakejs: { src: `https://gw.alipayobjects.com/render/p/yuyan_npm/@alipay_lakex-doc/${LAKE_EDITOR_VERSION}/umd/doc.umd.js`, after: (content) => { - return content.replace(`https://mdn.alipayobjects.com/design_kitchencore/afts/file/HWy0Q7LuuV0AAAAAAAAAAAAADhulAQBr`, './HWy0Q7LuuV0AAAAAAAAAAAAADhulAQBr'); + return content.replace(lakeIconURL, './lake-editor-icon.js'); }, }, lakecss: `https://gw.alipayobjects.com/render/p/yuyan_npm/@alipay_lakex-doc/${LAKE_EDITOR_VERSION}/umd/doc.css`, - antdcss: 'https://gw.alipayobjects.com/os/lib/antd/4.24.13/dist/antd.css', - lakeIcon: 'https://mdn.alipayobjects.com/design_kitchencore/afts/file/HWy0Q7LuuV0AAAAAAAAAAAAADhulAQBr', + antdcss: { + src: 'https://gw.alipayobjects.com/os/lib/antd/4.24.13/dist/antd.css', + name: 'antd.4.24.13.css', + }, + lakeIcon: { + src: lakeIconURL, + name: 'lake-editor-icon.js', + }, codemirror: 'https://gw.alipayobjects.com/render/p/yuyan_v/180020010000005484/7.1.4/CodeMirror.js', tracert_a385: 'https://ur.alipay.com/tracert_a385.js', }; @@ -65,14 +73,10 @@ module.exports.presetEditor = async function main() { const urls = Object.values(remoteAssetsUrls); for (let i = 0; i < urls.length; i++) { - let url = urls[i]; - let afterLoad = null; - if(typeof url !== 'string') { - afterLoad = url.after; - url = url.src; - } - console.info('url', url); - const fileName = url.split('/').pop(); + const asset = urls[i]; + const url = typeof asset === 'string' ? asset : asset.src; + const afterLoad = typeof asset === 'string' ? null : asset.after; + const fileName = asset.name || url.split('/').pop(); const localFilename = path.resolve(distFolder, fileName); mkdirSync(distFolder, { recursive: true }); await downloadFile(url, localFilename, afterLoad); diff --git a/src/manifest.json b/src/manifest.json index 254e80ea..af82aeac 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -34,8 +34,8 @@ "CodeMirror.js", "katex.min.js", "tracert_a385.js", - "antd.css", - "HWy0Q7LuuV0AAAAAAAAAAAAADhulAQBr", + "antd.4.24.13.css", + "lake-editor-icon.js", "react.production.min.js", "react-dom.production.min.js", "yuque-transform-script.js"