2021-11-15 13:50:17 +01:00
|
|
|
this.wp=this.wp||{},this.wp.keyboardShortcuts=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="cFS5")}({"1ZqX":function(t,e){t.exports=window.wp.data},GRId:function(t,e){t.exports=window.wp.element},RxS6:function(t,e){t.exports=window.wp.keycodes},YLtl:function(t,e){t.exports=window.lodash},cFS5:function(t,e,n){"use strict";n.r(e),n.d(e,"store",(function(){return w})),n.d(e,"useShortcut",(function(){return C})),n.d(e,"ShortcutProvider",(function(){return E})),n.d(e,"__unstableUseShortcutEventMatch",(function(){return x}));var r={};n.r(r),n.d(r,"registerShortcut",(function(){return a})),n.d(r,"unregisterShortcut",(function(){return s}));var o={};n.r(o),n.d(o,"getShortcutKeyCombination",(function(){return b})),n.d(o,"getShortcutRepresentation",(function(){return y})),n.d(o,"getShortcutDescription",(function(){return v})),n.d(o,"getShortcutAliases",(function(){return g})),n.d(o,"getAllShortcutKeyCombinations",(function(){return S})),n.d(o,"getAllShortcutRawKeyCombinations",(function(){return m})),n.d(o,"getCategoryShortcuts",(function(){return O}));var u=n("1ZqX"),c=n("YLtl");var i=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;switch(e.type){case"REGISTER_SHORTCUT":return{...t,[e.name]:{category:e.category,keyCombination:e.keyCombination,aliases:e.aliases,description:e.description}};case"UNREGISTER_SHORTCUT":return Object(c.omit)(t,e.name)}return t};function a(t){let{name:e,category:n,description:r,keyCombination:o,aliases:u}=t;return{type:"REGISTER_SHORTCUT",name:e,category:n,keyCombination:o,aliases:u,description:r}}function s(t){return{type:"UNREGISTER_SHORTCUT",name:t}}var l=n("pPDe"),f=n("RxS6");const d=[],p={display:f.displayShortcut,raw:f.rawShortcut,ariaLabel:f.shortcutAriaLabel};function h(t,e){return t?t.modifier?p[e][t.modifier](t.character):t.character:null}function b(t,e){return t[e]?t[e].keyCombination:null}function y(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"display";const r=b(t,e);return h(r,n)}function v(t,e){return t[e]?t[e].description:null}function g(t,e){return t[e]&&t[e].aliases?t[e].aliases:d}const S=Object(l.a)((t,e)=>Object(c.compact)([b(t,e),...g(t,e)]),(t,e)=>[t[e]]),m=Object(l.a)((t,e)=>S(t,e).map(t=>h(t,"raw")),(t,e)=>[t[e]]),O=Object(l.a)((t,e)=>Object.entries(t).filter(t=>{let[,n]=t;return n.category===e}).map(t=>{let[e]=t;return e}),t=>[t]),w=Object(u.createReduxStore)("core/keyboard-shortcuts",{reducer:i,actions:r,selectors:o});Object(u.register)(w);var j=n("GRId");function x(){const{getAllShortcutKeyCombinations:t}=Object(u.useSelect)(w);return function(e,n){return t(e).some(t=>{let{modifier:e,character:r}=t;return f.isKeyboardEvent[e](n,r)})}}const R=Object(j.createContext)();function C(t,e){let{isDisabled:n}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=Object(j.useContext)(R),o=x(),u=Object(j.useRef)();u.current=e,Object(j.useEffect)(()=>{if(!n)return r.current.add(e),()=>{r.current.delete(e)};function e(e){o(t,e)&&u.current(e)}},[t,n])}var T=n("wx14");const{Provider:D}=R;function E(t){const e=Object(j.useRef)(new Set);return Object(j.createElement)(D,{value:e},Object(j.createElement)("div",Object(T.a)({},t,{onKeyDown:functio
|