@wordpress/edit-site 3.0.18 → 3.0.22
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/build/components/block-editor/index.js +1 -1
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +37 -7
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/constants.js +1 -11
- package/build/components/navigation-sidebar/navigation-panel/constants.js.map +1 -1
- package/build/plugins/site-export.js +1 -1
- package/build/plugins/site-export.js.map +1 -1
- package/build-module/components/block-editor/index.js +2 -2
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +37 -7
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js +0 -5
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js.map +1 -1
- package/build-module/plugins/site-export.js +2 -2
- package/build-module/plugins/site-export.js.map +1 -1
- package/build-style/style-rtl.css +11 -4
- package/build-style/style.css +11 -4
- package/package.json +8 -8
- package/src/components/block-editor/index.js +2 -2
- package/src/components/block-editor/resizable-editor.js +52 -12
- package/src/components/block-editor/style.scss +8 -0
- package/src/components/editor/style.scss +0 -1
- package/src/components/global-styles/style.scss +2 -1
- package/src/components/navigation-sidebar/navigation-panel/constants.js +0 -15
- package/src/components/navigation-sidebar/navigation-toggle/style.scss +8 -4
- package/src/plugins/site-export.js +2 -2
- package/build/components/navigation-sidebar/navigation-panel/content-navigation-item.js +0 -101
- package/build/components/navigation-sidebar/navigation-panel/content-navigation-item.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/content-categories.js +0 -82
- package/build/components/navigation-sidebar/navigation-panel/menus/content-categories.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/content-pages.js +0 -82
- package/build/components/navigation-sidebar/navigation-panel/menus/content-pages.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/content-posts.js +0 -107
- package/build/components/navigation-sidebar/navigation-panel/menus/content-posts.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/index.js +0 -57
- package/build/components/navigation-sidebar/navigation-panel/menus/index.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js +0 -48
- package/build/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/template-parts.js +0 -100
- package/build/components/navigation-sidebar/navigation-panel/menus/template-parts.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/templates-sub.js +0 -62
- package/build/components/navigation-sidebar/navigation-panel/menus/templates-sub.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/templates.js +0 -143
- package/build/components/navigation-sidebar/navigation-panel/menus/templates.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/navigation-entity-items.js +0 -76
- package/build/components/navigation-sidebar/navigation-panel/navigation-entity-items.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/new-template-dropdown.js +0 -125
- package/build/components/navigation-sidebar/navigation-panel/new-template-dropdown.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/search-results.js +0 -132
- package/build/components/navigation-sidebar/navigation-panel/search-results.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/template-navigation-item.js +0 -86
- package/build/components/navigation-sidebar/navigation-panel/template-navigation-item.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/template-preview.js +0 -46
- package/build/components/navigation-sidebar/navigation-panel/template-preview.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/use-debounced-search.js +0 -47
- package/build/components/navigation-sidebar/navigation-panel/use-debounced-search.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/utils.js +0 -21
- package/build/components/navigation-sidebar/navigation-panel/utils.js.map +0 -1
- package/build/utils/get-closest-available-template.js +0 -48
- package/build/utils/get-closest-available-template.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/content-navigation-item.js +0 -86
- package/build-module/components/navigation-sidebar/navigation-panel/content-navigation-item.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/content-categories.js +0 -65
- package/build-module/components/navigation-sidebar/navigation-panel/menus/content-categories.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/content-pages.js +0 -65
- package/build-module/components/navigation-sidebar/navigation-panel/menus/content-pages.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/content-posts.js +0 -90
- package/build-module/components/navigation-sidebar/navigation-panel/menus/content-posts.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/index.js +0 -40
- package/build-module/components/navigation-sidebar/navigation-panel/menus/index.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js +0 -35
- package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts.js +0 -84
- package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/templates-sub.js +0 -50
- package/build-module/components/navigation-sidebar/navigation-panel/menus/templates-sub.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/templates.js +0 -124
- package/build-module/components/navigation-sidebar/navigation-panel/menus/templates.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/navigation-entity-items.js +0 -65
- package/build-module/components/navigation-sidebar/navigation-panel/navigation-entity-items.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/new-template-dropdown.js +0 -106
- package/build-module/components/navigation-sidebar/navigation-panel/new-template-dropdown.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/search-results.js +0 -116
- package/build-module/components/navigation-sidebar/navigation-panel/search-results.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/template-navigation-item.js +0 -71
- package/build-module/components/navigation-sidebar/navigation-panel/template-navigation-item.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/template-preview.js +0 -38
- package/build-module/components/navigation-sidebar/navigation-panel/template-preview.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/use-debounced-search.js +0 -37
- package/build-module/components/navigation-sidebar/navigation-panel/use-debounced-search.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/utils.js +0 -8
- package/build-module/components/navigation-sidebar/navigation-panel/utils.js.map +0 -1
- package/build-module/utils/get-closest-available-template.js +0 -40
- package/build-module/utils/get-closest-available-template.js.map +0 -1
- package/src/components/navigation-sidebar/navigation-panel/content-navigation-item.js +0 -89
- package/src/components/navigation-sidebar/navigation-panel/menus/content-categories.js +0 -85
- package/src/components/navigation-sidebar/navigation-panel/menus/content-pages.js +0 -85
- package/src/components/navigation-sidebar/navigation-panel/menus/content-posts.js +0 -117
- package/src/components/navigation-sidebar/navigation-panel/menus/index.js +0 -61
- package/src/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js +0 -34
- package/src/components/navigation-sidebar/navigation-panel/menus/template-parts.js +0 -94
- package/src/components/navigation-sidebar/navigation-panel/menus/templates-sub.js +0 -42
- package/src/components/navigation-sidebar/navigation-panel/menus/templates.js +0 -147
- package/src/components/navigation-sidebar/navigation-panel/navigation-entity-items.js +0 -53
- package/src/components/navigation-sidebar/navigation-panel/new-template-dropdown.js +0 -110
- package/src/components/navigation-sidebar/navigation-panel/search-results.js +0 -117
- package/src/components/navigation-sidebar/navigation-panel/template-navigation-item.js +0 -83
- package/src/components/navigation-sidebar/navigation-panel/template-preview.js +0 -32
- package/src/components/navigation-sidebar/navigation-panel/use-debounced-search.js +0 -47
- package/src/components/navigation-sidebar/navigation-panel/utils.js +0 -11
- package/src/utils/get-closest-available-template.js +0 -31
|
@@ -110,7 +110,7 @@ function BlockEditor(_ref) {
|
|
|
110
110
|
clearSelectedBlock();
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
}, (0, _element.createElement)(_backButton.default, null), (0, _element.createElement)(_resizableEditor.default // Reinitialize the editor and reset the states when the template changes.
|
|
113
|
+
}, (0, _element.createElement)(_blockEditor.BlockEditorKeyboardShortcuts.Register, null), (0, _element.createElement)(_backButton.default, null), (0, _element.createElement)(_resizableEditor.default // Reinitialize the editor and reset the states when the template changes.
|
|
114
114
|
, {
|
|
115
115
|
key: templateId,
|
|
116
116
|
enableResizing: isTemplatePart && // Disable resizing in mobile viewport.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/index.js"],"names":["LAYOUT","type","alignments","BlockEditor","setIsInserterOpen","settings","templateType","templateId","page","select","getSettings","getEditedPostType","getEditedPostId","getPage","editSiteStore","blocks","onInput","onChange","setPage","contentRef","mergedRefs","isMobileViewport","clearSelectedBlock","blockEditorStore","isTemplatePart","fillProps","event","target","currentTarget","undefined","onClose"],"mappings":";;;;;;;;;AASA;;;;AANA;;AAKA;;AAEA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/index.js"],"names":["LAYOUT","type","alignments","BlockEditor","setIsInserterOpen","settings","templateType","templateId","page","select","getSettings","getEditedPostType","getEditedPostId","getPage","editSiteStore","blocks","onInput","onChange","setPage","contentRef","mergedRefs","isMobileViewport","clearSelectedBlock","blockEditorStore","isTemplatePart","fillProps","event","target","currentTarget","undefined","onClose"],"mappings":";;;;;;;;;AASA;;;;AANA;;AAKA;;AAEA;;AACA;;AAWA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAnCA;AACA;AACA;;AAGA;AACA;AACA;;AAkBA;AACA;AACA;AAUA,MAAMA,MAAM,GAAG;AACdC,EAAAA,IAAI,EAAE,SADQ;AAEd;AACAC,EAAAA,UAAU,EAAE;AAHE,CAAf;;AAMe,SAASC,WAAT,OAA8C;AAAA,MAAxB;AAAEC,IAAAA;AAAF,GAAwB;AAC5D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A,SADN;AAEC,IAAA,UAAU,EAAGjB,IAFd;AAGC,IAAA,kBAAkB,EAAGU;AAHtB,KAFA,EAQD,CAAEV,IAAF,CARC,CADH,CATD,EAqBC,4BAAC,6BAAD,QACC,4BAAC,2BAAD,OADD,CArBD,EAwBC,4BAAC,uBAAD;AACC,IAAA,SAAS,EAAG,yBAAY,yBAAZ,EAAuC;AAClD,uBAAiBgB;AADiC,KAAvC,CADb;AAIC,IAAA,oBAAoB,EAAGL,UAJxB;AAKC,IAAA,OAAO,EAAKO,KAAF,IAAa;AACtB;AACA,UAAKA,KAAK,CAACC,MAAN,KAAiBD,KAAK,CAACE,aAA5B,EAA4C;AAC3CN,QAAAA,kBAAkB;AAClB;AACD;AAVF,KAYC,4BAAC,yCAAD,CAA8B,QAA9B,OAZD,EAaC,4BAAC,mBAAD,OAbD,EAcC,4BAAC,wBAAD,CACC;AADD;AAEC,IAAA,GAAG,EAAGf,UAFP;AAGC,IAAA,cAAc,EACbiB,cAAc,IACd;AACA,KAAEH,gBANJ;AAQC,IAAA,QAAQ,EAAGhB,QARZ;AASC,IAAA,UAAU,EAAGe;AATd,KAWC,4BAAC,sBAAD;AACC,IAAA,SAAS,EAAC,mDADX;AAEC,IAAA,oBAAoB,EAAGpB,MAFxB;AAGC,IAAA,cAAc,EAAGwB,cAAc,GAAG,KAAH,GAAWK;AAH3C,IAXD,CAdD,EA+BC,4BAAC,iDAAD,QACG;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WACD,4BAAC,6BAAD;AAAsB,MAAA,OAAO,EAAGA;AAAhC,MADC;AAAA,GADH,CA/BD,CAxBD,EA6DC,4BAAC,uCAAD,OA7DD,CADD;AAiEA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useEntityBlockEditor } from '@wordpress/core-data';\nimport {\n\tBlockList,\n\tBlockEditorProvider,\n\t__experimentalLinkControl,\n\tBlockInspector,\n\tBlockTools,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tBlockEditorKeyboardShortcuts,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useMergeRefs, useViewportMatch } from '@wordpress/compose';\nimport { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartConverter from '../template-part-converter';\nimport NavigateToLink from '../navigate-to-link';\nimport { SidebarInspectorFill } from '../sidebar';\nimport { store as editSiteStore } from '../../store';\nimport BlockInspectorButton from './block-inspector-button';\nimport EditTemplatePartMenuButton from '../edit-template-part-menu-button';\nimport BackButton from './back-button';\nimport ResizableEditor from './resizable-editor';\n\nconst LAYOUT = {\n\ttype: 'default',\n\t// At the root level of the site editor, no alignments should be allowed.\n\talignments: [],\n};\n\nexport default function BlockEditor( { setIsInserterOpen } ) {\n\tconst { settings, templateType, templateId, page } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetSettings,\n\t\t\t\tgetEditedPostType,\n\t\t\t\tgetEditedPostId,\n\t\t\t\tgetPage,\n\t\t\t} = select( editSiteStore );\n\n\t\t\treturn {\n\t\t\t\tsettings: getSettings( setIsInserterOpen ),\n\t\t\t\ttemplateType: getEditedPostType(),\n\t\t\t\ttemplateId: getEditedPostId(),\n\t\t\t\tpage: getPage(),\n\t\t\t};\n\t\t},\n\t\t[ setIsInserterOpen ]\n\t);\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplateType\n\t);\n\tconst { setPage } = useDispatch( editSiteStore );\n\tconst contentRef = useRef();\n\tconst mergedRefs = useMergeRefs( [ contentRef, useTypingObserver() ] );\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\n\tconst isTemplatePart = templateType === 'wp_template_part';\n\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ settings }\n\t\t\tvalue={ blocks }\n\t\t\tonInput={ onInput }\n\t\t\tonChange={ onChange }\n\t\t\tuseSubRegistry={ false }\n\t\t>\n\t\t\t<EditTemplatePartMenuButton />\n\t\t\t<TemplatePartConverter />\n\t\t\t<__experimentalLinkControl.ViewerFill>\n\t\t\t\t{ useCallback(\n\t\t\t\t\t( fillProps ) => (\n\t\t\t\t\t\t<NavigateToLink\n\t\t\t\t\t\t\t{ ...fillProps }\n\t\t\t\t\t\t\tactivePage={ page }\n\t\t\t\t\t\t\tonActivePageChange={ setPage }\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\t[ page ]\n\t\t\t\t) }\n\t\t\t</__experimentalLinkControl.ViewerFill>\n\t\t\t<SidebarInspectorFill>\n\t\t\t\t<BlockInspector />\n\t\t\t</SidebarInspectorFill>\n\t\t\t<BlockTools\n\t\t\t\tclassName={ classnames( 'edit-site-visual-editor', {\n\t\t\t\t\t'is-focus-mode': isTemplatePart,\n\t\t\t\t} ) }\n\t\t\t\t__unstableContentRef={ contentRef }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t// Clear selected block when clicking on the gray background.\n\t\t\t\t\tif ( event.target === event.currentTarget ) {\n\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t\t<BackButton />\n\t\t\t\t<ResizableEditor\n\t\t\t\t\t// Reinitialize the editor and reset the states when the template changes.\n\t\t\t\t\tkey={ templateId }\n\t\t\t\t\tenableResizing={\n\t\t\t\t\t\tisTemplatePart &&\n\t\t\t\t\t\t// Disable resizing in mobile viewport.\n\t\t\t\t\t\t! isMobileViewport\n\t\t\t\t\t}\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tcontentRef={ mergedRefs }\n\t\t\t\t>\n\t\t\t\t\t<BlockList\n\t\t\t\t\t\tclassName=\"edit-site-block-editor__block-list wp-site-blocks\"\n\t\t\t\t\t\t__experimentalLayout={ LAYOUT }\n\t\t\t\t\t\trenderAppender={ isTemplatePart ? false : undefined }\n\t\t\t\t\t/>\n\t\t\t\t</ResizableEditor>\n\t\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<BlockInspectorButton onClick={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t\t</BlockTools>\n\t\t\t<ReusableBlocksMenuItems />\n\t\t</BlockEditorProvider>\n\t);\n}\n"]}
|
|
@@ -67,14 +67,41 @@ function ResizableEditor(_ref) {
|
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
let animationFrame = null;
|
|
71
|
+
|
|
72
|
+
function resizeHeight() {
|
|
73
|
+
if (!animationFrame) {
|
|
74
|
+
// Throttle the updates on animation frame.
|
|
75
|
+
animationFrame = iframe.contentWindow.requestAnimationFrame(() => {
|
|
76
|
+
setHeight(iframe.contentDocument.documentElement.scrollHeight);
|
|
77
|
+
animationFrame = null;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
let resizeObserver;
|
|
83
|
+
|
|
84
|
+
function registerObserver() {
|
|
85
|
+
var _resizeObserver;
|
|
86
|
+
|
|
87
|
+
(_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 ? void 0 : _resizeObserver.disconnect();
|
|
88
|
+
resizeObserver = new iframe.contentWindow.ResizeObserver(resizeHeight); // Observing the <html> rather than the <body> because the latter
|
|
89
|
+
// gets destroyed and remounted after initialization in <Iframe>.
|
|
74
90
|
|
|
75
|
-
|
|
91
|
+
resizeObserver.observe(iframe.contentDocument.documentElement);
|
|
92
|
+
resizeHeight();
|
|
93
|
+
} // This is only required in Firefox for some unknown reasons.
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
iframe.addEventListener('load', registerObserver); // This is required in Chrome and Safari.
|
|
97
|
+
|
|
98
|
+
registerObserver();
|
|
76
99
|
return () => {
|
|
77
|
-
|
|
100
|
+
var _iframe$contentWindow, _resizeObserver2;
|
|
101
|
+
|
|
102
|
+
(_iframe$contentWindow = iframe.contentWindow) === null || _iframe$contentWindow === void 0 ? void 0 : _iframe$contentWindow.cancelAnimationFrame(animationFrame);
|
|
103
|
+
(_resizeObserver2 = resizeObserver) === null || _resizeObserver2 === void 0 ? void 0 : _resizeObserver2.disconnect();
|
|
104
|
+
iframe.removeEventListener('load', registerObserver);
|
|
78
105
|
};
|
|
79
106
|
}, [enableResizing]);
|
|
80
107
|
const resizeWidthBy = (0, _element.useCallback)(deltaPixels => {
|
|
@@ -123,7 +150,10 @@ function ResizableEditor(_ref) {
|
|
|
123
150
|
styles: settings.styles
|
|
124
151
|
}), (0, _element.createElement)("style", null, // Forming a "block formatting context" to prevent margin collapsing.
|
|
125
152
|
// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
|
|
126
|
-
`.
|
|
153
|
+
`.is-root-container { display: flow-root; }`), enableResizing && (0, _element.createElement)("style", null, // Force the <html> and <body>'s heights to fit the content.
|
|
154
|
+
`html, body { height: -moz-fit-content !important; height: fit-content !important; min-height: 0 !important; }`, // Some themes will have `min-height: 100vh` for the root container,
|
|
155
|
+
// which isn't a requirement in auto resize mode.
|
|
156
|
+
`.is-root-container { min-height: 0 !important; }`)),
|
|
127
157
|
ref: ref,
|
|
128
158
|
name: "editor-canvas",
|
|
129
159
|
className: "edit-site-visual-editor__editor-canvas"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/resizable-editor.js"],"names":["DEFAULT_STYLES","width","height","HANDLE_STYLES_OVERRIDE","position","undefined","userSelect","cursor","top","right","bottom","left","ResizableEditor","enableResizing","settings","props","deviceType","select","editSiteStore","__experimentalGetPreviewDeviceType","deviceStyles","setWidth","setHeight","iframeRef","mouseMoveTypingResetRef","ref","autoResizeIframeHeight","iframe","current","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/resizable-editor.js"],"names":["DEFAULT_STYLES","width","height","HANDLE_STYLES_OVERRIDE","position","undefined","userSelect","cursor","top","right","bottom","left","ResizableEditor","enableResizing","settings","props","deviceType","select","editSiteStore","__experimentalGetPreviewDeviceType","deviceStyles","setWidth","setHeight","iframeRef","mouseMoveTypingResetRef","ref","autoResizeIframeHeight","iframe","current","animationFrame","resizeHeight","contentWindow","requestAnimationFrame","contentDocument","documentElement","scrollHeight","resizeObserver","registerObserver","disconnect","ResizeObserver","observe","addEventListener","cancelAnimationFrame","removeEventListener","resizeWidthBy","deltaPixels","offsetWidth","event","direction","element","style","styles"],"mappings":";;;;;;;;;AAGA;;;;AACA;;AACA;;AAMA;;AACA;;AAKA;;AACA;;AAlBA;AACA;AACA;;AAYA;AACA;AACA;AAIA,MAAMA,cAAc,GAAG;AACtBC,EAAAA,KAAK,EAAE,MADe;AAEtBC,EAAAA,MAAM,EAAE;AAFc,CAAvB,C,CAKA;;AACA,MAAMC,sBAAsB,GAAG;AAC9BC,EAAAA,QAAQ,EAAEC,SADoB;AAE9BC,EAAAA,UAAU,EAAED,SAFkB;AAG9BE,EAAAA,MAAM,EAAEF,SAHsB;AAI9BJ,EAAAA,KAAK,EAAEI,SAJuB;AAK9BH,EAAAA,MAAM,EAAEG,SALsB;AAM9BG,EAAAA,GAAG,EAAEH,SANyB;AAO9BI,EAAAA,KAAK,EAAEJ,SAPuB;AAQ9BK,EAAAA,MAAM,EAAEL,SARsB;AAS9BM,EAAAA,IAAI,EAAEN;AATwB,CAA/B;;AAYA,SAASO,eAAT,OAAmE;AAAA,MAAzC;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,QAAlB;AAA4B,OAAGC;AAA/B,GAAyC;AAClE,QAAMC,UAAU,GAAG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ACJ,4BAAC,qBAAD;AACC,QAAA,SAAS,EAAC,OADX;AAEC,QAAA,aAAa,EAAGmC;AAFjB;AARgB,KApBnB;AAkCC,IAAA,aAAa,EAAGvC,SAlCjB;AAmCC,IAAA,YAAY,EAAG;AACdM,MAAAA,IAAI,EAAER,sBADQ;AAEdM,MAAAA,KAAK,EAAEN;AAFO;AAnChB,KAwCC,4BAAC,6BAAD;AACC,IAAA,KAAK,EAAGU,cAAc,GAAGR,SAAH,GAAee,YADtC;AAEC,IAAA,IAAI,EACH,qDACC,4BAAC,mCAAD;AAAc,MAAA,MAAM,EAAGN,QAAQ,CAACqC;AAAhC,MADD,EAEC,2CACC;AACA;AACC,gDAHF,CAFD,EAOGtC,cAAc,IACf,2CAEE;AACC,mHAHH,EAME;AACA;AACC,sDARH,CARF,CAHF;AAyBC,IAAA,GAAG,EAAGY,GAzBP;AA0BC,IAAA,IAAI,EAAC,eA1BN;AA2BC,IAAA,SAAS,EAAC;AA3BX,KA4BMV,KA5BN,EAxCD,CADD;AAyEA;;eAEcH,e","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useRef, useCallback } from '@wordpress/element';\nimport { ResizableBox } from '@wordpress/components';\nimport {\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport ResizeHandle from './resize-handle';\n\nconst DEFAULT_STYLES = {\n\twidth: '100%',\n\theight: '100%',\n};\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\nfunction ResizableEditor( { enableResizing, settings, ...props } ) {\n\tconst deviceType = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editSiteStore ).__experimentalGetPreviewDeviceType(),\n\t\t[]\n\t);\n\tconst deviceStyles = useResizeCanvas( deviceType );\n\tconst [ width, setWidth ] = useState( DEFAULT_STYLES.width );\n\tconst [ height, setHeight ] = useState( DEFAULT_STYLES.height );\n\tconst iframeRef = useRef();\n\tconst mouseMoveTypingResetRef = useMouseMoveTypingReset();\n\tconst ref = useMergeRefs( [ iframeRef, mouseMoveTypingResetRef ] );\n\n\tuseEffect(\n\t\tfunction autoResizeIframeHeight() {\n\t\t\tconst iframe = iframeRef.current;\n\n\t\t\tif ( ! iframe || ! enableResizing ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet animationFrame = null;\n\n\t\t\tfunction resizeHeight() {\n\t\t\t\tif ( ! animationFrame ) {\n\t\t\t\t\t// Throttle the updates on animation frame.\n\t\t\t\t\tanimationFrame = iframe.contentWindow.requestAnimationFrame(\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\tsetHeight(\n\t\t\t\t\t\t\t\tiframe.contentDocument.documentElement\n\t\t\t\t\t\t\t\t\t.scrollHeight\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tanimationFrame = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet resizeObserver;\n\n\t\t\tfunction registerObserver() {\n\t\t\t\tresizeObserver?.disconnect();\n\n\t\t\t\tresizeObserver = new iframe.contentWindow.ResizeObserver(\n\t\t\t\t\tresizeHeight\n\t\t\t\t);\n\t\t\t\t// Observing the <html> rather than the <body> because the latter\n\t\t\t\t// gets destroyed and remounted after initialization in <Iframe>.\n\t\t\t\tresizeObserver.observe(\n\t\t\t\t\tiframe.contentDocument.documentElement\n\t\t\t\t);\n\n\t\t\t\tresizeHeight();\n\t\t\t}\n\n\t\t\t// This is only required in Firefox for some unknown reasons.\n\t\t\tiframe.addEventListener( 'load', registerObserver );\n\t\t\t// This is required in Chrome and Safari.\n\t\t\tregisterObserver();\n\n\t\t\treturn () => {\n\t\t\t\tiframe.contentWindow?.cancelAnimationFrame( animationFrame );\n\t\t\t\tresizeObserver?.disconnect();\n\t\t\t\tiframe.removeEventListener( 'load', registerObserver );\n\t\t\t};\n\t\t},\n\t\t[ enableResizing ]\n\t);\n\n\tconst resizeWidthBy = useCallback( ( deltaPixels ) => {\n\t\tif ( iframeRef.current ) {\n\t\t\tsetWidth( iframeRef.current.offsetWidth + deltaPixels );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tsize={ {\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t} }\n\t\t\tonResizeStop={ ( event, direction, element ) => {\n\t\t\t\tsetWidth( element.style.width );\n\t\t\t} }\n\t\t\tminWidth={ 300 }\n\t\t\tmaxWidth=\"100%\"\n\t\t\tmaxHeight=\"100%\"\n\t\t\tenable={ {\n\t\t\t\tright: enableResizing,\n\t\t\t\tleft: enableResizing,\n\t\t\t} }\n\t\t\tshowHandle={ enableResizing }\n\t\t\t// The editor is centered horizontally, resizing it only\n\t\t\t// moves half the distance. Hence double the ratio to correctly\n\t\t\t// align the cursor to the resizer handle.\n\t\t\tresizeRatio={ 2 }\n\t\t\thandleComponent={ {\n\t\t\t\tleft: (\n\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\tdirection=\"left\"\n\t\t\t\t\t\tresizeWidthBy={ resizeWidthBy }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t\tright: (\n\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\tdirection=\"right\"\n\t\t\t\t\t\tresizeWidthBy={ resizeWidthBy }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t} }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t>\n\t\t\t<Iframe\n\t\t\t\tstyle={ enableResizing ? undefined : deviceStyles }\n\t\t\t\thead={\n\t\t\t\t\t<>\n\t\t\t\t\t\t<EditorStyles styles={ settings.styles } />\n\t\t\t\t\t\t<style>{\n\t\t\t\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t\t\t\t`.is-root-container { display: flow-root; }`\n\t\t\t\t\t\t}</style>\n\t\t\t\t\t\t{ enableResizing && (\n\t\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// Force the <html> and <body>'s heights to fit the content.\n\t\t\t\t\t\t\t\t\t`html, body { height: -moz-fit-content !important; height: fit-content !important; min-height: 0 !important; }`\n\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\t\t// Some themes will have `min-height: 100vh` for the root container,\n\t\t\t\t\t\t\t\t\t// which isn't a requirement in auto resize mode.\n\t\t\t\t\t\t\t\t\t`.is-root-container { min-height: 0 !important; }`\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</style>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tref={ ref }\n\t\t\t\tname=\"editor-canvas\"\n\t\t\t\tclassName=\"edit-site-visual-editor__editor-canvas\"\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableEditor;\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.TEMPLATE_PARTS_SUB_MENUS = exports.TEMPLATE_OVERRIDES = exports.TEMPLATES_TOP_LEVEL = exports.TEMPLATES_SECONDARY = exports.TEMPLATES_PRIMARY = exports.TEMPLATES_POSTS_PREFIXES = exports.TEMPLATES_PAGES_PREFIXES = exports.
|
|
6
|
+
exports.TEMPLATE_PARTS_SUB_MENUS = exports.TEMPLATE_OVERRIDES = exports.TEMPLATES_TOP_LEVEL = exports.TEMPLATES_SECONDARY = exports.TEMPLATES_PRIMARY = exports.TEMPLATES_POSTS_PREFIXES = exports.TEMPLATES_PAGES_PREFIXES = exports.TEMPLATES_GENERAL = exports.MENU_TEMPLATE_PARTS_SIDEBARS = exports.MENU_TEMPLATE_PARTS_HEADERS = exports.MENU_TEMPLATE_PARTS_GENERAL = exports.MENU_TEMPLATE_PARTS_FOOTERS = exports.MENU_TEMPLATE_PARTS = exports.MENU_TEMPLATES_UNUSED = exports.MENU_TEMPLATES_POSTS = exports.MENU_TEMPLATES_PAGES = exports.MENU_TEMPLATES_GENERAL = exports.MENU_TEMPLATES = exports.MENU_ROOT = void 0;
|
|
7
7
|
|
|
8
8
|
var _i18n = require("@wordpress/i18n");
|
|
9
9
|
|
|
@@ -28,8 +28,6 @@ const TEMPLATES_POSTS_PREFIXES = ['post-', 'author-', 'single-post-', 'tag-'];
|
|
|
28
28
|
exports.TEMPLATES_POSTS_PREFIXES = TEMPLATES_POSTS_PREFIXES;
|
|
29
29
|
const TEMPLATES_PAGES_PREFIXES = ['page-'];
|
|
30
30
|
exports.TEMPLATES_PAGES_PREFIXES = TEMPLATES_PAGES_PREFIXES;
|
|
31
|
-
const TEMPLATES_NEW_OPTIONS = ['front-page', 'single-post', 'page', 'archive', 'search', '404', 'index'];
|
|
32
|
-
exports.TEMPLATES_NEW_OPTIONS = TEMPLATES_NEW_OPTIONS;
|
|
33
31
|
const TEMPLATE_OVERRIDES = {
|
|
34
32
|
singular: ['single', 'page'],
|
|
35
33
|
index: ['archive', '404', 'search', 'singular', 'home'],
|
|
@@ -38,12 +36,6 @@ const TEMPLATE_OVERRIDES = {
|
|
|
38
36
|
exports.TEMPLATE_OVERRIDES = TEMPLATE_OVERRIDES;
|
|
39
37
|
const MENU_ROOT = 'root';
|
|
40
38
|
exports.MENU_ROOT = MENU_ROOT;
|
|
41
|
-
const MENU_CONTENT_CATEGORIES = 'content-categories';
|
|
42
|
-
exports.MENU_CONTENT_CATEGORIES = MENU_CONTENT_CATEGORIES;
|
|
43
|
-
const MENU_CONTENT_PAGES = 'content-pages';
|
|
44
|
-
exports.MENU_CONTENT_PAGES = MENU_CONTENT_PAGES;
|
|
45
|
-
const MENU_CONTENT_POSTS = 'content-posts';
|
|
46
|
-
exports.MENU_CONTENT_POSTS = MENU_CONTENT_POSTS;
|
|
47
39
|
const MENU_TEMPLATE_PARTS = 'template-parts';
|
|
48
40
|
exports.MENU_TEMPLATE_PARTS = MENU_TEMPLATE_PARTS;
|
|
49
41
|
const MENU_TEMPLATES = 'templates';
|
|
@@ -56,8 +48,6 @@ const MENU_TEMPLATES_POSTS = 'templates-posts';
|
|
|
56
48
|
exports.MENU_TEMPLATES_POSTS = MENU_TEMPLATES_POSTS;
|
|
57
49
|
const MENU_TEMPLATES_UNUSED = 'templates-unused';
|
|
58
50
|
exports.MENU_TEMPLATES_UNUSED = MENU_TEMPLATES_UNUSED;
|
|
59
|
-
const SEARCH_DEBOUNCE_IN_MS = 75;
|
|
60
|
-
exports.SEARCH_DEBOUNCE_IN_MS = SEARCH_DEBOUNCE_IN_MS;
|
|
61
51
|
const MENU_TEMPLATE_PARTS_HEADERS = 'template-parts-headers';
|
|
62
52
|
exports.MENU_TEMPLATE_PARTS_HEADERS = MENU_TEMPLATE_PARTS_HEADERS;
|
|
63
53
|
const MENU_TEMPLATE_PARTS_FOOTERS = 'template-parts-footers';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-panel/constants.js"],"names":["TEMPLATES_PRIMARY","TEMPLATES_SECONDARY","TEMPLATES_TOP_LEVEL","TEMPLATES_GENERAL","TEMPLATES_POSTS_PREFIXES","TEMPLATES_PAGES_PREFIXES","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-panel/constants.js"],"names":["TEMPLATES_PRIMARY","TEMPLATES_SECONDARY","TEMPLATES_TOP_LEVEL","TEMPLATES_GENERAL","TEMPLATES_POSTS_PREFIXES","TEMPLATES_PAGES_PREFIXES","TEMPLATE_OVERRIDES","singular","index","home","MENU_ROOT","MENU_TEMPLATE_PARTS","MENU_TEMPLATES","MENU_TEMPLATES_GENERAL","MENU_TEMPLATES_PAGES","MENU_TEMPLATES_POSTS","MENU_TEMPLATES_UNUSED","MENU_TEMPLATE_PARTS_HEADERS","MENU_TEMPLATE_PARTS_FOOTERS","MENU_TEMPLATE_PARTS_SIDEBARS","MENU_TEMPLATE_PARTS_GENERAL","TEMPLATE_PARTS_SUB_MENUS","area","TEMPLATE_PART_AREA_HEADER","menu","title","TEMPLATE_PART_AREA_FOOTER","TEMPLATE_PART_AREA_SIDEBAR","TEMPLATE_PART_AREA_GENERAL"],"mappings":";;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAQO,MAAMA,iBAAiB,GAAG,CAChC,OADgC,EAEhC,UAFgC,EAGhC,SAHgC,EAIhC,QAJgC,EAKhC,MALgC,EAMhC,MANgC,EAOhC,KAPgC,EAQhC,QARgC,CAA1B;;AAWA,MAAMC,mBAAmB,GAAG,CAClC,QADkC,EAElC,UAFkC,EAGlC,UAHkC,EAIlC,MAJkC,EAKlC,KALkC,EAMlC,YANkC,EAOlC,aAPkC,EAQlC,YARkC,CAA5B;;AAWA,MAAMC,mBAAmB,GAAG,CAClC,GAAGF,iBAD+B,EAElC,GAAGC,mBAF+B,CAA5B;;AAKA,MAAME,iBAAiB,GAAG,CAAE,WAAF,CAA1B;;AAEA,MAAMC,wBAAwB,GAAG,CACvC,OADuC,EAEvC,SAFuC,EAGvC,cAHuC,EAIvC,MAJuC,CAAjC;;AAOA,MAAMC,wBAAwB,GAAG,CAAE,OAAF,CAAjC;;AA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n * Internal dependencies\n */\nimport {\n\tTEMPLATE_PART_AREA_HEADER,\n\tTEMPLATE_PART_AREA_FOOTER,\n\tTEMPLATE_PART_AREA_SIDEBAR,\n\tTEMPLATE_PART_AREA_GENERAL,\n} from '../../../store/constants';\n\nexport const TEMPLATES_PRIMARY = [\n\t'index',\n\t'singular',\n\t'archive',\n\t'single',\n\t'page',\n\t'home',\n\t'404',\n\t'search',\n];\n\nexport const TEMPLATES_SECONDARY = [\n\t'author',\n\t'category',\n\t'taxonomy',\n\t'date',\n\t'tag',\n\t'attachment',\n\t'single-post',\n\t'front-page',\n];\n\nexport const TEMPLATES_TOP_LEVEL = [\n\t...TEMPLATES_PRIMARY,\n\t...TEMPLATES_SECONDARY,\n];\n\nexport const TEMPLATES_GENERAL = [ 'page-home' ];\n\nexport const TEMPLATES_POSTS_PREFIXES = [\n\t'post-',\n\t'author-',\n\t'single-post-',\n\t'tag-',\n];\n\nexport const TEMPLATES_PAGES_PREFIXES = [ 'page-' ];\n\nexport const TEMPLATE_OVERRIDES = {\n\tsingular: [ 'single', 'page' ],\n\tindex: [ 'archive', '404', 'search', 'singular', 'home' ],\n\thome: [ 'front-page' ],\n};\n\nexport const MENU_ROOT = 'root';\nexport const MENU_TEMPLATE_PARTS = 'template-parts';\nexport const MENU_TEMPLATES = 'templates';\nexport const MENU_TEMPLATES_GENERAL = 'templates-general';\nexport const MENU_TEMPLATES_PAGES = 'templates-pages';\nexport const MENU_TEMPLATES_POSTS = 'templates-posts';\nexport const MENU_TEMPLATES_UNUSED = 'templates-unused';\n\nexport const MENU_TEMPLATE_PARTS_HEADERS = 'template-parts-headers';\nexport const MENU_TEMPLATE_PARTS_FOOTERS = 'template-parts-footers';\nexport const MENU_TEMPLATE_PARTS_SIDEBARS = 'template-parts-sidebars';\nexport const MENU_TEMPLATE_PARTS_GENERAL = 'template-parts-general';\n\nexport const TEMPLATE_PARTS_SUB_MENUS = [\n\t{\n\t\tarea: TEMPLATE_PART_AREA_HEADER,\n\t\tmenu: MENU_TEMPLATE_PARTS_HEADERS,\n\t\ttitle: __( 'headers' ),\n\t},\n\t{\n\t\tarea: TEMPLATE_PART_AREA_FOOTER,\n\t\tmenu: MENU_TEMPLATE_PARTS_FOOTERS,\n\t\ttitle: __( 'footers' ),\n\t},\n\t{\n\t\tarea: TEMPLATE_PART_AREA_SIDEBAR,\n\t\tmenu: MENU_TEMPLATE_PARTS_SIDEBARS,\n\t\ttitle: __( 'sidebars' ),\n\t},\n\t{\n\t\tarea: TEMPLATE_PART_AREA_GENERAL,\n\t\tmenu: MENU_TEMPLATE_PARTS_GENERAL,\n\t\ttitle: __( 'general' ),\n\t},\n];\n"]}
|
|
@@ -62,6 +62,6 @@ function SiteExport() {
|
|
|
62
62
|
icon: _icons.download,
|
|
63
63
|
onClick: handleExport,
|
|
64
64
|
info: (0, _i18n.__)('Download your templates and template parts.')
|
|
65
|
-
}, (0, _i18n.
|
|
65
|
+
}, (0, _i18n._x)('Export', 'site exporter menu item'));
|
|
66
66
|
}
|
|
67
67
|
//# sourceMappingURL=site-export.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/plugins/site-export.js"],"names":["SiteExport","createErrorNotice","noticesStore","handleExport","response","path","parse","blob","errorResponse","error","json","e","errorMessage","message","code","type","download"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;AAQe,SAASA,UAAT,GAAsB;AACpC,QAAM;AAAEC,IAAAA;AAAF,MAAwB,uBAAaC,cAAb,CAA9B;;AAEA,iBAAeC,YAAf,GAA8B;AAC7B,QAAI;AACH,YAAMC,QAAQ,GAAG,MAAM,uBAAU;AAChCC,QAAAA,IAAI,EAAE,4BAD0B;AAEhCC,QAAAA,KAAK,EAAE;AAFyB,OAAV,CAAvB;AAIA,YAAMC,IAAI,GAAG,MAAMH,QAAQ,CAACG,IAAT,EAAnB;AAEA,+BAAYA,IAAZ,EAAkB,sBAAlB,EAA0C,iBAA1C;AACA,KARD,CAQE,OAAQC,aAAR,EAAwB;AACzB,UAAIC,KAAK,GAAG,EAAZ;;AACA,UAAI;AACHA,QAAAA,KAAK,GAAG,MAAMD,aAAa,CAACE,IAAd,EAAd;AACA,OAFD,CAEE,OAAQC,CAAR,EAAY,CAAE;;AAChB,YAAMC,YAAY,GACjBH,KAAK,CAACI,OAAN,IAAiBJ,KAAK,CAACK,IAAN,KAAe,eAAhC,GACGL,KAAK,CAACI,OADT,GAEG,cAAI,mDAAJ,CAHJ;AAKAZ,MAAAA,iBAAiB,CAAEW,YAAF,EAAgB;AAAEG,QAAAA,IAAI,EAAE;AAAR,OAAhB,CAAjB;AACA;AACD;;AAED,SACC,4BAAC,oBAAD;AACC,IAAA,IAAI,EAAC,UADN;AAEC,IAAA,IAAI,EAAGC,eAFR;AAGC,IAAA,OAAO,EAAGb,YAHX;AAIC,IAAA,IAAI,EAAG,cAAI,6CAAJ;AAJR,KAMG,cAAI,QAAJ,CANH,CADD;AAUA","sourcesContent":["/**\n * External dependencies\n */\nimport downloadjs from 'downloadjs';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport apiFetch from '@wordpress/api-fetch';\nimport { download } from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport default function SiteExport() {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tasync function handleExport() {\n\t\ttry {\n\t\t\tconst response = await apiFetch( {\n\t\t\t\tpath: '/wp-block-editor/v1/export',\n\t\t\t\tparse: false,\n\t\t\t} );\n\t\t\tconst blob = await response.blob();\n\n\t\t\tdownloadjs( blob, 'edit-site-export.zip', 'application/zip' );\n\t\t} catch ( errorResponse ) {\n\t\t\tlet error = {};\n\t\t\ttry {\n\t\t\t\terror = await errorResponse.json();\n\t\t\t} catch ( e ) {}\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while creating the site export.' );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\trole=\"menuitem\"\n\t\t\ticon={ download }\n\t\t\tonClick={ handleExport }\n\t\t\tinfo={ __( 'Download your templates and template parts.' ) }\n\t\t>\n\t\t\t{
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/plugins/site-export.js"],"names":["SiteExport","createErrorNotice","noticesStore","handleExport","response","path","parse","blob","errorResponse","error","json","e","errorMessage","message","code","type","download"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;AAQe,SAASA,UAAT,GAAsB;AACpC,QAAM;AAAEC,IAAAA;AAAF,MAAwB,uBAAaC,cAAb,CAA9B;;AAEA,iBAAeC,YAAf,GAA8B;AAC7B,QAAI;AACH,YAAMC,QAAQ,GAAG,MAAM,uBAAU;AAChCC,QAAAA,IAAI,EAAE,4BAD0B;AAEhCC,QAAAA,KAAK,EAAE;AAFyB,OAAV,CAAvB;AAIA,YAAMC,IAAI,GAAG,MAAMH,QAAQ,CAACG,IAAT,EAAnB;AAEA,+BAAYA,IAAZ,EAAkB,sBAAlB,EAA0C,iBAA1C;AACA,KARD,CAQE,OAAQC,aAAR,EAAwB;AACzB,UAAIC,KAAK,GAAG,EAAZ;;AACA,UAAI;AACHA,QAAAA,KAAK,GAAG,MAAMD,aAAa,CAACE,IAAd,EAAd;AACA,OAFD,CAEE,OAAQC,CAAR,EAAY,CAAE;;AAChB,YAAMC,YAAY,GACjBH,KAAK,CAACI,OAAN,IAAiBJ,KAAK,CAACK,IAAN,KAAe,eAAhC,GACGL,KAAK,CAACI,OADT,GAEG,cAAI,mDAAJ,CAHJ;AAKAZ,MAAAA,iBAAiB,CAAEW,YAAF,EAAgB;AAAEG,QAAAA,IAAI,EAAE;AAAR,OAAhB,CAAjB;AACA;AACD;;AAED,SACC,4BAAC,oBAAD;AACC,IAAA,IAAI,EAAC,UADN;AAEC,IAAA,IAAI,EAAGC,eAFR;AAGC,IAAA,OAAO,EAAGb,YAHX;AAIC,IAAA,IAAI,EAAG,cAAI,6CAAJ;AAJR,KAMG,cAAI,QAAJ,EAAc,yBAAd,CANH,CADD;AAUA","sourcesContent":["/**\n * External dependencies\n */\nimport downloadjs from 'downloadjs';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport apiFetch from '@wordpress/api-fetch';\nimport { download } from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport default function SiteExport() {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tasync function handleExport() {\n\t\ttry {\n\t\t\tconst response = await apiFetch( {\n\t\t\t\tpath: '/wp-block-editor/v1/export',\n\t\t\t\tparse: false,\n\t\t\t} );\n\t\t\tconst blob = await response.blob();\n\n\t\t\tdownloadjs( blob, 'edit-site-export.zip', 'application/zip' );\n\t\t} catch ( errorResponse ) {\n\t\t\tlet error = {};\n\t\t\ttry {\n\t\t\t\terror = await errorResponse.json();\n\t\t\t} catch ( e ) {}\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while creating the site export.' );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\trole=\"menuitem\"\n\t\t\ticon={ download }\n\t\t\tonClick={ handleExport }\n\t\t\tinfo={ __( 'Download your templates and template parts.' ) }\n\t\t>\n\t\t\t{ _x( 'Export', 'site exporter menu item' ) }\n\t\t</MenuItem>\n\t);\n}\n"]}
|
|
@@ -12,7 +12,7 @@ import classnames from 'classnames';
|
|
|
12
12
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
13
13
|
import { useCallback, useRef } from '@wordpress/element';
|
|
14
14
|
import { useEntityBlockEditor } from '@wordpress/core-data';
|
|
15
|
-
import { BlockList, BlockEditorProvider, __experimentalLinkControl, BlockInspector, BlockTools, __unstableBlockSettingsMenuFirstItem, __unstableUseTypingObserver as useTypingObserver, store as blockEditorStore } from '@wordpress/block-editor';
|
|
15
|
+
import { BlockList, BlockEditorProvider, __experimentalLinkControl, BlockInspector, BlockTools, __unstableBlockSettingsMenuFirstItem, __unstableUseTypingObserver as useTypingObserver, BlockEditorKeyboardShortcuts, store as blockEditorStore } from '@wordpress/block-editor';
|
|
16
16
|
import { useMergeRefs, useViewportMatch } from '@wordpress/compose';
|
|
17
17
|
import { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';
|
|
18
18
|
/**
|
|
@@ -86,7 +86,7 @@ export default function BlockEditor(_ref) {
|
|
|
86
86
|
clearSelectedBlock();
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
}, createElement(BackButton, null), createElement(ResizableEditor // Reinitialize the editor and reset the states when the template changes.
|
|
89
|
+
}, createElement(BlockEditorKeyboardShortcuts.Register, null), createElement(BackButton, null), createElement(ResizableEditor // Reinitialize the editor and reset the states when the template changes.
|
|
90
90
|
, {
|
|
91
91
|
key: templateId,
|
|
92
92
|
enableResizing: isTemplatePart && // Disable resizing in mobile viewport.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/index.js"],"names":["classnames","useSelect","useDispatch","useCallback","useRef","useEntityBlockEditor","BlockList","BlockEditorProvider","__experimentalLinkControl","BlockInspector","BlockTools","__unstableBlockSettingsMenuFirstItem","__unstableUseTypingObserver","useTypingObserver","store","blockEditorStore","useMergeRefs","useViewportMatch","ReusableBlocksMenuItems","TemplatePartConverter","NavigateToLink","SidebarInspectorFill","editSiteStore","BlockInspectorButton","EditTemplatePartMenuButton","BackButton","ResizableEditor","LAYOUT","type","alignments","BlockEditor","setIsInserterOpen","settings","templateType","templateId","page","select","getSettings","getEditedPostType","getEditedPostId","getPage","blocks","onInput","onChange","setPage","contentRef","mergedRefs","isMobileViewport","clearSelectedBlock","isTemplatePart","fillProps","event","target","currentTarget","undefined","onClose"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,oBAApC;AACA,SAASC,oBAAT,QAAqC,sBAArC;AACA,SACCC,SADD,EAECC,mBAFD,EAGCC,yBAHD,EAICC,cAJD,EAKCC,UALD,EAMCC,oCAND,EAOCC,2BAA2B,IAAIC,iBAPhC,EAQCC,KAAK,IAAIC,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/index.js"],"names":["classnames","useSelect","useDispatch","useCallback","useRef","useEntityBlockEditor","BlockList","BlockEditorProvider","__experimentalLinkControl","BlockInspector","BlockTools","__unstableBlockSettingsMenuFirstItem","__unstableUseTypingObserver","useTypingObserver","BlockEditorKeyboardShortcuts","store","blockEditorStore","useMergeRefs","useViewportMatch","ReusableBlocksMenuItems","TemplatePartConverter","NavigateToLink","SidebarInspectorFill","editSiteStore","BlockInspectorButton","EditTemplatePartMenuButton","BackButton","ResizableEditor","LAYOUT","type","alignments","BlockEditor","setIsInserterOpen","settings","templateType","templateId","page","select","getSettings","getEditedPostType","getEditedPostId","getPage","blocks","onInput","onChange","setPage","contentRef","mergedRefs","isMobileViewport","clearSelectedBlock","isTemplatePart","fillProps","event","target","currentTarget","undefined","onClose"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,WAAT,EAAsBC,M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,KAAiBD,KAAK,CAACE,aAA5B,EAA4C;AAC3CL,QAAAA,kBAAkB;AAClB;AACD;AAVF,KAYC,cAAC,4BAAD,CAA8B,QAA9B,OAZD,EAaC,cAAC,UAAD,OAbD,EAcC,cAAC,eAAD,CACC;AADD;AAEC,IAAA,GAAG,EAAGd,UAFP;AAGC,IAAA,cAAc,EACbe,cAAc,IACd;AACA,KAAEF,gBANJ;AAQC,IAAA,QAAQ,EAAGf,QARZ;AASC,IAAA,UAAU,EAAGc;AATd,KAWC,cAAC,SAAD;AACC,IAAA,SAAS,EAAC,mDADX;AAEC,IAAA,oBAAoB,EAAGnB,MAFxB;AAGC,IAAA,cAAc,EAAGsB,cAAc,GAAG,KAAH,GAAWK;AAH3C,IAXD,CAdD,EA+BC,cAAC,oCAAD,QACG;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WACD,cAAC,oBAAD;AAAsB,MAAA,OAAO,EAAGA;AAAhC,MADC;AAAA,GADH,CA/BD,CAxBD,EA6DC,cAAC,uBAAD,OA7DD,CADD;AAiEA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useEntityBlockEditor } from '@wordpress/core-data';\nimport {\n\tBlockList,\n\tBlockEditorProvider,\n\t__experimentalLinkControl,\n\tBlockInspector,\n\tBlockTools,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tBlockEditorKeyboardShortcuts,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useMergeRefs, useViewportMatch } from '@wordpress/compose';\nimport { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartConverter from '../template-part-converter';\nimport NavigateToLink from '../navigate-to-link';\nimport { SidebarInspectorFill } from '../sidebar';\nimport { store as editSiteStore } from '../../store';\nimport BlockInspectorButton from './block-inspector-button';\nimport EditTemplatePartMenuButton from '../edit-template-part-menu-button';\nimport BackButton from './back-button';\nimport ResizableEditor from './resizable-editor';\n\nconst LAYOUT = {\n\ttype: 'default',\n\t// At the root level of the site editor, no alignments should be allowed.\n\talignments: [],\n};\n\nexport default function BlockEditor( { setIsInserterOpen } ) {\n\tconst { settings, templateType, templateId, page } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetSettings,\n\t\t\t\tgetEditedPostType,\n\t\t\t\tgetEditedPostId,\n\t\t\t\tgetPage,\n\t\t\t} = select( editSiteStore );\n\n\t\t\treturn {\n\t\t\t\tsettings: getSettings( setIsInserterOpen ),\n\t\t\t\ttemplateType: getEditedPostType(),\n\t\t\t\ttemplateId: getEditedPostId(),\n\t\t\t\tpage: getPage(),\n\t\t\t};\n\t\t},\n\t\t[ setIsInserterOpen ]\n\t);\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplateType\n\t);\n\tconst { setPage } = useDispatch( editSiteStore );\n\tconst contentRef = useRef();\n\tconst mergedRefs = useMergeRefs( [ contentRef, useTypingObserver() ] );\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\n\tconst isTemplatePart = templateType === 'wp_template_part';\n\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ settings }\n\t\t\tvalue={ blocks }\n\t\t\tonInput={ onInput }\n\t\t\tonChange={ onChange }\n\t\t\tuseSubRegistry={ false }\n\t\t>\n\t\t\t<EditTemplatePartMenuButton />\n\t\t\t<TemplatePartConverter />\n\t\t\t<__experimentalLinkControl.ViewerFill>\n\t\t\t\t{ useCallback(\n\t\t\t\t\t( fillProps ) => (\n\t\t\t\t\t\t<NavigateToLink\n\t\t\t\t\t\t\t{ ...fillProps }\n\t\t\t\t\t\t\tactivePage={ page }\n\t\t\t\t\t\t\tonActivePageChange={ setPage }\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\t[ page ]\n\t\t\t\t) }\n\t\t\t</__experimentalLinkControl.ViewerFill>\n\t\t\t<SidebarInspectorFill>\n\t\t\t\t<BlockInspector />\n\t\t\t</SidebarInspectorFill>\n\t\t\t<BlockTools\n\t\t\t\tclassName={ classnames( 'edit-site-visual-editor', {\n\t\t\t\t\t'is-focus-mode': isTemplatePart,\n\t\t\t\t} ) }\n\t\t\t\t__unstableContentRef={ contentRef }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t// Clear selected block when clicking on the gray background.\n\t\t\t\t\tif ( event.target === event.currentTarget ) {\n\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t\t<BackButton />\n\t\t\t\t<ResizableEditor\n\t\t\t\t\t// Reinitialize the editor and reset the states when the template changes.\n\t\t\t\t\tkey={ templateId }\n\t\t\t\t\tenableResizing={\n\t\t\t\t\t\tisTemplatePart &&\n\t\t\t\t\t\t// Disable resizing in mobile viewport.\n\t\t\t\t\t\t! isMobileViewport\n\t\t\t\t\t}\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tcontentRef={ mergedRefs }\n\t\t\t\t>\n\t\t\t\t\t<BlockList\n\t\t\t\t\t\tclassName=\"edit-site-block-editor__block-list wp-site-blocks\"\n\t\t\t\t\t\t__experimentalLayout={ LAYOUT }\n\t\t\t\t\t\trenderAppender={ isTemplatePart ? false : undefined }\n\t\t\t\t\t/>\n\t\t\t\t</ResizableEditor>\n\t\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<BlockInspectorButton onClick={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t\t</BlockTools>\n\t\t\t<ReusableBlocksMenuItems />\n\t\t</BlockEditorProvider>\n\t);\n}\n"]}
|
|
@@ -52,14 +52,41 @@ function ResizableEditor(_ref) {
|
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
setHeight(iframe.contentDocument.querySelector(`.edit-site-block-editor__block-list`).offsetHeight);
|
|
57
|
-
}); // Observing the <html> rather than the <body> because the latter
|
|
58
|
-
// gets destroyed and remounted after initialization in <Iframe>.
|
|
55
|
+
let animationFrame = null;
|
|
59
56
|
|
|
60
|
-
|
|
57
|
+
function resizeHeight() {
|
|
58
|
+
if (!animationFrame) {
|
|
59
|
+
// Throttle the updates on animation frame.
|
|
60
|
+
animationFrame = iframe.contentWindow.requestAnimationFrame(() => {
|
|
61
|
+
setHeight(iframe.contentDocument.documentElement.scrollHeight);
|
|
62
|
+
animationFrame = null;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
let resizeObserver;
|
|
68
|
+
|
|
69
|
+
function registerObserver() {
|
|
70
|
+
var _resizeObserver;
|
|
71
|
+
|
|
72
|
+
(_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 ? void 0 : _resizeObserver.disconnect();
|
|
73
|
+
resizeObserver = new iframe.contentWindow.ResizeObserver(resizeHeight); // Observing the <html> rather than the <body> because the latter
|
|
74
|
+
// gets destroyed and remounted after initialization in <Iframe>.
|
|
75
|
+
|
|
76
|
+
resizeObserver.observe(iframe.contentDocument.documentElement);
|
|
77
|
+
resizeHeight();
|
|
78
|
+
} // This is only required in Firefox for some unknown reasons.
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
iframe.addEventListener('load', registerObserver); // This is required in Chrome and Safari.
|
|
82
|
+
|
|
83
|
+
registerObserver();
|
|
61
84
|
return () => {
|
|
62
|
-
|
|
85
|
+
var _iframe$contentWindow, _resizeObserver2;
|
|
86
|
+
|
|
87
|
+
(_iframe$contentWindow = iframe.contentWindow) === null || _iframe$contentWindow === void 0 ? void 0 : _iframe$contentWindow.cancelAnimationFrame(animationFrame);
|
|
88
|
+
(_resizeObserver2 = resizeObserver) === null || _resizeObserver2 === void 0 ? void 0 : _resizeObserver2.disconnect();
|
|
89
|
+
iframe.removeEventListener('load', registerObserver);
|
|
63
90
|
};
|
|
64
91
|
}, [enableResizing]);
|
|
65
92
|
const resizeWidthBy = useCallback(deltaPixels => {
|
|
@@ -108,7 +135,10 @@ function ResizableEditor(_ref) {
|
|
|
108
135
|
styles: settings.styles
|
|
109
136
|
}), createElement("style", null, // Forming a "block formatting context" to prevent margin collapsing.
|
|
110
137
|
// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
|
|
111
|
-
`.
|
|
138
|
+
`.is-root-container { display: flow-root; }`), enableResizing && createElement("style", null, // Force the <html> and <body>'s heights to fit the content.
|
|
139
|
+
`html, body { height: -moz-fit-content !important; height: fit-content !important; min-height: 0 !important; }`, // Some themes will have `min-height: 100vh` for the root container,
|
|
140
|
+
// which isn't a requirement in auto resize mode.
|
|
141
|
+
`.is-root-container { min-height: 0 !important; }`)),
|
|
112
142
|
ref: ref,
|
|
113
143
|
name: "editor-canvas",
|
|
114
144
|
className: "edit-site-visual-editor__editor-canvas"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/resizable-editor.js"],"names":["useState","useEffect","useRef","useCallback","ResizableBox","__experimentalUseResizeCanvas","useResizeCanvas","__unstableEditorStyles","EditorStyles","__unstableIframe","Iframe","__unstableUseMouseMoveTypingReset","useMouseMoveTypingReset","useSelect","useMergeRefs","store","editSiteStore","ResizeHandle","DEFAULT_STYLES","width","height","HANDLE_STYLES_OVERRIDE","position","undefined","userSelect","cursor","top","right","bottom","left","ResizableEditor","enableResizing","settings","props","deviceType","select","__experimentalGetPreviewDeviceType","deviceStyles","setWidth","setHeight","iframeRef","mouseMoveTypingResetRef","ref","autoResizeIframeHeight","iframe","current","resizeObserver","contentWindow","ResizeObserver","contentDocument","querySelector","offsetHeight","observe","documentElement","disconnect","resizeWidthBy","deltaPixels","offsetWidth","event","direction","element","style","styles"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,SAAnB,EAA8BC,MAA9B,EAAsCC,WAAtC,QAAyD,oBAAzD;AACA,SAASC,YAAT,QAA6B,uBAA7B;AACA,SACCC,6BAA6B,IAAIC,eADlC,EAECC,sBAAsB,IAAIC,YAF3B,EAGCC,gBAAgB,IAAIC,MAHrB,EAICC,iCAAiC,IAAIC,uBAJtC,QAKO,yBALP;AAMA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,YAAT,QAA6B,oBAA7B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AAEA,MAAMC,cAAc,GAAG;AACtBC,EAAAA,KAAK,EAAE,MADe;AAEtBC,EAAAA,MAAM,EAAE;AAFc,CAAvB,C,CAKA;;AACA,MAAMC,sBAAsB,GAAG;AAC9BC,EAAAA,QAAQ,EAAEC,SADoB;AAE9BC,EAAAA,UAAU,EAAED,SAFkB;AAG9BE,EAAAA,MAAM,EAAEF,SAHsB;AAI9BJ,EAAAA,KAAK,EAAEI,SAJuB;AAK9BH,EAAAA,MAAM,EAAEG,SALsB;AAM9BG,EAAAA,GAAG,EAAEH,SANyB;AAO9BI,EAAAA,KAAK,EAAEJ,SAPuB;AAQ9BK,EAAAA,MAAM,EAAEL,SARsB;AAS9BM,EAAAA,IAAI,EAAEN;AATwB,CAA/B;;AAYA,SAASO,eAAT,OAAmE;AAAA,MAAzC;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,QAAlB;AAA4B,OAAGC;AAA/B,GAAyC;AAClE,QAAMC,UAAU,GAAGrB,SAAS,CACzBsB,MAAF,IACCA,MAAM,CAAEnB,aAAF,CAAN,CAAwBoB,kCAAxB,EAF0B,EAG3B,EAH2B,CAA5B;AAKA,QAAMC,YAAY,GAAG/B,eAAe,C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KC,IAAA,YAAY,EAAG,CAAEsC,KAAF,EAASC,SAAT,EAAoBC,OAApB,KAAiC;AAC/CtB,MAAAA,QAAQ,CAAEsB,OAAO,CAACC,KAAR,CAAc1C,KAAhB,CAAR;AACA,KAPF;AAQC,IAAA,QAAQ,EAAG,GARZ;AASC,IAAA,QAAQ,EAAC,MATV;AAUC,IAAA,SAAS,EAAC,MAVX;AAWC,IAAA,MAAM,EAAG;AACRQ,MAAAA,KAAK,EAAEI,cADC;AAERF,MAAAA,IAAI,EAAEE;AAFE,KAXV;AAeC,IAAA,UAAU,EAAGA,cAfd,CAgBC;AACA;AACA;AAlBD;AAmBC,IAAA,WAAW,EAAG,CAnBf;AAoBC,IAAA,eAAe,EAAG;AACjBF,MAAAA,IAAI,EACH,cAAC,YAAD;AACC,QAAA,SAAS,EAAC,MADX;AAEC,QAAA,aAAa,EAAG0B;AAFjB,QAFgB;AAOjB5B,MAAAA,KAAK,EACJ,cAAC,YAAD;AACC,QAAA,SAAS,EAAC,OADX;AAEC,QAAA,aAAa,EAAG4B;AAFjB;AARgB,KApBnB;AAkCC,IAAA,aAAa,EAAGhC,SAlCjB;AAmCC,IAAA,YAAY,EAAG;AACdM,MAAAA,IAAI,EAAER,sBADQ;AAEdM,MAAAA,KAAK,EAAEN;AAFO;AAnChB,KAwCC,cAAC,MAAD;AACC,IAAA,KAAK,EAAGU,cAAc,GAAGR,SAAH,GAAec,YADtC;AAEC,IAAA,IAAI,EACH,8BACC,cAAC,YAAD;AAAc,MAAA,MAAM,EAAGL,QAAQ,CAAC8B;AAAhC,MADD,EAEC,6BACC;AACA;AACC,iEAHF,CAFD,CAHF;AAYC,IAAA,GAAG,EAAGpB,GAZP;AAaC,IAAA,IAAI,EAAC,eAbN;AAcC,IAAA,SAAS,EAAC;AAdX,KAeMT,KAfN,EAxCD,CADD;AA4DA;;AAED,eAAeH,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useRef, useCallback } from '@wordpress/element';\nimport { ResizableBox } from '@wordpress/components';\nimport {\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport ResizeHandle from './resize-handle';\n\nconst DEFAULT_STYLES = {\n\twidth: '100%',\n\theight: '100%',\n};\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\nfunction ResizableEditor( { enableResizing, settings, ...props } ) {\n\tconst deviceType = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editSiteStore ).__experimentalGetPreviewDeviceType(),\n\t\t[]\n\t);\n\tconst deviceStyles = useResizeCanvas( deviceType );\n\tconst [ width, setWidth ] = useState( DEFAULT_STYLES.width );\n\tconst [ height, setHeight ] = useState( DEFAULT_STYLES.height );\n\tconst iframeRef = useRef();\n\tconst mouseMoveTypingResetRef = useMouseMoveTypingReset();\n\tconst ref = useMergeRefs( [ iframeRef, mouseMoveTypingResetRef ] );\n\n\tuseEffect(\n\t\tfunction autoResizeIframeHeight() {\n\t\t\tconst iframe = iframeRef.current;\n\n\t\t\tif ( ! iframe || ! enableResizing ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst resizeObserver = new iframe.contentWindow.ResizeObserver(\n\t\t\t\t() => {\n\t\t\t\t\tsetHeight(\n\t\t\t\t\t\tiframe.contentDocument.querySelector(\n\t\t\t\t\t\t\t`.edit-site-block-editor__block-list`\n\t\t\t\t\t\t).offsetHeight\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// Observing the <html> rather than the <body> because the latter\n\t\t\t// gets destroyed and remounted after initialization in <Iframe>.\n\t\t\tresizeObserver.observe( iframe.contentDocument.documentElement );\n\n\t\t\treturn () => {\n\t\t\t\tresizeObserver.disconnect();\n\t\t\t};\n\t\t},\n\t\t[ enableResizing ]\n\t);\n\n\tconst resizeWidthBy = useCallback( ( deltaPixels ) => {\n\t\tif ( iframeRef.current ) {\n\t\t\tsetWidth( iframeRef.current.offsetWidth + deltaPixels );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tsize={ {\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t} }\n\t\t\tonResizeStop={ ( event, direction, element ) => {\n\t\t\t\tsetWidth( element.style.width );\n\t\t\t} }\n\t\t\tminWidth={ 300 }\n\t\t\tmaxWidth=\"100%\"\n\t\t\tmaxHeight=\"100%\"\n\t\t\tenable={ {\n\t\t\t\tright: enableResizing,\n\t\t\t\tleft: enableResizing,\n\t\t\t} }\n\t\t\tshowHandle={ enableResizing }\n\t\t\t// The editor is centered horizontally, resizing it only\n\t\t\t// moves half the distance. Hence double the ratio to correctly\n\t\t\t// align the cursor to the resizer handle.\n\t\t\tresizeRatio={ 2 }\n\t\t\thandleComponent={ {\n\t\t\t\tleft: (\n\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\tdirection=\"left\"\n\t\t\t\t\t\tresizeWidthBy={ resizeWidthBy }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t\tright: (\n\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\tdirection=\"right\"\n\t\t\t\t\t\tresizeWidthBy={ resizeWidthBy }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t} }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t>\n\t\t\t<Iframe\n\t\t\t\tstyle={ enableResizing ? undefined : deviceStyles }\n\t\t\t\thead={\n\t\t\t\t\t<>\n\t\t\t\t\t\t<EditorStyles styles={ settings.styles } />\n\t\t\t\t\t\t<style>{\n\t\t\t\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t\t\t\t`.edit-site-block-editor__block-list { display: flow-root; }`\n\t\t\t\t\t\t}</style>\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tref={ ref }\n\t\t\t\tname=\"editor-canvas\"\n\t\t\t\tclassName=\"edit-site-visual-editor__editor-canvas\"\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableEditor;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/resizable-editor.js"],"names":["useState","useEffect","useRef","useCallback","ResizableBox","__experimentalUseResizeCanvas","useResizeCanvas","__unstableEditorStyles","EditorStyles","__unstableIframe","Iframe","__unstableUseMouseMoveTypingReset","useMouseMoveTypingReset","useSelect","useMergeRefs","store","editSiteStore","ResizeHandle","DEFAULT_STYLES","width","height","HANDLE_STYLES_OVERRIDE","position","undefined","userSelect","cursor","top","right","bottom","left","ResizableEditor","enableResizing","settings","props","deviceType","select","__experimentalGetPreviewDeviceType","deviceStyles","setWidth","setHeight","iframeRef","mouseMoveTypingResetRef","ref","autoResizeIframeHeight","iframe","current","animationFrame","resizeHeight","contentWindow","requestAnimationFrame","contentDocument","documentElement","scrollHeight","resizeObserver","registerObserver","disconnect","ResizeObserver","observe","addEventListener","cancelAnimationFrame","removeEventListener","resizeWidthBy","deltaPixels","offsetWidth","event","direction","element","style","styles"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,SAAnB,EAA8BC,MAA9B,EAAsCC,WAAtC,QAAyD,oBAAzD;AACA,SAASC,YAAT,QAA6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,MAAD;AACC,IAAA,KAAK,EAAGU,cAAc,GAAGR,SAAH,GAAec,YADtC;AAEC,IAAA,IAAI,EACH,8BACC,cAAC,YAAD;AAAc,MAAA,MAAM,EAAGL,QAAQ,CAACoC;AAAhC,MADD,EAEC,6BACC;AACA;AACC,gDAHF,CAFD,EAOGrC,cAAc,IACf,6BAEE;AACC,mHAHH,EAME;AACA;AACC,sDARH,CARF,CAHF;AAyBC,IAAA,GAAG,EAAGW,GAzBP;AA0BC,IAAA,IAAI,EAAC,eA1BN;AA2BC,IAAA,SAAS,EAAC;AA3BX,KA4BMT,KA5BN,EAxCD,CADD;AAyEA;;AAED,eAAeH,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useRef, useCallback } from '@wordpress/element';\nimport { ResizableBox } from '@wordpress/components';\nimport {\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport ResizeHandle from './resize-handle';\n\nconst DEFAULT_STYLES = {\n\twidth: '100%',\n\theight: '100%',\n};\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\nfunction ResizableEditor( { enableResizing, settings, ...props } ) {\n\tconst deviceType = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editSiteStore ).__experimentalGetPreviewDeviceType(),\n\t\t[]\n\t);\n\tconst deviceStyles = useResizeCanvas( deviceType );\n\tconst [ width, setWidth ] = useState( DEFAULT_STYLES.width );\n\tconst [ height, setHeight ] = useState( DEFAULT_STYLES.height );\n\tconst iframeRef = useRef();\n\tconst mouseMoveTypingResetRef = useMouseMoveTypingReset();\n\tconst ref = useMergeRefs( [ iframeRef, mouseMoveTypingResetRef ] );\n\n\tuseEffect(\n\t\tfunction autoResizeIframeHeight() {\n\t\t\tconst iframe = iframeRef.current;\n\n\t\t\tif ( ! iframe || ! enableResizing ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet animationFrame = null;\n\n\t\t\tfunction resizeHeight() {\n\t\t\t\tif ( ! animationFrame ) {\n\t\t\t\t\t// Throttle the updates on animation frame.\n\t\t\t\t\tanimationFrame = iframe.contentWindow.requestAnimationFrame(\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\tsetHeight(\n\t\t\t\t\t\t\t\tiframe.contentDocument.documentElement\n\t\t\t\t\t\t\t\t\t.scrollHeight\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tanimationFrame = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet resizeObserver;\n\n\t\t\tfunction registerObserver() {\n\t\t\t\tresizeObserver?.disconnect();\n\n\t\t\t\tresizeObserver = new iframe.contentWindow.ResizeObserver(\n\t\t\t\t\tresizeHeight\n\t\t\t\t);\n\t\t\t\t// Observing the <html> rather than the <body> because the latter\n\t\t\t\t// gets destroyed and remounted after initialization in <Iframe>.\n\t\t\t\tresizeObserver.observe(\n\t\t\t\t\tiframe.contentDocument.documentElement\n\t\t\t\t);\n\n\t\t\t\tresizeHeight();\n\t\t\t}\n\n\t\t\t// This is only required in Firefox for some unknown reasons.\n\t\t\tiframe.addEventListener( 'load', registerObserver );\n\t\t\t// This is required in Chrome and Safari.\n\t\t\tregisterObserver();\n\n\t\t\treturn () => {\n\t\t\t\tiframe.contentWindow?.cancelAnimationFrame( animationFrame );\n\t\t\t\tresizeObserver?.disconnect();\n\t\t\t\tiframe.removeEventListener( 'load', registerObserver );\n\t\t\t};\n\t\t},\n\t\t[ enableResizing ]\n\t);\n\n\tconst resizeWidthBy = useCallback( ( deltaPixels ) => {\n\t\tif ( iframeRef.current ) {\n\t\t\tsetWidth( iframeRef.current.offsetWidth + deltaPixels );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tsize={ {\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t} }\n\t\t\tonResizeStop={ ( event, direction, element ) => {\n\t\t\t\tsetWidth( element.style.width );\n\t\t\t} }\n\t\t\tminWidth={ 300 }\n\t\t\tmaxWidth=\"100%\"\n\t\t\tmaxHeight=\"100%\"\n\t\t\tenable={ {\n\t\t\t\tright: enableResizing,\n\t\t\t\tleft: enableResizing,\n\t\t\t} }\n\t\t\tshowHandle={ enableResizing }\n\t\t\t// The editor is centered horizontally, resizing it only\n\t\t\t// moves half the distance. Hence double the ratio to correctly\n\t\t\t// align the cursor to the resizer handle.\n\t\t\tresizeRatio={ 2 }\n\t\t\thandleComponent={ {\n\t\t\t\tleft: (\n\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\tdirection=\"left\"\n\t\t\t\t\t\tresizeWidthBy={ resizeWidthBy }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t\tright: (\n\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\tdirection=\"right\"\n\t\t\t\t\t\tresizeWidthBy={ resizeWidthBy }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t} }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t>\n\t\t\t<Iframe\n\t\t\t\tstyle={ enableResizing ? undefined : deviceStyles }\n\t\t\t\thead={\n\t\t\t\t\t<>\n\t\t\t\t\t\t<EditorStyles styles={ settings.styles } />\n\t\t\t\t\t\t<style>{\n\t\t\t\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t\t\t\t`.is-root-container { display: flow-root; }`\n\t\t\t\t\t\t}</style>\n\t\t\t\t\t\t{ enableResizing && (\n\t\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// Force the <html> and <body>'s heights to fit the content.\n\t\t\t\t\t\t\t\t\t`html, body { height: -moz-fit-content !important; height: fit-content !important; min-height: 0 !important; }`\n\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\t\t// Some themes will have `min-height: 100vh` for the root container,\n\t\t\t\t\t\t\t\t\t// which isn't a requirement in auto resize mode.\n\t\t\t\t\t\t\t\t\t`.is-root-container { min-height: 0 !important; }`\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</style>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tref={ ref }\n\t\t\t\tname=\"editor-canvas\"\n\t\t\t\tclassName=\"edit-site-visual-editor__editor-canvas\"\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableEditor;\n"]}
|
|
@@ -13,23 +13,18 @@ export const TEMPLATES_TOP_LEVEL = [...TEMPLATES_PRIMARY, ...TEMPLATES_SECONDARY
|
|
|
13
13
|
export const TEMPLATES_GENERAL = ['page-home'];
|
|
14
14
|
export const TEMPLATES_POSTS_PREFIXES = ['post-', 'author-', 'single-post-', 'tag-'];
|
|
15
15
|
export const TEMPLATES_PAGES_PREFIXES = ['page-'];
|
|
16
|
-
export const TEMPLATES_NEW_OPTIONS = ['front-page', 'single-post', 'page', 'archive', 'search', '404', 'index'];
|
|
17
16
|
export const TEMPLATE_OVERRIDES = {
|
|
18
17
|
singular: ['single', 'page'],
|
|
19
18
|
index: ['archive', '404', 'search', 'singular', 'home'],
|
|
20
19
|
home: ['front-page']
|
|
21
20
|
};
|
|
22
21
|
export const MENU_ROOT = 'root';
|
|
23
|
-
export const MENU_CONTENT_CATEGORIES = 'content-categories';
|
|
24
|
-
export const MENU_CONTENT_PAGES = 'content-pages';
|
|
25
|
-
export const MENU_CONTENT_POSTS = 'content-posts';
|
|
26
22
|
export const MENU_TEMPLATE_PARTS = 'template-parts';
|
|
27
23
|
export const MENU_TEMPLATES = 'templates';
|
|
28
24
|
export const MENU_TEMPLATES_GENERAL = 'templates-general';
|
|
29
25
|
export const MENU_TEMPLATES_PAGES = 'templates-pages';
|
|
30
26
|
export const MENU_TEMPLATES_POSTS = 'templates-posts';
|
|
31
27
|
export const MENU_TEMPLATES_UNUSED = 'templates-unused';
|
|
32
|
-
export const SEARCH_DEBOUNCE_IN_MS = 75;
|
|
33
28
|
export const MENU_TEMPLATE_PARTS_HEADERS = 'template-parts-headers';
|
|
34
29
|
export const MENU_TEMPLATE_PARTS_FOOTERS = 'template-parts-footers';
|
|
35
30
|
export const MENU_TEMPLATE_PARTS_SIDEBARS = 'template-parts-sidebars';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-panel/constants.js"],"names":["__","TEMPLATE_PART_AREA_HEADER","TEMPLATE_PART_AREA_FOOTER","TEMPLATE_PART_AREA_SIDEBAR","TEMPLATE_PART_AREA_GENERAL","TEMPLATES_PRIMARY","TEMPLATES_SECONDARY","TEMPLATES_TOP_LEVEL","TEMPLATES_GENERAL","TEMPLATES_POSTS_PREFIXES","TEMPLATES_PAGES_PREFIXES","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-panel/constants.js"],"names":["__","TEMPLATE_PART_AREA_HEADER","TEMPLATE_PART_AREA_FOOTER","TEMPLATE_PART_AREA_SIDEBAR","TEMPLATE_PART_AREA_GENERAL","TEMPLATES_PRIMARY","TEMPLATES_SECONDARY","TEMPLATES_TOP_LEVEL","TEMPLATES_GENERAL","TEMPLATES_POSTS_PREFIXES","TEMPLATES_PAGES_PREFIXES","TEMPLATE_OVERRIDES","singular","index","home","MENU_ROOT","MENU_TEMPLATE_PARTS","MENU_TEMPLATES","MENU_TEMPLATES_GENERAL","MENU_TEMPLATES_PAGES","MENU_TEMPLATES_POSTS","MENU_TEMPLATES_UNUSED","MENU_TEMPLATE_PARTS_HEADERS","MENU_TEMPLATE_PARTS_FOOTERS","MENU_TEMPLATE_PARTS_SIDEBARS","MENU_TEMPLATE_PARTS_GENERAL","TEMPLATE_PARTS_SUB_MENUS","area","menu","title"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SACCC,yBADD,EAECC,yBAFD,EAGCC,0BAHD,EAICC,0BAJD,QAKO,0BALP;AAOA,OAAO,MAAMC,iBAAiB,GAAG,CAChC,OADgC,EAEhC,UAFgC,EAGhC,SAHgC,EAIhC,QAJgC,EAKhC,MALgC,EAMhC,MANgC,EAOhC,KAPgC,EAQhC,QARgC,CAA1B;AAWP,OAAO,MAAMC,mBAAmB,GAAG,CAClC,QADkC,EAElC,UAFkC,EAGlC,UAHkC,EAIlC,MAJkC,EAKlC,KALkC,EAMlC,YANkC,EAOlC,aAPkC,EAQlC,YARkC,CAA5B;AAWP,OAAO,MAAMC,mBAAmB,GAAG,CAClC,GAAGF,iBAD+B,EAElC,GAAGC,mBAF+B,CAA5B;AAKP,OAAO,MAAME,iBAAiB,GAAG,CAAE,WAAF,CAA1B;AAEP,OAAO,MAAMC,wBAAwB,GAAG,CACvC,OADuC,EAEvC,SAFuC,EAGvC,cAHuC,EAIvC,MAJuC,CAAjC;AAOP,OAAO,MAAMC,wBAAwB,GAAG,CAAE,OAAF,CAAjC;AAEP,OAAO,MAAMC,kBAAkB,GAAG;AACjCC,EAAAA,QAAQ,EAAE,CAAE,QAAF,EAAY,MAAZ,CADuB;AAEjCC,EAAAA,KAAK,EAAE,CAAE,SAAF,EAAa,KAA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PART_AREA_HEADER,\n\tTEMPLATE_PART_AREA_FOOTER,\n\tTEMPLATE_PART_AREA_SIDEBAR,\n\tTEMPLATE_PART_AREA_GENERAL,\n} from '../../../store/constants';\n\nexport const TEMPLATES_PRIMARY = [\n\t'index',\n\t'singular',\n\t'archive',\n\t'single',\n\t'page',\n\t'home',\n\t'404',\n\t'search',\n];\n\nexport const TEMPLATES_SECONDARY = [\n\t'author',\n\t'category',\n\t'taxonomy',\n\t'date',\n\t'tag',\n\t'attachment',\n\t'single-post',\n\t'front-page',\n];\n\nexport const TEMPLATES_TOP_LEVEL = [\n\t...TEMPLATES_PRIMARY,\n\t...TEMPLATES_SECONDARY,\n];\n\nexport const TEMPLATES_GENERAL = [ 'page-home' ];\n\nexport const TEMPLATES_POSTS_PREFIXES = [\n\t'post-',\n\t'author-',\n\t'single-post-',\n\t'tag-',\n];\n\nexport const TEMPLATES_PAGES_PREFIXES = [ 'page-' ];\n\nexport const TEMPLATE_OVERRIDES = {\n\tsingular: [ 'single', 'page' ],\n\tindex: [ 'archive', '404', 'search', 'singular', 'home' ],\n\thome: [ 'front-page' ],\n};\n\nexport const MENU_ROOT = 'root';\nexport const MENU_TEMPLATE_PARTS = 'template-parts';\nexport const MENU_TEMPLATES = 'templates';\nexport const MENU_TEMPLATES_GENERAL = 'templates-general';\nexport const MENU_TEMPLATES_PAGES = 'templates-pages';\nexport const MENU_TEMPLATES_POSTS = 'templates-posts';\nexport const MENU_TEMPLATES_UNUSED = 'templates-unused';\n\nexport const MENU_TEMPLATE_PARTS_HEADERS = 'template-parts-headers';\nexport const MENU_TEMPLATE_PARTS_FOOTERS = 'template-parts-footers';\nexport const MENU_TEMPLATE_PARTS_SIDEBARS = 'template-parts-sidebars';\nexport const MENU_TEMPLATE_PARTS_GENERAL = 'template-parts-general';\n\nexport const TEMPLATE_PARTS_SUB_MENUS = [\n\t{\n\t\tarea: TEMPLATE_PART_AREA_HEADER,\n\t\tmenu: MENU_TEMPLATE_PARTS_HEADERS,\n\t\ttitle: __( 'headers' ),\n\t},\n\t{\n\t\tarea: TEMPLATE_PART_AREA_FOOTER,\n\t\tmenu: MENU_TEMPLATE_PARTS_FOOTERS,\n\t\ttitle: __( 'footers' ),\n\t},\n\t{\n\t\tarea: TEMPLATE_PART_AREA_SIDEBAR,\n\t\tmenu: MENU_TEMPLATE_PARTS_SIDEBARS,\n\t\ttitle: __( 'sidebars' ),\n\t},\n\t{\n\t\tarea: TEMPLATE_PART_AREA_GENERAL,\n\t\tmenu: MENU_TEMPLATE_PARTS_GENERAL,\n\t\ttitle: __( 'general' ),\n\t},\n];\n"]}
|
|
@@ -8,7 +8,7 @@ import downloadjs from 'downloadjs';
|
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { __ } from '@wordpress/i18n';
|
|
11
|
+
import { __, _x } from '@wordpress/i18n';
|
|
12
12
|
import { MenuItem } from '@wordpress/components';
|
|
13
13
|
import apiFetch from '@wordpress/api-fetch';
|
|
14
14
|
import { download } from '@wordpress/icons';
|
|
@@ -46,6 +46,6 @@ export default function SiteExport() {
|
|
|
46
46
|
icon: download,
|
|
47
47
|
onClick: handleExport,
|
|
48
48
|
info: __('Download your templates and template parts.')
|
|
49
|
-
},
|
|
49
|
+
}, _x('Export', 'site exporter menu item'));
|
|
50
50
|
}
|
|
51
51
|
//# sourceMappingURL=site-export.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/plugins/site-export.js"],"names":["downloadjs","__","MenuItem","apiFetch","download","useDispatch","store","noticesStore","SiteExport","createErrorNotice","handleExport","response","path","parse","blob","errorResponse","error","json","e","errorMessage","message","code","type"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/plugins/site-export.js"],"names":["downloadjs","__","_x","MenuItem","apiFetch","download","useDispatch","store","noticesStore","SiteExport","createErrorNotice","handleExport","response","path","parse","blob","errorResponse","error","json","e","errorMessage","message","code","type"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,OAAOC,QAAP,MAAqB,sBAArB;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AAEA,eAAe,SAASC,UAAT,GAAsB;AACpC,QAAM;AAAEC,IAAAA;AAAF,MAAwBJ,WAAW,CAAEE,YAAF,CAAzC;;AAEA,iBAAeG,YAAf,GAA8B;AAC7B,QAAI;AACH,YAAMC,QAAQ,GAAG,MAAMR,QAAQ,CAAE;AAChCS,QAAAA,IAAI,EAAE,4BAD0B;AAEhCC,QAAAA,KAAK,EAAE;AAFyB,OAAF,CAA/B;AAIA,YAAMC,IAAI,GAAG,MAAMH,QAAQ,CAACG,IAAT,EAAnB;AAEAf,MAAAA,UAAU,CAAEe,IAAF,EAAQ,sBAAR,EAAgC,iBAAhC,CAAV;AACA,KARD,CAQE,OAAQC,aAAR,EAAwB;AACzB,UAAIC,KAAK,GAAG,EAAZ;;AACA,UAAI;AACHA,QAAAA,KAAK,GAAG,MAAMD,aAAa,CAACE,IAAd,EAAd;AACA,OAFD,CAEE,OAAQC,CAAR,EAAY,CAAE;;AAChB,YAAMC,YAAY,GACjBH,KAAK,CAACI,OAAN,IAAiBJ,KAAK,CAACK,IAAN,KAAe,eAAhC,GACGL,KAAK,CAACI,OADT,GAEGpB,EAAE,CAAE,mDAAF,CAHN;AAKAS,MAAAA,iBAAiB,CAAEU,YAAF,EAAgB;AAAEG,QAAAA,IAAI,EAAE;AAAR,OAAhB,CAAjB;AACA;AACD;;AAED,SACC,cAAC,QAAD;AACC,IAAA,IAAI,EAAC,UADN;AAEC,IAAA,IAAI,EAAGlB,QAFR;AAGC,IAAA,OAAO,EAAGM,YAHX;AAIC,IAAA,IAAI,EAAGV,EAAE,CAAE,6CAAF;AAJV,KAMGC,EAAE,CAAE,QAAF,EAAY,yBAAZ,CANL,CADD;AAUA","sourcesContent":["/**\n * External dependencies\n */\nimport downloadjs from 'downloadjs';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport apiFetch from '@wordpress/api-fetch';\nimport { download } from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport default function SiteExport() {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tasync function handleExport() {\n\t\ttry {\n\t\t\tconst response = await apiFetch( {\n\t\t\t\tpath: '/wp-block-editor/v1/export',\n\t\t\t\tparse: false,\n\t\t\t} );\n\t\t\tconst blob = await response.blob();\n\n\t\t\tdownloadjs( blob, 'edit-site-export.zip', 'application/zip' );\n\t\t} catch ( errorResponse ) {\n\t\t\tlet error = {};\n\t\t\ttry {\n\t\t\t\terror = await errorResponse.json();\n\t\t\t} catch ( e ) {}\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while creating the site export.' );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\trole=\"menuitem\"\n\t\t\ticon={ download }\n\t\t\tonClick={ handleExport }\n\t\t\tinfo={ __( 'Download your templates and template parts.' ) }\n\t\t>\n\t\t\t{ _x( 'Export', 'site exporter menu item' ) }\n\t\t</MenuItem>\n\t);\n}\n"]}
|
|
@@ -467,6 +467,9 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
467
467
|
.edit-site-visual-editor.is-focus-mode .edit-site-visual-editor__editor-canvas {
|
|
468
468
|
border-radius: 2px;
|
|
469
469
|
}
|
|
470
|
+
.edit-site-visual-editor.is-focus-mode .components-resizable-box__container {
|
|
471
|
+
overflow: visible;
|
|
472
|
+
}
|
|
470
473
|
|
|
471
474
|
.edit-site-visual-editor__editor-canvas {
|
|
472
475
|
border-radius: 2px 2px 0 0;
|
|
@@ -484,6 +487,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
484
487
|
|
|
485
488
|
.components-resizable-box__container {
|
|
486
489
|
margin: 0 auto;
|
|
490
|
+
overflow: auto;
|
|
487
491
|
}
|
|
488
492
|
|
|
489
493
|
.resizable-editor__drag-handle {
|
|
@@ -580,7 +584,8 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
580
584
|
.edit-site-global-styles-subtitle {
|
|
581
585
|
margin-bottom: 0 !important;
|
|
582
586
|
text-transform: uppercase;
|
|
583
|
-
font-weight: 500;
|
|
587
|
+
font-weight: 500 !important;
|
|
588
|
+
font-size: 11px !important;
|
|
584
589
|
}
|
|
585
590
|
|
|
586
591
|
.edit-site-screen-color-palette-toggle.edit-site-screen-color-palette-toggle {
|
|
@@ -914,10 +919,13 @@ body.is-navigation-sidebar-open .edit-site-header .edit-site-header_end .compone
|
|
|
914
919
|
.edit-site-navigation-toggle__button.has-icon:focus::before {
|
|
915
920
|
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) rgba(255, 255, 255, 0.1), inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
916
921
|
}
|
|
917
|
-
|
|
918
|
-
.edit-site-navigation-toggle__site-icon {
|
|
922
|
+
.edit-site-navigation-toggle__button .edit-site-navigation-toggle__site-icon {
|
|
919
923
|
width: 36px;
|
|
924
|
+
height: 36px;
|
|
920
925
|
border-radius: 2px;
|
|
926
|
+
-o-object-fit: cover;
|
|
927
|
+
object-fit: cover;
|
|
928
|
+
margin-top: -1px;
|
|
921
929
|
}
|
|
922
930
|
|
|
923
931
|
.edit-site-navigation-panel {
|
|
@@ -1506,7 +1514,6 @@ html.wp-toolbar {
|
|
|
1506
1514
|
position: relative;
|
|
1507
1515
|
height: 100%;
|
|
1508
1516
|
display: block;
|
|
1509
|
-
overflow: hidden;
|
|
1510
1517
|
}
|
|
1511
1518
|
.edit-site-visual-editor iframe {
|
|
1512
1519
|
display: block;
|