@wordpress/editor 14.34.1-next.2f1c7c01b.0 → 14.35.1-next.16d95556a.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +1 -1
- package/build/components/collab-sidebar/add-comment.js +4 -6
- package/build/components/collab-sidebar/add-comment.js.map +2 -2
- package/build/components/collab-sidebar/comment-form.js +14 -5
- package/build/components/collab-sidebar/comment-form.js.map +2 -2
- package/build/components/collab-sidebar/comments.js +61 -25
- package/build/components/collab-sidebar/comments.js.map +2 -2
- package/build/components/collab-sidebar/index.js +4 -4
- package/build/components/collab-sidebar/index.js.map +2 -2
- package/build/components/commands/index.js +16 -4
- package/build/components/commands/index.js.map +2 -2
- package/build/components/editor/index.js +10 -2
- package/build/components/editor/index.js.map +2 -2
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/pattern-duplicate-modal/index.js +20 -14
- package/build/components/pattern-duplicate-modal/index.js.map +3 -3
- package/build/components/pattern-rename-modal/index.js +20 -14
- package/build/components/pattern-rename-modal/index.js.map +3 -3
- package/build/components/post-template/panel.js +9 -6
- package/build/components/post-template/panel.js.map +2 -2
- package/build/components/post-title/index.js +18 -9
- package/build/components/post-title/index.js.map +2 -2
- package/build/components/style-book/examples.js +1 -1
- package/build/components/style-book/examples.js.map +1 -1
- package/build/components/visual-editor/index.js +10 -2
- package/build/components/visual-editor/index.js.map +2 -2
- package/build/components/visual-editor/use-edit-content-only-section-exit.js +65 -0
- package/build/components/visual-editor/use-edit-content-only-section-exit.js.map +7 -0
- package/build/components/visual-editor/use-padding-appender.js +75 -0
- package/build/components/visual-editor/use-padding-appender.js.map +7 -0
- package/build/dataviews/fields/content-preview/content-preview-view.js +2 -2
- package/build/dataviews/fields/content-preview/content-preview-view.js.map +3 -3
- package/build/hooks/pattern-overrides.js +1 -3
- package/build/hooks/pattern-overrides.js.map +2 -2
- package/build/store/actions.js +1 -1
- package/build/store/actions.js.map +2 -2
- package/build-module/components/collab-sidebar/add-comment.js +4 -6
- package/build-module/components/collab-sidebar/add-comment.js.map +2 -2
- package/build-module/components/collab-sidebar/comment-form.js +14 -5
- package/build-module/components/collab-sidebar/comment-form.js.map +2 -2
- package/build-module/components/collab-sidebar/comments.js +61 -25
- package/build-module/components/collab-sidebar/comments.js.map +2 -2
- package/build-module/components/collab-sidebar/index.js +4 -4
- package/build-module/components/collab-sidebar/index.js.map +2 -2
- package/build-module/components/commands/index.js +16 -4
- package/build-module/components/commands/index.js.map +2 -2
- package/build-module/components/editor/index.js +10 -2
- package/build-module/components/editor/index.js.map +2 -2
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/pattern-duplicate-modal/index.js +20 -14
- package/build-module/components/pattern-duplicate-modal/index.js.map +2 -2
- package/build-module/components/pattern-rename-modal/index.js +20 -14
- package/build-module/components/pattern-rename-modal/index.js.map +2 -2
- package/build-module/components/post-template/panel.js +9 -6
- package/build-module/components/post-template/panel.js.map +2 -2
- package/build-module/components/post-title/index.js +18 -9
- package/build-module/components/post-title/index.js.map +2 -2
- package/build-module/components/style-book/examples.js +1 -1
- package/build-module/components/style-book/examples.js.map +1 -1
- package/build-module/components/visual-editor/index.js +10 -2
- package/build-module/components/visual-editor/index.js.map +2 -2
- package/build-module/components/visual-editor/use-edit-content-only-section-exit.js +40 -0
- package/build-module/components/visual-editor/use-edit-content-only-section-exit.js.map +7 -0
- package/build-module/components/visual-editor/use-padding-appender.js +50 -0
- package/build-module/components/visual-editor/use-padding-appender.js.map +7 -0
- package/build-module/dataviews/fields/content-preview/content-preview-view.js +3 -4
- package/build-module/dataviews/fields/content-preview/content-preview-view.js.map +2 -2
- package/build-module/hooks/pattern-overrides.js +1 -3
- package/build-module/hooks/pattern-overrides.js.map +2 -2
- package/build-module/store/actions.js +1 -1
- package/build-module/store/actions.js.map +2 -2
- package/build-style/style-rtl.css +52 -40
- package/build-style/style.css +52 -40
- package/build-types/components/collab-sidebar/add-comment.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/comment-form.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/comments.d.ts +1 -1
- package/build-types/components/collab-sidebar/comments.d.ts.map +1 -1
- package/build-types/components/commands/index.d.ts.map +1 -1
- package/build-types/components/editor/index.d.ts.map +1 -1
- package/build-types/components/entities-saved-states/index.d.ts +2 -2
- package/build-types/components/entities-saved-states/index.d.ts.map +1 -1
- package/build-types/components/global-styles/hooks.d.ts +6 -6
- package/build-types/components/global-styles/hooks.d.ts.map +1 -1
- package/build-types/components/header/back-button.d.ts.map +1 -1
- package/build-types/components/local-autosave-monitor/index.d.ts.map +1 -1
- package/build-types/components/more-menu/tools-more-menu-group.d.ts.map +1 -1
- package/build-types/components/more-menu/view-more-menu-group.d.ts.map +1 -1
- package/build-types/components/pattern-duplicate-modal/index.d.ts.map +1 -1
- package/build-types/components/pattern-rename-modal/index.d.ts.map +1 -1
- package/build-types/components/plugin-document-setting-panel/index.d.ts.map +1 -1
- package/build-types/components/plugin-post-publish-panel/index.d.ts.map +1 -1
- package/build-types/components/plugin-post-status-info/index.d.ts.map +1 -1
- package/build-types/components/plugin-pre-publish-panel/index.d.ts.map +1 -1
- package/build-types/components/post-excerpt/plugin.d.ts.map +1 -1
- package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
- package/build-types/components/post-publish-button/index.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts +1 -10
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
- package/build-types/components/post-template/panel.d.ts.map +1 -1
- package/build-types/components/preferences-modal/enable-plugin-document-setting-panel.d.ts.map +1 -1
- package/build-types/components/save-publish-panels/index.d.ts.map +1 -1
- package/build-types/components/style-book/color-examples.d.ts.map +1 -1
- package/build-types/components/style-book/duotone-examples.d.ts.map +1 -1
- package/build-types/components/visual-editor/index.d.ts.map +1 -1
- package/build-types/components/visual-editor/use-edit-content-only-section-exit.d.ts +6 -0
- package/build-types/components/visual-editor/use-edit-content-only-section-exit.d.ts.map +1 -0
- package/build-types/components/visual-editor/use-padding-appender.d.ts +2 -0
- package/build-types/components/visual-editor/use-padding-appender.d.ts.map +1 -0
- package/build-types/dataviews/fields/content-preview/content-preview-view.d.ts.map +1 -1
- package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
- package/build-types/store/actions.d.ts +3 -4
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +5 -5
- package/build-types/store/selectors.d.ts +68 -68
- package/package.json +40 -40
- package/src/components/collab-sidebar/add-comment.js +4 -10
- package/src/components/collab-sidebar/comment-form.js +16 -4
- package/src/components/collab-sidebar/comments.js +101 -42
- package/src/components/collab-sidebar/index.js +4 -4
- package/src/components/collab-sidebar/style.scss +15 -0
- package/src/components/commands/index.js +32 -19
- package/src/components/editor/index.js +11 -0
- package/src/components/entities-saved-states/index.js +1 -1
- package/src/components/global-styles/hooks.js +4 -4
- package/src/components/pattern-duplicate-modal/index.js +23 -15
- package/src/components/pattern-rename-modal/index.js +24 -15
- package/src/components/post-template/panel.js +11 -8
- package/src/components/post-title/index.js +22 -9
- package/src/components/style-book/examples.tsx +1 -1
- package/src/components/visual-editor/index.js +10 -1
- package/src/components/visual-editor/use-edit-content-only-section-exit.js +55 -0
- package/src/components/visual-editor/use-padding-appender.js +70 -0
- package/src/dataviews/fields/content-preview/content-preview-view.tsx +2 -5
- package/src/hooks/pattern-overrides.js +0 -2
- package/src/store/actions.js +9 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -38,6 +38,8 @@ import {
|
|
|
38
38
|
TEMPLATE_POST_TYPE,
|
|
39
39
|
} from '../../store/constants';
|
|
40
40
|
import { useZoomOutModeExit } from './use-zoom-out-mode-exit';
|
|
41
|
+
import { usePaddingAppender } from './use-padding-appender';
|
|
42
|
+
import { useEditContentOnlySectionExit } from './use-edit-content-only-section-exit';
|
|
41
43
|
|
|
42
44
|
const {
|
|
43
45
|
LayoutStyle,
|
|
@@ -350,6 +352,10 @@ function VisualEditor( {
|
|
|
350
352
|
return canvasMinHeight + scrollTop;
|
|
351
353
|
}, [ canvasMinHeight ] );
|
|
352
354
|
|
|
355
|
+
const [ paddingAppenderRef, paddingStyle ] = usePaddingAppender(
|
|
356
|
+
! isPreview && renderingMode === 'post-only' && ! isDesignPostType
|
|
357
|
+
);
|
|
358
|
+
|
|
353
359
|
const iframeStyles = useMemo( () => {
|
|
354
360
|
return [
|
|
355
361
|
...( styles ?? [] ),
|
|
@@ -366,6 +372,7 @@ function VisualEditor( {
|
|
|
366
372
|
// which isn't a requirement in auto resize mode.
|
|
367
373
|
enableResizing ? 'min-height:0!important;' : ''
|
|
368
374
|
}}
|
|
375
|
+
${ paddingStyle ? paddingStyle : '' }
|
|
369
376
|
${
|
|
370
377
|
enableResizing
|
|
371
378
|
? `.block-editor-iframe__html{background:var(--wp-editor-canvas-background);display:flex;align-items:center;justify-content:center;min-height:100vh;}.block-editor-iframe__body{width:100%;}`
|
|
@@ -375,7 +382,7 @@ function VisualEditor( {
|
|
|
375
382
|
// color to the iframe HTML element to match the background color of the editor canvas.
|
|
376
383
|
},
|
|
377
384
|
];
|
|
378
|
-
}, [ styles, enableResizing, calculatedMinHeight ] );
|
|
385
|
+
}, [ styles, enableResizing, calculatedMinHeight, paddingStyle ] );
|
|
379
386
|
|
|
380
387
|
const typewriterRef = useTypewriter();
|
|
381
388
|
contentRef = useMergeRefs( [
|
|
@@ -389,6 +396,8 @@ function VisualEditor( {
|
|
|
389
396
|
isEnabled: renderingMode === 'template-locked',
|
|
390
397
|
} ),
|
|
391
398
|
useZoomOutModeExit(),
|
|
399
|
+
paddingAppenderRef,
|
|
400
|
+
useEditContentOnlySectionExit(),
|
|
392
401
|
] );
|
|
393
402
|
|
|
394
403
|
return (
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
|
+
import { useRefEffect } from '@wordpress/compose';
|
|
6
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import { unlock } from '../../lock-unlock';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Allows content only section editing to be exited by clicking outside of the
|
|
15
|
+
* edited blocks.
|
|
16
|
+
*/
|
|
17
|
+
export function useEditContentOnlySectionExit() {
|
|
18
|
+
const { getEditedContentOnlySection } = unlock(
|
|
19
|
+
useSelect( blockEditorStore )
|
|
20
|
+
);
|
|
21
|
+
const { stopEditingContentOnlySection } = unlock(
|
|
22
|
+
useDispatch( blockEditorStore )
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return useRefEffect(
|
|
26
|
+
( node ) => {
|
|
27
|
+
function onClick( event ) {
|
|
28
|
+
const editedContentOnlySection = getEditedContentOnlySection();
|
|
29
|
+
if ( ! editedContentOnlySection ) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if ( ! event.defaultPrevented ) {
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
|
|
36
|
+
// If the user clicks outside the edited block, stop editing.
|
|
37
|
+
if (
|
|
38
|
+
! event.target.closest(
|
|
39
|
+
`[data-block="${ editedContentOnlySection }"]`
|
|
40
|
+
)
|
|
41
|
+
) {
|
|
42
|
+
stopEditingContentOnlySection();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
node.addEventListener( 'click', onClick );
|
|
48
|
+
|
|
49
|
+
return () => {
|
|
50
|
+
node.removeEventListener( 'click', onClick );
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
[ getEditedContentOnlySection, stopEditingContentOnlySection ]
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useRegistry } from '@wordpress/data';
|
|
5
|
+
import { useRefEffect } from '@wordpress/compose';
|
|
6
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
7
|
+
import { isUnmodifiedDefaultBlock } from '@wordpress/blocks';
|
|
8
|
+
|
|
9
|
+
// Ruleset to add space for the typewriter effect. When typing in the last
|
|
10
|
+
// block, there needs to be room to scroll up.
|
|
11
|
+
const CSS =
|
|
12
|
+
':root :where(.editor-styles-wrapper)::after {content: ""; display: block; height: 40vh;}';
|
|
13
|
+
|
|
14
|
+
export function usePaddingAppender( enabled ) {
|
|
15
|
+
const registry = useRegistry();
|
|
16
|
+
const effect = useRefEffect(
|
|
17
|
+
( node ) => {
|
|
18
|
+
function onMouseDown( event ) {
|
|
19
|
+
if (
|
|
20
|
+
event.target !== node &&
|
|
21
|
+
// Tests for the parent element because in the iframed editor if the click is
|
|
22
|
+
// below the padding the target will be the parent element (html) and should
|
|
23
|
+
// still be treated as intent to append.
|
|
24
|
+
event.target !== node.parentElement
|
|
25
|
+
) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Only handle clicks under the last child.
|
|
30
|
+
const lastChild = node.lastElementChild;
|
|
31
|
+
if ( ! lastChild ) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const lastChildRect = lastChild.getBoundingClientRect();
|
|
36
|
+
if ( event.clientY < lastChildRect.bottom ) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
|
|
42
|
+
const blockOrder = registry
|
|
43
|
+
.select( blockEditorStore )
|
|
44
|
+
.getBlockOrder( '' );
|
|
45
|
+
const lastBlockClientId = blockOrder[ blockOrder.length - 1 ];
|
|
46
|
+
|
|
47
|
+
const lastBlock = registry
|
|
48
|
+
.select( blockEditorStore )
|
|
49
|
+
.getBlock( lastBlockClientId );
|
|
50
|
+
const { selectBlock, insertDefaultBlock } =
|
|
51
|
+
registry.dispatch( blockEditorStore );
|
|
52
|
+
|
|
53
|
+
if ( lastBlock && isUnmodifiedDefaultBlock( lastBlock ) ) {
|
|
54
|
+
selectBlock( lastBlockClientId );
|
|
55
|
+
} else {
|
|
56
|
+
insertDefaultBlock();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const { ownerDocument } = node;
|
|
60
|
+
// Adds the listener on the document so that in the iframed editor clicks below the
|
|
61
|
+
// padding can be handled as they too should be treated as intent to append.
|
|
62
|
+
ownerDocument.addEventListener( 'pointerdown', onMouseDown );
|
|
63
|
+
return () => {
|
|
64
|
+
ownerDocument.removeEventListener( 'pointerdown', onMouseDown );
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
[ registry ]
|
|
68
|
+
);
|
|
69
|
+
return enabled ? [ effect, CSS ] : [];
|
|
70
|
+
}
|
|
@@ -6,8 +6,6 @@ import {
|
|
|
6
6
|
// @ts-ignore
|
|
7
7
|
BlockPreview,
|
|
8
8
|
// @ts-ignore
|
|
9
|
-
privateApis as blockEditorPrivateApis,
|
|
10
|
-
// @ts-ignore
|
|
11
9
|
} from '@wordpress/block-editor';
|
|
12
10
|
import type { BasePost } from '@wordpress/fields';
|
|
13
11
|
import { useSelect } from '@wordpress/data';
|
|
@@ -17,12 +15,11 @@ import { useEntityBlockEditor, store as coreStore } from '@wordpress/core-data';
|
|
|
17
15
|
* Internal dependencies
|
|
18
16
|
*/
|
|
19
17
|
import { EditorProvider } from '../../../components/provider';
|
|
18
|
+
import { useStyle } from '../../../components/global-styles';
|
|
20
19
|
import { unlock } from '../../../lock-unlock';
|
|
21
20
|
// @ts-ignore
|
|
22
21
|
import { store as editorStore } from '../../../store';
|
|
23
22
|
|
|
24
|
-
const { useGlobalStyle } = unlock( blockEditorPrivateApis );
|
|
25
|
-
|
|
26
23
|
function PostPreviewContainer( {
|
|
27
24
|
template,
|
|
28
25
|
post,
|
|
@@ -30,7 +27,7 @@ function PostPreviewContainer( {
|
|
|
30
27
|
template: any;
|
|
31
28
|
post: any;
|
|
32
29
|
} ) {
|
|
33
|
-
const [ backgroundColor = 'white' ] =
|
|
30
|
+
const [ backgroundColor = 'white' ] = useStyle( 'color.background' );
|
|
34
31
|
const [ postBlocks ] = useEntityBlockEditor( 'postType', post.type, {
|
|
35
32
|
id: post.id,
|
|
36
33
|
} );
|
|
@@ -19,7 +19,6 @@ import { unlock } from '../lock-unlock';
|
|
|
19
19
|
const {
|
|
20
20
|
PatternOverridesControls,
|
|
21
21
|
ResetOverridesControl,
|
|
22
|
-
PatternOverridesBlockControls,
|
|
23
22
|
PATTERN_TYPES,
|
|
24
23
|
PARTIAL_SYNCING_SUPPORTED_BLOCKS,
|
|
25
24
|
PATTERN_SYNC_TYPES,
|
|
@@ -45,7 +44,6 @@ const withPatternOverrideControls = createHigherOrderComponent(
|
|
|
45
44
|
{ props.isSelected && isSupportedBlock && (
|
|
46
45
|
<ControlsWithStoreSubscription { ...props } />
|
|
47
46
|
) }
|
|
48
|
-
{ isSupportedBlock && <PatternOverridesBlockControls /> }
|
|
49
47
|
</>
|
|
50
48
|
);
|
|
51
49
|
},
|
package/src/store/actions.js
CHANGED
|
@@ -62,7 +62,7 @@ export const setupEditor =
|
|
|
62
62
|
}
|
|
63
63
|
if (
|
|
64
64
|
edits &&
|
|
65
|
-
Object.
|
|
65
|
+
Object.entries( edits ).some(
|
|
66
66
|
( [ key, edit ] ) =>
|
|
67
67
|
edit !== ( post[ key ]?.raw ?? post[ key ] )
|
|
68
68
|
)
|
|
@@ -476,6 +476,14 @@ export const autosave =
|
|
|
476
476
|
}
|
|
477
477
|
};
|
|
478
478
|
|
|
479
|
+
/**
|
|
480
|
+
* Save for preview.
|
|
481
|
+
*
|
|
482
|
+
* @param {Object} options Options object.
|
|
483
|
+
* @param {boolean} options.forceIsAutosaveable Whether to force the post to be autosaveable.
|
|
484
|
+
*
|
|
485
|
+
* @return {Function} Thunk that saves for preview and returns the preview link.
|
|
486
|
+
*/
|
|
479
487
|
export const __unstableSaveForPreview =
|
|
480
488
|
( { forceIsAutosaveable } = {} ) =>
|
|
481
489
|
async ( { select, dispatch } ) => {
|