Changeset 2886197
- Timestamp:
- 03/24/2023 08:05:09 AM (17 months ago)
- 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,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):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 Vars?.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,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):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)}))}()}));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;"),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 37 37 * Default Languages 38 38 */ 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" . 56 56 'git:"Git",'; 57 57 … … 59 59 * variables 60 60 */ 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 = ''; 65 66 66 67 /** … … 75 76 76 77 // Set linenum 77 add_filter( 'the_content' 78 add_filter( 'the_content', function( $content ) { 78 79 $content = str_replace( 'prism on-numbers', 'prism line-numbers', $content ); 79 80 // $content = preg_replace( '/class="prism([^"]*)on-numbers"/', 'class="prism$1line-numbers"', $content ); 80 81 81 82 //個別設定が未定義のブロックはベース設定に依存 82 if ( 'on' === LOOS_HCB::$settings[ 'show_linenum'] ) {83 if ( 'on' === LOOS_HCB::$settings[] ) { 83 84 $content = str_replace( 'prism undefined-numbers', 'prism line-numbers', $content ); 84 85 // $content = preg_replace( '/class="prism([^"]*)undefined-numbers"/', 'class="prism$1line-numbers"', $content ); … … 86 87 return $content; 87 88 88 } 89 }, 99); 89 90 } 90 91 … … 95 96 96 97 // Get Option for HCB Setiings 97 $option = get_option( self::DB_NAME[ 'settings'] ) ?: [];98 $option = get_option( self::DB_NAME[] ) ?: []; 98 99 99 100 // v1.2.2での変更 100 101 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 ); 104 105 105 106 if ( $default_langs === $support_langs ) { … … 107 108 108 109 // DB更新 109 update_option( LOOS_HCB::DB_NAME[ 'settings'], $option );110 update_option( ], $option ); 110 111 } 111 112 } 112 113 113 114 // Get default settings 114 $default = self::DEFAULT_SETTINGS;115 $default = self::DEFAULT_SETTINGS; 115 116 $default['support_langs'] = self::DEFAULT_LANGS; 116 117 117 118 118 // Merge to default … … 128 128 129 129 // 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']; 137 132 } 138 133 139 134 // 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']; 147 137 } 148 138 149 // Set editor coloring file url150 self::$editor_c oloring_css_url = LOOS_HCB_URL . '/build/css/editor_' . self::$settings[ 'editor_coloring'] . '.css';139 140 self::$editor_c] . '.css'; 151 141 } 152 142 … … 158 148 159 149 $inline_css = ''; 160 $HCB = LOOS_HCB::$settings;150 $HCB ::$settings; 161 151 162 152 // 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: ''}'; 165 155 166 156 // 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:''}'; 169 159 } 170 160 171 161 // Code Lang 172 if ( 'off' === $HCB[ 'show_lang'] ) {162 if ( 'off' === $HCB[] ) { 173 163 $inline_css .= '.hcb_wrap pre:not([data-file]):not([data-show-lang])::before{content: none;}'; 174 164 } 175 165 176 166 // Font smoothing 177 if ( 'on' === $HCB[ 'font_smoothing'] ) {167 if ( 'on' === $HCB[] ) { 178 168 $inline_css .= '.hcb_wrap pre{-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;}'; 179 169 } -
highlighting-code-block/tags/1.7.0/class/loos_hcb_mce.php
r2670262 r2886197 8 8 */ 9 9 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'] ); 14 14 } 15 15 … … 18 18 */ 19 19 public static function hook_mce_css( $mce_css ) { 20 21 20 if ( ! empty( $mce_css ) ) $mce_css .= ','; 22 21 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; 26 23 return $mce_css; 27 24 } … … 31 28 */ 32 29 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'; 34 31 return $plugins; 35 32 } … … 40 37 public static function hook_tiny_mce_before_init( $init ) { 41 38 // 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; 45 42 46 43 // Text editor indent 47 $init[ 'indent'] = true;44 $init[] = true; 48 45 49 46 // インラインスタイル … … 57 54 $inline_css = preg_replace( '/(?:\n|\r|\r\n)/su', '', $inline_css ); 58 55 $inline_css = str_replace( '"', "'", $inline_css ); // " があるとエラーになる 59 56 60 57 $init['content_style'] .= $inline_css; 61 58 } -
highlighting-code-block/tags/1.7.0/class/loos_hcb_scripts.php
r2670262 r2886197 8 8 */ 9 9 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 ); 15 15 } 16 16 … … 22 22 23 23 // ブロックのスクリプト登録 ( memo: wp_add_inline_script() で紐付けるために wp_register_script 必要 ) 24 $asset = include ( LOOS_HCB_PATH . '/build/js/code-block/index.asset.php' );24 $asset = include; 25 25 wp_register_script( 26 26 'hcb-code-block', … … 30 30 true 31 31 ); 32 32 33 33 // ブロックの登録 34 34 register_block_type_from_metadata( LOOS_HCB_PATH . '/src/js/code-block' ); … … 44 44 $ver = ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? wp_date( 'mdGis' ) : LOOS_HCB_VER; 45 45 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 ); 48 51 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 } 51 56 52 57 // Inline Style 53 58 wp_add_inline_style( 'hcb-style', LOOS_HCB::get_inline_style() ); 54 59 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 ); 59 65 } 60 66 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 } 63 78 64 79 // 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 ); 66 82 67 83 } … … 77 93 78 94 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 ); 80 96 } 81 97 } … … 90 106 $ver = ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? wp_date( 'mdGis' ) : LOOS_HCB_VER; 91 107 92 // Editor Coloring93 wp_enqueue_style( 'hcb-editor-coloring', LOOS_HCB::$editor_coloring_css_url, [], $ver );94 95 108 // 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 ); 97 110 wp_add_inline_style( 'hcb-editor-style', LOOS_HCB::get_inline_style() ); 98 111 … … 100 113 wp_enqueue_script( 'hcb-blocks', LOOS_HCB_URL . '/assets/js/hcb.js', [], $ver, false ); 101 114 102 // 翻訳 ファイルの読み込み115 // 翻訳ファイルの読み込み 103 116 wp_set_script_translations( 'hcb-blocks', 'loos-hcb', LOOS_HCB_PATH . '/languages' ); 104 117 105 118 // 管理画面側に渡すグローバル変数 106 wp_localize_script( 'hcb-blocks', 'hcb Vars', [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[], 109 122 ] ); 110 123 } … … 117 130 public static function hook_admin_head() { 118 131 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(); 122 135 $langs = trim( $langs, ',' ); 123 136 124 $code = 'var hcbLangs = {' . trim( $langs ) .'};';137 $code = 'var hcbLangs = {''};'; 125 138 126 139 // for tinyMCE 127 echo '<script id="hcb-langs">' . $code. '</script>' . PHP_EOL;140 echo '<script id="hcb-langs">' . . '</script>' . PHP_EOL; 128 141 129 142 // for Gutenberg -
highlighting-code-block/tags/1.7.0/highlighting-code-block.php
r2808006 r2886197 4 4 * Plugin URI: https://wordpress.org/plugins/highlighting-code-block/ 5 5 * Description: Add code block with syntax highlighting using prism.js. (Available for Gutenberg and Classic Editor) 6 * Version: 1. 6.16 * Version: 1. 7 7 * Requires at least: 5.6 8 8 * Author: LOOS, Inc. … … 39 39 * Activation hooks. 40 40 */ 41 register_activation_hook( __FILE__, ['LOOS_HCB_Activation', 'plugin_activate' ] );42 register_uninstall_hook( __FILE__, ['LOOS_HCB_Activation', 'plugin_uninstall' ] );41 register_activation_hook( __FILE__, ['LOOS_HCB_Activation', 'plugin_activate'] ); 42 register_uninstall_hook( __FILE__, ['LOOS_HCB_Activation', 'plugin_uninstall'] ); 43 43 44 44 /** … … 46 46 */ 47 47 add_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' ); 56 50 57 51 // 実行 -
highlighting-code-block/tags/1.7.0/languages/loos-hcb-ja.po
r2432522 r2886197 2 2 msgstr "" 3 3 "Project-Id-Version: Highlighting Code Block\n" 4 "POT-Creation-Date: 202 0-12-06 19:43+0900\n"5 "PO-Revision-Date: 202 0-12-06 19:44+0900\n"4 "POT-Creation-Date: 202+0900\n" 5 "PO-Revision-Date: 202+0900\n" 6 6 "Last-Translator: \n" 7 7 "Language-Team: \n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "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" 13 14 "X-Poedit-Basepath: ..\n" 14 "Plural-Forms: nplurals=1; plural=0;\n"15 15 "X-Poedit-Flags-xgettext: --add-comments=translators:\n" 16 16 "X-Poedit-WPHeader: highlighting-code-block.php\n" … … 24 24 "X-Poedit-SearchPathExcluded-2: src/js/code-block/_utils.js\n" 25 25 "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 28 29 msgid "HCB settings" 29 30 msgstr "HCB設定" 30 31 31 #: src/js/code-block/_ panels.js:2132 #: src/js/code-block/_ 32 33 msgid "Settings for displaying the number of lines" 33 34 msgstr "行数の表示に関する設定" 34 35 35 #: src/js/code-block/_ panels.js:27 src/js/code-block/_panels.js:4936 #: src/js/code-block/_ 36 37 msgid "Do not set individually" 37 38 msgstr "個別で設定はしない" 38 39 39 #: src/js/code-block/_ panels.js:3140 #: src/js/code-block/_ 40 41 msgid "Display row count" 41 42 msgstr "行数を表示する" 42 43 43 #: src/js/code-block/_ panels.js:3544 #: src/js/code-block/_ 44 45 msgid "Do not display row count" 45 46 msgstr "行数を表示しない" 46 47 47 #: src/js/code-block/_ panels.js:4548 #: src/js/code-block/_ 48 49 msgid "Settings for displaying language name" 49 50 msgstr "言語名の表示に関する設定" 50 51 51 #: src/js/code-block/_ panels.js:5352 #: src/js/code-block/_ 52 53 msgid "Display language" 53 54 msgstr "言語を表示する" 54 55 55 #: src/js/code-block/_ panels.js:5756 #: src/js/code-block/_ 56 57 msgid "Do not display language" 57 58 msgstr "言語を表示しない" 58 59 59 #: src/js/code-block/ index.js:20460 #: src/js/code-block/ 60 61 msgid "file name" 61 62 msgstr "ファイル名" 62 63 63 #: src/js/code-block/ index.js:21364 #: src/js/code-block/ 64 65 msgid "\"data-line\" value" 65 66 msgstr "data-line属性値" … … 138 139 msgstr "コードの “font-family”" 139 140 140 #: class/loos_hcb_menu.php:13 0141 #: class/loos_hcb_menu.php:13 141 142 msgid "Advanced settings" 142 143 msgstr "高度な設定" 143 144 144 #: class/loos_hcb_menu.php:13 5145 #: class/loos_hcb_menu.php:13 145 146 msgid "When you use each original file, please upload it in the theme folder." 146 147 msgstr "" … … 148 149 "い。" 149 150 150 #: class/loos_hcb_menu.php:13 6151 #: class/loos_hcb_menu.php:13 151 152 msgid "" 152 153 "If you set the path to your own file, the default coloring file and prism.js " … … 156 157 "ファイルは読み込まれなくなります。" 157 158 158 #: class/loos_hcb_menu.php:13 8159 #: class/loos_hcb_menu.php:13 159 160 #, php-format 160 161 msgid "* The currently loaded prism.js file can be downloaded at %s." 161 162 msgstr "※ 現在読み込んでいるprism.jsファイルは、 %s でダウンロードできます。" 162 163 163 #: class/loos_hcb_menu.php:1 39164 #: class/loos_hcb_menu.php:1 164 165 msgid "Here" 165 166 msgstr "こちら" 166 167 167 #: class/loos_hcb_menu.php:14 4168 #: class/loos_hcb_menu.php:14 168 169 msgid "Language set to use" 169 170 msgstr "使用する言語セット" 170 171 171 #: class/loos_hcb_menu.php:1 49172 #: class/loos_hcb_menu.php:1 172 173 #, php-format 173 174 msgid "Write in the format of %s, separated by \",\" (comma)." 174 175 msgstr "%s の形式で、”,”(カンマ)区切りで記述してください。" 175 176 176 #: class/loos_hcb_menu.php:15 0177 #: class/loos_hcb_menu.php:15 177 178 msgid "class-key:\"language-name\"" 178 179 msgstr "クラスキー:”言語名”" 179 180 180 #: class/loos_hcb_menu.php:15 2181 #: class/loos_hcb_menu.php:15 181 182 msgid "" 182 183 "\"class-key\" is the class name used in prism.js (the part corresponding to " … … 186 187 "部分)です。" 187 188 188 #: class/loos_hcb_menu.php:15 3189 #: class/loos_hcb_menu.php:15 189 190 msgid "" 190 191 "* If you use a language that is not supported by default, please use it " … … 194 195 "併用してください。" 195 196 196 #: class/loos_hcb_menu.php:15 8197 #: class/loos_hcb_menu.php:15 197 198 msgid "Original coloring file" 198 199 msgstr "独自カラーリングファイル" 199 200 200 #: class/loos_hcb_menu.php:16 1201 #: class/loos_hcb_menu.php:16 201 202 msgid "Load your own CSS file for code coloring." 202 203 msgstr "あなたが用意したコードカラーリング用のCSSファイルを読み込みます。" 203 204 204 #: class/loos_hcb_menu.php:16 5205 #: class/loos_hcb_menu.php:16 205 206 msgid "Original prism.js" 206 207 msgstr "独自prism.js" 207 208 208 #: class/loos_hcb_menu.php:16 8209 #: class/loos_hcb_menu.php:16 209 210 msgid "You can use the prism.js file corresponding to your own language set." 210 211 msgstr "自分専用の言語セットに対応したprism.jsファイルを使用できます。" 211 212 212 #: class/loos_hcb_menu.php:17 2213 #: class/loos_hcb_menu.php:17 213 214 msgid "help" 214 215 msgstr "ヘルプ" 215 216 216 #: class/loos_hcb_menu.php:20 3217 #: class/loos_hcb_menu.php:20 217 218 msgid "Highlighting Code Block settings" 218 219 msgstr "Highlighting Code Block 設定" 220 221 222 223 219 224 220 225 #. Plugin Name of the plugin/theme -
highlighting-code-block/tags/1.7.0/readme.txt
r2808006 r2886197 4 4 Tags: block, editor, guternberg, code, syntax, highlight, code highlighting, syntax highlight 5 5 Requires at least: 5.6 6 Tested up to: 6. 17 Stable tag: 1. 6.16 Tested up to: 6. 7 Stable tag: 1. 8 8 Requires PHP: 5.6 9 9 License: GPLv2 or later … … 95 95 == Changelog == 96 96 97 98 99 100 101 97 102 = 1.6.1 = 98 103 - Support for WordPress 6.1. -
highlighting-code-block/tags/1.7.0/sass-builder.js
r2669723 r2886197 35 35 const dist = 'build/css'; 36 36 const 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', 44 43 ]; 45 44 -
highlighting-code-block/tags/1.7.0/src/js/code-block/edit.js
r2669723 r2886197 98 98 // setAttributes({ preClass: preClass }); 99 99 100 const hcbShowLang = window.hcb Vars?.showLang;101 const hcbShowLinenum = window.hcb Vars?.showLinenum;100 const hcbShowLang = window.hcbVars?.showLang; 101 const hcbShowLinenum = window.hcbVars?.showLinenum; 102 102 103 103 let dataShowLang = '0'; -
highlighting-code-block/tags/1.7.0/src/js/hcb_script.js
r2622416 r2886197 1 document.addEventListener( 'DOMContentLoaded', function () {1 document.addEventListener('DOMContentLoaded', function () { 2 2 // if (!window.Prism) return; 3 3 … … 6 6 7 7 // 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[]; 11 11 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(); 17 17 } 18 18 } 19 19 20 20 // 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(); 26 26 27 const topPosEm = ( dataStart - 1) * 1.5; //line-heightの値27 const topPosEm = () * 1.5; //line-heightの値 28 28 29 29 // Line highlighterの位置がずれるので桁数に応じて微調節 -> ずれなくなった? … … 43 43 44 44 // clipboard 45 (function () { 46 if (!window.ClipboardJS) return; 45 ( function () { 46 if ( ! window.ClipboardJS ) return; 47 if ( ! window.hcbVars?.showCopyBtn ) return; 47 48 48 49 let clipCt = 1; 49 50 50 51 // hcb_wrap 51 const hcbWraps = document.querySelectorAll( '.hcb_wrap');52 const hcbWraps = document.querySelectorAll(); 52 53 // 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; 57 58 58 59 // ボタン生成 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 || '' ); 63 65 // button.innerHTML = `コピー`; 64 elem.prepend( button);66 elem.prepend(); 65 67 66 68 // codeタグにターゲット属性追加 67 code.setAttribute( 'data-hcb-clip', clipCt);69 code.setAttribute(); 68 70 69 71 clipCt++; 70 72 } 71 const clipboard = new ClipboardJS( '.hcb-clipboard');72 clipboard.on( 'success', function (e) {73 const clipboard = new ClipboardJS(); 74 clipboard.on() { 73 75 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 }); 79 81 // clipboard.on('error', function (e) { 80 82 // alert(e); 81 83 // }); 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,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):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 Vars?.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,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):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)}))}()}));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;"),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 37 37 * Default Languages 38 38 */ 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" . 56 56 'git:"Git",'; 57 57 … … 59 59 * variables 60 60 */ 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 = ''; 65 66 66 67 /** … … 75 76 76 77 // Set linenum 77 add_filter( 'the_content' 78 add_filter( 'the_content', function( $content ) { 78 79 $content = str_replace( 'prism on-numbers', 'prism line-numbers', $content ); 79 80 // $content = preg_replace( '/class="prism([^"]*)on-numbers"/', 'class="prism$1line-numbers"', $content ); 80 81 81 82 //個別設定が未定義のブロックはベース設定に依存 82 if ( 'on' === LOOS_HCB::$settings[ 'show_linenum'] ) {83 if ( 'on' === LOOS_HCB::$settings[] ) { 83 84 $content = str_replace( 'prism undefined-numbers', 'prism line-numbers', $content ); 84 85 // $content = preg_replace( '/class="prism([^"]*)undefined-numbers"/', 'class="prism$1line-numbers"', $content ); … … 86 87 return $content; 87 88 88 } 89 }, 99); 89 90 } 90 91 … … 95 96 96 97 // Get Option for HCB Setiings 97 $option = get_option( self::DB_NAME[ 'settings'] ) ?: [];98 $option = get_option( self::DB_NAME[] ) ?: []; 98 99 99 100 // v1.2.2での変更 100 101 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 ); 104 105 105 106 if ( $default_langs === $support_langs ) { … … 107 108 108 109 // DB更新 109 update_option( LOOS_HCB::DB_NAME[ 'settings'], $option );110 update_option( ], $option ); 110 111 } 111 112 } 112 113 113 114 // Get default settings 114 $default = self::DEFAULT_SETTINGS;115 $default = self::DEFAULT_SETTINGS; 115 116 $default['support_langs'] = self::DEFAULT_LANGS; 116 117 117 118 118 // Merge to default … … 128 128 129 129 // 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']; 137 132 } 138 133 139 134 // 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']; 147 137 } 148 138 149 // Set editor coloring file url150 self::$editor_c oloring_css_url = LOOS_HCB_URL . '/build/css/editor_' . self::$settings[ 'editor_coloring'] . '.css';139 140 self::$editor_c] . '.css'; 151 141 } 152 142 … … 158 148 159 149 $inline_css = ''; 160 $HCB = LOOS_HCB::$settings;150 $HCB ::$settings; 161 151 162 152 // 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: ''}'; 165 155 166 156 // 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:''}'; 169 159 } 170 160 171 161 // Code Lang 172 if ( 'off' === $HCB[ 'show_lang'] ) {162 if ( 'off' === $HCB[] ) { 173 163 $inline_css .= '.hcb_wrap pre:not([data-file]):not([data-show-lang])::before{content: none;}'; 174 164 } 175 165 176 166 // Font smoothing 177 if ( 'on' === $HCB[ 'font_smoothing'] ) {167 if ( 'on' === $HCB[] ) { 178 168 $inline_css .= '.hcb_wrap pre{-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;}'; 179 169 } -
highlighting-code-block/trunk/class/loos_hcb_mce.php
r2670262 r2886197 8 8 */ 9 9 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'] ); 14 14 } 15 15 … … 18 18 */ 19 19 public static function hook_mce_css( $mce_css ) { 20 21 20 if ( ! empty( $mce_css ) ) $mce_css .= ','; 22 21 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; 26 23 return $mce_css; 27 24 } … … 31 28 */ 32 29 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'; 34 31 return $plugins; 35 32 } … … 40 37 public static function hook_tiny_mce_before_init( $init ) { 41 38 // 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; 45 42 46 43 // Text editor indent 47 $init[ 'indent'] = true;44 $init[] = true; 48 45 49 46 // インラインスタイル … … 57 54 $inline_css = preg_replace( '/(?:\n|\r|\r\n)/su', '', $inline_css ); 58 55 $inline_css = str_replace( '"', "'", $inline_css ); // " があるとエラーになる 59 56 60 57 $init['content_style'] .= $inline_css; 61 58 } -
highlighting-code-block/trunk/class/loos_hcb_scripts.php
r2670262 r2886197 8 8 */ 9 9 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 ); 15 15 } 16 16 … … 22 22 23 23 // ブロックのスクリプト登録 ( memo: wp_add_inline_script() で紐付けるために wp_register_script 必要 ) 24 $asset = include ( LOOS_HCB_PATH . '/build/js/code-block/index.asset.php' );24 $asset = include; 25 25 wp_register_script( 26 26 'hcb-code-block', … … 30 30 true 31 31 ); 32 32 33 33 // ブロックの登録 34 34 register_block_type_from_metadata( LOOS_HCB_PATH . '/src/js/code-block' ); … … 44 44 $ver = ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? wp_date( 'mdGis' ) : LOOS_HCB_VER; 45 45 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 ); 48 51 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 } 51 56 52 57 // Inline Style 53 58 wp_add_inline_style( 'hcb-style', LOOS_HCB::get_inline_style() ); 54 59 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 ); 59 65 } 60 66 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 } 63 78 64 79 // 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 ); 66 82 67 83 } … … 77 93 78 94 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 ); 80 96 } 81 97 } … … 90 106 $ver = ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? wp_date( 'mdGis' ) : LOOS_HCB_VER; 91 107 92 // Editor Coloring93 wp_enqueue_style( 'hcb-editor-coloring', LOOS_HCB::$editor_coloring_css_url, [], $ver );94 95 108 // 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 ); 97 110 wp_add_inline_style( 'hcb-editor-style', LOOS_HCB::get_inline_style() ); 98 111 … … 100 113 wp_enqueue_script( 'hcb-blocks', LOOS_HCB_URL . '/assets/js/hcb.js', [], $ver, false ); 101 114 102 // 翻訳 ファイルの読み込み115 // 翻訳ファイルの読み込み 103 116 wp_set_script_translations( 'hcb-blocks', 'loos-hcb', LOOS_HCB_PATH . '/languages' ); 104 117 105 118 // 管理画面側に渡すグローバル変数 106 wp_localize_script( 'hcb-blocks', 'hcb Vars', [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[], 109 122 ] ); 110 123 } … … 117 130 public static function hook_admin_head() { 118 131 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(); 122 135 $langs = trim( $langs, ',' ); 123 136 124 $code = 'var hcbLangs = {' . trim( $langs ) .'};';137 $code = 'var hcbLangs = {''};'; 125 138 126 139 // for tinyMCE 127 echo '<script id="hcb-langs">' . $code. '</script>' . PHP_EOL;140 echo '<script id="hcb-langs">' . . '</script>' . PHP_EOL; 128 141 129 142 // for Gutenberg -
highlighting-code-block/trunk/highlighting-code-block.php
r2808006 r2886197 4 4 * Plugin URI: https://wordpress.org/plugins/highlighting-code-block/ 5 5 * Description: Add code block with syntax highlighting using prism.js. (Available for Gutenberg and Classic Editor) 6 * Version: 1. 6.16 * Version: 1. 7 7 * Requires at least: 5.6 8 8 * Author: LOOS, Inc. … … 39 39 * Activation hooks. 40 40 */ 41 register_activation_hook( __FILE__, ['LOOS_HCB_Activation', 'plugin_activate' ] );42 register_uninstall_hook( __FILE__, ['LOOS_HCB_Activation', 'plugin_uninstall' ] );41 register_activation_hook( __FILE__, ['LOOS_HCB_Activation', 'plugin_activate'] ); 42 register_uninstall_hook( __FILE__, ['LOOS_HCB_Activation', 'plugin_uninstall'] ); 43 43 44 44 /** … … 46 46 */ 47 47 add_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' ); 56 50 57 51 // 実行 -
highlighting-code-block/trunk/languages/loos-hcb-ja.po
r2432522 r2886197 2 2 msgstr "" 3 3 "Project-Id-Version: Highlighting Code Block\n" 4 "POT-Creation-Date: 202 0-12-06 19:43+0900\n"5 "PO-Revision-Date: 202 0-12-06 19:44+0900\n"4 "POT-Creation-Date: 202+0900\n" 5 "PO-Revision-Date: 202+0900\n" 6 6 "Last-Translator: \n" 7 7 "Language-Team: \n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "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" 13 14 "X-Poedit-Basepath: ..\n" 14 "Plural-Forms: nplurals=1; plural=0;\n"15 15 "X-Poedit-Flags-xgettext: --add-comments=translators:\n" 16 16 "X-Poedit-WPHeader: highlighting-code-block.php\n" … … 24 24 "X-Poedit-SearchPathExcluded-2: src/js/code-block/_utils.js\n" 25 25 "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 28 29 msgid "HCB settings" 29 30 msgstr "HCB設定" 30 31 31 #: src/js/code-block/_ panels.js:2132 #: src/js/code-block/_ 32 33 msgid "Settings for displaying the number of lines" 33 34 msgstr "行数の表示に関する設定" 34 35 35 #: src/js/code-block/_ panels.js:27 src/js/code-block/_panels.js:4936 #: src/js/code-block/_ 36 37 msgid "Do not set individually" 37 38 msgstr "個別で設定はしない" 38 39 39 #: src/js/code-block/_ panels.js:3140 #: src/js/code-block/_ 40 41 msgid "Display row count" 41 42 msgstr "行数を表示する" 42 43 43 #: src/js/code-block/_ panels.js:3544 #: src/js/code-block/_ 44 45 msgid "Do not display row count" 45 46 msgstr "行数を表示しない" 46 47 47 #: src/js/code-block/_ panels.js:4548 #: src/js/code-block/_ 48 49 msgid "Settings for displaying language name" 49 50 msgstr "言語名の表示に関する設定" 50 51 51 #: src/js/code-block/_ panels.js:5352 #: src/js/code-block/_ 52 53 msgid "Display language" 53 54 msgstr "言語を表示する" 54 55 55 #: src/js/code-block/_ panels.js:5756 #: src/js/code-block/_ 56 57 msgid "Do not display language" 57 58 msgstr "言語を表示しない" 58 59 59 #: src/js/code-block/ index.js:20460 #: src/js/code-block/ 60 61 msgid "file name" 61 62 msgstr "ファイル名" 62 63 63 #: src/js/code-block/ index.js:21364 #: src/js/code-block/ 64 65 msgid "\"data-line\" value" 65 66 msgstr "data-line属性値" … … 138 139 msgstr "コードの “font-family”" 139 140 140 #: class/loos_hcb_menu.php:13 0141 #: class/loos_hcb_menu.php:13 141 142 msgid "Advanced settings" 142 143 msgstr "高��な設定" 143 144 144 #: class/loos_hcb_menu.php:13 5145 #: class/loos_hcb_menu.php:13 145 146 msgid "When you use each original file, please upload it in the theme folder." 146 147 msgstr "" … … 148 149 "い。" 149 150 150 #: class/loos_hcb_menu.php:13 6151 #: class/loos_hcb_menu.php:13 151 152 msgid "" 152 153 "If you set the path to your own file, the default coloring file and prism.js " … … 156 157 "ファイルは読み込まれなくなります。" 157 158 158 #: class/loos_hcb_menu.php:13 8159 #: class/loos_hcb_menu.php:13 159 160 #, php-format 160 161 msgid "* The currently loaded prism.js file can be downloaded at %s." 161 162 msgstr "※ 現在読み込んでいるprism.jsファイルは、 %s でダウンロードできます。" 162 163 163 #: class/loos_hcb_menu.php:1 39164 #: class/loos_hcb_menu.php:1 164 165 msgid "Here" 165 166 msgstr "こちら" 166 167 167 #: class/loos_hcb_menu.php:14 4168 #: class/loos_hcb_menu.php:14 168 169 msgid "Language set to use" 169 170 msgstr "使用する言語セット" 170 171 171 #: class/loos_hcb_menu.php:1 49172 #: class/loos_hcb_menu.php:1 172 173 #, php-format 173 174 msgid "Write in the format of %s, separated by \",\" (comma)." 174 175 msgstr "%s の形式で、”,”(カンマ)区切りで記述してください。" 175 176 176 #: class/loos_hcb_menu.php:15 0177 #: class/loos_hcb_menu.php:15 177 178 msgid "class-key:\"language-name\"" 178 179 msgstr "クラスキー:”言語名”" 179 180 180 #: class/loos_hcb_menu.php:15 2181 #: class/loos_hcb_menu.php:15 181 182 msgid "" 182 183 "\"class-key\" is the class name used in prism.js (the part corresponding to " … … 186 187 "部分)です。" 187 188 188 #: class/loos_hcb_menu.php:15 3189 #: class/loos_hcb_menu.php:15 189 190 msgid "" 190 191 "* If you use a language that is not supported by default, please use it " … … 194 195 "併用してください。" 195 196 196 #: class/loos_hcb_menu.php:15 8197 #: class/loos_hcb_menu.php:15 197 198 msgid "Original coloring file" 198 199 msgstr "独自カラーリングファイル" 199 200 200 #: class/loos_hcb_menu.php:16 1201 #: class/loos_hcb_menu.php:16 201 202 msgid "Load your own CSS file for code coloring." 202 203 msgstr "あなたが用意したコードカラーリング用のCSSファイルを読み込みます。" 203 204 204 #: class/loos_hcb_menu.php:16 5205 #: class/loos_hcb_menu.php:16 205 206 msgid "Original prism.js" 206 207 msgstr "独自prism.js" 207 208 208 #: class/loos_hcb_menu.php:16 8209 #: class/loos_hcb_menu.php:16 209 210 msgid "You can use the prism.js file corresponding to your own language set." 210 211 msgstr "自分専用の言語セットに対応したprism.jsファイルを使用できます。" 211 212 212 #: class/loos_hcb_menu.php:17 2213 #: class/loos_hcb_menu.php:17 213 214 msgid "help" 214 215 msgstr "ヘルプ" 215 216 216 #: class/loos_hcb_menu.php:20 3217 #: class/loos_hcb_menu.php:20 217 218 msgid "Highlighting Code Block settings" 218 219 msgstr "Highlighting Code Block 設定" 220 221 222 223 219 224 220 225 #. Plugin Name of the plugin/theme -
highlighting-code-block/trunk/readme.txt
r2808006 r2886197 4 4 Tags: block, editor, guternberg, code, syntax, highlight, code highlighting, syntax highlight 5 5 Requires at least: 5.6 6 Tested up to: 6. 17 Stable tag: 1. 6.16 Tested up to: 6. 7 Stable tag: 1. 8 8 Requires PHP: 5.6 9 9 License: GPLv2 or later … … 95 95 == Changelog == 96 96 97 98 99 100 101 97 102 = 1.6.1 = 98 103 - Support for WordPress 6.1. -
highlighting-code-block/trunk/sass-builder.js
r2669723 r2886197 35 35 const dist = 'build/css'; 36 36 const 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', 44 43 ]; 45 44 -
highlighting-code-block/trunk/src/js/code-block/edit.js
r2669723 r2886197 98 98 // setAttributes({ preClass: preClass }); 99 99 100 const hcbShowLang = window.hcb Vars?.showLang;101 const hcbShowLinenum = window.hcb Vars?.showLinenum;100 const hcbShowLang = window.hcbVars?.showLang; 101 const hcbShowLinenum = window.hcbVars?.showLinenum; 102 102 103 103 let dataShowLang = '0'; -
highlighting-code-block/trunk/src/js/hcb_script.js
r2622416 r2886197 1 document.addEventListener( 'DOMContentLoaded', function () {1 document.addEventListener('DOMContentLoaded', function () { 2 2 // if (!window.Prism) return; 3 3 … … 6 6 7 7 // 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[]; 11 11 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(); 17 17 } 18 18 } 19 19 20 20 // 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(); 26 26 27 const topPosEm = ( dataStart - 1) * 1.5; //line-heightの値27 const topPosEm = () * 1.5; //line-heightの値 28 28 29 29 // Line highlighterの位置がずれるので桁数に応じて微調節 -> ずれなくなった? … … 43 43 44 44 // clipboard 45 (function () { 46 if (!window.ClipboardJS) return; 45 ( function () { 46 if ( ! window.ClipboardJS ) return; 47 if ( ! window.hcbVars?.showCopyBtn ) return; 47 48 48 49 let clipCt = 1; 49 50 50 51 // hcb_wrap 51 const hcbWraps = document.querySelectorAll( '.hcb_wrap');52 const hcbWraps = document.querySelectorAll(); 52 53 // 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; 57 58 58 59 // ボタン生成 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 || '' ); 63 65 // button.innerHTML = `コピー`; 64 elem.prepend( button);66 elem.prepend(); 65 67 66 68 // codeタグにターゲット属性追加 67 code.setAttribute( 'data-hcb-clip', clipCt);69 code.setAttribute(); 68 70 69 71 clipCt++; 70 72 } 71 const clipboard = new ClipboardJS( '.hcb-clipboard');72 clipboard.on( 'success', function (e) {73 const clipboard = new ClipboardJS(); 74 clipboard.on() { 73 75 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 }); 79 81 // clipboard.on('error', function (e) { 80 82 // alert(e); 81 83 // }); 82 } )();83 } );84 })(); 85 });
Note: See TracChangeset
for help on using the changeset viewer.