We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
hexo clean && hexo s
文章丢失样式。
使用 hexo-blog-encrypt 加密文章时,如果之前输入过密码,文章会失去样式。 原因是这段:
if (document.getElementById('hbePass')) { Fluid.utils.waitElementLoaded('hbe-prefix', function() { var hbePrefix = document.querySelector('hbe-prefix'); hbePrefix.parentElement.classList.add('markdown-body'); Fluid.utils.retry(function() { if (Fluid.boot && Fluid.boot.refresh) { Fluid.boot.refresh(); return true; } }, 100, 10); }) }
hexo-blog-encrypt 会保存密码,如果之前有正确的密码则会自动解密,这段脚本有属性 defer,会在页面加载完后才执行,所以如果之前输入过密码则会导致 id 为 hbePass 的密码输入框已经被删除,则不会重新进行所需的操作。并且由于解密操作是异步的,很可能没法在正常执行这些操作之前解密完成。最终导致如果输过密码则丢失样式。
if (document.getElementById('hbePass') || document.querySelector('hbe-prefix')) { Fluid.utils.waitElementLoaded('hbe-prefix', function() { var hbePrefix = document.querySelector('hbe-prefix'); hbePrefix.parentElement.classList.add('markdown-body'); hbePrefix.parentElement.removeChild(hbePrefix); Fluid.utils.retry(function() { if (Fluid.boot && Fluid.boot.refresh) { Fluid.boot.refresh(); return true; } }, 100, 10); }) }
如果改成这样能正确加载样式。
这是二级标题,但并没有相应的样式。
The text was updated successfully, but these errors were encountered:
经查找,应修改 /layout/_partials/plugins/encrypt.ejs 中的代码。
/layout/_partials/plugins/encrypt.ejs
Sorry, something went wrong.
🐛 修复 hexo-blog-encrypt 插件丢失样式 #895
f8c77bf
Fixed in v1.9.5
No branches or pull requests
请确认
hexo clean && hexo s
,并且清除浏览器缓存,仍可复现Bug 描述
文章丢失样式。
复现步骤
使用 hexo-blog-encrypt 加密文章时,如果之前输入过密码,文章会失去样式。
原因是这段:
hexo-blog-encrypt 会保存密码,如果之前有正确的密码则会自动解密,这段脚本有属性 defer,会在页面加载完后才执行,所以如果之前输入过密码则会导致 id 为 hbePass 的密码输入框已经被删除,则不会重新进行所需的操作。并且由于解密操作是异步的,很可能没法在正常执行这些操作之前解密完成。最终导致如果输过密码则丢失样式。
如果改成这样能正确加载样式。
截图
这是二级标题,但并没有相应的样式。
The text was updated successfully, but these errors were encountered: