Plugin Directory

Changeset 3066625


Ignore:
Timestamp:
04/08/2024 07:26:31 AM (2 years ago)
Author:
vickyagravat
Message:

updated to 2.0.2

Location:
wp-codemirror-block
Files:
597 added
7 edited

Legend:

Unmodified
Added
Removed
  • wp-codemirror-block/trunk/CHANGELOG.txt

    r3057639 r3066625  
     1= 2.0.2 =
     2* Fix: [Everything is duplicated](https://wordpress.org/support/topic/everything-is-duplicated) code block rendered twice bug.
     3
     4= 2.0.1 =
     5* Fix: Minor bug
     6
    17= 2.0.0 =
    28* Fix: Cross-Site Scripting issue. See it on [GitHub Advisory](https://github.com/advisories/GHSA-f949-cfvp-v3rg) or [Wordfence report](https://www.wordfence.com/threat-intel/vulnerabilities/id/52569aac-1e9e-40fb-9ff4-5eeb7940375d?source=cve)
  • wp-codemirror-block/trunk/build/block.json

    r3057639 r3066625  
    6969  "editorStyle": "file:./index.css",
    7070  "style": "file:./style-index.css",
    71   "script": "file:./autoload.js",
    72   "viewScript": "file:./view.js"
     71  "script": [
     72    "file:./autoload.js",
     73    "file:./view.js"
     74  ]
    7375}
  • wp-codemirror-block/trunk/build/view.asset.php

    r3057639 r3066625  
    1 <?php return array('dependencies' => array(), 'version' => 'd28aa58cd214c6dbbc48');
     1<?php return array('dependencies' => array(), 'version' => '273056f75bf73b6f2d72');
  • wp-codemirror-block/trunk/build/view.js

    r3057639 r3066625  
    1 void 0===window.wpcm.editors&&(window.wpcm.editors=[]),function(e,t){"use strict";e.executableModes=[],e.frontEndInitialization=function(){let t=document.querySelectorAll(".code-block > pre.CodeMirror");e.addNotice();for(let o=0;o<t.length;o++){const n=t[o];if(!n.dataset.setting)continue;let i=JSON.parse(n.dataset.setting),s=n.textContent,d="code-block-"+o;n.parentNode.setAttribute("id",o),n.setAttribute("id",d),e.codeMirrorInit(d,s,i,o)}let o=new CustomEvent("wpcm_editors_loaded");document.dispatchEvent(o)},e.codeMirrorInit=function(o,n,i){const s=document.getElementById(o);s.style="display: none";const d=t(s.parentNode,{lineNumbers:i.lineNumbers,lineWrapping:i.lineWrapping,readOnly:i.readOnly,scrollbarStyle:"simple",firstLineNumber:i.firstLineNumber?Math.abs(i.firstLineNumber):1});if(e.editorOptions.maxHeight){let e=d.getWrapperElement();e.classList.add("max-height"),e.style.setProperty("height",i.maxHeight),e.style.setProperty("padding-bottom","2rem")}t.autoLoadTheme(d,i.theme),d.setValue(n),i.disableCopy&&d.setOption("readOnly","nocursor"),d.setOption("mode",i.mime),d.setOption("theme",i.theme),i.styleActiveLine&&(d.on("blur",(e=>{d.setOption("styleActiveLine",!1)})),d.on("focus",(e=>{d.setOption("styleActiveLine",i.styleActiveLine)}))),t.autoLoadMode(d,i.mode),!0===i.showPanel&&e.panelOptions.showPanel&&(d.getWrapperElement().querySelector(".CodeMirror-simplescroll-vertical"),e.addPanel(d,i)),e.executableModes.includes(i.mode)&&e.renderOutputBlock(s),e.editors.push(d);let c=new CustomEvent("wpcm_editor_loaded",{detail:d});document.dispatchEvent(c)},e.addNotice=function(){const e=document.createElement("div");e.className="CodeMirror-notice",document.body.appendChild(e)},e.showNotice=function(e,t){const o=document.querySelector(".CodeMirror-notice");o.innerHTML=e,o.setAttribute("style","bottom: 15px"),setTimeout((()=>{o.removeAttribute("style")}),3e3)},e.addPanel=function(t,o){const n=document.createElement("div"),i=document.createElement("div"),s=document.createElement("div"),d=document.createElement("span"),c=t.getWrapperElement();if(n.className="CodeMirror-panel",i.className="info-panel",e.editorOptions.maxHeight&&i.classList.add("max-height"),s.className="control-panel","no"!==o.languageLabel&&(d.textContent=o?.fileName?o.fileName:o.language,d.className="language "+o.modeName.toLowerCase()),i.appendChild(d),window.wpcm.panelOptions.runButton&&e.executableModes.includes(o.mode)){let t=document.createElement("span"),o=document.createElement("b");t.classList="tool",t.setAttribute("data-tip","Execute Code"),o.className="run-code execute-code",t.onclick=e.executeCode,t.appendChild(o),s.appendChild(t)}if(window.wpcm.panelOptions.fullScreenButton){const t=document.createElement("span"),o=document.createElement("b");t.classList="tool",t.setAttribute("data-tip","Full Screen"),o.className="fullscreen maximize",o.onclick=e.setFullScreen,t.appendChild(o),s.appendChild(t)}if(window.wpcm.panelOptions.copyButton&&!o.disableCopy){const t=document.createElement("span"),o=document.createElement("b");t.classList="tool",t.setAttribute("data-tip","Copy Code"),o.className="copy",o.onclick=e.copyToClipboard,t.appendChild(o),s.appendChild(t)}i.appendChild(s),n.appendChild(i),c.insertBefore(n,c.firstChild)},e.executeCode=function(t){const o=this.closest(".code-block"),n=o.id,i=e.editors[n].getValue(),s=o.querySelector(".output-block-frame");let d=null;s.classList.add("show"),d=s.contentWindow?s.contentWindow:s.contentDocument.document?s.contentDocument.document:s.contentDocument,d.setAttribute("sandbox","allow-scripts"),d.document.open(),d.document.write(i),d.document.close(),window.scrollTo({top:s.offsetTop,left:100,behavior:"smooth"})},e.styleOutputBlock=function(e){let t=e.target,o=null,n=0;t.classList.contains("first-load")?t.classList.remove("first-load"):(o=t.contentWindow?t.contentWindow:t.contentDocument.document?t.contentDocument.document:t.contentDocument,t.setAttribute("style","height:200px"),o.document.body?(n=Math.round(o.document.body.scrollHeight)+25,n>200&&t.setAttribute("style",`height:${n}px`)):t.setAttribute("style","height:70vh"))},e.renderOutputBlock=function(t){const o=document.createElement("iframe");o.setAttribute("sandbox","allow-scripts"),o.classList.add("output-block-frame","first-load"),o.onload=e.styleOutputBlock,o.style.height="100px",o.src="",t.parentNode.append(o)},e.setFullScreen=function(){const t=this,o=t.closest(".code-block").id,n=e.editors[o],i=document.getElementById("wpadminbar"),s=t.closest(".CodeMirror");t.classList.contains("maximize")?(t.classList.remove("maximize"),t.classList.add("restore"),s.classList.add("CodeMirror-fullscreen"),void 0!==i&&null!=i&&t.closest(".CodeMirror").style.setProperty("top",`${i.clientHeight}px`),e.editorOptions.maxHeight&&(s.style.removeProperty("height"),s.style.setProperty("padding-bottom","2rem")),document.documentElement.style.setProperty("overflow","hidden")):(t.classList.remove("restore"),t.classList.add("maximize"),s.classList.remove("CodeMirror-fullscreen"),s.style.removeProperty("top"),document.documentElement.style.removeProperty("overflow"),e.editorOptions.maxHeight?s.style.setProperty("height",e.editorOptions.maxHeight):s.style.removeProperty("padding-bottom")),n.refresh()},e.copyToClipboard=function(){const t=this.closest(".code-block").id,o=e.editors[t].getValue();let n;if(window.clipboardData)window.clipboardData.setData("Text",o);else{const e=document.createElement("textarea");e.className="CodeMirror-ClipBoard",document.body.appendChild(e),e.appendChild(document.createTextNode(o)),e.select();try{n=document.execCommand("copy")?"Copied to clipboard":"Can not copied"}catch(e){n="Oops, unable to copy"}e.remove()}e.showNotice(n,"")}}(window.wpcm,window.CodeMirror),wpcm.frontEndInitialization(),window.addEventListener("load",(function(){console.log("window ready"),setTimeout((()=>{for(let e=0;e<wpcm.editors.length;e++)wpcm.editors[e].refresh()}),1500)}),!1);
     1void 0===window.wpcm.editors&&(window.wpcm.executed=!1,window.wpcm.editors=[]),function(e,t){"use strict";e.executableModes=[],e.frontEndInitialization=function(){let t=document.querySelectorAll(".code-block > pre.CodeMirror");e.addNotice();for(let o=0;o<t.length;o++){const n=t[o];if(!n.dataset.setting)continue;let i=JSON.parse(n.dataset.setting),d=n.textContent,s="code-block-"+o;n.parentNode.setAttribute("id",o),n.setAttribute("id",s),e.codeMirrorInit(s,d,i,o)}let o=new CustomEvent("wpcm_editors_loaded");document.dispatchEvent(o)},e.codeMirrorInit=function(o,n,i){const d=document.getElementById(o);d.style="display: none";const s=t(d.parentNode,{lineNumbers:i.lineNumbers,lineWrapping:i.lineWrapping,readOnly:i.readOnly,scrollbarStyle:"simple",firstLineNumber:i.firstLineNumber?Math.abs(i.firstLineNumber):1});if(e.editorOptions.maxHeight){let e=s.getWrapperElement();e.classList.add("max-height"),e.style.setProperty("height",i.maxHeight),e.style.setProperty("padding-bottom","2rem")}t.autoLoadTheme(s,i.theme),s.setValue(n),i.disableCopy&&s.setOption("readOnly","nocursor"),s.setOption("mode",i.mime),s.setOption("theme",i.theme),i.styleActiveLine&&(s.on("blur",(e=>{s.setOption("styleActiveLine",!1)})),s.on("focus",(e=>{s.setOption("styleActiveLine",i.styleActiveLine)}))),t.autoLoadMode(s,i.mode),!0===i.showPanel&&e.panelOptions.showPanel&&(s.getWrapperElement().querySelector(".CodeMirror-simplescroll-vertical"),e.addPanel(s,i)),e.editors.push(s);let r=new CustomEvent("wpcm_editor_loaded",{detail:s});document.dispatchEvent(r)},e.addNotice=function(){const e=document.createElement("div");e.className="CodeMirror-notice",document.body.appendChild(e)},e.showNotice=function(e,t){const o=document.querySelector(".CodeMirror-notice");o.innerHTML=e,o.setAttribute("style","bottom: 15px"),setTimeout((()=>{o.removeAttribute("style")}),3e3)},e.addPanel=function(t,o){const n=document.createElement("div"),i=document.createElement("div"),d=document.createElement("div"),s=document.createElement("span"),r=t.getWrapperElement();if(n.className="CodeMirror-panel",i.className="info-panel",e.editorOptions.maxHeight&&i.classList.add("max-height"),d.className="control-panel","no"!==o.languageLabel&&(s.textContent=o?.fileName?o.fileName:o.language,s.className="language "+o.modeName.toLowerCase()),i.appendChild(s),window.wpcm.panelOptions.runButton&&e.executableModes.includes(o.mode)){let t=document.createElement("span"),o=document.createElement("b");t.classList="tool",t.setAttribute("data-tip","Execute Code"),o.className="run-code execute-code",t.onclick=e.executeCode,t.appendChild(o),d.appendChild(t)}if(window.wpcm.panelOptions.fullScreenButton){const t=document.createElement("span"),o=document.createElement("b");t.classList="tool",t.setAttribute("data-tip","Full Screen"),o.className="fullscreen maximize",o.onclick=e.setFullScreen,t.appendChild(o),d.appendChild(t)}if(window.wpcm.panelOptions.copyButton&&!o.disableCopy){const t=document.createElement("span"),o=document.createElement("b");t.classList="tool",t.setAttribute("data-tip","Copy Code"),o.className="copy",o.onclick=e.copyToClipboard,t.appendChild(o),d.appendChild(t)}i.appendChild(d),n.appendChild(i),r.insertBefore(n,r.firstChild)},e.setFullScreen=function(){const t=this,o=t.closest(".code-block").id,n=e.editors[o],i=document.getElementById("wpadminbar"),d=t.closest(".CodeMirror");t.classList.contains("maximize")?(t.classList.remove("maximize"),t.classList.add("restore"),d.classList.add("CodeMirror-fullscreen"),void 0!==i&&null!=i&&t.closest(".CodeMirror").style.setProperty("top",`${i.clientHeight}px`),e.editorOptions.maxHeight&&(d.style.removeProperty("height"),d.style.setProperty("padding-bottom","2rem")),document.documentElement.style.setProperty("overflow","hidden")):(t.classList.remove("restore"),t.classList.add("maximize"),d.classList.remove("CodeMirror-fullscreen"),d.style.removeProperty("top"),document.documentElement.style.removeProperty("overflow"),e.editorOptions.maxHeight?d.style.setProperty("height",e.editorOptions.maxHeight):d.style.removeProperty("padding-bottom")),n.refresh()},e.copyToClipboard=function(){const t=this.closest(".code-block").id,o=e.editors[t].getValue();let n;if(window.clipboardData)window.clipboardData.setData("Text",o);else{const e=document.createElement("textarea");e.className="CodeMirror-ClipBoard",document.body.appendChild(e),e.appendChild(document.createTextNode(o)),e.select();try{n=document.execCommand("copy")?"Copied to clipboard":"Can not copied"}catch(e){n="Oops, unable to copy"}e.remove()}e.showNotice(n,"")}}(window.wpcm,window.CodeMirror),!1===window.wpcm.executed&&(window.wpcm.executed=!0,wpcm.frontEndInitialization()),window.addEventListener("load",(function(){console.log("window ready"),setTimeout((()=>{for(let e=0;e<wpcm.editors.length;e++)wpcm.editors[e].refresh()}),1500)}),!1);
  • wp-codemirror-block/trunk/includes/class-codemirror-blocks.php

    r3057710 r3066625  
    148148
    149149    $view_assets = require plugin_dir_path(CODEMIRROR_BLOCKS_PLUGIN) . '/build/view.asset.php';
    150     wp_enqueue_script(
     150    wp_register_script(
    151151      'codemirror-view',
    152152      plugin_dir_url(CODEMIRROR_BLOCKS_PLUGIN) . 'build/view.js',
     
    196196      return;
    197197    }
    198 
    199     $suffix = self::$suffix;
    200198
    201199    $regex = "#wp-block-codemirror-blocks#";
  • wp-codemirror-block/trunk/index.php

    r3057639 r3066625  
    77 * Requires at least: 6.0
    88 * Requires PHP:      7.0
    9  * Version:                     2.0.1
     9 * Version:                     2.0.2
    1010 * Author:                  Vicky Agravat
    1111 * Author URI:              https://profiles.wordpress.org/vickyagravat
  • wp-codemirror-block/trunk/readme.txt

    r3057639 r3066625  
    44Tags: syntax highlighter, codemirror, gutenberg, editor
    55Requires at least: 6.0
    6 Tested up to: 6.4
    7 Stable tag: 2.0.1
     6Tested up to: 6.5
     7Stable tag: 2.0.2
    88Requires PHP: 7.0
    99License: GPLv2 or later
     
    174174== Changelog ==
    175175
     176= 2.0.2 =
     177* Fix: [Everything is duplicated](https://wordpress.org/support/topic/everything-is-duplicated) code block rendered twice bug.
     178
     179= 2.0.1 =
     180* Fix: Minor bug
     181
    176182= 2.0.0 =
    177183* Fix: Cross-Site Scripting issue. See it on [GitHub Advisory](https://github.com/advisories/GHSA-f949-cfvp-v3rg) or [Wordfence](https://www.wordfence.com/threat-intel/vulnerabilities/id/52569aac-1e9e-40fb-9ff4-5eeb7940375d?source=cve)
Note: See TracChangeset for help on using the changeset viewer.