Version Description
Download this release
Release Info
Developer | youknowriad |
Plugin | Gutenberg |
Version | 4.6.1 |
Comparing to | |
See all releases |
Code changes from version 4.6.0 to 4.6.1
build/block-serialization-default-parser/index.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
this.wp=this.wp||{},this.wp.blockSerializationDefaultParser=function(n){var t={};function r(e){if(t[e])return t[e].exports;var u=t[e]={i:e,l:!1,exports:{}};return n[e].call(u.exports,u,u.exports,r),u.l=!0,u.exports}return r.m=n,r.c=t,r.d=function(n,t,e){r.o(n,t)||Object.defineProperty(n,t,{configurable:!1,enumerable:!0,get:e})},r.r=function(n){Object.defineProperty(n,"__esModule",{value:!0})},r.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(t,"a",t),t},r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.p="",r(r.s=339)}({25:function(n,t,r){"use strict";var e=r(35);var u=r(34);function o(n,t){return Object(e.a)(n)||function(n,t){var r=[],e=!0,u=!1,o=void 0;try{for(var i,c=n[Symbol.iterator]();!(e=(i=c.next()).done)&&(r.push(i.value),!t||r.length!==t);e=!0);}catch(n){u=!0,o=n}finally{try{e||null==c.return||c.return()}finally{if(u)throw o}}return r}(n,t)||Object(u.a)()}r.d(t,"a",function(){return o})},339:function(n,t,r){"use strict";r.r(t),r.d(t,"parse",function(){return f});var e,u,o,i,c=r(25),s=/<!--\s+(\/)?wp:([a-z][a-z0-9_-]*\/)?([a-z][a-z0-9_-]*)\s+({(?:[^}]+|}+(?=})|(?!}\s
|
1 |
+
this.wp=this.wp||{},this.wp.blockSerializationDefaultParser=function(n){var t={};function r(e){if(t[e])return t[e].exports;var u=t[e]={i:e,l:!1,exports:{}};return n[e].call(u.exports,u,u.exports,r),u.l=!0,u.exports}return r.m=n,r.c=t,r.d=function(n,t,e){r.o(n,t)||Object.defineProperty(n,t,{configurable:!1,enumerable:!0,get:e})},r.r=function(n){Object.defineProperty(n,"__esModule",{value:!0})},r.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(t,"a",t),t},r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.p="",r(r.s=339)}({25:function(n,t,r){"use strict";var e=r(35);var u=r(34);function o(n,t){return Object(e.a)(n)||function(n,t){var r=[],e=!0,u=!1,o=void 0;try{for(var i,c=n[Symbol.iterator]();!(e=(i=c.next()).done)&&(r.push(i.value),!t||r.length!==t);e=!0);}catch(n){u=!0,o=n}finally{try{e||null==c.return||c.return()}finally{if(u)throw o}}return r}(n,t)||Object(u.a)()}r.d(t,"a",function(){return o})},339:function(n,t,r){"use strict";r.r(t),r.d(t,"parse",function(){return f});var e,u,o,i,c=r(25),s=/<!--\s+(\/)?wp:([a-z][a-z0-9_-]*\/)?([a-z][a-z0-9_-]*)\s+({(?:(?=([^}]+|}+(?=})|(?!}\s+\/?-->)[^])*)\5|[^]*?)}\s+)?(\/)?-->/g;function l(n,t,r,e,u){return{blockName:n,attrs:t,innerBlocks:r,innerHTML:e,innerContent:u}}function a(n){return l(null,{},[],n,[n])}var f=function(n){e=n,u=0,o=[],i=[],s.lastIndex=0;do{}while(p());return o};function p(){var n=function(){var n=s.exec(e);if(null===n)return["no-more-tokens"];var t=n.index,r=Object(c.a)(n,7),u=r[0],o=r[1],i=r[2],l=r[3],a=r[4],f=r[6],p=u.length,b=!!o,v=!!f,h=(i||"core/")+l,k=!!a,d=k?function(n){try{return JSON.parse(n)}catch(n){return null}}(a):{};if(v)return["void-block",h,d,t,p];if(b)return["block-closer",h,null,t,p];return["block-opener",h,d,t,p]}(),t=Object(c.a)(n,5),r=t[0],f=t[1],p=t[2],k=t[3],d=t[4],O=i.length,g=k>u?u:null;switch(r){case"no-more-tokens":if(0===O)return b(),!1;if(1===O)return h(),!1;for(;0<i.length;)h();return!1;case"void-block":return 0===O?(null!==g&&o.push(a(e.substr(g,k-g))),o.push(l(f,p,[],"",[])),u=k+d,!0):(v(l(f,p,[],"",[]),k,d),u=k+d,!0);case"block-opener":return i.push(function(n,t,r,e,u){return{block:n,tokenStart:t,tokenLength:r,prevOffset:e||t+r,leadingHtmlStart:u}}(l(f,p,[],"",[]),k,d,k+d,g)),u=k+d,!0;case"block-closer":if(0===O)return b(),!1;if(1===O)return h(k),u=k+d,!0;var y=i.pop(),w=e.substr(y.prevOffset,k-y.prevOffset);return y.block.innerHTML+=w,y.block.innerContent.push(w),y.prevOffset=k+d,v(y.block,y.tokenStart,y.tokenLength,k+d),u=k+d,!0;default:return b(),!1}}function b(n){var t=n||e.length-u;0!==t&&o.push(a(e.substr(u,t)))}function v(n,t,r,u){var o=i[i.length-1];o.block.innerBlocks.push(n);var c=e.substr(o.prevOffset,t-o.prevOffset);c&&(o.block.innerHTML+=c,o.block.innerContent.push(c)),o.block.innerContent.push(null),o.prevOffset=u||t+r}function h(n){var t=i.pop(),r=t.block,u=t.leadingHtmlStart,c=t.prevOffset,s=t.tokenStart,l=n?e.substr(c,n-c):e.substr(c);l&&(r.innerHTML+=l,r.innerContent.push(l)),null!==u&&o.push(a(e.substr(u,s-u))),o.push(r)}},34:function(n,t,r){"use strict";function e(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}r.d(t,"a",function(){return e})},35:function(n,t,r){"use strict";function e(n){if(Array.isArray(n))return n}r.d(t,"a",function(){return e})}});
|
build/block-serialization-spec-parser/index.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
this.wp=this.wp||{},this.wp.blockSerializationSpecParser=function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=196)}({182:function(e,t,r){var o,n,c;n=[],void 0===(c="function"==typeof(o=function(){"use strict";function e(t,r,o,n){this.message=t,this.expected=r,this.found=o,this.location=n,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,e)}return function(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}(e,Error),e.buildMessage=function(e,t){var r={literal:function(e){return'"'+n(e.text)+'"'},class:function(e){var t,r="";for(t=0;t<e.parts.length;t++)r+=e.parts[t]instanceof Array?c(e.parts[t][0])+"-"+c(e.parts[t][1]):c(e.parts[t]);return"["+(e.inverted?"^":"")+r+"]"},any:function(e){return"any character"},end:function(e){return"end of input"},other:function(e){return e.description}};function o(e){return e.charCodeAt(0).toString(16).toUpperCase()}function n(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(e){return"\\x0"+o(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return"\\x"+o(e)})}function c(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(e){return"\\x0"+o(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return"\\x"+o(e)})}function p(e){return r[e.type](e)}return"Expected "+function(e){var t,r,o=new Array(e.length);for(t=0;t<e.length;t++)o[t]=p(e[t]);if(o.sort(),o.length>0){for(t=1,r=1;t<o.length;t++)o[t-1]!==o[t]&&(o[r]=o[t],r++);o.length=r}switch(o.length){case 1:return o[0];case 2:return o[0]+" or "+o[1];default:return o.slice(0,-1).join(", ")+", or "+o[o.length-1]}}(e)+" but "+function(e){return e?'"'+n(e)+'"':"end of input"}(t)+" found."},{SyntaxError:e,parse:function(t,r){r=void 0!==r?r:{};var o,n={},c={Block_List:Z},p=Z,a={type:"any"},i=function(e,t,r){return[t,r]},l=function(e,t,r){return function(e,t,r){var o,n,c,p,a,i=[];for(e.length&&i.push(pe(e)),o=0,n=t.length;o<n;o++)p=t[o],a=p[0],c=p[1],i.push(a),c.length&&i.push(pe(c));return r.length&&i.push(pe(r)),i}(e,t,r)},x="\x3c!--",s=G("\x3c!--",!1),u="wp:",b=G("wp:",!1),f=function(e,t){return t},k="/--\x3e",v=G("/--\x3e",!1),h=function(e,t){return{blockName:e,attrs:t||{},innerBlocks:[],innerHTML:"",innerContent:[]}},w=function(e,t,r){var o=function(e){var t,r,o,n="",c=[],p=[];for(t=0,r=e.length;t<r;t++)"string"==typeof(o=e[t])?(n+=o,p.push(o)):(c.push(o),p.push(null));return[n,c,p]}(t),n=o[0],c=o[1],p=o[2];return{blockName:e.blockName,attrs:e.attrs,innerBlocks:c,innerHTML:n,innerContent:p}},y="--\x3e",d=G("--\x3e",!1),g=function(e,t){return{blockName:e,attrs:t||{}}},m="/wp:",H=G("/wp:",!1),A=function(e){return{blockName:e}},P="/",C=G("/",!1),N=function(e){return"core/"+e},B=/^[a-z]/,T=K([["a","z"]],!1,!1),L=/^[a-z0-9_\-]/,M=K([["a","z"],["0","9"],"_","-"],!1,!1),E=Q("JSON-encoded attributes embedded in a block's opening comment"),S="{",j=G("{",!1),q="}",F=G("}",!1),O="",_=function(e){return function(e){try{return JSON.parse(e)}catch(e){return null}}(e)},z=/^[ \t\r\n]/,R=K([" ","\t","\r","\n"],!1,!1),J=0,I=[{line:1,column:1}],U=0,$=[],D=0;if("startRule"in r){if(!(r.startRule in c))throw new Error("Can't start parsing from rule \""+r.startRule+'".');p=c[r.startRule]}function G(e,t){return{type:"literal",text:e,ignoreCase:t}}function K(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function Q(e){return{type:"other",description:e}}function V(e){var r,o=I[e];if(o)return o;for(r=e-1;!I[r];)r--;for(o={line:(o=I[r]).line,column:o.column};r<e;)10===t.charCodeAt(r)?(o.line++,o.column=1):o.column++,r++;return I[e]=o,o}function W(e,t){var r=V(e),o=V(t);return{start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:o.line,column:o.column}}}function X(e){J<U||(J>U&&(U=J,$=[]),$.push(e))}function Y(t,r,o){return new e(e.buildMessage(t,r),t,r,o)}function Z(){var e,r,o,c,p,x,s,u,b,f;for(e=J,r=J,o=[],c=J,p=J,D++,x=ee(),D--,x===n?p=void 0:(J=p,p=n),p!==n?(t.length>J?(x=t.charAt(J),J++):(x=n,0===D&&X(a)),x!==n?c=p=[p,x]:(J=c,c=n)):(J=c,c=n);c!==n;)o.push(c),c=J,p=J,D++,x=ee(),D--,x===n?p=void 0:(J=p,p=n),p!==n?(t.length>J?(x=t.charAt(J),J++):(x=n,0===D&&X(a)),x!==n?c=p=[p,x]:(J=c,c=n)):(J=c,c=n);if((r=o!==n?t.substring(r,J):o)!==n){if(o=[],c=J,(p=ee())!==n){for(x=J,s=[],u=J,b=J,D++,f=ee(),D--,f===n?b=void 0:(J=b,b=n),b!==n?(t.length>J?(f=t.charAt(J),J++):(f=n,0===D&&X(a)),f!==n?u=b=[b,f]:(J=u,u=n)):(J=u,u=n);u!==n;)s.push(u),u=J,b=J,D++,f=ee(),D--,f===n?b=void 0:(J=b,b=n),b!==n?(t.length>J?(f=t.charAt(J),J++):(f=n,0===D&&X(a)),f!==n?u=b=[b,f]:(J=u,u=n)):(J=u,u=n);(x=s!==n?t.substring(x,J):s)!==n?(p=i(r,p,x),c=p):(J=c,c=n)}else J=c,c=n;for(;c!==n;)if(o.push(c),c=J,(p=ee())!==n){for(x=J,s=[],u=J,b=J,D++,f=ee(),D--,f===n?b=void 0:(J=b,b=n),b!==n?(t.length>J?(f=t.charAt(J),J++):(f=n,0===D&&X(a)),f!==n?u=b=[b,f]:(J=u,u=n)):(J=u,u=n);u!==n;)s.push(u),u=J,b=J,D++,f=ee(),D--,f===n?b=void 0:(J=b,b=n),b!==n?(t.length>J?(f=t.charAt(J),J++):(f=n,0===D&&X(a)),f!==n?u=b=[b,f]:(J=u,u=n)):(J=u,u=n);(x=s!==n?t.substring(x,J):s)!==n?(p=i(r,p,x),c=p):(J=c,c=n)}else J=c,c=n;if(o!==n){for(c=J,p=[],t.length>J?(x=t.charAt(J),J++):(x=n,0===D&&X(a));x!==n;)p.push(x),t.length>J?(x=t.charAt(J),J++):(x=n,0===D&&X(a));(c=p!==n?t.substring(c,J):p)!==n?(r=l(r,o,c),e=r):(J=e,e=n)}else J=e,e=n}else J=e,e=n;return e}function ee(){var e;return(e=function(){var e,r,o,c,p,a;return e=J,t.substr(J,4)===x?(r=x,J+=4):(r=n,0===D&&X(s)),r!==n&&ce()!==n?(t.substr(J,3)===u?(o=u,J+=3):(o=n,0===D&&X(b)),o!==n&&(c=re())!==n&&ce()!==n?(p=J,(a=ne())!==n&&ce()!==n?(a=f(c,a),p=a):(J=p,p=n),p===n&&(p=null),p!==n?(t.substr(J,4)===k?(a=k,J+=4):(a=n,0===D&&X(v)),a!==n?(r=h(c,p),e=r):(J=e,e=n)):(J=e,e=n)):(J=e,e=n)):(J=e,e=n),e}())===n&&(e=function(){var e,r,o,c,p,i,l,k,v;if(e=J,(r=function(){var e,r,o,c,p,a;return e=J,t.substr(J,4)===x?(r=x,J+=4):(r=n,0===D&&X(s)),r!==n&&ce()!==n?(t.substr(J,3)===u?(o=u,J+=3):(o=n,0===D&&X(b)),o!==n&&(c=re())!==n&&ce()!==n?(p=J,(a=ne())!==n&&ce()!==n?(a=f(c,a),p=a):(J=p,p=n),p===n&&(p=null),p!==n?(t.substr(J,3)===y?(a=y,J+=3):(a=n,0===D&&X(d)),a!==n?(r=g(c,p),e=r):(J=e,e=n)):(J=e,e=n)):(J=e,e=n)):(J=e,e=n),e}())!==n){if(o=[],(c=ee())===n){if(c=J,p=[],i=J,l=J,D++,k=ee(),D--,k===n?l=void 0:(J=l,l=n),l!==n?(k=J,D++,v=te(),D--,v===n?k=void 0:(J=k,k=n),k!==n?(t.length>J?(v=t.charAt(J),J++):(v=n,0===D&&X(a)),v!==n?i=l=[l,k,v]:(J=i,i=n)):(J=i,i=n)):(J=i,i=n),i!==n)for(;i!==n;)p.push(i),i=J,l=J,D++,k=ee(),D--,k===n?l=void 0:(J=l,l=n),l!==n?(k=J,D++,v=te(),D--,v===n?k=void 0:(J=k,k=n),k!==n?(t.length>J?(v=t.charAt(J),J++):(v=n,0===D&&X(a)),v!==n?i=l=[l,k,v]:(J=i,i=n)):(J=i,i=n)):(J=i,i=n);else p=n;c=p!==n?t.substring(c,J):p}for(;c!==n;)if(o.push(c),(c=ee())===n){if(c=J,p=[],i=J,l=J,D++,k=ee(),D--,k===n?l=void 0:(J=l,l=n),l!==n?(k=J,D++,v=te(),D--,v===n?k=void 0:(J=k,k=n),k!==n?(t.length>J?(v=t.charAt(J),J++):(v=n,0===D&&X(a)),v!==n?i=l=[l,k,v]:(J=i,i=n)):(J=i,i=n)):(J=i,i=n),i!==n)for(;i!==n;)p.push(i),i=J,l=J,D++,k=ee(),D--,k===n?l=void 0:(J=l,l=n),l!==n?(k=J,D++,v=te(),D--,v===n?k=void 0:(J=k,k=n),k!==n?(t.length>J?(v=t.charAt(J),J++):(v=n,0===D&&X(a)),v!==n?i=l=[l,k,v]:(J=i,i=n)):(J=i,i=n)):(J=i,i=n);else p=n;c=p!==n?t.substring(c,J):p}o!==n&&(c=te())!==n?(r=w(r,o,c),e=r):(J=e,e=n)}else J=e,e=n;return e}()),e}function te(){var e,r,o,c,p;return e=J,t.substr(J,4)===x?(r=x,J+=4):(r=n,0===D&&X(s)),r!==n&&ce()!==n?(t.substr(J,4)===m?(o=m,J+=4):(o=n,0===D&&X(H)),o!==n&&(c=re())!==n&&ce()!==n?(t.substr(J,3)===y?(p=y,J+=3):(p=n,0===D&&X(d)),p!==n?(r=A(c),e=r):(J=e,e=n)):(J=e,e=n)):(J=e,e=n),e}function re(){var e;return(e=function(){var e,r,o,c,p;return e=J,r=J,(o=oe())!==n?(47===t.charCodeAt(J)?(c=P,J++):(c=n,0===D&&X(C)),c!==n&&(p=oe())!==n?r=o=[o,c,p]:(J=r,r=n)):(J=r,r=n),e=r!==n?t.substring(e,J):r}())===n&&(e=function(){var e,r;return e=J,(e=(r=oe())!==n?t.substring(e,J):r)!==n&&(e=N(e)),e}()),e}function oe(){var e,r,o,c,p;if(e=J,r=J,B.test(t.charAt(J))?(o=t.charAt(J),J++):(o=n,0===D&&X(T)),o!==n){for(c=[],L.test(t.charAt(J))?(p=t.charAt(J),J++):(p=n,0===D&&X(M));p!==n;)c.push(p),L.test(t.charAt(J))?(p=t.charAt(J),J++):(p=n,0===D&&X(M));c!==n?r=o=[o,c]:(J=r,r=n)}else J=r,r=n;return e=r!==n?t.substring(e,J):r}function ne(){var e,r,o,c,p,i,l,x,s,u,b,f,k;if(D++,e=J,r=J,o=J,123===t.charCodeAt(J)?(c=S,J++):(c=n,0===D&&X(j)),c!==n){for(p=[],i=J,l=J,D++,x=J,125===t.charCodeAt(J)?(s=q,J++):(s=n,0===D&&X(F)),s!==n&&(u=ce())!==n&&(b=O)!==n?(47===t.charCodeAt(J)?(f=P,J++):(f=n,0===D&&X(C)),f===n&&(f=null),f!==n?(t.substr(J,3)===y?(k=y,J+=3):(k=n,0===D&&X(d)),k!==n?x=s=[s,u,b,f,k]:(J=x,x=n)):(J=x,x=n)):(J=x,x=n),D--,x===n?l=void 0:(J=l,l=n),l!==n?(t.length>J?(x=t.charAt(J),J++):(x=n,0===D&&X(a)),x!==n?i=l=[l,x]:(J=i,i=n)):(J=i,i=n);i!==n;)p.push(i),i=J,l=J,D++,x=J,125===t.charCodeAt(J)?(s=q,J++):(s=n,0===D&&X(F)),s!==n&&(u=ce())!==n&&(b=O)!==n?(47===t.charCodeAt(J)?(f=P,J++):(f=n,0===D&&X(C)),f===n&&(f=null),f!==n?(t.substr(J,3)===y?(k=y,J+=3):(k=n,0===D&&X(d)),k!==n?x=s=[s,u,b,f,k]:(J=x,x=n)):(J=x,x=n)):(J=x,x=n),D--,x===n?l=void 0:(J=l,l=n),l!==n?(t.length>J?(x=t.charAt(J),J++):(x=n,0===D&&X(a)),x!==n?i=l=[l,x]:(J=i,i=n)):(J=i,i=n);p!==n?(125===t.charCodeAt(J)?(i=q,J++):(i=n,0===D&&X(F)),i!==n?o=c=[c,p,i]:(J=o,o=n)):(J=o,o=n)}else J=o,o=n;return(r=o!==n?t.substring(r,J):o)!==n&&(r=_(r)),D--,(e=r)===n&&(r=n,0===D&&X(E)),e}function ce(){var e,r;if(e=[],z.test(t.charAt(J))?(r=t.charAt(J),J++):(r=n,0===D&&X(R)),r!==n)for(;r!==n;)e.push(r),z.test(t.charAt(J))?(r=t.charAt(J),J++):(r=n,0===D&&X(R));else e=n;return e}function pe(e){return e.length&&{blockName:null,attrs:{},innerBlocks:[],innerHTML:e,innerContent:[e]}}if((o=p())!==n&&J===t.length)return o;throw o!==n&&J<t.length&&X({type:"end"}),Y($,U<t.length?t.charAt(U):null,U<t.length?W(U,U+1):W(U,U))}}})?o.apply(t,n):o)||(e.exports=c)},196:function(e,t,r){"use strict";r.r(t);var o=r(182);const n=e=>()=>{describe("output structure",()=>{test("output is an array",()=>{expect(e("")).toEqual(expect.any(Array)),expect(e("test")).toEqual(expect.any(Array)),expect(e("\x3c!-- wp:void /--\x3e")).toEqual(expect.any(Array)),expect(e("\x3c!-- wp:block --\x3e\x3c!-- wp:inner /--\x3e\x3c!-- /wp:block --\x3e")).toEqual(expect.any(Array)),expect(e("\x3c!-- wp:first /--\x3e\x3c!-- wp:second /--\x3e")).toEqual(expect.any(Array))}),test("parses blocks of various types",()=>{expect(e("\x3c!-- wp:void /--\x3e")[0]).toHaveProperty("blockName","core/void"),expect(e("\x3c!-- wp:void {} /--\x3e")[0]).toHaveProperty("blockName","core/void"),expect(e('\x3c!-- wp:void {"value":true} /--\x3e')[0]).toHaveProperty("blockName","core/void"),expect(e('\x3c!-- wp:void {"a":{}} /--\x3e')[0]).toHaveProperty("blockName","core/void"),expect(e('\x3c!-- wp:void { "value" : true } /--\x3e')[0]).toHaveProperty("blockName","core/void"),expect(e('\x3c!-- wp:void {\n\t"value" : true\n} /--\x3e')[0]).toHaveProperty("blockName","core/void"),expect(e("\x3c!-- wp:block --\x3e\x3c!-- /wp:block --\x3e")[0]).toHaveProperty("blockName","core/block"),expect(e("\x3c!-- wp:block {} --\x3e\x3c!-- /wp:block --\x3e")[0]).toHaveProperty("blockName","core/block"),expect(e('\x3c!-- wp:block {"value":true} --\x3e\x3c!-- /wp:block --\x3e')[0]).toHaveProperty("blockName","core/block"),expect(e("\x3c!-- wp:block {} --\x3einner\x3c!-- /wp:block --\x3e")[0]).toHaveProperty("blockName","core/block"),expect(e('\x3c!-- wp:block {"value":{"a" : "true"}} --\x3einner\x3c!-- /wp:block --\x3e')[0]).toHaveProperty("blockName","core/block")}),test("blockName is namespaced string (except freeform)",()=>{expect(e("freeform has null name")[0]).toHaveProperty("blockName",null),expect(e("\x3c!-- wp:more /--\x3e")[0]).toHaveProperty("blockName","core/more"),expect(e("\x3c!-- wp:core/more /--\x3e")[0]).toHaveProperty("blockName","core/more"),expect(e("\x3c!-- wp:my/more /--\x3e")[0]).toHaveProperty("blockName","my/more")}),test("JSON attributes are key/value object",()=>{expect(e("freeform has empty attrs")[0]).toHaveProperty("attrs",{}),expect(e("\x3c!-- wp:void /--\x3e")[0]).toHaveProperty("attrs",{}),expect(e("\x3c!-- wp:void {} /--\x3e")[0]).toHaveProperty("blockName","core/void"),expect(e("\x3c!-- wp:void {} /--\x3e")[0]).toHaveProperty("attrs",{}),expect(e('\x3c!-- wp:void {"key": "value"} /--\x3e')[0]).toHaveProperty("attrs",{key:"value"}),expect(e("\x3c!-- wp:block --\x3e\x3c!-- /wp:block --\x3e")[0]).toHaveProperty("attrs",{}),expect(e("\x3c!-- wp:block {} --\x3e\x3c!-- /wp:block --\x3e")[0]).toHaveProperty("attrs",{}),expect(e('\x3c!-- wp:block {"key": "value"} --\x3e\x3c!-- /wp:block --\x3e')[0]).toHaveProperty("attrs",{key:"value"})}),test("innerBlocks is a list",()=>{expect(e("freeform has empty innerBlocks")[0]).toHaveProperty("innerBlocks",[]),expect(e("\x3c!-- wp:void /--\x3e")[0]).toHaveProperty("innerBlocks",[]),expect(e("\x3c!-- wp:block --\x3e\x3c!-- /wp:block --\x3e")[0]).toHaveProperty("innerBlocks",[]);const t=e("\x3c!-- wp:block --\x3e\x3c!-- wp:inner /--\x3e\x3c!-- /wp:block --\x3e")[0];expect(t).toHaveProperty("innerBlocks",expect.any(Array)),expect(t.innerBlocks).toHaveLength(1);const r=e("\x3c!-- wp:block --\x3ea\x3c!-- wp:first /--\x3eb\x3c!-- wp:second /--\x3ec\x3c!-- /wp:block --\x3e")[0];expect(r).toHaveProperty("innerBlocks",expect.any(Array)),expect(r.innerBlocks).toHaveLength(2)}),test("innerHTML is a string",()=>{expect(e("test")[0]).toHaveProperty("innerHTML",expect.any(String)),expect(e("\x3c!-- wp:test /--\x3e")[0]).toHaveProperty("innerHTML",expect.any(String)),expect(e("\x3c!-- wp:test --\x3e\x3c!-- /wp:test --\x3e")[0]).toHaveProperty("innerHTML",expect.any(String)),expect(e("\x3c!-- wp:test --\x3etest\x3c!-- /wp:test --\x3e")[0]).toHaveProperty("innerHTML",expect.any(String))})}),describe("generic tests",()=>{test("parse() accepts inputs with multiple Reusable blocks",()=>{expect(e('\x3c!-- wp:block {"ref":313} /--\x3e\x3c!-- wp:block {"ref":482} /--\x3e')).toEqual([expect.objectContaining({blockName:"core/block",attrs:{ref:313}}),expect.objectContaining({blockName:"core/block",attrs:{ref:482}})])}),test("treats void blocks and empty blocks identically",()=>{expect(e("\x3c!-- wp:block /--\x3e")).toEqual(e("\x3c!-- wp:block --\x3e\x3c!-- /wp:block --\x3e")),expect(e('\x3c!-- wp:my/bus { "is": "fast" } /--\x3e')).toEqual(e('\x3c!-- wp:my/bus { "is": "fast" } --\x3e\x3c!-- /wp:my/bus --\x3e'))}),test("should grab HTML soup before block openers",()=>{["<p>Break me</p>\x3c!-- wp:block /--\x3e","<p>Break me</p>\x3c!-- wp:block --\x3e\x3c!-- /wp:block --\x3e"].forEach(t=>expect(e(t)).toEqual([expect.objectContaining({innerHTML:"<p>Break me</p>"}),expect.objectContaining({blockName:"core/block",innerHTML:""})]))}),test("should grab HTML soup before inner block openers",()=>["\x3c!-- wp:outer --\x3e<p>Break me</p>\x3c!-- wp:block /--\x3e\x3c!-- /wp:outer --\x3e","\x3c!-- wp:outer --\x3e<p>Break me</p>\x3c!-- wp:block --\x3e\x3c!-- /wp:block --\x3e\x3c!-- /wp:outer --\x3e"].forEach(t=>expect(e(t)).toEqual([expect.objectContaining({innerBlocks:[expect.objectContaining({blockName:"core/block",innerHTML:""})],innerHTML:"<p>Break me</p>"})]))),test("should grab HTML soup after blocks",()=>["\x3c!-- wp:block /--\x3e<p>Break me</p>","\x3c!-- wp:block --\x3e\x3c!-- /wp:block --\x3e<p>Break me</p>"].forEach(t=>expect(e(t)).toEqual([expect.objectContaining({blockName:"core/block",innerHTML:""}),expect.objectContaining({innerHTML:"<p>Break me</p>"})])))}),describe("innerBlock placemarkers",()=>{test("innerContent exists",()=>{expect(e("test")[0]).toHaveProperty("innerContent",["test"]),expect(e("\x3c!-- wp:void /--\x3e")[0]).toHaveProperty("innerContent",[])}),test("innerContent contains innerHTML",()=>{expect(e("\x3c!-- wp:block --\x3eInner\x3c!-- /wp:block --\x3e")[0]).toHaveProperty("innerContent",["Inner"])}),test("block locations become null",()=>{expect(e("\x3c!-- wp:block --\x3e\x3c!-- wp:void /--\x3e\x3c!-- /wp:block --\x3e")[0]).toHaveProperty("innerContent",[null])}),test("HTML soup appears after blocks",()=>{expect(e("\x3c!-- wp:block --\x3e\x3c!-- wp:void /--\x3eAfter\x3c!-- /wp:block --\x3e")[0]).toHaveProperty("innerContent",[null,"After"])}),test("HTML soup appears before blocks",()=>{expect(e("\x3c!-- wp:block --\x3eBefore\x3c!-- wp:void /--\x3e\x3c!-- /wp:block --\x3e")[0]).toHaveProperty("innerContent",["Before",null])}),test("blocks follow each other",()=>{expect(e("\x3c!-- wp:block --\x3e\x3c!-- wp:void /--\x3e\x3c!-- wp:void /--\x3e\x3c!-- /wp:block --\x3e")[0]).toHaveProperty("innerContent",[null,null])})}),describe("attack vectors",()=>{test("really long JSON attribute sections",()=>{const t="a".repeat(1e5);let r;expect(()=>r=e(`\x3c!-- wp:fake {"a":"${t}"} /--\x3e`)[0]).not.toThrow(),expect(r.attrs.a).toHaveLength(1e5)})})},c=(...e)=>describe.skip(...e),p=(e,t)=>c(e,()=>{});r.d(t,"parse",function(){return o.parse}),r.d(t,"jsTester",function(){return n}),r.d(t,"phpTester",function(){return p})}});
|
1 |
+
this.wp=this.wp||{},this.wp.blockSerializationSpecParser=function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=196)}({182:function(e,t,r){var o,n,c;n=[],void 0===(c="function"==typeof(o=function(){"use strict";function e(t,r,o,n){this.message=t,this.expected=r,this.found=o,this.location=n,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,e)}return function(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}(e,Error),e.buildMessage=function(e,t){var r={literal:function(e){return'"'+n(e.text)+'"'},class:function(e){var t,r="";for(t=0;t<e.parts.length;t++)r+=e.parts[t]instanceof Array?c(e.parts[t][0])+"-"+c(e.parts[t][1]):c(e.parts[t]);return"["+(e.inverted?"^":"")+r+"]"},any:function(e){return"any character"},end:function(e){return"end of input"},other:function(e){return e.description}};function o(e){return e.charCodeAt(0).toString(16).toUpperCase()}function n(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(e){return"\\x0"+o(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return"\\x"+o(e)})}function c(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(e){return"\\x0"+o(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return"\\x"+o(e)})}function p(e){return r[e.type](e)}return"Expected "+function(e){var t,r,o=new Array(e.length);for(t=0;t<e.length;t++)o[t]=p(e[t]);if(o.sort(),o.length>0){for(t=1,r=1;t<o.length;t++)o[t-1]!==o[t]&&(o[r]=o[t],r++);o.length=r}switch(o.length){case 1:return o[0];case 2:return o[0]+" or "+o[1];default:return o.slice(0,-1).join(", ")+", or "+o[o.length-1]}}(e)+" but "+function(e){return e?'"'+n(e)+'"':"end of input"}(t)+" found."},{SyntaxError:e,parse:function(t,r){r=void 0!==r?r:{};var o,n={},c={Block_List:Z},p=Z,a={type:"any"},l=function(e,t,r){return[t,r]},i=function(e,t,r){return function(e,t,r){var o,n,c,p,a,l=[];for(e.length&&l.push(pe(e)),o=0,n=t.length;o<n;o++)p=t[o],a=p[0],c=p[1],l.push(a),c.length&&l.push(pe(c));return r.length&&l.push(pe(r)),l}(e,t,r)},x="\x3c!--",s=G("\x3c!--",!1),u="wp:",b=G("wp:",!1),f=function(e,t){return t},k="/--\x3e",v=G("/--\x3e",!1),h=function(e,t){return{blockName:e,attrs:t||{},innerBlocks:[],innerHTML:"",innerContent:[]}},w=function(e,t,r){var o=function(e){var t,r,o,n="",c=[],p=[];for(t=0,r=e.length;t<r;t++)"string"==typeof(o=e[t])?(n+=o,p.push(o)):(c.push(o),p.push(null));return[n,c,p]}(t),n=o[0],c=o[1],p=o[2];return{blockName:e.blockName,attrs:e.attrs,innerBlocks:c,innerHTML:n,innerContent:p}},d="--\x3e",y=G("--\x3e",!1),g=function(e,t){return{blockName:e,attrs:t||{}}},m="/wp:",H=G("/wp:",!1),A=function(e){return{blockName:e}},P="/",N=G("/",!1),C=function(e){return"core/"+e},B=/^[a-z]/,T=K([["a","z"]],!1,!1),L=/^[a-z0-9_\-]/,M=K([["a","z"],["0","9"],"_","-"],!1,!1),E=Q("JSON-encoded attributes embedded in a block's opening comment"),S="{",j=G("{",!1),q="}",F=G("}",!1),O="",_=function(e){return function(e){try{return JSON.parse(e)}catch(e){return null}}(e)},z=/^[ \t\r\n]/,R=K([" ","\t","\r","\n"],!1,!1),J=0,I=[{line:1,column:1}],U=0,$=[],D=0;if("startRule"in r){if(!(r.startRule in c))throw new Error("Can't start parsing from rule \""+r.startRule+'".');p=c[r.startRule]}function G(e,t){return{type:"literal",text:e,ignoreCase:t}}function K(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function Q(e){return{type:"other",description:e}}function V(e){var r,o=I[e];if(o)return o;for(r=e-1;!I[r];)r--;for(o={line:(o=I[r]).line,column:o.column};r<e;)10===t.charCodeAt(r)?(o.line++,o.column=1):o.column++,r++;return I[e]=o,o}function W(e,t){var r=V(e),o=V(t);return{start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:o.line,column:o.column}}}function X(e){J<U||(J>U&&(U=J,$=[]),$.push(e))}function Y(t,r,o){return new e(e.buildMessage(t,r),t,r,o)}function Z(){var e,r,o,c,p,x,s,u,b,f;for(e=J,r=J,o=[],c=J,p=J,D++,x=ee(),D--,x===n?p=void 0:(J=p,p=n),p!==n?(t.length>J?(x=t.charAt(J),J++):(x=n,0===D&&X(a)),x!==n?c=p=[p,x]:(J=c,c=n)):(J=c,c=n);c!==n;)o.push(c),c=J,p=J,D++,x=ee(),D--,x===n?p=void 0:(J=p,p=n),p!==n?(t.length>J?(x=t.charAt(J),J++):(x=n,0===D&&X(a)),x!==n?c=p=[p,x]:(J=c,c=n)):(J=c,c=n);if((r=o!==n?t.substring(r,J):o)!==n){if(o=[],c=J,(p=ee())!==n){for(x=J,s=[],u=J,b=J,D++,f=ee(),D--,f===n?b=void 0:(J=b,b=n),b!==n?(t.length>J?(f=t.charAt(J),J++):(f=n,0===D&&X(a)),f!==n?u=b=[b,f]:(J=u,u=n)):(J=u,u=n);u!==n;)s.push(u),u=J,b=J,D++,f=ee(),D--,f===n?b=void 0:(J=b,b=n),b!==n?(t.length>J?(f=t.charAt(J),J++):(f=n,0===D&&X(a)),f!==n?u=b=[b,f]:(J=u,u=n)):(J=u,u=n);(x=s!==n?t.substring(x,J):s)!==n?(p=l(r,p,x),c=p):(J=c,c=n)}else J=c,c=n;for(;c!==n;)if(o.push(c),c=J,(p=ee())!==n){for(x=J,s=[],u=J,b=J,D++,f=ee(),D--,f===n?b=void 0:(J=b,b=n),b!==n?(t.length>J?(f=t.charAt(J),J++):(f=n,0===D&&X(a)),f!==n?u=b=[b,f]:(J=u,u=n)):(J=u,u=n);u!==n;)s.push(u),u=J,b=J,D++,f=ee(),D--,f===n?b=void 0:(J=b,b=n),b!==n?(t.length>J?(f=t.charAt(J),J++):(f=n,0===D&&X(a)),f!==n?u=b=[b,f]:(J=u,u=n)):(J=u,u=n);(x=s!==n?t.substring(x,J):s)!==n?(p=l(r,p,x),c=p):(J=c,c=n)}else J=c,c=n;if(o!==n){for(c=J,p=[],t.length>J?(x=t.charAt(J),J++):(x=n,0===D&&X(a));x!==n;)p.push(x),t.length>J?(x=t.charAt(J),J++):(x=n,0===D&&X(a));(c=p!==n?t.substring(c,J):p)!==n?(r=i(r,o,c),e=r):(J=e,e=n)}else J=e,e=n}else J=e,e=n;return e}function ee(){var e;return(e=function(){var e,r,o,c,p,a;return e=J,t.substr(J,4)===x?(r=x,J+=4):(r=n,0===D&&X(s)),r!==n&&ce()!==n?(t.substr(J,3)===u?(o=u,J+=3):(o=n,0===D&&X(b)),o!==n&&(c=re())!==n&&ce()!==n?(p=J,(a=ne())!==n&&ce()!==n?(a=f(c,a),p=a):(J=p,p=n),p===n&&(p=null),p!==n?(t.substr(J,4)===k?(a=k,J+=4):(a=n,0===D&&X(v)),a!==n?(r=h(c,p),e=r):(J=e,e=n)):(J=e,e=n)):(J=e,e=n)):(J=e,e=n),e}())===n&&(e=function(){var e,r,o,c,p,l,i,k,v;if(e=J,(r=function(){var e,r,o,c,p,a;return e=J,t.substr(J,4)===x?(r=x,J+=4):(r=n,0===D&&X(s)),r!==n&&ce()!==n?(t.substr(J,3)===u?(o=u,J+=3):(o=n,0===D&&X(b)),o!==n&&(c=re())!==n&&ce()!==n?(p=J,(a=ne())!==n&&ce()!==n?(a=f(c,a),p=a):(J=p,p=n),p===n&&(p=null),p!==n?(t.substr(J,3)===d?(a=d,J+=3):(a=n,0===D&&X(y)),a!==n?(r=g(c,p),e=r):(J=e,e=n)):(J=e,e=n)):(J=e,e=n)):(J=e,e=n),e}())!==n){if(o=[],(c=ee())===n){if(c=J,p=[],l=J,i=J,D++,k=ee(),D--,k===n?i=void 0:(J=i,i=n),i!==n?(k=J,D++,v=te(),D--,v===n?k=void 0:(J=k,k=n),k!==n?(t.length>J?(v=t.charAt(J),J++):(v=n,0===D&&X(a)),v!==n?l=i=[i,k,v]:(J=l,l=n)):(J=l,l=n)):(J=l,l=n),l!==n)for(;l!==n;)p.push(l),l=J,i=J,D++,k=ee(),D--,k===n?i=void 0:(J=i,i=n),i!==n?(k=J,D++,v=te(),D--,v===n?k=void 0:(J=k,k=n),k!==n?(t.length>J?(v=t.charAt(J),J++):(v=n,0===D&&X(a)),v!==n?l=i=[i,k,v]:(J=l,l=n)):(J=l,l=n)):(J=l,l=n);else p=n;c=p!==n?t.substring(c,J):p}for(;c!==n;)if(o.push(c),(c=ee())===n){if(c=J,p=[],l=J,i=J,D++,k=ee(),D--,k===n?i=void 0:(J=i,i=n),i!==n?(k=J,D++,v=te(),D--,v===n?k=void 0:(J=k,k=n),k!==n?(t.length>J?(v=t.charAt(J),J++):(v=n,0===D&&X(a)),v!==n?l=i=[i,k,v]:(J=l,l=n)):(J=l,l=n)):(J=l,l=n),l!==n)for(;l!==n;)p.push(l),l=J,i=J,D++,k=ee(),D--,k===n?i=void 0:(J=i,i=n),i!==n?(k=J,D++,v=te(),D--,v===n?k=void 0:(J=k,k=n),k!==n?(t.length>J?(v=t.charAt(J),J++):(v=n,0===D&&X(a)),v!==n?l=i=[i,k,v]:(J=l,l=n)):(J=l,l=n)):(J=l,l=n);else p=n;c=p!==n?t.substring(c,J):p}o!==n&&(c=te())!==n?(r=w(r,o,c),e=r):(J=e,e=n)}else J=e,e=n;return e}()),e}function te(){var e,r,o,c,p;return e=J,t.substr(J,4)===x?(r=x,J+=4):(r=n,0===D&&X(s)),r!==n&&ce()!==n?(t.substr(J,4)===m?(o=m,J+=4):(o=n,0===D&&X(H)),o!==n&&(c=re())!==n&&ce()!==n?(t.substr(J,3)===d?(p=d,J+=3):(p=n,0===D&&X(y)),p!==n?(r=A(c),e=r):(J=e,e=n)):(J=e,e=n)):(J=e,e=n),e}function re(){var e;return(e=function(){var e,r,o,c,p;return e=J,r=J,(o=oe())!==n?(47===t.charCodeAt(J)?(c=P,J++):(c=n,0===D&&X(N)),c!==n&&(p=oe())!==n?r=o=[o,c,p]:(J=r,r=n)):(J=r,r=n),e=r!==n?t.substring(e,J):r}())===n&&(e=function(){var e,r;return e=J,(e=(r=oe())!==n?t.substring(e,J):r)!==n&&(e=C(e)),e}()),e}function oe(){var e,r,o,c,p;if(e=J,r=J,B.test(t.charAt(J))?(o=t.charAt(J),J++):(o=n,0===D&&X(T)),o!==n){for(c=[],L.test(t.charAt(J))?(p=t.charAt(J),J++):(p=n,0===D&&X(M));p!==n;)c.push(p),L.test(t.charAt(J))?(p=t.charAt(J),J++):(p=n,0===D&&X(M));c!==n?r=o=[o,c]:(J=r,r=n)}else J=r,r=n;return e=r!==n?t.substring(e,J):r}function ne(){var e,r,o,c,p,l,i,x,s,u,b,f,k;if(D++,e=J,r=J,o=J,123===t.charCodeAt(J)?(c=S,J++):(c=n,0===D&&X(j)),c!==n){for(p=[],l=J,i=J,D++,x=J,125===t.charCodeAt(J)?(s=q,J++):(s=n,0===D&&X(F)),s!==n&&(u=ce())!==n&&(b=O)!==n?(47===t.charCodeAt(J)?(f=P,J++):(f=n,0===D&&X(N)),f===n&&(f=null),f!==n?(t.substr(J,3)===d?(k=d,J+=3):(k=n,0===D&&X(y)),k!==n?x=s=[s,u,b,f,k]:(J=x,x=n)):(J=x,x=n)):(J=x,x=n),D--,x===n?i=void 0:(J=i,i=n),i!==n?(t.length>J?(x=t.charAt(J),J++):(x=n,0===D&&X(a)),x!==n?l=i=[i,x]:(J=l,l=n)):(J=l,l=n);l!==n;)p.push(l),l=J,i=J,D++,x=J,125===t.charCodeAt(J)?(s=q,J++):(s=n,0===D&&X(F)),s!==n&&(u=ce())!==n&&(b=O)!==n?(47===t.charCodeAt(J)?(f=P,J++):(f=n,0===D&&X(N)),f===n&&(f=null),f!==n?(t.substr(J,3)===d?(k=d,J+=3):(k=n,0===D&&X(y)),k!==n?x=s=[s,u,b,f,k]:(J=x,x=n)):(J=x,x=n)):(J=x,x=n),D--,x===n?i=void 0:(J=i,i=n),i!==n?(t.length>J?(x=t.charAt(J),J++):(x=n,0===D&&X(a)),x!==n?l=i=[i,x]:(J=l,l=n)):(J=l,l=n);p!==n?(125===t.charCodeAt(J)?(l=q,J++):(l=n,0===D&&X(F)),l!==n?o=c=[c,p,l]:(J=o,o=n)):(J=o,o=n)}else J=o,o=n;return(r=o!==n?t.substring(r,J):o)!==n&&(r=_(r)),D--,(e=r)===n&&(r=n,0===D&&X(E)),e}function ce(){var e,r;if(e=[],z.test(t.charAt(J))?(r=t.charAt(J),J++):(r=n,0===D&&X(R)),r!==n)for(;r!==n;)e.push(r),z.test(t.charAt(J))?(r=t.charAt(J),J++):(r=n,0===D&&X(R));else e=n;return e}function pe(e){return e.length&&{blockName:null,attrs:{},innerBlocks:[],innerHTML:e,innerContent:[e]}}if((o=p())!==n&&J===t.length)return o;throw o!==n&&J<t.length&&X({type:"end"}),Y($,U<t.length?t.charAt(U):null,U<t.length?W(U,U+1):W(U,U))}}})?o.apply(t,n):o)||(e.exports=c)},196:function(e,t,r){"use strict";r.r(t);var o=r(182);const n=e=>()=>{describe("output structure",()=>{test("output is an array",()=>{expect(e("")).toEqual(expect.any(Array)),expect(e("test")).toEqual(expect.any(Array)),expect(e("\x3c!-- wp:void /--\x3e")).toEqual(expect.any(Array)),expect(e("\x3c!-- wp:block --\x3e\x3c!-- wp:inner /--\x3e\x3c!-- /wp:block --\x3e")).toEqual(expect.any(Array)),expect(e("\x3c!-- wp:first /--\x3e\x3c!-- wp:second /--\x3e")).toEqual(expect.any(Array))}),test("parses blocks of various types",()=>{expect(e("\x3c!-- wp:void /--\x3e")[0]).toHaveProperty("blockName","core/void"),expect(e("\x3c!-- wp:void {} /--\x3e")[0]).toHaveProperty("blockName","core/void"),expect(e('\x3c!-- wp:void {"value":true} /--\x3e')[0]).toHaveProperty("blockName","core/void"),expect(e('\x3c!-- wp:void {"a":{}} /--\x3e')[0]).toHaveProperty("blockName","core/void"),expect(e('\x3c!-- wp:void { "value" : true } /--\x3e')[0]).toHaveProperty("blockName","core/void"),expect(e('\x3c!-- wp:void {\n\t"value" : true\n} /--\x3e')[0]).toHaveProperty("blockName","core/void"),expect(e("\x3c!-- wp:block --\x3e\x3c!-- /wp:block --\x3e")[0]).toHaveProperty("blockName","core/block"),expect(e("\x3c!-- wp:block {} --\x3e\x3c!-- /wp:block --\x3e")[0]).toHaveProperty("blockName","core/block"),expect(e('\x3c!-- wp:block {"value":true} --\x3e\x3c!-- /wp:block --\x3e')[0]).toHaveProperty("blockName","core/block"),expect(e("\x3c!-- wp:block {} --\x3einner\x3c!-- /wp:block --\x3e")[0]).toHaveProperty("blockName","core/block"),expect(e('\x3c!-- wp:block {"value":{"a" : "true"}} --\x3einner\x3c!-- /wp:block --\x3e')[0]).toHaveProperty("blockName","core/block")}),test("blockName is namespaced string (except freeform)",()=>{expect(e("freeform has null name")[0]).toHaveProperty("blockName",null),expect(e("\x3c!-- wp:more /--\x3e")[0]).toHaveProperty("blockName","core/more"),expect(e("\x3c!-- wp:core/more /--\x3e")[0]).toHaveProperty("blockName","core/more"),expect(e("\x3c!-- wp:my/more /--\x3e")[0]).toHaveProperty("blockName","my/more")}),test("JSON attributes are key/value object",()=>{expect(e("freeform has empty attrs")[0]).toHaveProperty("attrs",{}),expect(e("\x3c!-- wp:void /--\x3e")[0]).toHaveProperty("attrs",{}),expect(e("\x3c!-- wp:void {} /--\x3e")[0]).toHaveProperty("blockName","core/void"),expect(e("\x3c!-- wp:void {} /--\x3e")[0]).toHaveProperty("attrs",{}),expect(e('\x3c!-- wp:void {"key": "value"} /--\x3e')[0]).toHaveProperty("attrs",{key:"value"}),expect(e("\x3c!-- wp:block --\x3e\x3c!-- /wp:block --\x3e")[0]).toHaveProperty("attrs",{}),expect(e("\x3c!-- wp:block {} --\x3e\x3c!-- /wp:block --\x3e")[0]).toHaveProperty("attrs",{}),expect(e('\x3c!-- wp:block {"key": "value"} --\x3e\x3c!-- /wp:block --\x3e')[0]).toHaveProperty("attrs",{key:"value"})}),test("innerBlocks is a list",()=>{expect(e("freeform has empty innerBlocks")[0]).toHaveProperty("innerBlocks",[]),expect(e("\x3c!-- wp:void /--\x3e")[0]).toHaveProperty("innerBlocks",[]),expect(e("\x3c!-- wp:block --\x3e\x3c!-- /wp:block --\x3e")[0]).toHaveProperty("innerBlocks",[]);const t=e("\x3c!-- wp:block --\x3e\x3c!-- wp:inner /--\x3e\x3c!-- /wp:block --\x3e")[0];expect(t).toHaveProperty("innerBlocks",expect.any(Array)),expect(t.innerBlocks).toHaveLength(1);const r=e("\x3c!-- wp:block --\x3ea\x3c!-- wp:first /--\x3eb\x3c!-- wp:second /--\x3ec\x3c!-- /wp:block --\x3e")[0];expect(r).toHaveProperty("innerBlocks",expect.any(Array)),expect(r.innerBlocks).toHaveLength(2)}),test("innerHTML is a string",()=>{expect(e("test")[0]).toHaveProperty("innerHTML",expect.any(String)),expect(e("\x3c!-- wp:test /--\x3e")[0]).toHaveProperty("innerHTML",expect.any(String)),expect(e("\x3c!-- wp:test --\x3e\x3c!-- /wp:test --\x3e")[0]).toHaveProperty("innerHTML",expect.any(String)),expect(e("\x3c!-- wp:test --\x3etest\x3c!-- /wp:test --\x3e")[0]).toHaveProperty("innerHTML",expect.any(String))})}),describe("generic tests",()=>{test("parse() accepts inputs with multiple Reusable blocks",()=>{expect(e('\x3c!-- wp:block {"ref":313} /--\x3e\x3c!-- wp:block {"ref":482} /--\x3e')).toEqual([expect.objectContaining({blockName:"core/block",attrs:{ref:313}}),expect.objectContaining({blockName:"core/block",attrs:{ref:482}})])}),test("treats void blocks and empty blocks identically",()=>{expect(e("\x3c!-- wp:block /--\x3e")).toEqual(e("\x3c!-- wp:block --\x3e\x3c!-- /wp:block --\x3e")),expect(e('\x3c!-- wp:my/bus { "is": "fast" } /--\x3e')).toEqual(e('\x3c!-- wp:my/bus { "is": "fast" } --\x3e\x3c!-- /wp:my/bus --\x3e'))}),test("should grab HTML soup before block openers",()=>{["<p>Break me</p>\x3c!-- wp:block /--\x3e","<p>Break me</p>\x3c!-- wp:block --\x3e\x3c!-- /wp:block --\x3e"].forEach(t=>expect(e(t)).toEqual([expect.objectContaining({innerHTML:"<p>Break me</p>"}),expect.objectContaining({blockName:"core/block",innerHTML:""})]))}),test("should grab HTML soup before inner block openers",()=>["\x3c!-- wp:outer --\x3e<p>Break me</p>\x3c!-- wp:block /--\x3e\x3c!-- /wp:outer --\x3e","\x3c!-- wp:outer --\x3e<p>Break me</p>\x3c!-- wp:block --\x3e\x3c!-- /wp:block --\x3e\x3c!-- /wp:outer --\x3e"].forEach(t=>expect(e(t)).toEqual([expect.objectContaining({innerBlocks:[expect.objectContaining({blockName:"core/block",innerHTML:""})],innerHTML:"<p>Break me</p>"})]))),test("should grab HTML soup after blocks",()=>["\x3c!-- wp:block /--\x3e<p>Break me</p>","\x3c!-- wp:block --\x3e\x3c!-- /wp:block --\x3e<p>Break me</p>"].forEach(t=>expect(e(t)).toEqual([expect.objectContaining({blockName:"core/block",innerHTML:""}),expect.objectContaining({innerHTML:"<p>Break me</p>"})])))}),describe("innerBlock placemarkers",()=>{test("innerContent exists",()=>{expect(e("test")[0]).toHaveProperty("innerContent",["test"]),expect(e("\x3c!-- wp:void /--\x3e")[0]).toHaveProperty("innerContent",[])}),test("innerContent contains innerHTML",()=>{expect(e("\x3c!-- wp:block --\x3eInner\x3c!-- /wp:block --\x3e")[0]).toHaveProperty("innerContent",["Inner"])}),test("block locations become null",()=>{expect(e("\x3c!-- wp:block --\x3e\x3c!-- wp:void /--\x3e\x3c!-- /wp:block --\x3e")[0]).toHaveProperty("innerContent",[null])}),test("HTML soup appears after blocks",()=>{expect(e("\x3c!-- wp:block --\x3e\x3c!-- wp:void /--\x3eAfter\x3c!-- /wp:block --\x3e")[0]).toHaveProperty("innerContent",[null,"After"])}),test("HTML soup appears before blocks",()=>{expect(e("\x3c!-- wp:block --\x3eBefore\x3c!-- wp:void /--\x3e\x3c!-- /wp:block --\x3e")[0]).toHaveProperty("innerContent",["Before",null])}),test("blocks follow each other",()=>{expect(e("\x3c!-- wp:block --\x3e\x3c!-- wp:void /--\x3e\x3c!-- wp:void /--\x3e\x3c!-- /wp:block --\x3e")[0]).toHaveProperty("innerContent",[null,null])})}),describe("attack vectors",()=>{test("really long JSON attribute sections",()=>{const t="a".repeat(1e5);let r;expect(()=>r=e(`\x3c!-- wp:fake {"a":"${t}"} /--\x3e`)[0]).not.toThrow(),expect(r.attrs.a).toHaveLength(1e5)}),describe("invalid block comment syntax",()=>{test("extra space after void closer",()=>{let t;expect(()=>t=e("\x3c!-- wp:block / --\x3e")[0]).not.toThrow(),expect(t.blockName).toBeNull()})})})},c=(...e)=>describe.skip(...e),p=(e,t)=>c(e,()=>{});r.d(t,"parse",function(){return o.parse}),r.d(t,"jsTester",function(){return n}),r.d(t,"phpTester",function(){return p})}});
|
changelog.txt
CHANGED
@@ -1,5 +1,9 @@
|
|
1 |
== Changelog ==
|
2 |
|
|
|
|
|
|
|
|
|
3 |
= 4.6.0 =
|
4 |
|
5 |
* Fix issue with drag-and-drop in columns.
|
1 |
== Changelog ==
|
2 |
|
3 |
+
= 4.6.1 =
|
4 |
+
|
5 |
+
* Parser: Make attribute parsing possessive (Fix High CPU usage).
|
6 |
+
|
7 |
= 4.6.0 =
|
8 |
|
9 |
* Fix issue with drag-and-drop in columns.
|
gutenberg.php
CHANGED
@@ -3,15 +3,15 @@
|
|
3 |
* Plugin Name: Gutenberg
|
4 |
* Plugin URI: https://github.com/WordPress/gutenberg
|
5 |
* Description: Printing since 1440. This is the development plugin for the new block editor in core.
|
6 |
-
* Version: 4.6.
|
7 |
* Author: Gutenberg Team
|
8 |
*
|
9 |
* @package gutenberg
|
10 |
*/
|
11 |
|
12 |
### BEGIN AUTO-GENERATED DEFINES
|
13 |
-
define( 'GUTENBERG_VERSION', '4.6.
|
14 |
-
define( 'GUTENBERG_GIT_COMMIT', '
|
15 |
### END AUTO-GENERATED DEFINES
|
16 |
|
17 |
gutenberg_pre_init();
|
3 |
* Plugin Name: Gutenberg
|
4 |
* Plugin URI: https://github.com/WordPress/gutenberg
|
5 |
* Description: Printing since 1440. This is the development plugin for the new block editor in core.
|
6 |
+
* Version: 4.6.1
|
7 |
* Author: Gutenberg Team
|
8 |
*
|
9 |
* @package gutenberg
|
10 |
*/
|
11 |
|
12 |
### BEGIN AUTO-GENERATED DEFINES
|
13 |
+
define( 'GUTENBERG_VERSION', '4.6.1' );
|
14 |
+
define( 'GUTENBERG_GIT_COMMIT', '7e27b6438841d57ef71b8897ad2a205ec78166e1' );
|
15 |
### END AUTO-GENERATED DEFINES
|
16 |
|
17 |
gutenberg_pre_init();
|
packages/block-serialization-default-parser/parser.php
CHANGED
@@ -359,6 +359,7 @@ class WP_Block_Parser {
|
|
359 |
*
|
360 |
* @internal
|
361 |
* @since 3.8.0
|
|
|
362 |
* @return array
|
363 |
*/
|
364 |
function next_token() {
|
@@ -373,13 +374,18 @@ class WP_Block_Parser {
|
|
373 |
* match back in PHP to see which one it was.
|
374 |
*/
|
375 |
$has_match = preg_match(
|
376 |
-
'/<!--\s+(?<closer>\/)?wp:(?<namespace>[a-z][a-z0-9_-]*\/)?(?<name>[a-z][a-z0-9_-]*)\s+(?<attrs>{(?:[^}]+|}+(?=})|(?!}\s
|
377 |
$this->document,
|
378 |
$matches,
|
379 |
PREG_OFFSET_CAPTURE,
|
380 |
$this->offset
|
381 |
);
|
382 |
|
|
|
|
|
|
|
|
|
|
|
383 |
// we have no more tokens
|
384 |
if ( 0 === $has_match ) {
|
385 |
return array( 'no-more-tokens', null, null, null, null );
|
359 |
*
|
360 |
* @internal
|
361 |
* @since 3.8.0
|
362 |
+
* @since 4.6.1 fixed a bug in attribute parsing which caused catastrophic backtracking on invalid block comments
|
363 |
* @return array
|
364 |
*/
|
365 |
function next_token() {
|
374 |
* match back in PHP to see which one it was.
|
375 |
*/
|
376 |
$has_match = preg_match(
|
377 |
+
'/<!--\s+(?<closer>\/)?wp:(?<namespace>[a-z][a-z0-9_-]*\/)?(?<name>[a-z][a-z0-9_-]*)\s+(?<attrs>{(?:(?:[^}]+|}+(?=})|(?!}\s+\/?-->).)*+)?}\s+)?(?<void>\/)?-->/s',
|
378 |
$this->document,
|
379 |
$matches,
|
380 |
PREG_OFFSET_CAPTURE,
|
381 |
$this->offset
|
382 |
);
|
383 |
|
384 |
+
// if we get here we probably have catastrophic backtracking or out-of-memory in the PCRE
|
385 |
+
if ( false === $has_match ) {
|
386 |
+
return array( 'no-more-tokens', null, null, null, null );
|
387 |
+
}
|
388 |
+
|
389 |
// we have no more tokens
|
390 |
if ( 0 === $has_match ) {
|
391 |
return array( 'no-more-tokens', null, null, null, null );
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Contributors: matveb, joen, karmatosed
|
3 |
Requires at least: 4.9.8
|
4 |
Tested up to: 4.9
|
5 |
-
Stable tag: 4.
|
6 |
License: GPLv2 or later
|
7 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
8 |
|
@@ -81,30 +81,4 @@ See also <a href="https://github.com/WordPress/gutenberg/blob/master/CONTRIBUTIN
|
|
81 |
|
82 |
= Latest =
|
83 |
|
84 |
-
*
|
85 |
-
* Fix TinyMCE list plugin registration.
|
86 |
-
* Fix IE11 flexbox alignment when min-width is set.
|
87 |
-
* Fix IE11 focus loss after TinyMCE init. Add IE check.
|
88 |
-
* Fix getSelectedBlockClientId selector.
|
89 |
-
* Fix issue where unregistering a block type would cause blocks that convert to it to break.
|
90 |
-
* Fix Classic block not showing galleries on a grid.
|
91 |
-
* Fix visual issues with Button block text wrap.
|
92 |
-
* Fix modals in Edge.
|
93 |
-
* Fix Categories block filter effect on the front-end.
|
94 |
-
* Fix an issue where the block toolbar would cause an image to jump downwards when the wide or full - alignments were activated.
|
95 |
-
* Apply IE11 input fix only when mounting TinyMCE.
|
96 |
-
* Improve block preview styling.
|
97 |
-
* Make the Image Link URL field readonly.
|
98 |
-
* Disable HTML edit from Media & Text block.
|
99 |
-
* Avoid loading theme editor styles if not existing (RTL languages).
|
100 |
-
* Improve scoping of nested paragraph right-padding CSS rule.
|
101 |
-
* Add e2e tests for the format API.
|
102 |
-
* Merge similar text strings for i18n.
|
103 |
-
* Move editor specific styles from style.scss to editor.scss in Cover block.
|
104 |
-
* Simplify sidebar tabs aria-labels.
|
105 |
-
* Remove onSplit from RichText docs.
|
106 |
-
* Remove textdomain from the block library.
|
107 |
-
* Avoid rendering AdminNotices compatibility component.
|
108 |
-
* Avoid changing default wpautop priority.
|
109 |
-
* Change @package names to WordPress.
|
110 |
-
* Update published packages changelogs.
|
2 |
Contributors: matveb, joen, karmatosed
|
3 |
Requires at least: 4.9.8
|
4 |
Tested up to: 4.9
|
5 |
+
Stable tag: 4.6.0
|
6 |
License: GPLv2 or later
|
7 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
8 |
|
81 |
|
82 |
= Latest =
|
83 |
|
84 |
+
* Parser: Make attribute parsing possessive (Fix High CPU usage).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|