🚧 Change the code block style settings.

This commit is contained in:
凡梦星尘
2022-06-29 08:56:13 +08:00
parent 748c44e25d
commit b9cd603c04
5 changed files with 44 additions and 37 deletions

View File

@@ -10,7 +10,7 @@ if (!window.NexT) window.NexT = {};
"darkmode" : {{ .Site.Params.darkmode }},
"version" : "{{ .Site.Data.config.version }}",
"sidebar" : {{ .Site.Params.sidebar | jsonify }},
"copycode" : {{ .Site.Params.codeblock.copyBtn | jsonify }},
"copybtn" : {{ .Site.Params.codeblock.copyBtn }},
"bookmark" : {{ .Site.Params.bookmark | jsonify }},
"comments" : {{ .Site.Params.comments | jsonify }},
"mediumzoom" : {{ .Site.Params.mediumzoom }},

View File

@@ -45,7 +45,7 @@ NexT.boot.refresh = function() {
CONFIG.pangu && window.pangu.spacingPage();
CONFIG.isPage && NexT.utils.replacePostCRLink();
CONFIG.isPage && NexT.utils.registerCopyCode();
CONFIG.isPage && CONFIG.copybtn && NexT.utils.registerCopyCode();
NexT.utils.registerTabsTag();
/*NexT.utils.registerActiveMenuItem();
NexT.utils.registerLangSelect();*/

View File

@@ -41,7 +41,7 @@ NexT.utils = {
*/
registerCopyCode: function() {
let figure = document.querySelectorAll('.highlight pre');
if (figure.length === 0 || !CONFIG.copycode) return;
if (figure.length === 0 || !CONFIG.copybtn) return;
figure.forEach(element => {
let cn = element.querySelector('code').className;
// TODO seems hard code need find other ways fixed it.