Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

简化 CDN 配置 #1522

Closed
fangjue opened this issue Dec 15, 2023 · 2 comments
Closed

简化 CDN 配置 #1522

fangjue opened this issue Dec 15, 2023 · 2 comments
Assignees
Milestone

Comments

@fangjue
Copy link

fangjue commented Dec 15, 2023

描述问题

近日所在网络环境无法访问 unpkg.com,使用 cdn 属性指定自建 CDN 后,仍有少量资源通过 unpkg.com 访问,包括主题 CSS(例如 /dist/css/content-theme/light.css)与 Emoji 图片(例如 /dist/images/emoji/hacpai.png)。要使这些资源也使用自建 CDN,需要额外设置其他选项,较为麻烦,编辑器与预览选项还有一些差异。

期待的结果

只要设置好 cdn 这一个属性,所有资源都能通过自建 CDN 访问。

版本信息

  • 版本:3.9.7
  • 操作系统:Windows 11
  • 浏览器:Edge 120

其他信息

完全使用自建 CDN 所需的完整选项实例:

const CDN = '/third_party/vditor'

// 编辑器选项
new Vditor('vditor', {
  cdn: CDN,
  preview: {
    theme: {
      current: 'light',
      path: `${CDN}/dist/css/content-theme`,
    },
  },
  hint: {
    emojiPath: `${CDN}/dist/images/emoji`,
  },
})

// 预览选项
Vditor.preview(el, content, {
    cdn: CDN,
    mode: 'light',
    theme: {
      current: 'light',
      path: `${CDN}/dist/css/content-theme`,
    },
    emojiPath: `${CDN}/dist/images/emoji`,
})
@Vanessa219 Vanessa219 changed the title 使用 cdn 属性配置自建 CDN 后仍有来自 unpkg.com 的请求 简化 CDN 配置 Dec 15, 2023
@Vanessa219 Vanessa219 self-assigned this Dec 15, 2023
@Vanessa219 Vanessa219 added this to the 3.9 milestone Dec 15, 2023
Vanessa219 added a commit that referenced this issue Dec 15, 2023
@ooahz
Copy link

ooahz commented Mar 23, 2024

请问下,改进后的版本是不是只需要配置一个cdn属性就行了

@Vanessa219
Copy link
Owner

嗯嗯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants