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

cnd preview path 重复加载问题 #1230

Closed
de1ck opened this issue May 13, 2022 · 1 comment
Closed

cnd preview path 重复加载问题 #1230

de1ck opened this issue May 13, 2022 · 1 comment
Assignees
Milestone

Comments

@de1ck
Copy link

de1ck commented May 13, 2022

theme.path 每次调用会加载 content-theme/light.css highlight.js/styles/github.css

Vditor.preview(previewElement!, props.text ?? '', {
    mode: 'light',
    cdn: VDITOR_CDN,
    theme: {
      current: 'light',
      path: `${VDITOR_CDN}/dist/css/content-theme`,
    },
    // markdown: {
    //   toc: true,
    //   listStyle: true,
    // },
    // anchor: 1,
  });

new Vditor 多次调用会加载 css/content-theme/light.css

new Vditor(vditorRef.value!, {
    ...bindProps,
    cdn: VDITOR_CDN,
    i18n: {
      ...window.VditorI18n,
      upload: '上传图片',
    },
    preview: {
      theme: {
        current: 'light',
        path: `${VDITOR_CDN}/dist/css/content-theme`,
      },
    },
});
@de1ck
Copy link
Author

de1ck commented May 13, 2022

研究了一下, document.href 会自动加载域名路径,因为我设置的是 /vditor 这种路径,如果使用getAttribute('href') 就不会有这问题

docment.getAttribute('href')

或者设置加上域名的cdn路径

image

@Vanessa219 Vanessa219 self-assigned this May 16, 2022
@Vanessa219 Vanessa219 added this to the 3.8 milestone May 16, 2022
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

2 participants