Plugin Directory

Changeset 2994656


Ignore:
Timestamp:
11/12/2023 10:10:57 AM (2 years ago)
Author:
looswebstudio
Message:

Update to version 2.0.0 from GitHub

Location:
highlighting-code-block
Files:
20 added
10 deleted
58 edited
1 copied

Legend:

Unmodified
Added
Removed
  • highlighting-code-block/tags/2.0.0/build/css/hcb--dark.css

    r2886197 r2994656  
    1 .hcb_wrap.hcb_wrap{display:block;margin-bottom:2em;margin-top:2em;padding:0;position:relative;z-index:0}.hcb_wrap.hcb_wrap pre{-webkit-overflow-scrolling:touch;border-radius:0;box-sizing:border-box;display:block;font-family:var(--hcb-font-family,"Menlo","Consolas","Hiragino Kaku Gothic ProN","Hiragino Sans","Meiryo",sans-serif);font-size:var(--hcb-font-size,14px);letter-spacing:.1px;line-height:1;margin:0;overflow:auto;padding:1.75em 1.5em;position:static}.hcb_wrap.hcb_wrap code,.hcb_wrap.hcb_wrap pre{word-wrap:normal;background:var(--hcb-color--bg,#f7f6f6);border:none;color:var(--hcb-color--text,#1f1e1e);-webkit-hyphens:none;hyphens:none;-o-tab-size:4;tab-size:4;text-align:left;text-shadow:0 1px var(--hcb-color--text-shadow,#fff);white-space:pre;word-break:normal;word-spacing:normal}.hcb_wrap.hcb_wrap code,.hcb_wrap.hcb_wrap span{box-sizing:border-box;font-family:inherit;font-size:inherit;line-height:1.5;margin:0;padding:0}.hcb_wrap .line-highlight{background:var(--hcb-color--highlight,hsla(24,20%,49%,.1));font-size:inherit;left:0;line-height:inherit;margin-top:1.75em;padding:0;pointer-events:none;position:absolute;right:0;white-space:pre}.hcb_wrap .line-highlight:before,.hcb_wrap .line-highlight[data-end]:after{background-color:var(--hcb-color--highlight-bg,#b1aead);border-radius:0;box-sizing:border-box;color:var(--hcb-color--highlight-text,#f5f2f0);content:attr(data-start);font-size:12px;font-weight:700;left:0;line-height:inherit;min-width:1.5em;padding:1px 2px;position:absolute;text-align:center;text-shadow:none;top:0;vertical-align:middle}.hcb_wrap .line-highlight[data-end]:after{bottom:0;content:attr(data-end);top:auto}.hcb_wrap .line-numbers .line-highlight:after,.hcb_wrap .line-numbers .line-highlight:before{content:none}.hcb_wrap pre.line-numbers{counter-reset:linenumber;padding-left:3.75em;position:static}.hcb_wrap pre.line-numbers>code{position:relative;white-space:inherit}.hcb_wrap .line-numbers .line-numbers-rows{border-right:1px solid var(--hcb-color--line-numbers,#999);font-size:inherit;left:-3.75em;letter-spacing:-1px;pointer-events:none;position:absolute;top:-2px;-webkit-user-select:none;user-select:none;width:3em}.hcb_wrap .line-numbers-rows>span{counter-increment:linenumber;display:block;pointer-events:none}.hcb_wrap .line-numbers-rows>span:before{color:var(--hcb-color--line-numbers,#999);content:counter(linenumber);display:block;padding-right:.8em;text-align:right}.hcb_wrap pre:before{background-color:var(--hcb-color--lang--bg,#dedede);box-sizing:border-box;color:var(--hcb-color--lang--text,#1f1e1e);content:attr(data-lang);font-family:Arial,Helvetica,sans-serif;font-size:12px;line-height:20px;min-width:4em;padding:0 10px;position:absolute;right:0;text-align:center;top:0;z-index:1}.hcb_wrap .hcb-clipboard+pre:before{right:26px}.hcb_wrap pre[data-file]:before{background-image:var(--hcb-file-icon);background-position:center left 8px;background-repeat:no-repeat;background-size:auto 10px;content:attr(data-file);padding:0 8px 0 20px}.hcb_wrap pre[data-show-lang="0"]:not([data-file]):before{content:none}.hcb_wrap .hcb-clipboard{background-color:hsla(0,0%,100%,.8);background-image:url(../../assets/img/clipborad.svg);background-position:50%;background-repeat:no-repeat;background-size:16px auto;border:none;border-radius:1px;box-sizing:border-box;height:20px;padding:0;position:absolute;right:0;text-align:center;top:0;width:20px;z-index:1}.hcb_wrap .hcb-clipboard.-done{background-image:url(../../assets/img/copied.svg)}.hcb_wrap .hcb-clipboard.-done:before{bottom:100%;content:"Copied!";font-family:Arial,Helvetica,sans-serif;font-size:14px;line-height:1.5;position:absolute;right:0}.hcb_wrap pre::-webkit-scrollbar{height:6px}.hcb_wrap pre::-webkit-scrollbar-track{background:var(--hcb-color--scrollbar-track,hsla(0,0%,59%,.1));border:none}.hcb_wrap pre::-webkit-scrollbar-thumb{background:var(--hcb-color--scrollbar-thumb,hsla(0,0%,59%,.25));border-radius:3px}:not(pre)>code.prism{border-radius:.3em;padding:.1em;white-space:normal}body{--hcb-color--text:#f8f8f2;--hcb-color--text-shadow:rg1a1a1ab(136,132,132);--hcb-color--bg:#34352e;--hcb-color--lang--text:#fff;--hcb-color--lang--bg:#111;--hcb-color--line-numbers:#999;--hcb-color--highlight:rgba(255,250,245,.1);--hcb-color--highlight-text:#fcfcfc;--hcb-color--highlight-bg:#afa7a166;--hcb-file-icon:url(../../assets/img/file-icon-dark.svg);--hcb-color--scrollbar-track:hsla(0,0%,100%,.1);--hcb-color--scrollbar-thumb:hsla(0,0%,100%,.2)}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#a8a897}.token.punctuation{color:#f8f8f2}.namespace{opacity:.7}.token.constant,.token.deleted,.token.important,.token.property,.token.symbol,.token.tag{color:#ff2c78}.token.boolean,.token.number{color:#ae81ff}.token.attr-name,.token.builtin,.token.char,.token.class-name,.token.inserted,.token.selector{color:#b4ec43}.language-css .token.string,.style .token.string,.token.entity,.token.operator,.token.url,.token.variable{color:#f8f8f2}.token.atrule,.token.attr-value,.token.function,.token.string{color:#f3e880}.token.function,.token.keyword.def{color:#5fe6ff}.token.keyword,.token.operator{color:#f92672}.token.keyword.this,.token.regex{color:#fd971f}.token.delimiter:not(.symbol){color:#5294ff}.token.bold{font-weight:700}.token.builtin,.token.italic,.token.keyword.def{font-style:italic}.token.entity{cursor:help}.language-css .token.property,.language-json .token.property,.language-scss .token.property{color:#5fe6ff}.language-php .token.important.delimiter{font-weight:400}.language-ruby .token.interpolation{color:#f8f8f2}.language-json .token.operator{color:#f3e880}@media screen and (max-width:599px){.hcb_wrap.hcb_wrap pre{font-size:var(--hcb-font-size--mobile,13px)}}
     1:root{--hcb--fz:var(--hcb--fz--base,14px);--hcb--ff:"Menlo","Consolas","Hiragino Kaku Gothic ProN","Hiragino Sans","Meiryo",sans-serif;--hcb--pY:1.75em;--hcb--pX:1.5em;--hcb--radius:3px;--hcb--linenumW:3.5ch;--hcb--data-label:attr(data-lang);--hcb--btn-offset:20px;--hcb--c:#1f1e1e;--hcb--tsh:unset;--hcb--bgc:#f8f6f6;--hcb--data-label--c:#1f1e1e;--hcb--data-label--bgc:#e8e8e8;--hcb--line-numbers--c:#999;--hcb--highlight-color:#9678641a;--hcb--file-icon:url(../../assets/img/file-icon-light.svg);--hcb--scbar-track--bgc:#9696961a;--hcb--scbar-thumb--bgc:#96969640}.hcb_wrap.hcb_wrap{display:block;font-size:var(--hcb--fz,14px);margin-bottom:2em;margin-top:2em;padding:0;position:relative;z-index:0}.hcb_wrap.hcb_wrap>pre{-webkit-overflow-scrolling:touch;border-radius:var(--hcb--radius,0);box-sizing:border-box;display:block;font-family:var(--hcb--ff);font-size:inherit;letter-spacing:.1px;line-height:1.5;margin:0;overflow:auto;padding:var(--hcb--pY) var(--hcb--pX);position:static}.hcb_wrap.hcb_wrap>pre,.hcb_wrap.hcb_wrap>pre>code{word-wrap:normal;background:var(--hcb--bgc);border:none;color:var(--hcb--c);-webkit-hyphens:none;hyphens:none;tab-size:4;text-align:left;text-shadow:var(--hcb--tsh);white-space:pre;word-break:normal;word-spacing:normal}.hcb_wrap.hcb_wrap :is(code,span){box-sizing:border-box;font-family:inherit;font-size:inherit;line-height:inherit;margin:0;padding:0}.hcb_wrap .line-highlight{background:var(--hcb--highlight-color);font-size:inherit;left:0;line-height:inherit;margin-top:var(--hcb--pY);padding:0;pointer-events:none;position:absolute;right:0;white-space:pre}.hcb_wrap>.prism.line-numbers{counter-reset:linenumber;padding-left:calc(var(--hcb--pX) + var(--hcb--linenumW));position:static}.hcb_wrap>.prism.line-numbers>code{position:relative;white-space:inherit}.hcb_wrap .line-numbers-rows{border-right:1px solid var(--hcb--line-numbers--c);font-size:inherit;left:calc(-1px - var(--hcb--linenumW) - var(--hcb--pX)/2);min-width:var(--hcb--linenumW);pointer-events:none;position:absolute;top:-.125em;-webkit-user-select:none;user-select:none}.hcb_wrap .line-numbers-rows>span{counter-increment:linenumber;display:block;letter-spacing:-.25px;pointer-events:none;text-align:center}.hcb_wrap .line-numbers-rows>span:before{color:var(--hcb--line-numbers--c);content:counter(linenumber);display:block}.hcb_wrap>pre::-webkit-scrollbar{height:6px}.hcb_wrap>pre::-webkit-scrollbar-track{background:var(--hcb--scbar-track--bgc);border:none}.hcb_wrap>pre::-webkit-scrollbar-thumb{background:var(--hcb--scbar-thumb--bgc);border-radius:3px}:not(pre)>code.prism{border-radius:.3em;padding:.1em;white-space:normal}.hcb_wrap>pre:before{background-color:var(--hcb--data-label--bgc);border-radius:0 var(--hcb--radius);box-sizing:border-box;color:var(--hcb--data-label--c);content:var(--hcb--data-label);font-family:inherit;font-size:.925em;line-height:20px;min-width:4em;padding:0 10px;position:absolute;right:0;text-align:center;top:0;z-index:1}.hcb_wrap>pre[data-show-lang="0"]{--hcb--data-label:none}.hcb_wrap>pre[data-show-lang="1"]{--hcb--data-label:attr(data-lang)}.hcb_wrap>pre[data-file]:before{background-image:var(--hcb--file-icon);background-position:center left 8px;background-repeat:no-repeat;background-size:auto 10px;content:attr(data-file);padding:0 8px 0 20px}.hcb_wrap{--hcb-clipbtn-opacity:0}.hcb-clipboard:focus-visible,.hcb_wrap:hover{--hcb-clipbtn-opacity:100}.hcb-clipboard{-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);background:url(../../assets/img/clipboard-to-copy.svg) no-repeat 50%/64% auto;background-color:#fafafacc;border:none;border-radius:3px;box-shadow:0 1px 2px #3d3d3d40;box-sizing:border-box;color:#000;height:2.25em;opacity:var(--hcb-clipbtn-opacity);padding:0;position:absolute;right:8px;text-align:center;top:calc(var(--hcb--btn-offset, 0px) + 8px);transition:opacity .25s;width:2.25em;z-index:2}[data-show-lang="0"]+.hcb-clipboard{--hcb--btn-offset:0px}[data-show-lang="1"]+.hcb-clipboard{--hcb--btn-offset:20px}.hcb-clipboard.-done{background-image:url(../../assets/img/clipboard-copied.svg)}.hcb-clipboard.-done:before{background-color:inherit;border-radius:8px;color:inherit;content:"✓Copied";display:block;font-family:Arial,Helvetica,sans-serif;font-size:12px;line-height:1;padding:2px 4px 2px 2px;position:absolute;right:calc(4px + 100%);top:50%;translate:0 -50%}:root{--hcb--c:#f9f9f6;--hcb--bgc:#2d2e29;--hcb--data-label--c:#fff;--hcb--data-label--bgc:#20211f;--hcb--line-numbers--c:#a3a3a3;--hcb--highlight-color:#fffaf51a;--hcb--file-icon:url(../../assets/img/file-icon-dark.svg);--hcb--scbar-track--bgc:#ffffff1a;--hcb--scbar-thumb--bgc:#fff3}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#a8a897}.token.punctuation{color:#f8f8f2}.namespace{opacity:.7}.token.constant,.token.deleted,.token.important,.token.property,.token.symbol,.token.tag{color:#ff2c78}.token.boolean,.token.number{color:#ae81ff}.token.attr-name,.token.builtin,.token.char,.token.class-name,.token.inserted,.token.selector{color:#b4ec43}.language-css .token.string,.style .token.string,.token.entity,.token.operator,.token.url,.token.variable{color:#f8f8f2}.token.atrule,.token.attr-value,.token.function,.token.string{color:#f3e880}.token.function,.token.keyword.def{color:#5fe6ff}.token.keyword,.token.operator{color:#f92672}.token.keyword.this,.token.regex{color:#fd971f}.token.delimiter:not(.symbol){color:#5294ff}.token.bold{font-weight:700}.token.builtin,.token.italic,.token.keyword.def{font-style:italic}.token.entity{cursor:help}.language-css .token.property,.language-json .token.property,.language-scss .token.property{color:#5fe6ff}.language-php .token.important.delimiter{font-weight:400}.language-ruby .token.interpolation{color:#f8f8f2}.language-json .token.operator{color:#f3e880}@media screen and (max-width:599px){:root{--hcb--fz:var(--hcb--fz--mobile,13px)}}
  • highlighting-code-block/tags/2.0.0/build/css/hcb--light.css

    r2886197 r2994656  
    1 .hcb_wrap.hcb_wrap{display:block;margin-bottom:2em;margin-top:2em;padding:0;position:relative;z-index:0}.hcb_wrap.hcb_wrap pre{-webkit-overflow-scrolling:touch;border-radius:0;box-sizing:border-box;display:block;font-family:var(--hcb-font-family,"Menlo","Consolas","Hiragino Kaku Gothic ProN","Hiragino Sans","Meiryo",sans-serif);font-size:var(--hcb-font-size,14px);letter-spacing:.1px;line-height:1;margin:0;overflow:auto;padding:1.75em 1.5em;position:static}.hcb_wrap.hcb_wrap code,.hcb_wrap.hcb_wrap pre{word-wrap:normal;background:var(--hcb-color--bg,#f7f6f6);border:none;color:var(--hcb-color--text,#1f1e1e);-webkit-hyphens:none;hyphens:none;-o-tab-size:4;tab-size:4;text-align:left;text-shadow:0 1px var(--hcb-color--text-shadow,#fff);white-space:pre;word-break:normal;word-spacing:normal}.hcb_wrap.hcb_wrap code,.hcb_wrap.hcb_wrap span{box-sizing:border-box;font-family:inherit;font-size:inherit;line-height:1.5;margin:0;padding:0}.hcb_wrap .line-highlight{background:var(--hcb-color--highlight,hsla(24,20%,49%,.1));font-size:inherit;left:0;line-height:inherit;margin-top:1.75em;padding:0;pointer-events:none;position:absolute;right:0;white-space:pre}.hcb_wrap .line-highlight:before,.hcb_wrap .line-highlight[data-end]:after{background-color:var(--hcb-color--highlight-bg,#b1aead);border-radius:0;box-sizing:border-box;color:var(--hcb-color--highlight-text,#f5f2f0);content:attr(data-start);font-size:12px;font-weight:700;left:0;line-height:inherit;min-width:1.5em;padding:1px 2px;position:absolute;text-align:center;text-shadow:none;top:0;vertical-align:middle}.hcb_wrap .line-highlight[data-end]:after{bottom:0;content:attr(data-end);top:auto}.hcb_wrap .line-numbers .line-highlight:after,.hcb_wrap .line-numbers .line-highlight:before{content:none}.hcb_wrap pre.line-numbers{counter-reset:linenumber;padding-left:3.75em;position:static}.hcb_wrap pre.line-numbers>code{position:relative;white-space:inherit}.hcb_wrap .line-numbers .line-numbers-rows{border-right:1px solid var(--hcb-color--line-numbers,#999);font-size:inherit;left:-3.75em;letter-spacing:-1px;pointer-events:none;position:absolute;top:-2px;-webkit-user-select:none;user-select:none;width:3em}.hcb_wrap .line-numbers-rows>span{counter-increment:linenumber;display:block;pointer-events:none}.hcb_wrap .line-numbers-rows>span:before{color:var(--hcb-color--line-numbers,#999);content:counter(linenumber);display:block;padding-right:.8em;text-align:right}.hcb_wrap pre:before{background-color:var(--hcb-color--lang--bg,#dedede);box-sizing:border-box;color:var(--hcb-color--lang--text,#1f1e1e);content:attr(data-lang);font-family:Arial,Helvetica,sans-serif;font-size:12px;line-height:20px;min-width:4em;padding:0 10px;position:absolute;right:0;text-align:center;top:0;z-index:1}.hcb_wrap .hcb-clipboard+pre:before{right:26px}.hcb_wrap pre[data-file]:before{background-image:var(--hcb-file-icon);background-position:center left 8px;background-repeat:no-repeat;background-size:auto 10px;content:attr(data-file);padding:0 8px 0 20px}.hcb_wrap pre[data-show-lang="0"]:not([data-file]):before{content:none}.hcb_wrap .hcb-clipboard{background-color:hsla(0,0%,100%,.8);background-image:url(../../assets/img/clipborad.svg);background-position:50%;background-repeat:no-repeat;background-size:16px auto;border:none;border-radius:1px;box-sizing:border-box;height:20px;padding:0;position:absolute;right:0;text-align:center;top:0;width:20px;z-index:1}.hcb_wrap .hcb-clipboard.-done{background-image:url(../../assets/img/copied.svg)}.hcb_wrap .hcb-clipboard.-done:before{bottom:100%;content:"Copied!";font-family:Arial,Helvetica,sans-serif;font-size:14px;line-height:1.5;position:absolute;right:0}.hcb_wrap pre::-webkit-scrollbar{height:6px}.hcb_wrap pre::-webkit-scrollbar-track{background:var(--hcb-color--scrollbar-track,hsla(0,0%,59%,.1));border:none}.hcb_wrap pre::-webkit-scrollbar-thumb{background:var(--hcb-color--scrollbar-thumb,hsla(0,0%,59%,.25));border-radius:3px}:not(pre)>code.prism{border-radius:.3em;padding:.1em;white-space:normal}body{--hcb-color--text:#1f1e1e;--hcb-color--text-shadow:#fff;--hcb-color--bg:#f7f6f6;--hcb-color--lang--text:#1f1e1e;--hcb-color--lang--bg:#dedede;--hcb-color--line-numbers:#999;--hcb-color--highlight:hsla(24,20%,49%,.1);--hcb-color--highlight-text:#f5f2f0;--hcb-color--highlight-bg:#b1aead;--hcb-file-icon:url(../../assets/img/file-icon-light.svg);--hcb-color--scrollbar-track:rgba(0,0,0,.05);--hcb-color--scrollbar-thumb:#0000001a}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#708090}.token.punctuation{color:#5f5f5f}.namespace{opacity:.7}.token.boolean,.token.constant,.token.deleted,.token.number,.token.property,.token.symbol,.token.tag{color:#905}.token.attr-name,.token.builtin,.token.char,.token.class-name,.token.inserted,.token.selector,.token.string{color:#407b08}.language-css .token.string,.style .token.string,.token.entity,.token.url{color:#9a6e3a}.token.atrule,.token.attr-value,.token.function{color:#07a}.token.keyword,.token.operator{color:#c72c4c}.token.important,.token.keyword.this,.token.regex,.token.variable{color:#f18106}.token.bold{font-weight:700}.token.builtin,.token.italic,.token.keyword.def{font-style:italic}.token.entity{cursor:help}.token.delimiter.important{color:#183d86;font-weight:400}@media screen and (max-width:599px){.hcb_wrap.hcb_wrap pre{font-size:var(--hcb-font-size--mobile,13px)}}
     1:root{--hcb--fz:var(--hcb--fz--base,14px);--hcb--ff:"Menlo","Consolas","Hiragino Kaku Gothic ProN","Hiragino Sans","Meiryo",sans-serif;--hcb--pY:1.75em;--hcb--pX:1.5em;--hcb--radius:3px;--hcb--linenumW:3.5ch;--hcb--data-label:attr(data-lang);--hcb--btn-offset:20px;--hcb--c:#1f1e1e;--hcb--tsh:unset;--hcb--bgc:#f8f6f6;--hcb--data-label--c:#1f1e1e;--hcb--data-label--bgc:#e8e8e8;--hcb--line-numbers--c:#999;--hcb--highlight-color:#9678641a;--hcb--file-icon:url(../../assets/img/file-icon-light.svg);--hcb--scbar-track--bgc:#9696961a;--hcb--scbar-thumb--bgc:#96969640}.hcb_wrap.hcb_wrap{display:block;font-size:var(--hcb--fz,14px);margin-bottom:2em;margin-top:2em;padding:0;position:relative;z-index:0}.hcb_wrap.hcb_wrap>pre{-webkit-overflow-scrolling:touch;border-radius:var(--hcb--radius,0);box-sizing:border-box;display:block;font-family:var(--hcb--ff);font-size:inherit;letter-spacing:.1px;line-height:1.5;margin:0;overflow:auto;padding:var(--hcb--pY) var(--hcb--pX);position:static}.hcb_wrap.hcb_wrap>pre,.hcb_wrap.hcb_wrap>pre>code{word-wrap:normal;background:var(--hcb--bgc);border:none;color:var(--hcb--c);-webkit-hyphens:none;hyphens:none;tab-size:4;text-align:left;text-shadow:var(--hcb--tsh);white-space:pre;word-break:normal;word-spacing:normal}.hcb_wrap.hcb_wrap :is(code,span){box-sizing:border-box;font-family:inherit;font-size:inherit;line-height:inherit;margin:0;padding:0}.hcb_wrap .line-highlight{background:var(--hcb--highlight-color);font-size:inherit;left:0;line-height:inherit;margin-top:var(--hcb--pY);padding:0;pointer-events:none;position:absolute;right:0;white-space:pre}.hcb_wrap>.prism.line-numbers{counter-reset:linenumber;padding-left:calc(var(--hcb--pX) + var(--hcb--linenumW));position:static}.hcb_wrap>.prism.line-numbers>code{position:relative;white-space:inherit}.hcb_wrap .line-numbers-rows{border-right:1px solid var(--hcb--line-numbers--c);font-size:inherit;left:calc(-1px - var(--hcb--linenumW) - var(--hcb--pX)/2);min-width:var(--hcb--linenumW);pointer-events:none;position:absolute;top:-.125em;-webkit-user-select:none;user-select:none}.hcb_wrap .line-numbers-rows>span{counter-increment:linenumber;display:block;letter-spacing:-.25px;pointer-events:none;text-align:center}.hcb_wrap .line-numbers-rows>span:before{color:var(--hcb--line-numbers--c);content:counter(linenumber);display:block}.hcb_wrap>pre::-webkit-scrollbar{height:6px}.hcb_wrap>pre::-webkit-scrollbar-track{background:var(--hcb--scbar-track--bgc);border:none}.hcb_wrap>pre::-webkit-scrollbar-thumb{background:var(--hcb--scbar-thumb--bgc);border-radius:3px}:not(pre)>code.prism{border-radius:.3em;padding:.1em;white-space:normal}.hcb_wrap>pre:before{background-color:var(--hcb--data-label--bgc);border-radius:0 var(--hcb--radius);box-sizing:border-box;color:var(--hcb--data-label--c);content:var(--hcb--data-label);font-family:inherit;font-size:.925em;line-height:20px;min-width:4em;padding:0 10px;position:absolute;right:0;text-align:center;top:0;z-index:1}.hcb_wrap>pre[data-show-lang="0"]{--hcb--data-label:none}.hcb_wrap>pre[data-show-lang="1"]{--hcb--data-label:attr(data-lang)}.hcb_wrap>pre[data-file]:before{background-image:var(--hcb--file-icon);background-position:center left 8px;background-repeat:no-repeat;background-size:auto 10px;content:attr(data-file);padding:0 8px 0 20px}.hcb_wrap{--hcb-clipbtn-opacity:0}.hcb-clipboard:focus-visible,.hcb_wrap:hover{--hcb-clipbtn-opacity:100}.hcb-clipboard{-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);background:url(../../assets/img/clipboard-to-copy.svg) no-repeat 50%/64% auto;background-color:#fafafacc;border:none;border-radius:3px;box-shadow:0 1px 2px #3d3d3d40;box-sizing:border-box;color:#000;height:2.25em;opacity:var(--hcb-clipbtn-opacity);padding:0;position:absolute;right:8px;text-align:center;top:calc(var(--hcb--btn-offset, 0px) + 8px);transition:opacity .25s;width:2.25em;z-index:2}[data-show-lang="0"]+.hcb-clipboard{--hcb--btn-offset:0px}[data-show-lang="1"]+.hcb-clipboard{--hcb--btn-offset:20px}.hcb-clipboard.-done{background-image:url(../../assets/img/clipboard-copied.svg)}.hcb-clipboard.-done:before{background-color:inherit;border-radius:8px;color:inherit;content:"✓Copied";display:block;font-family:Arial,Helvetica,sans-serif;font-size:12px;line-height:1;padding:2px 4px 2px 2px;position:absolute;right:calc(4px + 100%);top:50%;translate:0 -50%}:root{--hcb--tsh:1px 1px 0px #f0f0f0}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#708090}.token.punctuation{color:#5f5f5f}.namespace{opacity:.7}.token.boolean,.token.constant,.token.deleted,.token.number,.token.property,.token.symbol,.token.tag{color:#905}.token.attr-name,.token.builtin,.token.char,.token.class-name,.token.inserted,.token.selector,.token.string{color:#407b08}.language-css .token.string,.style .token.string,.token.entity,.token.url{color:#9a6e3a}.token.atrule,.token.attr-value,.token.function{color:#07a}.token.keyword,.token.operator{color:#c72c4c}.token.important,.token.keyword.this,.token.regex,.token.variable{color:#f18106}.token.bold{font-weight:700}.token.builtin,.token.italic,.token.keyword.def{font-style:italic}.token.entity{cursor:help}.token.delimiter.important{color:#183d86;font-weight:400}@media screen and (max-width:599px){:root{--hcb--fz:var(--hcb--fz--mobile,13px)}}
  • highlighting-code-block/tags/2.0.0/build/css/hcb-editor--dark.css

    r2886197 r2994656  
    1 .mce-content-body .hcb_wrap{margin:2em 0}.hcb_wrap.hcb_wrap{border:1px solid #f1f1f1;position:relative}.hcb_wrap.hcb_wrap pre,.hcb_wrap.hcb_wrap textarea.hcb_textarea{background:var(--hcb-color--bg,#f7f6f6);border:none;border-radius:0;box-sizing:border-box;color:var(--hcb-color--text,#1f1e1e);display:block;font-family:var(--hcb-font-family,"Menlo","Consolas","Hiragino Kaku Gothic ProN","Hiragino Sans","Meiryo",sans-serif);font-size:var(--hcb-font-size,14px);line-height:1.8;margin:0!important;overflow-wrap:break-word;overflow-x:auto;padding:1.5em;position:static;-o-tab-size:2;tab-size:2;white-space:pre!important;width:100%}.hcb_wrap .hcb_codewrap{background:var(--hcb-color--bg,#f7f6f6);color:var(--hcb-color--text,#1f1e1e);padding-right:1em;position:relative}.hcb_wrap pre::-webkit-scrollbar,.hcb_wrap textarea.hcb_textarea::-webkit-scrollbar{border:none;height:8px}.hcb_wrap pre::-webkit-scrollbar-track,.hcb_wrap textarea.hcb_textarea::-webkit-scrollbar-track{background:#f7f7f7;border:none}.hcb_wrap pre::-webkit-scrollbar-thumb,.hcb_wrap textarea.hcb_textarea::-webkit-scrollbar-thumb{background:rgba(0,0,0,.1);border-radius:4px}.hcb_wrap textarea.hcb_textarea{box-shadow:none;outline:none;resize:none}.hcb_wrap pre code{background:inherit!important;color:inherit!important;display:block;font-family:inherit!important;padding:0!important;-o-tab-size:2;tab-size:2}.hcb_wrap .hcb_controls{display:flex;flex-wrap:wrap;padding:8px}.hcb_wrap .hcb_controls:after{clear:both;content:"";display:block;height:0;visibility:hidden}.hcb_wrap .hcb_controls .components-base-control{flex-basis:50%;max-width:25rem}.hcb_wrap .hcb_controls .components-base-control select{width:100%}.hcb_wrap .hcb_controls .filename_input{flex-basis:20%;height:28px;line-height:28px;margin-left:auto;min-width:10em;padding:0 8px}.hcb_wrap .hcb_controls .num_input{flex-basis:20%;height:28px;line-height:28px;margin-left:16px;min-width:10em;padding:0 8px}.hcb_wrap .hcb_linenum{border-right:1px solid hsla(0,0%,59%,.5);display:none;height:calc(100% - 2em);left:1em;position:absolute;top:1em;width:0}.hcb-block[data-show-linenum] .hcb_linenum{display:block}.hcb-block[data-show-linenum] textarea.hcb_textarea{margin-left:2em!important;padding-left:.5em;width:calc(100% - 2em)}.hcb-block:before,.hcb_wrap pre:before{background-color:var(--hcb-color--lang--bg,#dedede);box-sizing:border-box;color:var(--hcb-color--lang--text,#1f1e1e);content:attr(data-lang);font-family:Arial,Helvetica,sans-serif;font-size:12px;line-height:20px;min-width:4em;padding:0 10px;position:absolute;right:0;text-align:center;top:0;z-index:1}.hcb-block[data-file]:before{background-image:var(--hcb-file-icon);background-position:center left 8px;background-repeat:no-repeat;background-size:auto 10px;content:attr(data-file);padding:0 8px 0 20px}.hcb-block[data-show-lang="0"]:not([data-file]):before{content:none}.wp-embed-responsive.editor-styles-wrapper .hcb_controls,[data-type="loos-hcb/code-block"]:not(.is-selected) .hcb_controls{display:none}body{--hcb-color--text:#f8f8f2;--hcb-color--text-shadow:rg1a1a1ab(136,132,132);--hcb-color--bg:#34352e;--hcb-color--lang--text:#fff;--hcb-color--lang--bg:#111;--hcb-file-icon:url(../../assets/img/file-icon-dark.svg)}.hcb_wrap textarea.hcb_textarea::placeholder{color:hsla(0,0%,100%,.4);font-style:italic}.hcb_wrap textarea.hcb_textarea::-moz-placeholder,.hcb_wrap textarea.hcb_textarea::-ms-input-placeholder,.hcb_wrap textarea.hcb_textarea::-webkit-input-placeholder{color:hsla(0,0%,100%,.4);font-style:italic}
     1:root{--hcb--fz:var(--hcb--fz--base,14px);--hcb--ff:"Menlo","Consolas","Hiragino Kaku Gothic ProN","Hiragino Sans","Meiryo",sans-serif;--hcb--pY:1.75em;--hcb--radius:3px;--hcb--linenumW:3.5ch;--hcb--data-label:attr(data-lang);--hcb--btn-offset:20px;--hcb--c:#1f1e1e;--hcb--tsh:unset;--hcb--bgc:#f8f6f6;--hcb--data-label--c:#1f1e1e;--hcb--data-label--bgc:#e8e8e8;--hcb--line-numbers--c:#999;--hcb--highlight-color:#9678641a;--hcb--file-icon:url(../../assets/img/file-icon-light.svg);--hcb--scbar-track--bgc:#9696961a;--hcb--scbar-thumb--bgc:#96969640}.hcb-code-in-label{font-size:.95em;padding:2px;text-transform:lowercase}.hcb-datapreview{background-color:inherit;border-radius:var(--hcb--radius);bottom:var(--hcb--scbarH,0);color:inherit;display:flex;flex-wrap:wrap;font-size:12px;gap:4px;line-height:1.25;opacity:.75;padding:2px 4px;position:absolute;right:0}.mce-content-body .hcb_wrap{margin:2em 0}:root{--hcb--pY:2em;--hcb--pX:1.5em;--hcb--linenumW:3em}.hcb_wrap{position:relative}.hcb_wrap>.hcb_codewrap{background:var(--hcb--bgc);border-radius:var(--hcb--radius);color:var(--hcb--c);padding-right:.75em;position:relative}.hcb_codewrap,.hcb_textarea,.hcb_wrap>pre{background:var(--hcb--bgc)!important;color:var(--hcb--c)!important;font-family:var(--hcb--ff)!important;font-size:var(--hcb--fz,14px)!important;line-height:1.5!important}.hcb_textarea.hcb_textarea,.hcb_wrap.hcb_wrap>pre{border:none;border-radius:0;box-sizing:border-box;display:block;margin:0!important;overflow-wrap:break-word;overflow-x:auto;padding:var(--hcb--pY) var(--hcb--pX);position:static;tab-size:4;white-space:pre!important;width:100%}.hcb_textarea.hcb_textarea::-webkit-scrollbar,.hcb_wrap.hcb_wrap>pre::-webkit-scrollbar{border:none;height:6px}.hcb_textarea.hcb_textarea::-webkit-scrollbar-track,.hcb_wrap.hcb_wrap>pre::-webkit-scrollbar-track{background:var(--hcb--scbar-track--bgc);border:none}.hcb_textarea.hcb_textarea::-webkit-scrollbar-thumb,.hcb_wrap.hcb_wrap>pre::-webkit-scrollbar-thumb{background:var(--hcb--scbar-thumb--bgc);border-radius:3px}.hcb_textarea.hcb_textarea{box-shadow:none;height:calc(1.5em*var(--hcb--code-linenum, 1) + var(--hcb--pY)*2 + var(--hcb--scbarH, 0px));outline:none;resize:none}.hcb_textarea.hcb_textarea::placeholder{color:inherit;font-style:italic;opacity:.5}.hcb_textarea.hcb_textarea::-moz-placeholder,.hcb_textarea.hcb_textarea::-ms-input-placeholder,.hcb_textarea.hcb_textarea::-webkit-input-placeholder{color:inherit;font-style:italic;opacity:.5}.hcb_wrap>pre code{background:inherit!important;color:inherit!important;display:block;font-family:inherit!important;padding:0!important;tab-size:2}.hcb_linenum{border-right:1px solid;color:var(--hcb--line-numbers--c);height:calc(100% - var(--hcb--pY)*2);left:calc(var(--hcb--linenumW)/2 + .5em);position:absolute;top:var(--hcb--pY);width:0}.hcb_linenum>.hcb-startNum{word-wrap:normal;font:inherit;font-size:.95em;line-height:1.5;position:absolute;right:.5em;right:calc(.95em - 1px);top:0;translate:50%;white-space:nowrap}.hcb-block[data-show-linenum] .hcb_codewrap{padding-left:calc(var(--hcb--linenumW)/2 + 1em)}.hcb-block[data-show-linenum] .hcb_textarea{padding-left:calc(var(--hcb--linenumW)/2 - 1em)}.hcb-block:before,.hcb_wrap>pre:before{background-color:var(--hcb--data-label--bgc);border-radius:0 var(--hcb--radius);box-sizing:border-box;color:var(--hcb--data-label--c);content:var(--hcb--data-label);font-family:inherit;font-size:.925em;line-height:20px;min-width:4em;padding:0 10px;position:absolute;right:0;text-align:center;top:0;z-index:1}.hcb-block[data-show-lang="0"]{--hcb--data-label:none}.hcb-block[data-show-lang="1"]{--hcb--data-label:attr(data-lang)}.hcb-block[data-file]:before{background-image:var(--hcb--file-icon);background-position:center left 8px;background-repeat:no-repeat;background-size:auto 10px;content:attr(data-file);padding:0 8px 0 20px}:root{--hcb--c:#f8f8f2;--hcb--bgc:#34352e;--hcb--data-label--c:#fff;--hcb--data-label--bgc:#111;--hcb--file-icon:url(../../assets/img/file-icon-dark.svg);--hcb--scbar-track--bgc:#ffffff1a;--hcb--scbar-thumb--bgc:#fff3}@media screen and (max-width:599px){:root{--hcb--fz:var(--hcb--fz--mobile,13px)}}
  • highlighting-code-block/tags/2.0.0/build/css/hcb-editor--light.css

    r2886197 r2994656  
    1 .mce-content-body .hcb_wrap{margin:2em 0}.hcb_wrap.hcb_wrap{border:1px solid #f1f1f1;position:relative}.hcb_wrap.hcb_wrap pre,.hcb_wrap.hcb_wrap textarea.hcb_textarea{background:var(--hcb-color--bg,#f7f6f6);border:none;border-radius:0;box-sizing:border-box;color:var(--hcb-color--text,#1f1e1e);display:block;font-family:var(--hcb-font-family,"Menlo","Consolas","Hiragino Kaku Gothic ProN","Hiragino Sans","Meiryo",sans-serif);font-size:var(--hcb-font-size,14px);line-height:1.8;margin:0!important;overflow-wrap:break-word;overflow-x:auto;padding:1.5em;position:static;-o-tab-size:2;tab-size:2;white-space:pre!important;width:100%}.hcb_wrap .hcb_codewrap{background:var(--hcb-color--bg,#f7f6f6);color:var(--hcb-color--text,#1f1e1e);padding-right:1em;position:relative}.hcb_wrap pre::-webkit-scrollbar,.hcb_wrap textarea.hcb_textarea::-webkit-scrollbar{border:none;height:8px}.hcb_wrap pre::-webkit-scrollbar-track,.hcb_wrap textarea.hcb_textarea::-webkit-scrollbar-track{background:#f7f7f7;border:none}.hcb_wrap pre::-webkit-scrollbar-thumb,.hcb_wrap textarea.hcb_textarea::-webkit-scrollbar-thumb{background:rgba(0,0,0,.1);border-radius:4px}.hcb_wrap textarea.hcb_textarea{box-shadow:none;outline:none;resize:none}.hcb_wrap pre code{background:inherit!important;color:inherit!important;display:block;font-family:inherit!important;padding:0!important;-o-tab-size:2;tab-size:2}.hcb_wrap .hcb_controls{display:flex;flex-wrap:wrap;padding:8px}.hcb_wrap .hcb_controls:after{clear:both;content:"";display:block;height:0;visibility:hidden}.hcb_wrap .hcb_controls .components-base-control{flex-basis:50%;max-width:25rem}.hcb_wrap .hcb_controls .components-base-control select{width:100%}.hcb_wrap .hcb_controls .filename_input{flex-basis:20%;height:28px;line-height:28px;margin-left:auto;min-width:10em;padding:0 8px}.hcb_wrap .hcb_controls .num_input{flex-basis:20%;height:28px;line-height:28px;margin-left:16px;min-width:10em;padding:0 8px}.hcb_wrap .hcb_linenum{border-right:1px solid hsla(0,0%,59%,.5);display:none;height:calc(100% - 2em);left:1em;position:absolute;top:1em;width:0}.hcb-block[data-show-linenum] .hcb_linenum{display:block}.hcb-block[data-show-linenum] textarea.hcb_textarea{margin-left:2em!important;padding-left:.5em;width:calc(100% - 2em)}.hcb-block:before,.hcb_wrap pre:before{background-color:var(--hcb-color--lang--bg,#dedede);box-sizing:border-box;color:var(--hcb-color--lang--text,#1f1e1e);content:attr(data-lang);font-family:Arial,Helvetica,sans-serif;font-size:12px;line-height:20px;min-width:4em;padding:0 10px;position:absolute;right:0;text-align:center;top:0;z-index:1}.hcb-block[data-file]:before{background-image:var(--hcb-file-icon);background-position:center left 8px;background-repeat:no-repeat;background-size:auto 10px;content:attr(data-file);padding:0 8px 0 20px}.hcb-block[data-show-lang="0"]:not([data-file]):before{content:none}.wp-embed-responsive.editor-styles-wrapper .hcb_controls,[data-type="loos-hcb/code-block"]:not(.is-selected) .hcb_controls{display:none}body{--hcb-color--text:#1f1e1e;--hcb-color--text-shadow:#fff;--hcb-color--bg:#f7f6f6;--hcb-color--lang--text:#1f1e1e;--hcb-color--lang--bg:#dedede;--hcb-file-icon:url(../../assets/img/file-icon-light.svg)}
     1:root{--hcb--fz:var(--hcb--fz--base,14px);--hcb--ff:"Menlo","Consolas","Hiragino Kaku Gothic ProN","Hiragino Sans","Meiryo",sans-serif;--hcb--pY:1.75em;--hcb--radius:3px;--hcb--linenumW:3.5ch;--hcb--data-label:attr(data-lang);--hcb--btn-offset:20px;--hcb--c:#1f1e1e;--hcb--tsh:unset;--hcb--bgc:#f8f6f6;--hcb--data-label--c:#1f1e1e;--hcb--data-label--bgc:#e8e8e8;--hcb--line-numbers--c:#999;--hcb--highlight-color:#9678641a;--hcb--file-icon:url(../../assets/img/file-icon-light.svg);--hcb--scbar-track--bgc:#9696961a;--hcb--scbar-thumb--bgc:#96969640}.hcb-code-in-label{font-size:.95em;padding:2px;text-transform:lowercase}.hcb-datapreview{background-color:inherit;border-radius:var(--hcb--radius);bottom:var(--hcb--scbarH,0);color:inherit;display:flex;flex-wrap:wrap;font-size:12px;gap:4px;line-height:1.25;opacity:.75;padding:2px 4px;position:absolute;right:0}.mce-content-body .hcb_wrap{margin:2em 0}:root{--hcb--pY:2em;--hcb--pX:1.5em;--hcb--linenumW:3em}.hcb_wrap{position:relative}.hcb_wrap>.hcb_codewrap{background:var(--hcb--bgc);border-radius:var(--hcb--radius);color:var(--hcb--c);padding-right:.75em;position:relative}.hcb_codewrap,.hcb_textarea,.hcb_wrap>pre{background:var(--hcb--bgc)!important;color:var(--hcb--c)!important;font-family:var(--hcb--ff)!important;font-size:var(--hcb--fz,14px)!important;line-height:1.5!important}.hcb_textarea.hcb_textarea,.hcb_wrap.hcb_wrap>pre{border:none;border-radius:0;box-sizing:border-box;display:block;margin:0!important;overflow-wrap:break-word;overflow-x:auto;padding:var(--hcb--pY) var(--hcb--pX);position:static;tab-size:4;white-space:pre!important;width:100%}.hcb_textarea.hcb_textarea::-webkit-scrollbar,.hcb_wrap.hcb_wrap>pre::-webkit-scrollbar{border:none;height:6px}.hcb_textarea.hcb_textarea::-webkit-scrollbar-track,.hcb_wrap.hcb_wrap>pre::-webkit-scrollbar-track{background:var(--hcb--scbar-track--bgc);border:none}.hcb_textarea.hcb_textarea::-webkit-scrollbar-thumb,.hcb_wrap.hcb_wrap>pre::-webkit-scrollbar-thumb{background:var(--hcb--scbar-thumb--bgc);border-radius:3px}.hcb_textarea.hcb_textarea{box-shadow:none;height:calc(1.5em*var(--hcb--code-linenum, 1) + var(--hcb--pY)*2 + var(--hcb--scbarH, 0px));outline:none;resize:none}.hcb_textarea.hcb_textarea::placeholder{color:inherit;font-style:italic;opacity:.5}.hcb_textarea.hcb_textarea::-moz-placeholder,.hcb_textarea.hcb_textarea::-ms-input-placeholder,.hcb_textarea.hcb_textarea::-webkit-input-placeholder{color:inherit;font-style:italic;opacity:.5}.hcb_wrap>pre code{background:inherit!important;color:inherit!important;display:block;font-family:inherit!important;padding:0!important;tab-size:2}.hcb_linenum{border-right:1px solid;color:var(--hcb--line-numbers--c);height:calc(100% - var(--hcb--pY)*2);left:calc(var(--hcb--linenumW)/2 + .5em);position:absolute;top:var(--hcb--pY);width:0}.hcb_linenum>.hcb-startNum{word-wrap:normal;font:inherit;font-size:.95em;line-height:1.5;position:absolute;right:.5em;right:calc(.95em - 1px);top:0;translate:50%;white-space:nowrap}.hcb-block[data-show-linenum] .hcb_codewrap{padding-left:calc(var(--hcb--linenumW)/2 + 1em)}.hcb-block[data-show-linenum] .hcb_textarea{padding-left:calc(var(--hcb--linenumW)/2 - 1em)}.hcb-block:before,.hcb_wrap>pre:before{background-color:var(--hcb--data-label--bgc);border-radius:0 var(--hcb--radius);box-sizing:border-box;color:var(--hcb--data-label--c);content:var(--hcb--data-label);font-family:inherit;font-size:.925em;line-height:20px;min-width:4em;padding:0 10px;position:absolute;right:0;text-align:center;top:0;z-index:1}.hcb-block[data-show-lang="0"]{--hcb--data-label:none}.hcb-block[data-show-lang="1"]{--hcb--data-label:attr(data-lang)}.hcb-block[data-file]:before{background-image:var(--hcb--file-icon);background-position:center left 8px;background-repeat:no-repeat;background-size:auto 10px;content:attr(data-file);padding:0 8px 0 20px}@media screen and (max-width:599px){:root{--hcb--fz:var(--hcb--fz--mobile,13px)}}
  • highlighting-code-block/tags/2.0.0/build/css/hcb.css

    r2886197 r2994656  
    1 .hcb_wrap.hcb_wrap{display:block;margin-bottom:2em;margin-top:2em;padding:0;position:relative;z-index:0}.hcb_wrap.hcb_wrap pre{-webkit-overflow-scrolling:touch;border-radius:0;box-sizing:border-box;display:block;font-family:var(--hcb-font-family,"Menlo","Consolas","Hiragino Kaku Gothic ProN","Hiragino Sans","Meiryo",sans-serif);font-size:var(--hcb-font-size,14px);letter-spacing:.1px;line-height:1;margin:0;overflow:auto;padding:1.75em 1.5em;position:static}.hcb_wrap.hcb_wrap code,.hcb_wrap.hcb_wrap pre{word-wrap:normal;background:var(--hcb-color--bg,#f7f6f6);border:none;color:var(--hcb-color--text,#1f1e1e);-webkit-hyphens:none;hyphens:none;-o-tab-size:4;tab-size:4;text-align:left;text-shadow:0 1px var(--hcb-color--text-shadow,#fff);white-space:pre;word-break:normal;word-spacing:normal}.hcb_wrap.hcb_wrap code,.hcb_wrap.hcb_wrap span{box-sizing:border-box;font-family:inherit;font-size:inherit;line-height:1.5;margin:0;padding:0}.hcb_wrap .line-highlight{background:var(--hcb-color--highlight,hsla(24,20%,49%,.1));font-size:inherit;left:0;line-height:inherit;margin-top:1.75em;padding:0;pointer-events:none;position:absolute;right:0;white-space:pre}.hcb_wrap .line-highlight:before,.hcb_wrap .line-highlight[data-end]:after{background-color:var(--hcb-color--highlight-bg,#b1aead);border-radius:0;box-sizing:border-box;color:var(--hcb-color--highlight-text,#f5f2f0);content:attr(data-start);font-size:12px;font-weight:700;left:0;line-height:inherit;min-width:1.5em;padding:1px 2px;position:absolute;text-align:center;text-shadow:none;top:0;vertical-align:middle}.hcb_wrap .line-highlight[data-end]:after{bottom:0;content:attr(data-end);top:auto}.hcb_wrap .line-numbers .line-highlight:after,.hcb_wrap .line-numbers .line-highlight:before{content:none}.hcb_wrap pre.line-numbers{counter-reset:linenumber;padding-left:3.75em;position:static}.hcb_wrap pre.line-numbers>code{position:relative;white-space:inherit}.hcb_wrap .line-numbers .line-numbers-rows{border-right:1px solid var(--hcb-color--line-numbers,#999);font-size:inherit;left:-3.75em;letter-spacing:-1px;pointer-events:none;position:absolute;top:-2px;-webkit-user-select:none;user-select:none;width:3em}.hcb_wrap .line-numbers-rows>span{counter-increment:linenumber;display:block;pointer-events:none}.hcb_wrap .line-numbers-rows>span:before{color:var(--hcb-color--line-numbers,#999);content:counter(linenumber);display:block;padding-right:.8em;text-align:right}.hcb_wrap pre:before{background-color:var(--hcb-color--lang--bg,#dedede);box-sizing:border-box;color:var(--hcb-color--lang--text,#1f1e1e);content:attr(data-lang);font-family:Arial,Helvetica,sans-serif;font-size:12px;line-height:20px;min-width:4em;padding:0 10px;position:absolute;right:0;text-align:center;top:0;z-index:1}.hcb_wrap .hcb-clipboard+pre:before{right:26px}.hcb_wrap pre[data-file]:before{background-image:var(--hcb-file-icon);background-position:center left 8px;background-repeat:no-repeat;background-size:auto 10px;content:attr(data-file);padding:0 8px 0 20px}.hcb_wrap pre[data-show-lang="0"]:not([data-file]):before{content:none}.hcb_wrap .hcb-clipboard{background-color:hsla(0,0%,100%,.8);background-image:url(../../assets/img/clipborad.svg);background-position:50%;background-repeat:no-repeat;background-size:16px auto;border:none;border-radius:1px;box-sizing:border-box;height:20px;padding:0;position:absolute;right:0;text-align:center;top:0;width:20px;z-index:1}.hcb_wrap .hcb-clipboard.-done{background-image:url(../../assets/img/copied.svg)}.hcb_wrap .hcb-clipboard.-done:before{bottom:100%;content:"Copied!";font-family:Arial,Helvetica,sans-serif;font-size:14px;line-height:1.5;position:absolute;right:0}.hcb_wrap pre::-webkit-scrollbar{height:6px}.hcb_wrap pre::-webkit-scrollbar-track{background:var(--hcb-color--scrollbar-track,hsla(0,0%,59%,.1));border:none}.hcb_wrap pre::-webkit-scrollbar-thumb{background:var(--hcb-color--scrollbar-thumb,hsla(0,0%,59%,.25));border-radius:3px}:not(pre)>code.prism{border-radius:.3em;padding:.1em;white-space:normal}@media screen and (max-width:599px){.hcb_wrap.hcb_wrap pre{font-size:var(--hcb-font-size--mobile,13px)}}
     1:root{--hcb--fz:var(--hcb--fz--base,14px);--hcb--ff:"Menlo","Consolas","Hiragino Kaku Gothic ProN","Hiragino Sans","Meiryo",sans-serif;--hcb--pY:1.75em;--hcb--pX:1.5em;--hcb--radius:3px;--hcb--linenumW:3.5ch;--hcb--data-label:attr(data-lang);--hcb--btn-offset:20px;--hcb--c:#1f1e1e;--hcb--tsh:unset;--hcb--bgc:#f8f6f6;--hcb--data-label--c:#1f1e1e;--hcb--data-label--bgc:#e8e8e8;--hcb--line-numbers--c:#999;--hcb--highlight-color:#9678641a;--hcb--file-icon:url(../../assets/img/file-icon-light.svg);--hcb--scbar-track--bgc:#9696961a;--hcb--scbar-thumb--bgc:#96969640}.hcb_wrap.hcb_wrap{display:block;font-size:var(--hcb--fz,14px);margin-bottom:2em;margin-top:2em;padding:0;position:relative;z-index:0}.hcb_wrap.hcb_wrap>pre{-webkit-overflow-scrolling:touch;border-radius:var(--hcb--radius,0);box-sizing:border-box;display:block;font-family:var(--hcb--ff);font-size:inherit;letter-spacing:.1px;line-height:1.5;margin:0;overflow:auto;padding:var(--hcb--pY) var(--hcb--pX);position:static}.hcb_wrap.hcb_wrap>pre,.hcb_wrap.hcb_wrap>pre>code{word-wrap:normal;background:var(--hcb--bgc);border:none;color:var(--hcb--c);-webkit-hyphens:none;hyphens:none;tab-size:4;text-align:left;text-shadow:var(--hcb--tsh);white-space:pre;word-break:normal;word-spacing:normal}.hcb_wrap.hcb_wrap :is(code,span){box-sizing:border-box;font-family:inherit;font-size:inherit;line-height:inherit;margin:0;padding:0}.hcb_wrap .line-highlight{background:var(--hcb--highlight-color);font-size:inherit;left:0;line-height:inherit;margin-top:var(--hcb--pY);padding:0;pointer-events:none;position:absolute;right:0;white-space:pre}.hcb_wrap>.prism.line-numbers{counter-reset:linenumber;padding-left:calc(var(--hcb--pX) + var(--hcb--linenumW));position:static}.hcb_wrap>.prism.line-numbers>code{position:relative;white-space:inherit}.hcb_wrap .line-numbers-rows{border-right:1px solid var(--hcb--line-numbers--c);font-size:inherit;left:calc(-1px - var(--hcb--linenumW) - var(--hcb--pX)/2);min-width:var(--hcb--linenumW);pointer-events:none;position:absolute;top:-.125em;-webkit-user-select:none;user-select:none}.hcb_wrap .line-numbers-rows>span{counter-increment:linenumber;display:block;letter-spacing:-.25px;pointer-events:none;text-align:center}.hcb_wrap .line-numbers-rows>span:before{color:var(--hcb--line-numbers--c);content:counter(linenumber);display:block}.hcb_wrap>pre::-webkit-scrollbar{height:6px}.hcb_wrap>pre::-webkit-scrollbar-track{background:var(--hcb--scbar-track--bgc);border:none}.hcb_wrap>pre::-webkit-scrollbar-thumb{background:var(--hcb--scbar-thumb--bgc);border-radius:3px}:not(pre)>code.prism{border-radius:.3em;padding:.1em;white-space:normal}.hcb_wrap>pre:before{background-color:var(--hcb--data-label--bgc);border-radius:0 var(--hcb--radius);box-sizing:border-box;color:var(--hcb--data-label--c);content:var(--hcb--data-label);font-family:inherit;font-size:.925em;line-height:20px;min-width:4em;padding:0 10px;position:absolute;right:0;text-align:center;top:0;z-index:1}.hcb_wrap>pre[data-show-lang="0"]{--hcb--data-label:none}.hcb_wrap>pre[data-show-lang="1"]{--hcb--data-label:attr(data-lang)}.hcb_wrap>pre[data-file]:before{background-image:var(--hcb--file-icon);background-position:center left 8px;background-repeat:no-repeat;background-size:auto 10px;content:attr(data-file);padding:0 8px 0 20px}.hcb_wrap{--hcb-clipbtn-opacity:0}.hcb-clipboard:focus-visible,.hcb_wrap:hover{--hcb-clipbtn-opacity:100}.hcb-clipboard{-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);background:url(../../assets/img/clipboard-to-copy.svg) no-repeat 50%/64% auto;background-color:#fafafacc;border:none;border-radius:3px;box-shadow:0 1px 2px #3d3d3d40;box-sizing:border-box;color:#000;height:2.25em;opacity:var(--hcb-clipbtn-opacity);padding:0;position:absolute;right:8px;text-align:center;top:calc(var(--hcb--btn-offset, 0px) + 8px);transition:opacity .25s;width:2.25em;z-index:2}[data-show-lang="0"]+.hcb-clipboard{--hcb--btn-offset:0px}[data-show-lang="1"]+.hcb-clipboard{--hcb--btn-offset:20px}.hcb-clipboard.-done{background-image:url(../../assets/img/clipboard-copied.svg)}.hcb-clipboard.-done:before{background-color:inherit;border-radius:8px;color:inherit;content:"✓Copied";display:block;font-family:Arial,Helvetica,sans-serif;font-size:12px;line-height:1;padding:2px 4px 2px 2px;position:absolute;right:calc(4px + 100%);top:50%;translate:0 -50%}@media screen and (max-width:599px){:root{--hcb--fz:var(--hcb--fz--mobile,13px)}}
  • highlighting-code-block/tags/2.0.0/build/js/code-block/index.asset.php

    r2886197 r2994656  
    1 <?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'f4c02a0a618beab3fcd5f56b8c4dc46b');
     1<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'eee4433c3b38834bd373');
  • highlighting-code-block/tags/2.0.0/build/js/code-block/index.js

    r2886197 r2994656  
    1 !function(){var e={643:function(e,t,a){"use strict";var n=window.wp.blocks,l=window.wp.element,o=window.wp.i18n,s=window.wp.blockEditor,r=window.wp.components,c=(0,l.memo)((e=>{let{attributes:t,setAttributes:a}=e;const{isLineShow:n,isShowLang:c}=t;return(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(r.PanelBody,{title:(0,o.__)("HCB settings","loos-hcb"),initialOpen:!0},(0,l.createElement)(r.RadioControl,{label:(0,o.__)("Settings for displaying the number of lines","loos-hcb"),selected:n,options:[{label:(0,o.__)("Do not set individually","loos-hcb"),value:"undefined"},{label:(0,o.__)("Display row count","loos-hcb"),value:"on"},{label:(0,o.__)("Do not display row count","loos-hcb"),value:"off"}],onChange:e=>{a({isLineShow:e})}}),(0,l.createElement)(r.RadioControl,{label:(0,o.__)("Settings for displaying language name","loos-hcb"),selected:c,options:[{label:(0,o.__)("Do not set individually","loos-hcb"),value:""},{label:(0,o.__)("Display language","loos-hcb"),value:"1"},{label:(0,o.__)("Do not display language","loos-hcb"),value:"0"}],onChange:e=>{a({isShowLang:e})}})))}));function i(e){const t=e.value.match(/\r\n|\n/g);let a;a=null!==t?t.length+1:1,e.style.height=1.8*a+1.6+2+"em"}function u(e){return e?e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"):e}var p=a(184),d=a.n(p);let m=window.hcbLangs;"object"!=typeof m&&(m={html:"HTML",css:"CSS",scss:"SCSS",js:"JavaScript",ts:"TypeScript",php:"PHP",ruby:"Ruby",python:"Python",swift:"Swift",c:"C",csharp:"C#",cpp:"C++",objectivec:"Objective-C",sql:"SQL",json:"JSON",bash:"Bash",git:"Git"});const g=[{value:"",label:"- Lang Select -"}];Object.keys(m).forEach((e=>{g.push({value:e,label:m[e]})}));var h=JSON.parse('{"u2":"loos-hcb/code-block"}'),f=(0,l.createElement)("svg",{x:"0px",y:"0px",viewBox:"0 0 512 512"},(0,l.createElement)("path",{d:"M48,346.8h34.6v51h31.2v-51h34.6v135.8h-34.6V428H82.6v54.5H48V346.8z"}),(0,l.createElement)("path",{d:"M268.1,344.3c17.5,0,31.6,8.3,41,17.3l-19,21.6c-6.2-5.6-12.8-9.2-22-9.2c-17.3,0-30.5,15.2-30.5,40.4 c0,26.1,13.2,40.6,32,40.6c9,0,16.4-4.5,22.4-11.1l19,21.1c-11.5,13.4-26.7,19.9-43.4,19.9c-35.3,0-65.4-23.1-65.4-69.4 C202.1,370.3,231.5,344.3,268.1,344.3z"}),(0,l.createElement)("path",{d:"M363,346.8h44.4c28.2,0,50.6,7.1,50.6,33.7c0,11.8-7.1,25.4-22.9,29.5v0.8c19.2,3.6,29,13.7,29,31.8 c0,28-23.1,40-52.6,40H363V346.8z M406.3,400.6c12.6,0,17.7-6,17.7-14.9c0-8.6-5.3-12.2-17.7-12.2h-8.5v27.1H406.3z M408.9,455.8 c14.7,0,21.1-5.5,21.1-16.2c0-10.5-6.4-14.9-21.1-14.9h-11.1v31H408.9z"}),(0,l.createElement)("polygon",{points:"209.8,56.9 184,31 39.3,175.7 39.3,175.7 39.3,175.7 184,320.4 209.8,294.6 91,175.7"}),(0,l.createElement)("polygon",{points:"302.2,56.9 328,31 472.7,175.7 472.7,175.7 472.7,175.7 328,320.4 302.2,294.6 421,175.7"})),b=[{supports:{className:!1},attributes:{code:{type:"string",source:"text",selector:"code"},className:{type:"string",default:""},langType:{type:"string",default:""},langName:{type:"string",default:""},fileName:{type:"string",default:""},dataLineNum:{type:"string",default:""},isLineShow:{type:"string",default:"undefined"},isShowLang:{type:"string",default:""}},save:e=>{let{attributes:t}=e;const{code:a,fileName:n,langName:o,dataLineNum:r,isLineShow:c,isShowLang:i}=t,p=t.langType||"plain";let m=d()("prism",`lang-${p}`);return"undefined"!==c&&(m=d()(m,`${c}-numbers`)),(0,l.createElement)("div",{className:"hcb_wrap"},(0,l.createElement)("pre",{className:m,"data-file":n||null,"data-lang":o||null,"data-line":r||null,"data-show-lang":i||null},(0,l.createElement)(s.RichText.Content,{tagName:"code",value:u(a)})))}},{supports:{className:!1},attributes:{code:{type:"string",source:"text",selector:"code"},className:{type:"string",default:""},langType:{type:"string",default:"plane"},langName:{type:"string",default:""},fileName:{type:"string",default:""},dataLineNum:{type:"string",default:""},isLineShow:{type:"string",default:"undefined"},isShowLang:{type:"string",default:""}},migrate:e=>("plane"===e.langType&&(e.langType=""),e),save:e=>{let{attributes:t}=e;const{code:a,langType:n,fileName:o,langName:r,dataLineNum:c,isLineShow:i,isShowLang:p}=t,d="prism "+i+"-numbers lang-"+n;return(0,l.createElement)("div",{className:"hcb_wrap"},(0,l.createElement)("pre",{className:d,"data-file":o||null,"data-lang":r||null,"data-line":c||null,"data-show-lang":p||null},(0,l.createElement)(s.RichText.Content,{tagName:"code",value:u(a)})))}}];(0,n.registerBlockType)(h.u2,{icon:f,transforms:{from:[{type:"block",blocks:["core/code"],transform:e=>(0,n.createBlock)("loos-hcb/code-block",{code:e.content})}],to:[{type:"block",blocks:["core/code"],transform:e=>(0,n.createBlock)("core/code",{content:e.code})}]},edit:e=>{let{attributes:t,setAttributes:a,clientId:n}=e;const u=(0,l.useRef)(),{code:p,fileName:h,langName:f,dataLineNum:b,isShowLang:v,isLineShow:y}=t,w=d()("hcb_wrap","hcb-block");(0,l.useEffect)((()=>{const e=t.className;if(!e)return;const n=e.split(" "),l=[...new Set(n)];a({className:d()(l)})}),[]),(0,l.useEffect)((()=>{const{ownerDocument:e}=u.current;e&&i(e.querySelector(`#block-${n} .hcb_textarea`))}),[n,p]);const N=window.hcbEditorVars?.showLang,S=window.hcbEditorVars?.showLinenum;let E="0";("1"===v||""===v&&"on"===N)&&(E="1");let _=null;("on"===y||"undefined"===y&&"on"===S)&&(_="1");const L=(0,s.useBlockProps)({ref:u,className:w,"data-file":h||null,"data-lang":f||null,"data-show-lang":E,"data-show-linenum":_});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(c,{attributes:t,setAttributes:a}),(0,l.createElement)("div",L,(0,l.createElement)("div",{className:"hcb_codewrap"},(0,l.createElement)("div",{className:"hcb_linenum"}),(0,l.createElement)("textarea",{className:"hcb_textarea",placeholder:"Your Code...",value:p,onChange:e=>{a({code:e.target.value}),i(e.target)}})),(0,l.createElement)("div",{className:"hcb_controls"},(0,l.createElement)(r.SelectControl,{value:t.langType,options:g,onChange:e=>{a(""===e?{langType:"",langName:""}:{langType:e,langName:m[e]})}}),(0,l.createElement)("input",{type:"text",className:"filename_input",value:h,placeholder:(0,o.__)("file name","loos-hcb"),onChange:e=>{a({fileName:e.target.value})}}),(0,l.createElement)("input",{type:"text",className:"num_input",value:b,placeholder:(0,o.__)('"data-line" value',"loos-hcb"),onChange:e=>{a({dataLineNum:e.target.value})}}))))},save:e=>{let{attributes:t}=e;const{code:a,fileName:n,langName:o,dataLineNum:r,isLineShow:c,isShowLang:i}=t,p=t.langType||"plain",m=d()("prism",`${c}-numbers`,`lang-${p}`),g=s.useBlockProps.save({className:"hcb_wrap"});return(0,l.createElement)("div",g,(0,l.createElement)("pre",{className:m,"data-file":n||null,"data-lang":o||null,"data-line":r||null,"data-show-lang":i||null},(0,l.createElement)(s.RichText.Content,{tagName:"code",value:u(a)})))},deprecated:b})},184:function(e,t){var a;!function(){"use strict";var n={}.hasOwnProperty;function l(){for(var e=[],t=0;t<arguments.length;t++){var a=arguments[t];if(a){var o=typeof a;if("string"===o||"number"===o)e.push(a);else if(Array.isArray(a)){if(a.length){var s=l.apply(null,a);s&&e.push(s)}}else if("object"===o)if(a.toString===Object.prototype.toString)for(var r in a)n.call(a,r)&&a[r]&&e.push(r);else e.push(a.toString())}}return e.join(" ")}e.exports?(l.default=l,e.exports=l):void 0===(a=function(){return l}.apply(t,[]))||(e.exports=a)}()}},t={};function a(n){var l=t[n];if(void 0!==l)return l.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,a),o.exports}a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a(643)}();
     1(()=>{var e={184:(e,t)=>{var a;!function(){"use strict";var l={}.hasOwnProperty;function n(){for(var e=[],t=0;t<arguments.length;t++){var a=arguments[t];if(a){var o=typeof a;if("string"===o||"number"===o)e.push(a);else if(Array.isArray(a)){if(a.length){var r=n.apply(null,a);r&&e.push(r)}}else if("object"===o){if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]")){e.push(a.toString());continue}for(var c in a)l.call(a,c)&&a[c]&&e.push(c)}}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):void 0===(a=function(){return n}.apply(t,[]))||(e.exports=a)}()}},t={};function a(l){var n=t[l];if(void 0!==n)return n.exports;var o=t[l]={exports:{}};return e[l](o,o.exports,a),o.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var l in t)a.o(t,l)&&!a.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=window.wp.blocks,t=window.React,l=window.wp.i18n,n=window.wp.blockEditor,o=window.wp.components,r=window.wp.element;var c=a(184),s=a.n(c);const i=window.hcbVars?.showLang,u=window.hcbVars?.showLinenum;let d=window?.hcbLangs||null;const p=[["plain","Plain"],...Object.entries(d)],m=[{value:"",label:"Plain"},...Object.entries(d).map((([e,t])=>({value:e,label:t})))],g=(e="")=>{const t=e.match(/\r\n|\n/g);return null!==t?t.length+1:1};function h(e){return e?e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"):e}const b=JSON.parse('{"u2":"loos-hcb/code-block"}'),f=(0,t.createElement)("svg",{x:"0px",y:"0px",viewBox:"0 0 512 512"},(0,t.createElement)("g",null,(0,t.createElement)("path",{d:"M54.4,348.2H89v51h31.2v-51h34.6V484h-34.6v-54.6H89v54.5H54.4V348.2z"}),(0,t.createElement)("path",{d:"M267.5,345.7c17.5,0,31.6,8.3,41,17.3l-19,21.6c-6.2-5.6-12.8-9.2-22-9.2c-17.3,0-30.5,15.2-30.5,40.4 c0,26.1,13.2,40.6,32,40.6c9,0,16.4-4.5,22.4-11.1l19,21.1c-11.5,13.4-26.7,19.9-43.4,19.9c-35.3,0-65.4-23.1-65.4-69.4 C201.6,371.7,230.9,345.7,267.5,345.7z"}),(0,t.createElement)("path",{d:"M356.5,348.2h44.4c28.2,0,50.6,7.1,50.6,33.7c0,11.8-7.1,25.4-22.9,29.5v0.8c19.2,3.6,29,13.7,29,31.8 c0,28-23.1,40-52.6,40h-48.5V348.2z M399.8,402c12.6,0,17.7-6,17.7-14.9c0-8.6-5.3-12.2-17.7-12.2h-8.5V402H399.8z M402.3,457.2 c14.7,0,21.1-5.5,21.1-16.2c0-10.5-6.4-14.9-21.1-14.9h-11.1v31h11.1V457.2z"})),(0,t.createElement)("polygon",{points:"172,311.6 195,288.6 76.2,165.7 195,42.9 172,19.8 30.1,165.7 "}),(0,t.createElement)("polygon",{points:"340,19.8 317,42.9 435.8,165.7 317,288.6 340,311.6 481.9,165.7 "})),y=[{supports:{className:!1},attributes:{code:{type:"string",source:"text",selector:"code"},className:{type:"string",default:""},langType:{type:"string",default:""},langName:{type:"string",default:""},fileName:{type:"string",default:""},dataLineNum:{type:"string",default:""},isLineShow:{type:"string",default:"undefined"},isShowLang:{type:"string",default:""}},save:({attributes:e})=>{const{code:a,fileName:l,langName:o,dataLineNum:r,isLineShow:c,isShowLang:i}=e,u=e.langType||"plain";let d=s()("prism",`lang-${u}`);return"undefined"!==c&&(d=s()(d,`${c}-numbers`)),(0,t.createElement)("div",{className:"hcb_wrap"},(0,t.createElement)("pre",{className:d,"data-file":l||null,"data-lang":o||null,"data-line":r||null,"data-show-lang":i||null},(0,t.createElement)(n.RichText.Content,{tagName:"code",value:h(a)})))}},{supports:{className:!1},attributes:{code:{type:"string",source:"text",selector:"code"},className:{type:"string",default:""},langType:{type:"string",default:"plane"},langName:{type:"string",default:""},fileName:{type:"string",default:""},dataLineNum:{type:"string",default:""},isLineShow:{type:"string",default:"undefined"},isShowLang:{type:"string",default:""}},migrate:e=>("plane"===e.langType&&(e.langType=""),e),save:({attributes:e})=>{const{code:a,langType:l,fileName:o,langName:r,dataLineNum:c,isLineShow:s,isShowLang:i}=e,u="prism "+s+"-numbers lang-"+l;return(0,t.createElement)("div",{className:"hcb_wrap"},(0,t.createElement)("pre",{className:u,"data-file":o||null,"data-lang":r||null,"data-line":c||null,"data-show-lang":i||null},(0,t.createElement)(n.RichText.Content,{tagName:"code",value:h(a)})))}}];(0,e.registerBlockType)(b.u2,{icon:f,transforms:{from:[{type:"block",blocks:["core/code"],transform:t=>(0,e.createBlock)("loos-hcb/code-block",{code:t.content})}],to:[{type:"block",blocks:["core/code"],transform:t=>(0,e.createBlock)("core/code",{content:t.code})}]},edit:({attributes:e,setAttributes:a,clientId:c})=>{const h=(0,r.useRef)(),{className:b,code:f="",langType:y,fileName:v,langName:w,dataLineNum:N,dataStart:E,isShowLang:_,isLineShow:S}=e,[L,x]=(0,r.useState)(g(f)),C=s()("hcb-block","hcb_wrap");(0,r.useEffect)((()=>{const e=b||"";if(!e)return;const t=e.split(" "),l=[...new Set(t)];a({className:s()(l)})}),[b,a]),(0,r.useEffect)((()=>{const{ownerDocument:e}=h.current;if(e){const t=e.querySelector(`#block-${c}`),a=t.querySelector(".hcb_textarea");if(t.style.setProperty("--hcb--code-linenum",L),a.scrollWidth>a.offsetWidth){const e=a.offsetHeight-a.clientHeight;t.style.setProperty("--hcb--scbarH",e+"px")}}}),[c,L]);let T="0";("1"===_||""===_&&"on"===i)&&(T="1");let k=null;("on"===S||"undefined"===S&&"on"===u)&&(k="1");const P=(0,n.useBlockProps)({ref:h,className:C,"data-file":v||null,"data-lang":w||null,"data-show-lang":T,"data-show-linenum":k}),B=[...p];return y||B.shift(),(0,t.createElement)(t.Fragment,null,(0,t.createElement)(n.BlockControls,null,(0,t.createElement)(o.ToolbarGroup,{isCollapsed:!0,icon:(0,t.createElement)(t.Fragment,null,w||(0,l.__)("Language","loos-hcb")),title:"Lnaguage",controls:B.map((([e,t])=>({key:e,isActive:e===y,title:t,onClick:()=>{a("plain"===e?{langType:"",langName:""}:{langType:e,langName:t})}})))})),(0,t.createElement)(n.InspectorControls,null,(0,t.createElement)(o.PanelBody,{title:(0,l.__)("HCB settings","loos-hcb"),initialOpen:!0},(0,t.createElement)(o.SelectControl,{label:(0,l.__)("Language","loos-hcb"),value:e.langType,options:m,onChange:e=>{a(""===e?{langType:"",langName:""}:{langType:e,langName:d[e]})}}),(0,t.createElement)(o.SelectControl,{label:(0,l.__)("Display number of rows","loos-hcb"),value:S,options:[{label:(0,l.__)("Do not set individually","loos-hcb"),value:"undefined"},{label:(0,l.__)("Display row count","loos-hcb"),value:"on"},{label:(0,l.__)("Do not display row count","loos-hcb"),value:"off"}],onChange:e=>{a({isLineShow:e})}}),(0,t.createElement)(o.SelectControl,{label:(0,l.__)("Display language name","loos-hcb"),value:_,options:[{label:(0,l.__)("Do not set individually","loos-hcb"),value:""},{label:(0,l.__)("Display language","loos-hcb"),value:"1"},{label:(0,l.__)("Do not display language","loos-hcb"),value:"0"}],onChange:e=>{a({isShowLang:e})}}),(0,t.createElement)(o.TextControl,{label:(0,l.__)("File name","loos-hcb"),value:v,onChange:e=>{a({fileName:e})}}),(0,t.createElement)(o.TextControl,{label:(0,t.createElement)(t.Fragment,null,(0,l.__)("Highlight Number","loos-hcb")+" ( ",(0,t.createElement)("code",{className:"hcb-code-in-label"},"[data-line]")," )"),value:N,onChange:e=>{a({dataLineNum:e})}}),(0,t.createElement)(o.TextControl,{type:"number",label:(0,t.createElement)(t.Fragment,null,(0,l.__)("First line number","loos-hcb")+" ( ",(0,t.createElement)("code",{className:"hcb-code-in-label"},"[data-start]")," )"),value:E||1,onChange:e=>{a({dataStart:parseInt(e||1)})},style:{opacity:k?1:.5},disabled:!k}))),(0,t.createElement)("div",{...P},(0,t.createElement)("div",{className:"hcb_codewrap"},k&&(0,t.createElement)("div",{className:"hcb_linenum"},(0,t.createElement)("div",{className:"hcb-startNum"},E)),(0,t.createElement)("textarea",{className:"hcb_textarea",placeholder:"Your Code...",value:f,onChange:e=>{const t=e.target.value;a({code:t});const l=g(t);L!==l&&x(l)}}),N&&(0,t.createElement)("div",{className:"hcb-datapreview"},(0,t.createElement)("div",{className:"hcb-datapreview__items"},`{${N}}`)))))},save:({attributes:e})=>{const{code:a,fileName:l,langName:o,dataLineNum:r,dataStart:c,isLineShow:i,isShowLang:u}=e,d=e.langType||"plain",p=s()("prism",`${i}-numbers`,`lang-${d}`),m=n.useBlockProps.save({className:"hcb_wrap"});return(0,t.createElement)("div",{...m},(0,t.createElement)("pre",{className:p,"data-file":l||null,"data-lang":o||null,"data-line":r||null,"data-start":1===c?null:c,"data-show-lang":u||null},(0,t.createElement)(n.RichText.Content,{tagName:"code",value:h(a)})))},deprecated:y})})()})();
  • highlighting-code-block/tags/2.0.0/build/js/hcb_script.asset.php

    r2886197 r2994656  
    1 <?php return array('dependencies' => array(), 'version' => 'a41ce2112184d183ef84f00096e88ad5');
     1<?php return array('dependencies' => array(), 'version' => 'ba4f9f2286907745024d');
  • highlighting-code-block/tags/2.0.0/build/js/hcb_script.js

    r2886197 r2994656  
    1 document.addEventListener("DOMContentLoaded",(function(){const t=document.querySelectorAll(".token.keyword");for(let e=0;e<t.length;e++){const n=t[e];-1!==["function","def","class"].indexOf(n.textContent)?n.classList.add("def"):"this"===n.textContent&&n.classList.add("this")}const e=document.querySelectorAll(".line-highlight");for(let t=0;t<e.length;t++){const n=e[t];if(!n.parentNode.classList.contains("line-numbers")){const t=1.5*(n.getAttribute("data-start")-1);n.style.top=t+"em"}}!function(){if(!window.ClipboardJS)return;if(!window.hcbVars?.showCopyBtn)return;let t=1;const e=document.querySelectorAll(".hcb_wrap");for(let n=0;n<e.length;n++){const o=e[n],c=o.querySelector("code");if(null===c)continue;const s=document.createElement("button");s.classList.add("hcb-clipboard"),s.setAttribute("data-clipboard-target",'[data-hcb-clip="'+t+'"]'),s.setAttribute("data-clipboard-action","copy"),s.setAttribute("aria-label",window.hcbVars?.copyBtnLabel||""),o.prepend(s),c.setAttribute("data-hcb-clip",t),t++}new ClipboardJS(".hcb-clipboard").on("success",(function(t){const e=t.trigger;e.classList.add("-done"),setTimeout((()=>{e.classList.remove("-done")}),5e3)}))}()}));
     1document.addEventListener("DOMContentLoaded",(function(){const t=document.querySelectorAll(".token.keyword");for(let e=0;e<t.length;e++){const n=t[e];-1!==["function","def","class"].indexOf(n.textContent)?n.classList.add("def"):"this"===n.textContent&&n.classList.add("this")}const e=document.querySelectorAll(".line-highlight");for(let t=0;t<e.length;t++){const n=e[t];if(!n.parentNode.classList.contains("line-numbers")){const t=1.5*(n.getAttribute("data-start")-1);n.style.top=t+"em"}}!function(){if(!window.ClipboardJS)return;if(!window.hcbVars?.showCopyBtn)return;let t=1;const e=document.querySelectorAll(".hcb_wrap");for(let n=0;n<e.length;n++){const o=e[n],c=o.querySelector("code");if(null===c)continue;const s=document.createElement("button");s.classList.add("hcb-clipboard"),s.setAttribute("data-clipboard-target",'[data-hcb-clip="'+t+'"]'),s.setAttribute("data-clipboard-action","copy"),s.setAttribute("aria-label",window.hcbVars?.copyBtnLabel||""),o.append(s),c.setAttribute("data-hcb-clip",t),t++}new ClipboardJS(".hcb-clipboard").on("success",(function(t){const e=t.trigger;e.classList.add("-done"),setTimeout((()=>{e.classList.remove("-done")}),5e3)}))}()}));
  • highlighting-code-block/tags/2.0.0/class/loos_hcb.php

    r2886197 r2994656  
    151151
    152152        // Font size
    153         $inline_css .= ':root{--hcb-font-size: ' . $HCB['fontsize_pc'] . '}';
    154         $inline_css .= ':root{--hcb-font-size--mobile: ' . $HCB['fontsize_sp'] . '}';
     153        $inline_css .= ':root{--hcb--fz--base: ' . $HCB['fontsize_pc'] . '}';
     154        $inline_css .= ':root{--hcb--fz--mobile: ' . $HCB['fontsize_sp'] . '}';
    155155
    156156        // Font family
    157157        if ( $HCB['font_family'] ) {
    158             $inline_css .= ':root{--hcb-font-family:' . $HCB['font_family'] . '}';
     158            $inline_css .= ':root{--hcb--ff:' . $HCB['font_family'] . '}';
    159159        }
    160160
    161         // Code Lang
     161        // Code Lang (Default)
    162162        if ( 'off' === $HCB['show_lang'] ) {
    163             $inline_css .= '.hcb_wrap pre:not([data-file]):not([data-show-lang])::before{content: none;}';
     163            $inline_css .= '.hcb_wrap{--hcb--data-label: none;--hcb--btn-offset: 0px;}';
    164164        }
    165165
  • highlighting-code-block/tags/2.0.0/class/loos_hcb_scripts.php

    r2886197 r2994656  
    2121    public static function register_hcb_block() {
    2222
    23         // ブロックのスクリプト登録 ( memo: wp_add_inline_script() で紐付けるために wp_register_script 必要 )
     23        // ブロックのスクリプト登録 ( memo: wp_add_inline_script() でグローバル変数を紐付けるために wp_register_script() で登録している )
    2424        $asset = include LOOS_HCB_PATH . '/build/js/code-block/index.asset.php';
    2525        wp_register_script(
     
    3232
    3333        // ブロックの登録
    34         register_block_type_from_metadata( LOOS_HCB_PATH . '/src/js/code-block' );
     34        register_block_type_from_metadata( LOOS_HCB_PATH . '/build/js/code-block' );
     35
     36        // エディタに渡すグローバル変数
     37        wp_add_inline_script(
     38            'hcb-code-block',
     39            'var hcbLangs = ' . self::get_lang_obj_str() . ';',
     40            'before'
     41        );
     42        wp_localize_script( 'hcb-code-block', 'hcbVars', [
     43            'showLang'    => LOOS_HCB::$settings['show_lang'],
     44            'showLinenum' => LOOS_HCB::$settings['show_linenum'],
     45        ] );
    3546    }
    3647
     
    115126        // 翻訳jsonファイルの読み込み
    116127        wp_set_script_translations( 'hcb-blocks', 'loos-hcb', LOOS_HCB_PATH . '/languages' );
    117 
    118         // 管理画面側に渡すグローバル変数
    119         wp_localize_script( 'hcb-blocks', 'hcbEditorVars', [
    120             'showLang'    => LOOS_HCB::$settings['show_lang'],
    121             'showLinenum' => LOOS_HCB::$settings['show_linenum'],
    122         ] );
    123128    }
    124129
     
    128133     * TinyMCEでも必要なので admin_head にフックさせている。
    129134     */
    130     public static function hook_admin_head() {
     135    public static function get_lang_obj_str() {
     136        $langs = LOOS_HCB::$settings['support_langs'];
    131137
    132         $langs = LOOS_HCB::$settings['support_langs'];
    133         $langs = mb_convert_kana( $langs, 'as' ); //全角の文字やスペースがあれば半角に直す
     138        // Replace full-width characters and spaces with half-width equivalents
     139        $langs = str_replace(
     140            [' ', '"', ''', ':', ';', ',' ],
     141            [' ', '"', "'", ':', ';', ',' ],
     142            $langs
     143        );
    134144        $langs = str_replace( ["\r\n", "\r", "\n" ], '', $langs );
    135145        $langs = trim( $langs, ',' );
    136146
    137         $code = 'var hcbLangs = {' . trim( $langs ) . '};';
     147        return '{' . trim( $langs ) . '}';
     148    }
    138149
    139         // for tinyMCE
    140         echo '<script id="hcb-langs">' . wp_kses( $code, [] ) . '</script>' . PHP_EOL;
    141 
    142         // for Gutenberg
    143         wp_add_inline_script( 'hcb-code-block', $code, 'before' );
     150    /**
     151     * Add code to Admin Head. (for TinyMCE)
     152     */
     153    public static function hook_admin_head() {
     154        echo '<script id="hcb-langs">var hcbLangs = ' . wp_kses( self::get_lang_obj_str(), [] ) . ';</script>' . PHP_EOL;
    144155    }
    145156}
  • highlighting-code-block/tags/2.0.0/highlighting-code-block.php

    r2886197 r2994656  
    44 * Plugin URI: https://wordpress.org/plugins/highlighting-code-block/
    55 * Description: Add code block with syntax highlighting using prism.js. (Available for Gutenberg and Classic Editor)
    6  * Version: 1.7.0
     6 * Version: 2.0.0
    77 * Requires at least: 5.6
    88 * Author: LOOS, Inc.
  • highlighting-code-block/tags/2.0.0/languages/loos-hcb-ja-hcb-blocks.json

    r2359718 r2994656  
    1 {"domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural_forms":"nplurals=1; plural=0;","lang":"ja_JP"},"HCB settings":["HCB設定"],"Settings for displaying the number of lines":["行数の表示に関する設定"],"Do not set individually":["個別で設定はしない"],"Display row count":["行数を表示する"],"Do not display row count":["行数を表示しない"],"Settings for displaying language name":["言語名の表示に関する設定"],"Display language":["言語を表示する"],"Do not display language":["言語を表示しない"],"\"data-line\" value":["data-line属性値"],"file name":["ファイル名"],"[HCB] Settings":["[HCB] 設定"],"Highlighting Code Block settings":["Highlighting Code Block 設定"],"Basic settings":["基本設定"],"Display language name":["言語の表示"],"Display language name in code block":["コードブロックに言語名を表示する"],"If checked, the language type is displayed in the code on the site display side.":["チェックすると、サイト表示側のコードに言語の種類が表示されます。"],"Display settings for the number of rows":["行数の表示設定"],"Show line count in code block":["コードブロックに行数を表示する"],"If checked, the number of lines will be displayed on the left end of the code on the site display side.":["チェックすると、サイト表示側のコードの左端に行数が表示されます。"],"Font smoothing":["フォントスムージング"],"Turn on font smoothing":["フォントスムージングをオンにする"],"Add %s and %s to the code block.":["コードブロックに %s と %s が追加されます。"],"Cord coloring (front side)":["コードカラーリング(フロント側)"],"Code coloring (editor side)":["コードカラーリング(エディター側)"],"Font Size":["フォントサイズ"],"\"Font-family\" in code":["コードの “font-family”"],"Default":["デフォルト"],"Advanced settings":["高度な設定"],"Language set to use":["使用する言語セット"],"Write in the format of %s, separated by \",\" (comma).":["%s の形式で、”,”(カンマ)区切りで記述してください。"],"class-key:\"language-name\"":["クラスキー:”言語名”"],"\"class-key\" is the class name used in prism.js (the part corresponding to \"◯◯\" in \"lang- ◯◯\")":["「クラスキー」は、prism.jsで使用されるクラス名(「lang-◯◯」の「◯◯」に該当する部分)です。"],"* If you use a language that is not supported by default, please use it together with \"Original prism.js\" setting.":["※ デフォルトでサポートされていない言語を使用する場合、「独自prism.js」設定と併用してください。"],"Original coloring file":["独自カラーリングファイル"],"Load your own CSS file for code coloring.":["あなたが用意したコードカラーリング用のCSSファイルを読み込みます。"],"Original prism.js":["独自prism.js"],"You can use the prism.js file corresponding to your own language set.":["自分専用の言語セットに対応したprism.jsファイルを使用できます。"],"help":["ヘルプ"],"When you use each original file, please upload it in the theme folder.":["各独自ファイルを使用する場合は、テーマフォルダの中にアップロードしてください。"],"If you set the path to your own file, the default coloring file and prism.js file will not be loaded..":["独自ファイルへのパスを設定すると、デフォルトのカラーリングファイルやprism.jsファイルは読み込まれなくなります。"],"* The currently loaded prism.js file can be downloaded at %s.":["※ 現在読み込んでいるprism.jsファイルは、 %s でダウンロードできます。"],"Here":["こちら"],"Highlighting Code Block":["Highlighting Code Block"],"https://wordpress.org/plugins/highlighting-code-block/":["https://wordpress.org/plugins/highlighting-code-block/"],"Add code block with syntax highlighting using prism.js. (Available for Gutenberg and Classic Editor)":["prism.js を使用したシンタックスハイライト機能付きのコードブロックを追加します。(Gutenbergとクラシックエディター共に利用可能)"],"LOOS WEB STUDIO":["LOOS WEB STUDIO"],"https://loos-web-studio.com/":["https://loos-web-studio.com/"]}}}
     1{"domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural_forms":"nplurals=1; plural=0;","lang":"ja_JP"},"HCB settings":["HCB設定"],"Language":["言語"],"Display number of rows":["行数の表示"],"Do not set individually":["個別で設定はしない"],"Display row count":["行数を表示する"],"Do not display row count":["行数を表示しない"],"Display language name":["言語の表示"],"Display language":["言語を表示する"],"Do not display language":["言語を表示しない"],"File name":["ファイル名"],"Highlight Number":["ハイライトする行番号"],"First line number":["開始行番号"],"[HCB] Settings":["[HCB] 設定"],"Basic settings":["基本設定"],"Display language name in code block":["コードブロックに言語名を表示する"],"If checked, the language type is displayed in the code on the site display side.":["チェックすると、サイト表示側のコードに言語の種類が表示されます。"],"Display settings for the number of rows":["行数の表示設定"],"Show line count in code block":["コードブロックに行数を表示する"],"If checked, the number of lines will be displayed on the left end of the code on the site display side.":["チェックすると、サイト表示側のコードの左端に行数が表示されます。"],"Copy button":["コピーボタン"],"Show copy button in code block":["コードブロックにコピーボタンを表示する"],"Font smoothing":["フォントスムージング"],"Turn on font smoothing":["フォントスムージングをオンにする"],"Add %s and %s to the code block.":["コードブロックに %s と %s が追加されます。"],"Cord coloring (front side)":["コードカラーリング(フロント側)"],"Code coloring (editor side)":["コードカラーリング(エディター側)"],"Font Size":["フォントサイズ"],"\"Font-family\" in code":["コードの “font-family”"],"Advanced settings":["高度な設定"],"When you use each original file, please upload it in the theme folder.":["各独自ファイルを使用する場合は、テーマフォルダの中にアップロードしてください。"],"If you set the path to your own file, the default coloring file and prism.js file will not be loaded..":["独自ファイルへのパスを設定すると、デフォルトのカラーリングファイルやprism.jsファイルは読み込まれなくなります。"],"* The currently loaded prism.js file can be downloaded at %s.":["※ 現在読み込んでいるprism.jsファイルは、 %s でダウンロードできます。"],"Here":["こちら"],"Language set to use":["使用する言語セット"],"Write in the format of %s, separated by \",\" (comma).":["%s の形式で、”,”(カンマ)区切りで記述してください。"],"class-key:\"language-name\"":["クラスキー:”言語名”"],"\"class-key\" is the class name used in prism.js (the part corresponding to \"◯◯\" in \"lang- ◯◯\")":["「クラスキー」は、prism.jsで使用されるクラス名(「lang-◯◯」の「◯◯」に該当する部分)です。"],"* If you use a language that is not supported by default, please use it together with \"Original prism.js\" setting.":["※ デフォルトでサポートされていない言語を使用する場合、「独自prism.js」設定と併用してください。"],"Original coloring file":["独自カラーリングファイル"],"Load your own CSS file for code coloring.":["あなたが用意したコードカラーリング用のCSSファイルを読み込みます。"],"Original prism.js":["独自prism.js"],"You can use the prism.js file corresponding to your own language set.":["自分専用の言語セットに対応したprism.jsファイルを使用できます。"],"help":["ヘルプ"],"Highlighting Code Block settings":["Highlighting Code Block 設定"],"Copy code to clipboard":["コードをクリップボードにコピーする"],"Highlighting Code Block":["Highlighting Code Block"],"https://wordpress.org/plugins/highlighting-code-block/":["https://wordpress.org/plugins/highlighting-code-block/"],"Add code block with syntax highlighting using prism.js. (Available for Gutenberg and Classic Editor)":["prism.js を使用したシンタックスハイライト機能付きのコードブロックを追加します。(Gutenbergとクラシックエディター共に利用可能)"],"LOOS, Inc.":["LOOS, Inc."],"https://loos-web-studio.com/":["https://loos-web-studio.com/"]}}}
  • highlighting-code-block/tags/2.0.0/languages/loos-hcb-ja.po

    r2886197 r2994656  
    22msgstr ""
    33"Project-Id-Version: Highlighting Code Block\n"
    4 "POT-Creation-Date: 2023-03-24 15:35+0900\n"
    5 "PO-Revision-Date: 2023-03-24 15:35+0900\n"
     4"POT-Creation-Date: 2023-11-10 00:11+0900\n"
     5"PO-Revision-Date: 2023-11-10 00:12+0900\n"
    66"Last-Translator: \n"
    77"Language-Team: \n"
     
    2626"X-Poedit-SearchPathExcluded-4: vendor\n"
    2727
    28 #: src/js/code-block/_sidebar.js:14
     28#: src/js/code-block/edit.js:172
    2929msgid "HCB settings"
    3030msgstr "HCB設定"
    3131
    32 #: src/js/code-block/_sidebar.js:16
    33 msgid "Settings for displaying the number of lines"
    34 msgstr "行数の表示に関する設定"
    35 
    36 #: src/js/code-block/_sidebar.js:20 src/js/code-block/_sidebar.js:42
     32#: src/js/code-block/edit.js:174
     33msgid "Language"
     34msgstr "言語"
     35
     36#: src/js/code-block/edit.js:186
     37msgid "Display number of rows"
     38msgstr "行数の表示"
     39
     40#: src/js/code-block/edit.js:190 src/js/code-block/edit.js:211
    3741msgid "Do not set individually"
    3842msgstr "個別で設定はしない"
    3943
    40 #: src/js/code-block/_sidebar.js:24
     44#: src/js/code-block/edit.js:194
    4145msgid "Display row count"
    4246msgstr "行数を表示する"
    4347
    44 #: src/js/code-block/_sidebar.js:28
     48#: src/js/code-block/edit.js:198
    4549msgid "Do not display row count"
    4650msgstr "行数を表示しない"
    4751
    48 #: src/js/code-block/_sidebar.js:38
    49 msgid "Settings for displaying language name"
    50 msgstr "言語名の表示に関する設定"
    51 
    52 #: src/js/code-block/_sidebar.js:46
     52#: src/js/code-block/edit.js:207 class/loos_hcb_menu.php:35
     53msgid "Display language name"
     54msgstr "言語の表示"
     55
     56#: src/js/code-block/edit.js:215
    5357msgid "Display language"
    5458msgstr "言語を表示する"
    5559
    56 #: src/js/code-block/_sidebar.js:50
     60#: src/js/code-block/edit.js:219
    5761msgid "Do not display language"
    5862msgstr "言語を表示しない"
    5963
    60 #: src/js/code-block/edit.js:165
    61 msgid "file name"
     64#: src/js/code-block/edit.js:228
     65msgid "File name"
    6266msgstr "ファイル名"
    6367
    64 #: src/js/code-block/edit.js:174
    65 msgid "\"data-line\" value"
    66 msgstr "data-line属性値"
     68#: src/js/code-block/edit.js:238
     69msgid "Highlight Number"
     70msgstr "ハイライトする行番号"
     71
     72#: src/js/code-block/edit.js:254
     73msgid "First line number"
     74msgstr "開始行番号"
    6775
    6876#: class/loos_hcb_menu.php:8
     
    7381msgid "Basic settings"
    7482msgstr "基本設定"
    75 
    76 #: class/loos_hcb_menu.php:35
    77 msgid "Display language name"
    78 msgstr "言語の表示"
    7983
    8084#: class/loos_hcb_menu.php:38
     
    219223msgstr "Highlighting Code Block 設定"
    220224
    221 #: class/loos_hcb_scripts.php:62
     225#: class/loos_hcb_scripts.php:82
    222226msgid "Copy code to clipboard"
    223227msgstr "コードをクリップボードにコピーする"
     
    241245#. Author of the plugin/theme
    242246msgid "LOOS, Inc."
    243 msgstr ""
     247msgstr "LOOS, Inc."
    244248
    245249#. Author URI of the plugin/theme
     
    247251msgstr "https://loos-web-studio.com/"
    248252
     253#~ msgid "\"data-line\" value"
     254#~ msgstr "data-line属性値"
     255
     256#, fuzzy
     257#~| msgid "\"data-line\" value"
     258#~ msgid "\"data-start\" value"
     259#~ msgstr "data-line属性値"
     260
     261#~ msgid "Settings for displaying the number of lines"
     262#~ msgstr "行数の表示に関する設定"
     263
     264#~ msgid "Settings for displaying language name"
     265#~ msgstr "言語名の表示に関する設定"
     266
    249267#~ msgid "Default"
    250268#~ msgstr "デフォルト"
  • highlighting-code-block/tags/2.0.0/readme.txt

    r2886197 r2994656  
    44Tags: block, editor, guternberg, code, syntax, highlight, code highlighting, syntax highlight
    55Requires at least: 5.6
    6 Tested up to: 6.2
    7 Stable tag: 1.7.0
     6Tested up to: 6.4
     7Stable tag: 2.0.0
    88Requires PHP: 5.6
    99License: GPLv2 or later
     
    1919(However, we recommend using it in the "Block Editor".)
    2020
    21 Please see [this page](https://wemo.tech/2122/) for a detailed description of this plugin.(Japanese article)
    22 
    23 = How to use (For Block Editor) =
     21Please see the following page for a detailed explanation of this plugin.
     22
     23URL: [https://loos.co.jp/en/documents/highlighting-code-block/](https://loos.co.jp/en/documents/highlighting-code-block/)
     24
     25
     26### Source code
     27
     28The source code of this plugin is available on Github.
     29
     30URL: [https://github.com/ddryo/Highlighting-Code-Block](https://github.com/ddryo/Highlighting-Code-Block)
     31
     32### How to use
     33
     34#### How to use (For Block Editor)
    2435- Open the "Formatting" category of the Block Inserter.
    2536- There is a custom block named "Highlighing Code Block".
     
    2738- Select the language of the code and enter any code.
    2839
    29 = How to use (For Classic Editor) =
     40#### How to use (For Classic Editor)
    3041- You should see a select box labeled "Code Block" on the toolbar (2nd row by default).
    3142- When you select a language from the select box, a code block (pre tag) is inserted.
    3243
    3344
    34 = If it doesn't work =
     45#### If it doesn't work
    3546
    3647This plugin works only with PHP version 5.6 or later, WordPress 5.6 or later.
     
    3849
    3950
    40 = About settings =
     51#### About settings
    4152
    4253The menu "[HCB] Settings" should be added to "Settings" in the left menu of the management screen.
     
    95106== Changelog ==
    96107
     108= 2.0.0 =
     109- Support for WordPress 6.4.
     110- Support for PHP 8.2.
     111- The CSS and Block UI have been significantly adjusted.
     112- CSS custom properties have also been renamed and cleaned up overall.
     113- Added `data-start` attribute settings to blocks.
     114
    97115= 1.7.0 =
    98116- Support for WordPress 6.2.
  • highlighting-code-block/tags/2.0.0/sass-builder.js

    r2886197 r2994656  
    22// console.log('start sass-builder.js ...');
    33
    4 const path = require( 'path' );
    5 const fs = require( 'fs' );
     4const path = require('path');
     5const fs = require('fs');
     6const glob = require('glob');
    67
    78// node-sass
    8 const sass = require( 'node-sass' );
    9 const nodeSassGlobbing = require( 'node-sass-globbing' );
     9const sass = require('node-sass');
     10const globImporter = require('node-sass-glob-importer');
    1011
    1112// postcss
    12 const postcss = require( 'postcss' );
    13 const autoprefixer = require( 'autoprefixer' );
    14 const cssnano = require( 'cssnano' );
    15 const mqpacker = require( 'css-mqpacker' );
     13const postcss = require('postcss');
     14const autoprefixer = require('autoprefixer');
     15const cssnano = require('cssnano');
     16const mqpacker = require('css-mqpacker');
    1617
    1718// consoleの色付け
     
    1920const green = '\u001b[32m';
    2021
    21 const writeCSS = ( filePath, css ) => {
    22     const dir = path.dirname( filePath );
     22const writeCSS = (filePath, css) => {
     23    const dir = path.dirname(filePath);
    2324
    2425    // ディレクトリがなければ作成
    25     if ( ! fs.existsSync( dir ) ) {
    26         fs.mkdirSync( dir, { recursive: true } );
     26    if (!fs.existsSync(dir)) {
     27        fs.mkdirSync(dir, { recursive: true });
    2728    }
    2829
    2930    // css書き出し
    30     fs.writeFileSync( filePath, css );
     31    fs.writeFileSync(filePath, css);
    3132};
     33
     34// パス
    3235
    3336// パス
    3437const src = 'src/scss';
    3538const dist = 'build/css';
    36 const files = [
    37     'hcb',
    38     'hcb--light',
    39     'hcb--dark',
    40     'hcb-editor--light',
    41     'hcb-editor--dark',
    42     'hcb-admin',
    43 ];
     39// const files = [
     40//  'hcb',
     41//  'hcb--light',
     42//  'hcb--dark',
     43//  'hcb-editor--light',
     44//  'hcb-editor--dark',
     45//  'hcb-admin',
     46// ];
     47const ignore = ['**/_*.scss'];
     48const files = glob.sync(src + '/**/*.scss', { ignore });
     49// console.log('files', files);
    4450
    45 files.forEach( ( fileName ) => {
     51files.forEach((filePath) => {
     52    const fileName = filePath.replace(src + '/', '');
     53    const srcPath = path.resolve(__dirname, src, fileName);
     54    const distPath = path.resolve(__dirname, dist, fileName).replace('.scss', '.css');
     55
     56    // console.log(filePath, srcPath, distPath);
     57
    4658    // renderSyncだとimporter使えない
    4759    sass.render(
    4860        {
    49             file: path.resolve( __dirname, src, `${ fileName }.scss` ),
     61            file: srcPath,
    5062            outputStyle: 'compressed',
    51             importer: nodeSassGlobbing,
     63            importer: globImporter(),
    5264        },
    53         function ( err, sassResult ) {
    54             if ( err ) {
    55                 console.error( red + err );
     65        function (err, sassResult) {
     66            if (err) {
     67                console.error(red + err);
    5668            } else {
    5769                const css = sassResult.css.toString();
    58                 const filePath = path.resolve( __dirname, dist, `${ fileName }.css` );
    5970
    6071                // postcss実行
    61                 postcss( [ autoprefixer, mqpacker, cssnano ] )
    62                     .process( css, { from: undefined } )
    63                     .then( ( postcssResult ) => {
    64                         console.log( green + 'Wrote CSS to ' + filePath );
    65                         writeCSS( filePath, postcssResult.css );
     72                postcss([autoprefixer, mqpacker, cssnano])
     73                    .process(css, { from: undefined })
     74                    .then((postcssResult) => {
     75                        console.log(green + 'Wrote CSS to ' + distPath);
     76                        writeCSS(distPath, postcssResult.css);
    6677
    6778                        // if (postcssResult.map) {fs.writeFile('dest/app.css.map', postcssResult.map.toString(), () => true);}
    68                     } );
     79                    });
    6980            }
    7081        }
    7182    );
    72 } );
     83});
  • highlighting-code-block/tags/2.0.0/src/js/code-block/_utils.js

    r2359718 r2994656  
    33 * Function for setting code block height
    44 */
    5 export function setHeightCodeBlocks(elem) {
     5export function setHeightCodeBlocks(block, elem) {
    66    const num = elem.value.match(/\r\n|\n/g);
    7     let line;
     7    // let line;
    88    if (null !== num) {
    9         line = num.length + 1;
     9        // line = num.length + 1;
     10        elem.style.setProperty('--hcb--code-linenum', num.length + 1);
     11    }
     12    //  else {
     13    //  line = 1;
     14    // }
     15
     16    // let height = line * 1.5; // 1.5 = line-height
     17    // height += 2 * 2; // py
     18
     19    // offsetXXX: padding + border + scrollbar
     20    // scrollXXX: padding. スクロール可能なとき、見えていない部分のサイズも含む。
     21    // clientXXX: padding. スクロール可能なとき、見えている部分のサイズ。
     22    const isScrollableX = elem.scrollWidth > elem.offsetWidth;
     23    if (isScrollableX) {
     24        const scbarH = elem.offsetHeight - elem.clientHeight;
     25        elem.style.setProperty('--hcb--scbarH', scbarH + 'px');
     26        // elem.style.height = `calc(${height}em + ${scbarH}px)`;
    1027    } else {
    11         line = 1;
     28        // elem.style.height = height + 'em';
    1229    }
    13     elem.style.height = line * 1.8 + 1.6 + 2 + 'em';
    1430}
    1531
  • highlighting-code-block/tags/2.0.0/src/js/code-block/block.json

    r2669723 r2994656  
    3333            "default": ""
    3434        },
     35        "dataStart": {
     36            "type": "number",
     37            "default": 1
     38        },
    3539        "isLineShow": {
    3640            "type": "string",
  • highlighting-code-block/tags/2.0.0/src/js/code-block/edit.js

    r2886197 r2994656  
    33 */
    44import { __ } from '@wordpress/i18n';
    5 import { useBlockProps } from '@wordpress/block-editor';
    6 import { SelectControl } from '@wordpress/components';
    7 import { useEffect, useRef } from '@wordpress/element';
     5import { useBlockProps, InspectorControls, BlockControls } from '@wordpress/block-editor';
     6import {
     7    SelectControl,
     8    TextControl,
     9    // RadioControl,
     10    PanelBody,
     11    ToolbarGroup,
     12} from '@wordpress/components';
     13import { useState, useEffect, useRef } from '@wordpress/element';
    814
    915/**
    1016 * @Inner dependencies
    1117 */
    12 import HcbSidebar from './_sidebar';
    13 import { setHeightCodeBlocks } from './_utils';
     18// import { setHeightCodeBlocks } from './_utils';
    1419
    1520/**
     
    1924
    2025/**
    21  * 言語情報をグローバル変数から受け取る。
     26 * 設定情報をグローバル変数から受け取る。
    2227 */
    23 let hcbLangs = window.hcbLangs;
    24 if ( 'object' !== typeof hcbLangs ) {
    25     hcbLangs = {
     28const hcbShowLang = window.hcbVars?.showLang;
     29const hcbShowLinenum = window.hcbVars?.showLinenum;
     30
     31let HCB_LANGS = window?.hcbLangs || null;
     32if (null) {
     33    HCB_LANGS = {
    2634        html: 'HTML',
    2735        css: 'CSS',
     
    4452}
    4553
    46 const langList = [
     54// HCB_LANGS を配列化する
     55// const HCB_LANG_ARRAY = Object.entries(HCB_LANGS);
     56const HCB_LANG_ARRAY = [['plain', 'Plain'], ...Object.entries(HCB_LANGS)];
     57
     58const LANG_SELECT_OPTIONS = [
    4759    {
    4860        value: '',
    49         label: '- Lang Select -',
     61        label: 'Plain',
    5062    },
     63    ...Object.entries(HCB_LANGS).map(([key, value]) => ({
     64        value: key,
     65        label: value,
     66    })),
    5167];
    5268
    53 Object.keys( hcbLangs ).forEach( ( key ) => {
    54     langList.push( {
    55         value: key,
    56         label: hcbLangs[ key ],
    57     } );
    58 } );
     69const getLineNum = (code = '') => {
     70    const lineNums = code.match(/\r\n|\n/g);
     71    if (null !== lineNums) {
     72        return lineNums.length + 1;
     73    }
     74    return 1;
     75};
    5976
    6077// edit
    61 export default ( { attributes, setAttributes, clientId } ) => {
     78export default ({ attributes, setAttributes, clientId }) => {
    6279    const ref = useRef();
    6380
    6481    const {
    65         code,
    66         // langType,
     82        className,
     83        code = '',
     84        langType,
    6785        fileName,
    6886        langName,
    6987        dataLineNum,
     88        dataStart,
    7089        isShowLang,
    7190        isLineShow,
    7291    } = attributes;
    73 
    74     const blockClass = classnames( 'hcb_wrap', 'hcb-block' );
     92    // コード行数
     93    const [codeLineNum, setCodeLineNums] = useState(getLineNum(code));
     94
     95    const blockClass = classnames('hcb-block', 'hcb_wrap');
    7596
    7697    // クラスの重複バグの修正
    77     useEffect( () => {
    78         const nowClass = attributes.className;
    79         if ( ! nowClass ) return;
    80 
    81         const nowClasses = nowClass.split( ' ' );
    82         const newClasses = [ ...new Set( nowClasses ) ]; // 重複削除
    83         setAttributes( { className: classnames( newClasses ) } );
    84     }, [] );
     98    useEffect(() => {
     99        const nowClass = className || '';
     100        if (!nowClass) return;
     101
     102        const nowClasses = nowClass.split(' ');
     103        const newClasses = [...new Set(nowClasses)]; // 重複削除
     104        setAttributes({ className: classnames(newClasses) });
     105    }, [className, setAttributes]);
    85106
    86107    // コードの textarea 高さセット
    87     useEffect( () => {
     108    useEffect(() => {
    88109        const { ownerDocument } = ref.current;
    89110
    90         if ( ownerDocument ) {
    91             const hcbTextarea = ownerDocument.querySelector( `#block-${ clientId } .hcb_textarea` );
    92             setHeightCodeBlocks( hcbTextarea );
     111        if (ownerDocument) {
     112            const hcbBlock = ownerDocument.querySelector(`#block-${clientId}`);
     113            const hcbTextarea = hcbBlock.querySelector(`.hcb_textarea`);
     114            hcbBlock.style.setProperty('--hcb--code-linenum', codeLineNum);
     115
     116            // offsetXXX: padding + border + scrollbar
     117            // scrollXXX: padding. スクロール可能なとき、見えていない部分のサイズも含む。
     118            // clientXXX: padding. スクロール可能なとき、見えている部分のサイズ。
     119            const isScrollableX = hcbTextarea.scrollWidth > hcbTextarea.offsetWidth;
     120            if (isScrollableX) {
     121                const scbarH = hcbTextarea.offsetHeight - hcbTextarea.clientHeight;
     122                hcbBlock.style.setProperty('--hcb--scbarH', scbarH + 'px');
     123            }
    93124        }
    94     }, [ clientId, code ] );
     125    }, [clientId, codeLineNum]);
    95126
    96127    // preタグにつけるクラス名を生成して保存
     
    98129    // setAttributes({ preClass: preClass });
    99130
    100     const hcbShowLang = window.hcbEditorVars?.showLang;
    101     const hcbShowLinenum = window.hcbEditorVars?.showLinenum;
    102 
    103131    let dataShowLang = '0';
    104     if ( '1' === isShowLang ) {
     132    if ('1' === isShowLang) {
    105133        dataShowLang = '1';
    106     } else if ( '' === isShowLang && 'on' === hcbShowLang ) {
     134    } else if ('' === isShowLang && 'on' === hcbShowLang) {
    107135        dataShowLang = '1';
    108136    }
    109137
    110138    let dataShowLinenum = null;
    111     if ( 'on' === isLineShow ) {
     139    if ('on' === isLineShow) {
    112140        dataShowLinenum = '1';
    113     } else if ( 'undefined' === isLineShow && 'on' === hcbShowLinenum ) {
     141    } else if ('undefined' === isLineShow && 'on' === hcbShowLinenum) {
    114142        dataShowLinenum = '1';
    115143    }
    116144
    117     const blockProps = useBlockProps( {
     145    const blockProps = useBlockProps({
    118146        ref,
    119147        className: blockClass,
     
    122150        'data-show-lang': dataShowLang,
    123151        'data-show-linenum': dataShowLinenum,
    124         // 'data-line': dataLineNum || null,
    125     } );
     152        // 'data-line': dataLineNum || null, // edit側にはつけない
     153    });
     154
     155    // 新規配列を作成
     156    const langArray = [...HCB_LANG_ARRAY];
     157
     158    // lang未設定の時に 'Plain' は表示しない
     159    if (!langType) {
     160        langArray.shift();
     161    }
    126162
    127163    return (
    128164        <>
    129             <HcbSidebar { ...{ attributes, setAttributes } } />
    130             <div { ...blockProps }>
     165            <BlockControls>
     166                <ToolbarGroup
     167                    isCollapsed={true}
     168                    icon={<>{langName || __('Language', 'loos-hcb')}</>}
     169                    title='Lnaguage'
     170                    controls={langArray.map(([_langKey, _langName]) => {
     171                        return {
     172                            key: _langKey,
     173                            isActive: _langKey === langType,
     174                            title: _langName,
     175                            // icon: null,
     176                            onClick: () => {
     177                                if (_langKey === 'plain') {
     178                                    setAttributes({ langType: '', langName: '' });
     179                                } else {
     180                                    setAttributes({ langType: _langKey, langName: _langName });
     181                                }
     182                            },
     183                        };
     184                    })}
     185                />
     186            </BlockControls>
     187            <InspectorControls>
     188                <PanelBody title={__('HCB settings', 'loos-hcb')} initialOpen={true}>
     189                    <SelectControl
     190                        label={__('Language', 'loos-hcb')}
     191                        value={attributes.langType}
     192                        options={LANG_SELECT_OPTIONS}
     193                        onChange={(langKey) => {
     194                            if ('' === langKey) {
     195                                setAttributes({ langType: '', langName: '' });
     196                            } else {
     197                                setAttributes({ langType: langKey, langName: HCB_LANGS[langKey] });
     198                            }
     199                        }}
     200                    />
     201                    <SelectControl
     202                        label={__('Display number of rows', 'loos-hcb')} // 行数の表示
     203                        value={isLineShow}
     204                        options={[
     205                            {
     206                                label: __('Do not set individually', 'loos-hcb'), //個別で設定はしない
     207                                value: 'undefined',
     208                            },
     209                            {
     210                                label: __('Display row count', 'loos-hcb'), //行数を表示する
     211                                value: 'on',
     212                            },
     213                            {
     214                                label: __('Do not display row count', 'loos-hcb'), //行数を表示しない
     215                                value: 'off',
     216                            },
     217                        ]}
     218                        onChange={(val) => {
     219                            setAttributes({ isLineShow: val });
     220                        }}
     221                    />
     222                    <SelectControl
     223                        label={__('Display language name', 'loos-hcb')} // 言語名の表示に関する設定
     224                        value={isShowLang}
     225                        options={[
     226                            {
     227                                label: __('Do not set individually', 'loos-hcb'), //個別で設定はしない
     228                                value: '',
     229                            },
     230                            {
     231                                label: __('Display language', 'loos-hcb'), //言語を表示する
     232                                value: '1',
     233                            },
     234                            {
     235                                label: __('Do not display language', 'loos-hcb'), //言語を表示しない
     236                                value: '0',
     237                            },
     238                        ]}
     239                        onChange={(val) => {
     240                            setAttributes({ isShowLang: val });
     241                        }}
     242                    />
     243                    <TextControl
     244                        label={__('File name', 'loos-hcb')} // ファイル名
     245                        value={fileName}
     246                        onChange={(val) => {
     247                            setAttributes({ fileName: val });
     248                        }}
     249                    />
     250                    <TextControl
     251                        // ハイライトする行番号
     252                        label={
     253                            <>
     254                                {__('Highlight Number', 'loos-hcb') + ' ( '}
     255                                <code className='hcb-code-in-label'>[data-line]</code>
     256                                {' )'}
     257                            </>
     258                        }
     259                        value={dataLineNum}
     260                        onChange={(val) => {
     261                            setAttributes({ dataLineNum: val });
     262                        }}
     263                    />
     264                    <TextControl
     265                        type='number'
     266                        // 開始行番号
     267                        label={
     268                            <>
     269                                {__('First line number', 'loos-hcb') + ' ( '}
     270                                <code className='hcb-code-in-label'>[data-start]</code>
     271                                {' )'}
     272                            </>
     273                        }
     274                        value={dataStart || 1}
     275                        onChange={(val) => {
     276                            setAttributes({ dataStart: parseInt(val || 1) });
     277                        }}
     278                        style={{ opacity: dataShowLinenum ? 1 : 0.5 }}
     279                        disabled={dataShowLinenum ? false : true}
     280                    />
     281                </PanelBody>
     282            </InspectorControls>
     283            <div {...blockProps}>
    131284                <div className='hcb_codewrap'>
    132                     <div className='hcb_linenum'></div>
     285                    {dataShowLinenum && (
     286                        <div className='hcb_linenum'>
     287                            <div className='hcb-startNum'>{dataStart}</div>
     288                        </div>
     289                    )}
     290                    {/* <TextareaControl */}
    133291                    <textarea
    134292                        className='hcb_textarea'
    135293                        placeholder='Your Code...'
    136                         value={ code }
    137                         onChange={ ( e ) => {
    138                             setAttributes( { code: e.target.value } );
    139                             setHeightCodeBlocks( e.target );
    140                         } }
     294                        value={code}
     295                        onChange={(e) => {
     296                            const val = e.target.value;
     297                            setAttributes({ code: val });
     298                            // setHeightCodeBlocks(e.target);
     299                            const newCodeLineNum = getLineNum(val);
     300                            if (codeLineNum !== newCodeLineNum) {
     301                                setCodeLineNums(newCodeLineNum);
     302                            }
     303                        }}
    141304                    ></textarea>
    142                 </div>
    143                 <div className='hcb_controls'>
    144                     <SelectControl
    145                         value={ attributes.langType }
    146                         options={ langList }
    147                         onChange={ ( langKey ) => {
    148                             if ( '' === langKey ) {
    149                                 setAttributes( {
    150                                     langType: '',
    151                                     langName: '',
    152                                 } );
    153                             } else {
    154                                 setAttributes( {
    155                                     langType: langKey,
    156                                     langName: hcbLangs[ langKey ],
    157                                 } );
    158                             }
    159                         } }
    160                     />
    161                     <input
    162                         type='text'
    163                         className='filename_input'
    164                         value={ fileName }
    165                         placeholder={ __( 'file name', 'loos-hcb' ) } //ファイル名
    166                         onChange={ ( e ) => {
    167                             setAttributes( { fileName: e.target.value } );
    168                         } }
    169                     />
    170                     <input
    171                         type='text'
    172                         className='num_input'
    173                         value={ dataLineNum }
    174                         placeholder={ __( '"data-line" value', 'loos-hcb' ) } //data-line属性値
    175                         onChange={ ( e ) => {
    176                             setAttributes( { dataLineNum: e.target.value } );
    177                         } }
    178                     />
     305                    {dataLineNum && (
     306                        <div className='hcb-datapreview'>
     307                            <div className='hcb-datapreview__items'>{`{${dataLineNum}}`}</div>
     308                        </div>
     309                    )}
    179310                </div>
    180311            </div>
  • highlighting-code-block/tags/2.0.0/src/js/code-block/index.js

    r2669723 r2994656  
    1111import save from './save';
    1212import metadata from './block.json';
    13 import hcbIcon from './_icon';
     13import hcbIcon from './icon';
    1414import deprecated from './_deprecated';
    1515
     
    1717 * Register Highlighting Code Block
    1818 */
    19 registerBlockType( metadata.name, {
     19registerBlockType(metadata.name, {
    2020    icon: hcbIcon,
    2121    // attributes: metadata.attributes,
     
    2525            {
    2626                type: 'block',
    27                 blocks: [ 'core/code' ], //整形済みブロック : 'core/preformatted',
    28                 transform: ( attributes ) => {
    29                     return createBlock( 'loos-hcb/code-block', {
     27                blocks: ['core/code'], //整形済みブロック : 'core/preformatted',
     28                transform: (attributes) => {
     29                    return createBlock('loos-hcb/code-block', {
    3030                        code: attributes.content,
    31                     } );
     31                    });
    3232                },
    3333            },
     
    3737            {
    3838                type: 'block',
    39                 blocks: [ 'core/code' ],
    40                 transform: ( attributes ) => {
    41                     return createBlock( 'core/code', {
     39                blocks: ['core/code'],
     40                transform: (attributes) => {
     41                    return createBlock('core/code', {
    4242                        content: attributes.code,
    43                     } );
     43                    });
    4444                },
    4545            },
     
    4949    save,
    5050    deprecated,
    51 } );
     51});
  • highlighting-code-block/tags/2.0.0/src/js/code-block/save.js

    r2669723 r2994656  
    1515
    1616// save
    17 export default ( { attributes } ) => {
    18     const { code, fileName, langName, dataLineNum, isLineShow, isShowLang } = attributes;
     17export default ({ attributes }) => {
     18    const { code, fileName, langName, dataLineNum, dataStart, isLineShow, isShowLang } = attributes;
    1919    const langType = attributes.langType || 'plain';
    20     const preClass = classnames( 'prism', `${ isLineShow }-numbers`, `lang-${ langType }` );
     20    const preClass = classnames('prism', `${isLineShow}-numbers`, `lang-${langType}`);
    2121
    22     const blockProps = useBlockProps.save( {
     22    const blockProps = useBlockProps.save({
    2323        className: 'hcb_wrap',
    24     } );
     24    });
    2525    return (
    26         <div { ...blockProps }>
     26        <div {...blockProps}>
    2727            <pre
    28                 className={ preClass }
    29                 data-file={ fileName || null }
    30                 data-lang={ langName || null }
    31                 data-line={ dataLineNum || null }
    32                 data-show-lang={ isShowLang || null }
     28                className={preClass}
     29                data-file={fileName || null}
     30                data-lang={langName || null}
     31                data-line={dataLineNum || null}
     32                data-start={1 === dataStart ? null : dataStart}
     33                data-show-lang={isShowLang || null}
    3334            >
    34                 <RichText.Content tagName='code' value={ sanitizeCodeblock( code ) } />
     35                <RichText.Content tagName='code' value={sanitizeCodeblock(code)} />
    3536            </pre>
    3637        </div>
  • highlighting-code-block/tags/2.0.0/src/js/hcb_script.js

    r2886197 r2994656  
    1 document.addEventListener( 'DOMContentLoaded', function () {
     1document.addEventListener('DOMContentLoaded', function () {
    22    // if (!window.Prism) return;
    33
     
    66
    77    // Token customize
    8     const keyToken = document.querySelectorAll( '.token.keyword' );
    9     for ( let i = 0; i < keyToken.length; i++ ) {
    10         const elem = keyToken[ i ];
     8    const keyToken = document.querySelectorAll('.token.keyword');
     9    for (let i = 0; i < keyToken.length; i++) {
     10        const elem = keyToken[i];
    1111
    12         const defArr = [ 'function', 'def', 'class' ];
    13         if ( -1 !== defArr.indexOf( elem.textContent ) ) {
    14             elem.classList.add( 'def' );
    15         } else if ( 'this' === elem.textContent ) {
    16             elem.classList.add( 'this' );
     12        const defArr = ['function', 'def', 'class'];
     13        if (-1 !== defArr.indexOf(elem.textContent)) {
     14            elem.classList.add('def');
     15        } else if ('this' === elem.textContent) {
     16            elem.classList.add('this');
    1717        }
    1818    }
    1919
    2020    // Line highlighter position.
    21     const lineHighlighter = document.querySelectorAll( '.line-highlight' );
    22     for ( let i = 0; i < lineHighlighter.length; i++ ) {
    23         const elem = lineHighlighter[ i ];
    24         if ( ! elem.parentNode.classList.contains( 'line-numbers' ) ) {
    25             const dataStart = elem.getAttribute( 'data-start' );
     21    const lineHighlighter = document.querySelectorAll('.line-highlight');
     22    for (let i = 0; i < lineHighlighter.length; i++) {
     23        const elem = lineHighlighter[i];
     24        if (!elem.parentNode.classList.contains('line-numbers')) {
     25            const dataStart = elem.getAttribute('data-start');
    2626
    27             const topPosEm = ( dataStart - 1 ) * 1.5; //line-heightの値
     27            const topPosEm = (dataStart - 1) * 1.5; //line-heightの値
    2828
    2929            // Line highlighterの位置がずれるので桁数に応じて微調節 -> ずれなくなった?
     
    4343
    4444    // clipboard
    45     ( function () {
    46         if ( ! window.ClipboardJS ) return;
    47         if ( ! window.hcbVars?.showCopyBtn ) return;
     45    (function () {
     46        if (!window.ClipboardJS) return;
     47        if (!window.hcbVars?.showCopyBtn) return;
    4848
    4949        let clipCt = 1;
    5050
    5151        // hcb_wrap
    52         const hcbWraps = document.querySelectorAll( '.hcb_wrap' );
     52        const hcbWraps = document.querySelectorAll('.hcb_wrap');
    5353        // const hcbClips = document.querySelectorAll('.hcb-clipboard');
    54         for ( let i = 0; i < hcbWraps.length; i++ ) {
    55             const elem = hcbWraps[ i ];
    56             const code = elem.querySelector( 'code' );
    57             if ( null === code ) continue;
     54        for (let i = 0; i < hcbWraps.length; i++) {
     55            const elem = hcbWraps[i];
     56            const code = elem.querySelector('code');
     57            if (null === code) continue;
    5858
    5959            // ボタン生成
    60             const button = document.createElement( 'button' );
    61             button.classList.add( 'hcb-clipboard' );
    62             button.setAttribute( 'data-clipboard-target', '[data-hcb-clip="' + clipCt + '"]' );
    63             button.setAttribute( 'data-clipboard-action', 'copy' );
    64             button.setAttribute( 'aria-label', window.hcbVars?.copyBtnLabel || '' );
     60            const button = document.createElement('button');
     61            button.classList.add('hcb-clipboard');
     62            button.setAttribute('data-clipboard-target', '[data-hcb-clip="' + clipCt + '"]');
     63            button.setAttribute('data-clipboard-action', 'copy');
     64            button.setAttribute('aria-label', window.hcbVars?.copyBtnLabel || '');
    6565            // button.innerHTML = `コピー`;
    66             elem.prepend( button );
     66            elem.append(button);
    6767
    6868            // codeタグにターゲット属性追加
    69             code.setAttribute( 'data-hcb-clip', clipCt );
     69            code.setAttribute('data-hcb-clip', clipCt);
    7070
    7171            clipCt++;
    7272        }
    73         const clipboard = new ClipboardJS( '.hcb-clipboard' );
    74         clipboard.on( 'success', function ( e ) {
     73        const clipboard = new ClipboardJS('.hcb-clipboard');
     74        clipboard.on('success', function (e) {
    7575            const btn = e.trigger;
    76             btn.classList.add( '-done' );
    77             setTimeout( () => {
    78                 btn.classList.remove( '-done' );
    79             }, 5000 );
    80         } );
     76            btn.classList.add('-done');
     77            setTimeout(() => {
     78                btn.classList.remove('-done');
     79            }, 5000);
     80        });
    8181        // clipboard.on('error', function (e) {
    8282        //  alert(e);
    8383        // });
    84     } )();
    85 } );
     84    })();
     85});
  • highlighting-code-block/tags/2.0.0/src/scss/editor/_base.scss

    r2886197 r2994656  
     1@import "../root";
     2@import "./conrtols";
     3
    14// 共通
    25.mce-content-body .hcb_wrap {
     
    47}
    58
     9:root {
     10    --hcb--pY: 2em; // 高さセットにも使うので注意
     11    --hcb--pX: 1.5em;
     12    --hcb--linenumW: 3em;
     13}
     14
     15// Block: hcb_wrap > hcb_codewrap > hcb_textarea
     16// Classic: hcb_wrap > pre
    617.hcb_wrap {
     18    position: relative;
    719
    8     &.hcb_wrap {
     20    > .hcb_codewrap {
    921        position: relative;
    10         border: solid 1px #f1f1f1;
     22        padding-right: 0.75em;
     23        color: var(--hcb--c);
     24        background: var(--hcb--bgc);
     25        border-radius: var(--hcb--radius);
     26    }
     27}
    1128
    12         pre,
    13         textarea.hcb_textarea {
    14             position: static;
    15             display: block;
    16             box-sizing: border-box;
    17             width: 100%;
    18             margin: 0 !important;
    19             padding: 1.5em;
    20             overflow-x: auto;
    21             color: var(--hcb-color--text, #1f1e1e);
    22             font-size: var(--hcb-font-size, 14px);
    23             font-family: var(--hcb-font-family, "Menlo", "Consolas", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Meiryo", sans-serif);
    24             line-height: 1.8;
    25             white-space: pre !important;
    26             overflow-wrap: break-word;
    27             tab-size: 2;
    28             background: var(--hcb-color--bg, #f7f6f6);
    29             border: none;
    30             border-radius: 0;
    31         }
    32     }
     29.hcb_wrap > pre,
     30.hcb_codewrap,
     31.hcb_textarea {
     32    color: var(--hcb--c) !important;
     33    font-size: var(--hcb--fz, 14px) !important;
     34    font-family: var(--hcb--ff) !important;
     35    line-height: 1.5 !important;
     36    background: var(--hcb--bgc) !important;
     37}
    3338
    34     .hcb_codewrap {
    35         position: relative;
    36         padding-right: 1em;
    37         color: var(--hcb-color--text, #1f1e1e);
    38         background: var(--hcb-color--bg, #f7f6f6);
    39     }
     39
     40.hcb_wrap.hcb_wrap > pre,
     41.hcb_textarea.hcb_textarea {
     42    position: static;
     43    display: block;
     44    box-sizing: border-box;
     45    width: 100%;
     46    margin: 0 !important;
     47    padding: var(--hcb--pY) var(--hcb--pX);
     48    overflow-x: auto;
     49    white-space: pre !important;
     50    overflow-wrap: break-word;
     51    tab-size: 4;
     52    border: none;
     53    border-radius: 0;
    4054
    4155
    4256    // スクロールバー
    43     pre,
    44     textarea.hcb_textarea {
    45 
    46         &::-webkit-scrollbar {
    47             height: 8px;
    48             border: none;
    49         }
    50 
    51         &::-webkit-scrollbar-track {
    52             background: #f7f7f7;
    53             border: none;
    54         }
    55 
    56         &::-webkit-scrollbar-thumb {
    57             background: rgba(0, 0, 0, 0.1);
    58             border-radius: 4px;
    59         }
     57    &::-webkit-scrollbar {
     58        height: 6px;
     59        border: none;
    6060    }
    6161
    62     textarea.hcb_textarea {
    63         outline: none;
    64         box-shadow: none;
    65         resize: none;
     62    &::-webkit-scrollbar-track {
     63        background: var(--hcb--scbar-track--bgc);
     64        border: none;
    6665    }
    6766
    68     pre code {
    69         display: block;
    70         padding: 0 !important;
    71         color: inherit !important;
    72         font-family: inherit !important;
    73         tab-size: 2;
    74         background: inherit !important;
    75     }
    76 
    77     // 設定エリア
    78     .hcb_controls {
    79         display: flex;
    80         flex-wrap: wrap;
    81         padding: 8px 8px;
    82 
    83         &::after {
    84             display: block;
    85             clear: both;
    86             height: 0;
    87             visibility: hidden;
    88             content: "";
    89         }
    90 
    91         .components-base-control {
    92             flex-basis: 50%;
    93             max-width: 25rem;
    94 
    95             select {
    96                 width: 100%;
    97                 // margin: 0;
    98             }
    99         }
    100 
    101         .filename_input {
    102             flex-basis: 20%;
    103             // float: right;
    104             min-width: 10em;
    105             height: 28px;
    106             margin-left: auto;
    107             padding: 0 8px;
    108             line-height: 28px;
    109         }
    110 
    111         .num_input {
    112             flex-basis: 20%;
    113             // float: right;
    114             min-width: 10em;
    115             height: 28px;
    116             margin-left: 16px;
    117             padding: 0 8px;
    118             line-height: 28px;
    119         }
    120     }
    121 
    122     // エディダーではオン・オフが分かるように縦線だけ表示
    123     .hcb_linenum {
    124         position: absolute;
    125         top: 1em;
    126         left: 1em;
    127         display: none;
    128         width: 0;
    129         height: calc(100% - 2em);
    130         border-right: solid 1px rgba(150, 150, 150, 0.5);
     67    &::-webkit-scrollbar-thumb {
     68        background: var(--hcb--scbar-thumb--bgc);
     69        border-radius: 3px;
    13170    }
    13271}
    13372
    134 .hcb-block[data-show-linenum] {
     73.hcb_textarea.hcb_textarea {
     74    // `calc(${height}em + ${scbarH}px)`;
     75    height: calc(1.5em * var(--hcb--code-linenum, 1) + var(--hcb--pY) * 2 + var(--hcb--scbarH, 0px));
     76    outline: none;
     77    box-shadow: none;
     78    resize: none;
    13579
    136     .hcb_linenum {
    137         display: block;
     80    &::placeholder {
     81        color: inherit;
     82        font-style: italic;
     83        opacity: 0.5;
    13884    }
    13985
    140     textarea.hcb_textarea {
    141         width: calc(100% - 2em);
    142         margin-left: 2em !important;
    143         padding-left: 0.5em;
     86    &::-ms-input-placeholder,
     87    &::-moz-placeholder,
     88    &::-webkit-input-placeholder {
     89        color: inherit;
     90        font-style: italic;
     91        opacity: 0.5;
    14492    }
    14593}
    14694
    14795
     96.hcb_wrap > pre code {
     97    display: block;
     98    padding: 0 !important;
     99    color: inherit !important;
     100    font-family: inherit !important;
     101    tab-size: 2;
     102    background: inherit !important;
     103}
     104
     105// 行数表示 → エディダーではオン・オフが分かるように縦ボーダーだけ表示
     106.hcb_linenum {
     107    position: absolute;
     108    top: var(--hcb--pY);
     109    left: calc(var(--hcb--linenumW) / 2 + 0.5em);
     110    width: 0;
     111    height: calc(100% - var(--hcb--pY) * 2);
     112    color: var(--hcb--line-numbers--c);
     113    border-right: solid 1px currentcolor;
     114
     115    > .hcb-startNum {
     116        position: absolute;
     117        top: 0;
     118        right: 0.5em;
     119        right: calc(0.95em - 1px);
     120        font: inherit;
     121        font-size: 0.95em;
     122        line-height: 1.5;
     123        white-space: nowrap;
     124        word-wrap: normal;
     125        translate: 50%;
     126    }
     127}
     128
     129
     130.hcb-block[data-show-linenum] {
     131
     132    .hcb_codewrap {
     133        padding-left: calc(var(--hcb--linenumW) / 2 + 1em);
     134    }
     135
     136    .hcb_textarea {
     137        padding-left: calc(var(--hcb--linenumW) / 2 - 1em);
     138    }
     139
     140}
     141
     142
    148143// Lang Name
    149 .hcb_wrap pre::before, // for Classic
     144.hcb_wrap > pre::before, // for Classic
    150145.hcb-block::before {
    151146    position: absolute;
     
    156151    min-width: 4em;
    157152    padding: 0 10px;
    158     color: var(--hcb-color--lang--text, #1f1e1e);
    159     font-size: 12px;
    160     font-family: Arial, Helvetica, sans-serif;
     153    color: var(--hcb--data-label--c);
     154    font-size: 0.925em;
     155    font-family: inherit;
    161156    line-height: 20px;
    162157    text-align: center;
    163     background-color: var(--hcb-color--lang--bg, #dedede);
    164     content: attr(data-lang);
     158    background-color: var(--hcb--data-label--bgc);
     159    border-radius: 0 var(--hcb--radius);
     160    content: var(--hcb--data-label);
    165161}
    166162
    167163
     164.hcb-block[data-show-lang="0"] {
     165    --hcb--data-label: none;
     166}
     167
     168.hcb-block[data-show-lang="1"] {
     169    --hcb--data-label: attr(data-lang);
     170}
     171
     172// [data-file] があれば、lang 非表示でも表示する
    168173.hcb-block[data-file]::before {
    169174    padding: 0 8px 0 20px;
    170     background-image: var(--hcb-file-icon);
     175    background-image: var(--hcb--file-icon);
    171176    background-repeat: no-repeat;
    172177    background-position: center left 8px;
    173178    background-size: auto 10px;
    174     content: attr(data-file);
     179    content: attr(data-file); // --hcb--data-label: attr(data-file);
    175180}
    176181
    177 .hcb-block[data-show-lang="0"]:not([data-file])::before {
    178     content: none;
    179 }
     182// .hcb-block[data-show-lang="0"]:not([data-file])::before {
     183// content: none;
     184// }
    180185
    181 
    182 // ブロック非選択時
    183 [data-type="loos-hcb/code-block"]:not(.is-selected) {
    184 
    185     .hcb_controls {
    186         display: none;
    187     }
    188 }
    189 
    190 
    191 // デバイスプレビュー
    192 .wp-embed-responsive.editor-styles-wrapper {
    193 
    194     .hcb_controls {
    195         display: none;
    196     }
    197 }
  • highlighting-code-block/tags/2.0.0/src/scss/editor/_color--dark.scss

    r2886197 r2994656  
    1 body {
    2     --hcb-color--text: #f8f8f2;
    3     --hcb-color--text-shadow: rg1a1a1ab(136, 132, 132);
    4     --hcb-color--bg: #34352e;
    5     --hcb-color--lang--text: #fff;
    6     --hcb-color--lang--bg: #111;
    7     --hcb-file-icon: url(../../assets/img/file-icon-dark.svg);
     1:root {
     2    --hcb--c: #f8f8f2;
     3    --hcb--bgc: #34352e;
     4    --hcb--data-label--c: #fff;
     5    --hcb--data-label--bgc: #111;
     6    --hcb--file-icon: url(../../assets/img/file-icon-dark.svg);
     7    --hcb--scbar-track--bgc: rgba(255, 255, 255, 0.1);
     8    --hcb--scbar-thumb--bgc: rgba(255, 255, 255, 0.2);
     9
     10    // --hcb--placeholder--c: rgba(255, 255, 255, 0.4);
    811}
    9 
    10 
    11 // Gutenbergでのプレースホルダー
    12 .hcb_wrap textarea.hcb_textarea {
    13 
    14     &::placeholder {
    15         color: rgba(255, 255, 255, 0.4);
    16         font-style: italic;
    17     }
    18 
    19     &::-ms-input-placeholder,
    20     &::-moz-placeholder,
    21     &::-webkit-input-placeholder {
    22         color: rgba(255, 255, 255, 0.4);
    23         font-style: italic;
    24     }
    25 }
  • highlighting-code-block/tags/2.0.0/src/scss/editor/_color--light.scss

    r2886197 r2994656  
    1 body {
    2     --hcb-color--text: #1f1e1e;
    3     --hcb-color--text-shadow: #fff;
    4     --hcb-color--bg: #f7f6f6;
    5     --hcb-color--lang--text: #1f1e1e;
    6     --hcb-color--lang--bg: #dedede;
    7     --hcb-file-icon: url(../../assets/img/file-icon-light.svg);
    8 }
     1// :root {}
  • highlighting-code-block/tags/2.0.0/src/scss/front/_base.scss

    r2886197 r2994656  
     1@import "../root";
     2
     3
     4// ベース(テーマに上書きされないよう、クラス2重にして詳細度あげておく)
     5.hcb_wrap.hcb_wrap {
     6    position: relative;
     7    z-index: 0;
     8    display: block;
     9    margin-top: 2em;
     10    margin-bottom: 2em;
     11    padding: 0;
     12    font-size: var(--hcb--fz, 14px);
     13
     14    > pre {
     15        position: static;
     16        display: block;
     17        box-sizing: border-box;
     18        margin: 0;
     19        padding: var(--hcb--pY) var(--hcb--pX);
     20        overflow: auto;
     21        font-size: inherit;
     22        font-family: var(--hcb--ff);
     23        line-height: 1.5;
     24        letter-spacing: 0.1px;
     25        border-radius: var(--hcb--radius, 0);
     26        -webkit-overflow-scrolling: touch;
     27    }
     28
     29    > pre,
     30    > pre > code {
     31        color: var(--hcb--c);
     32        white-space: pre;
     33        text-align: left;
     34        text-shadow: var(--hcb--tsh);
     35        word-wrap: normal;
     36        word-break: normal;
     37        word-spacing: normal;
     38        tab-size: 4;
     39        hyphens: none;
     40        background: var(--hcb--bgc);
     41        border: none;
     42    }
     43
     44    :is(code, span) {
     45        box-sizing: border-box;
     46        margin: 0;
     47        padding: 0; // 一部の海外テーマでズレが生じるのを防ぐ
     48        font-size: inherit;
     49        font-family: inherit;
     50        line-height: inherit;
     51    }
     52}
     53
     54
    155/*
    2     カラーリングに関係ない共通設定
    3  */
    4 $hcbPaddingY: 1.75em;
    5 $hcbLineNumPadding: 3.75em;
    6 
     56  Note: .line-highlight の出現位置は、行数表示があるかどうかで変わる。
     57    行数表示がある → pre > .line-highlight
     58    行数表示がない → pre > code > .line-highlight
     59        また、このとき、.line-highlight は data-start, data-end を持つようになる。
     60*/
    761.hcb_wrap {
    8 
    9     // ベース(テーマに上書きされないよう、クラス2重にして詳細度あげておく)
    10     &.hcb_wrap {
    11         position: relative;
    12         z-index: 0;
    13         display: block;
    14         margin-top: 2em;
    15         margin-bottom: 2em;
    16         padding: 0;
    17 
    18         pre {
    19             position: static;
    20             display: block;
    21             box-sizing: border-box;
    22             margin: 0;
    23             padding: $hcbPaddingY 1.5em;
    24             overflow: auto;
    25             font-size: var(--hcb-font-size, 14px);
    26             font-family: var(--hcb-font-family, "Menlo", "Consolas", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Meiryo", sans-serif);
    27             line-height: 1;
    28             letter-spacing: 0.1px;
    29             border-radius: 0;
    30             -webkit-overflow-scrolling: touch;
    31 
    32             @media screen and (max-width: 599px) {
    33                 font-size: var(--hcb-font-size--mobile, 13px);
    34             }
    35         }
    36 
    37         code,
    38         pre {
    39             color: var(--hcb-color--text, #1f1e1e);
    40             white-space: pre;
    41             text-align: left;
    42             text-shadow: 0 1px var(--hcb-color--text-shadow, #fff);
    43             word-wrap: normal;
    44             word-break: normal;
    45             word-spacing: normal;
    46             tab-size: 4;
    47             hyphens: none;
    48             background: var(--hcb-color--bg, #f7f6f6);
    49             border: none;
    50         }
    51 
    52         code,
    53         span {
    54             box-sizing: border-box;
    55             margin: 0;
    56             padding: 0; // 一部の海外テーマでズレが生じるのを防ぐ
    57             font-size: inherit;
    58             font-family: inherit;
    59             line-height: 1.5;
    60         }
    61     }
    62 
    63 
    64     // line highlight
     62    // .prism[data-line] > .line-highlight
    6563    .line-highlight {
    6664        position: absolute;
    6765        right: 0;
    6866        left: 0;
    69         margin-top: $hcbPaddingY;
     67        margin-top: var(--hcb--pY);
    7068        padding: 0;
    7169        font-size: inherit;
    7270        line-height: inherit;
    7371        white-space: pre;
    74         background: var(--hcb-color--highlight, rgba(150, 120, 100, 0.1));
     72        background: var(--hcb--highlight-color);
    7573        pointer-events: none;
    7674
    77         &::before,
    78         &[data-end]::after {
    79             position: absolute;
    80             top: 0;
    81             left: 0;
    82             box-sizing: border-box;
    83             min-width: 1.5em;
    84             padding: 1px 2px;
    85             color: var(--hcb-color--highlight-text, #f5f2f0);
    86             font-weight: bold;
    87             font-size: 12px;
    88             line-height: inherit;
    89             text-align: center;
    90             text-shadow: none;
    91             vertical-align: middle;
    92             background-color: var(--hcb-color--highlight-bg, #b1aead);
    93             border-radius: 0;
    94             content: attr(data-start);
    95         }
    96 
    97         &[data-end]::after {
    98             top: auto;
    99             bottom: 0;
    100             content: attr(data-end);
    101         }
    102     }
    103 
    104     // 行数表示ある時はハイライトの行表示を消す
    105     .line-numbers .line-highlight::before,
    106     .line-numbers .line-highlight::after {
    107         content: none;
    108     }
    109 
    110     // line numbers
    111     pre.line-numbers {
    112         position: static; // pre の親の .hcb_wrap に追従
    113         padding-left: $hcbLineNumPadding;
     75
     76        // 1.8.0 で廃止
     77        // &::before,
     78        // &::after {
     79        //  position: absolute;
     80        //  top: 0;
     81        //  left: 0;
     82        //  box-sizing: border-box;
     83        //  min-width: 1.5em;
     84        //  padding: 1px 2px;
     85        //  color: var(--hcb--highlight-c);
     86        //  font-size: 12px;
     87        //  line-height: inherit;
     88        //  text-align: center;
     89        //  text-shadow: none;
     90        //  vertical-align: middle;
     91        //  background-color: var(--hcb--highlight-bgc);
     92        //  border-radius: 0;
     93        // }
     94
     95        // &[data-start]::before {
     96        //  content: attr(data-start);
     97        // }
     98
     99        // &[data-end]::after {
     100        //  top: auto;
     101        //  bottom: 0;
     102        //  content: attr(data-end);
     103        // }
     104    }
     105
     106    > .prism.line-numbers {
     107        position: static; // pre の親の .hcb_wrap に追従させたい
     108        padding-left: calc(var(--hcb--pX) + var(--hcb--linenumW)); // .hcb_wrap.hcb_wrap > pre に詳細度勝たないといけない
    114109        counter-reset: linenumber;
    115110
     
    120115    }
    121116
    122     .line-numbers .line-numbers-rows {
     117    .line-numbers-rows {
    123118        position: absolute;
    124         top: -2px;
    125         left: -$hcbLineNumPadding;
    126         width: 3em; // works for line-numbers below 1000 lines
    127         font-size: inherit;
    128         letter-spacing: -1px;
    129         border-right: 1px solid var(--hcb-color--line-numbers, #999);
    130         // -webkit-user-select: none;
    131         // -moz-user-select: none;
    132         // -ms-user-select: none;
     119        top: -0.125em;
     120        left: calc(-1px - var(--hcb--linenumW) - var(--hcb--pX) / 2);
     121        min-width: var(--hcb--linenumW);
     122        font-size: inherit;
     123        // letter-spacing: -1px;
     124        border-right: 1px solid var(--hcb--line-numbers--c);
    133125        user-select: none;
    134126        pointer-events: none;
     
    137129    .line-numbers-rows > span {
    138130        display: block;
     131        letter-spacing: -0.25px;
     132        text-align: center;
    139133        counter-increment: linenumber;
    140134        pointer-events: none;
     
    143137    .line-numbers-rows > span::before {
    144138        display: block;
    145         padding-right: 0.8em;
    146         color: var(--hcb-color--line-numbers, #999);
    147         text-align: right;
     139        color: var(--hcb--line-numbers--c);
    148140        content: counter(linenumber);
    149141    }
    150142
    151     // Lang Name
    152     pre::before {
    153         position: absolute;
    154         top: 0;
    155         right: 0;
    156         z-index: 1;
    157         box-sizing: border-box;
    158         min-width: 4em;
    159         padding: 0 10px;
    160         color: var(--hcb-color--lang--text, #1f1e1e);
    161         font-size: 12px;
    162         font-family: Arial, Helvetica, sans-serif;
    163         line-height: 20px;
    164         text-align: center;
    165         background-color: var(--hcb-color--lang--bg, #dedede);
    166         content: attr(data-lang);
    167     }
    168 
    169     // コピーボタンがある時
    170     .hcb-clipboard + pre::before {
    171         right: 26px;
    172     }
    173 
    174     // ファイル名を表示する時
    175     pre[data-file]::before {
    176         padding: 0 8px 0 20px;
    177         // background-colorを打ち消さないように分けて書く
    178         background-image: var(--hcb-file-icon);
    179         background-repeat: no-repeat;
    180         background-position: center left 8px;
    181         background-size: auto 10px;
    182         content: attr(data-file);
    183     }
    184 
    185     // 強制オフ時
    186     pre[data-show-lang="0"]:not([data-file])::before {
    187         content: none;
    188     }
    189 
    190     // コピーボタン
    191     .hcb-clipboard {
    192         position: absolute;
    193         top: 0;
    194         right: 0;
    195         z-index: 1;
    196         box-sizing: border-box;
    197         width: 20px;
    198         height: 20px;
    199         padding: 0;
    200         text-align: center;
    201         background-color: rgba(#fff, 0.8);
    202         background-image: url(../../assets/img/clipborad.svg);
    203         background-repeat: no-repeat;
    204         background-position: center;
    205         background-size: 16px auto;
     143    // scrollbar
     144    > pre::-webkit-scrollbar {
     145        height: 6px;
     146    }
     147
     148    > pre::-webkit-scrollbar-track {
     149        background: var(--hcb--scbar-track--bgc);
    206150        border: none;
    207         border-radius: 1px;
    208 
    209         &.-done {
    210             background-image: url(../../assets/img/copied.svg);
    211 
    212             &::before {
    213                 position: absolute;
    214                 right: 0;
    215                 bottom: 100%;
    216                 font-size: 14px;
    217                 font-family: Arial, Helvetica, sans-serif;
    218                 line-height: 1.5;
    219                 content: "Copied!";
    220             }
    221         }
    222     }
    223 
    224     // scrollbar
    225     pre::-webkit-scrollbar {
    226         height: 6px;
    227     }
    228 
    229     pre::-webkit-scrollbar-track {
    230         background: var(--hcb-color--scrollbar-track, rgba(150, 150, 150, 0.1));
    231         border: none;
    232     }
    233 
    234     pre::-webkit-scrollbar-thumb {
    235         background: var(--hcb-color--scrollbar-thumb, rgba(150, 150, 150, 0.25));
     151    }
     152
     153    > pre::-webkit-scrollbar-thumb {
     154        background: var(--hcb--scbar-thumb--bgc);
    236155        border-radius: 3px;
    237156    }
     
    245164    border-radius: 0.3em;
    246165}
     166
     167
     168// Lang Name, File Name
     169.hcb_wrap > pre::before {
     170    position: absolute;
     171    top: 0;
     172    right: 0;
     173    z-index: 1;
     174    box-sizing: border-box;
     175    min-width: 4em;
     176    padding: 0 10px;
     177    color: var(--hcb--data-label--c);
     178    font-size: 0.925em;
     179    font-family: inherit;
     180    line-height: 20px;
     181    text-align: center;
     182    background-color: var(--hcb--data-label--bgc);
     183    border-radius: 0 var(--hcb--radius);
     184    content: var(--hcb--data-label);
     185}
     186
     187
     188// 強制オフ時
     189.hcb_wrap > pre[data-show-lang="0"] {
     190    --hcb--data-label: none;
     191}
     192// 強制オン時
     193.hcb_wrap > pre[data-show-lang="1"] {
     194    --hcb--data-label: attr(data-lang);
     195}
     196
     197
     198// コピーボタンがある時
     199// .hcb-clipboard + pre::before {
     200//  right: 26px;
     201// }
     202
     203// ファイル名を表示する時
     204.hcb_wrap > pre[data-file]::before {
     205    padding: 0 8px 0 20px;
     206    // background-colorを打ち消さないように分けて書く
     207    background-image: var(--hcb--file-icon);
     208    background-repeat: no-repeat;
     209    background-position: center left 8px;
     210    background-size: auto 10px;
     211    content: attr(data-file);
     212}
     213
     214// data-show-lang
     215
     216// コピーボタン
     217/* stylelint-disable-next-line no-duplicate-selectors */
     218.hcb_wrap {
     219    --hcb-clipbtn-opacity: 0;
     220}
     221
     222.hcb_wrap:hover,
     223.hcb-clipboard:focus-visible {
     224    --hcb-clipbtn-opacity: 100;
     225}
     226
     227.hcb-clipboard {
     228    position: absolute;
     229    top: calc(var(--hcb--btn-offset, 0px) + 8px);
     230    right: 8px;
     231    z-index: 2;
     232    box-sizing: border-box;
     233    width: 2.25em;
     234    height: 2.25em;
     235    padding: 0;
     236    color: #000;
     237    text-align: center;
     238    background: url(../../assets/img/clipboard-to-copy.svg) no-repeat center / 64% auto;
     239    background-color: rgba(250, 250, 250, 0.8);
     240    border: none;
     241    border-radius: 3px;
     242    box-shadow: 0 1px 2px rgba(#3d3d3d, 0.25);
     243    opacity: var(--hcb-clipbtn-opacity);
     244    backdrop-filter: blur(2px);
     245    transition: opacity 0.25s;
     246
     247    [data-show-lang="0"] + & {
     248        --hcb--btn-offset: 0px;
     249    }
     250
     251    [data-show-lang="1"] + & {
     252        --hcb--btn-offset: 20px;
     253    }
     254
     255    &.-done {
     256        background-image: url(../../assets/img/clipboard-copied.svg);
     257
     258        &::before {
     259            position: absolute;
     260            top: 50%;
     261            right: calc(4px + 100%);
     262            display: block;
     263            padding: 2px 4px 2px 2px;
     264            color: inherit;
     265            font-size: 12px;
     266            font-family: Arial, Helvetica, sans-serif;
     267            line-height: 1;
     268            background-color: inherit;
     269            border-radius: 8px;
     270            content: "✓Copied";
     271            translate: 0 -50%;
     272        }
     273    }
     274}
  • highlighting-code-block/tags/2.0.0/src/scss/front/_color--dark.scss

    r2886197 r2994656  
    22  Dark coloring
    33*/
    4 body {
    5     --hcb-color--text: #f8f8f2;
    6     --hcb-color--text-shadow: rg1a1a1ab(136, 132, 132);
    7     --hcb-color--bg: #34352e;
    8     --hcb-color--lang--text: #fff;
    9     --hcb-color--lang--bg: #111;
    10     --hcb-color--line-numbers: #999;
    11     --hcb-color--highlight: rgba(255, 250, 245, 0.1);
    12     --hcb-color--highlight-text: #fcfcfc;
    13     --hcb-color--highlight-bg: #afa7a166;
    14     --hcb-file-icon: url(../../assets/img/file-icon-dark.svg);
    15     --hcb-color--scrollbar-track: rgba(255, 255, 255, 0.1);
    16     --hcb-color--scrollbar-thumb: rgba(255, 255, 255, 0.2);
     4:root {
     5    --hcb--c: #f9f9f6;
     6    // --hcb--tsh: none;
     7    --hcb--bgc: #2d2e29;
     8    --hcb--data-label--c: #fff;
     9    --hcb--data-label--bgc: #20211f;
     10    --hcb--line-numbers--c: #a3a3a3;
     11    --hcb--highlight-color: rgba(255, 250, 245, 0.1);
     12    --hcb--file-icon: url(../../assets/img/file-icon-dark.svg);
     13    --hcb--scbar-track--bgc: rgba(255, 255, 255, 0.1);
     14    --hcb--scbar-thumb--bgc: rgba(255, 255, 255, 0.2);
     15
    1716}
    1817
  • highlighting-code-block/tags/2.0.0/src/scss/front/_color--light.scss

    r2886197 r2994656  
    22  Light coloring
    33*/
    4 body {
    5     --hcb-color--text: #1f1e1e;
    6     --hcb-color--text-shadow: #fff;
    7     --hcb-color--bg: #f7f6f6;
    8     --hcb-color--lang--text: #1f1e1e;
    9     --hcb-color--lang--bg: #dedede;
    10     --hcb-color--line-numbers: #999;
    11     --hcb-color--highlight: rgba(150, 120, 100, 0.1);
    12     --hcb-color--highlight-text: #f5f2f0;
    13     --hcb-color--highlight-bg: #b1aead;
    14     --hcb-file-icon: url(../../assets/img/file-icon-light.svg);
    15     --hcb-color--scrollbar-track: rgba(0, 0, 0, 0.05);
    16     --hcb-color--scrollbar-thumb: #0000001a;
     4:root {
     5    --hcb--tsh: 1px 1px 0px rgb(240, 240, 240);
    176}
    187
  • highlighting-code-block/trunk/build/css/hcb--dark.css

    r2886197 r2994656  
    1 .hcb_wrap.hcb_wrap{display:block;margin-bottom:2em;margin-top:2em;padding:0;position:relative;z-index:0}.hcb_wrap.hcb_wrap pre{-webkit-overflow-scrolling:touch;border-radius:0;box-sizing:border-box;display:block;font-family:var(--hcb-font-family,"Menlo","Consolas","Hiragino Kaku Gothic ProN","Hiragino Sans","Meiryo",sans-serif);font-size:var(--hcb-font-size,14px);letter-spacing:.1px;line-height:1;margin:0;overflow:auto;padding:1.75em 1.5em;position:static}.hcb_wrap.hcb_wrap code,.hcb_wrap.hcb_wrap pre{word-wrap:normal;background:var(--hcb-color--bg,#f7f6f6);border:none;color:var(--hcb-color--text,#1f1e1e);-webkit-hyphens:none;hyphens:none;-o-tab-size:4;tab-size:4;text-align:left;text-shadow:0 1px var(--hcb-color--text-shadow,#fff);white-space:pre;word-break:normal;word-spacing:normal}.hcb_wrap.hcb_wrap code,.hcb_wrap.hcb_wrap span{box-sizing:border-box;font-family:inherit;font-size:inherit;line-height:1.5;margin:0;padding:0}.hcb_wrap .line-highlight{background:var(--hcb-color--highlight,hsla(24,20%,49%,.1));font-size:inherit;left:0;line-height:inherit;margin-top:1.75em;padding:0;pointer-events:none;position:absolute;right:0;white-space:pre}.hcb_wrap .line-highlight:before,.hcb_wrap .line-highlight[data-end]:after{background-color:var(--hcb-color--highlight-bg,#b1aead);border-radius:0;box-sizing:border-box;color:var(--hcb-color--highlight-text,#f5f2f0);content:attr(data-start);font-size:12px;font-weight:700;left:0;line-height:inherit;min-width:1.5em;padding:1px 2px;position:absolute;text-align:center;text-shadow:none;top:0;vertical-align:middle}.hcb_wrap .line-highlight[data-end]:after{bottom:0;content:attr(data-end);top:auto}.hcb_wrap .line-numbers .line-highlight:after,.hcb_wrap .line-numbers .line-highlight:before{content:none}.hcb_wrap pre.line-numbers{counter-reset:linenumber;padding-left:3.75em;position:static}.hcb_wrap pre.line-numbers>code{position:relative;white-space:inherit}.hcb_wrap .line-numbers .line-numbers-rows{border-right:1px solid var(--hcb-color--line-numbers,#999);font-size:inherit;left:-3.75em;letter-spacing:-1px;pointer-events:none;position:absolute;top:-2px;-webkit-user-select:none;user-select:none;width:3em}.hcb_wrap .line-numbers-rows>span{counter-increment:linenumber;display:block;pointer-events:none}.hcb_wrap .line-numbers-rows>span:before{color:var(--hcb-color--line-numbers,#999);content:counter(linenumber);display:block;padding-right:.8em;text-align:right}.hcb_wrap pre:before{background-color:var(--hcb-color--lang--bg,#dedede);box-sizing:border-box;color:var(--hcb-color--lang--text,#1f1e1e);content:attr(data-lang);font-family:Arial,Helvetica,sans-serif;font-size:12px;line-height:20px;min-width:4em;padding:0 10px;position:absolute;right:0;text-align:center;top:0;z-index:1}.hcb_wrap .hcb-clipboard+pre:before{right:26px}.hcb_wrap pre[data-file]:before{background-image:var(--hcb-file-icon);background-position:center left 8px;background-repeat:no-repeat;background-size:auto 10px;content:attr(data-file);padding:0 8px 0 20px}.hcb_wrap pre[data-show-lang="0"]:not([data-file]):before{content:none}.hcb_wrap .hcb-clipboard{background-color:hsla(0,0%,100%,.8);background-image:url(../../assets/img/clipborad.svg);background-position:50%;background-repeat:no-repeat;background-size:16px auto;border:none;border-radius:1px;box-sizing:border-box;height:20px;padding:0;position:absolute;right:0;text-align:center;top:0;width:20px;z-index:1}.hcb_wrap .hcb-clipboard.-done{background-image:url(../../assets/img/copied.svg)}.hcb_wrap .hcb-clipboard.-done:before{bottom:100%;content:"Copied!";font-family:Arial,Helvetica,sans-serif;font-size:14px;line-height:1.5;position:absolute;right:0}.hcb_wrap pre::-webkit-scrollbar{height:6px}.hcb_wrap pre::-webkit-scrollbar-track{background:var(--hcb-color--scrollbar-track,hsla(0,0%,59%,.1));border:none}.hcb_wrap pre::-webkit-scrollbar-thumb{background:var(--hcb-color--scrollbar-thumb,hsla(0,0%,59%,.25));border-radius:3px}:not(pre)>code.prism{border-radius:.3em;padding:.1em;white-space:normal}body{--hcb-color--text:#f8f8f2;--hcb-color--text-shadow:rg1a1a1ab(136,132,132);--hcb-color--bg:#34352e;--hcb-color--lang--text:#fff;--hcb-color--lang--bg:#111;--hcb-color--line-numbers:#999;--hcb-color--highlight:rgba(255,250,245,.1);--hcb-color--highlight-text:#fcfcfc;--hcb-color--highlight-bg:#afa7a166;--hcb-file-icon:url(../../assets/img/file-icon-dark.svg);--hcb-color--scrollbar-track:hsla(0,0%,100%,.1);--hcb-color--scrollbar-thumb:hsla(0,0%,100%,.2)}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#a8a897}.token.punctuation{color:#f8f8f2}.namespace{opacity:.7}.token.constant,.token.deleted,.token.important,.token.property,.token.symbol,.token.tag{color:#ff2c78}.token.boolean,.token.number{color:#ae81ff}.token.attr-name,.token.builtin,.token.char,.token.class-name,.token.inserted,.token.selector{color:#b4ec43}.language-css .token.string,.style .token.string,.token.entity,.token.operator,.token.url,.token.variable{color:#f8f8f2}.token.atrule,.token.attr-value,.token.function,.token.string{color:#f3e880}.token.function,.token.keyword.def{color:#5fe6ff}.token.keyword,.token.operator{color:#f92672}.token.keyword.this,.token.regex{color:#fd971f}.token.delimiter:not(.symbol){color:#5294ff}.token.bold{font-weight:700}.token.builtin,.token.italic,.token.keyword.def{font-style:italic}.token.entity{cursor:help}.language-css .token.property,.language-json .token.property,.language-scss .token.property{color:#5fe6ff}.language-php .token.important.delimiter{font-weight:400}.language-ruby .token.interpolation{color:#f8f8f2}.language-json .token.operator{color:#f3e880}@media screen and (max-width:599px){.hcb_wrap.hcb_wrap pre{font-size:var(--hcb-font-size--mobile,13px)}}
     1:root{--hcb--fz:var(--hcb--fz--base,14px);--hcb--ff:"Menlo","Consolas","Hiragino Kaku Gothic ProN","Hiragino Sans","Meiryo",sans-serif;--hcb--pY:1.75em;--hcb--pX:1.5em;--hcb--radius:3px;--hcb--linenumW:3.5ch;--hcb--data-label:attr(data-lang);--hcb--btn-offset:20px;--hcb--c:#1f1e1e;--hcb--tsh:unset;--hcb--bgc:#f8f6f6;--hcb--data-label--c:#1f1e1e;--hcb--data-label--bgc:#e8e8e8;--hcb--line-numbers--c:#999;--hcb--highlight-color:#9678641a;--hcb--file-icon:url(../../assets/img/file-icon-light.svg);--hcb--scbar-track--bgc:#9696961a;--hcb--scbar-thumb--bgc:#96969640}.hcb_wrap.hcb_wrap{display:block;font-size:var(--hcb--fz,14px);margin-bottom:2em;margin-top:2em;padding:0;position:relative;z-index:0}.hcb_wrap.hcb_wrap>pre{-webkit-overflow-scrolling:touch;border-radius:var(--hcb--radius,0);box-sizing:border-box;display:block;font-family:var(--hcb--ff);font-size:inherit;letter-spacing:.1px;line-height:1.5;margin:0;overflow:auto;padding:var(--hcb--pY) var(--hcb--pX);position:static}.hcb_wrap.hcb_wrap>pre,.hcb_wrap.hcb_wrap>pre>code{word-wrap:normal;background:var(--hcb--bgc);border:none;color:var(--hcb--c);-webkit-hyphens:none;hyphens:none;tab-size:4;text-align:left;text-shadow:var(--hcb--tsh);white-space:pre;word-break:normal;word-spacing:normal}.hcb_wrap.hcb_wrap :is(code,span){box-sizing:border-box;font-family:inherit;font-size:inherit;line-height:inherit;margin:0;padding:0}.hcb_wrap .line-highlight{background:var(--hcb--highlight-color);font-size:inherit;left:0;line-height:inherit;margin-top:var(--hcb--pY);padding:0;pointer-events:none;position:absolute;right:0;white-space:pre}.hcb_wrap>.prism.line-numbers{counter-reset:linenumber;padding-left:calc(var(--hcb--pX) + var(--hcb--linenumW));position:static}.hcb_wrap>.prism.line-numbers>code{position:relative;white-space:inherit}.hcb_wrap .line-numbers-rows{border-right:1px solid var(--hcb--line-numbers--c);font-size:inherit;left:calc(-1px - var(--hcb--linenumW) - var(--hcb--pX)/2);min-width:var(--hcb--linenumW);pointer-events:none;position:absolute;top:-.125em;-webkit-user-select:none;user-select:none}.hcb_wrap .line-numbers-rows>span{counter-increment:linenumber;display:block;letter-spacing:-.25px;pointer-events:none;text-align:center}.hcb_wrap .line-numbers-rows>span:before{color:var(--hcb--line-numbers--c);content:counter(linenumber);display:block}.hcb_wrap>pre::-webkit-scrollbar{height:6px}.hcb_wrap>pre::-webkit-scrollbar-track{background:var(--hcb--scbar-track--bgc);border:none}.hcb_wrap>pre::-webkit-scrollbar-thumb{background:var(--hcb--scbar-thumb--bgc);border-radius:3px}:not(pre)>code.prism{border-radius:.3em;padding:.1em;white-space:normal}.hcb_wrap>pre:before{background-color:var(--hcb--data-label--bgc);border-radius:0 var(--hcb--radius);box-sizing:border-box;color:var(--hcb--data-label--c);content:var(--hcb--data-label);font-family:inherit;font-size:.925em;line-height:20px;min-width:4em;padding:0 10px;position:absolute;right:0;text-align:center;top:0;z-index:1}.hcb_wrap>pre[data-show-lang="0"]{--hcb--data-label:none}.hcb_wrap>pre[data-show-lang="1"]{--hcb--data-label:attr(data-lang)}.hcb_wrap>pre[data-file]:before{background-image:var(--hcb--file-icon);background-position:center left 8px;background-repeat:no-repeat;background-size:auto 10px;content:attr(data-file);padding:0 8px 0 20px}.hcb_wrap{--hcb-clipbtn-opacity:0}.hcb-clipboard:focus-visible,.hcb_wrap:hover{--hcb-clipbtn-opacity:100}.hcb-clipboard{-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);background:url(../../assets/img/clipboard-to-copy.svg) no-repeat 50%/64% auto;background-color:#fafafacc;border:none;border-radius:3px;box-shadow:0 1px 2px #3d3d3d40;box-sizing:border-box;color:#000;height:2.25em;opacity:var(--hcb-clipbtn-opacity);padding:0;position:absolute;right:8px;text-align:center;top:calc(var(--hcb--btn-offset, 0px) + 8px);transition:opacity .25s;width:2.25em;z-index:2}[data-show-lang="0"]+.hcb-clipboard{--hcb--btn-offset:0px}[data-show-lang="1"]+.hcb-clipboard{--hcb--btn-offset:20px}.hcb-clipboard.-done{background-image:url(../../assets/img/clipboard-copied.svg)}.hcb-clipboard.-done:before{background-color:inherit;border-radius:8px;color:inherit;content:"✓Copied";display:block;font-family:Arial,Helvetica,sans-serif;font-size:12px;line-height:1;padding:2px 4px 2px 2px;position:absolute;right:calc(4px + 100%);top:50%;translate:0 -50%}:root{--hcb--c:#f9f9f6;--hcb--bgc:#2d2e29;--hcb--data-label--c:#fff;--hcb--data-label--bgc:#20211f;--hcb--line-numbers--c:#a3a3a3;--hcb--highlight-color:#fffaf51a;--hcb--file-icon:url(../../assets/img/file-icon-dark.svg);--hcb--scbar-track--bgc:#ffffff1a;--hcb--scbar-thumb--bgc:#fff3}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#a8a897}.token.punctuation{color:#f8f8f2}.namespace{opacity:.7}.token.constant,.token.deleted,.token.important,.token.property,.token.symbol,.token.tag{color:#ff2c78}.token.boolean,.token.number{color:#ae81ff}.token.attr-name,.token.builtin,.token.char,.token.class-name,.token.inserted,.token.selector{color:#b4ec43}.language-css .token.string,.style .token.string,.token.entity,.token.operator,.token.url,.token.variable{color:#f8f8f2}.token.atrule,.token.attr-value,.token.function,.token.string{color:#f3e880}.token.function,.token.keyword.def{color:#5fe6ff}.token.keyword,.token.operator{color:#f92672}.token.keyword.this,.token.regex{color:#fd971f}.token.delimiter:not(.symbol){color:#5294ff}.token.bold{font-weight:700}.token.builtin,.token.italic,.token.keyword.def{font-style:italic}.token.entity{cursor:help}.language-css .token.property,.language-json .token.property,.language-scss .token.property{color:#5fe6ff}.language-php .token.important.delimiter{font-weight:400}.language-ruby .token.interpolation{color:#f8f8f2}.language-json .token.operator{color:#f3e880}@media screen and (max-width:599px){:root{--hcb--fz:var(--hcb--fz--mobile,13px)}}
  • highlighting-code-block/trunk/build/css/hcb--light.css

    r2886197 r2994656  
    1 .hcb_wrap.hcb_wrap{display:block;margin-bottom:2em;margin-top:2em;padding:0;position:relative;z-index:0}.hcb_wrap.hcb_wrap pre{-webkit-overflow-scrolling:touch;border-radius:0;box-sizing:border-box;display:block;font-family:var(--hcb-font-family,"Menlo","Consolas","Hiragino Kaku Gothic ProN","Hiragino Sans","Meiryo",sans-serif);font-size:var(--hcb-font-size,14px);letter-spacing:.1px;line-height:1;margin:0;overflow:auto;padding:1.75em 1.5em;position:static}.hcb_wrap.hcb_wrap code,.hcb_wrap.hcb_wrap pre{word-wrap:normal;background:var(--hcb-color--bg,#f7f6f6);border:none;color:var(--hcb-color--text,#1f1e1e);-webkit-hyphens:none;hyphens:none;-o-tab-size:4;tab-size:4;text-align:left;text-shadow:0 1px var(--hcb-color--text-shadow,#fff);white-space:pre;word-break:normal;word-spacing:normal}.hcb_wrap.hcb_wrap code,.hcb_wrap.hcb_wrap span{box-sizing:border-box;font-family:inherit;font-size:inherit;line-height:1.5;margin:0;padding:0}.hcb_wrap .line-highlight{background:var(--hcb-color--highlight,hsla(24,20%,49%,.1));font-size:inherit;left:0;line-height:inherit;margin-top:1.75em;padding:0;pointer-events:none;position:absolute;right:0;white-space:pre}.hcb_wrap .line-highlight:before,.hcb_wrap .line-highlight[data-end]:after{background-color:var(--hcb-color--highlight-bg,#b1aead);border-radius:0;box-sizing:border-box;color:var(--hcb-color--highlight-text,#f5f2f0);content:attr(data-start);font-size:12px;font-weight:700;left:0;line-height:inherit;min-width:1.5em;padding:1px 2px;position:absolute;text-align:center;text-shadow:none;top:0;vertical-align:middle}.hcb_wrap .line-highlight[data-end]:after{bottom:0;content:attr(data-end);top:auto}.hcb_wrap .line-numbers .line-highlight:after,.hcb_wrap .line-numbers .line-highlight:before{content:none}.hcb_wrap pre.line-numbers{counter-reset:linenumber;padding-left:3.75em;position:static}.hcb_wrap pre.line-numbers>code{position:relative;white-space:inherit}.hcb_wrap .line-numbers .line-numbers-rows{border-right:1px solid var(--hcb-color--line-numbers,#999);font-size:inherit;left:-3.75em;letter-spacing:-1px;pointer-events:none;position:absolute;top:-2px;-webkit-user-select:none;user-select:none;width:3em}.hcb_wrap .line-numbers-rows>span{counter-increment:linenumber;display:block;pointer-events:none}.hcb_wrap .line-numbers-rows>span:before{color:var(--hcb-color--line-numbers,#999);content:counter(linenumber);display:block;padding-right:.8em;text-align:right}.hcb_wrap pre:before{background-color:var(--hcb-color--lang--bg,#dedede);box-sizing:border-box;color:var(--hcb-color--lang--text,#1f1e1e);content:attr(data-lang);font-family:Arial,Helvetica,sans-serif;font-size:12px;line-height:20px;min-width:4em;padding:0 10px;position:absolute;right:0;text-align:center;top:0;z-index:1}.hcb_wrap .hcb-clipboard+pre:before{right:26px}.hcb_wrap pre[data-file]:before{background-image:var(--hcb-file-icon);background-position:center left 8px;background-repeat:no-repeat;background-size:auto 10px;content:attr(data-file);padding:0 8px 0 20px}.hcb_wrap pre[data-show-lang="0"]:not([data-file]):before{content:none}.hcb_wrap .hcb-clipboard{background-color:hsla(0,0%,100%,.8);background-image:url(../../assets/img/clipborad.svg);background-position:50%;background-repeat:no-repeat;background-size:16px auto;border:none;border-radius:1px;box-sizing:border-box;height:20px;padding:0;position:absolute;right:0;text-align:center;top:0;width:20px;z-index:1}.hcb_wrap .hcb-clipboard.-done{background-image:url(../../assets/img/copied.svg)}.hcb_wrap .hcb-clipboard.-done:before{bottom:100%;content:"Copied!";font-family:Arial,Helvetica,sans-serif;font-size:14px;line-height:1.5;position:absolute;right:0}.hcb_wrap pre::-webkit-scrollbar{height:6px}.hcb_wrap pre::-webkit-scrollbar-track{background:var(--hcb-color--scrollbar-track,hsla(0,0%,59%,.1));border:none}.hcb_wrap pre::-webkit-scrollbar-thumb{background:var(--hcb-color--scrollbar-thumb,hsla(0,0%,59%,.25));border-radius:3px}:not(pre)>code.prism{border-radius:.3em;padding:.1em;white-space:normal}body{--hcb-color--text:#1f1e1e;--hcb-color--text-shadow:#fff;--hcb-color--bg:#f7f6f6;--hcb-color--lang--text:#1f1e1e;--hcb-color--lang--bg:#dedede;--hcb-color--line-numbers:#999;--hcb-color--highlight:hsla(24,20%,49%,.1);--hcb-color--highlight-text:#f5f2f0;--hcb-color--highlight-bg:#b1aead;--hcb-file-icon:url(../../assets/img/file-icon-light.svg);--hcb-color--scrollbar-track:rgba(0,0,0,.05);--hcb-color--scrollbar-thumb:#0000001a}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#708090}.token.punctuation{color:#5f5f5f}.namespace{opacity:.7}.token.boolean,.token.constant,.token.deleted,.token.number,.token.property,.token.symbol,.token.tag{color:#905}.token.attr-name,.token.builtin,.token.char,.token.class-name,.token.inserted,.token.selector,.token.string{color:#407b08}.language-css .token.string,.style .token.string,.token.entity,.token.url{color:#9a6e3a}.token.atrule,.token.attr-value,.token.function{color:#07a}.token.keyword,.token.operator{color:#c72c4c}.token.important,.token.keyword.this,.token.regex,.token.variable{color:#f18106}.token.bold{font-weight:700}.token.builtin,.token.italic,.token.keyword.def{font-style:italic}.token.entity{cursor:help}.token.delimiter.important{color:#183d86;font-weight:400}@media screen and (max-width:599px){.hcb_wrap.hcb_wrap pre{font-size:var(--hcb-font-size--mobile,13px)}}
     1:root{--hcb--fz:var(--hcb--fz--base,14px);--hcb--ff:"Menlo","Consolas","Hiragino Kaku Gothic ProN","Hiragino Sans","Meiryo",sans-serif;--hcb--pY:1.75em;--hcb--pX:1.5em;--hcb--radius:3px;--hcb--linenumW:3.5ch;--hcb--data-label:attr(data-lang);--hcb--btn-offset:20px;--hcb--c:#1f1e1e;--hcb--tsh:unset;--hcb--bgc:#f8f6f6;--hcb--data-label--c:#1f1e1e;--hcb--data-label--bgc:#e8e8e8;--hcb--line-numbers--c:#999;--hcb--highlight-color:#9678641a;--hcb--file-icon:url(../../assets/img/file-icon-light.svg);--hcb--scbar-track--bgc:#9696961a;--hcb--scbar-thumb--bgc:#96969640}.hcb_wrap.hcb_wrap{display:block;font-size:var(--hcb--fz,14px);margin-bottom:2em;margin-top:2em;padding:0;position:relative;z-index:0}.hcb_wrap.hcb_wrap>pre{-webkit-overflow-scrolling:touch;border-radius:var(--hcb--radius,0);box-sizing:border-box;display:block;font-family:var(--hcb--ff);font-size:inherit;letter-spacing:.1px;line-height:1.5;margin:0;overflow:auto;padding:var(--hcb--pY) var(--hcb--pX);position:static}.hcb_wrap.hcb_wrap>pre,.hcb_wrap.hcb_wrap>pre>code{word-wrap:normal;background:var(--hcb--bgc);border:none;color:var(--hcb--c);-webkit-hyphens:none;hyphens:none;tab-size:4;text-align:left;text-shadow:var(--hcb--tsh);white-space:pre;word-break:normal;word-spacing:normal}.hcb_wrap.hcb_wrap :is(code,span){box-sizing:border-box;font-family:inherit;font-size:inherit;line-height:inherit;margin:0;padding:0}.hcb_wrap .line-highlight{background:var(--hcb--highlight-color);font-size:inherit;left:0;line-height:inherit;margin-top:var(--hcb--pY);padding:0;pointer-events:none;position:absolute;right:0;white-space:pre}.hcb_wrap>.prism.line-numbers{counter-reset:linenumber;padding-left:calc(var(--hcb--pX) + var(--hcb--linenumW));position:static}.hcb_wrap>.prism.line-numbers>code{position:relative;white-space:inherit}.hcb_wrap .line-numbers-rows{border-right:1px solid var(--hcb--line-numbers--c);font-size:inherit;left:calc(-1px - var(--hcb--linenumW) - var(--hcb--pX)/2);min-width:var(--hcb--linenumW);pointer-events:none;position:absolute;top:-.125em;-webkit-user-select:none;user-select:none}.hcb_wrap .line-numbers-rows>span{counter-increment:linenumber;display:block;letter-spacing:-.25px;pointer-events:none;text-align:center}.hcb_wrap .line-numbers-rows>span:before{color:var(--hcb--line-numbers--c);content:counter(linenumber);display:block}.hcb_wrap>pre::-webkit-scrollbar{height:6px}.hcb_wrap>pre::-webkit-scrollbar-track{background:var(--hcb--scbar-track--bgc);border:none}.hcb_wrap>pre::-webkit-scrollbar-thumb{background:var(--hcb--scbar-thumb--bgc);border-radius:3px}:not(pre)>code.prism{border-radius:.3em;padding:.1em;white-space:normal}.hcb_wrap>pre:before{background-color:var(--hcb--data-label--bgc);border-radius:0 var(--hcb--radius);box-sizing:border-box;color:var(--hcb--data-label--c);content:var(--hcb--data-label);font-family:inherit;font-size:.925em;line-height:20px;min-width:4em;padding:0 10px;position:absolute;right:0;text-align:center;top:0;z-index:1}.hcb_wrap>pre[data-show-lang="0"]{--hcb--data-label:none}.hcb_wrap>pre[data-show-lang="1"]{--hcb--data-label:attr(data-lang)}.hcb_wrap>pre[data-file]:before{background-image:var(--hcb--file-icon);background-position:center left 8px;background-repeat:no-repeat;background-size:auto 10px;content:attr(data-file);padding:0 8px 0 20px}.hcb_wrap{--hcb-clipbtn-opacity:0}.hcb-clipboard:focus-visible,.hcb_wrap:hover{--hcb-clipbtn-opacity:100}.hcb-clipboard{-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);background:url(../../assets/img/clipboard-to-copy.svg) no-repeat 50%/64% auto;background-color:#fafafacc;border:none;border-radius:3px;box-shadow:0 1px 2px #3d3d3d40;box-sizing:border-box;color:#000;height:2.25em;opacity:var(--hcb-clipbtn-opacity);padding:0;position:absolute;right:8px;text-align:center;top:calc(var(--hcb--btn-offset, 0px) + 8px);transition:opacity .25s;width:2.25em;z-index:2}[data-show-lang="0"]+.hcb-clipboard{--hcb--btn-offset:0px}[data-show-lang="1"]+.hcb-clipboard{--hcb--btn-offset:20px}.hcb-clipboard.-done{background-image:url(../../assets/img/clipboard-copied.svg)}.hcb-clipboard.-done:before{background-color:inherit;border-radius:8px;color:inherit;content:"✓Copied";display:block;font-family:Arial,Helvetica,sans-serif;font-size:12px;line-height:1;padding:2px 4px 2px 2px;position:absolute;right:calc(4px + 100%);top:50%;translate:0 -50%}:root{--hcb--tsh:1px 1px 0px #f0f0f0}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#708090}.token.punctuation{color:#5f5f5f}.namespace{opacity:.7}.token.boolean,.token.constant,.token.deleted,.token.number,.token.property,.token.symbol,.token.tag{color:#905}.token.attr-name,.token.builtin,.token.char,.token.class-name,.token.inserted,.token.selector,.token.string{color:#407b08}.language-css .token.string,.style .token.string,.token.entity,.token.url{color:#9a6e3a}.token.atrule,.token.attr-value,.token.function{color:#07a}.token.keyword,.token.operator{color:#c72c4c}.token.important,.token.keyword.this,.token.regex,.token.variable{color:#f18106}.token.bold{font-weight:700}.token.builtin,.token.italic,.token.keyword.def{font-style:italic}.token.entity{cursor:help}.token.delimiter.important{color:#183d86;font-weight:400}@media screen and (max-width:599px){:root{--hcb--fz:var(--hcb--fz--mobile,13px)}}
  • highlighting-code-block/trunk/build/css/hcb-editor--dark.css

    r2886197 r2994656  
    1 .mce-content-body .hcb_wrap{margin:2em 0}.hcb_wrap.hcb_wrap{border:1px solid #f1f1f1;position:relative}.hcb_wrap.hcb_wrap pre,.hcb_wrap.hcb_wrap textarea.hcb_textarea{background:var(--hcb-color--bg,#f7f6f6);border:none;border-radius:0;box-sizing:border-box;color:var(--hcb-color--text,#1f1e1e);display:block;font-family:var(--hcb-font-family,"Menlo","Consolas","Hiragino Kaku Gothic ProN","Hiragino Sans","Meiryo",sans-serif);font-size:var(--hcb-font-size,14px);line-height:1.8;margin:0!important;overflow-wrap:break-word;overflow-x:auto;padding:1.5em;position:static;-o-tab-size:2;tab-size:2;white-space:pre!important;width:100%}.hcb_wrap .hcb_codewrap{background:var(--hcb-color--bg,#f7f6f6);color:var(--hcb-color--text,#1f1e1e);padding-right:1em;position:relative}.hcb_wrap pre::-webkit-scrollbar,.hcb_wrap textarea.hcb_textarea::-webkit-scrollbar{border:none;height:8px}.hcb_wrap pre::-webkit-scrollbar-track,.hcb_wrap textarea.hcb_textarea::-webkit-scrollbar-track{background:#f7f7f7;border:none}.hcb_wrap pre::-webkit-scrollbar-thumb,.hcb_wrap textarea.hcb_textarea::-webkit-scrollbar-thumb{background:rgba(0,0,0,.1);border-radius:4px}.hcb_wrap textarea.hcb_textarea{box-shadow:none;outline:none;resize:none}.hcb_wrap pre code{background:inherit!important;color:inherit!important;display:block;font-family:inherit!important;padding:0!important;-o-tab-size:2;tab-size:2}.hcb_wrap .hcb_controls{display:flex;flex-wrap:wrap;padding:8px}.hcb_wrap .hcb_controls:after{clear:both;content:"";display:block;height:0;visibility:hidden}.hcb_wrap .hcb_controls .components-base-control{flex-basis:50%;max-width:25rem}.hcb_wrap .hcb_controls .components-base-control select{width:100%}.hcb_wrap .hcb_controls .filename_input{flex-basis:20%;height:28px;line-height:28px;margin-left:auto;min-width:10em;padding:0 8px}.hcb_wrap .hcb_controls .num_input{flex-basis:20%;height:28px;line-height:28px;margin-left:16px;min-width:10em;padding:0 8px}.hcb_wrap .hcb_linenum{border-right:1px solid hsla(0,0%,59%,.5);display:none;height:calc(100% - 2em);left:1em;position:absolute;top:1em;width:0}.hcb-block[data-show-linenum] .hcb_linenum{display:block}.hcb-block[data-show-linenum] textarea.hcb_textarea{margin-left:2em!important;padding-left:.5em;width:calc(100% - 2em)}.hcb-block:before,.hcb_wrap pre:before{background-color:var(--hcb-color--lang--bg,#dedede);box-sizing:border-box;color:var(--hcb-color--lang--text,#1f1e1e);content:attr(data-lang);font-family:Arial,Helvetica,sans-serif;font-size:12px;line-height:20px;min-width:4em;padding:0 10px;position:absolute;right:0;text-align:center;top:0;z-index:1}.hcb-block[data-file]:before{background-image:var(--hcb-file-icon);background-position:center left 8px;background-repeat:no-repeat;background-size:auto 10px;content:attr(data-file);padding:0 8px 0 20px}.hcb-block[data-show-lang="0"]:not([data-file]):before{content:none}.wp-embed-responsive.editor-styles-wrapper .hcb_controls,[data-type="loos-hcb/code-block"]:not(.is-selected) .hcb_controls{display:none}body{--hcb-color--text:#f8f8f2;--hcb-color--text-shadow:rg1a1a1ab(136,132,132);--hcb-color--bg:#34352e;--hcb-color--lang--text:#fff;--hcb-color--lang--bg:#111;--hcb-file-icon:url(../../assets/img/file-icon-dark.svg)}.hcb_wrap textarea.hcb_textarea::placeholder{color:hsla(0,0%,100%,.4);font-style:italic}.hcb_wrap textarea.hcb_textarea::-moz-placeholder,.hcb_wrap textarea.hcb_textarea::-ms-input-placeholder,.hcb_wrap textarea.hcb_textarea::-webkit-input-placeholder{color:hsla(0,0%,100%,.4);font-style:italic}
     1:root{--hcb--fz:var(--hcb--fz--base,14px);--hcb--ff:"Menlo","Consolas","Hiragino Kaku Gothic ProN","Hiragino Sans","Meiryo",sans-serif;--hcb--pY:1.75em;--hcb--radius:3px;--hcb--linenumW:3.5ch;--hcb--data-label:attr(data-lang);--hcb--btn-offset:20px;--hcb--c:#1f1e1e;--hcb--tsh:unset;--hcb--bgc:#f8f6f6;--hcb--data-label--c:#1f1e1e;--hcb--data-label--bgc:#e8e8e8;--hcb--line-numbers--c:#999;--hcb--highlight-color:#9678641a;--hcb--file-icon:url(../../assets/img/file-icon-light.svg);--hcb--scbar-track--bgc:#9696961a;--hcb--scbar-thumb--bgc:#96969640}.hcb-code-in-label{font-size:.95em;padding:2px;text-transform:lowercase}.hcb-datapreview{background-color:inherit;border-radius:var(--hcb--radius);bottom:var(--hcb--scbarH,0);color:inherit;display:flex;flex-wrap:wrap;font-size:12px;gap:4px;line-height:1.25;opacity:.75;padding:2px 4px;position:absolute;right:0}.mce-content-body .hcb_wrap{margin:2em 0}:root{--hcb--pY:2em;--hcb--pX:1.5em;--hcb--linenumW:3em}.hcb_wrap{position:relative}.hcb_wrap>.hcb_codewrap{background:var(--hcb--bgc);border-radius:var(--hcb--radius);color:var(--hcb--c);padding-right:.75em;position:relative}.hcb_codewrap,.hcb_textarea,.hcb_wrap>pre{background:var(--hcb--bgc)!important;color:var(--hcb--c)!important;font-family:var(--hcb--ff)!important;font-size:var(--hcb--fz,14px)!important;line-height:1.5!important}.hcb_textarea.hcb_textarea,.hcb_wrap.hcb_wrap>pre{border:none;border-radius:0;box-sizing:border-box;display:block;margin:0!important;overflow-wrap:break-word;overflow-x:auto;padding:var(--hcb--pY) var(--hcb--pX);position:static;tab-size:4;white-space:pre!important;width:100%}.hcb_textarea.hcb_textarea::-webkit-scrollbar,.hcb_wrap.hcb_wrap>pre::-webkit-scrollbar{border:none;height:6px}.hcb_textarea.hcb_textarea::-webkit-scrollbar-track,.hcb_wrap.hcb_wrap>pre::-webkit-scrollbar-track{background:var(--hcb--scbar-track--bgc);border:none}.hcb_textarea.hcb_textarea::-webkit-scrollbar-thumb,.hcb_wrap.hcb_wrap>pre::-webkit-scrollbar-thumb{background:var(--hcb--scbar-thumb--bgc);border-radius:3px}.hcb_textarea.hcb_textarea{box-shadow:none;height:calc(1.5em*var(--hcb--code-linenum, 1) + var(--hcb--pY)*2 + var(--hcb--scbarH, 0px));outline:none;resize:none}.hcb_textarea.hcb_textarea::placeholder{color:inherit;font-style:italic;opacity:.5}.hcb_textarea.hcb_textarea::-moz-placeholder,.hcb_textarea.hcb_textarea::-ms-input-placeholder,.hcb_textarea.hcb_textarea::-webkit-input-placeholder{color:inherit;font-style:italic;opacity:.5}.hcb_wrap>pre code{background:inherit!important;color:inherit!important;display:block;font-family:inherit!important;padding:0!important;tab-size:2}.hcb_linenum{border-right:1px solid;color:var(--hcb--line-numbers--c);height:calc(100% - var(--hcb--pY)*2);left:calc(var(--hcb--linenumW)/2 + .5em);position:absolute;top:var(--hcb--pY);width:0}.hcb_linenum>.hcb-startNum{word-wrap:normal;font:inherit;font-size:.95em;line-height:1.5;position:absolute;right:.5em;right:calc(.95em - 1px);top:0;translate:50%;white-space:nowrap}.hcb-block[data-show-linenum] .hcb_codewrap{padding-left:calc(var(--hcb--linenumW)/2 + 1em)}.hcb-block[data-show-linenum] .hcb_textarea{padding-left:calc(var(--hcb--linenumW)/2 - 1em)}.hcb-block:before,.hcb_wrap>pre:before{background-color:var(--hcb--data-label--bgc);border-radius:0 var(--hcb--radius);box-sizing:border-box;color:var(--hcb--data-label--c);content:var(--hcb--data-label);font-family:inherit;font-size:.925em;line-height:20px;min-width:4em;padding:0 10px;position:absolute;right:0;text-align:center;top:0;z-index:1}.hcb-block[data-show-lang="0"]{--hcb--data-label:none}.hcb-block[data-show-lang="1"]{--hcb--data-label:attr(data-lang)}.hcb-block[data-file]:before{background-image:var(--hcb--file-icon);background-position:center left 8px;background-repeat:no-repeat;background-size:auto 10px;content:attr(data-file);padding:0 8px 0 20px}:root{--hcb--c:#f8f8f2;--hcb--bgc:#34352e;--hcb--data-label--c:#fff;--hcb--data-label--bgc:#111;--hcb--file-icon:url(../../assets/img/file-icon-dark.svg);--hcb--scbar-track--bgc:#ffffff1a;--hcb--scbar-thumb--bgc:#fff3}@media screen and (max-width:599px){:root{--hcb--fz:var(--hcb--fz--mobile,13px)}}
  • highlighting-code-block/trunk/build/css/hcb-editor--light.css

    r2886197 r2994656  
    1 .mce-content-body .hcb_wrap{margin:2em 0}.hcb_wrap.hcb_wrap{border:1px solid #f1f1f1;position:relative}.hcb_wrap.hcb_wrap pre,.hcb_wrap.hcb_wrap textarea.hcb_textarea{background:var(--hcb-color--bg,#f7f6f6);border:none;border-radius:0;box-sizing:border-box;color:var(--hcb-color--text,#1f1e1e);display:block;font-family:var(--hcb-font-family,"Menlo","Consolas","Hiragino Kaku Gothic ProN","Hiragino Sans","Meiryo",sans-serif);font-size:var(--hcb-font-size,14px);line-height:1.8;margin:0!important;overflow-wrap:break-word;overflow-x:auto;padding:1.5em;position:static;-o-tab-size:2;tab-size:2;white-space:pre!important;width:100%}.hcb_wrap .hcb_codewrap{background:var(--hcb-color--bg,#f7f6f6);color:var(--hcb-color--text,#1f1e1e);padding-right:1em;position:relative}.hcb_wrap pre::-webkit-scrollbar,.hcb_wrap textarea.hcb_textarea::-webkit-scrollbar{border:none;height:8px}.hcb_wrap pre::-webkit-scrollbar-track,.hcb_wrap textarea.hcb_textarea::-webkit-scrollbar-track{background:#f7f7f7;border:none}.hcb_wrap pre::-webkit-scrollbar-thumb,.hcb_wrap textarea.hcb_textarea::-webkit-scrollbar-thumb{background:rgba(0,0,0,.1);border-radius:4px}.hcb_wrap textarea.hcb_textarea{box-shadow:none;outline:none;resize:none}.hcb_wrap pre code{background:inherit!important;color:inherit!important;display:block;font-family:inherit!important;padding:0!important;-o-tab-size:2;tab-size:2}.hcb_wrap .hcb_controls{display:flex;flex-wrap:wrap;padding:8px}.hcb_wrap .hcb_controls:after{clear:both;content:"";display:block;height:0;visibility:hidden}.hcb_wrap .hcb_controls .components-base-control{flex-basis:50%;max-width:25rem}.hcb_wrap .hcb_controls .components-base-control select{width:100%}.hcb_wrap .hcb_controls .filename_input{flex-basis:20%;height:28px;line-height:28px;margin-left:auto;min-width:10em;padding:0 8px}.hcb_wrap .hcb_controls .num_input{flex-basis:20%;height:28px;line-height:28px;margin-left:16px;min-width:10em;padding:0 8px}.hcb_wrap .hcb_linenum{border-right:1px solid hsla(0,0%,59%,.5);display:none;height:calc(100% - 2em);left:1em;position:absolute;top:1em;width:0}.hcb-block[data-show-linenum] .hcb_linenum{display:block}.hcb-block[data-show-linenum] textarea.hcb_textarea{margin-left:2em!important;padding-left:.5em;width:calc(100% - 2em)}.hcb-block:before,.hcb_wrap pre:before{background-color:var(--hcb-color--lang--bg,#dedede);box-sizing:border-box;color:var(--hcb-color--lang--text,#1f1e1e);content:attr(data-lang);font-family:Arial,Helvetica,sans-serif;font-size:12px;line-height:20px;min-width:4em;padding:0 10px;position:absolute;right:0;text-align:center;top:0;z-index:1}.hcb-block[data-file]:before{background-image:var(--hcb-file-icon);background-position:center left 8px;background-repeat:no-repeat;background-size:auto 10px;content:attr(data-file);padding:0 8px 0 20px}.hcb-block[data-show-lang="0"]:not([data-file]):before{content:none}.wp-embed-responsive.editor-styles-wrapper .hcb_controls,[data-type="loos-hcb/code-block"]:not(.is-selected) .hcb_controls{display:none}body{--hcb-color--text:#1f1e1e;--hcb-color--text-shadow:#fff;--hcb-color--bg:#f7f6f6;--hcb-color--lang--text:#1f1e1e;--hcb-color--lang--bg:#dedede;--hcb-file-icon:url(../../assets/img/file-icon-light.svg)}
     1:root{--hcb--fz:var(--hcb--fz--base,14px);--hcb--ff:"Menlo","Consolas","Hiragino Kaku Gothic ProN","Hiragino Sans","Meiryo",sans-serif;--hcb--pY:1.75em;--hcb--radius:3px;--hcb--linenumW:3.5ch;--hcb--data-label:attr(data-lang);--hcb--btn-offset:20px;--hcb--c:#1f1e1e;--hcb--tsh:unset;--hcb--bgc:#f8f6f6;--hcb--data-label--c:#1f1e1e;--hcb--data-label--bgc:#e8e8e8;--hcb--line-numbers--c:#999;--hcb--highlight-color:#9678641a;--hcb--file-icon:url(../../assets/img/file-icon-light.svg);--hcb--scbar-track--bgc:#9696961a;--hcb--scbar-thumb--bgc:#96969640}.hcb-code-in-label{font-size:.95em;padding:2px;text-transform:lowercase}.hcb-datapreview{background-color:inherit;border-radius:var(--hcb--radius);bottom:var(--hcb--scbarH,0);color:inherit;display:flex;flex-wrap:wrap;font-size:12px;gap:4px;line-height:1.25;opacity:.75;padding:2px 4px;position:absolute;right:0}.mce-content-body .hcb_wrap{margin:2em 0}:root{--hcb--pY:2em;--hcb--pX:1.5em;--hcb--linenumW:3em}.hcb_wrap{position:relative}.hcb_wrap>.hcb_codewrap{background:var(--hcb--bgc);border-radius:var(--hcb--radius);color:var(--hcb--c);padding-right:.75em;position:relative}.hcb_codewrap,.hcb_textarea,.hcb_wrap>pre{background:var(--hcb--bgc)!important;color:var(--hcb--c)!important;font-family:var(--hcb--ff)!important;font-size:var(--hcb--fz,14px)!important;line-height:1.5!important}.hcb_textarea.hcb_textarea,.hcb_wrap.hcb_wrap>pre{border:none;border-radius:0;box-sizing:border-box;display:block;margin:0!important;overflow-wrap:break-word;overflow-x:auto;padding:var(--hcb--pY) var(--hcb--pX);position:static;tab-size:4;white-space:pre!important;width:100%}.hcb_textarea.hcb_textarea::-webkit-scrollbar,.hcb_wrap.hcb_wrap>pre::-webkit-scrollbar{border:none;height:6px}.hcb_textarea.hcb_textarea::-webkit-scrollbar-track,.hcb_wrap.hcb_wrap>pre::-webkit-scrollbar-track{background:var(--hcb--scbar-track--bgc);border:none}.hcb_textarea.hcb_textarea::-webkit-scrollbar-thumb,.hcb_wrap.hcb_wrap>pre::-webkit-scrollbar-thumb{background:var(--hcb--scbar-thumb--bgc);border-radius:3px}.hcb_textarea.hcb_textarea{box-shadow:none;height:calc(1.5em*var(--hcb--code-linenum, 1) + var(--hcb--pY)*2 + var(--hcb--scbarH, 0px));outline:none;resize:none}.hcb_textarea.hcb_textarea::placeholder{color:inherit;font-style:italic;opacity:.5}.hcb_textarea.hcb_textarea::-moz-placeholder,.hcb_textarea.hcb_textarea::-ms-input-placeholder,.hcb_textarea.hcb_textarea::-webkit-input-placeholder{color:inherit;font-style:italic;opacity:.5}.hcb_wrap>pre code{background:inherit!important;color:inherit!important;display:block;font-family:inherit!important;padding:0!important;tab-size:2}.hcb_linenum{border-right:1px solid;color:var(--hcb--line-numbers--c);height:calc(100% - var(--hcb--pY)*2);left:calc(var(--hcb--linenumW)/2 + .5em);position:absolute;top:var(--hcb--pY);width:0}.hcb_linenum>.hcb-startNum{word-wrap:normal;font:inherit;font-size:.95em;line-height:1.5;position:absolute;right:.5em;right:calc(.95em - 1px);top:0;translate:50%;white-space:nowrap}.hcb-block[data-show-linenum] .hcb_codewrap{padding-left:calc(var(--hcb--linenumW)/2 + 1em)}.hcb-block[data-show-linenum] .hcb_textarea{padding-left:calc(var(--hcb--linenumW)/2 - 1em)}.hcb-block:before,.hcb_wrap>pre:before{background-color:var(--hcb--data-label--bgc);border-radius:0 var(--hcb--radius);box-sizing:border-box;color:var(--hcb--data-label--c);content:var(--hcb--data-label);font-family:inherit;font-size:.925em;line-height:20px;min-width:4em;padding:0 10px;position:absolute;right:0;text-align:center;top:0;z-index:1}.hcb-block[data-show-lang="0"]{--hcb--data-label:none}.hcb-block[data-show-lang="1"]{--hcb--data-label:attr(data-lang)}.hcb-block[data-file]:before{background-image:var(--hcb--file-icon);background-position:center left 8px;background-repeat:no-repeat;background-size:auto 10px;content:attr(data-file);padding:0 8px 0 20px}@media screen and (max-width:599px){:root{--hcb--fz:var(--hcb--fz--mobile,13px)}}
  • highlighting-code-block/trunk/build/css/hcb.css

    r2886197 r2994656  
    1 .hcb_wrap.hcb_wrap{display:block;margin-bottom:2em;margin-top:2em;padding:0;position:relative;z-index:0}.hcb_wrap.hcb_wrap pre{-webkit-overflow-scrolling:touch;border-radius:0;box-sizing:border-box;display:block;font-family:var(--hcb-font-family,"Menlo","Consolas","Hiragino Kaku Gothic ProN","Hiragino Sans","Meiryo",sans-serif);font-size:var(--hcb-font-size,14px);letter-spacing:.1px;line-height:1;margin:0;overflow:auto;padding:1.75em 1.5em;position:static}.hcb_wrap.hcb_wrap code,.hcb_wrap.hcb_wrap pre{word-wrap:normal;background:var(--hcb-color--bg,#f7f6f6);border:none;color:var(--hcb-color--text,#1f1e1e);-webkit-hyphens:none;hyphens:none;-o-tab-size:4;tab-size:4;text-align:left;text-shadow:0 1px var(--hcb-color--text-shadow,#fff);white-space:pre;word-break:normal;word-spacing:normal}.hcb_wrap.hcb_wrap code,.hcb_wrap.hcb_wrap span{box-sizing:border-box;font-family:inherit;font-size:inherit;line-height:1.5;margin:0;padding:0}.hcb_wrap .line-highlight{background:var(--hcb-color--highlight,hsla(24,20%,49%,.1));font-size:inherit;left:0;line-height:inherit;margin-top:1.75em;padding:0;pointer-events:none;position:absolute;right:0;white-space:pre}.hcb_wrap .line-highlight:before,.hcb_wrap .line-highlight[data-end]:after{background-color:var(--hcb-color--highlight-bg,#b1aead);border-radius:0;box-sizing:border-box;color:var(--hcb-color--highlight-text,#f5f2f0);content:attr(data-start);font-size:12px;font-weight:700;left:0;line-height:inherit;min-width:1.5em;padding:1px 2px;position:absolute;text-align:center;text-shadow:none;top:0;vertical-align:middle}.hcb_wrap .line-highlight[data-end]:after{bottom:0;content:attr(data-end);top:auto}.hcb_wrap .line-numbers .line-highlight:after,.hcb_wrap .line-numbers .line-highlight:before{content:none}.hcb_wrap pre.line-numbers{counter-reset:linenumber;padding-left:3.75em;position:static}.hcb_wrap pre.line-numbers>code{position:relative;white-space:inherit}.hcb_wrap .line-numbers .line-numbers-rows{border-right:1px solid var(--hcb-color--line-numbers,#999);font-size:inherit;left:-3.75em;letter-spacing:-1px;pointer-events:none;position:absolute;top:-2px;-webkit-user-select:none;user-select:none;width:3em}.hcb_wrap .line-numbers-rows>span{counter-increment:linenumber;display:block;pointer-events:none}.hcb_wrap .line-numbers-rows>span:before{color:var(--hcb-color--line-numbers,#999);content:counter(linenumber);display:block;padding-right:.8em;text-align:right}.hcb_wrap pre:before{background-color:var(--hcb-color--lang--bg,#dedede);box-sizing:border-box;color:var(--hcb-color--lang--text,#1f1e1e);content:attr(data-lang);font-family:Arial,Helvetica,sans-serif;font-size:12px;line-height:20px;min-width:4em;padding:0 10px;position:absolute;right:0;text-align:center;top:0;z-index:1}.hcb_wrap .hcb-clipboard+pre:before{right:26px}.hcb_wrap pre[data-file]:before{background-image:var(--hcb-file-icon);background-position:center left 8px;background-repeat:no-repeat;background-size:auto 10px;content:attr(data-file);padding:0 8px 0 20px}.hcb_wrap pre[data-show-lang="0"]:not([data-file]):before{content:none}.hcb_wrap .hcb-clipboard{background-color:hsla(0,0%,100%,.8);background-image:url(../../assets/img/clipborad.svg);background-position:50%;background-repeat:no-repeat;background-size:16px auto;border:none;border-radius:1px;box-sizing:border-box;height:20px;padding:0;position:absolute;right:0;text-align:center;top:0;width:20px;z-index:1}.hcb_wrap .hcb-clipboard.-done{background-image:url(../../assets/img/copied.svg)}.hcb_wrap .hcb-clipboard.-done:before{bottom:100%;content:"Copied!";font-family:Arial,Helvetica,sans-serif;font-size:14px;line-height:1.5;position:absolute;right:0}.hcb_wrap pre::-webkit-scrollbar{height:6px}.hcb_wrap pre::-webkit-scrollbar-track{background:var(--hcb-color--scrollbar-track,hsla(0,0%,59%,.1));border:none}.hcb_wrap pre::-webkit-scrollbar-thumb{background:var(--hcb-color--scrollbar-thumb,hsla(0,0%,59%,.25));border-radius:3px}:not(pre)>code.prism{border-radius:.3em;padding:.1em;white-space:normal}@media screen and (max-width:599px){.hcb_wrap.hcb_wrap pre{font-size:var(--hcb-font-size--mobile,13px)}}
     1:root{--hcb--fz:var(--hcb--fz--base,14px);--hcb--ff:"Menlo","Consolas","Hiragino Kaku Gothic ProN","Hiragino Sans","Meiryo",sans-serif;--hcb--pY:1.75em;--hcb--pX:1.5em;--hcb--radius:3px;--hcb--linenumW:3.5ch;--hcb--data-label:attr(data-lang);--hcb--btn-offset:20px;--hcb--c:#1f1e1e;--hcb--tsh:unset;--hcb--bgc:#f8f6f6;--hcb--data-label--c:#1f1e1e;--hcb--data-label--bgc:#e8e8e8;--hcb--line-numbers--c:#999;--hcb--highlight-color:#9678641a;--hcb--file-icon:url(../../assets/img/file-icon-light.svg);--hcb--scbar-track--bgc:#9696961a;--hcb--scbar-thumb--bgc:#96969640}.hcb_wrap.hcb_wrap{display:block;font-size:var(--hcb--fz,14px);margin-bottom:2em;margin-top:2em;padding:0;position:relative;z-index:0}.hcb_wrap.hcb_wrap>pre{-webkit-overflow-scrolling:touch;border-radius:var(--hcb--radius,0);box-sizing:border-box;display:block;font-family:var(--hcb--ff);font-size:inherit;letter-spacing:.1px;line-height:1.5;margin:0;overflow:auto;padding:var(--hcb--pY) var(--hcb--pX);position:static}.hcb_wrap.hcb_wrap>pre,.hcb_wrap.hcb_wrap>pre>code{word-wrap:normal;background:var(--hcb--bgc);border:none;color:var(--hcb--c);-webkit-hyphens:none;hyphens:none;tab-size:4;text-align:left;text-shadow:var(--hcb--tsh);white-space:pre;word-break:normal;word-spacing:normal}.hcb_wrap.hcb_wrap :is(code,span){box-sizing:border-box;font-family:inherit;font-size:inherit;line-height:inherit;margin:0;padding:0}.hcb_wrap .line-highlight{background:var(--hcb--highlight-color);font-size:inherit;left:0;line-height:inherit;margin-top:var(--hcb--pY);padding:0;pointer-events:none;position:absolute;right:0;white-space:pre}.hcb_wrap>.prism.line-numbers{counter-reset:linenumber;padding-left:calc(var(--hcb--pX) + var(--hcb--linenumW));position:static}.hcb_wrap>.prism.line-numbers>code{position:relative;white-space:inherit}.hcb_wrap .line-numbers-rows{border-right:1px solid var(--hcb--line-numbers--c);font-size:inherit;left:calc(-1px - var(--hcb--linenumW) - var(--hcb--pX)/2);min-width:var(--hcb--linenumW);pointer-events:none;position:absolute;top:-.125em;-webkit-user-select:none;user-select:none}.hcb_wrap .line-numbers-rows>span{counter-increment:linenumber;display:block;letter-spacing:-.25px;pointer-events:none;text-align:center}.hcb_wrap .line-numbers-rows>span:before{color:var(--hcb--line-numbers--c);content:counter(linenumber);display:block}.hcb_wrap>pre::-webkit-scrollbar{height:6px}.hcb_wrap>pre::-webkit-scrollbar-track{background:var(--hcb--scbar-track--bgc);border:none}.hcb_wrap>pre::-webkit-scrollbar-thumb{background:var(--hcb--scbar-thumb--bgc);border-radius:3px}:not(pre)>code.prism{border-radius:.3em;padding:.1em;white-space:normal}.hcb_wrap>pre:before{background-color:var(--hcb--data-label--bgc);border-radius:0 var(--hcb--radius);box-sizing:border-box;color:var(--hcb--data-label--c);content:var(--hcb--data-label);font-family:inherit;font-size:.925em;line-height:20px;min-width:4em;padding:0 10px;position:absolute;right:0;text-align:center;top:0;z-index:1}.hcb_wrap>pre[data-show-lang="0"]{--hcb--data-label:none}.hcb_wrap>pre[data-show-lang="1"]{--hcb--data-label:attr(data-lang)}.hcb_wrap>pre[data-file]:before{background-image:var(--hcb--file-icon);background-position:center left 8px;background-repeat:no-repeat;background-size:auto 10px;content:attr(data-file);padding:0 8px 0 20px}.hcb_wrap{--hcb-clipbtn-opacity:0}.hcb-clipboard:focus-visible,.hcb_wrap:hover{--hcb-clipbtn-opacity:100}.hcb-clipboard{-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);background:url(../../assets/img/clipboard-to-copy.svg) no-repeat 50%/64% auto;background-color:#fafafacc;border:none;border-radius:3px;box-shadow:0 1px 2px #3d3d3d40;box-sizing:border-box;color:#000;height:2.25em;opacity:var(--hcb-clipbtn-opacity);padding:0;position:absolute;right:8px;text-align:center;top:calc(var(--hcb--btn-offset, 0px) + 8px);transition:opacity .25s;width:2.25em;z-index:2}[data-show-lang="0"]+.hcb-clipboard{--hcb--btn-offset:0px}[data-show-lang="1"]+.hcb-clipboard{--hcb--btn-offset:20px}.hcb-clipboard.-done{background-image:url(../../assets/img/clipboard-copied.svg)}.hcb-clipboard.-done:before{background-color:inherit;border-radius:8px;color:inherit;content:"✓Copied";display:block;font-family:Arial,Helvetica,sans-serif;font-size:12px;line-height:1;padding:2px 4px 2px 2px;position:absolute;right:calc(4px + 100%);top:50%;translate:0 -50%}@media screen and (max-width:599px){:root{--hcb--fz:var(--hcb--fz--mobile,13px)}}
  • highlighting-code-block/trunk/build/js/code-block/index.asset.php

    r2886197 r2994656  
    1 <?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'f4c02a0a618beab3fcd5f56b8c4dc46b');
     1<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'eee4433c3b38834bd373');
  • highlighting-code-block/trunk/build/js/code-block/index.js

    r2886197 r2994656  
    1 !function(){var e={643:function(e,t,a){"use strict";var n=window.wp.blocks,l=window.wp.element,o=window.wp.i18n,s=window.wp.blockEditor,r=window.wp.components,c=(0,l.memo)((e=>{let{attributes:t,setAttributes:a}=e;const{isLineShow:n,isShowLang:c}=t;return(0,l.createElement)(s.InspectorControls,null,(0,l.createElement)(r.PanelBody,{title:(0,o.__)("HCB settings","loos-hcb"),initialOpen:!0},(0,l.createElement)(r.RadioControl,{label:(0,o.__)("Settings for displaying the number of lines","loos-hcb"),selected:n,options:[{label:(0,o.__)("Do not set individually","loos-hcb"),value:"undefined"},{label:(0,o.__)("Display row count","loos-hcb"),value:"on"},{label:(0,o.__)("Do not display row count","loos-hcb"),value:"off"}],onChange:e=>{a({isLineShow:e})}}),(0,l.createElement)(r.RadioControl,{label:(0,o.__)("Settings for displaying language name","loos-hcb"),selected:c,options:[{label:(0,o.__)("Do not set individually","loos-hcb"),value:""},{label:(0,o.__)("Display language","loos-hcb"),value:"1"},{label:(0,o.__)("Do not display language","loos-hcb"),value:"0"}],onChange:e=>{a({isShowLang:e})}})))}));function i(e){const t=e.value.match(/\r\n|\n/g);let a;a=null!==t?t.length+1:1,e.style.height=1.8*a+1.6+2+"em"}function u(e){return e?e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"):e}var p=a(184),d=a.n(p);let m=window.hcbLangs;"object"!=typeof m&&(m={html:"HTML",css:"CSS",scss:"SCSS",js:"JavaScript",ts:"TypeScript",php:"PHP",ruby:"Ruby",python:"Python",swift:"Swift",c:"C",csharp:"C#",cpp:"C++",objectivec:"Objective-C",sql:"SQL",json:"JSON",bash:"Bash",git:"Git"});const g=[{value:"",label:"- Lang Select -"}];Object.keys(m).forEach((e=>{g.push({value:e,label:m[e]})}));var h=JSON.parse('{"u2":"loos-hcb/code-block"}'),f=(0,l.createElement)("svg",{x:"0px",y:"0px",viewBox:"0 0 512 512"},(0,l.createElement)("path",{d:"M48,346.8h34.6v51h31.2v-51h34.6v135.8h-34.6V428H82.6v54.5H48V346.8z"}),(0,l.createElement)("path",{d:"M268.1,344.3c17.5,0,31.6,8.3,41,17.3l-19,21.6c-6.2-5.6-12.8-9.2-22-9.2c-17.3,0-30.5,15.2-30.5,40.4 c0,26.1,13.2,40.6,32,40.6c9,0,16.4-4.5,22.4-11.1l19,21.1c-11.5,13.4-26.7,19.9-43.4,19.9c-35.3,0-65.4-23.1-65.4-69.4 C202.1,370.3,231.5,344.3,268.1,344.3z"}),(0,l.createElement)("path",{d:"M363,346.8h44.4c28.2,0,50.6,7.1,50.6,33.7c0,11.8-7.1,25.4-22.9,29.5v0.8c19.2,3.6,29,13.7,29,31.8 c0,28-23.1,40-52.6,40H363V346.8z M406.3,400.6c12.6,0,17.7-6,17.7-14.9c0-8.6-5.3-12.2-17.7-12.2h-8.5v27.1H406.3z M408.9,455.8 c14.7,0,21.1-5.5,21.1-16.2c0-10.5-6.4-14.9-21.1-14.9h-11.1v31H408.9z"}),(0,l.createElement)("polygon",{points:"209.8,56.9 184,31 39.3,175.7 39.3,175.7 39.3,175.7 184,320.4 209.8,294.6 91,175.7"}),(0,l.createElement)("polygon",{points:"302.2,56.9 328,31 472.7,175.7 472.7,175.7 472.7,175.7 328,320.4 302.2,294.6 421,175.7"})),b=[{supports:{className:!1},attributes:{code:{type:"string",source:"text",selector:"code"},className:{type:"string",default:""},langType:{type:"string",default:""},langName:{type:"string",default:""},fileName:{type:"string",default:""},dataLineNum:{type:"string",default:""},isLineShow:{type:"string",default:"undefined"},isShowLang:{type:"string",default:""}},save:e=>{let{attributes:t}=e;const{code:a,fileName:n,langName:o,dataLineNum:r,isLineShow:c,isShowLang:i}=t,p=t.langType||"plain";let m=d()("prism",`lang-${p}`);return"undefined"!==c&&(m=d()(m,`${c}-numbers`)),(0,l.createElement)("div",{className:"hcb_wrap"},(0,l.createElement)("pre",{className:m,"data-file":n||null,"data-lang":o||null,"data-line":r||null,"data-show-lang":i||null},(0,l.createElement)(s.RichText.Content,{tagName:"code",value:u(a)})))}},{supports:{className:!1},attributes:{code:{type:"string",source:"text",selector:"code"},className:{type:"string",default:""},langType:{type:"string",default:"plane"},langName:{type:"string",default:""},fileName:{type:"string",default:""},dataLineNum:{type:"string",default:""},isLineShow:{type:"string",default:"undefined"},isShowLang:{type:"string",default:""}},migrate:e=>("plane"===e.langType&&(e.langType=""),e),save:e=>{let{attributes:t}=e;const{code:a,langType:n,fileName:o,langName:r,dataLineNum:c,isLineShow:i,isShowLang:p}=t,d="prism "+i+"-numbers lang-"+n;return(0,l.createElement)("div",{className:"hcb_wrap"},(0,l.createElement)("pre",{className:d,"data-file":o||null,"data-lang":r||null,"data-line":c||null,"data-show-lang":p||null},(0,l.createElement)(s.RichText.Content,{tagName:"code",value:u(a)})))}}];(0,n.registerBlockType)(h.u2,{icon:f,transforms:{from:[{type:"block",blocks:["core/code"],transform:e=>(0,n.createBlock)("loos-hcb/code-block",{code:e.content})}],to:[{type:"block",blocks:["core/code"],transform:e=>(0,n.createBlock)("core/code",{content:e.code})}]},edit:e=>{let{attributes:t,setAttributes:a,clientId:n}=e;const u=(0,l.useRef)(),{code:p,fileName:h,langName:f,dataLineNum:b,isShowLang:v,isLineShow:y}=t,w=d()("hcb_wrap","hcb-block");(0,l.useEffect)((()=>{const e=t.className;if(!e)return;const n=e.split(" "),l=[...new Set(n)];a({className:d()(l)})}),[]),(0,l.useEffect)((()=>{const{ownerDocument:e}=u.current;e&&i(e.querySelector(`#block-${n} .hcb_textarea`))}),[n,p]);const N=window.hcbEditorVars?.showLang,S=window.hcbEditorVars?.showLinenum;let E="0";("1"===v||""===v&&"on"===N)&&(E="1");let _=null;("on"===y||"undefined"===y&&"on"===S)&&(_="1");const L=(0,s.useBlockProps)({ref:u,className:w,"data-file":h||null,"data-lang":f||null,"data-show-lang":E,"data-show-linenum":_});return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(c,{attributes:t,setAttributes:a}),(0,l.createElement)("div",L,(0,l.createElement)("div",{className:"hcb_codewrap"},(0,l.createElement)("div",{className:"hcb_linenum"}),(0,l.createElement)("textarea",{className:"hcb_textarea",placeholder:"Your Code...",value:p,onChange:e=>{a({code:e.target.value}),i(e.target)}})),(0,l.createElement)("div",{className:"hcb_controls"},(0,l.createElement)(r.SelectControl,{value:t.langType,options:g,onChange:e=>{a(""===e?{langType:"",langName:""}:{langType:e,langName:m[e]})}}),(0,l.createElement)("input",{type:"text",className:"filename_input",value:h,placeholder:(0,o.__)("file name","loos-hcb"),onChange:e=>{a({fileName:e.target.value})}}),(0,l.createElement)("input",{type:"text",className:"num_input",value:b,placeholder:(0,o.__)('"data-line" value',"loos-hcb"),onChange:e=>{a({dataLineNum:e.target.value})}}))))},save:e=>{let{attributes:t}=e;const{code:a,fileName:n,langName:o,dataLineNum:r,isLineShow:c,isShowLang:i}=t,p=t.langType||"plain",m=d()("prism",`${c}-numbers`,`lang-${p}`),g=s.useBlockProps.save({className:"hcb_wrap"});return(0,l.createElement)("div",g,(0,l.createElement)("pre",{className:m,"data-file":n||null,"data-lang":o||null,"data-line":r||null,"data-show-lang":i||null},(0,l.createElement)(s.RichText.Content,{tagName:"code",value:u(a)})))},deprecated:b})},184:function(e,t){var a;!function(){"use strict";var n={}.hasOwnProperty;function l(){for(var e=[],t=0;t<arguments.length;t++){var a=arguments[t];if(a){var o=typeof a;if("string"===o||"number"===o)e.push(a);else if(Array.isArray(a)){if(a.length){var s=l.apply(null,a);s&&e.push(s)}}else if("object"===o)if(a.toString===Object.prototype.toString)for(var r in a)n.call(a,r)&&a[r]&&e.push(r);else e.push(a.toString())}}return e.join(" ")}e.exports?(l.default=l,e.exports=l):void 0===(a=function(){return l}.apply(t,[]))||(e.exports=a)}()}},t={};function a(n){var l=t[n];if(void 0!==l)return l.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,a),o.exports}a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a(643)}();
     1(()=>{var e={184:(e,t)=>{var a;!function(){"use strict";var l={}.hasOwnProperty;function n(){for(var e=[],t=0;t<arguments.length;t++){var a=arguments[t];if(a){var o=typeof a;if("string"===o||"number"===o)e.push(a);else if(Array.isArray(a)){if(a.length){var r=n.apply(null,a);r&&e.push(r)}}else if("object"===o){if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]")){e.push(a.toString());continue}for(var c in a)l.call(a,c)&&a[c]&&e.push(c)}}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):void 0===(a=function(){return n}.apply(t,[]))||(e.exports=a)}()}},t={};function a(l){var n=t[l];if(void 0!==n)return n.exports;var o=t[l]={exports:{}};return e[l](o,o.exports,a),o.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var l in t)a.o(t,l)&&!a.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=window.wp.blocks,t=window.React,l=window.wp.i18n,n=window.wp.blockEditor,o=window.wp.components,r=window.wp.element;var c=a(184),s=a.n(c);const i=window.hcbVars?.showLang,u=window.hcbVars?.showLinenum;let d=window?.hcbLangs||null;const p=[["plain","Plain"],...Object.entries(d)],m=[{value:"",label:"Plain"},...Object.entries(d).map((([e,t])=>({value:e,label:t})))],g=(e="")=>{const t=e.match(/\r\n|\n/g);return null!==t?t.length+1:1};function h(e){return e?e.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"):e}const b=JSON.parse('{"u2":"loos-hcb/code-block"}'),f=(0,t.createElement)("svg",{x:"0px",y:"0px",viewBox:"0 0 512 512"},(0,t.createElement)("g",null,(0,t.createElement)("path",{d:"M54.4,348.2H89v51h31.2v-51h34.6V484h-34.6v-54.6H89v54.5H54.4V348.2z"}),(0,t.createElement)("path",{d:"M267.5,345.7c17.5,0,31.6,8.3,41,17.3l-19,21.6c-6.2-5.6-12.8-9.2-22-9.2c-17.3,0-30.5,15.2-30.5,40.4 c0,26.1,13.2,40.6,32,40.6c9,0,16.4-4.5,22.4-11.1l19,21.1c-11.5,13.4-26.7,19.9-43.4,19.9c-35.3,0-65.4-23.1-65.4-69.4 C201.6,371.7,230.9,345.7,267.5,345.7z"}),(0,t.createElement)("path",{d:"M356.5,348.2h44.4c28.2,0,50.6,7.1,50.6,33.7c0,11.8-7.1,25.4-22.9,29.5v0.8c19.2,3.6,29,13.7,29,31.8 c0,28-23.1,40-52.6,40h-48.5V348.2z M399.8,402c12.6,0,17.7-6,17.7-14.9c0-8.6-5.3-12.2-17.7-12.2h-8.5V402H399.8z M402.3,457.2 c14.7,0,21.1-5.5,21.1-16.2c0-10.5-6.4-14.9-21.1-14.9h-11.1v31h11.1V457.2z"})),(0,t.createElement)("polygon",{points:"172,311.6 195,288.6 76.2,165.7 195,42.9 172,19.8 30.1,165.7 "}),(0,t.createElement)("polygon",{points:"340,19.8 317,42.9 435.8,165.7 317,288.6 340,311.6 481.9,165.7 "})),y=[{supports:{className:!1},attributes:{code:{type:"string",source:"text",selector:"code"},className:{type:"string",default:""},langType:{type:"string",default:""},langName:{type:"string",default:""},fileName:{type:"string",default:""},dataLineNum:{type:"string",default:""},isLineShow:{type:"string",default:"undefined"},isShowLang:{type:"string",default:""}},save:({attributes:e})=>{const{code:a,fileName:l,langName:o,dataLineNum:r,isLineShow:c,isShowLang:i}=e,u=e.langType||"plain";let d=s()("prism",`lang-${u}`);return"undefined"!==c&&(d=s()(d,`${c}-numbers`)),(0,t.createElement)("div",{className:"hcb_wrap"},(0,t.createElement)("pre",{className:d,"data-file":l||null,"data-lang":o||null,"data-line":r||null,"data-show-lang":i||null},(0,t.createElement)(n.RichText.Content,{tagName:"code",value:h(a)})))}},{supports:{className:!1},attributes:{code:{type:"string",source:"text",selector:"code"},className:{type:"string",default:""},langType:{type:"string",default:"plane"},langName:{type:"string",default:""},fileName:{type:"string",default:""},dataLineNum:{type:"string",default:""},isLineShow:{type:"string",default:"undefined"},isShowLang:{type:"string",default:""}},migrate:e=>("plane"===e.langType&&(e.langType=""),e),save:({attributes:e})=>{const{code:a,langType:l,fileName:o,langName:r,dataLineNum:c,isLineShow:s,isShowLang:i}=e,u="prism "+s+"-numbers lang-"+l;return(0,t.createElement)("div",{className:"hcb_wrap"},(0,t.createElement)("pre",{className:u,"data-file":o||null,"data-lang":r||null,"data-line":c||null,"data-show-lang":i||null},(0,t.createElement)(n.RichText.Content,{tagName:"code",value:h(a)})))}}];(0,e.registerBlockType)(b.u2,{icon:f,transforms:{from:[{type:"block",blocks:["core/code"],transform:t=>(0,e.createBlock)("loos-hcb/code-block",{code:t.content})}],to:[{type:"block",blocks:["core/code"],transform:t=>(0,e.createBlock)("core/code",{content:t.code})}]},edit:({attributes:e,setAttributes:a,clientId:c})=>{const h=(0,r.useRef)(),{className:b,code:f="",langType:y,fileName:v,langName:w,dataLineNum:N,dataStart:E,isShowLang:_,isLineShow:S}=e,[L,x]=(0,r.useState)(g(f)),C=s()("hcb-block","hcb_wrap");(0,r.useEffect)((()=>{const e=b||"";if(!e)return;const t=e.split(" "),l=[...new Set(t)];a({className:s()(l)})}),[b,a]),(0,r.useEffect)((()=>{const{ownerDocument:e}=h.current;if(e){const t=e.querySelector(`#block-${c}`),a=t.querySelector(".hcb_textarea");if(t.style.setProperty("--hcb--code-linenum",L),a.scrollWidth>a.offsetWidth){const e=a.offsetHeight-a.clientHeight;t.style.setProperty("--hcb--scbarH",e+"px")}}}),[c,L]);let T="0";("1"===_||""===_&&"on"===i)&&(T="1");let k=null;("on"===S||"undefined"===S&&"on"===u)&&(k="1");const P=(0,n.useBlockProps)({ref:h,className:C,"data-file":v||null,"data-lang":w||null,"data-show-lang":T,"data-show-linenum":k}),B=[...p];return y||B.shift(),(0,t.createElement)(t.Fragment,null,(0,t.createElement)(n.BlockControls,null,(0,t.createElement)(o.ToolbarGroup,{isCollapsed:!0,icon:(0,t.createElement)(t.Fragment,null,w||(0,l.__)("Language","loos-hcb")),title:"Lnaguage",controls:B.map((([e,t])=>({key:e,isActive:e===y,title:t,onClick:()=>{a("plain"===e?{langType:"",langName:""}:{langType:e,langName:t})}})))})),(0,t.createElement)(n.InspectorControls,null,(0,t.createElement)(o.PanelBody,{title:(0,l.__)("HCB settings","loos-hcb"),initialOpen:!0},(0,t.createElement)(o.SelectControl,{label:(0,l.__)("Language","loos-hcb"),value:e.langType,options:m,onChange:e=>{a(""===e?{langType:"",langName:""}:{langType:e,langName:d[e]})}}),(0,t.createElement)(o.SelectControl,{label:(0,l.__)("Display number of rows","loos-hcb"),value:S,options:[{label:(0,l.__)("Do not set individually","loos-hcb"),value:"undefined"},{label:(0,l.__)("Display row count","loos-hcb"),value:"on"},{label:(0,l.__)("Do not display row count","loos-hcb"),value:"off"}],onChange:e=>{a({isLineShow:e})}}),(0,t.createElement)(o.SelectControl,{label:(0,l.__)("Display language name","loos-hcb"),value:_,options:[{label:(0,l.__)("Do not set individually","loos-hcb"),value:""},{label:(0,l.__)("Display language","loos-hcb"),value:"1"},{label:(0,l.__)("Do not display language","loos-hcb"),value:"0"}],onChange:e=>{a({isShowLang:e})}}),(0,t.createElement)(o.TextControl,{label:(0,l.__)("File name","loos-hcb"),value:v,onChange:e=>{a({fileName:e})}}),(0,t.createElement)(o.TextControl,{label:(0,t.createElement)(t.Fragment,null,(0,l.__)("Highlight Number","loos-hcb")+" ( ",(0,t.createElement)("code",{className:"hcb-code-in-label"},"[data-line]")," )"),value:N,onChange:e=>{a({dataLineNum:e})}}),(0,t.createElement)(o.TextControl,{type:"number",label:(0,t.createElement)(t.Fragment,null,(0,l.__)("First line number","loos-hcb")+" ( ",(0,t.createElement)("code",{className:"hcb-code-in-label"},"[data-start]")," )"),value:E||1,onChange:e=>{a({dataStart:parseInt(e||1)})},style:{opacity:k?1:.5},disabled:!k}))),(0,t.createElement)("div",{...P},(0,t.createElement)("div",{className:"hcb_codewrap"},k&&(0,t.createElement)("div",{className:"hcb_linenum"},(0,t.createElement)("div",{className:"hcb-startNum"},E)),(0,t.createElement)("textarea",{className:"hcb_textarea",placeholder:"Your Code...",value:f,onChange:e=>{const t=e.target.value;a({code:t});const l=g(t);L!==l&&x(l)}}),N&&(0,t.createElement)("div",{className:"hcb-datapreview"},(0,t.createElement)("div",{className:"hcb-datapreview__items"},`{${N}}`)))))},save:({attributes:e})=>{const{code:a,fileName:l,langName:o,dataLineNum:r,dataStart:c,isLineShow:i,isShowLang:u}=e,d=e.langType||"plain",p=s()("prism",`${i}-numbers`,`lang-${d}`),m=n.useBlockProps.save({className:"hcb_wrap"});return(0,t.createElement)("div",{...m},(0,t.createElement)("pre",{className:p,"data-file":l||null,"data-lang":o||null,"data-line":r||null,"data-start":1===c?null:c,"data-show-lang":u||null},(0,t.createElement)(n.RichText.Content,{tagName:"code",value:h(a)})))},deprecated:y})})()})();
  • highlighting-code-block/trunk/build/js/hcb_script.asset.php

    r2886197 r2994656  
    1 <?php return array('dependencies' => array(), 'version' => 'a41ce2112184d183ef84f00096e88ad5');
     1<?php return array('dependencies' => array(), 'version' => 'ba4f9f2286907745024d');
  • highlighting-code-block/trunk/build/js/hcb_script.js

    r2886197 r2994656  
    1 document.addEventListener("DOMContentLoaded",(function(){const t=document.querySelectorAll(".token.keyword");for(let e=0;e<t.length;e++){const n=t[e];-1!==["function","def","class"].indexOf(n.textContent)?n.classList.add("def"):"this"===n.textContent&&n.classList.add("this")}const e=document.querySelectorAll(".line-highlight");for(let t=0;t<e.length;t++){const n=e[t];if(!n.parentNode.classList.contains("line-numbers")){const t=1.5*(n.getAttribute("data-start")-1);n.style.top=t+"em"}}!function(){if(!window.ClipboardJS)return;if(!window.hcbVars?.showCopyBtn)return;let t=1;const e=document.querySelectorAll(".hcb_wrap");for(let n=0;n<e.length;n++){const o=e[n],c=o.querySelector("code");if(null===c)continue;const s=document.createElement("button");s.classList.add("hcb-clipboard"),s.setAttribute("data-clipboard-target",'[data-hcb-clip="'+t+'"]'),s.setAttribute("data-clipboard-action","copy"),s.setAttribute("aria-label",window.hcbVars?.copyBtnLabel||""),o.prepend(s),c.setAttribute("data-hcb-clip",t),t++}new ClipboardJS(".hcb-clipboard").on("success",(function(t){const e=t.trigger;e.classList.add("-done"),setTimeout((()=>{e.classList.remove("-done")}),5e3)}))}()}));
     1document.addEventListener("DOMContentLoaded",(function(){const t=document.querySelectorAll(".token.keyword");for(let e=0;e<t.length;e++){const n=t[e];-1!==["function","def","class"].indexOf(n.textContent)?n.classList.add("def"):"this"===n.textContent&&n.classList.add("this")}const e=document.querySelectorAll(".line-highlight");for(let t=0;t<e.length;t++){const n=e[t];if(!n.parentNode.classList.contains("line-numbers")){const t=1.5*(n.getAttribute("data-start")-1);n.style.top=t+"em"}}!function(){if(!window.ClipboardJS)return;if(!window.hcbVars?.showCopyBtn)return;let t=1;const e=document.querySelectorAll(".hcb_wrap");for(let n=0;n<e.length;n++){const o=e[n],c=o.querySelector("code");if(null===c)continue;const s=document.createElement("button");s.classList.add("hcb-clipboard"),s.setAttribute("data-clipboard-target",'[data-hcb-clip="'+t+'"]'),s.setAttribute("data-clipboard-action","copy"),s.setAttribute("aria-label",window.hcbVars?.copyBtnLabel||""),o.append(s),c.setAttribute("data-hcb-clip",t),t++}new ClipboardJS(".hcb-clipboard").on("success",(function(t){const e=t.trigger;e.classList.add("-done"),setTimeout((()=>{e.classList.remove("-done")}),5e3)}))}()}));
  • highlighting-code-block/trunk/class/loos_hcb.php

    r2886197 r2994656  
    151151
    152152        // Font size
    153         $inline_css .= ':root{--hcb-font-size: ' . $HCB['fontsize_pc'] . '}';
    154         $inline_css .= ':root{--hcb-font-size--mobile: ' . $HCB['fontsize_sp'] . '}';
     153        $inline_css .= ':root{--hcb--fz--base: ' . $HCB['fontsize_pc'] . '}';
     154        $inline_css .= ':root{--hcb--fz--mobile: ' . $HCB['fontsize_sp'] . '}';
    155155
    156156        // Font family
    157157        if ( $HCB['font_family'] ) {
    158             $inline_css .= ':root{--hcb-font-family:' . $HCB['font_family'] . '}';
     158            $inline_css .= ':root{--hcb--ff:' . $HCB['font_family'] . '}';
    159159        }
    160160
    161         // Code Lang
     161        // Code Lang (Default)
    162162        if ( 'off' === $HCB['show_lang'] ) {
    163             $inline_css .= '.hcb_wrap pre:not([data-file]):not([data-show-lang])::before{content: none;}';
     163            $inline_css .= '.hcb_wrap{--hcb--data-label: none;--hcb--btn-offset: 0px;}';
    164164        }
    165165
  • highlighting-code-block/trunk/class/loos_hcb_scripts.php

    r2886197 r2994656  
    2121    public static function register_hcb_block() {
    2222
    23         // ブロックのスクリプト登録 ( memo: wp_add_inline_script() で紐付けるために wp_register_script 必要 )
     23        // ブロックのスクリプト登録 ( memo: wp_add_inline_script() でグローバル変数を紐付けるために wp_register_script() で登録している )
    2424        $asset = include LOOS_HCB_PATH . '/build/js/code-block/index.asset.php';
    2525        wp_register_script(
     
    3232
    3333        // ブロックの登録
    34         register_block_type_from_metadata( LOOS_HCB_PATH . '/src/js/code-block' );
     34        register_block_type_from_metadata( LOOS_HCB_PATH . '/build/js/code-block' );
     35
     36        // エディタに渡すグローバル変数
     37        wp_add_inline_script(
     38            'hcb-code-block',
     39            'var hcbLangs = ' . self::get_lang_obj_str() . ';',
     40            'before'
     41        );
     42        wp_localize_script( 'hcb-code-block', 'hcbVars', [
     43            'showLang'    => LOOS_HCB::$settings['show_lang'],
     44            'showLinenum' => LOOS_HCB::$settings['show_linenum'],
     45        ] );
    3546    }
    3647
     
    115126        // 翻訳jsonファイルの読み込み
    116127        wp_set_script_translations( 'hcb-blocks', 'loos-hcb', LOOS_HCB_PATH . '/languages' );
    117 
    118         // 管理画面側に渡すグローバル変数
    119         wp_localize_script( 'hcb-blocks', 'hcbEditorVars', [
    120             'showLang'    => LOOS_HCB::$settings['show_lang'],
    121             'showLinenum' => LOOS_HCB::$settings['show_linenum'],
    122         ] );
    123128    }
    124129
     
    128133     * TinyMCEでも必要なので admin_head にフックさせている。
    129134     */
    130     public static function hook_admin_head() {
     135    public static function get_lang_obj_str() {
     136        $langs = LOOS_HCB::$settings['support_langs'];
    131137
    132         $langs = LOOS_HCB::$settings['support_langs'];
    133         $langs = mb_convert_kana( $langs, 'as' ); //全角の文字やスペースがあれば半角に直す
     138        // Replace full-width characters and spaces with half-width equivalents
     139        $langs = str_replace(
     140            [' ', '"', ''', ':', ';', ',' ],
     141            [' ', '"', "'", ':', ';', ',' ],
     142            $langs
     143        );
    134144        $langs = str_replace( ["\r\n", "\r", "\n" ], '', $langs );
    135145        $langs = trim( $langs, ',' );
    136146
    137         $code = 'var hcbLangs = {' . trim( $langs ) . '};';
     147        return '{' . trim( $langs ) . '}';
     148    }
    138149
    139         // for tinyMCE
    140         echo '<script id="hcb-langs">' . wp_kses( $code, [] ) . '</script>' . PHP_EOL;
    141 
    142         // for Gutenberg
    143         wp_add_inline_script( 'hcb-code-block', $code, 'before' );
     150    /**
     151     * Add code to Admin Head. (for TinyMCE)
     152     */
     153    public static function hook_admin_head() {
     154        echo '<script id="hcb-langs">var hcbLangs = ' . wp_kses( self::get_lang_obj_str(), [] ) . ';</script>' . PHP_EOL;
    144155    }
    145156}
  • highlighting-code-block/trunk/highlighting-code-block.php

    r2886197 r2994656  
    44 * Plugin URI: https://wordpress.org/plugins/highlighting-code-block/
    55 * Description: Add code block with syntax highlighting using prism.js. (Available for Gutenberg and Classic Editor)
    6  * Version: 1.7.0
     6 * Version: 2.0.0
    77 * Requires at least: 5.6
    88 * Author: LOOS, Inc.
  • highlighting-code-block/trunk/languages/loos-hcb-ja-hcb-blocks.json

    r2359718 r2994656  
    1 {"domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural_forms":"nplurals=1; plural=0;","lang":"ja_JP"},"HCB settings":["HCB設定"],"Settings for displaying the number of lines":["行数の表示に関する設定"],"Do not set individually":["個別で設定はしない"],"Display row count":["行数を表示する"],"Do not display row count":["行数を表示しない"],"Settings for displaying language name":["言語名の表示に関する設定"],"Display language":["言語を表示する"],"Do not display language":["言語を表示しない"],"\"data-line\" value":["data-line属性値"],"file name":["ファイル名"],"[HCB] Settings":["[HCB] 設定"],"Highlighting Code Block settings":["Highlighting Code Block 設定"],"Basic settings":["基本設定"],"Display language name":["言語の表示"],"Display language name in code block":["コードブロックに言語名を表示する"],"If checked, the language type is displayed in the code on the site display side.":["チェックすると、サイト表示側のコードに言語の種類が表示されます。"],"Display settings for the number of rows":["行数の表示設定"],"Show line count in code block":["コードブロックに行数を表示する"],"If checked, the number of lines will be displayed on the left end of the code on the site display side.":["チェックすると、サイト表示側のコードの左端に行数が表示されます。"],"Font smoothing":["フォントスムージング"],"Turn on font smoothing":["フォントスムージングをオンにする"],"Add %s and %s to the code block.":["コードブロックに %s と %s が追加されます。"],"Cord coloring (front side)":["コードカラーリング(フロント側)"],"Code coloring (editor side)":["コードカラーリング(エディター側)"],"Font Size":["フォントサイズ"],"\"Font-family\" in code":["コードの “font-family”"],"Default":["デフォルト"],"Advanced settings":["高度な設定"],"Language set to use":["使用する言語セット"],"Write in the format of %s, separated by \",\" (comma).":["%s の形式で、”,”(カンマ)区切りで記述してください。"],"class-key:\"language-name\"":["クラスキー:”言語名”"],"\"class-key\" is the class name used in prism.js (the part corresponding to \"◯◯\" in \"lang- ◯◯\")":["「クラスキー」は、prism.jsで使用されるクラス名(「lang-◯◯」の「◯◯」に該当する部分)です。"],"* If you use a language that is not supported by default, please use it together with \"Original prism.js\" setting.":["※ デフォルトでサポートされていない言語を使用する場合、「独自prism.js」設定と併用してください。"],"Original coloring file":["独自カラーリングファイル"],"Load your own CSS file for code coloring.":["あなたが用意したコードカラーリング用のCSSファイルを読み込みます。"],"Original prism.js":["独自prism.js"],"You can use the prism.js file corresponding to your own language set.":["自分専用の言語セットに対応したprism.jsファイルを使用できます。"],"help":["ヘルプ"],"When you use each original file, please upload it in the theme folder.":["各独自ファイルを使用する場合は、テーマフォルダの中にアップロードしてください。"],"If you set the path to your own file, the default coloring file and prism.js file will not be loaded..":["独自ファイルへのパスを設定すると、デフォルトのカラーリングファイルやprism.jsファイルは読み込まれなくなります。"],"* The currently loaded prism.js file can be downloaded at %s.":["※ 現在読み込んでいるprism.jsファイルは、 %s でダウンロードできます。"],"Here":["こちら"],"Highlighting Code Block":["Highlighting Code Block"],"https://wordpress.org/plugins/highlighting-code-block/":["https://wordpress.org/plugins/highlighting-code-block/"],"Add code block with syntax highlighting using prism.js. (Available for Gutenberg and Classic Editor)":["prism.js を使用したシンタックスハイライト機能付きのコードブロックを追加します。(Gutenbergとクラシックエディター共に利用可能)"],"LOOS WEB STUDIO":["LOOS WEB STUDIO"],"https://loos-web-studio.com/":["https://loos-web-studio.com/"]}}}
     1{"domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural_forms":"nplurals=1; plural=0;","lang":"ja_JP"},"HCB settings":["HCB設定"],"Language":["言語"],"Display number of rows":["行数の表示"],"Do not set individually":["個別で設定はしない"],"Display row count":["行数を表示する"],"Do not display row count":["行数を表示しない"],"Display language name":["言語の表示"],"Display language":["言語を表示する"],"Do not display language":["言語を表示しない"],"File name":["ファイル名"],"Highlight Number":["ハイライトする行番号"],"First line number":["開始行番号"],"[HCB] Settings":["[HCB] 設定"],"Basic settings":["基本設定"],"Display language name in code block":["コードブロックに言語名を表示する"],"If checked, the language type is displayed in the code on the site display side.":["チェックすると、サイト表示側のコードに言語の種類が表示されます。"],"Display settings for the number of rows":["行数の表示設定"],"Show line count in code block":["コードブロックに行数を表示する"],"If checked, the number of lines will be displayed on the left end of the code on the site display side.":["チェックすると、サイト表示側のコードの左端に行数が表示されます。"],"Copy button":["コピーボタン"],"Show copy button in code block":["コードブロックにコピーボタンを表示する"],"Font smoothing":["フォントスムージング"],"Turn on font smoothing":["フォントスムージングをオンにする"],"Add %s and %s to the code block.":["コードブロックに %s と %s が追加されます。"],"Cord coloring (front side)":["コードカラーリング(フロント側)"],"Code coloring (editor side)":["コードカラーリング(エディター側)"],"Font Size":["フォントサイズ"],"\"Font-family\" in code":["コードの “font-family”"],"Advanced settings":["高度な設定"],"When you use each original file, please upload it in the theme folder.":["各独自ファイルを使用する場合は、テーマフォルダの中にアップロードしてください。"],"If you set the path to your own file, the default coloring file and prism.js file will not be loaded..":["独自ファイルへのパスを設定すると、デフォルトのカラーリングファイルやprism.jsファイルは読み込まれなくなります。"],"* The currently loaded prism.js file can be downloaded at %s.":["※ 現在読み込んでいるprism.jsファイルは、 %s でダウンロードできます。"],"Here":["こちら"],"Language set to use":["使用する言語セット"],"Write in the format of %s, separated by \",\" (comma).":["%s の形式で、”,”(カンマ)区切りで記述してください。"],"class-key:\"language-name\"":["クラスキー:”言語名”"],"\"class-key\" is the class name used in prism.js (the part corresponding to \"◯◯\" in \"lang- ◯◯\")":["「クラスキー」は、prism.jsで使用されるクラス名(「lang-◯◯」の「◯◯」に該当する部分)です。"],"* If you use a language that is not supported by default, please use it together with \"Original prism.js\" setting.":["※ デフォルトでサポートされていない言語を使用する場合、「独自prism.js」設定と併用してください。"],"Original coloring file":["独自カラーリングファイル"],"Load your own CSS file for code coloring.":["あなたが用意したコードカラーリング用のCSSファイルを読み込みます。"],"Original prism.js":["独自prism.js"],"You can use the prism.js file corresponding to your own language set.":["自分専用の言語セットに対応したprism.jsファイルを使用できます。"],"help":["ヘルプ"],"Highlighting Code Block settings":["Highlighting Code Block 設定"],"Copy code to clipboard":["コードをクリップボードにコピーする"],"Highlighting Code Block":["Highlighting Code Block"],"https://wordpress.org/plugins/highlighting-code-block/":["https://wordpress.org/plugins/highlighting-code-block/"],"Add code block with syntax highlighting using prism.js. (Available for Gutenberg and Classic Editor)":["prism.js を使用したシンタックスハイライト機能付きのコードブロックを追加します。(Gutenbergとクラシックエディター共に利用可能)"],"LOOS, Inc.":["LOOS, Inc."],"https://loos-web-studio.com/":["https://loos-web-studio.com/"]}}}
  • highlighting-code-block/trunk/languages/loos-hcb-ja.po

    r2886197 r2994656  
    22msgstr ""
    33"Project-Id-Version: Highlighting Code Block\n"
    4 "POT-Creation-Date: 2023-03-24 15:35+0900\n"
    5 "PO-Revision-Date: 2023-03-24 15:35+0900\n"
     4"POT-Creation-Date: 2023-11-10 00:11+0900\n"
     5"PO-Revision-Date: 2023-11-10 00:12+0900\n"
    66"Last-Translator: \n"
    77"Language-Team: \n"
     
    2626"X-Poedit-SearchPathExcluded-4: vendor\n"
    2727
    28 #: src/js/code-block/_sidebar.js:14
     28#: src/js/code-block/edit.js:172
    2929msgid "HCB settings"
    3030msgstr "HCB設定"
    3131
    32 #: src/js/code-block/_sidebar.js:16
    33 msgid "Settings for displaying the number of lines"
    34 msgstr "行数の表示に関する設定"
    35 
    36 #: src/js/code-block/_sidebar.js:20 src/js/code-block/_sidebar.js:42
     32#: src/js/code-block/edit.js:174
     33msgid "Language"
     34msgstr "言語"
     35
     36#: src/js/code-block/edit.js:186
     37msgid "Display number of rows"
     38msgstr "行数の表示"
     39
     40#: src/js/code-block/edit.js:190 src/js/code-block/edit.js:211
    3741msgid "Do not set individually"
    3842msgstr "個別で設定はしない"
    3943
    40 #: src/js/code-block/_sidebar.js:24
     44#: src/js/code-block/edit.js:194
    4145msgid "Display row count"
    4246msgstr "行数を表示する"
    4347
    44 #: src/js/code-block/_sidebar.js:28
     48#: src/js/code-block/edit.js:198
    4549msgid "Do not display row count"
    4650msgstr "行数を表示しない"
    4751
    48 #: src/js/code-block/_sidebar.js:38
    49 msgid "Settings for displaying language name"
    50 msgstr "言語名の表示に関する設定"
    51 
    52 #: src/js/code-block/_sidebar.js:46
     52#: src/js/code-block/edit.js:207 class/loos_hcb_menu.php:35
     53msgid "Display language name"
     54msgstr "言語の表示"
     55
     56#: src/js/code-block/edit.js:215
    5357msgid "Display language"
    5458msgstr "言語を表示する"
    5559
    56 #: src/js/code-block/_sidebar.js:50
     60#: src/js/code-block/edit.js:219
    5761msgid "Do not display language"
    5862msgstr "言語を表示しない"
    5963
    60 #: src/js/code-block/edit.js:165
    61 msgid "file name"
     64#: src/js/code-block/edit.js:228
     65msgid "File name"
    6266msgstr "ファイル名"
    6367
    64 #: src/js/code-block/edit.js:174
    65 msgid "\"data-line\" value"
    66 msgstr "data-line属性値"
     68#: src/js/code-block/edit.js:238
     69msgid "Highlight Number"
     70msgstr "ハイライトする行番号"
     71
     72#: src/js/code-block/edit.js:254
     73msgid "First line number"
     74msgstr "開始行番号"
    6775
    6876#: class/loos_hcb_menu.php:8
     
    7381msgid "Basic settings"
    7482msgstr "基本設定"
    75 
    76 #: class/loos_hcb_menu.php:35
    77 msgid "Display language name"
    78 msgstr "言語の表示"
    7983
    8084#: class/loos_hcb_menu.php:38
     
    219223msgstr "Highlighting Code Block 設定"
    220224
    221 #: class/loos_hcb_scripts.php:62
     225#: class/loos_hcb_scripts.php:82
    222226msgid "Copy code to clipboard"
    223227msgstr "コードをクリップボードにコピーする"
     
    241245#. Author of the plugin/theme
    242246msgid "LOOS, Inc."
    243 msgstr ""
     247msgstr "LOOS, Inc."
    244248
    245249#. Author URI of the plugin/theme
     
    247251msgstr "https://loos-web-studio.com/"
    248252
     253#~ msgid "\"data-line\" value"
     254#~ msgstr "data-line属性値"
     255
     256#, fuzzy
     257#~| msgid "\"data-line\" value"
     258#~ msgid "\"data-start\" value"
     259#~ msgstr "data-line属性値"
     260
     261#~ msgid "Settings for displaying the number of lines"
     262#~ msgstr "行数の表示に関する設定"
     263
     264#~ msgid "Settings for displaying language name"
     265#~ msgstr "言語名の表示に関する設定"
     266
    249267#~ msgid "Default"
    250268#~ msgstr "デフォルト"
  • highlighting-code-block/trunk/readme.txt

    r2886197 r2994656  
    44Tags: block, editor, guternberg, code, syntax, highlight, code highlighting, syntax highlight
    55Requires at least: 5.6
    6 Tested up to: 6.2
    7 Stable tag: 1.7.0
     6Tested up to: 6.4
     7Stable tag: 2.0.0
    88Requires PHP: 5.6
    99License: GPLv2 or later
     
    1919(However, we recommend using it in the "Block Editor".)
    2020
    21 Please see [this page](https://wemo.tech/2122/) for a detailed description of this plugin.(Japanese article)
    22 
    23 = How to use (For Block Editor) =
     21Please see the following page for a detailed explanation of this plugin.
     22
     23URL: [https://loos.co.jp/en/documents/highlighting-code-block/](https://loos.co.jp/en/documents/highlighting-code-block/)
     24
     25
     26### Source code
     27
     28The source code of this plugin is available on Github.
     29
     30URL: [https://github.com/ddryo/Highlighting-Code-Block](https://github.com/ddryo/Highlighting-Code-Block)
     31
     32### How to use
     33
     34#### How to use (For Block Editor)
    2435- Open the "Formatting" category of the Block Inserter.
    2536- There is a custom block named "Highlighing Code Block".
     
    2738- Select the language of the code and enter any code.
    2839
    29 = How to use (For Classic Editor) =
     40#### How to use (For Classic Editor)
    3041- You should see a select box labeled "Code Block" on the toolbar (2nd row by default).
    3142- When you select a language from the select box, a code block (pre tag) is inserted.
    3243
    3344
    34 = If it doesn't work =
     45#### If it doesn't work
    3546
    3647This plugin works only with PHP version 5.6 or later, WordPress 5.6 or later.
     
    3849
    3950
    40 = About settings =
     51#### About settings
    4152
    4253The menu "[HCB] Settings" should be added to "Settings" in the left menu of the management screen.
     
    95106== Changelog ==
    96107
     108= 2.0.0 =
     109- Support for WordPress 6.4.
     110- Support for PHP 8.2.
     111- The CSS and Block UI have been significantly adjusted.
     112- CSS custom properties have also been renamed and cleaned up overall.
     113- Added `data-start` attribute settings to blocks.
     114
    97115= 1.7.0 =
    98116- Support for WordPress 6.2.
  • highlighting-code-block/trunk/sass-builder.js

    r2886197 r2994656  
    22// console.log('start sass-builder.js ...');
    33
    4 const path = require( 'path' );
    5 const fs = require( 'fs' );
     4const path = require('path');
     5const fs = require('fs');
     6const glob = require('glob');
    67
    78// node-sass
    8 const sass = require( 'node-sass' );
    9 const nodeSassGlobbing = require( 'node-sass-globbing' );
     9const sass = require('node-sass');
     10const globImporter = require('node-sass-glob-importer');
    1011
    1112// postcss
    12 const postcss = require( 'postcss' );
    13 const autoprefixer = require( 'autoprefixer' );
    14 const cssnano = require( 'cssnano' );
    15 const mqpacker = require( 'css-mqpacker' );
     13const postcss = require('postcss');
     14const autoprefixer = require('autoprefixer');
     15const cssnano = require('cssnano');
     16const mqpacker = require('css-mqpacker');
    1617
    1718// consoleの色付け
     
    1920const green = '\u001b[32m';
    2021
    21 const writeCSS = ( filePath, css ) => {
    22     const dir = path.dirname( filePath );
     22const writeCSS = (filePath, css) => {
     23    const dir = path.dirname(filePath);
    2324
    2425    // ディレクトリがなければ作成
    25     if ( ! fs.existsSync( dir ) ) {
    26         fs.mkdirSync( dir, { recursive: true } );
     26    if (!fs.existsSync(dir)) {
     27        fs.mkdirSync(dir, { recursive: true });
    2728    }
    2829
    2930    // css書き出し
    30     fs.writeFileSync( filePath, css );
     31    fs.writeFileSync(filePath, css);
    3132};
     33
     34// パス
    3235
    3336// パス
    3437const src = 'src/scss';
    3538const dist = 'build/css';
    36 const files = [
    37     'hcb',
    38     'hcb--light',
    39     'hcb--dark',
    40     'hcb-editor--light',
    41     'hcb-editor--dark',
    42     'hcb-admin',
    43 ];
     39// const files = [
     40//  'hcb',
     41//  'hcb--light',
     42//  'hcb--dark',
     43//  'hcb-editor--light',
     44//  'hcb-editor--dark',
     45//  'hcb-admin',
     46// ];
     47const ignore = ['**/_*.scss'];
     48const files = glob.sync(src + '/**/*.scss', { ignore });
     49// console.log('files', files);
    4450
    45 files.forEach( ( fileName ) => {
     51files.forEach((filePath) => {
     52    const fileName = filePath.replace(src + '/', '');
     53    const srcPath = path.resolve(__dirname, src, fileName);
     54    const distPath = path.resolve(__dirname, dist, fileName).replace('.scss', '.css');
     55
     56    // console.log(filePath, srcPath, distPath);
     57
    4658    // renderSyncだとimporter使えない
    4759    sass.render(
    4860        {
    49             file: path.resolve( __dirname, src, `${ fileName }.scss` ),
     61            file: srcPath,
    5062            outputStyle: 'compressed',
    51             importer: nodeSassGlobbing,
     63            importer: globImporter(),
    5264        },
    53         function ( err, sassResult ) {
    54             if ( err ) {
    55                 console.error( red + err );
     65        function (err, sassResult) {
     66            if (err) {
     67                console.error(red + err);
    5668            } else {
    5769                const css = sassResult.css.toString();
    58                 const filePath = path.resolve( __dirname, dist, `${ fileName }.css` );
    5970
    6071                // postcss実行
    61                 postcss( [ autoprefixer, mqpacker, cssnano ] )
    62                     .process( css, { from: undefined } )
    63                     .then( ( postcssResult ) => {
    64                         console.log( green + 'Wrote CSS to ' + filePath );
    65                         writeCSS( filePath, postcssResult.css );
     72                postcss([autoprefixer, mqpacker, cssnano])
     73                    .process(css, { from: undefined })
     74                    .then((postcssResult) => {
     75                        console.log(green + 'Wrote CSS to ' + distPath);
     76                        writeCSS(distPath, postcssResult.css);
    6677
    6778                        // if (postcssResult.map) {fs.writeFile('dest/app.css.map', postcssResult.map.toString(), () => true);}
    68                     } );
     79                    });
    6980            }
    7081        }
    7182    );
    72 } );
     83});
  • highlighting-code-block/trunk/src/js/code-block/_utils.js

    r2359718 r2994656  
    33 * Function for setting code block height
    44 */
    5 export function setHeightCodeBlocks(elem) {
     5export function setHeightCodeBlocks(block, elem) {
    66    const num = elem.value.match(/\r\n|\n/g);
    7     let line;
     7    // let line;
    88    if (null !== num) {
    9         line = num.length + 1;
     9        // line = num.length + 1;
     10        elem.style.setProperty('--hcb--code-linenum', num.length + 1);
     11    }
     12    //  else {
     13    //  line = 1;
     14    // }
     15
     16    // let height = line * 1.5; // 1.5 = line-height
     17    // height += 2 * 2; // py
     18
     19    // offsetXXX: padding + border + scrollbar
     20    // scrollXXX: padding. スクロール可能なとき、見えていない部分のサイズも含む。
     21    // clientXXX: padding. スクロール可能なとき、見えている部分のサイズ。
     22    const isScrollableX = elem.scrollWidth > elem.offsetWidth;
     23    if (isScrollableX) {
     24        const scbarH = elem.offsetHeight - elem.clientHeight;
     25        elem.style.setProperty('--hcb--scbarH', scbarH + 'px');
     26        // elem.style.height = `calc(${height}em + ${scbarH}px)`;
    1027    } else {
    11         line = 1;
     28        // elem.style.height = height + 'em';
    1229    }
    13     elem.style.height = line * 1.8 + 1.6 + 2 + 'em';
    1430}
    1531
  • highlighting-code-block/trunk/src/js/code-block/block.json

    r2669723 r2994656  
    3333            "default": ""
    3434        },
     35        "dataStart": {
     36            "type": "number",
     37            "default": 1
     38        },
    3539        "isLineShow": {
    3640            "type": "string",
  • highlighting-code-block/trunk/src/js/code-block/edit.js

    r2886197 r2994656  
    33 */
    44import { __ } from '@wordpress/i18n';
    5 import { useBlockProps } from '@wordpress/block-editor';
    6 import { SelectControl } from '@wordpress/components';
    7 import { useEffect, useRef } from '@wordpress/element';
     5import { useBlockProps, InspectorControls, BlockControls } from '@wordpress/block-editor';
     6import {
     7    SelectControl,
     8    TextControl,
     9    // RadioControl,
     10    PanelBody,
     11    ToolbarGroup,
     12} from '@wordpress/components';
     13import { useState, useEffect, useRef } from '@wordpress/element';
    814
    915/**
    1016 * @Inner dependencies
    1117 */
    12 import HcbSidebar from './_sidebar';
    13 import { setHeightCodeBlocks } from './_utils';
     18// import { setHeightCodeBlocks } from './_utils';
    1419
    1520/**
     
    1924
    2025/**
    21  * 言語情報をグローバル変数から受け取る。
     26 * 設定情報をグローバル変数から受け取る。
    2227 */
    23 let hcbLangs = window.hcbLangs;
    24 if ( 'object' !== typeof hcbLangs ) {
    25     hcbLangs = {
     28const hcbShowLang = window.hcbVars?.showLang;
     29const hcbShowLinenum = window.hcbVars?.showLinenum;
     30
     31let HCB_LANGS = window?.hcbLangs || null;
     32if (null) {
     33    HCB_LANGS = {
    2634        html: 'HTML',
    2735        css: 'CSS',
     
    4452}
    4553
    46 const langList = [
     54// HCB_LANGS を配列化する
     55// const HCB_LANG_ARRAY = Object.entries(HCB_LANGS);
     56const HCB_LANG_ARRAY = [['plain', 'Plain'], ...Object.entries(HCB_LANGS)];
     57
     58const LANG_SELECT_OPTIONS = [
    4759    {
    4860        value: '',
    49         label: '- Lang Select -',
     61        label: 'Plain',
    5062    },
     63    ...Object.entries(HCB_LANGS).map(([key, value]) => ({
     64        value: key,
     65        label: value,
     66    })),
    5167];
    5268
    53 Object.keys( hcbLangs ).forEach( ( key ) => {
    54     langList.push( {
    55         value: key,
    56         label: hcbLangs[ key ],
    57     } );
    58 } );
     69const getLineNum = (code = '') => {
     70    const lineNums = code.match(/\r\n|\n/g);
     71    if (null !== lineNums) {
     72        return lineNums.length + 1;
     73    }
     74    return 1;
     75};
    5976
    6077// edit
    61 export default ( { attributes, setAttributes, clientId } ) => {
     78export default ({ attributes, setAttributes, clientId }) => {
    6279    const ref = useRef();
    6380
    6481    const {
    65         code,
    66         // langType,
     82        className,
     83        code = '',
     84        langType,
    6785        fileName,
    6886        langName,
    6987        dataLineNum,
     88        dataStart,
    7089        isShowLang,
    7190        isLineShow,
    7291    } = attributes;
    73 
    74     const blockClass = classnames( 'hcb_wrap', 'hcb-block' );
     92    // コード行数
     93    const [codeLineNum, setCodeLineNums] = useState(getLineNum(code));
     94
     95    const blockClass = classnames('hcb-block', 'hcb_wrap');
    7596
    7697    // クラスの重複バグの修正
    77     useEffect( () => {
    78         const nowClass = attributes.className;
    79         if ( ! nowClass ) return;
    80 
    81         const nowClasses = nowClass.split( ' ' );
    82         const newClasses = [ ...new Set( nowClasses ) ]; // 重複削除
    83         setAttributes( { className: classnames( newClasses ) } );
    84     }, [] );
     98    useEffect(() => {
     99        const nowClass = className || '';
     100        if (!nowClass) return;
     101
     102        const nowClasses = nowClass.split(' ');
     103        const newClasses = [...new Set(nowClasses)]; // 重複削除
     104        setAttributes({ className: classnames(newClasses) });
     105    }, [className, setAttributes]);
    85106
    86107    // コードの textarea 高さセット
    87     useEffect( () => {
     108    useEffect(() => {
    88109        const { ownerDocument } = ref.current;
    89110
    90         if ( ownerDocument ) {
    91             const hcbTextarea = ownerDocument.querySelector( `#block-${ clientId } .hcb_textarea` );
    92             setHeightCodeBlocks( hcbTextarea );
     111        if (ownerDocument) {
     112            const hcbBlock = ownerDocument.querySelector(`#block-${clientId}`);
     113            const hcbTextarea = hcbBlock.querySelector(`.hcb_textarea`);
     114            hcbBlock.style.setProperty('--hcb--code-linenum', codeLineNum);
     115
     116            // offsetXXX: padding + border + scrollbar
     117            // scrollXXX: padding. スクロール可能なとき、見えていない部分のサイズも含む。
     118            // clientXXX: padding. スクロール可能なとき、見えている部分のサイズ。
     119            const isScrollableX = hcbTextarea.scrollWidth > hcbTextarea.offsetWidth;
     120            if (isScrollableX) {
     121                const scbarH = hcbTextarea.offsetHeight - hcbTextarea.clientHeight;
     122                hcbBlock.style.setProperty('--hcb--scbarH', scbarH + 'px');
     123            }
    93124        }
    94     }, [ clientId, code ] );
     125    }, [clientId, codeLineNum]);
    95126
    96127    // preタグにつけるクラス名を生成して保存
     
    98129    // setAttributes({ preClass: preClass });
    99130
    100     const hcbShowLang = window.hcbEditorVars?.showLang;
    101     const hcbShowLinenum = window.hcbEditorVars?.showLinenum;
    102 
    103131    let dataShowLang = '0';
    104     if ( '1' === isShowLang ) {
     132    if ('1' === isShowLang) {
    105133        dataShowLang = '1';
    106     } else if ( '' === isShowLang && 'on' === hcbShowLang ) {
     134    } else if ('' === isShowLang && 'on' === hcbShowLang) {
    107135        dataShowLang = '1';
    108136    }
    109137
    110138    let dataShowLinenum = null;
    111     if ( 'on' === isLineShow ) {
     139    if ('on' === isLineShow) {
    112140        dataShowLinenum = '1';
    113     } else if ( 'undefined' === isLineShow && 'on' === hcbShowLinenum ) {
     141    } else if ('undefined' === isLineShow && 'on' === hcbShowLinenum) {
    114142        dataShowLinenum = '1';
    115143    }
    116144
    117     const blockProps = useBlockProps( {
     145    const blockProps = useBlockProps({
    118146        ref,
    119147        className: blockClass,
     
    122150        'data-show-lang': dataShowLang,
    123151        'data-show-linenum': dataShowLinenum,
    124         // 'data-line': dataLineNum || null,
    125     } );
     152        // 'data-line': dataLineNum || null, // edit側にはつけない
     153    });
     154
     155    // 新規配列を作成
     156    const langArray = [...HCB_LANG_ARRAY];
     157
     158    // lang未設定の時に 'Plain' は表示しない
     159    if (!langType) {
     160        langArray.shift();
     161    }
    126162
    127163    return (
    128164        <>
    129             <HcbSidebar { ...{ attributes, setAttributes } } />
    130             <div { ...blockProps }>
     165            <BlockControls>
     166                <ToolbarGroup
     167                    isCollapsed={true}
     168                    icon={<>{langName || __('Language', 'loos-hcb')}</>}
     169                    title='Lnaguage'
     170                    controls={langArray.map(([_langKey, _langName]) => {
     171                        return {
     172                            key: _langKey,
     173                            isActive: _langKey === langType,
     174                            title: _langName,
     175                            // icon: null,
     176                            onClick: () => {
     177                                if (_langKey === 'plain') {
     178                                    setAttributes({ langType: '', langName: '' });
     179                                } else {
     180                                    setAttributes({ langType: _langKey, langName: _langName });
     181                                }
     182                            },
     183                        };
     184                    })}
     185                />
     186            </BlockControls>
     187            <InspectorControls>
     188                <PanelBody title={__('HCB settings', 'loos-hcb')} initialOpen={true}>
     189                    <SelectControl
     190                        label={__('Language', 'loos-hcb')}
     191                        value={attributes.langType}
     192                        options={LANG_SELECT_OPTIONS}
     193                        onChange={(langKey) => {
     194                            if ('' === langKey) {
     195                                setAttributes({ langType: '', langName: '' });
     196                            } else {
     197                                setAttributes({ langType: langKey, langName: HCB_LANGS[langKey] });
     198                            }
     199                        }}
     200                    />
     201                    <SelectControl
     202                        label={__('Display number of rows', 'loos-hcb')} // 行数の表示
     203                        value={isLineShow}
     204                        options={[
     205                            {
     206                                label: __('Do not set individually', 'loos-hcb'), //個別で設定はしない
     207                                value: 'undefined',
     208                            },
     209                            {
     210                                label: __('Display row count', 'loos-hcb'), //行数を表示する
     211                                value: 'on',
     212                            },
     213                            {
     214                                label: __('Do not display row count', 'loos-hcb'), //行数を表示しない
     215                                value: 'off',
     216                            },
     217                        ]}
     218                        onChange={(val) => {
     219                            setAttributes({ isLineShow: val });
     220                        }}
     221                    />
     222                    <SelectControl
     223                        label={__('Display language name', 'loos-hcb')} // 言語名の表示に関する設定
     224                        value={isShowLang}
     225                        options={[
     226                            {
     227                                label: __('Do not set individually', 'loos-hcb'), //個別で設定はしない
     228                                value: '',
     229                            },
     230                            {
     231                                label: __('Display language', 'loos-hcb'), //言語を表示する
     232                                value: '1',
     233                            },
     234                            {
     235                                label: __('Do not display language', 'loos-hcb'), //言語を表示しない
     236                                value: '0',
     237                            },
     238                        ]}
     239                        onChange={(val) => {
     240                            setAttributes({ isShowLang: val });
     241                        }}
     242                    />
     243                    <TextControl
     244                        label={__('File name', 'loos-hcb')} // ファイル名
     245                        value={fileName}
     246                        onChange={(val) => {
     247                            setAttributes({ fileName: val });
     248                        }}
     249                    />
     250                    <TextControl
     251                        // ハイライトする行番号
     252                        label={
     253                            <>
     254                                {__('Highlight Number', 'loos-hcb') + ' ( '}
     255                                <code className='hcb-code-in-label'>[data-line]</code>
     256                                {' )'}
     257                            </>
     258                        }
     259                        value={dataLineNum}
     260                        onChange={(val) => {
     261                            setAttributes({ dataLineNum: val });
     262                        }}
     263                    />
     264                    <TextControl
     265                        type='number'
     266                        // 開始行番号
     267                        label={
     268                            <>
     269                                {__('First line number', 'loos-hcb') + ' ( '}
     270                                <code className='hcb-code-in-label'>[data-start]</code>
     271                                {' )'}
     272                            </>
     273                        }
     274                        value={dataStart || 1}
     275                        onChange={(val) => {
     276                            setAttributes({ dataStart: parseInt(val || 1) });
     277                        }}
     278                        style={{ opacity: dataShowLinenum ? 1 : 0.5 }}
     279                        disabled={dataShowLinenum ? false : true}
     280                    />
     281                </PanelBody>
     282            </InspectorControls>
     283            <div {...blockProps}>
    131284                <div className='hcb_codewrap'>
    132                     <div className='hcb_linenum'></div>
     285                    {dataShowLinenum && (
     286                        <div className='hcb_linenum'>
     287                            <div className='hcb-startNum'>{dataStart}</div>
     288                        </div>
     289                    )}
     290                    {/* <TextareaControl */}
    133291                    <textarea
    134292                        className='hcb_textarea'
    135293                        placeholder='Your Code...'
    136                         value={ code }
    137                         onChange={ ( e ) => {
    138                             setAttributes( { code: e.target.value } );
    139                             setHeightCodeBlocks( e.target );
    140                         } }
     294                        value={code}
     295                        onChange={(e) => {
     296                            const val = e.target.value;
     297                            setAttributes({ code: val });
     298                            // setHeightCodeBlocks(e.target);
     299                            const newCodeLineNum = getLineNum(val);
     300                            if (codeLineNum !== newCodeLineNum) {
     301                                setCodeLineNums(newCodeLineNum);
     302                            }
     303                        }}
    141304                    ></textarea>
    142                 </div>
    143                 <div className='hcb_controls'>
    144                     <SelectControl
    145                         value={ attributes.langType }
    146                         options={ langList }
    147                         onChange={ ( langKey ) => {
    148                             if ( '' === langKey ) {
    149                                 setAttributes( {
    150                                     langType: '',
    151                                     langName: '',
    152                                 } );
    153                             } else {
    154                                 setAttributes( {
    155                                     langType: langKey,
    156                                     langName: hcbLangs[ langKey ],
    157                                 } );
    158                             }
    159                         } }
    160                     />
    161                     <input
    162                         type='text'
    163                         className='filename_input'
    164                         value={ fileName }
    165                         placeholder={ __( 'file name', 'loos-hcb' ) } //ファイル名
    166                         onChange={ ( e ) => {
    167                             setAttributes( { fileName: e.target.value } );
    168                         } }
    169                     />
    170                     <input
    171                         type='text'
    172                         className='num_input'
    173                         value={ dataLineNum }
    174                         placeholder={ __( '"data-line" value', 'loos-hcb' ) } //data-line属性値
    175                         onChange={ ( e ) => {
    176                             setAttributes( { dataLineNum: e.target.value } );
    177                         } }
    178                     />
     305                    {dataLineNum && (
     306                        <div className='hcb-datapreview'>
     307                            <div className='hcb-datapreview__items'>{`{${dataLineNum}}`}</div>
     308                        </div>
     309                    )}
    179310                </div>
    180311            </div>
  • highlighting-code-block/trunk/src/js/code-block/index.js

    r2669723 r2994656  
    1111import save from './save';
    1212import metadata from './block.json';
    13 import hcbIcon from './_icon';
     13import hcbIcon from './icon';
    1414import deprecated from './_deprecated';
    1515
     
    1717 * Register Highlighting Code Block
    1818 */
    19 registerBlockType( metadata.name, {
     19registerBlockType(metadata.name, {
    2020    icon: hcbIcon,
    2121    // attributes: metadata.attributes,
     
    2525            {
    2626                type: 'block',
    27                 blocks: [ 'core/code' ], //整形済みブロック : 'core/preformatted',
    28                 transform: ( attributes ) => {
    29                     return createBlock( 'loos-hcb/code-block', {
     27                blocks: ['core/code'], //整形済みブロック : 'core/preformatted',
     28                transform: (attributes) => {
     29                    return createBlock('loos-hcb/code-block', {
    3030                        code: attributes.content,
    31                     } );
     31                    });
    3232                },
    3333            },
     
    3737            {
    3838                type: 'block',
    39                 blocks: [ 'core/code' ],
    40                 transform: ( attributes ) => {
    41                     return createBlock( 'core/code', {
     39                blocks: ['core/code'],
     40                transform: (attributes) => {
     41                    return createBlock('core/code', {
    4242                        content: attributes.code,
    43                     } );
     43                    });
    4444                },
    4545            },
     
    4949    save,
    5050    deprecated,
    51 } );
     51});
  • highlighting-code-block/trunk/src/js/code-block/save.js

    r2669723 r2994656  
    1515
    1616// save
    17 export default ( { attributes } ) => {
    18     const { code, fileName, langName, dataLineNum, isLineShow, isShowLang } = attributes;
     17export default ({ attributes }) => {
     18    const { code, fileName, langName, dataLineNum, dataStart, isLineShow, isShowLang } = attributes;
    1919    const langType = attributes.langType || 'plain';
    20     const preClass = classnames( 'prism', `${ isLineShow }-numbers`, `lang-${ langType }` );
     20    const preClass = classnames('prism', `${isLineShow}-numbers`, `lang-${langType}`);
    2121
    22     const blockProps = useBlockProps.save( {
     22    const blockProps = useBlockProps.save({
    2323        className: 'hcb_wrap',
    24     } );
     24    });
    2525    return (
    26         <div { ...blockProps }>
     26        <div {...blockProps}>
    2727            <pre
    28                 className={ preClass }
    29                 data-file={ fileName || null }
    30                 data-lang={ langName || null }
    31                 data-line={ dataLineNum || null }
    32                 data-show-lang={ isShowLang || null }
     28                className={preClass}
     29                data-file={fileName || null}
     30                data-lang={langName || null}
     31                data-line={dataLineNum || null}
     32                data-start={1 === dataStart ? null : dataStart}
     33                data-show-lang={isShowLang || null}
    3334            >
    34                 <RichText.Content tagName='code' value={ sanitizeCodeblock( code ) } />
     35                <RichText.Content tagName='code' value={sanitizeCodeblock(code)} />
    3536            </pre>
    3637        </div>
  • highlighting-code-block/trunk/src/js/hcb_script.js

    r2886197 r2994656  
    1 document.addEventListener( 'DOMContentLoaded', function () {
     1document.addEventListener('DOMContentLoaded', function () {
    22    // if (!window.Prism) return;
    33
     
    66
    77    // Token customize
    8     const keyToken = document.querySelectorAll( '.token.keyword' );
    9     for ( let i = 0; i < keyToken.length; i++ ) {
    10         const elem = keyToken[ i ];
     8    const keyToken = document.querySelectorAll('.token.keyword');
     9    for (let i = 0; i < keyToken.length; i++) {
     10        const elem = keyToken[i];
    1111
    12         const defArr = [ 'function', 'def', 'class' ];
    13         if ( -1 !== defArr.indexOf( elem.textContent ) ) {
    14             elem.classList.add( 'def' );
    15         } else if ( 'this' === elem.textContent ) {
    16             elem.classList.add( 'this' );
     12        const defArr = ['function', 'def', 'class'];
     13        if (-1 !== defArr.indexOf(elem.textContent)) {
     14            elem.classList.add('def');
     15        } else if ('this' === elem.textContent) {
     16            elem.classList.add('this');
    1717        }
    1818    }
    1919
    2020    // Line highlighter position.
    21     const lineHighlighter = document.querySelectorAll( '.line-highlight' );
    22     for ( let i = 0; i < lineHighlighter.length; i++ ) {
    23         const elem = lineHighlighter[ i ];
    24         if ( ! elem.parentNode.classList.contains( 'line-numbers' ) ) {
    25             const dataStart = elem.getAttribute( 'data-start' );
     21    const lineHighlighter = document.querySelectorAll('.line-highlight');
     22    for (let i = 0; i < lineHighlighter.length; i++) {
     23        const elem = lineHighlighter[i];
     24        if (!elem.parentNode.classList.contains('line-numbers')) {
     25            const dataStart = elem.getAttribute('data-start');
    2626
    27             const topPosEm = ( dataStart - 1 ) * 1.5; //line-heightの値
     27            const topPosEm = (dataStart - 1) * 1.5; //line-heightの値
    2828
    2929            // Line highlighterの位置がずれるので桁数に応じて微調節 -> ずれなくなった?
     
    4343
    4444    // clipboard
    45     ( function () {
    46         if ( ! window.ClipboardJS ) return;
    47         if ( ! window.hcbVars?.showCopyBtn ) return;
     45    (function () {
     46        if (!window.ClipboardJS) return;
     47        if (!window.hcbVars?.showCopyBtn) return;
    4848
    4949        let clipCt = 1;
    5050
    5151        // hcb_wrap
    52         const hcbWraps = document.querySelectorAll( '.hcb_wrap' );
     52        const hcbWraps = document.querySelectorAll('.hcb_wrap');
    5353        // const hcbClips = document.querySelectorAll('.hcb-clipboard');
    54         for ( let i = 0; i < hcbWraps.length; i++ ) {
    55             const elem = hcbWraps[ i ];
    56             const code = elem.querySelector( 'code' );
    57             if ( null === code ) continue;
     54        for (let i = 0; i < hcbWraps.length; i++) {
     55            const elem = hcbWraps[i];
     56            const code = elem.querySelector('code');
     57            if (null === code) continue;
    5858
    5959            // ボタン生成
    60             const button = document.createElement( 'button' );
    61             button.classList.add( 'hcb-clipboard' );
    62             button.setAttribute( 'data-clipboard-target', '[data-hcb-clip="' + clipCt + '"]' );
    63             button.setAttribute( 'data-clipboard-action', 'copy' );
    64             button.setAttribute( 'aria-label', window.hcbVars?.copyBtnLabel || '' );
     60            const button = document.createElement('button');
     61            button.classList.add('hcb-clipboard');
     62            button.setAttribute('data-clipboard-target', '[data-hcb-clip="' + clipCt + '"]');
     63            button.setAttribute('data-clipboard-action', 'copy');
     64            button.setAttribute('aria-label', window.hcbVars?.copyBtnLabel || '');
    6565            // button.innerHTML = `コピー`;
    66             elem.prepend( button );
     66            elem.append(button);
    6767
    6868            // codeタグにターゲット属性追加
    69             code.setAttribute( 'data-hcb-clip', clipCt );
     69            code.setAttribute('data-hcb-clip', clipCt);
    7070
    7171            clipCt++;
    7272        }
    73         const clipboard = new ClipboardJS( '.hcb-clipboard' );
    74         clipboard.on( 'success', function ( e ) {
     73        const clipboard = new ClipboardJS('.hcb-clipboard');
     74        clipboard.on('success', function (e) {
    7575            const btn = e.trigger;
    76             btn.classList.add( '-done' );
    77             setTimeout( () => {
    78                 btn.classList.remove( '-done' );
    79             }, 5000 );
    80         } );
     76            btn.classList.add('-done');
     77            setTimeout(() => {
     78                btn.classList.remove('-done');
     79            }, 5000);
     80        });
    8181        // clipboard.on('error', function (e) {
    8282        //  alert(e);
    8383        // });
    84     } )();
    85 } );
     84    })();
     85});
  • highlighting-code-block/trunk/src/scss/editor/_base.scss

    r2886197 r2994656  
     1@import "../root";
     2@import "./conrtols";
     3
    14// 共通
    25.mce-content-body .hcb_wrap {
     
    47}
    58
     9:root {
     10    --hcb--pY: 2em; // 高さセットにも使うので注意
     11    --hcb--pX: 1.5em;
     12    --hcb--linenumW: 3em;
     13}
     14
     15// Block: hcb_wrap > hcb_codewrap > hcb_textarea
     16// Classic: hcb_wrap > pre
    617.hcb_wrap {
     18    position: relative;
    719
    8     &.hcb_wrap {
     20    > .hcb_codewrap {
    921        position: relative;
    10         border: solid 1px #f1f1f1;
     22        padding-right: 0.75em;
     23        color: var(--hcb--c);
     24        background: var(--hcb--bgc);
     25        border-radius: var(--hcb--radius);
     26    }
     27}
    1128
    12         pre,
    13         textarea.hcb_textarea {
    14             position: static;
    15             display: block;
    16             box-sizing: border-box;
    17             width: 100%;
    18             margin: 0 !important;
    19             padding: 1.5em;
    20             overflow-x: auto;
    21             color: var(--hcb-color--text, #1f1e1e);
    22             font-size: var(--hcb-font-size, 14px);
    23             font-family: var(--hcb-font-family, "Menlo", "Consolas", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Meiryo", sans-serif);
    24             line-height: 1.8;
    25             white-space: pre !important;
    26             overflow-wrap: break-word;
    27             tab-size: 2;
    28             background: var(--hcb-color--bg, #f7f6f6);
    29             border: none;
    30             border-radius: 0;
    31         }
    32     }
     29.hcb_wrap > pre,
     30.hcb_codewrap,
     31.hcb_textarea {
     32    color: var(--hcb--c) !important;
     33    font-size: var(--hcb--fz, 14px) !important;
     34    font-family: var(--hcb--ff) !important;
     35    line-height: 1.5 !important;
     36    background: var(--hcb--bgc) !important;
     37}
    3338
    34     .hcb_codewrap {
    35         position: relative;
    36         padding-right: 1em;
    37         color: var(--hcb-color--text, #1f1e1e);
    38         background: var(--hcb-color--bg, #f7f6f6);
    39     }
     39
     40.hcb_wrap.hcb_wrap > pre,
     41.hcb_textarea.hcb_textarea {
     42    position: static;
     43    display: block;
     44    box-sizing: border-box;
     45    width: 100%;
     46    margin: 0 !important;
     47    padding: var(--hcb--pY) var(--hcb--pX);
     48    overflow-x: auto;
     49    white-space: pre !important;
     50    overflow-wrap: break-word;
     51    tab-size: 4;
     52    border: none;
     53    border-radius: 0;
    4054
    4155
    4256    // スクロールバー
    43     pre,
    44     textarea.hcb_textarea {
    45 
    46         &::-webkit-scrollbar {
    47             height: 8px;
    48             border: none;
    49         }
    50 
    51         &::-webkit-scrollbar-track {
    52             background: #f7f7f7;
    53             border: none;
    54         }
    55 
    56         &::-webkit-scrollbar-thumb {
    57             background: rgba(0, 0, 0, 0.1);
    58             border-radius: 4px;
    59         }
     57    &::-webkit-scrollbar {
     58        height: 6px;
     59        border: none;
    6060    }
    6161
    62     textarea.hcb_textarea {
    63         outline: none;
    64         box-shadow: none;
    65         resize: none;
     62    &::-webkit-scrollbar-track {
     63        background: var(--hcb--scbar-track--bgc);
     64        border: none;
    6665    }
    6766
    68     pre code {
    69         display: block;
    70         padding: 0 !important;
    71         color: inherit !important;
    72         font-family: inherit !important;
    73         tab-size: 2;
    74         background: inherit !important;
    75     }
    76 
    77     // 設定エリア
    78     .hcb_controls {
    79         display: flex;
    80         flex-wrap: wrap;
    81         padding: 8px 8px;
    82 
    83         &::after {
    84             display: block;
    85             clear: both;
    86             height: 0;
    87             visibility: hidden;
    88             content: "";
    89         }
    90 
    91         .components-base-control {
    92             flex-basis: 50%;
    93             max-width: 25rem;
    94 
    95             select {
    96                 width: 100%;
    97                 // margin: 0;
    98             }
    99         }
    100 
    101         .filename_input {
    102             flex-basis: 20%;
    103             // float: right;
    104             min-width: 10em;
    105             height: 28px;
    106             margin-left: auto;
    107             padding: 0 8px;
    108             line-height: 28px;
    109         }
    110 
    111         .num_input {
    112             flex-basis: 20%;
    113             // float: right;
    114             min-width: 10em;
    115             height: 28px;
    116             margin-left: 16px;
    117             padding: 0 8px;
    118             line-height: 28px;
    119         }
    120     }
    121 
    122     // エディダーではオン・オフが分かるように縦線だけ表示
    123     .hcb_linenum {
    124         position: absolute;
    125         top: 1em;
    126         left: 1em;
    127         display: none;
    128         width: 0;
    129         height: calc(100% - 2em);
    130         border-right: solid 1px rgba(150, 150, 150, 0.5);
     67    &::-webkit-scrollbar-thumb {
     68        background: var(--hcb--scbar-thumb--bgc);
     69        border-radius: 3px;
    13170    }
    13271}
    13372
    134 .hcb-block[data-show-linenum] {
     73.hcb_textarea.hcb_textarea {
     74    // `calc(${height}em + ${scbarH}px)`;
     75    height: calc(1.5em * var(--hcb--code-linenum, 1) + var(--hcb--pY) * 2 + var(--hcb--scbarH, 0px));
     76    outline: none;
     77    box-shadow: none;
     78    resize: none;
    13579
    136     .hcb_linenum {
    137         display: block;
     80    &::placeholder {
     81        color: inherit;
     82        font-style: italic;
     83        opacity: 0.5;
    13884    }
    13985
    140     textarea.hcb_textarea {
    141         width: calc(100% - 2em);
    142         margin-left: 2em !important;
    143         padding-left: 0.5em;
     86    &::-ms-input-placeholder,
     87    &::-moz-placeholder,
     88    &::-webkit-input-placeholder {
     89        color: inherit;
     90        font-style: italic;
     91        opacity: 0.5;
    14492    }
    14593}
    14694
    14795
     96.hcb_wrap > pre code {
     97    display: block;
     98    padding: 0 !important;
     99    color: inherit !important;
     100    font-family: inherit !important;
     101    tab-size: 2;
     102    background: inherit !important;
     103}
     104
     105// 行数表示 → エディダーではオン・オフが分かるように縦ボーダーだけ表示
     106.hcb_linenum {
     107    position: absolute;
     108    top: var(--hcb--pY);
     109    left: calc(var(--hcb--linenumW) / 2 + 0.5em);
     110    width: 0;
     111    height: calc(100% - var(--hcb--pY) * 2);
     112    color: var(--hcb--line-numbers--c);
     113    border-right: solid 1px currentcolor;
     114
     115    > .hcb-startNum {
     116        position: absolute;
     117        top: 0;
     118        right: 0.5em;
     119        right: calc(0.95em - 1px);
     120        font: inherit;
     121        font-size: 0.95em;
     122        line-height: 1.5;
     123        white-space: nowrap;
     124        word-wrap: normal;
     125        translate: 50%;
     126    }
     127}
     128
     129
     130.hcb-block[data-show-linenum] {
     131
     132    .hcb_codewrap {
     133        padding-left: calc(var(--hcb--linenumW) / 2 + 1em);
     134    }
     135
     136    .hcb_textarea {
     137        padding-left: calc(var(--hcb--linenumW) / 2 - 1em);
     138    }
     139
     140}
     141
     142
    148143// Lang Name
    149 .hcb_wrap pre::before, // for Classic
     144.hcb_wrap > pre::before, // for Classic
    150145.hcb-block::before {
    151146    position: absolute;
     
    156151    min-width: 4em;
    157152    padding: 0 10px;
    158     color: var(--hcb-color--lang--text, #1f1e1e);
    159     font-size: 12px;
    160     font-family: Arial, Helvetica, sans-serif;
     153    color: var(--hcb--data-label--c);
     154    font-size: 0.925em;
     155    font-family: inherit;
    161156    line-height: 20px;
    162157    text-align: center;
    163     background-color: var(--hcb-color--lang--bg, #dedede);
    164     content: attr(data-lang);
     158    background-color: var(--hcb--data-label--bgc);
     159    border-radius: 0 var(--hcb--radius);
     160    content: var(--hcb--data-label);
    165161}
    166162
    167163
     164.hcb-block[data-show-lang="0"] {
     165    --hcb--data-label: none;
     166}
     167
     168.hcb-block[data-show-lang="1"] {
     169    --hcb--data-label: attr(data-lang);
     170}
     171
     172// [data-file] があれば、lang 非表示でも表示する
    168173.hcb-block[data-file]::before {
    169174    padding: 0 8px 0 20px;
    170     background-image: var(--hcb-file-icon);
     175    background-image: var(--hcb--file-icon);
    171176    background-repeat: no-repeat;
    172177    background-position: center left 8px;
    173178    background-size: auto 10px;
    174     content: attr(data-file);
     179    content: attr(data-file); // --hcb--data-label: attr(data-file);
    175180}
    176181
    177 .hcb-block[data-show-lang="0"]:not([data-file])::before {
    178     content: none;
    179 }
     182// .hcb-block[data-show-lang="0"]:not([data-file])::before {
     183// content: none;
     184// }
    180185
    181 
    182 // ブロック非選択時
    183 [data-type="loos-hcb/code-block"]:not(.is-selected) {
    184 
    185     .hcb_controls {
    186         display: none;
    187     }
    188 }
    189 
    190 
    191 // デバイスプレビュー
    192 .wp-embed-responsive.editor-styles-wrapper {
    193 
    194     .hcb_controls {
    195         display: none;
    196     }
    197 }
  • highlighting-code-block/trunk/src/scss/editor/_color--dark.scss

    r2886197 r2994656  
    1 body {
    2     --hcb-color--text: #f8f8f2;
    3     --hcb-color--text-shadow: rg1a1a1ab(136, 132, 132);
    4     --hcb-color--bg: #34352e;
    5     --hcb-color--lang--text: #fff;
    6     --hcb-color--lang--bg: #111;
    7     --hcb-file-icon: url(../../assets/img/file-icon-dark.svg);
     1:root {
     2    --hcb--c: #f8f8f2;
     3    --hcb--bgc: #34352e;
     4    --hcb--data-label--c: #fff;
     5    --hcb--data-label--bgc: #111;
     6    --hcb--file-icon: url(../../assets/img/file-icon-dark.svg);
     7    --hcb--scbar-track--bgc: rgba(255, 255, 255, 0.1);
     8    --hcb--scbar-thumb--bgc: rgba(255, 255, 255, 0.2);
     9
     10    // --hcb--placeholder--c: rgba(255, 255, 255, 0.4);
    811}
    9 
    10 
    11 // Gutenbergでのプレースホルダー
    12 .hcb_wrap textarea.hcb_textarea {
    13 
    14     &::placeholder {
    15         color: rgba(255, 255, 255, 0.4);
    16         font-style: italic;
    17     }
    18 
    19     &::-ms-input-placeholder,
    20     &::-moz-placeholder,
    21     &::-webkit-input-placeholder {
    22         color: rgba(255, 255, 255, 0.4);
    23         font-style: italic;
    24     }
    25 }
  • highlighting-code-block/trunk/src/scss/editor/_color--light.scss

    r2886197 r2994656  
    1 body {
    2     --hcb-color--text: #1f1e1e;
    3     --hcb-color--text-shadow: #fff;
    4     --hcb-color--bg: #f7f6f6;
    5     --hcb-color--lang--text: #1f1e1e;
    6     --hcb-color--lang--bg: #dedede;
    7     --hcb-file-icon: url(../../assets/img/file-icon-light.svg);
    8 }
     1// :root {}
  • highlighting-code-block/trunk/src/scss/front/_base.scss

    r2886197 r2994656  
     1@import "../root";
     2
     3
     4// ベース(テーマに上書きされないよう、クラス2重にして詳細度あげておく)
     5.hcb_wrap.hcb_wrap {
     6    position: relative;
     7    z-index: 0;
     8    display: block;
     9    margin-top: 2em;
     10    margin-bottom: 2em;
     11    padding: 0;
     12    font-size: var(--hcb--fz, 14px);
     13
     14    > pre {
     15        position: static;
     16        display: block;
     17        box-sizing: border-box;
     18        margin: 0;
     19        padding: var(--hcb--pY) var(--hcb--pX);
     20        overflow: auto;
     21        font-size: inherit;
     22        font-family: var(--hcb--ff);
     23        line-height: 1.5;
     24        letter-spacing: 0.1px;
     25        border-radius: var(--hcb--radius, 0);
     26        -webkit-overflow-scrolling: touch;
     27    }
     28
     29    > pre,
     30    > pre > code {
     31        color: var(--hcb--c);
     32        white-space: pre;
     33        text-align: left;
     34        text-shadow: var(--hcb--tsh);
     35        word-wrap: normal;
     36        word-break: normal;
     37        word-spacing: normal;
     38        tab-size: 4;
     39        hyphens: none;
     40        background: var(--hcb--bgc);
     41        border: none;
     42    }
     43
     44    :is(code, span) {
     45        box-sizing: border-box;
     46        margin: 0;
     47        padding: 0; // 一部の海外テーマでズレが生じるのを防ぐ
     48        font-size: inherit;
     49        font-family: inherit;
     50        line-height: inherit;
     51    }
     52}
     53
     54
    155/*
    2     カラーリングに関係ない共通設定
    3  */
    4 $hcbPaddingY: 1.75em;
    5 $hcbLineNumPadding: 3.75em;
    6 
     56  Note: .line-highlight の出現位置は、行数表示があるかどうかで変わる。
     57    行数表示がある → pre > .line-highlight
     58    行数表示がない → pre > code > .line-highlight
     59        また、このとき、.line-highlight は data-start, data-end を持つようになる。
     60*/
    761.hcb_wrap {
    8 
    9     // ベース(テーマに上書きされないよう、クラス2重にして詳細度あげておく)
    10     &.hcb_wrap {
    11         position: relative;
    12         z-index: 0;
    13         display: block;
    14         margin-top: 2em;
    15         margin-bottom: 2em;
    16         padding: 0;
    17 
    18         pre {
    19             position: static;
    20             display: block;
    21             box-sizing: border-box;
    22             margin: 0;
    23             padding: $hcbPaddingY 1.5em;
    24             overflow: auto;
    25             font-size: var(--hcb-font-size, 14px);
    26             font-family: var(--hcb-font-family, "Menlo", "Consolas", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Meiryo", sans-serif);
    27             line-height: 1;
    28             letter-spacing: 0.1px;
    29             border-radius: 0;
    30             -webkit-overflow-scrolling: touch;
    31 
    32             @media screen and (max-width: 599px) {
    33                 font-size: var(--hcb-font-size--mobile, 13px);
    34             }
    35         }
    36 
    37         code,
    38         pre {
    39             color: var(--hcb-color--text, #1f1e1e);
    40             white-space: pre;
    41             text-align: left;
    42             text-shadow: 0 1px var(--hcb-color--text-shadow, #fff);
    43             word-wrap: normal;
    44             word-break: normal;
    45             word-spacing: normal;
    46             tab-size: 4;
    47             hyphens: none;
    48             background: var(--hcb-color--bg, #f7f6f6);
    49             border: none;
    50         }
    51 
    52         code,
    53         span {
    54             box-sizing: border-box;
    55             margin: 0;
    56             padding: 0; // 一部の海外テーマでズレが生じるのを防ぐ
    57             font-size: inherit;
    58             font-family: inherit;
    59             line-height: 1.5;
    60         }
    61     }
    62 
    63 
    64     // line highlight
     62    // .prism[data-line] > .line-highlight
    6563    .line-highlight {
    6664        position: absolute;
    6765        right: 0;
    6866        left: 0;
    69         margin-top: $hcbPaddingY;
     67        margin-top: var(--hcb--pY);
    7068        padding: 0;
    7169        font-size: inherit;
    7270        line-height: inherit;
    7371        white-space: pre;
    74         background: var(--hcb-color--highlight, rgba(150, 120, 100, 0.1));
     72        background: var(--hcb--highlight-color);
    7573        pointer-events: none;
    7674
    77         &::before,
    78         &[data-end]::after {
    79             position: absolute;
    80             top: 0;
    81             left: 0;
    82             box-sizing: border-box;
    83             min-width: 1.5em;
    84             padding: 1px 2px;
    85             color: var(--hcb-color--highlight-text, #f5f2f0);
    86             font-weight: bold;
    87             font-size: 12px;
    88             line-height: inherit;
    89             text-align: center;
    90             text-shadow: none;
    91             vertical-align: middle;
    92             background-color: var(--hcb-color--highlight-bg, #b1aead);
    93             border-radius: 0;
    94             content: attr(data-start);
    95         }
    96 
    97         &[data-end]::after {
    98             top: auto;
    99             bottom: 0;
    100             content: attr(data-end);
    101         }
    102     }
    103 
    104     // 行数表示ある時はハイライトの行表示を消す
    105     .line-numbers .line-highlight::before,
    106     .line-numbers .line-highlight::after {
    107         content: none;
    108     }
    109 
    110     // line numbers
    111     pre.line-numbers {
    112         position: static; // pre の親の .hcb_wrap に追従
    113         padding-left: $hcbLineNumPadding;
     75
     76        // 1.8.0 で廃止
     77        // &::before,
     78        // &::after {
     79        //  position: absolute;
     80        //  top: 0;
     81        //  left: 0;
     82        //  box-sizing: border-box;
     83        //  min-width: 1.5em;
     84        //  padding: 1px 2px;
     85        //  color: var(--hcb--highlight-c);
     86        //  font-size: 12px;
     87        //  line-height: inherit;
     88        //  text-align: center;
     89        //  text-shadow: none;
     90        //  vertical-align: middle;
     91        //  background-color: var(--hcb--highlight-bgc);
     92        //  border-radius: 0;
     93        // }
     94
     95        // &[data-start]::before {
     96        //  content: attr(data-start);
     97        // }
     98
     99        // &[data-end]::after {
     100        //  top: auto;
     101        //  bottom: 0;
     102        //  content: attr(data-end);
     103        // }
     104    }
     105
     106    > .prism.line-numbers {
     107        position: static; // pre の親の .hcb_wrap に追従させたい
     108        padding-left: calc(var(--hcb--pX) + var(--hcb--linenumW)); // .hcb_wrap.hcb_wrap > pre に詳細度勝たないといけない
    114109        counter-reset: linenumber;
    115110
     
    120115    }
    121116
    122     .line-numbers .line-numbers-rows {
     117    .line-numbers-rows {
    123118        position: absolute;
    124         top: -2px;
    125         left: -$hcbLineNumPadding;
    126         width: 3em; // works for line-numbers below 1000 lines
    127         font-size: inherit;
    128         letter-spacing: -1px;
    129         border-right: 1px solid var(--hcb-color--line-numbers, #999);
    130         // -webkit-user-select: none;
    131         // -moz-user-select: none;
    132         // -ms-user-select: none;
     119        top: -0.125em;
     120        left: calc(-1px - var(--hcb--linenumW) - var(--hcb--pX) / 2);
     121        min-width: var(--hcb--linenumW);
     122        font-size: inherit;
     123        // letter-spacing: -1px;
     124        border-right: 1px solid var(--hcb--line-numbers--c);
    133125        user-select: none;
    134126        pointer-events: none;
     
    137129    .line-numbers-rows > span {
    138130        display: block;
     131        letter-spacing: -0.25px;
     132        text-align: center;
    139133        counter-increment: linenumber;
    140134        pointer-events: none;
     
    143137    .line-numbers-rows > span::before {
    144138        display: block;
    145         padding-right: 0.8em;
    146         color: var(--hcb-color--line-numbers, #999);
    147         text-align: right;
     139        color: var(--hcb--line-numbers--c);
    148140        content: counter(linenumber);
    149141    }
    150142
    151     // Lang Name
    152     pre::before {
    153         position: absolute;
    154         top: 0;
    155         right: 0;
    156         z-index: 1;
    157         box-sizing: border-box;
    158         min-width: 4em;
    159         padding: 0 10px;
    160         color: var(--hcb-color--lang--text, #1f1e1e);
    161         font-size: 12px;
    162         font-family: Arial, Helvetica, sans-serif;
    163         line-height: 20px;
    164         text-align: center;
    165         background-color: var(--hcb-color--lang--bg, #dedede);
    166         content: attr(data-lang);
    167     }
    168 
    169     // コピーボタンがある時
    170     .hcb-clipboard + pre::before {
    171         right: 26px;
    172     }
    173 
    174     // ファイル名を表示する時
    175     pre[data-file]::before {
    176         padding: 0 8px 0 20px;
    177         // background-colorを打ち消さないように分けて書く
    178         background-image: var(--hcb-file-icon);
    179         background-repeat: no-repeat;
    180         background-position: center left 8px;
    181         background-size: auto 10px;
    182         content: attr(data-file);
    183     }
    184 
    185     // 強制オフ時
    186     pre[data-show-lang="0"]:not([data-file])::before {
    187         content: none;
    188     }
    189 
    190     // コピーボタン
    191     .hcb-clipboard {
    192         position: absolute;
    193         top: 0;
    194         right: 0;
    195         z-index: 1;
    196         box-sizing: border-box;
    197         width: 20px;
    198         height: 20px;
    199         padding: 0;
    200         text-align: center;
    201         background-color: rgba(#fff, 0.8);
    202         background-image: url(../../assets/img/clipborad.svg);
    203         background-repeat: no-repeat;
    204         background-position: center;
    205         background-size: 16px auto;
     143    // scrollbar
     144    > pre::-webkit-scrollbar {
     145        height: 6px;
     146    }
     147
     148    > pre::-webkit-scrollbar-track {
     149        background: var(--hcb--scbar-track--bgc);
    206150        border: none;
    207         border-radius: 1px;
    208 
    209         &.-done {
    210             background-image: url(../../assets/img/copied.svg);
    211 
    212             &::before {
    213                 position: absolute;
    214                 right: 0;
    215                 bottom: 100%;
    216                 font-size: 14px;
    217                 font-family: Arial, Helvetica, sans-serif;
    218                 line-height: 1.5;
    219                 content: "Copied!";
    220             }
    221         }
    222     }
    223 
    224     // scrollbar
    225     pre::-webkit-scrollbar {
    226         height: 6px;
    227     }
    228 
    229     pre::-webkit-scrollbar-track {
    230         background: var(--hcb-color--scrollbar-track, rgba(150, 150, 150, 0.1));
    231         border: none;
    232     }
    233 
    234     pre::-webkit-scrollbar-thumb {
    235         background: var(--hcb-color--scrollbar-thumb, rgba(150, 150, 150, 0.25));
     151    }
     152
     153    > pre::-webkit-scrollbar-thumb {
     154        background: var(--hcb--scbar-thumb--bgc);
    236155        border-radius: 3px;
    237156    }
     
    245164    border-radius: 0.3em;
    246165}
     166
     167
     168// Lang Name, File Name
     169.hcb_wrap > pre::before {
     170    position: absolute;
     171    top: 0;
     172    right: 0;
     173    z-index: 1;
     174    box-sizing: border-box;
     175    min-width: 4em;
     176    padding: 0 10px;
     177    color: var(--hcb--data-label--c);
     178    font-size: 0.925em;
     179    font-family: inherit;
     180    line-height: 20px;
     181    text-align: center;
     182    background-color: var(--hcb--data-label--bgc);
     183    border-radius: 0 var(--hcb--radius);
     184    content: var(--hcb--data-label);
     185}
     186
     187
     188// 強制オフ時
     189.hcb_wrap > pre[data-show-lang="0"] {
     190    --hcb--data-label: none;
     191}
     192// 強制オン時
     193.hcb_wrap > pre[data-show-lang="1"] {
     194    --hcb--data-label: attr(data-lang);
     195}
     196
     197
     198// コピーボタンがある時
     199// .hcb-clipboard + pre::before {
     200//  right: 26px;
     201// }
     202
     203// ファイル名を表示する時
     204.hcb_wrap > pre[data-file]::before {
     205    padding: 0 8px 0 20px;
     206    // background-colorを打ち消さないように分けて書く
     207    background-image: var(--hcb--file-icon);
     208    background-repeat: no-repeat;
     209    background-position: center left 8px;
     210    background-size: auto 10px;
     211    content: attr(data-file);
     212}
     213
     214// data-show-lang
     215
     216// コピーボタン
     217/* stylelint-disable-next-line no-duplicate-selectors */
     218.hcb_wrap {
     219    --hcb-clipbtn-opacity: 0;
     220}
     221
     222.hcb_wrap:hover,
     223.hcb-clipboard:focus-visible {
     224    --hcb-clipbtn-opacity: 100;
     225}
     226
     227.hcb-clipboard {
     228    position: absolute;
     229    top: calc(var(--hcb--btn-offset, 0px) + 8px);
     230    right: 8px;
     231    z-index: 2;
     232    box-sizing: border-box;
     233    width: 2.25em;
     234    height: 2.25em;
     235    padding: 0;
     236    color: #000;
     237    text-align: center;
     238    background: url(../../assets/img/clipboard-to-copy.svg) no-repeat center / 64% auto;
     239    background-color: rgba(250, 250, 250, 0.8);
     240    border: none;
     241    border-radius: 3px;
     242    box-shadow: 0 1px 2px rgba(#3d3d3d, 0.25);
     243    opacity: var(--hcb-clipbtn-opacity);
     244    backdrop-filter: blur(2px);
     245    transition: opacity 0.25s;
     246
     247    [data-show-lang="0"] + & {
     248        --hcb--btn-offset: 0px;
     249    }
     250
     251    [data-show-lang="1"] + & {
     252        --hcb--btn-offset: 20px;
     253    }
     254
     255    &.-done {
     256        background-image: url(../../assets/img/clipboard-copied.svg);
     257
     258        &::before {
     259            position: absolute;
     260            top: 50%;
     261            right: calc(4px + 100%);
     262            display: block;
     263            padding: 2px 4px 2px 2px;
     264            color: inherit;
     265            font-size: 12px;
     266            font-family: Arial, Helvetica, sans-serif;
     267            line-height: 1;
     268            background-color: inherit;
     269            border-radius: 8px;
     270            content: "✓Copied";
     271            translate: 0 -50%;
     272        }
     273    }
     274}
  • highlighting-code-block/trunk/src/scss/front/_color--dark.scss

    r2886197 r2994656  
    22  Dark coloring
    33*/
    4 body {
    5     --hcb-color--text: #f8f8f2;
    6     --hcb-color--text-shadow: rg1a1a1ab(136, 132, 132);
    7     --hcb-color--bg: #34352e;
    8     --hcb-color--lang--text: #fff;
    9     --hcb-color--lang--bg: #111;
    10     --hcb-color--line-numbers: #999;
    11     --hcb-color--highlight: rgba(255, 250, 245, 0.1);
    12     --hcb-color--highlight-text: #fcfcfc;
    13     --hcb-color--highlight-bg: #afa7a166;
    14     --hcb-file-icon: url(../../assets/img/file-icon-dark.svg);
    15     --hcb-color--scrollbar-track: rgba(255, 255, 255, 0.1);
    16     --hcb-color--scrollbar-thumb: rgba(255, 255, 255, 0.2);
     4:root {
     5    --hcb--c: #f9f9f6;
     6    // --hcb--tsh: none;
     7    --hcb--bgc: #2d2e29;
     8    --hcb--data-label--c: #fff;
     9    --hcb--data-label--bgc: #20211f;
     10    --hcb--line-numbers--c: #a3a3a3;
     11    --hcb--highlight-color: rgba(255, 250, 245, 0.1);
     12    --hcb--file-icon: url(../../assets/img/file-icon-dark.svg);
     13    --hcb--scbar-track--bgc: rgba(255, 255, 255, 0.1);
     14    --hcb--scbar-thumb--bgc: rgba(255, 255, 255, 0.2);
     15
    1716}
    1817
  • highlighting-code-block/trunk/src/scss/front/_color--light.scss

    r2886197 r2994656  
    22  Light coloring
    33*/
    4 body {
    5     --hcb-color--text: #1f1e1e;
    6     --hcb-color--text-shadow: #fff;
    7     --hcb-color--bg: #f7f6f6;
    8     --hcb-color--lang--text: #1f1e1e;
    9     --hcb-color--lang--bg: #dedede;
    10     --hcb-color--line-numbers: #999;
    11     --hcb-color--highlight: rgba(150, 120, 100, 0.1);
    12     --hcb-color--highlight-text: #f5f2f0;
    13     --hcb-color--highlight-bg: #b1aead;
    14     --hcb-file-icon: url(../../assets/img/file-icon-light.svg);
    15     --hcb-color--scrollbar-track: rgba(0, 0, 0, 0.05);
    16     --hcb-color--scrollbar-thumb: #0000001a;
     4:root {
     5    --hcb--tsh: 1px 1px 0px rgb(240, 240, 240);
    176}
    187
Note: See TracChangeset for help on using the changeset viewer.