@wordpress/edit-post 7.13.0 → 7.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/components/device-preview/index.js +6 -6
- package/build/components/device-preview/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.js +10 -3
- package/build/components/header/header-toolbar/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.native.js +91 -49
- package/build/components/header/header-toolbar/index.native.js.map +1 -1
- package/build/components/header/index.js +26 -30
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/post-publish-button-or-toggle.js +0 -2
- package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build/components/header/preferences-menu-item/index.js +5 -3
- package/build/components/header/preferences-menu-item/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +8 -6
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +0 -2
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/actions-panel.js +5 -10
- package/build/components/layout/actions-panel.js.map +1 -1
- package/build/components/layout/index.js +2 -2
- package/build/components/layout/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +5 -3
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/sidebar/post-status/index.js +2 -1
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/sidebar/post-trash/index.js +1 -5
- package/build/components/sidebar/post-trash/index.js.map +1 -1
- package/build/components/text-editor/index.js +1 -1
- package/build/components/text-editor/index.js.map +1 -1
- package/build/components/visual-editor/header.native.js +1 -13
- package/build/components/visual-editor/header.native.js.map +1 -1
- package/build/components/visual-editor/index.js +1 -1
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/editor.js +3 -0
- package/build/editor.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +176 -0
- package/build/hooks/commands/use-common-commands.js.map +1 -0
- package/build/plugins/index.js +35 -6
- package/build/plugins/index.js.map +1 -1
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +5 -3
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
- package/build/store/actions.js +43 -29
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +0 -23
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +11 -7
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/device-preview/index.js +6 -6
- package/build-module/components/device-preview/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.js +9 -3
- package/build-module/components/header/header-toolbar/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.native.js +92 -53
- package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
- package/build-module/components/header/index.js +25 -30
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/post-publish-button-or-toggle.js +0 -2
- package/build-module/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build-module/components/header/preferences-menu-item/index.js +4 -3
- package/build-module/components/header/preferences-menu-item/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +5 -5
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +0 -2
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/actions-panel.js +5 -10
- package/build-module/components/layout/actions-panel.js.map +1 -1
- package/build-module/components/layout/index.js +3 -3
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +4 -4
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/sidebar/post-status/index.js +2 -1
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/sidebar/post-trash/index.js +1 -4
- package/build-module/components/sidebar/post-trash/index.js.map +1 -1
- package/build-module/components/text-editor/index.js +2 -2
- package/build-module/components/text-editor/index.js.map +1 -1
- package/build-module/components/visual-editor/header.native.js +1 -10
- package/build-module/components/visual-editor/header.native.js.map +1 -1
- package/build-module/components/visual-editor/index.js +2 -2
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/editor.js +2 -0
- package/build-module/editor.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +160 -0
- package/build-module/hooks/commands/use-common-commands.js.map +1 -0
- package/build-module/plugins/index.js +33 -6
- package/build-module/plugins/index.js.map +1 -1
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js +4 -3
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
- package/build-module/store/actions.js +35 -25
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +0 -21
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +9 -3
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +10 -15
- package/build-style/style.css +10 -15
- package/package.json +32 -32
- package/src/components/block-manager/style.scss +1 -1
- package/src/components/device-preview/index.js +35 -39
- package/src/components/header/header-toolbar/index.js +5 -1
- package/src/components/header/header-toolbar/index.native.js +124 -68
- package/src/components/header/header-toolbar/style.native.scss +23 -4
- package/src/components/header/index.js +22 -32
- package/src/components/header/post-publish-button-or-toggle.js +0 -2
- package/src/components/header/preferences-menu-item/index.js +4 -3
- package/src/components/keyboard-shortcut-help-modal/index.js +10 -5
- package/src/components/keyboard-shortcuts/index.js +0 -2
- package/src/components/layout/actions-panel.js +5 -7
- package/src/components/layout/index.js +4 -0
- package/src/components/layout/style.native.scss +1 -1
- package/src/components/preferences-modal/index.js +6 -4
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +11 -3
- package/src/components/sidebar/post-status/index.js +1 -0
- package/src/components/sidebar/post-trash/index.js +1 -4
- package/src/components/start-page-options/style.scss +0 -3
- package/src/components/text-editor/index.js +0 -2
- package/src/components/visual-editor/header.native.js +1 -17
- package/src/components/visual-editor/index.js +1 -6
- package/src/components/visual-editor/test/__snapshots__/index.native.js.snap +15 -0
- package/src/components/visual-editor/test/index.native.js +118 -1
- package/src/editor.js +2 -0
- package/src/hooks/commands/use-common-commands.js +155 -0
- package/src/plugins/index.js +32 -8
- package/src/plugins/keyboard-shortcuts-help-menu-item/index.js +4 -3
- package/src/store/actions.js +40 -36
- package/src/store/reducer.js +0 -20
- package/src/store/selectors.js +11 -3
- package/src/store/test/reducer.js +0 -25
- package/src/store/test/selectors.js +0 -27
- package/src/style.scss +1 -7
- package/src/components/visual-editor/style.native.scss +0 -18
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
@@ -21,8 +19,6 @@ var _editor = require("@wordpress/editor");
|
|
|
21
19
|
|
|
22
20
|
var _blockEditor = require("@wordpress/block-editor");
|
|
23
21
|
|
|
24
|
-
var _style = _interopRequireDefault(require("./style.scss"));
|
|
25
|
-
|
|
26
22
|
/**
|
|
27
23
|
* External dependencies
|
|
28
24
|
*/
|
|
@@ -30,18 +26,12 @@ var _style = _interopRequireDefault(require("./style.scss"));
|
|
|
30
26
|
/**
|
|
31
27
|
* WordPress dependencies
|
|
32
28
|
*/
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Internal dependencies
|
|
36
|
-
*/
|
|
37
29
|
const Header = (0, _element.memo)(function EditorHeader({
|
|
38
30
|
editTitle,
|
|
39
31
|
setTitleRef,
|
|
40
|
-
title
|
|
41
|
-
getStylesFromColorScheme
|
|
32
|
+
title
|
|
42
33
|
}) {
|
|
43
34
|
const [wrapperStyles] = (0, _blockEditor.useEditorWrapperStyles)();
|
|
44
|
-
const blockHolderFocusedStyle = getStylesFromColorScheme(_style.default.blockHolderFocused, _style.default.blockHolderFocusedDark);
|
|
45
35
|
return (0, _element.createElement)(_reactNative.View, {
|
|
46
36
|
style: wrapperStyles
|
|
47
37
|
}, (0, _element.createElement)(_editor.PostTitle, {
|
|
@@ -49,8 +39,6 @@ const Header = (0, _element.memo)(function EditorHeader({
|
|
|
49
39
|
title: title,
|
|
50
40
|
onUpdate: editTitle,
|
|
51
41
|
placeholder: (0, _i18n.__)('Add title'),
|
|
52
|
-
borderStyle: _style.default.blockHolderFullBordered,
|
|
53
|
-
focusedBorderColor: blockHolderFocusedStyle.borderColor,
|
|
54
42
|
accessibilityLabel: "post-title"
|
|
55
43
|
}));
|
|
56
44
|
}, (prevProps, nextProps) => prevProps.title === nextProps.title);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/header.native.js"],"names":["Header","EditorHeader","editTitle","setTitleRef","title","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/header.native.js"],"names":["Header","EditorHeader","editTitle","setTitleRef","title","wrapperStyles","prevProps","nextProps","select","getEditedPostAttribute","dispatch","editPost","clearSelectedBlock","blockEditorStore","withPreferredColorScheme"],"mappings":";;;;;;;AAQA;;AALA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;AAWA,MAAMA,MAAM,GAAG,mBACd,SAASC,YAAT,CAAuB;AAAEC,EAAAA,SAAF;AAAaC,EAAAA,WAAb;AAA0BC,EAAAA;AAA1B,CAAvB,EAA2D;AAC1D,QAAM,CAAEC,aAAF,IAAoB,0CAA1B;AACA,SACC,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAGA;AAAd,KACC,4BAAC,iBAAD;AACC,IAAA,QAAQ,EAAGF,WADZ;AAEC,IAAA,KAAK,EAAGC,KAFT;AAGC,IAAA,QAAQ,EAAGF,SAHZ;AAIC,IAAA,WAAW,EAAG,cAAI,WAAJ,CAJf;AAKC,IAAA,kBAAkB,EAAC;AALpB,IADD,CADD;AAWA,CAda,EAed,CAAEI,SAAF,EAAaC,SAAb,KAA4BD,SAAS,CAACF,KAAV,KAAoBG,SAAS,CAACH,KAf5C,CAAf;;eAkBe,sBAAS,CACvB,sBAAcI,MAAF,IAAc;AACzB,QAAM;AAAEC,IAAAA;AAAF,MAA6BD,MAAM,CAAE,aAAF,CAAzC;AAEA,SAAO;AACNJ,IAAAA,KAAK,EAAEK,sBAAsB,CAAE,OAAF;AADvB,GAAP;AAGA,CAND,CADuB,EAQvB,wBAAgBC,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA;AAAF,MAAeD,QAAQ,CAAE,aAAF,CAA7B;AAEA,QAAM;AAAEE,IAAAA;AAAF,MAAyBF,QAAQ,CAAEG,kBAAF,CAAvC;AAEA,SAAO;AACND,IAAAA,kBADM;;AAENV,IAAAA,SAAS,CAAEE,KAAF,EAAU;AAClBO,MAAAA,QAAQ,CAAE;AAAEP,QAAAA;AAAF,OAAF,CAAR;AACA;;AAJK,GAAP;AAMA,CAXD,CARuB,EAoBvBU,iCApBuB,CAAT,EAqBVd,MArBU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { memo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose, withPreferredColorScheme } from '@wordpress/compose';\nimport { PostTitle } from '@wordpress/editor';\nimport {\n\tstore as blockEditorStore,\n\tuseEditorWrapperStyles,\n} from '@wordpress/block-editor';\n\nconst Header = memo(\n\tfunction EditorHeader( { editTitle, setTitleRef, title } ) {\n\t\tconst [ wrapperStyles ] = useEditorWrapperStyles();\n\t\treturn (\n\t\t\t<View style={ wrapperStyles }>\n\t\t\t\t<PostTitle\n\t\t\t\t\tinnerRef={ setTitleRef }\n\t\t\t\t\ttitle={ title }\n\t\t\t\t\tonUpdate={ editTitle }\n\t\t\t\t\tplaceholder={ __( 'Add title' ) }\n\t\t\t\t\taccessibilityLabel=\"post-title\"\n\t\t\t\t/>\n\t\t\t</View>\n\t\t);\n\t},\n\t( prevProps, nextProps ) => prevProps.title === nextProps.title\n);\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( 'core/editor' );\n\n\t\treturn {\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost } = dispatch( 'core/editor' );\n\n\t\tconst { clearSelectedBlock } = dispatch( blockEditorStore );\n\n\t\treturn {\n\t\t\tclearSelectedBlock,\n\t\t\teditTitle( title ) {\n\t\t\t\teditPost( { title } );\n\t\t\t},\n\t\t};\n\t} ),\n\twithPreferredColorScheme,\n] )( Header );\n"]}
|
|
@@ -302,7 +302,7 @@ function VisualEditor({
|
|
|
302
302
|
className: (0, _classnames.default)('edit-post-visual-editor', {
|
|
303
303
|
'is-template-mode': isTemplateMode
|
|
304
304
|
})
|
|
305
|
-
}, (0, _element.createElement)(
|
|
305
|
+
}, (0, _element.createElement)(_components.__unstableMotion.div, {
|
|
306
306
|
className: "edit-post-visual-editor__content-area",
|
|
307
307
|
animate: {
|
|
308
308
|
padding: isTemplateMode ? '48px 48px 0' : 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"names":["LayoutStyle","useLayoutClasses","useLayoutStyles","blockEditorPrivateApis","isGutenbergPlugin","process","env","IS_GUTENBERG_PLUGIN","MaybeIframe","children","contentRef","shouldIframe","styles","style","ref","flex","width","height","display","getPostContentAttributes","blocks","i","length","name","attributes","innerBlocks","nestedPostContent","VisualEditor","deviceType","isWelcomeGuideVisible","isTemplateMode","postContentAttributes","editedPostTemplate","wrapperBlockName","wrapperUniqueId","isBlockBasedTheme","hasV3BlocksOnly","select","isFeatureActive","isEditingTemplate","getEditedPostTemplate","__experimentalGetPreviewDeviceType","editPostStore","getCurrentPostId","getCurrentPostType","getEditorSettings","editorStore","getBlockTypes","blocksStore","_isTemplateMode","_wrapperBlockName","editorSettings","supportsTemplateMode","canEditTemplate","coreStore","canUser","undefined","__unstableIsBlockBasedTheme","every","type","apiVersion","isCleanNewPost","hasMetaBoxes","hasRootPaddingAwareAlignments","isFocusMode","themeHasDisabledLayoutStyles","themeSupportsLayout","_settings","blockEditorStore","getSettings","disableLayoutStyles","supportsLayout","focusMode","__experimentalFeatures","useRootPaddingAwareAlignments","desktopCanvasStyles","margin","flexFlow","background","templateModeStyles","borderRadius","border","borderBottom","resizedCanvasStyles","globalLayoutSettings","previewMode","toLowerCase","animatedStyles","paddingBottom","blockSelectionClearerRef","fallbackLayout","newestPostContentAttributes","content","parseableContent","layout","align","postContentLayoutClasses","blockListLayoutClass","postContentLayoutStyles","postContentLayout","inherit","contentSize","wideSize","blockListLayout","titleRef","current","focus","css","alignCSS","padding"],"mappings":";;;;;;;;;AA8BA;;AA3BA;;AAKA;;AAKA;;AAkBA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAzCA;AACA;AACA;;AAGA;AACA;AACA;;AA8BA;AACA;AACA;AAIA,MAAM;AAAEA,EAAAA,WAAF;AAAeC,EAAAA,gBAAf;AAAiCC,EAAAA;AAAjC,IAAqD,wBAC1DC,wBAD0D,CAA3D;AAIA,MAAMC,iBAAiB,GAAGC,OAAO,CAACC,GAAR,CAAYC,mBAAZ,GAAkC,IAAlC,GAAyC,KAAnE;;AAEA,SAASC,WAAT,CAAsB;AAAEC,EAAAA,QAAF;AAAYC,EAAAA,UAAZ;AAAwBC,EAAAA,YAAxB;AAAsCC,EAAAA,MAAtC;AAA8CC,EAAAA;AAA9C,CAAtB,EAA8E;AAC7E,QAAMC,GAAG,GAAG,qDAAZ;;AAEA,MAAK,CAAEH,YAAP,EAAsB;AACrB,WACC,qDACC,4BAAC,mCAAD;AAAc,MAAA,MAAM,EAAGC;AAAvB,MADD,EAEC,4BAAC,wBAAD;AACC,MAAA,GAAG,EAAGF,UADP;AAEC,MAAA,SAAS,EAAC,uBAFX;AAGC,MAAA,KAAK,EAAG;AAAEK,QAAAA,IAAI,EAAE,GAAR;AAAa,WAAGF;A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,KAKC,4BAAC,WAAD;AACC,IAAA,YAAY,EACT,CAAEjD,eAAe,IAChBhC,iBAAiB,IAAI+B,iBADtB,KAED,CAAE2B,YAFH,IAGAhC,cAHA,IAIAF,UAAU,KAAK,QAJf,IAKAA,UAAU,KAAK,QAPjB;AASC,IAAA,UAAU,EAAGlB,UATd;AAUC,IAAA,MAAM,EAAGE;AAVV,KAYGsD,mBAAmB,IACpB,CAAED,4BADD,IAED,CAAEnC,cAFD,IAGA,qDACC,4BAAC,WAAD;AACC,IAAA,QAAQ,EAAC,8CADV;AAEC,IAAA,MAAM,EAAG4D;AAFV,IADD,EAKC,4BAAC,WAAD;AACC,IAAA,QAAQ,EAAC,oDADV;AAEC,IAAA,MAAM,EAAGa;AAFV,IALD,EASGR,KAAK,IACN,4BAAC,WAAD;AAAa,IAAA,GAAG,EAAGa;AAAnB,IAVF,EAYGV,uBAAuB,IACxB,4BAAC,WAAD;AACC,IAAA,MAAM,EAAGC,iBADV;AAEC,IAAA,GAAG,EAAGD;AAFP,IAbF,CAfH,EAmCG,CAAEpE,cAAF,IACD;AACC,IAAA,SAAS,EAAG,yBACX,6CADW,EAEX;AACC,uBAAiBkC,WADlB;AAEC,4BACCD;AAHF,KAFW,CADb;AASC,IAAA,eAAe,EAAG;AATnB,KAWC,4BAAC,iBAAD;AAAW,IAAA,GAAG,EAAGyC;AAAjB,IAXD,CApCF,EAkDC,4BAAC,4CAAD;AACC,IAAA,SAAS,EAAGvE,gBADb;AAEC,IAAA,QAAQ,EAAGC;AAFZ,KAIC,4BAAC,sBAAD;AACC,IAAA,SAAS,EACRJ,cAAc,GACX,gBADW,GAEV,GAAGmE,oBAAsB,wBAHrB,CAG6C;AAJvD;AAMC,IAAA,MAAM,EAAGM;AANV,IAJD,CAlDD,CALD,CAPD,CAPD,CADD;AAwFA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tVisualEditorGlobalKeyboardShortcuts,\n\tPostTitle,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport {\n\tWritingFlow,\n\tBlockList,\n\tBlockTools,\n\tstore as blockEditorStore,\n\t__unstableUseBlockSelectionClearer as useBlockSelectionClearer,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseClipboardHandler as useClipboardHandler,\n\t__unstableUseTypingObserver as useTypingObserver,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\tuseSetting,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\t__unstableIframe as Iframe,\n\t__experimentalRecursionProvider as RecursionProvider,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useMemo } from '@wordpress/element';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { parse, store as blocksStore } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { LayoutStyle, useLayoutClasses, useLayoutStyles } = unlock(\n\tblockEditorPrivateApis\n);\n\nconst isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false;\n\nfunction MaybeIframe( { children, contentRef, shouldIframe, styles, style } ) {\n\tconst ref = useMouseMoveTypingReset();\n\n\tif ( ! shouldIframe ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorStyles styles={ styles } />\n\t\t\t\t<WritingFlow\n\t\t\t\t\tref={ contentRef }\n\t\t\t\t\tclassName=\"editor-styles-wrapper\"\n\t\t\t\t\tstyle={ { flex: '1', ...style } }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</WritingFlow>\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Iframe\n\t\t\tref={ ref }\n\t\t\tcontentRef={ contentRef }\n\t\t\tstyle={ { width: '100%', height: '100%', display: 'block' } }\n\t\t\tname=\"editor-canvas\"\n\t\t>\n\t\t\t<EditorStyles styles={ styles } />\n\t\t\t{ children }\n\t\t</Iframe>\n\t);\n}\n\n/**\n * Given an array of nested blocks, find the first Post Content\n * block inside it, recursing through any nesting levels,\n * and return its attributes.\n *\n * @param {Array} blocks A list of blocks.\n *\n * @return {Object | undefined} The Post Content block.\n */\nfunction getPostContentAttributes( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn blocks[ i ].attributes;\n\t\t}\n\t\tif ( blocks[ i ].innerBlocks.length ) {\n\t\t\tconst nestedPostContent = getPostContentAttributes(\n\t\t\t\tblocks[ i ].innerBlocks\n\t\t\t);\n\n\t\t\tif ( nestedPostContent ) {\n\t\t\t\treturn nestedPostContent;\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tdeviceType,\n\t\tisWelcomeGuideVisible,\n\t\tisTemplateMode,\n\t\tpostContentAttributes,\n\t\teditedPostTemplate = {},\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t\tisBlockBasedTheme,\n\t\thasV3BlocksOnly,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisFeatureActive,\n\t\t\tisEditingTemplate,\n\t\t\tgetEditedPostTemplate,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t} = select( editPostStore );\n\t\tconst { getCurrentPostId, getCurrentPostType, getEditorSettings } =\n\t\t\tselect( editorStore );\n\t\tconst { getBlockTypes } = select( blocksStore );\n\t\tconst _isTemplateMode = isEditingTemplate();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( getCurrentPostType() === 'wp_block' ) {\n\t\t\t_wrapperBlockName = 'core/block';\n\t\t} else if ( ! _isTemplateMode ) {\n\t\t\t_wrapperBlockName = 'core/post-content';\n\t\t}\n\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst supportsTemplateMode = editorSettings.supportsTemplateMode;\n\t\tconst canEditTemplate = select( coreStore ).canUser(\n\t\t\t'create',\n\t\t\t'templates'\n\t\t);\n\n\t\treturn {\n\t\t\tdeviceType: __experimentalGetPreviewDeviceType(),\n\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t\tisTemplateMode: _isTemplateMode,\n\t\t\tpostContentAttributes: getEditorSettings().postContentAttributes,\n\t\t\t// Post template fetch returns a 404 on classic themes, which\n\t\t\t// messes with e2e tests, so check it's a block theme first.\n\t\t\teditedPostTemplate:\n\t\t\t\tsupportsTemplateMode && canEditTemplate\n\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t: undefined,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t\tisBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme,\n\t\t\thasV3BlocksOnly: getBlockTypes().every( ( type ) => {\n\t\t\t\treturn type.apiVersion >= 3;\n\t\t\t} ),\n\t\t};\n\t}, [] );\n\tconst { isCleanNewPost } = useSelect( editorStore );\n\tconst hasMetaBoxes = useSelect(\n\t\t( select ) => select( editPostStore ).hasMetaBoxes(),\n\t\t[]\n\t);\n\tconst {\n\t\thasRootPaddingAwareAlignments,\n\t\tisFocusMode,\n\t\tthemeHasDisabledLayoutStyles,\n\t\tthemeSupportsLayout,\n\t} = useSelect( ( select ) => {\n\t\tconst _settings = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tthemeHasDisabledLayoutStyles: _settings.disableLayoutStyles,\n\t\t\tthemeSupportsLayout: _settings.supportsLayout,\n\t\t\tisFocusMode: _settings.focusMode,\n\t\t\thasRootPaddingAwareAlignments:\n\t\t\t\t_settings.__experimentalFeatures?.useRootPaddingAwareAlignments,\n\t\t};\n\t}, [] );\n\tconst desktopCanvasStyles = {\n\t\theight: '100%',\n\t\twidth: '100%',\n\t\tmargin: 0,\n\t\tdisplay: 'flex',\n\t\tflexFlow: 'column',\n\t\t// Default background color so that grey\n\t\t// .edit-post-editor-regions__content color doesn't show through.\n\t\tbackground: 'white',\n\t};\n\tconst templateModeStyles = {\n\t\t...desktopCanvasStyles,\n\t\tborderRadius: '2px 2px 0 0',\n\t\tborder: '1px solid #ddd',\n\t\tborderBottom: 0,\n\t};\n\tconst resizedCanvasStyles = useResizeCanvas( deviceType, isTemplateMode );\n\tconst globalLayoutSettings = useSetting( 'layout' );\n\tconst previewMode = 'is-' + deviceType.toLowerCase() + '-preview';\n\n\tlet animatedStyles = isTemplateMode\n\t\t? templateModeStyles\n\t\t: desktopCanvasStyles;\n\tif ( resizedCanvasStyles ) {\n\t\tanimatedStyles = resizedCanvasStyles;\n\t}\n\n\tlet paddingBottom;\n\n\t// Add a constant padding for the typewritter effect. When typing at the\n\t// bottom, there needs to be room to scroll up.\n\tif ( ! hasMetaBoxes && ! resizedCanvasStyles && ! isTemplateMode ) {\n\t\tpaddingBottom = '40vh';\n\t}\n\n\tconst ref = useRef();\n\tconst contentRef = useMergeRefs( [\n\t\tref,\n\t\tuseClipboardHandler(),\n\t\tuseTypewriter(),\n\t\tuseTypingObserver(),\n\t\tuseBlockSelectionClearer(),\n\t] );\n\n\tconst blockSelectionClearerRef = useBlockSelectionClearer();\n\n\t// fallbackLayout is used if there is no Post Content,\n\t// and for Post Title.\n\tconst fallbackLayout = useMemo( () => {\n\t\tif ( isTemplateMode ) {\n\t\t\treturn { type: 'default' };\n\t\t}\n\n\t\tif ( themeSupportsLayout ) {\n\t\t\t// We need to ensure support for wide and full alignments,\n\t\t\t// so we add the constrained type.\n\t\t\treturn { ...globalLayoutSettings, type: 'constrained' };\n\t\t}\n\t\t// Set default layout for classic themes so all alignments are supported.\n\t\treturn { type: 'default' };\n\t}, [ isTemplateMode, themeSupportsLayout, globalLayoutSettings ] );\n\n\tconst newestPostContentAttributes = useMemo( () => {\n\t\tif ( ! editedPostTemplate?.content && ! editedPostTemplate?.blocks ) {\n\t\t\treturn postContentAttributes;\n\t\t}\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn getPostContentAttributes( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn getPostContentAttributes( parse( parseableContent ) ) || {};\n\t}, [\n\t\teditedPostTemplate?.content,\n\t\teditedPostTemplate?.blocks,\n\t\tpostContentAttributes,\n\t] );\n\n\tconst { layout = {}, align = '' } = newestPostContentAttributes || {};\n\n\tconst postContentLayoutClasses = useLayoutClasses(\n\t\tnewestPostContentAttributes,\n\t\t'core/post-content'\n\t);\n\n\tconst blockListLayoutClass = classnames(\n\t\t{\n\t\t\t'is-layout-flow': ! themeSupportsLayout,\n\t\t},\n\t\tthemeSupportsLayout && postContentLayoutClasses,\n\t\talign && `align${ align }`\n\t);\n\n\tconst postContentLayoutStyles = useLayoutStyles(\n\t\tnewestPostContentAttributes,\n\t\t'core/post-content',\n\t\t'.block-editor-block-list__layout.is-root-container'\n\t);\n\n\t// Update type for blocks using legacy layouts.\n\tconst postContentLayout = useMemo( () => {\n\t\treturn layout &&\n\t\t\t( layout?.type === 'constrained' ||\n\t\t\t\tlayout?.inherit ||\n\t\t\t\tlayout?.contentSize ||\n\t\t\t\tlayout?.wideSize )\n\t\t\t? { ...globalLayoutSettings, ...layout, type: 'constrained' }\n\t\t\t: { ...globalLayoutSettings, ...layout, type: 'default' };\n\t}, [\n\t\tlayout?.type,\n\t\tlayout?.inherit,\n\t\tlayout?.contentSize,\n\t\tlayout?.wideSize,\n\t\tglobalLayoutSettings,\n\t] );\n\n\t// If there is a Post Content block we use its layout for the block list;\n\t// if not, this must be a classic theme, in which case we use the fallback layout.\n\tconst blockListLayout = postContentAttributes\n\t\t? postContentLayout\n\t\t: fallbackLayout;\n\n\tconst titleRef = useRef();\n\tuseEffect( () => {\n\t\tif ( isWelcomeGuideVisible || ! isCleanNewPost() ) {\n\t\t\treturn;\n\t\t}\n\t\ttitleRef?.current?.focus();\n\t}, [ isWelcomeGuideVisible, isCleanNewPost ] );\n\n\tstyles = useMemo(\n\t\t() => [\n\t\t\t...styles,\n\t\t\t{\n\t\t\t\t// We should move this in to future to the body.\n\t\t\t\tcss:\n\t\t\t\t\t`.edit-post-visual-editor__post-title-wrapper{margin-top:4rem}` +\n\t\t\t\t\t( paddingBottom\n\t\t\t\t\t\t? `body{padding-bottom:${ paddingBottom }}`\n\t\t\t\t\t\t: '' ),\n\t\t\t},\n\t\t],\n\t\t[ styles ]\n\t);\n\n\t// Add some styles for alignwide/alignfull Post Content and its children.\n\tconst alignCSS = `.is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);}\n\t\t.is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`;\n\n\treturn (\n\t\t<BlockTools\n\t\t\t__unstableContentRef={ ref }\n\t\t\tclassName={ classnames( 'edit-post-visual-editor', {\n\t\t\t\t'is-template-mode': isTemplateMode,\n\t\t\t} ) }\n\t\t>\n\t\t\t<VisualEditorGlobalKeyboardShortcuts />\n\t\t\t<motion.div\n\t\t\t\tclassName=\"edit-post-visual-editor__content-area\"\n\t\t\t\tanimate={ {\n\t\t\t\t\tpadding: isTemplateMode ? '48px 48px 0' : 0,\n\t\t\t\t} }\n\t\t\t\tref={ blockSelectionClearerRef }\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tanimate={ animatedStyles }\n\t\t\t\t\tinitial={ desktopCanvasStyles }\n\t\t\t\t\tclassName={ previewMode }\n\t\t\t\t>\n\t\t\t\t\t<MaybeIframe\n\t\t\t\t\t\tshouldIframe={\n\t\t\t\t\t\t\t( ( hasV3BlocksOnly ||\n\t\t\t\t\t\t\t\t( isGutenbergPlugin && isBlockBasedTheme ) ) &&\n\t\t\t\t\t\t\t\t! hasMetaBoxes ) ||\n\t\t\t\t\t\t\tisTemplateMode ||\n\t\t\t\t\t\t\tdeviceType === 'Tablet' ||\n\t\t\t\t\t\t\tdeviceType === 'Mobile'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\tstyles={ styles }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ themeSupportsLayout &&\n\t\t\t\t\t\t\t! themeHasDisabledLayoutStyles &&\n\t\t\t\t\t\t\t! isTemplateMode && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\tselector=\".edit-post-visual-editor__post-title-wrapper\"\n\t\t\t\t\t\t\t\t\t\tlayout={ fallbackLayout }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\tselector=\".block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\t\t\tlayout={ blockListLayout }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ align && (\n\t\t\t\t\t\t\t\t\t\t<LayoutStyle css={ alignCSS } />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ postContentLayoutStyles && (\n\t\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\t\tlayout={ postContentLayout }\n\t\t\t\t\t\t\t\t\t\t\tcss={ postContentLayoutStyles }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! isTemplateMode && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t'edit-post-visual-editor__post-title-wrapper',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'is-focus-mode': isFocusMode,\n\t\t\t\t\t\t\t\t\t\t'has-global-padding':\n\t\t\t\t\t\t\t\t\t\t\thasRootPaddingAwareAlignments,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tcontentEditable={ false }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostTitle ref={ titleRef } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<RecursionProvider\n\t\t\t\t\t\t\tblockName={ wrapperBlockName }\n\t\t\t\t\t\t\tuniqueId={ wrapperUniqueId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\tisTemplateMode\n\t\t\t\t\t\t\t\t\t\t? 'wp-site-blocks'\n\t\t\t\t\t\t\t\t\t\t: `${ blockListLayoutClass } wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules.\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlayout={ blockListLayout }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</RecursionProvider>\n\t\t\t\t\t</MaybeIframe>\n\t\t\t\t</motion.div>\n\t\t\t</motion.div>\n\t\t</BlockTools>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"names":["LayoutStyle","useLayoutClasses","useLayoutStyles","blockEditorPrivateApis","isGutenbergPlugin","process","env","IS_GUTENBERG_PLUGIN","MaybeIframe","children","contentRef","shouldIframe","styles","style","ref","flex","width","height","display","getPostContentAttributes","blocks","i","length","name","attributes","innerBlocks","nestedPostContent","VisualEditor","deviceType","isWelcomeGuideVisible","isTemplateMode","postContentAttributes","editedPostTemplate","wrapperBlockName","wrapperUniqueId","isBlockBasedTheme","hasV3BlocksOnly","select","isFeatureActive","isEditingTemplate","getEditedPostTemplate","__experimentalGetPreviewDeviceType","editPostStore","getCurrentPostId","getCurrentPostType","getEditorSettings","editorStore","getBlockTypes","blocksStore","_isTemplateMode","_wrapperBlockName","editorSettings","supportsTemplateMode","canEditTemplate","coreStore","canUser","undefined","__unstableIsBlockBasedTheme","every","type","apiVersion","isCleanNewPost","hasMetaBoxes","hasRootPaddingAwareAlignments","isFocusMode","themeHasDisabledLayoutStyles","themeSupportsLayout","_settings","blockEditorStore","getSettings","disableLayoutStyles","supportsLayout","focusMode","__experimentalFeatures","useRootPaddingAwareAlignments","desktopCanvasStyles","margin","flexFlow","background","templateModeStyles","borderRadius","border","borderBottom","resizedCanvasStyles","globalLayoutSettings","previewMode","toLowerCase","animatedStyles","paddingBottom","blockSelectionClearerRef","fallbackLayout","newestPostContentAttributes","content","parseableContent","layout","align","postContentLayoutClasses","blockListLayoutClass","postContentLayoutStyles","postContentLayout","inherit","contentSize","wideSize","blockListLayout","titleRef","current","focus","css","alignCSS","padding"],"mappings":";;;;;;;;;AA0BA;;AAvBA;;AAKA;;AACA;;AAkBA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AArCA;AACA;AACA;;AAGA;AACA;AACA;;AA0BA;AACA;AACA;AAIA,MAAM;AAAEA,EAAAA,WAAF;AAAeC,EAAAA,gBAAf;AAAiCC,EAAAA;AAAjC,IAAqD,wBAC1DC,wBAD0D,CAA3D;AAIA,MAAMC,iBAAiB,GAAGC,OAAO,CAACC,GAAR,CAAYC,mBAAZ,GAAkC,IAAlC,GAAyC,KAAnE;;AAEA,SAASC,WAAT,CAAsB;AAAEC,EAAAA,QAAF;AAAYC,EAAAA,UAAZ;AAAwBC,EAAAA,YAAxB;AAAsCC,EAAAA,MAAtC;AAA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GC;AAFZ,KAIC,4BAAC,sBAAD;AACC,IAAA,SAAS,EACRJ,cAAc,GACX,gBADW,GAEV,GAAGmE,oBAAsB,wBAHrB,CAG6C;AAJvD;AAMC,IAAA,MAAM,EAAGM;AANV,IAJD,CAlDD,CALD,CAPD,CAND,CADD;AAuFA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { PostTitle, store as editorStore } from '@wordpress/editor';\nimport {\n\tWritingFlow,\n\tBlockList,\n\tBlockTools,\n\tstore as blockEditorStore,\n\t__unstableUseBlockSelectionClearer as useBlockSelectionClearer,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseClipboardHandler as useClipboardHandler,\n\t__unstableUseTypingObserver as useTypingObserver,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\tuseSetting,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\t__unstableIframe as Iframe,\n\t__experimentalRecursionProvider as RecursionProvider,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useMemo } from '@wordpress/element';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { parse, store as blocksStore } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { LayoutStyle, useLayoutClasses, useLayoutStyles } = unlock(\n\tblockEditorPrivateApis\n);\n\nconst isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false;\n\nfunction MaybeIframe( { children, contentRef, shouldIframe, styles, style } ) {\n\tconst ref = useMouseMoveTypingReset();\n\n\tif ( ! shouldIframe ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorStyles styles={ styles } />\n\t\t\t\t<WritingFlow\n\t\t\t\t\tref={ contentRef }\n\t\t\t\t\tclassName=\"editor-styles-wrapper\"\n\t\t\t\t\tstyle={ { flex: '1', ...style } }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</WritingFlow>\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Iframe\n\t\t\tref={ ref }\n\t\t\tcontentRef={ contentRef }\n\t\t\tstyle={ { width: '100%', height: '100%', display: 'block' } }\n\t\t\tname=\"editor-canvas\"\n\t\t>\n\t\t\t<EditorStyles styles={ styles } />\n\t\t\t{ children }\n\t\t</Iframe>\n\t);\n}\n\n/**\n * Given an array of nested blocks, find the first Post Content\n * block inside it, recursing through any nesting levels,\n * and return its attributes.\n *\n * @param {Array} blocks A list of blocks.\n *\n * @return {Object | undefined} The Post Content block.\n */\nfunction getPostContentAttributes( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn blocks[ i ].attributes;\n\t\t}\n\t\tif ( blocks[ i ].innerBlocks.length ) {\n\t\t\tconst nestedPostContent = getPostContentAttributes(\n\t\t\t\tblocks[ i ].innerBlocks\n\t\t\t);\n\n\t\t\tif ( nestedPostContent ) {\n\t\t\t\treturn nestedPostContent;\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tdeviceType,\n\t\tisWelcomeGuideVisible,\n\t\tisTemplateMode,\n\t\tpostContentAttributes,\n\t\teditedPostTemplate = {},\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t\tisBlockBasedTheme,\n\t\thasV3BlocksOnly,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisFeatureActive,\n\t\t\tisEditingTemplate,\n\t\t\tgetEditedPostTemplate,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t} = select( editPostStore );\n\t\tconst { getCurrentPostId, getCurrentPostType, getEditorSettings } =\n\t\t\tselect( editorStore );\n\t\tconst { getBlockTypes } = select( blocksStore );\n\t\tconst _isTemplateMode = isEditingTemplate();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( getCurrentPostType() === 'wp_block' ) {\n\t\t\t_wrapperBlockName = 'core/block';\n\t\t} else if ( ! _isTemplateMode ) {\n\t\t\t_wrapperBlockName = 'core/post-content';\n\t\t}\n\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst supportsTemplateMode = editorSettings.supportsTemplateMode;\n\t\tconst canEditTemplate = select( coreStore ).canUser(\n\t\t\t'create',\n\t\t\t'templates'\n\t\t);\n\n\t\treturn {\n\t\t\tdeviceType: __experimentalGetPreviewDeviceType(),\n\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t\tisTemplateMode: _isTemplateMode,\n\t\t\tpostContentAttributes: getEditorSettings().postContentAttributes,\n\t\t\t// Post template fetch returns a 404 on classic themes, which\n\t\t\t// messes with e2e tests, so check it's a block theme first.\n\t\t\teditedPostTemplate:\n\t\t\t\tsupportsTemplateMode && canEditTemplate\n\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t: undefined,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t\tisBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme,\n\t\t\thasV3BlocksOnly: getBlockTypes().every( ( type ) => {\n\t\t\t\treturn type.apiVersion >= 3;\n\t\t\t} ),\n\t\t};\n\t}, [] );\n\tconst { isCleanNewPost } = useSelect( editorStore );\n\tconst hasMetaBoxes = useSelect(\n\t\t( select ) => select( editPostStore ).hasMetaBoxes(),\n\t\t[]\n\t);\n\tconst {\n\t\thasRootPaddingAwareAlignments,\n\t\tisFocusMode,\n\t\tthemeHasDisabledLayoutStyles,\n\t\tthemeSupportsLayout,\n\t} = useSelect( ( select ) => {\n\t\tconst _settings = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tthemeHasDisabledLayoutStyles: _settings.disableLayoutStyles,\n\t\t\tthemeSupportsLayout: _settings.supportsLayout,\n\t\t\tisFocusMode: _settings.focusMode,\n\t\t\thasRootPaddingAwareAlignments:\n\t\t\t\t_settings.__experimentalFeatures?.useRootPaddingAwareAlignments,\n\t\t};\n\t}, [] );\n\tconst desktopCanvasStyles = {\n\t\theight: '100%',\n\t\twidth: '100%',\n\t\tmargin: 0,\n\t\tdisplay: 'flex',\n\t\tflexFlow: 'column',\n\t\t// Default background color so that grey\n\t\t// .edit-post-editor-regions__content color doesn't show through.\n\t\tbackground: 'white',\n\t};\n\tconst templateModeStyles = {\n\t\t...desktopCanvasStyles,\n\t\tborderRadius: '2px 2px 0 0',\n\t\tborder: '1px solid #ddd',\n\t\tborderBottom: 0,\n\t};\n\tconst resizedCanvasStyles = useResizeCanvas( deviceType, isTemplateMode );\n\tconst globalLayoutSettings = useSetting( 'layout' );\n\tconst previewMode = 'is-' + deviceType.toLowerCase() + '-preview';\n\n\tlet animatedStyles = isTemplateMode\n\t\t? templateModeStyles\n\t\t: desktopCanvasStyles;\n\tif ( resizedCanvasStyles ) {\n\t\tanimatedStyles = resizedCanvasStyles;\n\t}\n\n\tlet paddingBottom;\n\n\t// Add a constant padding for the typewritter effect. When typing at the\n\t// bottom, there needs to be room to scroll up.\n\tif ( ! hasMetaBoxes && ! resizedCanvasStyles && ! isTemplateMode ) {\n\t\tpaddingBottom = '40vh';\n\t}\n\n\tconst ref = useRef();\n\tconst contentRef = useMergeRefs( [\n\t\tref,\n\t\tuseClipboardHandler(),\n\t\tuseTypewriter(),\n\t\tuseTypingObserver(),\n\t\tuseBlockSelectionClearer(),\n\t] );\n\n\tconst blockSelectionClearerRef = useBlockSelectionClearer();\n\n\t// fallbackLayout is used if there is no Post Content,\n\t// and for Post Title.\n\tconst fallbackLayout = useMemo( () => {\n\t\tif ( isTemplateMode ) {\n\t\t\treturn { type: 'default' };\n\t\t}\n\n\t\tif ( themeSupportsLayout ) {\n\t\t\t// We need to ensure support for wide and full alignments,\n\t\t\t// so we add the constrained type.\n\t\t\treturn { ...globalLayoutSettings, type: 'constrained' };\n\t\t}\n\t\t// Set default layout for classic themes so all alignments are supported.\n\t\treturn { type: 'default' };\n\t}, [ isTemplateMode, themeSupportsLayout, globalLayoutSettings ] );\n\n\tconst newestPostContentAttributes = useMemo( () => {\n\t\tif ( ! editedPostTemplate?.content && ! editedPostTemplate?.blocks ) {\n\t\t\treturn postContentAttributes;\n\t\t}\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn getPostContentAttributes( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn getPostContentAttributes( parse( parseableContent ) ) || {};\n\t}, [\n\t\teditedPostTemplate?.content,\n\t\teditedPostTemplate?.blocks,\n\t\tpostContentAttributes,\n\t] );\n\n\tconst { layout = {}, align = '' } = newestPostContentAttributes || {};\n\n\tconst postContentLayoutClasses = useLayoutClasses(\n\t\tnewestPostContentAttributes,\n\t\t'core/post-content'\n\t);\n\n\tconst blockListLayoutClass = classnames(\n\t\t{\n\t\t\t'is-layout-flow': ! themeSupportsLayout,\n\t\t},\n\t\tthemeSupportsLayout && postContentLayoutClasses,\n\t\talign && `align${ align }`\n\t);\n\n\tconst postContentLayoutStyles = useLayoutStyles(\n\t\tnewestPostContentAttributes,\n\t\t'core/post-content',\n\t\t'.block-editor-block-list__layout.is-root-container'\n\t);\n\n\t// Update type for blocks using legacy layouts.\n\tconst postContentLayout = useMemo( () => {\n\t\treturn layout &&\n\t\t\t( layout?.type === 'constrained' ||\n\t\t\t\tlayout?.inherit ||\n\t\t\t\tlayout?.contentSize ||\n\t\t\t\tlayout?.wideSize )\n\t\t\t? { ...globalLayoutSettings, ...layout, type: 'constrained' }\n\t\t\t: { ...globalLayoutSettings, ...layout, type: 'default' };\n\t}, [\n\t\tlayout?.type,\n\t\tlayout?.inherit,\n\t\tlayout?.contentSize,\n\t\tlayout?.wideSize,\n\t\tglobalLayoutSettings,\n\t] );\n\n\t// If there is a Post Content block we use its layout for the block list;\n\t// if not, this must be a classic theme, in which case we use the fallback layout.\n\tconst blockListLayout = postContentAttributes\n\t\t? postContentLayout\n\t\t: fallbackLayout;\n\n\tconst titleRef = useRef();\n\tuseEffect( () => {\n\t\tif ( isWelcomeGuideVisible || ! isCleanNewPost() ) {\n\t\t\treturn;\n\t\t}\n\t\ttitleRef?.current?.focus();\n\t}, [ isWelcomeGuideVisible, isCleanNewPost ] );\n\n\tstyles = useMemo(\n\t\t() => [\n\t\t\t...styles,\n\t\t\t{\n\t\t\t\t// We should move this in to future to the body.\n\t\t\t\tcss:\n\t\t\t\t\t`.edit-post-visual-editor__post-title-wrapper{margin-top:4rem}` +\n\t\t\t\t\t( paddingBottom\n\t\t\t\t\t\t? `body{padding-bottom:${ paddingBottom }}`\n\t\t\t\t\t\t: '' ),\n\t\t\t},\n\t\t],\n\t\t[ styles ]\n\t);\n\n\t// Add some styles for alignwide/alignfull Post Content and its children.\n\tconst alignCSS = `.is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);}\n\t\t.is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`;\n\n\treturn (\n\t\t<BlockTools\n\t\t\t__unstableContentRef={ ref }\n\t\t\tclassName={ classnames( 'edit-post-visual-editor', {\n\t\t\t\t'is-template-mode': isTemplateMode,\n\t\t\t} ) }\n\t\t>\n\t\t\t<motion.div\n\t\t\t\tclassName=\"edit-post-visual-editor__content-area\"\n\t\t\t\tanimate={ {\n\t\t\t\t\tpadding: isTemplateMode ? '48px 48px 0' : 0,\n\t\t\t\t} }\n\t\t\t\tref={ blockSelectionClearerRef }\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tanimate={ animatedStyles }\n\t\t\t\t\tinitial={ desktopCanvasStyles }\n\t\t\t\t\tclassName={ previewMode }\n\t\t\t\t>\n\t\t\t\t\t<MaybeIframe\n\t\t\t\t\t\tshouldIframe={\n\t\t\t\t\t\t\t( ( hasV3BlocksOnly ||\n\t\t\t\t\t\t\t\t( isGutenbergPlugin && isBlockBasedTheme ) ) &&\n\t\t\t\t\t\t\t\t! hasMetaBoxes ) ||\n\t\t\t\t\t\t\tisTemplateMode ||\n\t\t\t\t\t\t\tdeviceType === 'Tablet' ||\n\t\t\t\t\t\t\tdeviceType === 'Mobile'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\tstyles={ styles }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ themeSupportsLayout &&\n\t\t\t\t\t\t\t! themeHasDisabledLayoutStyles &&\n\t\t\t\t\t\t\t! isTemplateMode && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\tselector=\".edit-post-visual-editor__post-title-wrapper\"\n\t\t\t\t\t\t\t\t\t\tlayout={ fallbackLayout }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\tselector=\".block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\t\t\tlayout={ blockListLayout }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ align && (\n\t\t\t\t\t\t\t\t\t\t<LayoutStyle css={ alignCSS } />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ postContentLayoutStyles && (\n\t\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\t\tlayout={ postContentLayout }\n\t\t\t\t\t\t\t\t\t\t\tcss={ postContentLayoutStyles }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! isTemplateMode && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t'edit-post-visual-editor__post-title-wrapper',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'is-focus-mode': isFocusMode,\n\t\t\t\t\t\t\t\t\t\t'has-global-padding':\n\t\t\t\t\t\t\t\t\t\t\thasRootPaddingAwareAlignments,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tcontentEditable={ false }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostTitle ref={ titleRef } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<RecursionProvider\n\t\t\t\t\t\t\tblockName={ wrapperBlockName }\n\t\t\t\t\t\t\tuniqueId={ wrapperUniqueId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\tisTemplateMode\n\t\t\t\t\t\t\t\t\t\t? 'wp-site-blocks'\n\t\t\t\t\t\t\t\t\t\t: `${ blockListLayoutClass } wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules.\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlayout={ blockListLayout }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</RecursionProvider>\n\t\t\t\t\t</MaybeIframe>\n\t\t\t\t</motion.div>\n\t\t\t</motion.div>\n\t\t</BlockTools>\n\t);\n}\n"]}
|
package/build/editor.js
CHANGED
|
@@ -37,6 +37,8 @@ var _store = require("./store");
|
|
|
37
37
|
|
|
38
38
|
var _lockUnlock = require("./lock-unlock");
|
|
39
39
|
|
|
40
|
+
var _useCommonCommands = _interopRequireDefault(require("./hooks/commands/use-common-commands"));
|
|
41
|
+
|
|
40
42
|
/**
|
|
41
43
|
* WordPress dependencies
|
|
42
44
|
*/
|
|
@@ -62,6 +64,7 @@ function Editor({
|
|
|
62
64
|
...props
|
|
63
65
|
}) {
|
|
64
66
|
useCommands();
|
|
67
|
+
(0, _useCommonCommands.default)();
|
|
65
68
|
const {
|
|
66
69
|
hasFixedToolbar,
|
|
67
70
|
focusMode,
|
package/build/editor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/editor.js"],"names":["ExperimentalEditorProvider","editorPrivateApis","getLayoutStyles","blockEditorPrivateApis","useCommands","coreCommandsPrivateApis","Editor","postId","postType","settings","initialEdits","props","hasFixedToolbar","focusMode","isDistractionFree","hasInlineToolbar","hasThemeStyles","post","preferredStyleVariations","hiddenBlockTypes","blockTypes","keepCaretInsideBlock","isTemplateMode","template","select","isFeatureActive","__experimentalGetPreviewDeviceType","isEditingTemplate","getEditedPostTemplate","getHiddenBlockTypes","editPostStore","getEntityRecord","getPostType","getEntityRecords","canUser","coreStore","getEditorSettings","editorStore","getBlockTypes","blocksStore","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","canEditTemplate","preferencesStore","get","updatePreferredStyleVariations","setIsInserterOpened","editorSettings","result","__experimentalPreferredStyleVariations","value","onChange","__experimentalSetIsInserterOpened","defaultAllowedBlockTypes","allowedBlockTypes","length","map","name","filter","type","styles","themeStyles","presetStyles","forEach","style","__unstableType","push","defaultEditorStyles","disableLayoutStyles","css","selector","hasBlockGapSupport","hasFallbackGapSupport","fallbackGapValue","undefined"],"mappings":";;;;;;;;;AAYA;;AATA;;AACA;;AACA;;AAMA;;AAEA;;AAC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YAAY,EAAGP,YAHhB;AAIC,IAAA,cAAc,EAAG,KAJlB;AAKC,IAAA,kBAAkB,EAAGY,cAAc,GAAGC,QAAH,GAAcyD,SALlD;AAAA,OAMMrE;AANN,KAQC,4BAAC,qBAAD,QACC,4BAAC,qBAAD,OADD,EAEC,4BAAC,6BAAD;AAAsB,IAAA,MAAM,EAAGJ;AAA/B,IAFD,EAGC,4BAAC,eAAD;AAAQ,IAAA,MAAM,EAAG2D;AAAjB,IAHD,CARD,EAaC,4BAAC,uBAAD,OAbD,CADD,CADD,CADD;AAqBA;;eAEc5D,M","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { CommandMenu } from '@wordpress/commands';\nimport { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\nimport { unlock } from './lock-unlock';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\nconst { getLayoutStyles } = unlock( blockEditorPrivateApis );\nconst { useCommands } = unlock( coreCommandsPrivateApis );\n\nfunction Editor( { postId, postType, settings, initialEdits, ...props } ) {\n\tuseCommands();\n\tconst {\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thasInlineToolbar,\n\t\thasThemeStyles,\n\t\tpost,\n\t\tpreferredStyleVariations,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tkeepCaretInsideBlock,\n\t\tisTemplateMode,\n\t\ttemplate,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisFeatureActive,\n\t\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\t\tisEditingTemplate,\n\t\t\t\tgetEditedPostTemplate,\n\t\t\t\tgetHiddenBlockTypes,\n\t\t\t} = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, getEntityRecords, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\t\tpostType\n\t\t\t);\n\t\t\t// Ideally the initializeEditor function should be called using the ID of the REST endpoint.\n\t\t\t// to avoid the special case.\n\t\t\tlet postObject;\n\t\t\tif ( isTemplate ) {\n\t\t\t\tconst posts = getEntityRecords( 'postType', postType, {\n\t\t\t\t\twp_id: postId,\n\t\t\t\t} );\n\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t} else {\n\t\t\t\tpostObject = getEntityRecord( 'postType', postType, postId );\n\t\t\t}\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable = getPostType( postType )?.viewable ?? false;\n\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\n\t\t\treturn {\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tisFeatureActive( 'fixedToolbar' ) ||\n\t\t\t\t\t__experimentalGetPreviewDeviceType() !== 'Desktop',\n\t\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\t\tisDistractionFree: isFeatureActive( 'distractionFree' ),\n\t\t\t\thasInlineToolbar: isFeatureActive( 'inlineToolbar' ),\n\t\t\t\thasThemeStyles: isFeatureActive( 'themeStyles' ),\n\t\t\t\tpreferredStyleVariations: select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t),\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tkeepCaretInsideBlock: isFeatureActive( 'keepCaretInsideBlock' ),\n\t\t\t\tisTemplateMode: isEditingTemplate(),\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode && isViewable && canEditTemplate\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst { updatePreferredStyleVariations, setIsInserterOpened } =\n\t\tuseDispatch( editPostStore );\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\tisDistractionFree,\n\t\t\thasInlineToolbar,\n\n\t\t\t// This is marked as experimental to give time for the quick inserter to mature.\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t// Keep a reference of the `allowedBlockTypes` from the server to handle use cases\n\t\t\t// where we need to differentiate if a block is disabled by the user or some plugin.\n\t\t\tdefaultAllowedBlockTypes: settings.allowedBlockTypes,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tresult.allowedBlockTypes = defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn result;\n\t}, [\n\t\tsettings,\n\t\thasFixedToolbar,\n\t\thasInlineToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tpreferredStyleVariations,\n\t\tsetIsInserterOpened,\n\t\tupdatePreferredStyleVariations,\n\t\tkeepCaretInsideBlock,\n\t] );\n\n\tconst styles = useMemo( () => {\n\t\tconst themeStyles = [];\n\t\tconst presetStyles = [];\n\t\tsettings.styles?.forEach( ( style ) => {\n\t\t\tif ( ! style.__unstableType || style.__unstableType === 'theme' ) {\n\t\t\t\tthemeStyles.push( style );\n\t\t\t} else {\n\t\t\t\tpresetStyles.push( style );\n\t\t\t}\n\t\t} );\n\n\t\tconst defaultEditorStyles = [\n\t\t\t...settings.defaultEditorStyles,\n\t\t\t...presetStyles,\n\t\t];\n\n\t\t// If theme styles are not present or displayed, ensure that\n\t\t// base layout styles are still present in the editor.\n\t\tif (\n\t\t\t! settings.disableLayoutStyles &&\n\t\t\t! ( hasThemeStyles && themeStyles.length )\n\t\t) {\n\t\t\tdefaultEditorStyles.push( {\n\t\t\t\tcss: getLayoutStyles( {\n\t\t\t\t\tstyle: {},\n\t\t\t\t\tselector: 'body',\n\t\t\t\t\thasBlockGapSupport: false,\n\t\t\t\t\thasFallbackGapSupport: true,\n\t\t\t\t\tfallbackGapValue: '0.5em',\n\t\t\t\t} ),\n\t\t\t} );\n\t\t}\n\n\t\treturn hasThemeStyles && themeStyles.length\n\t\t\t? settings.styles\n\t\t\t: defaultEditorStyles;\n\t}, [ settings, hasThemeStyles ] );\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ShortcutProvider>\n\t\t\t<SlotFillProvider>\n\t\t\t\t<ExperimentalEditorProvider\n\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\tpost={ post }\n\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t__unstableTemplate={ isTemplateMode ? template : undefined }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t<CommandMenu />\n\t\t\t\t\t\t<EditorInitialization postId={ postId } />\n\t\t\t\t\t\t<Layout styles={ styles } />\n\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t<PostLockedModal />\n\t\t\t\t</ExperimentalEditorProvider>\n\t\t\t</SlotFillProvider>\n\t\t</ShortcutProvider>\n\t);\n}\n\nexport default Editor;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/editor.js"],"names":["ExperimentalEditorProvider","editorPrivateApis","getLayoutStyles","blockEditorPrivateApis","useCommands","coreCommandsPrivateApis","Editor","postId","postType","settings","initialEdits","props","hasFixedToolbar","focusMode","isDistractionFree","hasInlineToolbar","hasThemeStyles","post","preferredStyleVariations","hiddenBlockTypes","blockTypes","keepCaretInsideBlock","isTemplateMode","template","select","isFeatureActive","__experimentalGetPreviewDeviceType","isEditingTemplate","getEditedPostTemplate","getHiddenBlockTypes","editPostStore","getEntityRecord","getPostType","getEntityRecords","canUser","coreStore","getEditorSettings","editorStore","getBlockTypes","blocksStore","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","canEditTemplate","preferencesStore","get","updatePreferredStyleVariations","setIsInserterOpened","editorSettings","result","__experimentalPreferredStyleVariations","value","onChange","__experimentalSetIsInserterOpened","defaultAllowedBlockTypes","allowedBlockTypes","length","map","name","filter","type","styles","themeStyles","presetStyles","forEach","style","__unstableType","push","defaultEditorStyles","disableLayoutStyles","css","selector","hasBlockGapSupport","hasFallbackGapSupport","fallbackGapValue","undefined"],"mappings":";;;;;;;;;AAYA;;AATA;;AACA;;AACA;;AAMA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;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c,EAAG,KAJlB;AAKC,IAAA,kBAAkB,EAAGY,cAAc,GAAGC,QAAH,GAAcyD,SALlD;AAAA,OAMMrE;AANN,KAQC,4BAAC,qBAAD,QACC,4BAAC,qBAAD,OADD,EAEC,4BAAC,6BAAD;AAAsB,IAAA,MAAM,EAAGJ;AAA/B,IAFD,EAGC,4BAAC,eAAD;AAAQ,IAAA,MAAM,EAAG2D;AAAjB,IAHD,CARD,EAaC,4BAAC,uBAAD,OAbD,CADD,CADD,CADD;AAqBA;;eAEc5D,M","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { CommandMenu } from '@wordpress/commands';\nimport { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\nimport { unlock } from './lock-unlock';\nimport useCommonCommands from './hooks/commands/use-common-commands';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\nconst { getLayoutStyles } = unlock( blockEditorPrivateApis );\nconst { useCommands } = unlock( coreCommandsPrivateApis );\n\nfunction Editor( { postId, postType, settings, initialEdits, ...props } ) {\n\tuseCommands();\n\tuseCommonCommands();\n\tconst {\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thasInlineToolbar,\n\t\thasThemeStyles,\n\t\tpost,\n\t\tpreferredStyleVariations,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tkeepCaretInsideBlock,\n\t\tisTemplateMode,\n\t\ttemplate,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisFeatureActive,\n\t\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\t\tisEditingTemplate,\n\t\t\t\tgetEditedPostTemplate,\n\t\t\t\tgetHiddenBlockTypes,\n\t\t\t} = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, getEntityRecords, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\t\tpostType\n\t\t\t);\n\t\t\t// Ideally the initializeEditor function should be called using the ID of the REST endpoint.\n\t\t\t// to avoid the special case.\n\t\t\tlet postObject;\n\t\t\tif ( isTemplate ) {\n\t\t\t\tconst posts = getEntityRecords( 'postType', postType, {\n\t\t\t\t\twp_id: postId,\n\t\t\t\t} );\n\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t} else {\n\t\t\t\tpostObject = getEntityRecord( 'postType', postType, postId );\n\t\t\t}\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable = getPostType( postType )?.viewable ?? false;\n\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\n\t\t\treturn {\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tisFeatureActive( 'fixedToolbar' ) ||\n\t\t\t\t\t__experimentalGetPreviewDeviceType() !== 'Desktop',\n\t\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\t\tisDistractionFree: isFeatureActive( 'distractionFree' ),\n\t\t\t\thasInlineToolbar: isFeatureActive( 'inlineToolbar' ),\n\t\t\t\thasThemeStyles: isFeatureActive( 'themeStyles' ),\n\t\t\t\tpreferredStyleVariations: select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t),\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tkeepCaretInsideBlock: isFeatureActive( 'keepCaretInsideBlock' ),\n\t\t\t\tisTemplateMode: isEditingTemplate(),\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode && isViewable && canEditTemplate\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst { updatePreferredStyleVariations, setIsInserterOpened } =\n\t\tuseDispatch( editPostStore );\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\tisDistractionFree,\n\t\t\thasInlineToolbar,\n\n\t\t\t// This is marked as experimental to give time for the quick inserter to mature.\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t// Keep a reference of the `allowedBlockTypes` from the server to handle use cases\n\t\t\t// where we need to differentiate if a block is disabled by the user or some plugin.\n\t\t\tdefaultAllowedBlockTypes: settings.allowedBlockTypes,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tresult.allowedBlockTypes = defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn result;\n\t}, [\n\t\tsettings,\n\t\thasFixedToolbar,\n\t\thasInlineToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tpreferredStyleVariations,\n\t\tsetIsInserterOpened,\n\t\tupdatePreferredStyleVariations,\n\t\tkeepCaretInsideBlock,\n\t] );\n\n\tconst styles = useMemo( () => {\n\t\tconst themeStyles = [];\n\t\tconst presetStyles = [];\n\t\tsettings.styles?.forEach( ( style ) => {\n\t\t\tif ( ! style.__unstableType || style.__unstableType === 'theme' ) {\n\t\t\t\tthemeStyles.push( style );\n\t\t\t} else {\n\t\t\t\tpresetStyles.push( style );\n\t\t\t}\n\t\t} );\n\n\t\tconst defaultEditorStyles = [\n\t\t\t...settings.defaultEditorStyles,\n\t\t\t...presetStyles,\n\t\t];\n\n\t\t// If theme styles are not present or displayed, ensure that\n\t\t// base layout styles are still present in the editor.\n\t\tif (\n\t\t\t! settings.disableLayoutStyles &&\n\t\t\t! ( hasThemeStyles && themeStyles.length )\n\t\t) {\n\t\t\tdefaultEditorStyles.push( {\n\t\t\t\tcss: getLayoutStyles( {\n\t\t\t\t\tstyle: {},\n\t\t\t\t\tselector: 'body',\n\t\t\t\t\thasBlockGapSupport: false,\n\t\t\t\t\thasFallbackGapSupport: true,\n\t\t\t\t\tfallbackGapValue: '0.5em',\n\t\t\t\t} ),\n\t\t\t} );\n\t\t}\n\n\t\treturn hasThemeStyles && themeStyles.length\n\t\t\t? settings.styles\n\t\t\t: defaultEditorStyles;\n\t}, [ settings, hasThemeStyles ] );\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ShortcutProvider>\n\t\t\t<SlotFillProvider>\n\t\t\t\t<ExperimentalEditorProvider\n\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\tpost={ post }\n\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t__unstableTemplate={ isTemplateMode ? template : undefined }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t<CommandMenu />\n\t\t\t\t\t\t<EditorInitialization postId={ postId } />\n\t\t\t\t\t\t<Layout styles={ styles } />\n\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t<PostLockedModal />\n\t\t\t\t</ExperimentalEditorProvider>\n\t\t\t</SlotFillProvider>\n\t\t</ShortcutProvider>\n\t);\n}\n\nexport default Editor;\n"]}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useCommonCommands;
|
|
7
|
+
|
|
8
|
+
var _data = require("@wordpress/data");
|
|
9
|
+
|
|
10
|
+
var _i18n = require("@wordpress/i18n");
|
|
11
|
+
|
|
12
|
+
var _icons = require("@wordpress/icons");
|
|
13
|
+
|
|
14
|
+
var _commands = require("@wordpress/commands");
|
|
15
|
+
|
|
16
|
+
var _preferences = require("@wordpress/preferences");
|
|
17
|
+
|
|
18
|
+
var _interface = require("@wordpress/interface");
|
|
19
|
+
|
|
20
|
+
var _keyboardShortcutHelpModal = require("../../components/keyboard-shortcut-help-modal");
|
|
21
|
+
|
|
22
|
+
var _preferencesModal = require("../../components/preferences-modal");
|
|
23
|
+
|
|
24
|
+
var _store = require("../../store");
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* WordPress dependencies
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Internal dependencies
|
|
32
|
+
*/
|
|
33
|
+
function useCommonCommands() {
|
|
34
|
+
const {
|
|
35
|
+
openGeneralSidebar,
|
|
36
|
+
closeGeneralSidebar,
|
|
37
|
+
switchEditorMode,
|
|
38
|
+
setIsListViewOpened
|
|
39
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
40
|
+
const {
|
|
41
|
+
openModal
|
|
42
|
+
} = (0, _data.useDispatch)(_interface.store);
|
|
43
|
+
const {
|
|
44
|
+
editorMode,
|
|
45
|
+
activeSidebar,
|
|
46
|
+
isListViewOpen
|
|
47
|
+
} = (0, _data.useSelect)(select => {
|
|
48
|
+
const {
|
|
49
|
+
getEditorMode,
|
|
50
|
+
isListViewOpened
|
|
51
|
+
} = select(_store.store);
|
|
52
|
+
return {
|
|
53
|
+
activeSidebar: select(_interface.store).getActiveComplementaryArea(_store.store.name),
|
|
54
|
+
editorMode: getEditorMode(),
|
|
55
|
+
isListViewOpen: isListViewOpened()
|
|
56
|
+
};
|
|
57
|
+
}, []);
|
|
58
|
+
const {
|
|
59
|
+
toggle
|
|
60
|
+
} = (0, _data.useDispatch)(_preferences.store);
|
|
61
|
+
(0, _commands.useCommand)({
|
|
62
|
+
name: 'core/open-settings-sidebar',
|
|
63
|
+
label: (0, _i18n.__)('Toggle settings sidebar'),
|
|
64
|
+
icon: (0, _i18n.isRTL)() ? _icons.drawerLeft : _icons.drawerRight,
|
|
65
|
+
callback: ({
|
|
66
|
+
close
|
|
67
|
+
}) => {
|
|
68
|
+
close();
|
|
69
|
+
|
|
70
|
+
if (activeSidebar === 'edit-post/document') {
|
|
71
|
+
closeGeneralSidebar();
|
|
72
|
+
} else {
|
|
73
|
+
openGeneralSidebar('edit-post/document');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
(0, _commands.useCommand)({
|
|
78
|
+
name: 'core/open-block-inspector',
|
|
79
|
+
label: (0, _i18n.__)('Toggle block inspector'),
|
|
80
|
+
icon: _icons.blockDefault,
|
|
81
|
+
callback: ({
|
|
82
|
+
close
|
|
83
|
+
}) => {
|
|
84
|
+
close();
|
|
85
|
+
|
|
86
|
+
if (activeSidebar === 'edit-post/block') {
|
|
87
|
+
closeGeneralSidebar();
|
|
88
|
+
} else {
|
|
89
|
+
openGeneralSidebar('edit-post/block');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
(0, _commands.useCommand)({
|
|
94
|
+
name: 'core/toggle-distraction-free',
|
|
95
|
+
label: (0, _i18n.__)('Toggle distraction free'),
|
|
96
|
+
icon: _icons.cog,
|
|
97
|
+
callback: ({
|
|
98
|
+
close
|
|
99
|
+
}) => {
|
|
100
|
+
toggle('core/edit-post', 'distractionFree');
|
|
101
|
+
close();
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
(0, _commands.useCommand)({
|
|
105
|
+
name: 'core/toggle-spotlight-mode',
|
|
106
|
+
label: (0, _i18n.__)('Toggle spotlight mode'),
|
|
107
|
+
icon: _icons.cog,
|
|
108
|
+
callback: ({
|
|
109
|
+
close
|
|
110
|
+
}) => {
|
|
111
|
+
toggle('core/edit-post', 'focusMode');
|
|
112
|
+
close();
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
(0, _commands.useCommand)({
|
|
116
|
+
name: 'core/toggle-fullscreen-mode',
|
|
117
|
+
label: (0, _i18n.__)('Toggle fullscreen mode'),
|
|
118
|
+
icon: _icons.desktop,
|
|
119
|
+
callback: ({
|
|
120
|
+
close
|
|
121
|
+
}) => {
|
|
122
|
+
toggle('core/edit-post', 'fullscreenMode');
|
|
123
|
+
close();
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
(0, _commands.useCommand)({
|
|
127
|
+
name: 'core/toggle-list-view',
|
|
128
|
+
label: (0, _i18n.__)('Toggle list view'),
|
|
129
|
+
icon: _icons.listView,
|
|
130
|
+
callback: ({
|
|
131
|
+
close
|
|
132
|
+
}) => {
|
|
133
|
+
setIsListViewOpened(!isListViewOpen);
|
|
134
|
+
close();
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
(0, _commands.useCommand)({
|
|
138
|
+
name: 'core/toggle-top-toolbar',
|
|
139
|
+
label: (0, _i18n.__)('Toggle top toolbar'),
|
|
140
|
+
icon: _icons.cog,
|
|
141
|
+
callback: ({
|
|
142
|
+
close
|
|
143
|
+
}) => {
|
|
144
|
+
toggle('core/edit-post', 'fixedToolbar');
|
|
145
|
+
close();
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
(0, _commands.useCommand)({
|
|
149
|
+
name: 'core/toggle-code-editor',
|
|
150
|
+
label: (0, _i18n.__)('Toggle code editor'),
|
|
151
|
+
icon: _icons.code,
|
|
152
|
+
callback: ({
|
|
153
|
+
close
|
|
154
|
+
}) => {
|
|
155
|
+
switchEditorMode(editorMode === 'visual' ? 'text' : 'visual');
|
|
156
|
+
close();
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
(0, _commands.useCommand)({
|
|
160
|
+
name: 'core/open-preferences',
|
|
161
|
+
label: (0, _i18n.__)('Open editor preferences'),
|
|
162
|
+
icon: _icons.cog,
|
|
163
|
+
callback: () => {
|
|
164
|
+
openModal(_preferencesModal.PREFERENCES_MODAL_NAME);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
(0, _commands.useCommand)({
|
|
168
|
+
name: 'core/open-shortcut-help',
|
|
169
|
+
label: (0, _i18n.__)('Open keyboard shortcuts'),
|
|
170
|
+
icon: _icons.keyboardClose,
|
|
171
|
+
callback: () => {
|
|
172
|
+
openModal(_keyboardShortcutHelpModal.KEYBOARD_SHORTCUT_HELP_MODAL_NAME);
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=use-common-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/hooks/commands/use-common-commands.js"],"names":["useCommonCommands","openGeneralSidebar","closeGeneralSidebar","switchEditorMode","setIsListViewOpened","editPostStore","openModal","interfaceStore","editorMode","activeSidebar","isListViewOpen","select","getEditorMode","isListViewOpened","getActiveComplementaryArea","name","toggle","preferencesStore","label","icon","drawerLeft","drawerRight","callback","close","blockDefault","cog","desktop","listView","code","PREFERENCES_MODAL_NAME","keyboardClose","KEYBOARD_SHORTCUT_HELP_MODAL_NAME"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAUA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAxBA;AACA;AACA;;AAiBA;AACA;AACA;AAKe,SAASA,iBAAT,GAA6B;AAC3C,QAAM;AACLC,IAAAA,kBADK;AAELC,IAAAA,mBAFK;AAGLC,IAAAA,gBAHK;AAILC,IAAAA;AAJK,MAKF,uBAAaC,YAAb,CALJ;AAMA,QAAM;AAAEC,IAAAA;AAAF,MAAgB,uBAAaC,gBAAb,CAAtB;AACA,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,aAAd;AAA6BC,IAAAA;AAA7B,MAAgD,qBACnDC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,aAAF;AAAiBC,MAAAA;AAAjB,QAAsCF,MAAM,CAAEN,YAAF,CAAlD;AACA,WAAO;AACNI,MAAAA,aAAa,EAAEE,MAAM,CACpBJ,gBADoB,CAAN,CAEbO,0BAFa,CAEeT,aAAcU,IAF7B,CADT;AAINP,MAAAA,UAAU,EAAEI,aAAa,EAJnB;AAKNF,MAAAA,cAAc,EAAEG,gBAAgB;AAL1B,KAAP;AAOA,GAVoD,EAWrD,EAXqD,CAAtD;AAaA,QAAM;AAAEG,IAAAA;AAAF,MAAa,uBAAaC,kBAAb,CAAnB;AAEA,4BAAY;AACXF,IAAAA,IAAI,EAAE,4BADK;AAEXG,IAAAA,KAAK,EAAE,cAAI,yBAAJ,CAFI;AAGXC,IAAAA,IAAI,EAAE,qBAAUC,iBAAV,GAAuBC,kBAHlB;AAIXC,IAAAA,QAAQ,EAAE,CAAE;AAAEC,MAAAA;AAAF,KAAF,KAAiB;AAC1BA,MAAAA,KAAK;;AACL,UAAKd,aAAa,KAAK,oBAAvB,EAA8C;AAC7CP,QAAAA,mBAAmB;AACnB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cAAI,yBAAJ,CAFI;AAGXC,IAAAA,IAAI,EAAEW,oBAHK;AAIXR,IAAAA,QAAQ,EAAE,MAAM;AACfhB,MAAAA,SAAS,CAAEyB,4DAAF,CAAT;AACA;AANU,GAAZ;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tcode,\n\tcog,\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tkeyboardClose,\n\tdesktop,\n\tlistView,\n} from '@wordpress/icons';\nimport { useCommand } from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\nimport { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';\nimport { store as editPostStore } from '../../store';\n\nexport default function useCommonCommands() {\n\tconst {\n\t\topenGeneralSidebar,\n\t\tcloseGeneralSidebar,\n\t\tswitchEditorMode,\n\t\tsetIsListViewOpened,\n\t} = useDispatch( editPostStore );\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst { editorMode, activeSidebar, isListViewOpen } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorMode, isListViewOpened } = select( editPostStore );\n\t\t\treturn {\n\t\t\t\tactiveSidebar: select(\n\t\t\t\t\tinterfaceStore\n\t\t\t\t).getActiveComplementaryArea( editPostStore.name ),\n\t\t\t\teditorMode: getEditorMode(),\n\t\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tuseCommand( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/document' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/document' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/block' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/block' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-distraction-free',\n\t\tlabel: __( 'Toggle distraction free' ),\n\t\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'distractionFree' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-spotlight-mode',\n\t\tlabel: __( 'Toggle spotlight mode' ),\n\t\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'focusMode' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-fullscreen-mode',\n\t\tlabel: __( 'Toggle fullscreen mode' ),\n\t\ticon: desktop,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'fullscreenMode' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-list-view',\n\t\tlabel: __( 'Toggle list view' ),\n\t\ticon: listView,\n\t\tcallback: ( { close } ) => {\n\t\t\tsetIsListViewOpened( ! isListViewOpen );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-top-toolbar',\n\t\tlabel: __( 'Toggle top toolbar' ),\n\t\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'fixedToolbar' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-code-editor',\n\t\tlabel: __( 'Toggle code editor' ),\n\t\ticon: code,\n\t\tcallback: ( { close } ) => {\n\t\t\tswitchEditorMode( editorMode === 'visual' ? 'text' : 'visual' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Open editor preferences' ),\n\t\ticon: cog,\n\t\tcallback: () => {\n\t\t\topenModal( PREFERENCES_MODAL_NAME );\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Open keyboard shortcuts' ),\n\t\ticon: keyboardClose,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t},\n\t} );\n}\n"]}
|
package/build/plugins/index.js
CHANGED
|
@@ -6,6 +6,12 @@ var _element = require("@wordpress/element");
|
|
|
6
6
|
|
|
7
7
|
var _components = require("@wordpress/components");
|
|
8
8
|
|
|
9
|
+
var _coreData = require("@wordpress/core-data");
|
|
10
|
+
|
|
11
|
+
var _editor = require("@wordpress/editor");
|
|
12
|
+
|
|
13
|
+
var _data = require("@wordpress/data");
|
|
14
|
+
|
|
9
15
|
var _icons = require("@wordpress/icons");
|
|
10
16
|
|
|
11
17
|
var _i18n = require("@wordpress/i18n");
|
|
@@ -29,16 +35,39 @@ var _welcomeGuideMenuItem = _interopRequireDefault(require("./welcome-guide-menu
|
|
|
29
35
|
/**
|
|
30
36
|
* Internal dependencies
|
|
31
37
|
*/
|
|
38
|
+
function ManagePatternsMenuItem() {
|
|
39
|
+
const url = (0, _data.useSelect)(select => {
|
|
40
|
+
const {
|
|
41
|
+
canUser
|
|
42
|
+
} = select(_coreData.store);
|
|
43
|
+
const {
|
|
44
|
+
getEditorSettings
|
|
45
|
+
} = select(_editor.store);
|
|
46
|
+
|
|
47
|
+
const isBlockTheme = getEditorSettings().__unstableIsBlockBasedTheme;
|
|
48
|
+
|
|
49
|
+
const defaultUrl = (0, _url.addQueryArgs)('edit.php', {
|
|
50
|
+
post_type: 'wp_block'
|
|
51
|
+
});
|
|
52
|
+
const patternsUrl = (0, _url.addQueryArgs)('site-editor.php', {
|
|
53
|
+
path: '/patterns'
|
|
54
|
+
}); // The site editor and templates both check whether the user has
|
|
55
|
+
// edit_theme_options capabilities. We can leverage that here and not
|
|
56
|
+
// display the manage patterns link if the user can't access it.
|
|
57
|
+
|
|
58
|
+
return canUser('read', 'templates') && isBlockTheme ? patternsUrl : defaultUrl;
|
|
59
|
+
}, []);
|
|
60
|
+
return (0, _element.createElement)(_components.MenuItem, {
|
|
61
|
+
role: "menuitem",
|
|
62
|
+
href: url
|
|
63
|
+
}, (0, _i18n.__)('Manage patterns'));
|
|
64
|
+
}
|
|
65
|
+
|
|
32
66
|
(0, _plugins.registerPlugin)('edit-post', {
|
|
33
67
|
render() {
|
|
34
68
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_toolsMoreMenuGroup.default, null, ({
|
|
35
69
|
onClose
|
|
36
|
-
}) => (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(
|
|
37
|
-
role: "menuitem",
|
|
38
|
-
href: (0, _url.addQueryArgs)('edit.php', {
|
|
39
|
-
post_type: 'wp_block'
|
|
40
|
-
})
|
|
41
|
-
}, (0, _i18n.__)('Manage Patterns')), (0, _element.createElement)(_keyboardShortcutsHelpMenuItem.default, {
|
|
70
|
+
}) => (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(ManagePatternsMenuItem, null), (0, _element.createElement)(_keyboardShortcutsHelpMenuItem.default, {
|
|
42
71
|
onSelect: onClose
|
|
43
72
|
}), (0, _element.createElement)(_welcomeGuideMenuItem.default, null), (0, _element.createElement)(_copyContentMenuItem.default, null), (0, _element.createElement)(_components.MenuItem, {
|
|
44
73
|
role: "menuitem",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/plugins/index.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/plugins/index.js"],"names":["ManagePatternsMenuItem","url","select","canUser","coreStore","getEditorSettings","editorStore","isBlockTheme","__unstableIsBlockBasedTheme","defaultUrl","post_type","patternsUrl","path","render","onClose","external"],"mappings":";;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAUA;AACA;AACA;AAMA,SAASA,sBAAT,GAAkC;AACjC,QAAMC,GAAG,GAAG,qBAAaC,MAAF,IAAc;AACpC,UAAM;AAAEC,MAAAA;AAAF,QAAcD,MAAM,CAAEE,eAAF,CAA1B;AACA,UAAM;AAAEC,MAAAA;AAAF,QAAwBH,MAAM,CAAEI,aAAF,CAApC;;AAEA,UAAMC,YAAY,GAAGF,iBAAiB,GAAGG,2BAAzC;;AACA,UAAMC,UAAU,GAAG,uBAAc,UAAd,EAA0B;AAC5CC,MAAAA,SAAS,EAAE;AADiC,KAA1B,CAAnB;AAGA,UAAMC,WAAW,GAAG,uBAAc,iBAAd,EAAiC;AACpDC,MAAAA,IAAI,EAAE;AAD8C,KAAjC,CAApB,CARoC,CAYpC;AACA;AACA;;AACA,WAAOT,OAAO,CAAE,MAAF,EAAU,WAAV,CAAP,IAAkCI,YAAlC,GACJI,WADI,GAEJF,UAFH;AAGA,GAlBW,EAkBT,EAlBS,CAAZ;AAoBA,SACC,4BAAC,oBAAD;AAAU,IAAA,IAAI,EAAC,UAAf;AAA0B,IAAA,IAAI,EAAGR;AAAjC,KACG,cAAI,iBAAJ,CADH,CADD;AAKA;;AAED,6BAAgB,WAAhB,EAA6B;AAC5BY,EAAAA,MAAM,GAAG;AACR,WACC,qDACC,4BAAC,2BAAD,QACG,CAAE;AAAEC,MAAAA;AAAF,KAAF,KACD,qDACC,4BAAC,sBAAD,OADD,EAEC,4BAAC,sCAAD;AACC,MAAA,QAAQ,EAAGA;AADZ,MAFD,EAKC,4BAAC,6BAAD,OALD,EAMC,4BAAC,4BAAD,OAND,EAOC,4BAAC,oBAAD;AACC,MAAA,IAAI,EAAC,UADN;AAEC,MAAA,IAAI,EAAGC,eAFR;AAGC,MAAA,IAAI,EAAG,cACN,qEADM,CAHR;AAMC,MAAA,MAAM,EAAC,QANR;AAOC,MAAA,GAAG,EAAC;AAPL,OASG,cAAI,MAAJ,CATH,EAUC,4BAAC,0BAAD;AAAgB,MAAA,EAAE,EAAC;AAAnB;AAEE;AACA,kBAAI,sBAAJ,CAHF,CAVD,CAPD,CAFF,CADD,CADD;AAiCA;;AAnC2B,CAA7B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem, VisuallyHidden } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { external } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { registerPlugin } from '@wordpress/plugins';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport CopyContentMenuItem from './copy-content-menu-item';\nimport KeyboardShortcutsHelpMenuItem from './keyboard-shortcuts-help-menu-item';\nimport ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';\nimport WelcomeGuideMenuItem from './welcome-guide-menu-item';\n\nfunction ManagePatternsMenuItem() {\n\tconst url = useSelect( ( select ) => {\n\t\tconst { canUser } = select( coreStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\n\t\tconst isBlockTheme = getEditorSettings().__unstableIsBlockBasedTheme;\n\t\tconst defaultUrl = addQueryArgs( 'edit.php', {\n\t\t\tpost_type: 'wp_block',\n\t\t} );\n\t\tconst patternsUrl = addQueryArgs( 'site-editor.php', {\n\t\t\tpath: '/patterns',\n\t\t} );\n\n\t\t// The site editor and templates both check whether the user has\n\t\t// edit_theme_options capabilities. We can leverage that here and not\n\t\t// display the manage patterns link if the user can't access it.\n\t\treturn canUser( 'read', 'templates' ) && isBlockTheme\n\t\t\t? patternsUrl\n\t\t\t: defaultUrl;\n\t}, [] );\n\n\treturn (\n\t\t<MenuItem role=\"menuitem\" href={ url }>\n\t\t\t{ __( 'Manage patterns' ) }\n\t\t</MenuItem>\n\t);\n}\n\nregisterPlugin( 'edit-post', {\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<ToolsMoreMenuGroup>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ManagePatternsMenuItem />\n\t\t\t\t\t\t\t<KeyboardShortcutsHelpMenuItem\n\t\t\t\t\t\t\t\tonSelect={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<WelcomeGuideMenuItem />\n\t\t\t\t\t\t\t<CopyContentMenuItem />\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsMoreMenuGroup>\n\t\t\t</>\n\t\t);\n\t},\n} );\n"]}
|
|
@@ -16,7 +16,9 @@ var _i18n = require("@wordpress/i18n");
|
|
|
16
16
|
|
|
17
17
|
var _keycodes = require("@wordpress/keycodes");
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _interface = require("@wordpress/interface");
|
|
20
|
+
|
|
21
|
+
var _keyboardShortcutHelpModal = require("../../components/keyboard-shortcut-help-modal");
|
|
20
22
|
|
|
21
23
|
/**
|
|
22
24
|
* WordPress dependencies
|
|
@@ -30,7 +32,7 @@ function KeyboardShortcutsHelpMenuItem({
|
|
|
30
32
|
}) {
|
|
31
33
|
return (0, _element.createElement)(_components.MenuItem, {
|
|
32
34
|
onClick: () => {
|
|
33
|
-
openModal(
|
|
35
|
+
openModal(_keyboardShortcutHelpModal.KEYBOARD_SHORTCUT_HELP_MODAL_NAME);
|
|
34
36
|
},
|
|
35
37
|
shortcut: _keycodes.displayShortcut.access('h')
|
|
36
38
|
}, (0, _i18n.__)('Keyboard shortcuts'));
|
|
@@ -39,7 +41,7 @@ function KeyboardShortcutsHelpMenuItem({
|
|
|
39
41
|
var _default = (0, _data.withDispatch)(dispatch => {
|
|
40
42
|
const {
|
|
41
43
|
openModal
|
|
42
|
-
} = dispatch(
|
|
44
|
+
} = dispatch(_interface.store);
|
|
43
45
|
return {
|
|
44
46
|
openModal
|
|
45
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/plugins/keyboard-shortcuts-help-menu-item/index.js"],"names":["KeyboardShortcutsHelpMenuItem","openModal","displayShortcut","access","dispatch","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/plugins/keyboard-shortcuts-help-menu-item/index.js"],"names":["KeyboardShortcutsHelpMenuItem","openModal","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","displayShortcut","access","dispatch","interfaceStore"],"mappings":";;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAZA;AACA;AACA;;AAOA;AACA;AACA;AAGO,SAASA,6BAAT,CAAwC;AAAEC,EAAAA;AAAF,CAAxC,EAAwD;AAC9D,SACC,4BAAC,oBAAD;AACC,IAAA,OAAO,EAAG,MAAM;AACfA,MAAAA,SAAS,CAAEC,4DAAF,CAAT;AACA,KAHF;AAIC,IAAA,QAAQ,EAAGC,0BAAgBC,MAAhB,CAAwB,GAAxB;AAJZ,KAMG,cAAI,oBAAJ,CANH,CADD;AAUA;;eAEc,wBAAgBC,QAAF,IAAgB;AAC5C,QAAM;AAAEJ,IAAAA;AAAF,MAAgBI,QAAQ,CAAEC,gBAAF,CAA9B;AAEA,SAAO;AACNL,IAAAA;AADM,GAAP;AAGA,CANc,EAMVD,6BANU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { withDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\n\nexport function KeyboardShortcutsHelpMenuItem( { openModal } ) {\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t\t} }\n\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t>\n\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t</MenuItem>\n\t);\n}\n\nexport default withDispatch( ( dispatch ) => {\n\tconst { openModal } = dispatch( interfaceStore );\n\n\treturn {\n\t\topenModal,\n\t};\n} )( KeyboardShortcutsHelpMenuItem );\n"]}
|