WordPress/wp-includes/js/dist/editor.min.js

11 lines
187 KiB
JavaScript
Raw Normal View History

this.wp=this.wp||{},this.wp.editor=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=358)}({0:function(t,e){!function(){t.exports=this.wp.element}()},1:function(t,e){!function(){t.exports=this.wp.i18n}()},10:function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}n.d(e,"a",(function(){return r}))},109:function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},11:function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(32),o=n(3);function i(t,e){return!e||"object"!==Object(r.a)(e)&&"function"!=typeof e?Object(o.a)(t):e}},111:function(t,e,n){"use strict";var r,o=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},s=this&&this.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&(n[r[o]]=t[r[o]])}return n};e.__esModule=!0;var a=n(27),c=n(31),u=n(112),l=n(113),d=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.state={lineHeight:null},e.dispatchEvent=function(t){var n=document.createEvent("Event");n.initEvent(t,!0,!1),e.textarea.dispatchEvent(n)},e.updateLineHeight=function(){e.setState({lineHeight:l(e.textarea)})},e.onChange=function(t){var n=e.props.onChange;e.currentValue=t.currentTarget.value,n&&n(t)},e.saveDOMNodeRef=function(t){var n=e.props.innerRef;n&&n(t),e.textarea=t},e.getLocals=function(){var t=e,n=t.props,r=(n.onResize,n.maxRows),o=(n.onChange,n.style),a=(n.innerRef,s(n,["onResize","maxRows","onChange","style","innerRef"])),c=t.state.lineHeight,u=t.saveDOMNodeRef,l=r&&c?c*r:null;return i({},a,{saveDOMNodeRef:u,style:l?i({},o,{maxHeight:l}):o,onChange:e.onChange})},e}return o(e,t),e.prototype.componentDidMount=function(){var t=this,e=this.props,n=e.onResize;"number"==typeof e.maxRows&&this.updateLineHeight(),setTimeout((function(){return u(t.textarea)})),n&&this.textarea.addEventListener("autosize:resized",n)},e.prototype.componentWillUnmount=function(){var t=this.props.onResize;t&&this.textarea.removeEventListener("autosize:resized",t),this.dispatchEvent("autosize:destroy")},e.prototype.render=function(){var t=this.getLocals(),e=t.children,n=t.saveDOMNodeRef,r=s(t,["children","saveDOMNodeRef"]);return a.createElement("textarea",i({},r,{ref:n}),e)},e.prototype.componentDidUpdate=function(t){this.props.value===this.currentValue&&this.props.rows===t.rows||this.dispatchEvent("autosize:upda
Block Editor: Update the WordPress Packages from Gutenberg 5.3 - @wordpress/a11y@2.2.0 - @wordpress/annotations@1.2.0 - @wordpress/api-fetch@3.1.0 - @wordpress/autop@2.2.0 - @wordpress/babel-plugin-import-jsx-pragma@2.1.0 - @wordpress/babel-preset-default@4.1.0 - @wordpress/blob@2.3.0 - @wordpress/block-editor@1.1.0 - @wordpress/block-library@2.4.0 - @wordpress/block-serialization-default-parser@3.1.0 - @wordpress/blocks@6.2.0 - @wordpress/components@7.2.0 - @wordpress/compose@3.2.0 - @wordpress/core-data@2.2.0 - @wordpress/data@4.4.0 - @wordpress/date@3.2.0 - @wordpress/deprecated@2.2.0 - @wordpress/docgen@1.1.0 - @wordpress/dom-ready@2.2.0 - @wordpress/dom@2.2.0 - @wordpress/e2e-test-utils@1.1.0 - @wordpress/e2e-tests@1.1.0 - @wordpress/edit-post@3.3.0 - @wordpress/edit-widgets@0.2.0 - @wordpress/editor@9.2.0 - @wordpress/element@2.3.0 - @wordpress/escape-html@1.2.0 - @wordpress/eslint-plugin@2.1.0 - @wordpress/format-library@1.4.0 - @wordpress/hooks@2.2.0 - @wordpress/html-entities@2.2.0 - @wordpress/i18n@3.3.0 - @wordpress/keycodes@2.2.0 - @wordpress/list-reusable-blocks@1.3.0 - @wordpress/notices@1.3.0 - @wordpress/nux@3.2.0 - @wordpress/plugins@2.2.0 - @wordpress/priority-queue@1.1.0 - @wordpress/redux-routine@3.2.0 - @wordpress/rich-text@3.2.0 - @wordpress/scripts@3.1.0 - @wordpress/shortcode@2.2.0 - @wordpress/url@2.5.0 - @wordpress/viewport@2.3.0 - @wordpress/wordcount@2.2.0 Built from https://develop.svn.wordpress.org/trunk@44960 git-svn-id: http://core.svn.wordpress.org/trunk@44791 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-21 13:48:00 +01:00
/*!
autosize 4.0.2
license: MIT
http://www.jacklmoore.com/autosize
*/o=[t,e],void 0===(i="function"==typeof(r=function(t,e){"use strict";var n,r,o="function"==typeof Map?new Map:(n=[],r=[],{has:function(t){return n.indexOf(t)>-1},get:function(t){return r[n.indexOf(t)]},set:function(t,e){-1===n.indexOf(t)&&(n.push(t),r.push(e))},delete:function(t){var e=n.indexOf(t);e>-1&&(n.splice(e,1),r.splice(e,1))}}),i=function(t){return new Event(t,{bubbles:!0})};try{new Event("test")}catch(t){i=function(t){var e=document.createEvent("Event");return e.initEvent(t,!0,!1),e}}function s(t){if(t&&t.nodeName&&"TEXTAREA"===t.nodeName&&!o.has(t)){var e,n=null,r=null,s=null,a=function(){t.clientWidth!==r&&d()},c=function(e){window.removeEventListener("resize",a,!1),t.removeEventListener("input",d,!1),t.removeEventListener("keyup",d,!1),t.removeEventListener("autosize:destroy",c,!1),t.removeEventListener("autosize:update",d,!1),Object.keys(e).forEach((function(n){t.style[n]=e[n]})),o.delete(t)}.bind(t,{height:t.style.height,resize:t.style.resize,overflowY:t.style.overflowY,overflowX:t.style.overflowX,wordWrap:t.style.wordWrap});t.addEventListener("autosize:destroy",c,!1),"onpropertychange"in t&&"oninput"in t&&t.addEventListener("keyup",d,!1),window.addEventListener("resize",a,!1),t.addEventListener("input",d,!1),t.addEventListener("autosize:update",d,!1),t.style.overflowX="hidden",t.style.wordWrap="break-word",o.set(t,{destroy:c,update:d}),"vertical"===(e=window.getComputedStyle(t,null)).resize?t.style.resize="none":"both"===e.resize&&(t.style.resize="horizontal"),n="content-box"===e.boxSizing?-(parseFloat(e.paddingTop)+parseFloat(e.paddingBottom)):parseFloat(e.borderTopWidth)+parseFloat(e.borderBottomWidth),isNaN(n)&&(n=0),d()}function u(e){var n=t.style.width;t.style.width="0px",t.offsetWidth,t.style.width=n,t.style.overflowY=e}function l(){if(0!==t.scrollHeight){var e=function(t){for(var e=[];t&&t.parentNode&&t.parentNode instanceof Element;)t.parentNode.scrollTop&&e.push({node:t.parentNode,scrollTop:t.parentNode.scrollTop}),t=t.parentNode;return e}(t),o=document.documentElement&&document.documentElement.scrollTop;t.style.height="",t.style.height=t.scrollHeight+n+"px",r=t.clientWidth,e.forEach((function(t){t.node.scrollTop=t.scrollTop})),o&&(document.documentElement.scrollTop=o)}}function d(){l();var e=Math.round(parseFloat(t.style.height)),n=window.getComputedStyle(t,null),r="content-box"===n.boxSizing?Math.round(parseFloat(n.height)):t.offsetHeight;if(r<e?"hidden"===n.overflowY&&(u("scroll"),l(),r="content-box"===n.boxSizing?Math.round(parseFloat(window.getComputedStyle(t,null).height)):t.offsetHeight):"hidden"!==n.overflowY&&(u("hidden"),l(),r="content-box"===n.boxSizing?Math.round(parseFloat(window.getComputedStyle(t,null).height)):t.offsetHeight),s!==r){s=r;var o=i("autosize:resized");try{t.dispatchEvent(o)}catch(t){}}}}function a(t){var e=o.get(t);e&&e.destroy()}function c(t){var e=o.get(t);e&&e.update()}var u=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?((u=function(t){return t}).destroy=function(t){return t},u.update=function(t){return t}):((u=function(t,e){return t&&Array.prototype.forEach.call(t.length?t:[t],(function(t){return s(t)})),t}).destroy=function(t){return t&&Array.prototype.forEach.call(t.length?t:[t],a),t},u.update=function(t){return t&&Array.prototype.forEach.call(t.length?t:[t],c),t}),e.default=u,t.exports=e.default})?r.apply(e,o):r)||(t.exports=i)},113:function(t,e,n){var r=n(114);t.exports=function(t){var e=r(t,"line-height"),n=parseFloat(e,10);if(e===n+""){var o=t.style.lineHeight;t.style.lineHeight=e+"em",e=r(t,"line-height"),n=parseFloat(e,10),o?t.style.lineHeight=o:delete t.style.lineHeight}if(-1!==e.indexOf("pt")?(n*=4,n/=3):-1!==e.indexOf("mm")?(n*=96,n/=25.4):-1!==e.indexOf("cm")?(n*=96,n/=2.54):-1!==e.indexOf("in")?n*=96:-1!==e.indexOf("pc")&&(n*=16),n=Math.round(n),"normal"===e){var i=t.nodeName,s=document.createElement(i);s.innerHTML="&nbsp;","TEXTAREA"===i.toUpperCase()&&s.setAttribute("rows","1");var a=r(t,"font-size");s.style.fontSize=a,s.style.padding="0px",s.style.border="0px";var c=document.body;c.appendChild(s),n=s.offsetHeight,c.r
/*!
Copyright (c) 2017 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var t=[],e=0;e<arguments.length;e++){var r=arguments[e];if(r){var i=typeof r;if("string"===i||"number"===i)t.push(r);else if(Array.isArray(r)&&r.length){var s=o.apply(null,r);s&&t.push(s)}else if("object"===i)for(var a in r)n.call(r,a)&&r[a]&&t.push(a)}}return t.join(" ")}t.exports?(o.default=o,t.exports=o):void 0===(r=function(){return o}.apply(e,[]))||(t.exports=r)}()},17:function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(34);function o(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||Object(r.a)(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}},18:function(t,e){!function(){t.exports=this.wp.keycodes}()},19:function(t,e,n){"use strict";function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}n.d(e,"a",(function(){return r}))},2:function(t,e){!function(){t.exports=this.lodash}()},20:function(t,e){!function(){t.exports=this.wp.richText}()},21:function(t,e,n){"use strict";function r(t,e){if(null==t)return{};var n,r,o=function(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}n.d(e,"a",(function(){return r}))},227:function(t,e){var n=t.exports=function(t){return new r(t)};function r(t){this.value=t}function o(t,e,n){var r=[],o=[],a=!0;return function t(d){var p=n?i(d):d,h={},f=!0,b={node:p,node_:d,path:[].concat(r),parent:o[o.length-1],parents:o,key:r.slice(-1)[0],isRoot:0===r.length,level:r.length,circular:null,update:function(t,e){b.isRoot||(b.parent.node[b.key]=t),b.node=t,e&&(f=!1)},delete:function(t){delete b.parent.node[b.key],t&&(f=!1)},remove:function(t){c(b.parent.node)?b.parent.node.splice(b.key,1):delete b.parent.node[b.key],t&&(f=!1)},keys:null,before:function(t){h.before=t},after:function(t){h.after=t},pre:function(t){h.pre=t},post:function(t){h.post=t},stop:function(){a=!1},block:function(){f=!1}};if(!a)return b;function m(){if("object"==typeof b.node&&null!==b.node){b.keys&&b.node_===b.node||(b.keys=s(b.node)),b.isLeaf=0==b.keys.length;for(var t=0;t<o.length;t++)if(o[t].node_===d){b.circular=o[t];break}}else b.isLeaf=!0,b.keys=null;b.notLeaf=!b.isLeaf,b.notRoot=!b.isRoot}m();var v=e.call(b,b.node);return void 0!==v&&b.update&&b.update(v),h.before&&h.before.call(b,b.node),f?("object"!=typeof b.node||null===b.node||b.circular||(o.push(b),m(),u(b.keys,(function(e,o){r.push(e),h.pre&&h.pre.call(b,b.node[e],e);var i=t(b.node[e]);n&&l.call(b.node,e)&&(b.node[e]=i.node),i.isLast=o==b.keys.length-1,i.isFirst=0==o,h.post&&h.post.call(b,i),r.pop()})),o.pop()),h.after&&h.after.call(b,b.node),b):b}(t).node}function i(t){if("object"==typeof t&&null!==t){var e;if(c(t))e=[];else if("[object Date]"===a(t))e=new Date(t.getTime?t.getTime():t);else if(function(t){return"[object RegExp]"===a(t)}(t))e=new RegExp(t);else if(function(t){return"[object Error]"===a(t)}(t))e={message:t.message};else if(function(t){return"[object Boolean]"===a(t)}(t))e=new Boolean(t);else if(function(t){return"[object Number]"===a(t)}(t))e=new Number(t);else if(function(t){return"[object String]"===a(t)}(t))e=new String(t);else if(Object.create&&Object.getPrototypeOf)e=Object.create(Object.getPrototypeOf(t));else if(t.constructor===Object)e={};else{var n=t.constructor&&t.constructor.prototype||t.__proto__||{},r=function(){};r.prototype=n,e=new r}return u(s(t),(function(n){e[n]=t[n]})),e}return t}r.prototype.get=function(t){for(var e=this.value,n=0;n<t.length;n++){var r=t[n];if(!e||!l.call(e,r)){e=void 0;break}e=e[r]}return e},r.prototype.has=function(t){for(var e=this.value,n=0;n<t.length;n++){var r=t[n];if(!e||!l.call(e,r))return!1;e=e[r]}return!0