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使用相对地址/相对协议时css被重复加载 #1606

Closed
lz6060788 opened this issue Apr 10, 2024 · 1 comment
Closed

cdn使用相对地址/相对协议时css被重复加载 #1606

lz6060788 opened this issue Apr 10, 2024 · 1 comment

Comments

@lz6060788
Copy link
Contributor

编辑模式

任何模式

描述问题

由于在内网环境访问不到cdn,于是我把cdn资源搬到了我的nuxt服务上,因此设置的cdn地址为相对地址。
此时引入代码高亮主题的js在判断link元素的href前后一致时有误。

const vditorHljsStyle = document.getElementById("vditorHljsStyle") as HTMLLinkElement;
const href = `${cdn}/dist/js/highlight.js/styles/${style}.css`;
// .href将获取到dom的完整地址,.getAttribute('href')才能够获取到相对地址,与href变量计算一致。
if (vditorHljsStyle && vditorHljsStyle.href !== href) {
    vditorHljsStyle.remove();
}

期待的结果

支持相对地址/相对协议

截屏或录像

image
image

版本信息

  • 版本:3.9.1
  • 操作系统:windows 10
  • 浏览器:chrome 123.0.6312.106

其他信息

lz6060788 added a commit to lz6060788/vditor that referenced this issue Apr 10, 2024
Vanessa219 pushed a commit that referenced this issue Apr 16, 2024
@Vanessa219
Copy link
Owner

#1607

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

No branches or pull requests

2 participants