@wordpress/edit-post 7.35.0 → 8.0.1
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 +7 -0
- package/build/commands/use-commands.js +56 -0
- package/build/commands/use-commands.js.map +1 -0
- package/build/components/{header/fullscreen-mode-close/index.js → back-button/fullscreen-mode-close.js} +16 -14
- package/build/components/back-button/fullscreen-mode-close.js.map +1 -0
- package/build/components/back-button/index.js +59 -0
- package/build/components/back-button/index.js.map +1 -0
- package/build/components/header/header-toolbar/index.native.js +63 -62
- package/build/components/header/header-toolbar/index.native.js.map +1 -1
- package/build/components/header/index.native.js +2 -2
- package/build/components/header/index.native.js.map +1 -1
- package/build/components/init-pattern-modal/index.js +50 -43
- package/build/components/init-pattern-modal/index.js.map +1 -1
- package/build/components/layout/index.js +93 -155
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/index.native.js +28 -21
- package/build/components/layout/index.native.js.map +1 -1
- package/build/components/layout/use-padding-appender.js.map +1 -0
- package/build/components/layout/use-should-iframe.js +46 -0
- package/build/components/layout/use-should-iframe.js.map +1 -0
- package/build/components/meta-boxes/index.js +10 -9
- package/build/components/meta-boxes/index.js.map +1 -1
- package/build/components/meta-boxes/meta-boxes-area/index.js +11 -11
- package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build/components/more-menu/index.js +49 -0
- package/build/components/more-menu/index.js.map +1 -0
- package/build/components/{header/more-menu → more-menu}/manage-patterns-menu-item.js +5 -4
- package/build/components/more-menu/manage-patterns-menu-item.js.map +1 -0
- package/build/components/{header/more-menu → more-menu}/welcome-guide-menu-item.js +2 -2
- package/build/components/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build/components/preferences-modal/enable-custom-fields.js +24 -18
- package/build/components/preferences-modal/enable-custom-fields.js.map +1 -1
- package/build/components/preferences-modal/index.js +4 -4
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preferences-modal/meta-boxes-section.js +13 -13
- package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build/components/visual-editor/header.native.js +11 -10
- package/build/components/visual-editor/header.native.js.map +1 -1
- package/build/components/visual-editor/index.native.js +3 -3
- package/build/components/visual-editor/index.native.js.map +1 -1
- package/build/components/welcome-guide/default.js +50 -33
- package/build/components/welcome-guide/default.js.map +1 -1
- package/build/components/welcome-guide/image.js +13 -12
- package/build/components/welcome-guide/image.js.map +1 -1
- package/build/components/welcome-guide/index.js +2 -2
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/template.js +12 -8
- package/build/components/welcome-guide/template.js.map +1 -1
- package/build/deprecated.js +9 -9
- package/build/deprecated.js.map +1 -1
- package/build/editor.js +16 -11
- package/build/editor.js.map +1 -1
- package/build/editor.native.js +18 -12
- package/build/editor.native.js.map +1 -1
- package/build/index.js +12 -13
- package/build/index.js.map +1 -1
- package/build/index.native.js +2 -2
- package/build/index.native.js.map +1 -1
- package/build/store/selectors.js +1 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/commands/use-commands.js +49 -0
- package/build-module/commands/use-commands.js.map +1 -0
- package/build-module/components/{header/fullscreen-mode-close/index.js → back-button/fullscreen-mode-close.js} +16 -14
- package/build-module/components/back-button/fullscreen-mode-close.js.map +1 -0
- package/build-module/components/back-button/index.js +51 -0
- package/build-module/components/back-button/index.js.map +1 -0
- package/build-module/components/header/header-toolbar/index.native.js +64 -62
- package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
- package/build-module/components/header/index.native.js +2 -2
- package/build-module/components/header/index.native.js.map +1 -1
- package/build-module/components/init-pattern-modal/index.js +52 -43
- package/build-module/components/init-pattern-modal/index.js.map +1 -1
- package/build-module/components/layout/index.js +98 -158
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/index.native.js +30 -21
- package/build-module/components/layout/index.native.js.map +1 -1
- package/build-module/components/layout/use-padding-appender.js.map +1 -0
- package/build-module/components/layout/use-should-iframe.js +39 -0
- package/build-module/components/layout/use-should-iframe.js.map +1 -0
- package/build-module/components/meta-boxes/index.js +12 -9
- package/build-module/components/meta-boxes/index.js.map +1 -1
- package/build-module/components/meta-boxes/meta-boxes-area/index.js +11 -9
- package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build-module/components/more-menu/index.js +43 -0
- package/build-module/components/more-menu/index.js.map +1 -0
- package/build-module/components/{header/more-menu → more-menu}/manage-patterns-menu-item.js +5 -4
- package/build-module/components/more-menu/manage-patterns-menu-item.js.map +1 -0
- package/build-module/components/{header/more-menu → more-menu}/welcome-guide-menu-item.js +2 -2
- package/build-module/components/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build-module/components/preferences-modal/enable-custom-fields.js +26 -18
- package/build-module/components/preferences-modal/enable-custom-fields.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/preferences-modal/meta-boxes-section.js +14 -13
- package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build-module/components/visual-editor/header.native.js +11 -10
- package/build-module/components/visual-editor/header.native.js.map +1 -1
- package/build-module/components/visual-editor/index.native.js +3 -3
- package/build-module/components/visual-editor/index.native.js.map +1 -1
- package/build-module/components/welcome-guide/default.js +52 -33
- package/build-module/components/welcome-guide/default.js.map +1 -1
- package/build-module/components/welcome-guide/image.js +14 -12
- package/build-module/components/welcome-guide/image.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +2 -2
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/template.js +14 -8
- package/build-module/components/welcome-guide/template.js.map +1 -1
- package/build-module/deprecated.js +9 -9
- package/build-module/deprecated.js.map +1 -1
- package/build-module/editor.js +17 -11
- package/build-module/editor.js.map +1 -1
- package/build-module/editor.native.js +18 -12
- package/build-module/editor.native.js.map +1 -1
- package/build-module/index.js +10 -7
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +2 -2
- package/build-module/index.native.js.map +1 -1
- package/build-module/store/selectors.js +1 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +27 -128
- package/build-style/style.css +27 -128
- package/package.json +32 -32
- package/src/commands/use-commands.js +48 -0
- package/src/components/{header/fullscreen-mode-close/index.js → back-button/fullscreen-mode-close.js} +1 -1
- package/src/components/back-button/index.js +41 -0
- package/src/components/{header/fullscreen-mode-close → back-button}/style.scss +16 -2
- package/src/components/{header/fullscreen-mode-close/test/index.js → back-button/test/fullscreen-mode-close.js} +1 -1
- package/src/components/init-pattern-modal/index.js +1 -4
- package/src/components/layout/index.js +88 -202
- package/src/components/layout/style.scss +9 -17
- package/src/components/layout/use-should-iframe.js +40 -0
- package/src/components/{header/more-menu → more-menu}/index.js +2 -2
- package/src/components/preferences-modal/enable-custom-fields.js +1 -0
- package/src/index.js +11 -6
- package/src/store/selectors.js +8 -5
- package/src/style.scss +2 -5
- package/src/test/__snapshots__/editor.native.js.snap +72 -0
- package/src/test/editor.native.js +77 -0
- package/build/components/header/fullscreen-mode-close/index.js.map +0 -1
- package/build/components/header/index.js +0 -69
- package/build/components/header/index.js.map +0 -1
- package/build/components/header/main-dashboard-button/index.js +0 -33
- package/build/components/header/main-dashboard-button/index.js.map +0 -1
- package/build/components/header/more-menu/index.js +0 -43
- package/build/components/header/more-menu/index.js.map +0 -1
- package/build/components/header/more-menu/manage-patterns-menu-item.js.map +0 -1
- package/build/components/header/more-menu/welcome-guide-menu-item.js.map +0 -1
- package/build/components/text-editor/index.js +0 -61
- package/build/components/text-editor/index.js.map +0 -1
- package/build/components/visual-editor/block-inspector-button.js +0 -55
- package/build/components/visual-editor/block-inspector-button.js.map +0 -1
- package/build/components/visual-editor/index.js +0 -98
- package/build/components/visual-editor/index.js.map +0 -1
- package/build/components/visual-editor/use-padding-appender.js.map +0 -1
- package/build/hooks/commands/use-common-commands.js +0 -119
- package/build/hooks/commands/use-common-commands.js.map +0 -1
- package/build/hooks/components/index.js +0 -11
- package/build/hooks/components/index.js.map +0 -1
- package/build/hooks/index.js +0 -5
- package/build/hooks/index.js.map +0 -1
- package/build/hooks/validate-multiple-use/index.js +0 -134
- package/build/hooks/validate-multiple-use/index.js.map +0 -1
- package/build-module/components/header/fullscreen-mode-close/index.js.map +0 -1
- package/build-module/components/header/index.js +0 -61
- package/build-module/components/header/index.js.map +0 -1
- package/build-module/components/header/main-dashboard-button/index.js +0 -26
- package/build-module/components/header/main-dashboard-button/index.js.map +0 -1
- package/build-module/components/header/more-menu/index.js +0 -35
- package/build-module/components/header/more-menu/index.js.map +0 -1
- package/build-module/components/header/more-menu/manage-patterns-menu-item.js.map +0 -1
- package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +0 -1
- package/build-module/components/text-editor/index.js +0 -54
- package/build-module/components/text-editor/index.js.map +0 -1
- package/build-module/components/visual-editor/block-inspector-button.js +0 -47
- package/build-module/components/visual-editor/block-inspector-button.js.map +0 -1
- package/build-module/components/visual-editor/index.js +0 -90
- package/build-module/components/visual-editor/index.js.map +0 -1
- package/build-module/components/visual-editor/use-padding-appender.js.map +0 -1
- package/build-module/hooks/commands/use-common-commands.js +0 -112
- package/build-module/hooks/commands/use-common-commands.js.map +0 -1
- package/build-module/hooks/components/index.js +0 -8
- package/build-module/hooks/components/index.js.map +0 -1
- package/build-module/hooks/index.js +0 -6
- package/build-module/hooks/index.js.map +0 -1
- package/build-module/hooks/validate-multiple-use/index.js +0 -132
- package/build-module/hooks/validate-multiple-use/index.js.map +0 -1
- package/src/components/header/index.js +0 -53
- package/src/components/header/main-dashboard-button/index.js +0 -28
- package/src/components/header/style.scss +0 -14
- package/src/components/text-editor/index.js +0 -63
- package/src/components/text-editor/style.scss +0 -71
- package/src/components/visual-editor/block-inspector-button.js +0 -59
- package/src/components/visual-editor/index.js +0 -108
- package/src/components/visual-editor/style.scss +0 -53
- package/src/hooks/commands/use-common-commands.js +0 -126
- package/src/hooks/components/index.js +0 -13
- package/src/hooks/index.js +0 -5
- package/src/hooks/validate-multiple-use/index.js +0 -163
- /package/build/components/{visual-editor → layout}/use-padding-appender.js +0 -0
- /package/build-module/components/{visual-editor → layout}/use-padding-appender.js +0 -0
- /package/src/components/{header/fullscreen-mode-close/test/__snapshots__/index.js.snap → back-button/test/__snapshots__/fullscreen-mode-close.js.snap} +0 -0
- /package/src/components/{visual-editor → layout}/use-padding-appender.js +0 -0
- /package/src/components/{header/more-menu → more-menu}/manage-patterns-menu-item.js +0 -0
- /package/src/components/{header/more-menu → more-menu}/welcome-guide-menu-item.js +0 -0
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* External dependencies
|
|
4
|
-
*/
|
|
5
|
-
import clsx from 'clsx';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* WordPress dependencies
|
|
9
|
-
*/
|
|
10
|
-
import { store as editorStore, privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
11
|
-
import { useMemo } from '@wordpress/element';
|
|
12
|
-
import { useSelect } from '@wordpress/data';
|
|
13
|
-
import { store as blocksStore } from '@wordpress/blocks';
|
|
14
|
-
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Internal dependencies
|
|
18
|
-
*/
|
|
19
|
-
import { store as editPostStore } from '../../store';
|
|
20
|
-
import { unlock } from '../../lock-unlock';
|
|
21
|
-
import { usePaddingAppender } from './use-padding-appender';
|
|
22
|
-
const {
|
|
23
|
-
EditorCanvas
|
|
24
|
-
} = unlock(editorPrivateApis);
|
|
25
|
-
const isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false;
|
|
26
|
-
export default function VisualEditor({
|
|
27
|
-
styles
|
|
28
|
-
}) {
|
|
29
|
-
const {
|
|
30
|
-
isWelcomeGuideVisible,
|
|
31
|
-
renderingMode,
|
|
32
|
-
isBlockBasedTheme,
|
|
33
|
-
hasV3BlocksOnly,
|
|
34
|
-
isEditingTemplate,
|
|
35
|
-
isZoomedOutView
|
|
36
|
-
} = useSelect(select => {
|
|
37
|
-
const {
|
|
38
|
-
isFeatureActive
|
|
39
|
-
} = select(editPostStore);
|
|
40
|
-
const {
|
|
41
|
-
getEditorSettings,
|
|
42
|
-
getRenderingMode
|
|
43
|
-
} = select(editorStore);
|
|
44
|
-
const {
|
|
45
|
-
getBlockTypes
|
|
46
|
-
} = select(blocksStore);
|
|
47
|
-
const {
|
|
48
|
-
__unstableGetEditorMode
|
|
49
|
-
} = select(blockEditorStore);
|
|
50
|
-
const editorSettings = getEditorSettings();
|
|
51
|
-
return {
|
|
52
|
-
isWelcomeGuideVisible: isFeatureActive('welcomeGuide'),
|
|
53
|
-
renderingMode: getRenderingMode(),
|
|
54
|
-
isBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme,
|
|
55
|
-
hasV3BlocksOnly: getBlockTypes().every(type => {
|
|
56
|
-
return type.apiVersion >= 3;
|
|
57
|
-
}),
|
|
58
|
-
isEditingTemplate: select(editorStore).getCurrentPostType() === 'wp_template',
|
|
59
|
-
isZoomedOutView: __unstableGetEditorMode() === 'zoom-out'
|
|
60
|
-
};
|
|
61
|
-
}, []);
|
|
62
|
-
const hasMetaBoxes = useSelect(select => select(editPostStore).hasMetaBoxes(), []);
|
|
63
|
-
const paddingAppenderRef = usePaddingAppender();
|
|
64
|
-
let paddingBottom;
|
|
65
|
-
|
|
66
|
-
// Add a constant padding for the typewritter effect. When typing at the
|
|
67
|
-
// bottom, there needs to be room to scroll up.
|
|
68
|
-
if (!isZoomedOutView && !hasMetaBoxes && renderingMode === 'post-only') {
|
|
69
|
-
paddingBottom = '40vh';
|
|
70
|
-
}
|
|
71
|
-
styles = useMemo(() => [...styles, {
|
|
72
|
-
// We should move this in to future to the body.
|
|
73
|
-
css: paddingBottom ? `body{padding-bottom:${paddingBottom}}` : ''
|
|
74
|
-
}], [styles, paddingBottom]);
|
|
75
|
-
const isToBeIframed = (hasV3BlocksOnly || isGutenbergPlugin && isBlockBasedTheme) && !hasMetaBoxes || isEditingTemplate;
|
|
76
|
-
return createElement("div", {
|
|
77
|
-
className: clsx('edit-post-visual-editor', {
|
|
78
|
-
'has-inline-canvas': !isToBeIframed
|
|
79
|
-
})
|
|
80
|
-
}, createElement(EditorCanvas, {
|
|
81
|
-
disableIframe: !isToBeIframed,
|
|
82
|
-
styles: styles
|
|
83
|
-
// We should auto-focus the canvas (title) on load.
|
|
84
|
-
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
85
|
-
,
|
|
86
|
-
autoFocus: !isWelcomeGuideVisible,
|
|
87
|
-
contentRef: paddingAppenderRef
|
|
88
|
-
}));
|
|
89
|
-
}
|
|
90
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","store","editorStore","privateApis","editorPrivateApis","useMemo","useSelect","blocksStore","blockEditorStore","editPostStore","unlock","usePaddingAppender","EditorCanvas","isGutenbergPlugin","process","env","IS_GUTENBERG_PLUGIN","VisualEditor","styles","isWelcomeGuideVisible","renderingMode","isBlockBasedTheme","hasV3BlocksOnly","isEditingTemplate","isZoomedOutView","select","isFeatureActive","getEditorSettings","getRenderingMode","getBlockTypes","__unstableGetEditorMode","editorSettings","__unstableIsBlockBasedTheme","every","type","apiVersion","getCurrentPostType","hasMetaBoxes","paddingAppenderRef","paddingBottom","css","isToBeIframed","createElement","className","disableIframe","autoFocus","contentRef"],"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { usePaddingAppender } from './use-padding-appender';\n\nconst { EditorCanvas } = unlock( editorPrivateApis );\n\nconst isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false;\n\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tisWelcomeGuideVisible,\n\t\trenderingMode,\n\t\tisBlockBasedTheme,\n\t\thasV3BlocksOnly,\n\t\tisEditingTemplate,\n\t\tisZoomedOutView,\n\t} = useSelect( ( select ) => {\n\t\tconst { isFeatureActive } = select( editPostStore );\n\t\tconst { getEditorSettings, getRenderingMode } = select( editorStore );\n\t\tconst { getBlockTypes } = select( blocksStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\t\tconst editorSettings = getEditorSettings();\n\t\treturn {\n\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t\trenderingMode: getRenderingMode(),\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\tisEditingTemplate:\n\t\t\t\tselect( editorStore ).getCurrentPostType() === 'wp_template',\n\t\t\tisZoomedOutView: __unstableGetEditorMode() === 'zoom-out',\n\t\t};\n\t}, [] );\n\tconst hasMetaBoxes = useSelect(\n\t\t( select ) => select( editPostStore ).hasMetaBoxes(),\n\t\t[]\n\t);\n\n\tconst paddingAppenderRef = usePaddingAppender();\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 (\n\t\t! isZoomedOutView &&\n\t\t! hasMetaBoxes &&\n\t\trenderingMode === 'post-only'\n\t) {\n\t\tpaddingBottom = '40vh';\n\t}\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: paddingBottom\n\t\t\t\t\t? `body{padding-bottom:${ paddingBottom }}`\n\t\t\t\t\t: '',\n\t\t\t},\n\t\t],\n\t\t[ styles, paddingBottom ]\n\t);\n\n\tconst isToBeIframed =\n\t\t( ( hasV3BlocksOnly || ( isGutenbergPlugin && isBlockBasedTheme ) ) &&\n\t\t\t! hasMetaBoxes ) ||\n\t\tisEditingTemplate;\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'edit-post-visual-editor', {\n\t\t\t\t'has-inline-canvas': ! isToBeIframed,\n\t\t\t} ) }\n\t\t>\n\t\t\t<EditorCanvas\n\t\t\t\tdisableIframe={ ! isToBeIframed }\n\t\t\t\tstyles={ styles }\n\t\t\t\t// We should auto-focus the canvas (title) on load.\n\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\tautoFocus={ ! isWelcomeGuideVisible }\n\t\t\t\tcontentRef={ paddingAppenderRef }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,KAAK,IAAIC,WAAW,EACpBC,WAAW,IAAIC,iBAAiB,QAC1B,mBAAmB;AAC1B,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASL,KAAK,IAAIM,WAAW,QAAQ,mBAAmB;AACxD,SAASN,KAAK,IAAIO,gBAAgB,QAAQ,yBAAyB;;AAEnE;AACA;AACA;AACA,SAASP,KAAK,IAAIQ,aAAa,QAAQ,aAAa;AACpD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,kBAAkB,QAAQ,wBAAwB;AAE3D,MAAM;EAAEC;AAAa,CAAC,GAAGF,MAAM,CAAEN,iBAAkB,CAAC;AAEpD,MAAMS,iBAAiB,GAAGC,OAAO,CAACC,GAAG,CAACC,mBAAmB,GAAG,IAAI,GAAG,KAAK;AAExE,eAAe,SAASC,YAAYA,CAAE;EAAEC;AAAO,C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AAa,GAAG,MAAM;EACvB;EAEArB,MAAM,GAAGb,OAAO,CACf,MAAM,CACL,GAAGa,MAAM,EACT;IACC;IACAsB,GAAG,EAAED,aAAa,GACd,uBAAuBA,aAAe,GAAE,GACzC;EACJ,CAAC,CACD,EACD,CAAErB,MAAM,EAAEqB,aAAa,CACxB,CAAC;EAED,MAAME,aAAa,GAChB,CAAEnB,eAAe,IAAMT,iBAAiB,IAAIQ,iBAAmB,KAChE,CAAEgB,YAAY,IACfd,iBAAiB;EAElB,OACCmB,aAAA;IACCC,SAAS,EAAG3C,IAAI,CAAE,yBAAyB,EAAE;MAC5C,mBAAmB,EAAE,CAAEyC;IACxB,CAAE;EAAG,GAELC,aAAA,CAAC9B,YAAY;IACZgC,aAAa,EAAG,CAAEH,aAAe;IACjCvB,MAAM,EAAGA;IACT;IACA;IAAA;IACA2B,SAAS,EAAG,CAAE1B,qBAAuB;IACrC2B,UAAU,EAAGR;EAAoB,CACjC,CACG,CAAC;AAER","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useRegistry","useRefEffect","store","blockEditorStore","isUnmodifiedDefaultBlock","usePaddingAppender","registry","node","onMouseDown","event","target","ownerDocument","defaultView","paddingBottom","parseInt","getComputedStyle","lastChild","lastElementChild","lastChildRect","getBoundingClientRect","clientY","bottom","preventDefault","blockOrder","select","getBlockOrder","lastBlockClientId","length","lastBlock","getBlock","selectBlock","insertDefaultBlock","dispatch","addEventListener","removeEventListener"],"sources":["@wordpress/edit-post/src/components/visual-editor/use-padding-appender.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\n\nexport function usePaddingAppender() {\n\tconst registry = useRegistry();\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tfunction onMouseDown( event ) {\n\t\t\t\tif ( event.target !== node ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst { ownerDocument } = node;\n\t\t\t\tconst { defaultView } = ownerDocument;\n\n\t\t\t\tconst paddingBottom = defaultView.parseInt(\n\t\t\t\t\tdefaultView.getComputedStyle( node ).paddingBottom,\n\t\t\t\t\t10\n\t\t\t\t);\n\n\t\t\t\tif ( ! paddingBottom ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Only handle clicks under the last child.\n\t\t\t\tconst lastChild = node.lastElementChild;\n\t\t\t\tif ( ! lastChild ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst lastChildRect = lastChild.getBoundingClientRect();\n\t\t\t\tif ( event.clientY < lastChildRect.bottom ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tconst blockOrder = registry\n\t\t\t\t\t.select( blockEditorStore )\n\t\t\t\t\t.getBlockOrder( '' );\n\t\t\t\tconst lastBlockClientId = blockOrder[ blockOrder.length - 1 ];\n\n\t\t\t\t// Do nothing when only default block appender is present.\n\t\t\t\tif ( ! lastBlockClientId ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst lastBlock = registry\n\t\t\t\t\t.select( blockEditorStore )\n\t\t\t\t\t.getBlock( lastBlockClientId );\n\t\t\t\tconst { selectBlock, insertDefaultBlock } =\n\t\t\t\t\tregistry.dispatch( blockEditorStore );\n\n\t\t\t\tif ( isUnmodifiedDefaultBlock( lastBlock ) ) {\n\t\t\t\t\tselectBlock( lastBlockClientId );\n\t\t\t\t} else {\n\t\t\t\t\tinsertDefaultBlock();\n\t\t\t\t}\n\t\t\t}\n\t\t\tnode.addEventListener( 'mousedown', onMouseDown );\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'mousedown', onMouseDown );\n\t\t\t};\n\t\t},\n\t\t[ registry ]\n\t);\n}\n"],"mappings":"AAAA;AACA;A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AAkB,CAAC;MAC/B,MAAM;QAAEI,WAAW;QAAEC;MAAmB,CAAC,GACxCzB,QAAQ,CAAC0B,QAAQ,CAAE7B,gBAAiB,CAAC;MAEtC,IAAKC,wBAAwB,CAAEwB,SAAU,CAAC,EAAG;QAC5CE,WAAW,CAAEJ,iBAAkB,CAAC;MACjC,CAAC,MAAM;QACNK,kBAAkB,CAAC,CAAC;MACrB;IACD;IACAxB,IAAI,CAAC0B,gBAAgB,CAAE,WAAW,EAAEzB,WAAY,CAAC;IACjD,OAAO,MAAM;MACZD,IAAI,CAAC2B,mBAAmB,CAAE,WAAW,EAAE1B,WAAY,CAAC;IACrD,CAAC;EACF,CAAC,EACD,CAAEF,QAAQ,CACX,CAAC;AACF","ignoreList":[]}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
|
-
import { __, isRTL } from '@wordpress/i18n';
|
|
6
|
-
import { drawerLeft, drawerRight, blockDefault, fullscreen, formatListBullets } from '@wordpress/icons';
|
|
7
|
-
import { useCommand } from '@wordpress/commands';
|
|
8
|
-
import { store as preferencesStore } from '@wordpress/preferences';
|
|
9
|
-
import { store as editorStore, privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
10
|
-
import { store as noticesStore } from '@wordpress/notices';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
|
-
import { store as editPostStore } from '../../store';
|
|
16
|
-
import { unlock } from '../../lock-unlock';
|
|
17
|
-
const {
|
|
18
|
-
interfaceStore
|
|
19
|
-
} = unlock(editorPrivateApis);
|
|
20
|
-
export default function useCommonCommands() {
|
|
21
|
-
const {
|
|
22
|
-
openGeneralSidebar,
|
|
23
|
-
closeGeneralSidebar
|
|
24
|
-
} = useDispatch(editPostStore);
|
|
25
|
-
const {
|
|
26
|
-
activeSidebar,
|
|
27
|
-
isFullscreen,
|
|
28
|
-
isPublishSidebarEnabled
|
|
29
|
-
} = useSelect(select => {
|
|
30
|
-
const {
|
|
31
|
-
get
|
|
32
|
-
} = select(preferencesStore);
|
|
33
|
-
return {
|
|
34
|
-
activeSidebar: select(interfaceStore).getActiveComplementaryArea('core'),
|
|
35
|
-
isPublishSidebarEnabled: select(editorStore).isPublishSidebarEnabled(),
|
|
36
|
-
isFullscreen: get('core/edit-post', 'fullscreenMode')
|
|
37
|
-
};
|
|
38
|
-
}, []);
|
|
39
|
-
const {
|
|
40
|
-
toggle
|
|
41
|
-
} = useDispatch(preferencesStore);
|
|
42
|
-
const {
|
|
43
|
-
createInfoNotice
|
|
44
|
-
} = useDispatch(noticesStore);
|
|
45
|
-
useCommand({
|
|
46
|
-
name: 'core/open-settings-sidebar',
|
|
47
|
-
label: __('Toggle settings sidebar'),
|
|
48
|
-
icon: isRTL() ? drawerLeft : drawerRight,
|
|
49
|
-
callback: ({
|
|
50
|
-
close
|
|
51
|
-
}) => {
|
|
52
|
-
close();
|
|
53
|
-
if (activeSidebar === 'edit-post/document') {
|
|
54
|
-
closeGeneralSidebar();
|
|
55
|
-
} else {
|
|
56
|
-
openGeneralSidebar('edit-post/document');
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
useCommand({
|
|
61
|
-
name: 'core/open-block-inspector',
|
|
62
|
-
label: __('Toggle block inspector'),
|
|
63
|
-
icon: blockDefault,
|
|
64
|
-
callback: ({
|
|
65
|
-
close
|
|
66
|
-
}) => {
|
|
67
|
-
close();
|
|
68
|
-
if (activeSidebar === 'edit-post/block') {
|
|
69
|
-
closeGeneralSidebar();
|
|
70
|
-
} else {
|
|
71
|
-
openGeneralSidebar('edit-post/block');
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
useCommand({
|
|
76
|
-
name: 'core/toggle-fullscreen-mode',
|
|
77
|
-
label: isFullscreen ? __('Exit fullscreen') : __('Enter fullscreen'),
|
|
78
|
-
icon: fullscreen,
|
|
79
|
-
callback: ({
|
|
80
|
-
close
|
|
81
|
-
}) => {
|
|
82
|
-
toggle('core/edit-post', 'fullscreenMode');
|
|
83
|
-
close();
|
|
84
|
-
createInfoNotice(isFullscreen ? __('Fullscreen off.') : __('Fullscreen on.'), {
|
|
85
|
-
id: 'core/edit-post/toggle-fullscreen-mode/notice',
|
|
86
|
-
type: 'snackbar',
|
|
87
|
-
actions: [{
|
|
88
|
-
label: __('Undo'),
|
|
89
|
-
onClick: () => {
|
|
90
|
-
toggle('core/edit-post', 'fullscreenMode');
|
|
91
|
-
}
|
|
92
|
-
}]
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
useCommand({
|
|
97
|
-
name: 'core/toggle-publish-sidebar',
|
|
98
|
-
label: isPublishSidebarEnabled ? __('Disable pre-publish checks') : __('Enable pre-publish checks'),
|
|
99
|
-
icon: formatListBullets,
|
|
100
|
-
callback: ({
|
|
101
|
-
close
|
|
102
|
-
}) => {
|
|
103
|
-
close();
|
|
104
|
-
toggle('core', 'isPublishSidebarEnabled');
|
|
105
|
-
createInfoNotice(isPublishSidebarEnabled ? __('Pre-publish checks disabled.') : __('Pre-publish checks enabled.'), {
|
|
106
|
-
id: 'core/editor/publish-sidebar/notice',
|
|
107
|
-
type: 'snackbar'
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
//# sourceMappingURL=use-common-commands.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useDispatch","__","isRTL","drawerLeft","drawerRight","blockDefault","fullscreen","formatListBullets","useCommand","store","preferencesStore","editorStore","privateApis","editorPrivateApis","noticesStore","editPostStore","unlock","interfaceStore","useCommonCommands","openGeneralSidebar","closeGeneralSidebar","activeSidebar","isFullscreen","isPublishSidebarEnabled","select","get","getActiveComplementaryArea","toggle","createInfoNotice","name","label","icon","callback","close","id","type","actions","onClick"],"sources":["@wordpress/edit-post/src/hooks/commands/use-common-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tfullscreen,\n\tformatListBullets,\n} from '@wordpress/icons';\nimport { useCommand } from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { interfaceStore } = unlock( editorPrivateApis );\n\nexport default function useCommonCommands() {\n\tconst { openGeneralSidebar, closeGeneralSidebar } =\n\t\tuseDispatch( editPostStore );\n\tconst { activeSidebar, isFullscreen, isPublishSidebarEnabled } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { get } = select( preferencesStore );\n\n\t\t\treturn {\n\t\t\t\tactiveSidebar:\n\t\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t\t\t'core'\n\t\t\t\t\t),\n\t\t\t\tisPublishSidebarEnabled:\n\t\t\t\t\tselect( editorStore ).isPublishSidebarEnabled(),\n\t\t\t\tisFullscreen: get( 'core/edit-post', 'fullscreenMode' ),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst { createInfoNotice } = useDispatch( noticesStore );\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-fullscreen-mode',\n\t\tlabel: isFullscreen\n\t\t\t? __( 'Exit fullscreen' )\n\t\t\t: __( 'Enter fullscreen' ),\n\t\ticon: fullscreen,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'fullscreenMode' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisFullscreen ? __( 'Fullscreen off.' ) : __( 'Fullscreen on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/toggle-fullscreen-mode/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\ttoggle( 'core/edit-post', 'fullscreenMode' );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-publish-sidebar',\n\t\tlabel: isPublishSidebarEnabled\n\t\t\t? __( 'Disable pre-publish checks' )\n\t\t\t: __( 'Enable pre-publish checks' ),\n\t\ticon: formatListBullets,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\ttoggle( 'core', 'isPublishSidebarEnabled' );\n\t\t\tcreateInfoNotice(\n\t\t\t\tisPublishSidebarEnabled\n\t\t\t\t\t? __( 'Pre-publish checks disabled.'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gB,CACfN,YAAY,GAAGrB,EAAE,CAAE,iBAAkB,CAAC,GAAGA,EAAE,CAAE,gBAAiB,CAAC,EAC/D;QACCiC,EAAE,EAAE,8CAA8C;QAClDC,IAAI,EAAE,UAAU;QAChBC,OAAO,EAAE,CACR;UACCN,KAAK,EAAE7B,EAAE,CAAE,MAAO,CAAC;UACnBoC,OAAO,EAAEA,CAAA,KAAM;YACdV,MAAM,CAAE,gBAAgB,EAAE,gBAAiB,CAAC;UAC7C;QACD,CAAC;MAEH,CACD,CAAC;IACF;EACD,CAAE,CAAC;EAEHnB,UAAU,CAAE;IACXqB,IAAI,EAAE,6BAA6B;IACnCC,KAAK,EAAEP,uBAAuB,GAC3BtB,EAAE,CAAE,4BAA6B,CAAC,GAClCA,EAAE,CAAE,2BAA4B,CAAC;IACpC8B,IAAI,EAAExB,iBAAiB;IACvByB,QAAQ,EAAEA,CAAE;MAAEC;IAAM,CAAC,KAAM;MAC1BA,KAAK,CAAC,CAAC;MACPN,MAAM,CAAE,MAAM,EAAE,yBAA0B,CAAC;MAC3CC,gBAAgB,CACfL,uBAAuB,GACpBtB,EAAE,CAAE,8BAA+B,CAAC,GACpCA,EAAE,CAAE,6BAA8B,CAAC,EACtC;QACCiC,EAAE,EAAE,oCAAoC;QACxCC,IAAI,EAAE;MACP,CACD,CAAC;IACF;EACD,CAAE,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { addFilter } from '@wordpress/hooks';
|
|
5
|
-
import { MediaUpload } from '@wordpress/media-utils';
|
|
6
|
-
const replaceMediaUpload = () => MediaUpload;
|
|
7
|
-
addFilter('editor.MediaUpload', 'core/edit-post/replace-media-upload', replaceMediaUpload);
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["addFilter","MediaUpload","replaceMediaUpload"],"sources":["@wordpress/edit-post/src/hooks/components/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { MediaUpload } from '@wordpress/media-utils';\n\nconst replaceMediaUpload = () => MediaUpload;\n\naddFilter(\n\t'editor.MediaUpload',\n\t'core/edit-post/replace-media-upload',\n\treplaceMediaUpload\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,WAAW,QAAQ,wBAAwB;AAEpD,MAAMC,kBAAkB,GAAGA,CAAA,KAAMD,WAAW;AAE5CD,SAAS,CACR,oBAAoB,EACpB,qCAAqC,EACrCE,kBACD,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/edit-post/src/hooks/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport './components';\nimport './validate-multiple-use';\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,cAAc;AACrB,OAAO,yBAAyB","ignoreList":[]}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { createBlock, findTransform, getBlockTransforms, getBlockType, hasBlockSupport } from '@wordpress/blocks';
|
|
6
|
-
import { Button } from '@wordpress/components';
|
|
7
|
-
import { withSelect, withDispatch } from '@wordpress/data';
|
|
8
|
-
import { Warning, store as blockEditorStore } from '@wordpress/block-editor';
|
|
9
|
-
import { addFilter } from '@wordpress/hooks';
|
|
10
|
-
import { __ } from '@wordpress/i18n';
|
|
11
|
-
import { compose, createHigherOrderComponent } from '@wordpress/compose';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Recursively find very first block of an specific block type.
|
|
15
|
-
*
|
|
16
|
-
* @param {Object[]} blocks List of blocks.
|
|
17
|
-
* @param {string} name Block name to search.
|
|
18
|
-
*
|
|
19
|
-
* @return {Object|undefined} Return block object or undefined.
|
|
20
|
-
*/
|
|
21
|
-
function findFirstOfSameType(blocks, name) {
|
|
22
|
-
if (!Array.isArray(blocks) || !blocks.length) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
for (const block of blocks) {
|
|
26
|
-
if (block.name === name) {
|
|
27
|
-
return block;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Search inside innerBlocks.
|
|
31
|
-
const firstBlock = findFirstOfSameType(block.innerBlocks, name);
|
|
32
|
-
if (firstBlock) {
|
|
33
|
-
return firstBlock;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const enhance = compose(
|
|
38
|
-
/**
|
|
39
|
-
* For blocks whose block type doesn't support `multiple`, provides the
|
|
40
|
-
* wrapped component with `originalBlockClientId` -- a reference to the
|
|
41
|
-
* first block of the same type in the content -- if and only if that
|
|
42
|
-
* "original" block is not the current one. Thus, an inexisting
|
|
43
|
-
* `originalBlockClientId` prop signals that the block is valid.
|
|
44
|
-
*
|
|
45
|
-
* @param {Component} WrappedBlockEdit A filtered BlockEdit instance.
|
|
46
|
-
*
|
|
47
|
-
* @return {Component} Enhanced component with merged state data props.
|
|
48
|
-
*/
|
|
49
|
-
withSelect((select, block) => {
|
|
50
|
-
const multiple = hasBlockSupport(block.name, 'multiple', true);
|
|
51
|
-
|
|
52
|
-
// For block types with `multiple` support, there is no "original
|
|
53
|
-
// block" to be found in the content, as the block itself is valid.
|
|
54
|
-
if (multiple) {
|
|
55
|
-
return {};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Otherwise, only pass `originalBlockClientId` if it refers to a different
|
|
59
|
-
// block from the current one.
|
|
60
|
-
const blocks = select(blockEditorStore).getBlocks();
|
|
61
|
-
const firstOfSameType = findFirstOfSameType(blocks, block.name);
|
|
62
|
-
const isInvalid = firstOfSameType && firstOfSameType.clientId !== block.clientId;
|
|
63
|
-
return {
|
|
64
|
-
originalBlockClientId: isInvalid && firstOfSameType.clientId
|
|
65
|
-
};
|
|
66
|
-
}), withDispatch((dispatch, {
|
|
67
|
-
originalBlockClientId
|
|
68
|
-
}) => ({
|
|
69
|
-
selectFirst: () => dispatch(blockEditorStore).selectBlock(originalBlockClientId)
|
|
70
|
-
})));
|
|
71
|
-
const withMultipleValidation = createHigherOrderComponent(BlockEdit => {
|
|
72
|
-
return enhance(({
|
|
73
|
-
originalBlockClientId,
|
|
74
|
-
selectFirst,
|
|
75
|
-
...props
|
|
76
|
-
}) => {
|
|
77
|
-
if (!originalBlockClientId) {
|
|
78
|
-
return createElement(BlockEdit, {
|
|
79
|
-
...props
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
const blockType = getBlockType(props.name);
|
|
83
|
-
const outboundType = getOutboundType(props.name);
|
|
84
|
-
return [createElement("div", {
|
|
85
|
-
key: "invalid-preview",
|
|
86
|
-
style: {
|
|
87
|
-
minHeight: '60px'
|
|
88
|
-
}
|
|
89
|
-
}, createElement(BlockEdit, {
|
|
90
|
-
key: "block-edit",
|
|
91
|
-
...props
|
|
92
|
-
})), createElement(Warning, {
|
|
93
|
-
key: "multiple-use-warning",
|
|
94
|
-
actions: [createElement(Button, {
|
|
95
|
-
key: "find-original",
|
|
96
|
-
variant: "secondary",
|
|
97
|
-
onClick: selectFirst
|
|
98
|
-
}, __('Find original')), createElement(Button, {
|
|
99
|
-
key: "remove",
|
|
100
|
-
variant: "secondary",
|
|
101
|
-
onClick: () => props.onReplace([])
|
|
102
|
-
}, __('Remove')), outboundType && createElement(Button, {
|
|
103
|
-
key: "transform",
|
|
104
|
-
variant: "secondary",
|
|
105
|
-
onClick: () => props.onReplace(createBlock(outboundType.name, props.attributes))
|
|
106
|
-
}, __('Transform into:'), " ", outboundType.title)]
|
|
107
|
-
}, createElement("strong", null, blockType?.title, ": "), __('This block can only be used once.'))];
|
|
108
|
-
});
|
|
109
|
-
}, 'withMultipleValidation');
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Given a base block name, returns the default block type to which to offer
|
|
113
|
-
* transforms.
|
|
114
|
-
*
|
|
115
|
-
* @param {string} blockName Base block name.
|
|
116
|
-
*
|
|
117
|
-
* @return {?Object} The chosen default block type.
|
|
118
|
-
*/
|
|
119
|
-
function getOutboundType(blockName) {
|
|
120
|
-
// Grab the first outbound transform.
|
|
121
|
-
const transform = findTransform(getBlockTransforms('to', blockName), ({
|
|
122
|
-
type,
|
|
123
|
-
blocks
|
|
124
|
-
}) => type === 'block' && blocks.length === 1 // What about when .length > 1?
|
|
125
|
-
);
|
|
126
|
-
if (!transform) {
|
|
127
|
-
return null;
|
|
128
|
-
}
|
|
129
|
-
return getBlockType(transform.blocks[0]);
|
|
130
|
-
}
|
|
131
|
-
addFilter('editor.BlockEdit', 'core/edit-post/validate-multiple-use/with-multiple-validation', withMultipleValidation);
|
|
132
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createBlock","findTransform","getBlockTransforms","getBlockType","hasBlockSupport","Button","withSelect","withDispatch","Warning","store","blockEditorStore","addFilter","__","compose","createHigherOrderComponent","findFirstOfSameType","blocks","name","Array","isArray","length","block","firstBlock","innerBlocks","enhance","select","multiple","getBlocks","firstOfSameType","isInvalid","clientId","originalBlockClientId","dispatch","selectFirst","selectBlock","withMultipleValidation","BlockEdit","props","createElement","blockType","outboundType","getOutboundType","key","style","minHeight","actions","variant","onClick","onReplace","attributes","title","blockName","transform","type"],"sources":["@wordpress/edit-post/src/hooks/validate-multiple-use/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateBlock,\n\tfindTransform,\n\tgetBlockTransforms,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { Button } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { Warning, store as blockEditorStore } from '@wordpress/block-editor';\nimport { addFilter } from '@wordpress/hooks';\nimport { __ } from '@wordpress/i18n';\nimport { compose, createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Recursively find very first block of an specific block type.\n *\n * @param {Object[]} blocks List of blocks.\n * @param {string} name Block name to search.\n *\n * @return {Object|undefined} Return block object or undefined.\n */\nfunction findFirstOfSameType( blocks, name ) {\n\tif ( ! Array.isArray( blocks ) || ! blocks.length ) {\n\t\treturn;\n\t}\n\n\tfor ( const block of blocks ) {\n\t\tif ( block.name === name ) {\n\t\t\treturn block;\n\t\t}\n\n\t\t// Search inside innerBlocks.\n\t\tconst firstBlock = findFirstOfSameType( block.innerBlocks, name );\n\n\t\tif ( firstBlock ) {\n\t\t\treturn firstBlock;\n\t\t}\n\t}\n}\n\nconst enhance = compose(\n\t/**\n\t * For blocks whose block type doesn't support `multiple`, provides the\n\t * wrapped component with `originalBlockClientId` -- a reference to the\n\t * first block of the same type in the content -- if and only if that\n\t * \"original\" block is not the current one. Thus, an inexisting\n\t * `originalBlockClientId` prop signals that the block is valid.\n\t *\n\t * @param {Component} WrappedBlockEdit A filtered BlockEdit instance.\n\t *\n\t * @return {Component} Enhanced component with merged state data props.\n\t */\n\twithSelect( ( select, block ) => {\n\t\tconst multiple = hasBlockSupport( block.name, 'multiple', true );\n\n\t\t// For block types with `multiple` support, there is no \"original\n\t\t// block\" to be found in the content, as the block itself is valid.\n\t\tif ( multiple ) {\n\t\t\treturn {};\n\t\t}\n\n\t\t// Otherwise, only pass `originalBlockClientId` if it refers to a different\n\t\t// block from the current one.\n\t\tconst blocks = select( blockEditorStore ).getBlocks();\n\t\tconst firstOfSameType = findFirstOfSameType( blocks, block.name );\n\t\tconst isInvalid =\n\t\t\tfirstOfSameType && firstOfSameType.clientId !== block.clientId;\n\t\treturn {\n\t\t\toriginalBlockClientId: isInvalid && firstOfSameType.clientId,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { originalBlockClientId } ) => ( {\n\t\tselectFirst: () =>\n\t\t\tdispatch( blockEditorStore ).selectBlock( originalBlockClientId ),\n\t} ) )\n);\n\nconst withMultipleValidation = createHigherOrderComponent( ( BlockEdit ) => {\n\treturn enhance( ( { originalBlockClientId, selectFirst, ...props } ) => {\n\t\tif ( ! originalBlockClientId ) {\n\t\t\treturn <BlockEdit { ...props } />;\n\t\t}\n\n\t\tconst blockType = getBlockType( props.name );\n\t\tconst outboundType = getOutboundType( props.name );\n\n\t\treturn [\n\t\t\t<div key=\"invalid-preview\" style={ { minHeight: '60px' } }>\n\t\t\t\t<BlockEdit key=\"block-edit\" { ...props } />\n\t\t\t</div>,\n\t\t\t<Warning\n\t\t\t\tkey=\"multiple-use-warning\"\n\t\t\t\tactions={ [\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey=\"find-original\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tonClick={ selectFirst }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Find original' ) }\n\t\t\t\t\t</Button>,\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey=\"remove\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tonClick={ () => props.onReplace( [] ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t</Button>,\n\t\t\t\t\toutboundType && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey=\"transform\"\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tprops.onReplace(\n\t\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\t\toutboundType.name,\n\t\t\t\t\t\t\t\t\t\tprops.attributes\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>\n\t\t\t\t\t\t\t{ __( 'Transform into:' ) } { outboundType.title }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t),\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t<strong>{ blockType?.title }: </strong>\n\t\t\t\t{ __( 'This block can only be used once.' ) }\n\t\t\t</Warning>,\n\t\t];\n\t} );\n}, 'withMultipleValidation' );\n\n/**\n * Given a base block name, returns the default block type to which to offer\n * transforms.\n *\n * @param {string} blockName Base block name.\n *\n * @return {?Object} The chosen default block type.\n */\nfunction getOutboundType( blockName ) {\n\t// Grab the first outbound transform.\n\tconst transform = findTransform(\n\t\tgetBlockTransforms( 'to', blockName ),\n\t\t( { type, blocks } ) => type === 'block' && blocks.length === 1 // What about when .length > 1?\n\t);\n\n\tif ( ! transform ) {\n\t\treturn null;\n\t}\n\n\treturn getBlockType( transform.blocks[ 0 ] );\n}\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-post/validate-multiple-use/with-multiple-validation',\n\twithMultipleValidation\n);\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,WAAW,EACXC,aAAa,EACbC,kBAAkB,EAClBC,YAAY,EACZC,eAAe,QACT,mBAAmB;AAC1B,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC1D,SAASC,OAAO,EAAEC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AAC5E,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,OAAO,EAAEC,0BAA0B,QAAQ,oBAAoB;;AAExE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,mBAAmBA,CAAEC,MAAM,EAAEC,IAAI,EAAG;EAC5C,IAAK,CAAEC,KAAK,CAACC,OAAO,CAAEH,MAAO,CAAC,IAAI,CAAEA,MAAM,CAACI,MAAM,EAAG;IACnD;EACD;EAEA,KAAM,MAAMC,KAAK,IAAIL,MAAM,EAAG;IAC7B,IAAKK,KAAK,CAACJ,IAAI,KAAKA,IAAI,EAAG;MAC1B,OAAOI,KAAK;IACb;;IAEA;IACA,MAAMC,UAAU,GAAGP,mBAAmB,CAAEM,KAAK,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AAa,CAC9BC,kBAAkB,CAAE,IAAI,EAAEiD,SAAU,CAAC,EACrC,CAAE;IAAEE,IAAI;IAAErC;EAAO,CAAC,KAAMqC,IAAI,KAAK,OAAO,IAAIrC,MAAM,CAACI,MAAM,KAAK,CAAC,CAAC;EACjE,CAAC;EAED,IAAK,CAAEgC,SAAS,EAAG;IAClB,OAAO,IAAI;EACZ;EAEA,OAAOjD,YAAY,CAAEiD,SAAS,CAACpC,MAAM,CAAE,CAAC,CAAG,CAAC;AAC7C;AAEAL,SAAS,CACR,kBAAkB,EAClB,+DAA+D,EAC/DwB,sBACD,CAAC","ignoreList":[]}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
5
|
-
import { useSelect } from '@wordpress/data';
|
|
6
|
-
import { __unstableMotion as motion } from '@wordpress/components';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
import FullscreenModeClose from './fullscreen-mode-close';
|
|
12
|
-
import PostEditorMoreMenu from './more-menu';
|
|
13
|
-
import MainDashboardButton from './main-dashboard-button';
|
|
14
|
-
import { store as editPostStore } from '../../store';
|
|
15
|
-
import { unlock } from '../../lock-unlock';
|
|
16
|
-
|
|
17
|
-
const { Header: EditorHeader } = unlock( editorPrivateApis );
|
|
18
|
-
|
|
19
|
-
const slideX = {
|
|
20
|
-
hidden: { x: '-100%' },
|
|
21
|
-
distractionFreeInactive: { x: 0 },
|
|
22
|
-
hover: { x: 0, transition: { type: 'tween', delay: 0.2 } },
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
function Header( { setEntitiesSavedStatesCallback, initialPost } ) {
|
|
26
|
-
const { hasActiveMetaboxes } = useSelect( ( select ) => {
|
|
27
|
-
return {
|
|
28
|
-
hasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),
|
|
29
|
-
};
|
|
30
|
-
}, [] );
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<EditorHeader
|
|
34
|
-
forceIsDirty={ hasActiveMetaboxes }
|
|
35
|
-
setEntitiesSavedStatesCallback={ setEntitiesSavedStatesCallback }
|
|
36
|
-
>
|
|
37
|
-
<MainDashboardButton.Slot>
|
|
38
|
-
<motion.div
|
|
39
|
-
variants={ slideX }
|
|
40
|
-
transition={ { type: 'tween', delay: 0.8 } }
|
|
41
|
-
>
|
|
42
|
-
<FullscreenModeClose
|
|
43
|
-
showTooltip
|
|
44
|
-
initialPost={ initialPost }
|
|
45
|
-
/>
|
|
46
|
-
</motion.div>
|
|
47
|
-
</MainDashboardButton.Slot>
|
|
48
|
-
<PostEditorMoreMenu />
|
|
49
|
-
</EditorHeader>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export default Header;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
__experimentalUseSlotFills as useSlotFills,
|
|
6
|
-
createSlotFill,
|
|
7
|
-
} from '@wordpress/components';
|
|
8
|
-
|
|
9
|
-
const slotName = '__experimentalMainDashboardButton';
|
|
10
|
-
|
|
11
|
-
const { Fill, Slot: MainDashboardButtonSlot } = createSlotFill( slotName );
|
|
12
|
-
|
|
13
|
-
const MainDashboardButton = Fill;
|
|
14
|
-
|
|
15
|
-
const Slot = ( { children } ) => {
|
|
16
|
-
const fills = useSlotFills( slotName );
|
|
17
|
-
const hasFills = Boolean( fills && fills.length );
|
|
18
|
-
|
|
19
|
-
if ( ! hasFills ) {
|
|
20
|
-
return children;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return <MainDashboardButtonSlot bubblesVirtually />;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
MainDashboardButton.Slot = Slot;
|
|
27
|
-
|
|
28
|
-
export default MainDashboardButton;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
PostTextEditor,
|
|
6
|
-
PostTitleRaw,
|
|
7
|
-
store as editorStore,
|
|
8
|
-
} from '@wordpress/editor';
|
|
9
|
-
import { Button } from '@wordpress/components';
|
|
10
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
11
|
-
import { __ } from '@wordpress/i18n';
|
|
12
|
-
import { displayShortcut } from '@wordpress/keycodes';
|
|
13
|
-
import { useEffect, useRef } from '@wordpress/element';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Internal dependencies
|
|
17
|
-
*/
|
|
18
|
-
import { store as editPostStore } from '../../store';
|
|
19
|
-
|
|
20
|
-
export default function TextEditor() {
|
|
21
|
-
const isRichEditingEnabled = useSelect( ( select ) => {
|
|
22
|
-
return select( editorStore ).getEditorSettings().richEditingEnabled;
|
|
23
|
-
}, [] );
|
|
24
|
-
const { switchEditorMode } = useDispatch( editorStore );
|
|
25
|
-
|
|
26
|
-
const { isWelcomeGuideVisible } = useSelect( ( select ) => {
|
|
27
|
-
const { isFeatureActive } = select( editPostStore );
|
|
28
|
-
|
|
29
|
-
return {
|
|
30
|
-
isWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),
|
|
31
|
-
};
|
|
32
|
-
}, [] );
|
|
33
|
-
|
|
34
|
-
const titleRef = useRef();
|
|
35
|
-
|
|
36
|
-
useEffect( () => {
|
|
37
|
-
if ( isWelcomeGuideVisible ) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
titleRef?.current?.focus();
|
|
41
|
-
}, [ isWelcomeGuideVisible ] );
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<div className="edit-post-text-editor">
|
|
45
|
-
{ isRichEditingEnabled && (
|
|
46
|
-
<div className="edit-post-text-editor__toolbar">
|
|
47
|
-
<h2>{ __( 'Editing code' ) }</h2>
|
|
48
|
-
<Button
|
|
49
|
-
variant="tertiary"
|
|
50
|
-
onClick={ () => switchEditorMode( 'visual' ) }
|
|
51
|
-
shortcut={ displayShortcut.secondary( 'm' ) }
|
|
52
|
-
>
|
|
53
|
-
{ __( 'Exit code editor' ) }
|
|
54
|
-
</Button>
|
|
55
|
-
</div>
|
|
56
|
-
) }
|
|
57
|
-
<div className="edit-post-text-editor__body">
|
|
58
|
-
<PostTitleRaw ref={ titleRef } />
|
|
59
|
-
<PostTextEditor />
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
);
|
|
63
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
.edit-post-text-editor {
|
|
2
|
-
position: relative;
|
|
3
|
-
width: 100%;
|
|
4
|
-
background-color: $white;
|
|
5
|
-
flex-grow: 1;
|
|
6
|
-
|
|
7
|
-
// Post title.
|
|
8
|
-
.editor-post-title:not(.is-raw-text),
|
|
9
|
-
.editor-post-title.is-raw-text textarea {
|
|
10
|
-
max-width: none;
|
|
11
|
-
line-height: $default-line-height;
|
|
12
|
-
|
|
13
|
-
font-family: $editor-html-font;
|
|
14
|
-
font-size: 2.5em;
|
|
15
|
-
font-weight: normal;
|
|
16
|
-
|
|
17
|
-
border: $border-width solid $gray-600;
|
|
18
|
-
border-radius: 0;
|
|
19
|
-
|
|
20
|
-
// Same padding as body.
|
|
21
|
-
padding: $grid-unit-20;
|
|
22
|
-
|
|
23
|
-
@include break-small() {
|
|
24
|
-
padding: $grid-unit-30;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
&:focus {
|
|
28
|
-
border-color: var(--wp-admin-theme-color);
|
|
29
|
-
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.edit-post-text-editor__body {
|
|
35
|
-
width: 100%;
|
|
36
|
-
padding: 0 $grid-unit-15 $grid-unit-15 $grid-unit-15;
|
|
37
|
-
max-width: $break-xlarge;
|
|
38
|
-
margin-left: auto;
|
|
39
|
-
margin-right: auto;
|
|
40
|
-
|
|
41
|
-
@include break-large() {
|
|
42
|
-
padding: 0 $grid-unit-30 $grid-unit-30 $grid-unit-30;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Exit code editor toolbar.
|
|
47
|
-
.edit-post-text-editor__toolbar {
|
|
48
|
-
position: sticky;
|
|
49
|
-
z-index: z-index(".edit-post-text-editor__toolbar");
|
|
50
|
-
top: 0;
|
|
51
|
-
left: 0;
|
|
52
|
-
right: 0;
|
|
53
|
-
display: flex;
|
|
54
|
-
background: rgba($white, 0.8);
|
|
55
|
-
padding: $grid-unit-05 $grid-unit-15;
|
|
56
|
-
|
|
57
|
-
@include break-small() {
|
|
58
|
-
padding: $grid-unit-15;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
@include break-large() {
|
|
62
|
-
padding: $grid-unit-15 $grid-unit-30;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
h2 {
|
|
66
|
-
line-height: $button-size;
|
|
67
|
-
margin: 0 auto 0 0;
|
|
68
|
-
font-size: $default-font-size;
|
|
69
|
-
color: $gray-900;
|
|
70
|
-
}
|
|
71
|
-
}
|