diff --git a/client/src/entrypoints/admin/core.js b/client/src/entrypoints/admin/core.js index 7b30f1bf34..2e4c6ef03a 100644 --- a/client/src/entrypoints/admin/core.js +++ b/client/src/entrypoints/admin/core.js @@ -4,6 +4,8 @@ import * as StimulusModule from '@hotwired/stimulus'; import { Icon, Portal } from '../..'; import { coreControllerDefinitions } from '../../controllers'; import { escapeHtml } from '../../utils/text'; +import { InlinePanel } from '../../components/InlinePanel'; +import { MultipleChooserPanel } from '../../components/MultipleChooserPanel'; import { initStimulus } from '../../includes/initStimulus'; /** Expose a global to allow for customisations and packages to build with Stimulus. */ @@ -32,6 +34,10 @@ window.wagtail = wagtail; window.escapeHtml = escapeHtml; +window.InlinePanel = InlinePanel; + +window.MultipleChooserPanel = MultipleChooserPanel; + $(() => { /* Dropzones */ $('.drop-zone') diff --git a/client/src/entrypoints/admin/page-editor.js b/client/src/entrypoints/admin/page-editor.js deleted file mode 100644 index b5701b104f..0000000000 --- a/client/src/entrypoints/admin/page-editor.js +++ /dev/null @@ -1,29 +0,0 @@ -import $ from 'jquery'; -import { InlinePanel } from '../../components/InlinePanel'; -import { MultipleChooserPanel } from '../../components/MultipleChooserPanel'; - -window.InlinePanel = InlinePanel; -window.MultipleChooserPanel = MultipleChooserPanel; - -function initKeyboardShortcuts() { - // eslint-disable-next-line no-undef - Mousetrap.bind(['mod+p'], () => { - const previewToggle = document.querySelector( - '[data-side-panel-toggle="preview"]', - ); - if (previewToggle) previewToggle.click(); - return false; - }); - - // eslint-disable-next-line no-undef - Mousetrap.bind(['mod+s'], () => { - $('.action-save').trigger('click'); - return false; - }); -} - -window.initKeyboardShortcuts = initKeyboardShortcuts; - -$(() => { - initKeyboardShortcuts(); -}); diff --git a/client/webpack.config.js b/client/webpack.config.js index e5132a997c..1f28187457 100644 --- a/client/webpack.config.js +++ b/client/webpack.config.js @@ -44,7 +44,6 @@ module.exports = function exports(env, argv) { 'page-chooser-modal', 'page-chooser', 'page-chooser-telepath', - 'page-editor', 'preview-panel', 'privacy-switch', 'sidebar', diff --git a/wagtail/admin/static_src/wagtailadmin/js/vendor/mousetrap.min.js b/wagtail/admin/static_src/wagtailadmin/js/vendor/mousetrap.min.js deleted file mode 100644 index 291aff8d54..0000000000 --- a/wagtail/admin/static_src/wagtailadmin/js/vendor/mousetrap.min.js +++ /dev/null @@ -1,11 +0,0 @@ -/* mousetrap v1.5.3 craig.is/killing/mice */ -(function(C,r,g){function t(a,b,h){a.addEventListener?a.addEventListener(b,h,!1):a.attachEvent("on"+b,h)}function x(a){if("keypress"==a.type){var b=String.fromCharCode(a.which);a.shiftKey||(b=b.toLowerCase());return b}return l[a.which]?l[a.which]:p[a.which]?p[a.which]:String.fromCharCode(a.which).toLowerCase()}function D(a){var b=[];a.shiftKey&&b.push("shift");a.altKey&&b.push("alt");a.ctrlKey&&b.push("ctrl");a.metaKey&&b.push("meta");return b}function u(a){return"shift"==a||"ctrl"==a||"alt"==a|| -"meta"==a}function y(a,b){var h,c,e,g=[];h=a;"+"===h?h=["+"]:(h=h.replace(/\+{2}/g,"+plus"),h=h.split("+"));for(e=0;em||l.hasOwnProperty(m)&&(k[l[m]]=m)}e=k[h]?"keydown":"keypress"}"keypress"==e&&g.length&&(e="keydown");return{key:c,modifiers:g,action:e}}function B(a,b){return null===a||a===r?!1:a===b?!0:B(a.parentNode,b)}function c(a){function b(a){a= -a||{};var b=!1,n;for(n in q)a[n]?b=!0:q[n]=0;b||(v=!1)}function h(a,b,n,f,c,h){var g,e,l=[],m=n.type;if(!d._callbacks[a])return[];"keyup"==m&&u(a)&&(b=[a]);for(g=0;g":".","?":"/","|":"\\"},z={option:"alt",command:"meta","return":"enter", -escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},k;for(g=1;20>g;++g)l[111+g]="f"+g;for(g=0;9>=g;++g)l[g+96]=g;c.prototype.bind=function(a,b,c){a=a instanceof Array?a:[a];this._bindMultiple.call(this,a,b,c);return this};c.prototype.unbind=function(a,b){return this.bind.call(this,a,function(){},b)};c.prototype.trigger=function(a,b){if(this._directMap[a+":"+b])this._directMap[a+":"+b]({},a);return this};c.prototype.reset=function(){this._callbacks={};this._directMap= -{};return this};c.prototype.stopCallback=function(a,b){return-1<(" "+b.className+" ").indexOf(" mousetrap ")||B(b,this.target)?!1:"INPUT"==b.tagName||"SELECT"==b.tagName||"TEXTAREA"==b.tagName||b.isContentEditable};c.prototype.handleKey=function(){return this._handleKey.apply(this,arguments)};c.init=function(){var a=c(r),b;for(b in a)"_"!==b.charAt(0)&&(c[b]=function(b){return function(){return a[b].apply(a,arguments)}}(b))};c.init();C.Mousetrap=c;"undefined"!==typeof module&&module.exports&&(module.exports= -c);"function"===typeof define&&define.amd&&define(function(){return c})})(window,document); diff --git a/wagtail/admin/templates/wagtailadmin/pages/_editor_js.html b/wagtail/admin/templates/wagtailadmin/pages/_editor_js.html index 96f108a5f9..41fbf8f4c2 100644 --- a/wagtail/admin/templates/wagtailadmin/pages/_editor_js.html +++ b/wagtail/admin/templates/wagtailadmin/pages/_editor_js.html @@ -6,9 +6,7 @@ - -