2021-11-08 15:29:21 +01:00
|
|
|
this.wp=this.wp||{},this.wp.keyboardShortcuts=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="cFS5")}({"1ZqX":function(e,t){e.exports=window.wp.data},GRId:function(e,t){e.exports=window.wp.element},RxS6:function(e,t){e.exports=window.wp.keycodes},YLtl:function(e,t){e.exports=window.lodash},cFS5:function(e,t,n){"use strict";n.r(t),n.d(t,"store",(function(){return w})),n.d(t,"useShortcut",(function(){return C})),n.d(t,"ShortcutProvider",(function(){return E})),n.d(t,"__unstableUseShortcutEventMatch",(function(){return x}));var r={};n.r(r),n.d(r,"registerShortcut",(function(){return i})),n.d(r,"unregisterShortcut",(function(){return s}));var o={};n.r(o),n.d(o,"getShortcutKeyCombination",(function(){return y})),n.d(o,"getShortcutRepresentation",(function(){return h})),n.d(o,"getShortcutDescription",(function(){return v})),n.d(o,"getShortcutAliases",(function(){return S})),n.d(o,"getAllShortcutKeyCombinations",(function(){return g})),n.d(o,"getAllShortcutRawKeyCombinations",(function(){return m})),n.d(o,"getCategoryShortcuts",(function(){return O}));var u=n("1ZqX"),c=n("YLtl");var a=function(e={},t){switch(t.type){case"REGISTER_SHORTCUT":return{...e,[t.name]:{category:t.category,keyCombination:t.keyCombination,aliases:t.aliases,description:t.description}};case"UNREGISTER_SHORTCUT":return Object(c.omit)(e,t.name)}return e};function i({name:e,category:t,description:n,keyCombination:r,aliases:o}){return{type:"REGISTER_SHORTCUT",name:e,category:t,keyCombination:r,aliases:o,description:n}}function s(e){return{type:"UNREGISTER_SHORTCUT",name:e}}var f=n("pPDe"),l=n("RxS6");const d=[],p={display:l.displayShortcut,raw:l.rawShortcut,ariaLabel:l.shortcutAriaLabel};function b(e,t){return e?e.modifier?p[t][e.modifier](e.character):e.character:null}function y(e,t){return e[t]?e[t].keyCombination:null}function h(e,t,n="display"){return b(y(e,t),n)}function v(e,t){return e[t]?e[t].description:null}function S(e,t){return e[t]&&e[t].aliases?e[t].aliases:d}const g=Object(f.a)((e,t)=>Object(c.compact)([y(e,t),...S(e,t)]),(e,t)=>[e[t]]),m=Object(f.a)((e,t)=>g(e,t).map(e=>b(e,"raw")),(e,t)=>[e[t]]),O=Object(f.a)((e,t)=>Object.entries(e).filter(([,e])=>e.category===t).map(([e])=>e),e=>[e]),w=Object(u.createReduxStore)("core/keyboard-shortcuts",{reducer:a,actions:r,selectors:o});Object(u.register)(w);var j=n("GRId");function x(){const{getAllShortcutKeyCombinations:e}=Object(u.useSelect)(w);return function(t,n){return e(t).some(({modifier:e,character:t})=>l.isKeyboardEvent[e](n,t))}}const R=Object(j.createContext)();function C(e,t,{isDisabled:n}={}){const r=Object(j.useContext)(R),o=x(),u=Object(j.useRef)();u.current=t,Object(j.useEffect)(()=>{if(!n)return r.current.add(t),()=>{r.current.delete(t)};function t(t){o(e,t)&&u.current(t)}},[e,n])}var T=n("wx14");const{Provider:D}=R;function E(e){const t=Object(j.useRef)(new Set);return Object(j.createElement)(D,{value:t},Object(j.createElement)("div",Object(T.a)({},e,{onKeyDown:function(n){e.onKeyDown&&e.onKeyDown(n);for(const e of t.current)e(n)}})))}},pPDe:function(e,t,n){"use strict";var r,o;function u(e){return[e]}function c(){var e={clear:function(){e.head=null}};return e}function a(e,t,n){var r;if(e.length!==t.length)return!1;for(r=n;r<e.length;r++)
|