mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 21:49:25 +08:00
fix: vditor cdn use local resources (#6229)
This commit is contained in:
parent
e99c1cd9b3
commit
e33fc10f00
@ -27,12 +27,6 @@ export class PluginFieldMarkdownVditorClient extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getCDN() {
|
getCDN() {
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
|
||||||
// 开发模式下使用远程 cdn
|
|
||||||
return 'https://unpkg.com/vditor@3.10.4';
|
|
||||||
}
|
|
||||||
// 生产环境,使用本地链接,支持内网
|
|
||||||
// 需要支持子目录,比如应用部署在 /xxx/ 目录下
|
|
||||||
return this.app.getPublicPath() + 'static/plugins/@nocobase/plugin-field-markdown-vditor/dist/client/vditor';
|
return this.app.getPublicPath() + 'static/plugins/@nocobase/plugin-field-markdown-vditor/dist/client/vditor';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,13 +8,26 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Plugin } from '@nocobase/server';
|
import { Plugin } from '@nocobase/server';
|
||||||
|
import fs from 'fs-extra';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
export class PluginFieldMarkdownVditorServer extends Plugin {
|
export class PluginFieldMarkdownVditorServer extends Plugin {
|
||||||
async afterAdd() {}
|
async afterAdd() {}
|
||||||
|
|
||||||
async beforeLoad() {}
|
async beforeLoad() {}
|
||||||
|
|
||||||
async load() {}
|
async load() {
|
||||||
|
await this.copyVditorDist();
|
||||||
|
}
|
||||||
|
|
||||||
|
async copyVditorDist() {
|
||||||
|
const vditor = path.dirname(require.resolve('vditor'));
|
||||||
|
const dist = path.resolve(__dirname, '../../dist/client/vditor/dist');
|
||||||
|
if (await fs.exists(dist)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await fs.copy(vditor, dist);
|
||||||
|
}
|
||||||
|
|
||||||
async install() {}
|
async install() {}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user