Plugin Directory

Changeset 2886197

Timestamp:
03/24/2023 08:05:09 AM (17 months ago)
Author:
looswebstudio
Message:

Update to version 1.7.0 from GitHub

Location:
highlighting-code-block
Files:
44 added
28 deleted
28 edited
1 copied

Legend:

Unmodified
Added
Removed
  • highlighting-code-block/tags/1.7.0/build/js/code-block/index.asset.php

    r2669723 r2886197  
    1 <?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '84e2053c93ff6b82f7c7eaff63db2176');
     1<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '');
  • highlighting-code-block/tags/1.7.0/build/js/code-block/index.js

    r2669723 r2886197  
    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.hcbVars?.showLang,S=window.hcbVars?.showLinenum;let _="0";("1"===v||""===v&&"on"===N)&&(_="1");let E=null;("on"===y||"undefined"===y&&"on"===S)&&(E="1");const L=(0,s.useBlockProps)({ref:u,className:w,"data-file":h||null,"data-lang":f||null,"data-show-lang":_,"data-show-linenum":E});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!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.hcb});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)}();
  • highlighting-code-block/tags/1.7.0/build/js/hcb_script.asset.php

    r2669723 r2886197  
    1 <?php return array('dependencies' => array(), 'version' => 'c8838e9b2ff9a8c9044c57752c577ce3');
     1<?php return array('dependencies' => array(), 'version' => '');
  • highlighting-code-block/tags/1.7.0/build/js/hcb_script.js

    r2669723 r2886197  
    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;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"),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;"),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)}))}()}));
  • highlighting-code-block/tags/1.7.0/class/loos_hcb.php

    r2670262 r2886197  
    3737     * Default Languages
    3838     */
    39     const DEFAULT_LANGS = ''.
    40         'html:"HTML",'."\n" .
    41         'css:"CSS",'."\n" .
    42         'scss:"SCSS",'."\n" .
    43         'js:"JavaScript",'."\n" .
    44         'ts:"TypeScript",'."\n" .
    45         'php:"PHP",'."\n" .
    46         'ruby:"Ruby",'."\n" .
    47         'python:"Python",'."\n" .
    48         'swift:"Swift",'."\n" .
    49         'c:"C",'."\n" .
    50         'csharp:"C#",'."\n" .
    51         'cpp:"C++",'."\n" .
    52         'objectivec:"Objective-C",'."\n" .
    53         'sql:"SQL",'."\n" .
    54         'json:"JSON",'."\n" .
    55         'bash:"Bash",'."\n" .
     39    const DEFAULT_LANGS = ''.
     40        'html:"HTML",'"\n" .
     41        'css:"CSS",'"\n" .
     42        'scss:"SCSS",'"\n" .
     43        'js:"JavaScript",'"\n" .
     44        'ts:"TypeScript",'"\n" .
     45        'php:"PHP",'"\n" .
     46        'ruby:"Ruby",'"\n" .
     47        'python:"Python",'"\n" .
     48        'swift:"Swift",'"\n" .
     49        'c:"C",'"\n" .
     50        'csharp:"C#",'"\n" .
     51        'cpp:"C++",'"\n" .
     52        'objectivec:"Objective-C",'"\n" .
     53        'sql:"SQL",'"\n" .
     54        'json:"JSON",'"\n" .
     55        'bash:"Bash",'"\n" .
    5656        'git:"Git",';
    5757
     
    5959     * variables
    6060     */
    61     public static $settings = '';
    62     public static $prism_js_url  = '';
    63     public static $coloring_css_url = '';
    64     public static $editor_coloring_css_url = '';
     61    public static $settings             = '';
     62    public static $custom_prism_path    = '';
     63    public static $custom_coloring_path = '';
     64    public static $front_css_path       = '';
     65    public static $editor_css_path      = '';
    6566
    6667    /**
     
    7576
    7677        // Set linenum
    77         add_filter( 'the_content' , function( $content ) {
     78        add_filter( 'the_content', function( $content ) {
    7879            $content = str_replace( 'prism on-numbers', 'prism line-numbers', $content );
    7980            // $content = preg_replace( '/class="prism([^"]*)on-numbers"/', 'class="prism$1line-numbers"', $content );
    8081
    8182            //個別設定が未定義のブロックはベース設定に依存
    82             if ( 'on' === LOOS_HCB::$settings[ 'show_linenum' ] ) {
     83            if ( 'on' === LOOS_HCB::$settings[] ) {
    8384                $content = str_replace( 'prism undefined-numbers', 'prism line-numbers', $content );
    8485                // $content = preg_replace( '/class="prism([^"]*)undefined-numbers"/', 'class="prism$1line-numbers"', $content );
     
    8687            return $content;
    8788
    88         } , 99);
     89        }, 99);
    8990    }
    9091
     
    9596
    9697        // Get Option for HCB Setiings
    97         $option = get_option( self::DB_NAME[ 'settings' ] ) ?: [];
     98        $option = get_option( self::DB_NAME[] ) ?: [];
    9899
    99100        // v1.2.2での変更
    100101        if ( is_admin() && isset( $option['support_langs'] ) ) {
    101            
    102             $support_langs      = str_replace(["\r\n", "\r", "\n"], '', $option['support_langs']);
    103             $default_langs      = str_replace(["\n"], '', self::DEFAULT_LANGS);
     102
     103            $support_langs );
     104            $default_langs );
    104105
    105106            if ( $default_langs === $support_langs ) {
     
    107108
    108109                // DB更新
    109                 update_option( LOOS_HCB::DB_NAME[ 'settings' ], $option );
     110                update_option( ], $option );
    110111            }
    111112        }
    112113
    113114        // Get default settings
    114         $default = self::DEFAULT_SETTINGS;
     115        $default = self::DEFAULT_SETTINGS;
    115116        $default['support_langs'] = self::DEFAULT_LANGS;
    116 
    117117
    118118        // Merge to default
     
    128128
    129129        // Set Prism.js file url
    130         if ( self::$settings[ 'prism_js_path' ] ) {
    131 
    132             self::$prism_js_url = get_stylesheet_directory_uri() . '/' . self::$settings[ 'prism_js_path' ];
    133 
    134         } else {
    135 
    136             self::$prism_js_url = LOOS_HCB_URL . '/assets/js/prism.js';
     130        if ( self::$settings['prism_js_path'] ) {
     131            self::$custom_prism_path = get_stylesheet_directory_uri() . '/' . self::$settings['prism_js_path'];
    137132        }
    138133
    139134        // Set front coloring file url
    140         if ( self::$settings[ 'prism_css_path' ] ) {
    141 
    142             self::$coloring_css_url = get_stylesheet_directory_uri() . '/' . self::$settings[ 'prism_css_path' ];
    143 
    144         } else {
    145 
    146             self::$coloring_css_url = LOOS_HCB_URL . '/build/css/coloring_' . self::$settings[ 'front_coloring' ] . '.css';
     135        if ( self::$settings['prism_css_path'] ) {
     136            self::$custom_coloring_path = get_stylesheet_directory_uri() . '/' . self::$settings['prism_css_path'];
    147137        }
    148138
    149         // Set editor coloring file url
    150         self::$editor_coloring_css_url = LOOS_HCB_URL . '/build/css/editor_' . self::$settings[ 'editor_coloring' ] . '.css';
     139       
     140        self::$editor_c] . '.css';
    151141    }
    152142
     
    158148
    159149        $inline_css = '';
    160         $HCB = LOOS_HCB::$settings;
     150        $HCB ::$settings;
    161151
    162152        // Font size
    163         $inline_css .= ':root{--hcb-font-size: '. $HCB[ 'fontsize_pc' ] .'}';
    164         $inline_css .= ':root{--hcb-font-size--mobile: '. $HCB[ 'fontsize_sp' ] .'}';
     153        $inline_css .= ':root{--hcb-font-size: ''}';
     154        $inline_css .= ':root{--hcb-font-size--mobile: ''}';
    165155
    166156        // Font family
    167         if ( $HCB[ 'font_family' ] ) {
    168             $inline_css .= ':root{--hcb-font-family:'. $HCB[ 'font_family' ] .'}';
     157        if ( $HCB[] ) {
     158            $inline_css .= ':root{--hcb-font-family:''}';
    169159        }
    170160
    171161        // Code Lang
    172         if ( 'off' === $HCB[ 'show_lang' ] ) {
     162        if ( 'off' === $HCB[] ) {
    173163            $inline_css .= '.hcb_wrap pre:not([data-file]):not([data-show-lang])::before{content: none;}';
    174164        }
    175165
    176166        // Font smoothing
    177         if ( 'on' === $HCB[ 'font_smoothing' ] ) {
     167        if ( 'on' === $HCB[] ) {
    178168            $inline_css .= '.hcb_wrap pre{-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;}';
    179169        }
  • highlighting-code-block/tags/1.7.0/class/loos_hcb_mce.php

    r2670262 r2886197  
    88     */
    99    public function __construct() {
    10         add_action( 'mce_css', ['LOOS_HCB_Mce', 'hook_mce_css'] );
    11         add_action( 'mce_external_plugins', ['LOOS_HCB_Mce', 'hook_mce_external_plugins'], 20 );
    12         add_action( 'tiny_mce_before_init', ['LOOS_HCB_Mce', 'hook_tiny_mce_before_init'] );
    13         add_action( 'mce_buttons_2', ['LOOS_HCB_Mce', 'hook_mce_buttons_2'] );
     10        add_action( 'mce_css', ['LOOS_HCB_Mce', 'hook_mce_css'] );
     11        add_action( 'mce_external_plugins', ['LOOS_HCB_Mce', 'hook_mce_external_plugins'], 20 );
     12        add_action( 'tiny_mce_before_init', ['LOOS_HCB_Mce', 'hook_tiny_mce_before_init'] );
     13        add_action( 'mce_buttons_2', ['LOOS_HCB_Mce', 'hook_mce_buttons_2'] );
    1414    }
    1515
     
    1818     */
    1919    public static function hook_mce_css( $mce_css ) {
    20 
    2120        if ( ! empty( $mce_css ) ) $mce_css .= ',';
    2221
    23         $mce_css .= LOOS_HCB_URL . '/build/css/hcb_editor.css';
    24         $mce_css .= ',';
    25         $mce_css .= LOOS_HCB::$editor_coloring_css_url;
     22        $mce_css .= LOOS_HCB::$editor_css_path;
    2623        return $mce_css;
    2724    }
     
    3128     */
    3229    public static function hook_mce_external_plugins( $plugins ) {
    33         $plugins[ 'hcb_external_script' ] = LOOS_HCB_URL . '/assets/js/hcb_mce_button.js';
     30        $plugins[] = LOOS_HCB_URL . '/assets/js/hcb_mce_button.js';
    3431        return $plugins;
    3532    }
     
    4037    public static function hook_tiny_mce_before_init( $init ) {
    4138        // Don't delete id & empty tags & etc...
    42         $init[ 'valid_elements' ]          = '*[*]';
    43         $init[ 'extended_valid_elements' ] = '*[*]';
    44         $init[ 'verify_html' ]             = false;
     39        $init[]          = '*[*]';
     40        $init[] = '*[*]';
     41        $init[]             = false;
    4542
    4643        // Text editor indent
    47         $init[ 'indent' ] = true;
     44        $init[] = true;
    4845
    4946        // インラインスタイル
     
    5754            $inline_css = preg_replace( '/(?:\n|\r|\r\n)/su', '', $inline_css );
    5855            $inline_css = str_replace( '"', "'", $inline_css ); // " があるとエラーになる
    59    
     56
    6057            $init['content_style'] .= $inline_css;
    6158        }
  • highlighting-code-block/tags/1.7.0/class/loos_hcb_scripts.php

    r2670262 r2886197  
    88     */
    99    public function __construct() {
    10         add_action( 'init', ['LOOS_HCB_Scripts', 'register_hcb_block'] );
    11         add_action( 'wp_enqueue_scripts', ['LOOS_HCB_Scripts', 'hook_wp_enqueue_scripts'], 20 );
    12         add_action( 'admin_enqueue_scripts', ['LOOS_HCB_Scripts', 'hook_admin_enqueue_scripts'] );
    13         add_action( 'enqueue_block_editor_assets', ['LOOS_HCB_Scripts', 'hook_enqueue_block_editor_assets'] );
    14         add_action( 'admin_head', ['LOOS_HCB_Scripts', 'hook_admin_head'], 1 );
     10        add_action( 'init', ['LOOS_HCB_Scripts', 'register_hcb_block'] );
     11        add_action( 'wp_enqueue_scripts', ['LOOS_HCB_Scripts', 'hook_wp_enqueue_scripts'], 20 );
     12        add_action( 'admin_enqueue_scripts', ['LOOS_HCB_Scripts', 'hook_admin_enqueue_scripts'] );
     13        add_action( 'enqueue_block_editor_assets', ['LOOS_HCB_Scripts', 'hook_enqueue_block_editor_assets'] );
     14        add_action( 'admin_head', ['LOOS_HCB_Scripts', 'hook_admin_head'], 1 );
    1515    }
    1616
     
    2222
    2323        // ブロックのスクリプト登録 ( memo: wp_add_inline_script() で紐付けるために wp_register_script 必要 )
    24         $asset = include( LOOS_HCB_PATH . '/build/js/code-block/index.asset.php' );
     24        $asset = include;
    2525        wp_register_script(
    2626            'hcb-code-block',
     
    3030            true
    3131        );
    32        
     32
    3333        // ブロックの登録
    3434        register_block_type_from_metadata( LOOS_HCB_PATH . '/src/js/code-block' );
     
    4444        $ver = ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? wp_date( 'mdGis' ) : LOOS_HCB_VER;
    4545
    46         // HCB style
    47         wp_enqueue_style( 'hcb-style', LOOS_HCB_URL . '/build/css/hcb_style.css', [], $ver );
     46        // HCB スタイルの読み込み.
     47        if ( LOOS_HCB::$custom_coloring_path ) {
     48            // ユーザーに指定されたCSSがあれば、baseスタイル + そのファイルを読み込む
     49            wp_enqueue_style( 'hcb-style', LOOS_HCB_URL . '/build/css/hcb.css', [], $ver );
     50            wp_enqueue_style( 'hcb-coloring', LOOS_HCB::$custom_coloring_path, [ 'hcb-style' ], $ver );
    4851
    49         // Coloring style
    50         wp_enqueue_style( 'hcb-coloring', LOOS_HCB::$coloring_css_url, [ 'hcb-style' ], $ver );
     52        } else {
     53            // ユーザー指定がなければ、カラーリングを含んだデフォルトCSSを読み込む
     54            wp_enqueue_style( 'hcb-style', LOOS_HCB::$front_css_path, [], $ver );
     55        }
    5156
    5257        // Inline Style
    5358        wp_add_inline_style( 'hcb-style', LOOS_HCB::get_inline_style() );
    5459
    55         // clipboard.js
    56         $is_show_copy = LOOS_HCB::$settings['show_copy'];
    57         if ( 'on' === $is_show_copy ) {
    58             wp_enqueue_script( 'clipboard' );
     60        // Prism.js
     61        if ( LOOS_HCB::$custom_prism_path ) {
     62            wp_enqueue_script( 'hcb-prism', LOOS_HCB::$custom_prism_path, [], $ver, true );
     63        } else {
     64            wp_enqueue_script( 'hcb-prism', LOOS_HCB_URL . '/assets/js/prism.js', [], $ver, true );
    5965        }
    6066
    61         // Prism.js
    62         wp_enqueue_script( 'hcb-prism', LOOS_HCB::$prism_js_url, [], $ver, true );
     67        // hcb-scriptの依存関係
     68        $js_deps = [ 'hcb-prism' ];
     69        $js_vars = [
     70            'showCopyBtn'  => '',
     71            'copyBtnLabel' => __( 'Copy code to clipboard', 'loos-hcb' ),
     72        ];
     73
     74        if ( 'on' === LOOS_HCB::$settings['show_copy'] ) {
     75            $js_deps[]              = 'clipboard';
     76            $js_vars['showCopyBtn'] = '1';
     77        }
    6378
    6479        // HCB script
    65         wp_enqueue_script( 'hcb-script', LOOS_HCB_URL . '/build/js/hcb_script.js', [ 'hcb-prism' ], $ver, true );
     80        wp_enqueue_script( 'hcb-script', LOOS_HCB_URL . '/build/js/hcb_script.js', $js_deps, $ver, true );
     81        wp_localize_script( 'hcb-script', 'hcbVars', $js_vars );
    6682
    6783    }
     
    7793
    7894        if ( 'settings_page_hcb_settings' === $hook_suffix ) {
    79             wp_enqueue_style( 'hcb-admin', LOOS_HCB_URL . '/build/css/hcb_admin.css', [], $ver );
     95            wp_enqueue_style( 'hcb-admin', LOOS_HCB_URL . '/build/css/hcbadmin.css', [], $ver );
    8096        }
    8197    }
     
    90106        $ver = ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? wp_date( 'mdGis' ) : LOOS_HCB_VER;
    91107
    92         // Editor Coloring
    93         wp_enqueue_style( 'hcb-editor-coloring', LOOS_HCB::$editor_coloring_css_url, [], $ver );
    94 
    95108        // Editor Style
    96         wp_enqueue_style( 'hcb-editor-style', LOOS_HCB_URL . '/build/css/hcb_editor.css', [ 'hcb-editor-coloring' ], $ver );
     109        wp_enqueue_style( 'hcb-editor-style', LOOS_HCB], $ver );
    97110        wp_add_inline_style( 'hcb-editor-style', LOOS_HCB::get_inline_style() );
    98111
     
    100113        wp_enqueue_script( 'hcb-blocks', LOOS_HCB_URL . '/assets/js/hcb.js', [], $ver, false );
    101114
    102         // 翻訳ファイルの読み込み
     115        // 翻訳ファイルの読み込み
    103116        wp_set_script_translations( 'hcb-blocks', 'loos-hcb', LOOS_HCB_PATH . '/languages' );
    104117
    105118        // 管理画面側に渡すグローバル変数
    106         wp_localize_script( 'hcb-blocks', 'hcbVars', [
    107             'showLang'    => LOOS_HCB::$settings[ 'show_lang' ],
    108             'showLinenum' => LOOS_HCB::$settings[ 'show_linenum' ],
     119        wp_localize_script( 'hcb-blocks', 'hcbVars', [
     120            'showLang'    => LOOS_HCB::$settings[],
     121            'showLinenum' => LOOS_HCB::$settings[],
    109122        ] );
    110123    }
     
    117130    public static function hook_admin_head() {
    118131
    119         $langs = LOOS_HCB::$settings[ 'support_langs' ];
    120         $langs = mb_convert_kana( $langs, 'as'); //全角の文字やスペースがあれば半角に直す
    121         $langs = str_replace(["\r\n", "\r", "\n"], '', $langs);
     132        $langs = LOOS_HCB::$settings[];
     133        $langs = mb_convert_kana( $langs, 'as'); //全角の文字やスペースがあれば半角に直す
     134        $langs = str_replace();
    122135        $langs = trim( $langs, ',' );
    123136
    124         $code = 'var hcbLangs = {'. trim( $langs ) .'};';
     137        $code = 'var hcbLangs = {''};';
    125138
    126139        // for tinyMCE
    127         echo '<script id="hcb-langs">' . $code . '</script>' . PHP_EOL;
     140        echo '<script id="hcb-langs">' . . '</script>' . PHP_EOL;
    128141
    129142        // for Gutenberg
  • highlighting-code-block/tags/1.7.0/highlighting-code-block.php

    r2808006 r2886197  
    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.6.1
     6 * Version: 1.
    77 * Requires at least: 5.6
    88 * Author: LOOS, Inc.
     
    3939 * Activation hooks.
    4040 */
    41 register_activation_hook( __FILE__, ['LOOS_HCB_Activation', 'plugin_activate'] );
    42 register_uninstall_hook( __FILE__, ['LOOS_HCB_Activation', 'plugin_uninstall'] );
     41register_activation_hook( __FILE__, ['LOOS_HCB_Activation', 'plugin_activate'] );
     42register_uninstall_hook( __FILE__, ['LOOS_HCB_Activation', 'plugin_uninstall'] );
    4343
    4444/**
     
    4646 */
    4747add_action( 'plugins_loaded', function() {
    48     // 翻訳
    49     // $locale = apply_filters( 'plugin_locale', determine_locale(), 'loos-hcb' );
    50     // load_textdomain( 'loos-hcb', LOOS_HCB_PATH . '/languages/loos-hcb-' . $locale . '.mo' );
    51     if ( 'ja' === determine_locale() ) {
    52         load_textdomain( 'loos-hcb', LOOS_HCB_PATH . '/languages/loos-hcb-ja.mo' );
    53     } else {
    54         load_plugin_textdomain( 'loos-hcb' );
    55     }
     48    // 翻訳ファイルの読み込み
     49    load_plugin_textdomain( 'loos-hcb', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
    5650
    5751    // 実行
  • highlighting-code-block/tags/1.7.0/languages/loos-hcb-ja.po

    r2432522 r2886197  
    22msgstr ""
    33"Project-Id-Version: Highlighting Code Block\n"
    4 "POT-Creation-Date: 2020-12-06 19:43+0900\n"
    5 "PO-Revision-Date: 2020-12-06 19:44+0900\n"
     4"POT-Creation-Date: 202+0900\n"
     5"PO-Revision-Date: 202+0900\n"
    66"Last-Translator: \n"
    77"Language-Team: \n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "X-Generator: Poedit 2.4.2\n"
     12"Plural-Forms: nplurals=1; plural=0;\n"
     13"X-Generator: Poedit 3.2.2\n"
    1314"X-Poedit-Basepath: ..\n"
    14 "Plural-Forms: nplurals=1; plural=0;\n"
    1515"X-Poedit-Flags-xgettext: --add-comments=translators:\n"
    1616"X-Poedit-WPHeader: highlighting-code-block.php\n"
     
    2424"X-Poedit-SearchPathExcluded-2: src/js/code-block/_utils.js\n"
    2525"X-Poedit-SearchPathExcluded-3: assets/js\n"
    26 
    27 #: src/js/code-block/_panels.js:18
     26"X-Poedit-SearchPathExcluded-4: vendor\n"
     27
     28#: src/js/code-block/_sidebar.js:14
    2829msgid "HCB settings"
    2930msgstr "HCB設定"
    3031
    31 #: src/js/code-block/_panels.js:21
     32#: src/js/code-block/_
    3233msgid "Settings for displaying the number of lines"
    3334msgstr "行数の表示に関する設定"
    3435
    35 #: src/js/code-block/_panels.js:27 src/js/code-block/_panels.js:49
     36#: src/js/code-block/_
    3637msgid "Do not set individually"
    3738msgstr "個別で設定はしない"
    3839
    39 #: src/js/code-block/_panels.js:31
     40#: src/js/code-block/_
    4041msgid "Display row count"
    4142msgstr "行数を表示する"
    4243
    43 #: src/js/code-block/_panels.js:35
     44#: src/js/code-block/_
    4445msgid "Do not display row count"
    4546msgstr "行数を表示しない"
    4647
    47 #: src/js/code-block/_panels.js:45
     48#: src/js/code-block/_
    4849msgid "Settings for displaying language name"
    4950msgstr "言語名の表示に関する設定"
    5051
    51 #: src/js/code-block/_panels.js:53
     52#: src/js/code-block/_
    5253msgid "Display language"
    5354msgstr "言語を表示する"
    5455
    55 #: src/js/code-block/_panels.js:57
     56#: src/js/code-block/_
    5657msgid "Do not display language"
    5758msgstr "言語を表示しない"
    5859
    59 #: src/js/code-block/index.js:204
     60#: src/js/code-block/
    6061msgid "file name"
    6162msgstr "ファイル名"
    6263
    63 #: src/js/code-block/index.js:213
     64#: src/js/code-block/
    6465msgid "\"data-line\" value"
    6566msgstr "data-line属性値"
     
    138139msgstr "コードの “font-family”"
    139140
    140 #: class/loos_hcb_menu.php:130
     141#: class/loos_hcb_menu.php:13
    141142msgid "Advanced settings"
    142143msgstr "高度な設定"
    143144
    144 #: class/loos_hcb_menu.php:135
     145#: class/loos_hcb_menu.php:13
    145146msgid "When you use each original file, please upload it in the theme folder."
    146147msgstr ""
     
    148149"い。"
    149150
    150 #: class/loos_hcb_menu.php:136
     151#: class/loos_hcb_menu.php:13
    151152msgid ""
    152153"If you set the path to your own file, the default coloring file and prism.js "
     
    156157"ファイルは読み込まれなくなります。"
    157158
    158 #: class/loos_hcb_menu.php:138
     159#: class/loos_hcb_menu.php:13
    159160#, php-format
    160161msgid "* The currently loaded prism.js file can be downloaded at %s."
    161162msgstr "※ 現在読み込んでいるprism.jsファイルは、 %s でダウンロードできます。"
    162163
    163 #: class/loos_hcb_menu.php:139
     164#: class/loos_hcb_menu.php:1
    164165msgid "Here"
    165166msgstr "こちら"
    166167
    167 #: class/loos_hcb_menu.php:144
     168#: class/loos_hcb_menu.php:14
    168169msgid "Language set to use"
    169170msgstr "使用する言語セット"
    170171
    171 #: class/loos_hcb_menu.php:149
     172#: class/loos_hcb_menu.php:1
    172173#, php-format
    173174msgid "Write in the format of %s, separated by \",\" (comma)."
    174175msgstr "%s の形式で、”,”(カンマ)区切りで記述してください。"
    175176
    176 #: class/loos_hcb_menu.php:150
     177#: class/loos_hcb_menu.php:15
    177178msgid "class-key:\"language-name\""
    178179msgstr "クラスキー:”言語名”"
    179180
    180 #: class/loos_hcb_menu.php:152
     181#: class/loos_hcb_menu.php:15
    181182msgid ""
    182183"\"class-key\" is the class name used in prism.js (the part corresponding to "
     
    186187"部分)です。"
    187188
    188 #: class/loos_hcb_menu.php:153
     189#: class/loos_hcb_menu.php:15
    189190msgid ""
    190191"* If you use a language that is not supported by default, please use it "
     
    194195"併用してください。"
    195196
    196 #: class/loos_hcb_menu.php:158
     197#: class/loos_hcb_menu.php:15
    197198msgid "Original coloring file"
    198199msgstr "独自カラーリングファイル"
    199200
    200 #: class/loos_hcb_menu.php:161
     201#: class/loos_hcb_menu.php:16
    201202msgid "Load your own CSS file for code coloring."
    202203msgstr "あなたが用意したコードカラーリング用のCSSファイルを読み込みます。"
    203204
    204 #: class/loos_hcb_menu.php:165
     205#: class/loos_hcb_menu.php:16
    205206msgid "Original prism.js"
    206207msgstr "独自prism.js"
    207208
    208 #: class/loos_hcb_menu.php:168
     209#: class/loos_hcb_menu.php:16
    209210msgid "You can use the prism.js file corresponding to your own language set."
    210211msgstr "自分専用の言語セットに対応したprism.jsファイルを使用できます。"
    211212
    212 #: class/loos_hcb_menu.php:172
     213#: class/loos_hcb_menu.php:17
    213214msgid "help"
    214215msgstr "ヘルプ"
    215216
    216 #: class/loos_hcb_menu.php:203
     217#: class/loos_hcb_menu.php:20
    217218msgid "Highlighting Code Block settings"
    218219msgstr "Highlighting Code Block 設定"
     220
     221
     222
     223
    219224
    220225#. Plugin Name of the plugin/theme
  • highlighting-code-block/tags/1.7.0/readme.txt

    r2808006 r2886197  
    44Tags: block, editor, guternberg, code, syntax, highlight, code highlighting, syntax highlight
    55Requires at least: 5.6
    6 Tested up to: 6.1
    7 Stable tag: 1.6.1
     6Tested up to: 6.
     7Stable tag: 1.
    88Requires PHP: 5.6
    99License: GPLv2 or later
     
    9595== Changelog ==
    9696
     97
     98
     99
     100
     101
    97102= 1.6.1 =
    98103- Support for WordPress 6.1.
  • highlighting-code-block/tags/1.7.0/sass-builder.js

    r2669723 r2886197  
    3535const dist = 'build/css';
    3636const files = [
    37     'hcb_style',
    38     'hcb_editor',
    39     'hcb_admin',
    40     'editor_light',
    41     'editor_dark',
    42     'coloring_light',
    43     'coloring_dark',
     37    'hcb',
     38    'hcb--light',
     39    'hcb--dark',
     40    'hcb-editor--light',
     41    'hcb-editor--dark',
     42    'hcb-admin',
    4443];
    4544
  • highlighting-code-block/tags/1.7.0/src/js/code-block/edit.js

    r2669723 r2886197  
    9898    // setAttributes({ preClass: preClass });
    9999
    100     const hcbShowLang = window.hcbVars?.showLang;
    101     const hcbShowLinenum = window.hcbVars?.showLinenum;
     100    const hcbShowLang = window.hcbVars?.showLang;
     101    const hcbShowLinenum = window.hcbVars?.showLinenum;
    102102
    103103    let dataShowLang = '0';
  • highlighting-code-block/tags/1.7.0/src/js/hcb_script.js

    r2622416 r2886197  
    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();
     9    for () {
     10        const elem = keyToken[];
    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 = [];
     13        if () {
     14            elem.classList.add();
     15        } else if () {
     16            elem.classList.add();
    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();
     22    for () {
     23        const elem = lineHighlighter[];
     24        if () {
     25            const dataStart = elem.getAttribute();
    2626
    27             const topPosEm = (dataStart - 1) * 1.5; //line-heightの値
     27            const topPosEm = () * 1.5; //line-heightの値
    2828
    2929            // Line highlighterの位置がずれるので桁数に応じて微調節 -> ずれなくなった?
     
    4343
    4444    // clipboard
    45     (function () {
    46         if (!window.ClipboardJS) return;
     45    ( function () {
     46        if ( ! window.ClipboardJS ) return;
     47        if ( ! window.hcbVars?.showCopyBtn ) return;
    4748
    4849        let clipCt = 1;
    4950
    5051        // hcb_wrap
    51         const hcbWraps = document.querySelectorAll('.hcb_wrap');
     52        const hcbWraps = document.querySelectorAll();
    5253        // const hcbClips = document.querySelectorAll('.hcb-clipboard');
    53         for (let i = 0; i < hcbWraps.length; i++) {
    54             const elem = hcbWraps[i];
    55             const code = elem.querySelector('code');
    56             if (null === code) continue;
     54        for () {
     55            const elem = hcbWraps[];
     56            const code = elem.querySelector();
     57            if () continue;
    5758
    5859            // ボタン生成
    59             const button = document.createElement('button');
    60             button.classList.add('hcb-clipboard');
    61             button.setAttribute('data-clipboard-target', '[data-hcb-clip="' + clipCt + '"]');
    62             button.setAttribute('data-clipboard-action', 'copy');
     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 || '' );
    6365            // button.innerHTML = `コピー`;
    64             elem.prepend(button);
     66            elem.prepend();
    6567
    6668            // codeタグにターゲット属性追加
    67             code.setAttribute('data-hcb-clip', clipCt);
     69            code.setAttribute();
    6870
    6971            clipCt++;
    7072        }
    71         const clipboard = new ClipboardJS('.hcb-clipboard');
    72         clipboard.on('success', function (e) {
     73        const clipboard = new ClipboardJS();
     74        clipboard.on() {
    7375            const btn = e.trigger;
    74             btn.classList.add('-done');
    75             setTimeout(() => {
    76                 btn.classList.remove('-done');
    77             }, 5000);
    78         });
     76            btn.classList.add();
     77            setTimeout(() => {
     78                btn.classList.remove();
     79            }, 5000);
     80        });
    7981        // clipboard.on('error', function (e) {
    8082        //  alert(e);
    8183        // });
    82     })();
    83 });
     84    })();
     85});
  • highlighting-code-block/trunk/build/js/code-block/index.asset.php

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

    r2669723 r2886197  
    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.hcbVars?.showLang,S=window.hcbVars?.showLinenum;let _="0";("1"===v||""===v&&"on"===N)&&(_="1");let E=null;("on"===y||"undefined"===y&&"on"===S)&&(E="1");const L=(0,s.useBlockProps)({ref:u,className:w,"data-file":h||null,"data-lang":f||null,"data-show-lang":_,"data-show-linenum":E});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!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.hcb});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)}();
  • highlighting-code-block/trunk/build/js/hcb_script.asset.php

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

    r2669723 r2886197  
    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;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"),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;"),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)}))}()}));
  • highlighting-code-block/trunk/class/loos_hcb.php

    r2670262 r2886197  
    3737     * Default Languages
    3838     */
    39     const DEFAULT_LANGS = ''.
    40         'html:"HTML",'."\n" .
    41         'css:"CSS",'."\n" .
    42         'scss:"SCSS",'."\n" .
    43         'js:"JavaScript",'."\n" .
    44         'ts:"TypeScript",'."\n" .
    45         'php:"PHP",'."\n" .
    46         'ruby:"Ruby",'."\n" .
    47         'python:"Python",'."\n" .
    48         'swift:"Swift",'."\n" .
    49         'c:"C",'."\n" .
    50         'csharp:"C#",'."\n" .
    51         'cpp:"C++",'."\n" .
    52         'objectivec:"Objective-C",'."\n" .
    53         'sql:"SQL",'."\n" .
    54         'json:"JSON",'."\n" .
    55         'bash:"Bash",'."\n" .
     39    const DEFAULT_LANGS = ''.
     40        'html:"HTML",'"\n" .
     41        'css:"CSS",'"\n" .
     42        'scss:"SCSS",'"\n" .
     43        'js:"JavaScript",'"\n" .
     44        'ts:"TypeScript",'"\n" .
     45        'php:"PHP",'"\n" .
     46        'ruby:"Ruby",'"\n" .
     47        'python:"Python",'"\n" .
     48        'swift:"Swift",'"\n" .
     49        'c:"C",'"\n" .
     50        'csharp:"C#",'"\n" .
     51        'cpp:"C++",'"\n" .
     52        'objectivec:"Objective-C",'"\n" .
     53        'sql:"SQL",'"\n" .
     54        'json:"JSON",'"\n" .
     55        'bash:"Bash",'"\n" .
    5656        'git:"Git",';
    5757
     
    5959     * variables
    6060     */
    61     public static $settings = '';
    62     public static $prism_js_url  = '';
    63     public static $coloring_css_url = '';
    64     public static $editor_coloring_css_url = '';
     61    public static $settings             = '';
     62    public static $custom_prism_path    = '';
     63    public static $custom_coloring_path = '';
     64    public static $front_css_path       = '';
     65    public static $editor_css_path      = '';
    6566
    6667    /**
     
    7576
    7677        // Set linenum
    77         add_filter( 'the_content' , function( $content ) {
     78        add_filter( 'the_content', function( $content ) {
    7879            $content = str_replace( 'prism on-numbers', 'prism line-numbers', $content );
    7980            // $content = preg_replace( '/class="prism([^"]*)on-numbers"/', 'class="prism$1line-numbers"', $content );
    8081
    8182            //個別設定が未定義のブロックはベース設定に依存
    82             if ( 'on' === LOOS_HCB::$settings[ 'show_linenum' ] ) {
     83            if ( 'on' === LOOS_HCB::$settings[] ) {
    8384                $content = str_replace( 'prism undefined-numbers', 'prism line-numbers', $content );
    8485                // $content = preg_replace( '/class="prism([^"]*)undefined-numbers"/', 'class="prism$1line-numbers"', $content );
     
    8687            return $content;
    8788
    88         } , 99);
     89        }, 99);
    8990    }
    9091
     
    9596
    9697        // Get Option for HCB Setiings
    97         $option = get_option( self::DB_NAME[ 'settings' ] ) ?: [];
     98        $option = get_option( self::DB_NAME[] ) ?: [];
    9899
    99100        // v1.2.2での変更
    100101        if ( is_admin() && isset( $option['support_langs'] ) ) {
    101            
    102             $support_langs      = str_replace(["\r\n", "\r", "\n"], '', $option['support_langs']);
    103             $default_langs      = str_replace(["\n"], '', self::DEFAULT_LANGS);
     102
     103            $support_langs );
     104            $default_langs );
    104105
    105106            if ( $default_langs === $support_langs ) {
     
    107108
    108109                // DB更新
    109                 update_option( LOOS_HCB::DB_NAME[ 'settings' ], $option );
     110                update_option( ], $option );
    110111            }
    111112        }
    112113
    113114        // Get default settings
    114         $default = self::DEFAULT_SETTINGS;
     115        $default = self::DEFAULT_SETTINGS;
    115116        $default['support_langs'] = self::DEFAULT_LANGS;
    116 
    117117
    118118        // Merge to default
     
    128128
    129129        // Set Prism.js file url
    130         if ( self::$settings[ 'prism_js_path' ] ) {
    131 
    132             self::$prism_js_url = get_stylesheet_directory_uri() . '/' . self::$settings[ 'prism_js_path' ];
    133 
    134         } else {
    135 
    136             self::$prism_js_url = LOOS_HCB_URL . '/assets/js/prism.js';
     130        if ( self::$settings['prism_js_path'] ) {
     131            self::$custom_prism_path = get_stylesheet_directory_uri() . '/' . self::$settings['prism_js_path'];
    137132        }
    138133
    139134        // Set front coloring file url
    140         if ( self::$settings[ 'prism_css_path' ] ) {
    141 
    142             self::$coloring_css_url = get_stylesheet_directory_uri() . '/' . self::$settings[ 'prism_css_path' ];
    143 
    144         } else {
    145 
    146             self::$coloring_css_url = LOOS_HCB_URL . '/build/css/coloring_' . self::$settings[ 'front_coloring' ] . '.css';
     135        if ( self::$settings['prism_css_path'] ) {
     136            self::$custom_coloring_path = get_stylesheet_directory_uri() . '/' . self::$settings['prism_css_path'];
    147137        }
    148138
    149         // Set editor coloring file url
    150         self::$editor_coloring_css_url = LOOS_HCB_URL . '/build/css/editor_' . self::$settings[ 'editor_coloring' ] . '.css';
     139       
     140        self::$editor_c] . '.css';
    151141    }
    152142
     
    158148
    159149        $inline_css = '';
    160         $HCB = LOOS_HCB::$settings;
     150        $HCB ::$settings;
    161151
    162152        // Font size
    163         $inline_css .= ':root{--hcb-font-size: '. $HCB[ 'fontsize_pc' ] .'}';
    164         $inline_css .= ':root{--hcb-font-size--mobile: '. $HCB[ 'fontsize_sp' ] .'}';
     153        $inline_css .= ':root{--hcb-font-size: ''}';
     154        $inline_css .= ':root{--hcb-font-size--mobile: ''}';
    165155
    166156        // Font family
    167         if ( $HCB[ 'font_family' ] ) {
    168             $inline_css .= ':root{--hcb-font-family:'. $HCB[ 'font_family' ] .'}';
     157        if ( $HCB[] ) {
     158            $inline_css .= ':root{--hcb-font-family:''}';
    169159        }
    170160
    171161        // Code Lang
    172         if ( 'off' === $HCB[ 'show_lang' ] ) {
     162        if ( 'off' === $HCB[] ) {
    173163            $inline_css .= '.hcb_wrap pre:not([data-file]):not([data-show-lang])::before{content: none;}';
    174164        }
    175165
    176166        // Font smoothing
    177         if ( 'on' === $HCB[ 'font_smoothing' ] ) {
     167        if ( 'on' === $HCB[] ) {
    178168            $inline_css .= '.hcb_wrap pre{-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;}';
    179169        }
  • highlighting-code-block/trunk/class/loos_hcb_mce.php

    r2670262 r2886197  
    88     */
    99    public function __construct() {
    10         add_action( 'mce_css', ['LOOS_HCB_Mce', 'hook_mce_css'] );
    11         add_action( 'mce_external_plugins', ['LOOS_HCB_Mce', 'hook_mce_external_plugins'], 20 );
    12         add_action( 'tiny_mce_before_init', ['LOOS_HCB_Mce', 'hook_tiny_mce_before_init'] );
    13         add_action( 'mce_buttons_2', ['LOOS_HCB_Mce', 'hook_mce_buttons_2'] );
     10        add_action( 'mce_css', ['LOOS_HCB_Mce', 'hook_mce_css'] );
     11        add_action( 'mce_external_plugins', ['LOOS_HCB_Mce', 'hook_mce_external_plugins'], 20 );
     12        add_action( 'tiny_mce_before_init', ['LOOS_HCB_Mce', 'hook_tiny_mce_before_init'] );
     13        add_action( 'mce_buttons_2', ['LOOS_HCB_Mce', 'hook_mce_buttons_2'] );
    1414    }
    1515
     
    1818     */
    1919    public static function hook_mce_css( $mce_css ) {
    20 
    2120        if ( ! empty( $mce_css ) ) $mce_css .= ',';
    2221
    23         $mce_css .= LOOS_HCB_URL . '/build/css/hcb_editor.css';
    24         $mce_css .= ',';
    25         $mce_css .= LOOS_HCB::$editor_coloring_css_url;
     22        $mce_css .= LOOS_HCB::$editor_css_path;
    2623        return $mce_css;
    2724    }
     
    3128     */
    3229    public static function hook_mce_external_plugins( $plugins ) {
    33         $plugins[ 'hcb_external_script' ] = LOOS_HCB_URL . '/assets/js/hcb_mce_button.js';
     30        $plugins[] = LOOS_HCB_URL . '/assets/js/hcb_mce_button.js';
    3431        return $plugins;
    3532    }
     
    4037    public static function hook_tiny_mce_before_init( $init ) {
    4138        // Don't delete id & empty tags & etc...
    42         $init[ 'valid_elements' ]          = '*[*]';
    43         $init[ 'extended_valid_elements' ] = '*[*]';
    44         $init[ 'verify_html' ]             = false;
     39        $init[]          = '*[*]';
     40        $init[] = '*[*]';
     41        $init[]             = false;
    4542
    4643        // Text editor indent
    47         $init[ 'indent' ] = true;
     44        $init[] = true;
    4845
    4946        // インラインスタイル
     
    5754            $inline_css = preg_replace( '/(?:\n|\r|\r\n)/su', '', $inline_css );
    5855            $inline_css = str_replace( '"', "'", $inline_css ); // " があるとエラーになる
    59    
     56
    6057            $init['content_style'] .= $inline_css;
    6158        }
  • highlighting-code-block/trunk/class/loos_hcb_scripts.php

    r2670262 r2886197  
    88     */
    99    public function __construct() {
    10         add_action( 'init', ['LOOS_HCB_Scripts', 'register_hcb_block'] );
    11         add_action( 'wp_enqueue_scripts', ['LOOS_HCB_Scripts', 'hook_wp_enqueue_scripts'], 20 );
    12         add_action( 'admin_enqueue_scripts', ['LOOS_HCB_Scripts', 'hook_admin_enqueue_scripts'] );
    13         add_action( 'enqueue_block_editor_assets', ['LOOS_HCB_Scripts', 'hook_enqueue_block_editor_assets'] );
    14         add_action( 'admin_head', ['LOOS_HCB_Scripts', 'hook_admin_head'], 1 );
     10        add_action( 'init', ['LOOS_HCB_Scripts', 'register_hcb_block'] );
     11        add_action( 'wp_enqueue_scripts', ['LOOS_HCB_Scripts', 'hook_wp_enqueue_scripts'], 20 );
     12        add_action( 'admin_enqueue_scripts', ['LOOS_HCB_Scripts', 'hook_admin_enqueue_scripts'] );
     13        add_action( 'enqueue_block_editor_assets', ['LOOS_HCB_Scripts', 'hook_enqueue_block_editor_assets'] );
     14        add_action( 'admin_head', ['LOOS_HCB_Scripts', 'hook_admin_head'], 1 );
    1515    }
    1616
     
    2222
    2323        // ブロックのスクリプト登録 ( memo: wp_add_inline_script() で紐付けるために wp_register_script 必要 )
    24         $asset = include( LOOS_HCB_PATH . '/build/js/code-block/index.asset.php' );
     24        $asset = include;
    2525        wp_register_script(
    2626            'hcb-code-block',
     
    3030            true
    3131        );
    32        
     32
    3333        // ブロックの登録
    3434        register_block_type_from_metadata( LOOS_HCB_PATH . '/src/js/code-block' );
     
    4444        $ver = ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? wp_date( 'mdGis' ) : LOOS_HCB_VER;
    4545
    46         // HCB style
    47         wp_enqueue_style( 'hcb-style', LOOS_HCB_URL . '/build/css/hcb_style.css', [], $ver );
     46        // HCB スタイルの読み込み.
     47        if ( LOOS_HCB::$custom_coloring_path ) {
     48            // ユーザーに指定されたCSSがあれば、baseスタイル + そのファイルを読み込む
     49            wp_enqueue_style( 'hcb-style', LOOS_HCB_URL . '/build/css/hcb.css', [], $ver );
     50            wp_enqueue_style( 'hcb-coloring', LOOS_HCB::$custom_coloring_path, [ 'hcb-style' ], $ver );
    4851
    49         // Coloring style
    50         wp_enqueue_style( 'hcb-coloring', LOOS_HCB::$coloring_css_url, [ 'hcb-style' ], $ver );
     52        } else {
     53            // ユーザー指定がなければ、カラーリングを含んだデフォルトCSSを読み込む
     54            wp_enqueue_style( 'hcb-style', LOOS_HCB::$front_css_path, [], $ver );
     55        }
    5156
    5257        // Inline Style
    5358        wp_add_inline_style( 'hcb-style', LOOS_HCB::get_inline_style() );
    5459
    55         // clipboard.js
    56         $is_show_copy = LOOS_HCB::$settings['show_copy'];
    57         if ( 'on' === $is_show_copy ) {
    58             wp_enqueue_script( 'clipboard' );
     60        // Prism.js
     61        if ( LOOS_HCB::$custom_prism_path ) {
     62            wp_enqueue_script( 'hcb-prism', LOOS_HCB::$custom_prism_path, [], $ver, true );
     63        } else {
     64            wp_enqueue_script( 'hcb-prism', LOOS_HCB_URL . '/assets/js/prism.js', [], $ver, true );
    5965        }
    6066
    61         // Prism.js
    62         wp_enqueue_script( 'hcb-prism', LOOS_HCB::$prism_js_url, [], $ver, true );
     67        // hcb-scriptの依存関係
     68        $js_deps = [ 'hcb-prism' ];
     69        $js_vars = [
     70            'showCopyBtn'  => '',
     71            'copyBtnLabel' => __( 'Copy code to clipboard', 'loos-hcb' ),
     72        ];
     73
     74        if ( 'on' === LOOS_HCB::$settings['show_copy'] ) {
     75            $js_deps[]              = 'clipboard';
     76            $js_vars['showCopyBtn'] = '1';
     77        }
    6378
    6479        // HCB script
    65         wp_enqueue_script( 'hcb-script', LOOS_HCB_URL . '/build/js/hcb_script.js', [ 'hcb-prism' ], $ver, true );
     80        wp_enqueue_script( 'hcb-script', LOOS_HCB_URL . '/build/js/hcb_script.js', $js_deps, $ver, true );
     81        wp_localize_script( 'hcb-script', 'hcbVars', $js_vars );
    6682
    6783    }
     
    7793
    7894        if ( 'settings_page_hcb_settings' === $hook_suffix ) {
    79             wp_enqueue_style( 'hcb-admin', LOOS_HCB_URL . '/build/css/hcb_admin.css', [], $ver );
     95            wp_enqueue_style( 'hcb-admin', LOOS_HCB_URL . '/build/css/hcbadmin.css', [], $ver );
    8096        }
    8197    }
     
    90106        $ver = ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? wp_date( 'mdGis' ) : LOOS_HCB_VER;
    91107
    92         // Editor Coloring
    93         wp_enqueue_style( 'hcb-editor-coloring', LOOS_HCB::$editor_coloring_css_url, [], $ver );
    94 
    95108        // Editor Style
    96         wp_enqueue_style( 'hcb-editor-style', LOOS_HCB_URL . '/build/css/hcb_editor.css', [ 'hcb-editor-coloring' ], $ver );
     109        wp_enqueue_style( 'hcb-editor-style', LOOS_HCB], $ver );
    97110        wp_add_inline_style( 'hcb-editor-style', LOOS_HCB::get_inline_style() );
    98111
     
    100113        wp_enqueue_script( 'hcb-blocks', LOOS_HCB_URL . '/assets/js/hcb.js', [], $ver, false );
    101114
    102         // 翻訳ファイルの読み込み
     115        // 翻訳ファイルの読み込み
    103116        wp_set_script_translations( 'hcb-blocks', 'loos-hcb', LOOS_HCB_PATH . '/languages' );
    104117
    105118        // 管理画面側に渡すグローバル変数
    106         wp_localize_script( 'hcb-blocks', 'hcbVars', [
    107             'showLang'    => LOOS_HCB::$settings[ 'show_lang' ],
    108             'showLinenum' => LOOS_HCB::$settings[ 'show_linenum' ],
     119        wp_localize_script( 'hcb-blocks', 'hcbVars', [
     120            'showLang'    => LOOS_HCB::$settings[],
     121            'showLinenum' => LOOS_HCB::$settings[],
    109122        ] );
    110123    }
     
    117130    public static function hook_admin_head() {
    118131
    119         $langs = LOOS_HCB::$settings[ 'support_langs' ];
    120         $langs = mb_convert_kana( $langs, 'as'); //全角の文字やスペースがあれば半角に直す
    121         $langs = str_replace(["\r\n", "\r", "\n"], '', $langs);
     132        $langs = LOOS_HCB::$settings[];
     133        $langs = mb_convert_kana( $langs, 'as'); //全角の文字やスペースがあれば半角に直す
     134        $langs = str_replace();
    122135        $langs = trim( $langs, ',' );
    123136
    124         $code = 'var hcbLangs = {'. trim( $langs ) .'};';
     137        $code = 'var hcbLangs = {''};';
    125138
    126139        // for tinyMCE
    127         echo '<script id="hcb-langs">' . $code . '</script>' . PHP_EOL;
     140        echo '<script id="hcb-langs">' . . '</script>' . PHP_EOL;
    128141
    129142        // for Gutenberg
  • highlighting-code-block/trunk/highlighting-code-block.php

    r2808006 r2886197  
    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.6.1
     6 * Version: 1.
    77 * Requires at least: 5.6
    88 * Author: LOOS, Inc.
     
    3939 * Activation hooks.
    4040 */
    41 register_activation_hook( __FILE__, ['LOOS_HCB_Activation', 'plugin_activate'] );
    42 register_uninstall_hook( __FILE__, ['LOOS_HCB_Activation', 'plugin_uninstall'] );
     41register_activation_hook( __FILE__, ['LOOS_HCB_Activation', 'plugin_activate'] );
     42register_uninstall_hook( __FILE__, ['LOOS_HCB_Activation', 'plugin_uninstall'] );
    4343
    4444/**
     
    4646 */
    4747add_action( 'plugins_loaded', function() {
    48     // 翻訳
    49     // $locale = apply_filters( 'plugin_locale', determine_locale(), 'loos-hcb' );
    50     // load_textdomain( 'loos-hcb', LOOS_HCB_PATH . '/languages/loos-hcb-' . $locale . '.mo' );
    51     if ( 'ja' === determine_locale() ) {
    52         load_textdomain( 'loos-hcb', LOOS_HCB_PATH . '/languages/loos-hcb-ja.mo' );
    53     } else {
    54         load_plugin_textdomain( 'loos-hcb' );
    55     }
     48    // 翻訳ファイルの読み込み
     49    load_plugin_textdomain( 'loos-hcb', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
    5650
    5751    // 実行
  • highlighting-code-block/trunk/languages/loos-hcb-ja.po

    r2432522 r2886197  
    22msgstr ""
    33"Project-Id-Version: Highlighting Code Block\n"
    4 "POT-Creation-Date: 2020-12-06 19:43+0900\n"
    5 "PO-Revision-Date: 2020-12-06 19:44+0900\n"
     4"POT-Creation-Date: 202+0900\n"
     5"PO-Revision-Date: 202+0900\n"
    66"Last-Translator: \n"
    77"Language-Team: \n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "X-Generator: Poedit 2.4.2\n"
     12"Plural-Forms: nplurals=1; plural=0;\n"
     13"X-Generator: Poedit 3.2.2\n"
    1314"X-Poedit-Basepath: ..\n"
    14 "Plural-Forms: nplurals=1; plural=0;\n"
    1515"X-Poedit-Flags-xgettext: --add-comments=translators:\n"
    1616"X-Poedit-WPHeader: highlighting-code-block.php\n"
     
    2424"X-Poedit-SearchPathExcluded-2: src/js/code-block/_utils.js\n"
    2525"X-Poedit-SearchPathExcluded-3: assets/js\n"
    26 
    27 #: src/js/code-block/_panels.js:18
     26"X-Poedit-SearchPathExcluded-4: vendor\n"
     27
     28#: src/js/code-block/_sidebar.js:14
    2829msgid "HCB settings"
    2930msgstr "HCB設定"
    3031
    31 #: src/js/code-block/_panels.js:21
     32#: src/js/code-block/_
    3233msgid "Settings for displaying the number of lines"
    3334msgstr "行数の表示に関する設定"
    3435
    35 #: src/js/code-block/_panels.js:27 src/js/code-block/_panels.js:49
     36#: src/js/code-block/_
    3637msgid "Do not set individually"
    3738msgstr "個別で設定はしない"
    3839
    39 #: src/js/code-block/_panels.js:31
     40#: src/js/code-block/_
    4041msgid "Display row count"
    4142msgstr "行数を表示する"
    4243
    43 #: src/js/code-block/_panels.js:35
     44#: src/js/code-block/_
    4445msgid "Do not display row count"
    4546msgstr "行数を表示しない"
    4647
    47 #: src/js/code-block/_panels.js:45
     48#: src/js/code-block/_
    4849msgid "Settings for displaying language name"
    4950msgstr "言語名の表示に関する設定"
    5051
    51 #: src/js/code-block/_panels.js:53
     52#: src/js/code-block/_
    5253msgid "Display language"
    5354msgstr "言語を表示する"
    5455
    55 #: src/js/code-block/_panels.js:57
     56#: src/js/code-block/_
    5657msgid "Do not display language"
    5758msgstr "言語を表示しない"
    5859
    59 #: src/js/code-block/index.js:204
     60#: src/js/code-block/
    6061msgid "file name"
    6162msgstr "ファイル名"
    6263
    63 #: src/js/code-block/index.js:213
     64#: src/js/code-block/
    6465msgid "\"data-line\" value"
    6566msgstr "data-line属性値"
     
    138139msgstr "コードの “font-family”"
    139140
    140 #: class/loos_hcb_menu.php:130
     141#: class/loos_hcb_menu.php:13
    141142msgid "Advanced settings"
    142143msgstr "高��な設定"
    143144
    144 #: class/loos_hcb_menu.php:135
     145#: class/loos_hcb_menu.php:13
    145146msgid "When you use each original file, please upload it in the theme folder."
    146147msgstr ""
     
    148149"い。"
    149150
    150 #: class/loos_hcb_menu.php:136
     151#: class/loos_hcb_menu.php:13
    151152msgid ""
    152153"If you set the path to your own file, the default coloring file and prism.js "
     
    156157"ファイルは読み込まれなくなります。"
    157158
    158 #: class/loos_hcb_menu.php:138
     159#: class/loos_hcb_menu.php:13
    159160#, php-format
    160161msgid "* The currently loaded prism.js file can be downloaded at %s."
    161162msgstr "※ 現在読み込んでいるprism.jsファイルは、 %s でダウンロードできます。"
    162163
    163 #: class/loos_hcb_menu.php:139
     164#: class/loos_hcb_menu.php:1
    164165msgid "Here"
    165166msgstr "こちら"
    166167
    167 #: class/loos_hcb_menu.php:144
     168#: class/loos_hcb_menu.php:14
    168169msgid "Language set to use"
    169170msgstr "使用する言語セット"
    170171
    171 #: class/loos_hcb_menu.php:149
     172#: class/loos_hcb_menu.php:1
    172173#, php-format
    173174msgid "Write in the format of %s, separated by \",\" (comma)."
    174175msgstr "%s の形式で、”,”(カンマ)区切りで記述してください。"
    175176
    176 #: class/loos_hcb_menu.php:150
     177#: class/loos_hcb_menu.php:15
    177178msgid "class-key:\"language-name\""
    178179msgstr "クラスキー:”言語名”"
    179180
    180 #: class/loos_hcb_menu.php:152
     181#: class/loos_hcb_menu.php:15
    181182msgid ""
    182183"\"class-key\" is the class name used in prism.js (the part corresponding to "
     
    186187"部分)です。"
    187188
    188 #: class/loos_hcb_menu.php:153
     189#: class/loos_hcb_menu.php:15
    189190msgid ""
    190191"* If you use a language that is not supported by default, please use it "
     
    194195"併用してください。"
    195196
    196 #: class/loos_hcb_menu.php:158
     197#: class/loos_hcb_menu.php:15
    197198msgid "Original coloring file"
    198199msgstr "独自カラーリングファイル"
    199200
    200 #: class/loos_hcb_menu.php:161
     201#: class/loos_hcb_menu.php:16
    201202msgid "Load your own CSS file for code coloring."
    202203msgstr "あなたが用意したコードカラーリング用のCSSファイルを読み込みます。"
    203204
    204 #: class/loos_hcb_menu.php:165
     205#: class/loos_hcb_menu.php:16
    205206msgid "Original prism.js"
    206207msgstr "独自prism.js"
    207208
    208 #: class/loos_hcb_menu.php:168
     209#: class/loos_hcb_menu.php:16
    209210msgid "You can use the prism.js file corresponding to your own language set."
    210211msgstr "自分専用の言語セットに対応したprism.jsファイルを使用できます。"
    211212
    212 #: class/loos_hcb_menu.php:172
     213#: class/loos_hcb_menu.php:17
    213214msgid "help"
    214215msgstr "ヘルプ"
    215216
    216 #: class/loos_hcb_menu.php:203
     217#: class/loos_hcb_menu.php:20
    217218msgid "Highlighting Code Block settings"
    218219msgstr "Highlighting Code Block 設定"
     220
     221
     222
     223
    219224
    220225#. Plugin Name of the plugin/theme
  • highlighting-code-block/trunk/readme.txt

    r2808006 r2886197  
    44Tags: block, editor, guternberg, code, syntax, highlight, code highlighting, syntax highlight
    55Requires at least: 5.6
    6 Tested up to: 6.1
    7 Stable tag: 1.6.1
     6Tested up to: 6.
     7Stable tag: 1.
    88Requires PHP: 5.6
    99License: GPLv2 or later
     
    9595== Changelog ==
    9696
     97
     98
     99
     100
     101
    97102= 1.6.1 =
    98103- Support for WordPress 6.1.
  • highlighting-code-block/trunk/sass-builder.js

    r2669723 r2886197  
    3535const dist = 'build/css';
    3636const files = [
    37     'hcb_style',
    38     'hcb_editor',
    39     'hcb_admin',
    40     'editor_light',
    41     'editor_dark',
    42     'coloring_light',
    43     'coloring_dark',
     37    'hcb',
     38    'hcb--light',
     39    'hcb--dark',
     40    'hcb-editor--light',
     41    'hcb-editor--dark',
     42    'hcb-admin',
    4443];
    4544
  • highlighting-code-block/trunk/src/js/code-block/edit.js

    r2669723 r2886197  
    9898    // setAttributes({ preClass: preClass });
    9999
    100     const hcbShowLang = window.hcbVars?.showLang;
    101     const hcbShowLinenum = window.hcbVars?.showLinenum;
     100    const hcbShowLang = window.hcbVars?.showLang;
     101    const hcbShowLinenum = window.hcbVars?.showLinenum;
    102102
    103103    let dataShowLang = '0';
  • highlighting-code-block/trunk/src/js/hcb_script.js

    r2622416 r2886197  
    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();
     9    for () {
     10        const elem = keyToken[];
    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 = [];
     13        if () {
     14            elem.classList.add();
     15        } else if () {
     16            elem.classList.add();
    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();
     22    for () {
     23        const elem = lineHighlighter[];
     24        if () {
     25            const dataStart = elem.getAttribute();
    2626
    27             const topPosEm = (dataStart - 1) * 1.5; //line-heightの値
     27            const topPosEm = () * 1.5; //line-heightの値
    2828
    2929            // Line highlighterの位置がずれるので桁数に応じて微調節 -> ずれなくなった?
     
    4343
    4444    // clipboard
    45     (function () {
    46         if (!window.ClipboardJS) return;
     45    ( function () {
     46        if ( ! window.ClipboardJS ) return;
     47        if ( ! window.hcbVars?.showCopyBtn ) return;
    4748
    4849        let clipCt = 1;
    4950
    5051        // hcb_wrap
    51         const hcbWraps = document.querySelectorAll('.hcb_wrap');
     52        const hcbWraps = document.querySelectorAll();
    5253        // const hcbClips = document.querySelectorAll('.hcb-clipboard');
    53         for (let i = 0; i < hcbWraps.length; i++) {
    54             const elem = hcbWraps[i];
    55             const code = elem.querySelector('code');
    56             if (null === code) continue;
     54        for () {
     55            const elem = hcbWraps[];
     56            const code = elem.querySelector();
     57            if () continue;
    5758
    5859            // ボタン生成
    59             const button = document.createElement('button');
    60             button.classList.add('hcb-clipboard');
    61             button.setAttribute('data-clipboard-target', '[data-hcb-clip="' + clipCt + '"]');
    62             button.setAttribute('data-clipboard-action', 'copy');
     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 || '' );
    6365            // button.innerHTML = `コピー`;
    64             elem.prepend(button);
     66            elem.prepend();
    6567
    6668            // codeタグにターゲット属性追加
    67             code.setAttribute('data-hcb-clip', clipCt);
     69            code.setAttribute();
    6870
    6971            clipCt++;
    7072        }
    71         const clipboard = new ClipboardJS('.hcb-clipboard');
    72         clipboard.on('success', function (e) {
     73        const clipboard = new ClipboardJS();
     74        clipboard.on() {
    7375            const btn = e.trigger;
    74             btn.classList.add('-done');
    75             setTimeout(() => {
    76                 btn.classList.remove('-done');
    77             }, 5000);
    78         });
     76            btn.classList.add();
     77            setTimeout(() => {
     78                btn.classList.remove();
     79            }, 5000);
     80        });
    7981        // clipboard.on('error', function (e) {
    8082        //  alert(e);
    8183        // });
    82     })();
    83 });
     84    })();
     85});
Note: See TracChangeset for help on using the changeset viewer.