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

代码复制按钮无法正常显示 #825

Closed
ce-amtic opened this issue Dec 28, 2020 · 10 comments
Closed

代码复制按钮无法正常显示 #825

ce-amtic opened this issue Dec 28, 2020 · 10 comments
Labels
bug:extension Issues about widgets, comment, share, search, and plugins.

Comments

@ce-amtic
Copy link

ce-amtic commented Dec 28, 2020

Bug描述
初次打开网页时,代码框的复制按钮无法正常显示,按 Ctrl+R 刷新后依然不能显示(如图),但是按 Shift+F5 刷新后又可以显示。

反复确认主题配置并未发现问题。去看了一下您的 demo,发现存在同样的问题,想不到是出于什么原因。

截图
无标题

@ppoffice
Copy link
Owner

请按照issue模板列出你的主题配置以及浏览器环境

@ppoffice ppoffice added the not following issue template Issues that are not following the issue templates. label Dec 28, 2020
@ce-amtic
Copy link
Author

主题配置

article:
    highlight:
        theme: atom-one-light
        clipboard: true
        fold: folded
    thumbnail: true
    readtime: true
    licenses:

浏览器是 Google Chrome 87.0,另外使用 Firefox 浏览器(版本不是很清楚)测试过,也存在同样的问题。

@ppoffice
Copy link
Owner

CDN呢?

@ce-amtic
Copy link
Author

providers:
    cdn: jsdelivr
    fontcdn: google
    iconcdn: https://cdn.bootcss.com/font-awesome/5.13.0/css/all.css

图标用了国内的 CDN,会不会是这个原因?

@ppoffice
Copy link
Owner

ppoffice commented Dec 31, 2020

@ce-amtic 可能是你的网络环境无法正确加载jsdelivr。 请参照https://ppoffice.github.io/hexo-theme-icarus/Configuration/icarus%E7%94%A8%E6%88%B7%E6%8C%87%E5%8D%97-cdn%E6%8F%90%E4%BE%9B%E5%95%86/ 将你的CDN换为loli.net

@ppoffice ppoffice added discussion Any questions about this theme. and removed not following issue template Issues that are not following the issue templates. labels Dec 31, 2020
@ce-amtic
Copy link
Author

ce-amtic commented Jan 1, 2021

已经替换 CDN 配置,但是问题依然存在。

providers:
    cdn: loli
    fontcdn: loli
    iconcdn: loli

发现 clipboard.js 已经成功加载,但是

<div class="level-right">
    <a href="javascript:;" class="copy" title="Copy" data-clipboard-target="#code-1609503773896788 .code">
        <i class="fas fa-copy"></i>
    </a>
</div>

这段代码有时会变成这个样子

<div class="level-right">
</div>

两种情况下均能找到 clipboard.js

屏幕截图 2021-01-01 202010

我发现您的 demo 也存在同样的问题,是我的网络环境导致的吗?

无标题

@ppoffice
Copy link
Owner

ppoffice commented Jan 1, 2021

@ce-amtic 更换浏览器或者使用隐私模式浏览网页观察是否有同样问题。记得禁用所有第三方插件。

@hamlinzheng
Copy link

+1,同样的问题。
更换过多个CDN、Chrome的普通模式以及隐私模式、Edge浏览器访问都会出现上述不出现复制按钮的情况(补充:第一次进入页面是能加载出复制按钮的,但是F5刷新后复制按钮就不见了),使用Ctrl+F5刷新后复制按钮重新出现。
另外通过观察,访问使用旧版Icarus主题的博客没有这个问题,新版(4.0+)似乎都有这个问题。

@ppoffice ppoffice added bug:extension Issues about widgets, comment, share, search, and plugins. and removed discussion Any questions about this theme. labels Jan 1, 2021
@ppoffice
Copy link
Owner

ppoffice commented Jan 1, 2021

@hamlinzheng @ce-amtic 请更新主题至最新commit。

@ce-amtic
Copy link
Author

ce-amtic commented Jan 2, 2021

已经解决问题,非常感谢!

@ce-amtic ce-amtic closed this as completed Jan 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:extension Issues about widgets, comment, share, search, and plugins.
Projects
None yet
Development

No branches or pull requests

3 participants