@wordpress/editor 14.48.0 → 14.48.2-next.v.202606191442.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 +25 -1
- package/build/bindings/pattern-overrides.cjs +1 -1
- package/build/bindings/pattern-overrides.cjs.map +2 -2
- package/build/components/block-removal-warnings/index.cjs +0 -3
- package/build/components/block-removal-warnings/index.cjs.map +2 -2
- package/build/components/collab-sidebar/note-byline.cjs +1 -1
- package/build/components/collab-sidebar/note-byline.cjs.map +2 -2
- package/build/components/collab-sidebar/note-indicator-toolbar.cjs +49 -43
- package/build/components/collab-sidebar/note-indicator-toolbar.cjs.map +3 -3
- package/build/components/collab-sidebar/note.cjs +49 -17
- package/build/components/collab-sidebar/note.cjs.map +3 -3
- package/build/components/collab-sidebar/notes.cjs.map +1 -1
- package/build/components/collab-sidebar/utils.cjs +1 -1
- package/build/components/collab-sidebar/utils.cjs.map +2 -2
- package/build/components/collaborators-overlay/avatar-iframe-styles.cjs.map +1 -1
- package/build/components/collaborators-overlay/collaborator-styles.cjs.map +1 -1
- package/build/components/collaborators-overlay/compute-selection.cjs.map +1 -1
- package/build/components/collaborators-overlay/overlay-iframe-styles.cjs +1 -1
- package/build/components/collaborators-overlay/overlay-iframe-styles.cjs.map +1 -1
- package/build/components/collaborators-overlay/use-block-highlighting.cjs +1 -8
- package/build/components/collaborators-overlay/use-block-highlighting.cjs.map +3 -3
- package/build/components/collaborators-overlay/use-render-cursors.cjs +1 -7
- package/build/components/collaborators-overlay/use-render-cursors.cjs.map +3 -3
- package/build/components/collaborators-presence/avatar/component.cjs.map +2 -2
- package/build/components/collaborators-presence/avatar/use-image-loading-status.cjs.map +1 -1
- package/build/components/document-bar/index.cjs +7 -5
- package/build/components/document-bar/index.cjs.map +2 -2
- package/build/components/global-keyboard-shortcuts/index.cjs +3 -2
- package/build/components/global-keyboard-shortcuts/index.cjs.map +2 -2
- package/build/components/global-styles-sidebar/welcome-guide.cjs +3 -3
- package/build/components/global-styles-sidebar/welcome-guide.cjs.map +1 -1
- package/build/components/local-autosave-monitor/index.cjs +14 -15
- package/build/components/local-autosave-monitor/index.cjs.map +2 -2
- package/build/components/more-menu/view-more-menu-group.cjs +1 -2
- package/build/components/more-menu/view-more-menu-group.cjs.map +2 -2
- package/build/components/page-attributes/parent.cjs +2 -1
- package/build/components/page-attributes/parent.cjs.map +2 -2
- package/build/components/post-card-panel/index.cjs +1 -1
- package/build/components/post-card-panel/index.cjs.map +2 -2
- package/build/components/post-excerpt/panel.cjs +1 -1
- package/build/components/post-excerpt/panel.cjs.map +2 -2
- package/build/components/post-locked-modal/index.cjs +3 -3
- package/build/components/post-locked-modal/index.cjs.map +1 -1
- package/build/components/post-preview-button/index.cjs +2 -2
- package/build/components/post-preview-button/index.cjs.map +2 -2
- package/build/components/post-publish-button/index.cjs +115 -157
- package/build/components/post-publish-button/index.cjs.map +3 -3
- package/build/components/post-publish-button/label.cjs +2 -2
- package/build/components/post-publish-button/label.cjs.map +2 -2
- package/build/components/post-publish-panel/index.cjs.map +1 -1
- package/build/components/post-publish-panel/postpublish.cjs +1 -1
- package/build/components/post-publish-panel/postpublish.cjs.map +2 -2
- package/build/components/post-revisions-preview/block-diff.cjs +21 -9
- package/build/components/post-revisions-preview/block-diff.cjs.map +2 -2
- package/build/components/post-revisions-preview/diff-markers.cjs.map +2 -2
- package/build/components/post-revisions-preview/preserve-client-ids.cjs +2 -2
- package/build/components/post-revisions-preview/preserve-client-ids.cjs.map +2 -2
- package/build/components/post-revisions-preview/revisions-slider.cjs +1 -1
- package/build/components/post-revisions-preview/revisions-slider.cjs.map +2 -2
- package/build/components/post-revisions-timeline/index.cjs +173 -0
- package/build/components/post-revisions-timeline/index.cjs.map +7 -0
- package/build/components/post-saved-state/index.cjs +17 -26
- package/build/components/post-saved-state/index.cjs.map +2 -2
- package/build/components/post-schedule/label.cjs +5 -5
- package/build/components/post-schedule/label.cjs.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.cjs +2 -1
- package/build/components/post-taxonomies/flat-term-selector.cjs.map +3 -3
- package/build/components/post-taxonomies/hierarchical-term-selector.cjs +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.cjs.map +2 -2
- package/build/components/post-text-editor/index.cjs +51 -0
- package/build/components/post-text-editor/index.cjs.map +2 -2
- package/build/components/post-text-editor/utils.cjs +150 -0
- package/build/components/post-text-editor/utils.cjs.map +7 -0
- package/build/components/post-url/index.cjs +1 -1
- package/build/components/post-url/index.cjs.map +2 -2
- package/build/components/post-view-link/index.cjs +1 -1
- package/build/components/post-view-link/index.cjs.map +2 -2
- package/build/components/provider/disable-non-page-content-blocks.cjs.map +1 -1
- package/build/components/provider/index.cjs +3 -1
- package/build/components/provider/index.cjs.map +3 -3
- package/build/components/provider/use-network-reconnect.cjs +51 -0
- package/build/components/provider/use-network-reconnect.cjs.map +7 -0
- package/build/components/resizable-editor/resize-handle.cjs.map +2 -2
- package/build/components/revision-diff-panel/index.cjs +7 -2
- package/build/components/revision-diff-panel/index.cjs.map +2 -2
- package/build/components/revision-fields-diff/index.cjs +8 -4
- package/build/components/revision-fields-diff/index.cjs.map +2 -2
- package/build/components/sidebar/dataform-post-summary.cjs +125 -20
- package/build/components/sidebar/dataform-post-summary.cjs.map +3 -3
- package/build/components/sidebar/index.cjs +2 -15
- package/build/components/sidebar/index.cjs.map +3 -3
- package/build/components/sidebar/post-revision-summary.cjs +11 -17
- package/build/components/sidebar/post-revision-summary.cjs.map +3 -3
- package/build/components/sidebar/post-summary.cjs +1 -1
- package/build/components/sidebar/post-summary.cjs.map +2 -2
- package/build/components/style-book/examples.cjs +1 -1
- package/build/components/style-book/examples.cjs.map +1 -1
- package/build/components/style-book/index.cjs +1 -1
- package/build/components/style-book/index.cjs.map +2 -2
- package/build/components/sync-connection-error-modal/index.cjs +3 -3
- package/build/components/sync-connection-error-modal/index.cjs.map +1 -1
- package/build/components/template-actions-panel/block-theme-content.cjs +7 -1
- package/build/components/template-actions-panel/block-theme-content.cjs.map +2 -2
- package/build/components/template-actions-panel/index.cjs +0 -9
- package/build/components/template-actions-panel/index.cjs.map +3 -3
- package/build/components/template-validation-notice/index.cjs +1 -1
- package/build/components/template-validation-notice/index.cjs.map +1 -1
- package/build/components/upload-progress-snackbar/index.cjs +161 -0
- package/build/components/upload-progress-snackbar/index.cjs.map +7 -0
- package/build/components/upload-progress-snackbar/tracker.cjs +90 -0
- package/build/components/upload-progress-snackbar/tracker.cjs.map +7 -0
- package/build/components/visual-editor/edit-template-blocks-notification.cjs +1 -1
- package/build/components/visual-editor/edit-template-blocks-notification.cjs.map +1 -1
- package/build/{components/revision-author-panel → dataviews/fields/revisions}/index.cjs +18 -26
- package/build/dataviews/fields/revisions/index.cjs.map +7 -0
- package/build/dataviews/fields/revisions/revisions-view.cjs +74 -0
- package/build/dataviews/fields/revisions/revisions-view.cjs.map +7 -0
- package/build/dataviews/store/private-actions.cjs +14 -4
- package/build/dataviews/store/private-actions.cjs.map +3 -3
- package/build/hooks/push-changes-to-global-styles/index.cjs +1 -1
- package/build/hooks/push-changes-to-global-styles/index.cjs.map +1 -1
- package/build/private-apis.cjs +2 -0
- package/build/private-apis.cjs.map +3 -3
- package/build/store/actions.cjs +1 -1
- package/build/store/actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +6 -1
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/selectors.cjs +1 -2
- package/build/store/selectors.cjs.map +2 -2
- package/build/utils/media-upload/index.cjs +16 -0
- package/build/utils/media-upload/index.cjs.map +3 -3
- package/build/utils/set-nested-value.cjs.map +1 -1
- package/build-module/bindings/pattern-overrides.mjs +1 -1
- package/build-module/bindings/pattern-overrides.mjs.map +2 -2
- package/build-module/components/block-removal-warnings/index.mjs +0 -3
- package/build-module/components/block-removal-warnings/index.mjs.map +2 -2
- package/build-module/components/collab-sidebar/note-byline.mjs +1 -1
- package/build-module/components/collab-sidebar/note-byline.mjs.map +2 -2
- package/build-module/components/collab-sidebar/note-indicator-toolbar.mjs +53 -44
- package/build-module/components/collab-sidebar/note-indicator-toolbar.mjs.map +2 -2
- package/build-module/components/collab-sidebar/note.mjs +50 -18
- package/build-module/components/collab-sidebar/note.mjs.map +2 -2
- package/build-module/components/collab-sidebar/notes.mjs.map +1 -1
- package/build-module/components/collab-sidebar/utils.mjs +1 -1
- package/build-module/components/collab-sidebar/utils.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/avatar-iframe-styles.mjs.map +1 -1
- package/build-module/components/collaborators-overlay/collaborator-styles.mjs.map +1 -1
- package/build-module/components/collaborators-overlay/compute-selection.mjs.map +1 -1
- package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs +1 -1
- package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs.map +1 -1
- package/build-module/components/collaborators-overlay/use-block-highlighting.mjs +1 -8
- package/build-module/components/collaborators-overlay/use-block-highlighting.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/use-render-cursors.mjs +1 -7
- package/build-module/components/collaborators-overlay/use-render-cursors.mjs.map +2 -2
- package/build-module/components/collaborators-presence/avatar/component.mjs.map +2 -2
- package/build-module/components/collaborators-presence/avatar/use-image-loading-status.mjs.map +1 -1
- package/build-module/components/document-bar/index.mjs +7 -5
- package/build-module/components/document-bar/index.mjs.map +2 -2
- package/build-module/components/global-keyboard-shortcuts/index.mjs +3 -2
- package/build-module/components/global-keyboard-shortcuts/index.mjs.map +2 -2
- package/build-module/components/global-styles-sidebar/welcome-guide.mjs +3 -3
- package/build-module/components/global-styles-sidebar/welcome-guide.mjs.map +1 -1
- package/build-module/components/local-autosave-monitor/index.mjs +15 -16
- package/build-module/components/local-autosave-monitor/index.mjs.map +2 -2
- package/build-module/components/more-menu/view-more-menu-group.mjs +1 -2
- package/build-module/components/more-menu/view-more-menu-group.mjs.map +2 -2
- package/build-module/components/page-attributes/parent.mjs +2 -1
- package/build-module/components/page-attributes/parent.mjs.map +2 -2
- package/build-module/components/post-card-panel/index.mjs +1 -1
- package/build-module/components/post-card-panel/index.mjs.map +2 -2
- package/build-module/components/post-excerpt/panel.mjs +1 -1
- package/build-module/components/post-excerpt/panel.mjs.map +2 -2
- package/build-module/components/post-locked-modal/index.mjs +3 -3
- package/build-module/components/post-locked-modal/index.mjs.map +1 -1
- package/build-module/components/post-preview-button/index.mjs +2 -2
- package/build-module/components/post-preview-button/index.mjs.map +2 -2
- package/build-module/components/post-publish-button/index.mjs +117 -159
- package/build-module/components/post-publish-button/index.mjs.map +2 -2
- package/build-module/components/post-publish-button/label.mjs +2 -2
- package/build-module/components/post-publish-button/label.mjs.map +2 -2
- package/build-module/components/post-publish-panel/index.mjs.map +1 -1
- package/build-module/components/post-publish-panel/postpublish.mjs +1 -1
- package/build-module/components/post-publish-panel/postpublish.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/block-diff.mjs +20 -8
- package/build-module/components/post-revisions-preview/block-diff.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/diff-markers.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/preserve-client-ids.mjs +1 -1
- package/build-module/components/post-revisions-preview/preserve-client-ids.mjs.map +1 -1
- package/build-module/components/post-revisions-preview/revisions-slider.mjs +1 -1
- package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
- package/build-module/components/post-revisions-timeline/index.mjs +152 -0
- package/build-module/components/post-revisions-timeline/index.mjs.map +7 -0
- package/build-module/components/post-saved-state/index.mjs +17 -26
- package/build-module/components/post-saved-state/index.mjs.map +2 -2
- package/build-module/components/post-schedule/label.mjs +5 -5
- package/build-module/components/post-schedule/label.mjs.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.mjs +3 -6
- package/build-module/components/post-taxonomies/flat-term-selector.mjs.map +2 -2
- package/build-module/components/post-taxonomies/hierarchical-term-selector.mjs +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.mjs.map +2 -2
- package/build-module/components/post-text-editor/index.mjs +51 -0
- package/build-module/components/post-text-editor/index.mjs.map +2 -2
- package/build-module/components/post-text-editor/utils.mjs +123 -0
- package/build-module/components/post-text-editor/utils.mjs.map +7 -0
- package/build-module/components/post-url/index.mjs +1 -1
- package/build-module/components/post-url/index.mjs.map +2 -2
- package/build-module/components/post-view-link/index.mjs +1 -1
- package/build-module/components/post-view-link/index.mjs.map +2 -2
- package/build-module/components/provider/disable-non-page-content-blocks.mjs.map +1 -1
- package/build-module/components/provider/index.mjs +3 -1
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/use-network-reconnect.mjs +30 -0
- package/build-module/components/provider/use-network-reconnect.mjs.map +7 -0
- package/build-module/components/resizable-editor/resize-handle.mjs.map +2 -2
- package/build-module/components/revision-diff-panel/index.mjs +7 -2
- package/build-module/components/revision-diff-panel/index.mjs.map +2 -2
- package/build-module/components/revision-fields-diff/index.mjs +8 -4
- package/build-module/components/revision-fields-diff/index.mjs.map +2 -2
- package/build-module/components/sidebar/dataform-post-summary.mjs +125 -20
- package/build-module/components/sidebar/dataform-post-summary.mjs.map +2 -2
- package/build-module/components/sidebar/index.mjs +3 -22
- package/build-module/components/sidebar/index.mjs.map +2 -2
- package/build-module/components/sidebar/post-revision-summary.mjs +11 -17
- package/build-module/components/sidebar/post-revision-summary.mjs.map +2 -2
- package/build-module/components/sidebar/post-summary.mjs +1 -1
- package/build-module/components/sidebar/post-summary.mjs.map +2 -2
- package/build-module/components/style-book/examples.mjs +1 -1
- package/build-module/components/style-book/examples.mjs.map +1 -1
- package/build-module/components/style-book/index.mjs +1 -1
- package/build-module/components/style-book/index.mjs.map +2 -2
- package/build-module/components/sync-connection-error-modal/index.mjs +3 -3
- package/build-module/components/sync-connection-error-modal/index.mjs.map +1 -1
- package/build-module/components/template-actions-panel/block-theme-content.mjs +7 -1
- package/build-module/components/template-actions-panel/block-theme-content.mjs.map +2 -2
- package/build-module/components/template-actions-panel/index.mjs +0 -9
- package/build-module/components/template-actions-panel/index.mjs.map +2 -2
- package/build-module/components/template-validation-notice/index.mjs +1 -1
- package/build-module/components/template-validation-notice/index.mjs.map +1 -1
- package/build-module/components/upload-progress-snackbar/index.mjs +135 -0
- package/build-module/components/upload-progress-snackbar/index.mjs.map +7 -0
- package/build-module/components/upload-progress-snackbar/tracker.mjs +61 -0
- package/build-module/components/upload-progress-snackbar/tracker.mjs.map +7 -0
- package/build-module/components/visual-editor/edit-template-blocks-notification.mjs +1 -1
- package/build-module/components/visual-editor/edit-template-blocks-notification.mjs.map +1 -1
- package/build-module/dataviews/fields/revisions/index.mjs +20 -0
- package/build-module/dataviews/fields/revisions/index.mjs.map +7 -0
- package/build-module/dataviews/fields/revisions/revisions-view.mjs +53 -0
- package/build-module/dataviews/fields/revisions/revisions-view.mjs.map +7 -0
- package/build-module/dataviews/store/private-actions.mjs +23 -7
- package/build-module/dataviews/store/private-actions.mjs.map +2 -2
- package/build-module/hooks/push-changes-to-global-styles/index.mjs +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.mjs.map +1 -1
- package/build-module/private-apis.mjs +2 -0
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/actions.mjs +1 -1
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +7 -1
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/selectors.mjs +1 -2
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/media-upload/index.mjs +19 -0
- package/build-module/utils/media-upload/index.mjs.map +2 -2
- package/build-module/utils/set-nested-value.mjs.map +1 -1
- package/build-style/style-rtl.css +707 -270
- package/build-style/style.css +707 -270
- package/build-types/components/block-removal-warnings/index.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/note-byline.d.ts +0 -3
- package/build-types/components/collab-sidebar/note-byline.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/note-indicator-toolbar.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/note.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/use-block-highlighting.d.ts +0 -3
- package/build-types/components/collaborators-overlay/use-block-highlighting.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/use-render-cursors.d.ts.map +1 -1
- package/build-types/components/collaborators-presence/avatar/component.d.ts.map +1 -1
- package/build-types/components/document-bar/index.d.ts.map +1 -1
- package/build-types/components/global-keyboard-shortcuts/index.d.ts.map +1 -1
- package/build-types/components/local-autosave-monitor/index.d.ts.map +1 -1
- package/build-types/components/more-menu/view-more-menu-group.d.ts.map +1 -1
- package/build-types/components/page-attributes/parent.d.ts.map +1 -1
- package/build-types/components/post-publish-button/index.d.ts +9 -9
- package/build-types/components/post-publish-button/index.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/block-diff.d.ts +3 -0
- package/build-types/components/post-revisions-preview/block-diff.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/diff-markers.d.ts.map +1 -1
- package/build-types/components/post-revisions-timeline/index.d.ts +2 -0
- package/build-types/components/post-revisions-timeline/index.d.ts.map +1 -0
- package/build-types/components/post-saved-state/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-text-editor/index.d.ts.map +1 -1
- package/build-types/components/post-text-editor/utils.d.ts +29 -0
- package/build-types/components/post-text-editor/utils.d.ts.map +1 -0
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/provider/use-network-reconnect.d.ts +8 -0
- package/build-types/components/provider/use-network-reconnect.d.ts.map +1 -0
- package/build-types/components/resizable-editor/resize-handle.d.ts.map +1 -1
- package/build-types/components/revision-diff-panel/index.d.ts +3 -1
- package/build-types/components/revision-diff-panel/index.d.ts.map +1 -1
- package/build-types/components/revision-fields-diff/index.d.ts +3 -0
- package/build-types/components/revision-fields-diff/index.d.ts.map +1 -1
- package/build-types/components/sidebar/dataform-post-summary.d.ts.map +1 -1
- package/build-types/components/sidebar/index.d.ts.map +1 -1
- package/build-types/components/sidebar/post-revision-summary.d.ts.map +1 -1
- package/build-types/components/template-actions-panel/block-theme-content.d.ts.map +1 -1
- package/build-types/components/template-actions-panel/index.d.ts.map +1 -1
- package/build-types/components/upload-progress-snackbar/index.d.ts +19 -0
- package/build-types/components/upload-progress-snackbar/index.d.ts.map +1 -0
- package/build-types/components/upload-progress-snackbar/stories/index.story.d.ts +28 -0
- package/build-types/components/upload-progress-snackbar/stories/index.story.d.ts.map +1 -0
- package/build-types/components/upload-progress-snackbar/tracker.d.ts +41 -0
- package/build-types/components/upload-progress-snackbar/tracker.d.ts.map +1 -0
- package/build-types/dataviews/fields/revisions/index.d.ts +8 -0
- package/build-types/dataviews/fields/revisions/index.d.ts.map +1 -0
- package/build-types/dataviews/fields/revisions/revisions-view.d.ts +2 -0
- package/build-types/dataviews/fields/revisions/revisions-view.d.ts.map +1 -0
- package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +1 -1
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +1 -1
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/utils/get-template-part-icon.d.ts.map +1 -1
- package/build-types/utils/media-upload/index.d.ts.map +1 -1
- package/package.json +59 -50
- package/src/bindings/pattern-overrides.js +1 -1
- package/src/bindings/test/pattern-overrides.js +65 -0
- package/src/components/README.md +1 -1
- package/src/components/block-removal-warnings/index.js +0 -7
- package/src/components/collab-sidebar/note-byline.js +0 -1
- package/src/components/collab-sidebar/note-indicator-toolbar.js +73 -60
- package/src/components/collab-sidebar/note.js +64 -29
- package/src/components/collab-sidebar/style.scss +20 -0
- package/src/components/collaborators-overlay/use-block-highlighting.ts +0 -9
- package/src/components/collaborators-overlay/use-render-cursors.ts +0 -8
- package/src/components/collaborators-presence/avatar/component.tsx +0 -1
- package/src/components/collaborators-presence/avatar/test/index.tsx +8 -4
- package/src/components/document-bar/index.js +8 -3
- package/src/components/document-bar/style.scss +4 -2
- package/src/components/global-keyboard-shortcuts/index.js +2 -1
- package/src/components/local-autosave-monitor/index.js +23 -21
- package/src/components/more-menu/view-more-menu-group.js +1 -2
- package/src/components/page-attributes/parent.js +1 -0
- package/src/components/post-card-panel/index.js +1 -1
- package/src/components/post-publish-button/index.js +146 -192
- package/src/components/post-publish-button/test/index.js +149 -113
- package/src/components/post-revisions-preview/block-diff.js +63 -19
- package/src/components/post-revisions-preview/diff-markers.js +0 -1
- package/src/components/post-revisions-preview/preserve-client-ids.js +1 -1
- package/src/components/post-revisions-preview/test/block-diff.js +109 -6
- package/src/components/post-revisions-timeline/index.js +186 -0
- package/src/components/post-revisions-timeline/style.scss +43 -0
- package/src/components/post-saved-state/index.js +23 -26
- package/src/components/post-saved-state/test/index.js +18 -0
- package/src/components/post-taxonomies/flat-term-selector.js +4 -7
- package/src/components/post-text-editor/index.js +65 -0
- package/src/components/post-text-editor/test/utils.js +210 -0
- package/src/components/post-text-editor/utils.js +204 -0
- package/src/components/post-type-support-check/test/index.js +11 -0
- package/src/components/post-url/index.js +1 -1
- package/src/components/post-view-link/index.js +1 -1
- package/src/components/post-view-link/test/index.js +71 -0
- package/src/components/provider/index.js +6 -1
- package/src/components/provider/test/use-network-reconnect.js +137 -0
- package/src/components/provider/use-network-reconnect.js +44 -0
- package/src/components/resizable-editor/resize-handle.js +0 -1
- package/src/components/revision-diff-panel/index.js +8 -2
- package/src/components/revision-fields-diff/index.js +19 -3
- package/src/components/sidebar/dataform-post-summary.js +196 -25
- package/src/components/sidebar/index.js +4 -23
- package/src/components/sidebar/post-revision-summary.js +8 -15
- package/src/components/sidebar/post-summary.js +1 -1
- package/src/components/style-book/index.js +1 -1
- package/src/components/template-actions-panel/block-theme-content.js +10 -2
- package/src/components/template-actions-panel/index.js +0 -15
- package/src/components/upload-progress-snackbar/README.md +26 -0
- package/src/components/upload-progress-snackbar/index.js +216 -0
- package/src/components/upload-progress-snackbar/stories/index.story.tsx +85 -0
- package/src/components/upload-progress-snackbar/style.scss +30 -0
- package/src/components/upload-progress-snackbar/test/index.js +199 -0
- package/src/components/upload-progress-snackbar/tracker.js +105 -0
- package/src/dataviews/fields/revisions/index.tsx +28 -0
- package/src/dataviews/fields/revisions/revisions-view.tsx +59 -0
- package/src/dataviews/store/private-actions.ts +27 -6
- package/src/private-apis.js +2 -0
- package/src/store/private-selectors.js +11 -1
- package/src/store/selectors.js +1 -3
- package/src/store/test/private-selectors.js +69 -0
- package/src/style.scss +2 -1
- package/src/utils/media-upload/index.js +27 -0
- package/build/components/post-revisions-panel/index.cjs +0 -173
- package/build/components/post-revisions-panel/index.cjs.map +0 -7
- package/build/components/revision-author-panel/index.cjs.map +0 -7
- package/build/components/revision-created-panel/index.cjs +0 -47
- package/build/components/revision-created-panel/index.cjs.map +0 -7
- package/build-module/components/post-revisions-panel/index.mjs +0 -148
- package/build-module/components/post-revisions-panel/index.mjs.map +0 -7
- package/build-module/components/revision-author-panel/index.mjs +0 -28
- package/build-module/components/revision-author-panel/index.mjs.map +0 -7
- package/build-module/components/revision-created-panel/index.mjs +0 -26
- package/build-module/components/revision-created-panel/index.mjs.map +0 -7
- package/build-types/components/post-revisions-panel/index.d.ts +0 -2
- package/build-types/components/post-revisions-panel/index.d.ts.map +0 -1
- package/build-types/components/revision-author-panel/index.d.ts +0 -2
- package/build-types/components/revision-author-panel/index.d.ts.map +0 -1
- package/build-types/components/revision-created-panel/index.d.ts +0 -2
- package/build-types/components/revision-created-panel/index.d.ts.map +0 -1
- package/src/components/commands/index.native.js +0 -2
- package/src/components/deprecated.native.js +0 -47
- package/src/components/editor-help/add-blocks.native.js +0 -40
- package/src/components/editor-help/customize-blocks.native.js +0 -40
- package/src/components/editor-help/help-detail-navigation-screen.native.js +0 -67
- package/src/components/editor-help/help-get-support-button.native.js +0 -38
- package/src/components/editor-help/help-section-title.native.js +0 -29
- package/src/components/editor-help/help-topic-row.native.js +0 -33
- package/src/components/editor-help/icon-move-blocks.native.js +0 -10
- package/src/components/editor-help/images/add-dark.png +0 -0
- package/src/components/editor-help/images/add-dark@2x.png +0 -0
- package/src/components/editor-help/images/add-dark@3x.png +0 -0
- package/src/components/editor-help/images/add-light.png +0 -0
- package/src/components/editor-help/images/add-light@2x.png +0 -0
- package/src/components/editor-help/images/add-light@3x.png +0 -0
- package/src/components/editor-help/images/block-layout-collage.png +0 -0
- package/src/components/editor-help/images/block-layout-collage@2x.png +0 -0
- package/src/components/editor-help/images/block-layout-collage@3x.png +0 -0
- package/src/components/editor-help/images/build-layouts-dark.png +0 -0
- package/src/components/editor-help/images/build-layouts-dark@2x.png +0 -0
- package/src/components/editor-help/images/build-layouts-dark@3x.png +0 -0
- package/src/components/editor-help/images/build-layouts-light.png +0 -0
- package/src/components/editor-help/images/build-layouts-light@2x.png +0 -0
- package/src/components/editor-help/images/build-layouts-light@3x.png +0 -0
- package/src/components/editor-help/images/drag-and-drop-dark.png +0 -0
- package/src/components/editor-help/images/drag-and-drop-dark@2x.png +0 -0
- package/src/components/editor-help/images/drag-and-drop-dark@3x.png +0 -0
- package/src/components/editor-help/images/drag-and-drop-light.png +0 -0
- package/src/components/editor-help/images/drag-and-drop-light@2x.png +0 -0
- package/src/components/editor-help/images/drag-and-drop-light@3x.png +0 -0
- package/src/components/editor-help/images/edit-media-dark.png +0 -0
- package/src/components/editor-help/images/edit-media-dark@2x.png +0 -0
- package/src/components/editor-help/images/edit-media-dark@3x.png +0 -0
- package/src/components/editor-help/images/edit-media-light.png +0 -0
- package/src/components/editor-help/images/edit-media-light@2x.png +0 -0
- package/src/components/editor-help/images/edit-media-light@3x.png +0 -0
- package/src/components/editor-help/images/embed-media-dark.png +0 -0
- package/src/components/editor-help/images/embed-media-dark@2x.png +0 -0
- package/src/components/editor-help/images/embed-media-dark@3x.png +0 -0
- package/src/components/editor-help/images/embed-media-light.png +0 -0
- package/src/components/editor-help/images/embed-media-light@2x.png +0 -0
- package/src/components/editor-help/images/embed-media-light@3x.png +0 -0
- package/src/components/editor-help/images/move-dark.png +0 -0
- package/src/components/editor-help/images/move-dark@2x.png +0 -0
- package/src/components/editor-help/images/move-dark@3x.png +0 -0
- package/src/components/editor-help/images/move-light.png +0 -0
- package/src/components/editor-help/images/move-light@2x.png +0 -0
- package/src/components/editor-help/images/move-light@3x.png +0 -0
- package/src/components/editor-help/images/options-dark.png +0 -0
- package/src/components/editor-help/images/options-dark@2x.png +0 -0
- package/src/components/editor-help/images/options-dark@3x.png +0 -0
- package/src/components/editor-help/images/options-light.png +0 -0
- package/src/components/editor-help/images/options-light@2x.png +0 -0
- package/src/components/editor-help/images/options-light@3x.png +0 -0
- package/src/components/editor-help/images/rich-text-dark.png +0 -0
- package/src/components/editor-help/images/rich-text-dark@2x.png +0 -0
- package/src/components/editor-help/images/rich-text-dark@3x.png +0 -0
- package/src/components/editor-help/images/rich-text-light.png +0 -0
- package/src/components/editor-help/images/rich-text-light@2x.png +0 -0
- package/src/components/editor-help/images/rich-text-light@3x.png +0 -0
- package/src/components/editor-help/images/settings-dark.png +0 -0
- package/src/components/editor-help/images/settings-dark@2x.png +0 -0
- package/src/components/editor-help/images/settings-dark@3x.png +0 -0
- package/src/components/editor-help/images/settings-light.png +0 -0
- package/src/components/editor-help/images/settings-light@2x.png +0 -0
- package/src/components/editor-help/images/settings-light@3x.png +0 -0
- package/src/components/editor-help/index.native.js +0 -208
- package/src/components/editor-help/intro-to-blocks.native.js +0 -91
- package/src/components/editor-help/move-blocks.native.js +0 -55
- package/src/components/editor-help/remove-blocks.native.js +0 -35
- package/src/components/editor-help/style.android.scss +0 -6
- package/src/components/editor-help/style.ios.scss +0 -6
- package/src/components/editor-help/style.scss +0 -123
- package/src/components/editor-help/test/index.native.js +0 -81
- package/src/components/editor-help/view-sections.native.js +0 -79
- package/src/components/error-boundary/index.native.js +0 -192
- package/src/components/error-boundary/style.native.scss +0 -116
- package/src/components/index.native.js +0 -15
- package/src/components/offline-status/index.native.js +0 -99
- package/src/components/offline-status/style.native.scss +0 -28
- package/src/components/offline-status/test/index.native.js +0 -108
- package/src/components/post-revisions-panel/index.js +0 -161
- package/src/components/post-revisions-panel/style.scss +0 -16
- package/src/components/post-title/index.native.js +0 -282
- package/src/components/post-title/style.native.scss +0 -13
- package/src/components/post-title/test/__snapshots__/index.native.js.snap +0 -25
- package/src/components/post-title/test/index.native.js +0 -78
- package/src/components/provider/index.native.js +0 -497
- package/src/components/provider/use-block-editor-settings.native.js +0 -48
- package/src/components/revision-author-panel/index.js +0 -36
- package/src/components/revision-created-panel/index.js +0 -36
- package/src/components/template-part-menu-items/index.native.js +0 -3
- package/src/hooks/index.native.js +0 -0
- package/src/index.native.js +0 -16
- package/src/private-apis.native.js +0 -33
- package/src/store/actions.native.js +0 -27
- package/src/store/reducer.native.js +0 -94
- package/src/store/selectors.native.js +0 -57
- package/src/store/test/actions.native.js +0 -16
- package/src/store/test/reducer.native.js +0 -36
- package/src/store/test/selectors.native.js +0 -28
- package/src/utils/index.native.js +0 -6
- package/src/utils/media-sideload/index.native.js +0 -1
- package/src/utils/media-upload/index.native.js +0 -1
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
PanelBody,
|
|
6
|
-
Button,
|
|
7
|
-
__experimentalHStack as HStack,
|
|
8
|
-
__experimentalVStack as VStack,
|
|
9
|
-
privateApis as componentsPrivateApis,
|
|
10
|
-
} from '@wordpress/components';
|
|
11
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
12
|
-
import { DataViews } from '@wordpress/dataviews';
|
|
13
|
-
import { dateI18n, getDate, humanTimeDiff, getSettings } from '@wordpress/date';
|
|
14
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
15
|
-
import { __ } from '@wordpress/i18n';
|
|
16
|
-
import { authorField } from '@wordpress/fields';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Internal dependencies
|
|
20
|
-
*/
|
|
21
|
-
import PostLastRevisionCheck from '../post-last-revision/check';
|
|
22
|
-
import { store as editorStore } from '../../store';
|
|
23
|
-
import { unlock } from '../../lock-unlock';
|
|
24
|
-
|
|
25
|
-
const { Badge: WCBadge } = unlock( componentsPrivateApis );
|
|
26
|
-
const DAY_IN_MILLISECONDS = 86400000;
|
|
27
|
-
const EMPTY_ARRAY = [];
|
|
28
|
-
const defaultLayouts = { activity: true };
|
|
29
|
-
const noop = () => {};
|
|
30
|
-
const paginationInfo = {};
|
|
31
|
-
const view = {
|
|
32
|
-
type: 'activity',
|
|
33
|
-
titleField: 'date',
|
|
34
|
-
fields: [ 'author' ],
|
|
35
|
-
layout: { density: 'compact' },
|
|
36
|
-
};
|
|
37
|
-
const fields = [
|
|
38
|
-
{
|
|
39
|
-
id: 'date',
|
|
40
|
-
label: __( 'Date' ),
|
|
41
|
-
render: ( { item, field } ) => {
|
|
42
|
-
const dateNowInMs = getDate( null ).getTime();
|
|
43
|
-
const _value = field.getValue( { item } );
|
|
44
|
-
const date = getDate( _value ?? null );
|
|
45
|
-
const displayDate =
|
|
46
|
-
dateNowInMs - date.getTime() > DAY_IN_MILLISECONDS
|
|
47
|
-
? dateI18n(
|
|
48
|
-
getSettings().formats.datetimeAbbreviated,
|
|
49
|
-
date
|
|
50
|
-
)
|
|
51
|
-
: humanTimeDiff( date );
|
|
52
|
-
return (
|
|
53
|
-
<time
|
|
54
|
-
className="editor-post-revisions-panel__revision-date"
|
|
55
|
-
dateTime={ _value }
|
|
56
|
-
>
|
|
57
|
-
{ displayDate }
|
|
58
|
-
</time>
|
|
59
|
-
);
|
|
60
|
-
},
|
|
61
|
-
enableSorting: false,
|
|
62
|
-
enableHiding: false,
|
|
63
|
-
},
|
|
64
|
-
authorField,
|
|
65
|
-
];
|
|
66
|
-
|
|
67
|
-
function PostRevisionsPanelContent() {
|
|
68
|
-
const { setCurrentRevisionId } = unlock( useDispatch( editorStore ) );
|
|
69
|
-
const {
|
|
70
|
-
revisionsCount,
|
|
71
|
-
revisions,
|
|
72
|
-
revisionKey,
|
|
73
|
-
isLoading,
|
|
74
|
-
lastRevisionId,
|
|
75
|
-
} = useSelect( ( select ) => {
|
|
76
|
-
const { getCurrentPostId, getCurrentPostType } = select( editorStore );
|
|
77
|
-
const { getCurrentPostRevisionsCount, getCurrentPostLastRevisionId } =
|
|
78
|
-
select( editorStore );
|
|
79
|
-
const { getRevisions, getEntityConfig, isResolving } =
|
|
80
|
-
select( coreStore );
|
|
81
|
-
const _postType = getCurrentPostType();
|
|
82
|
-
const entityConfig = getEntityConfig( 'postType', _postType );
|
|
83
|
-
const _revisionKey = entityConfig?.revisionKey || 'id';
|
|
84
|
-
const revisionsQuery = {
|
|
85
|
-
per_page: 3,
|
|
86
|
-
orderby: 'date',
|
|
87
|
-
order: 'desc',
|
|
88
|
-
_fields: `${ _revisionKey },date,author`,
|
|
89
|
-
};
|
|
90
|
-
const query = [
|
|
91
|
-
'postType',
|
|
92
|
-
_postType,
|
|
93
|
-
getCurrentPostId(),
|
|
94
|
-
revisionsQuery,
|
|
95
|
-
];
|
|
96
|
-
const _revisions = getRevisions( ...query );
|
|
97
|
-
return {
|
|
98
|
-
revisionsCount: getCurrentPostRevisionsCount(),
|
|
99
|
-
lastRevisionId: getCurrentPostLastRevisionId(),
|
|
100
|
-
revisions: _revisions,
|
|
101
|
-
revisionKey: _revisionKey,
|
|
102
|
-
isLoading: isResolving( 'getRevisions', query ),
|
|
103
|
-
};
|
|
104
|
-
}, [] );
|
|
105
|
-
return (
|
|
106
|
-
<PanelBody
|
|
107
|
-
title={
|
|
108
|
-
<HStack justify="space-between" align="center" as="span">
|
|
109
|
-
<span>{ __( 'Revisions' ) }</span>
|
|
110
|
-
<WCBadge className="editor-post-revisions-panel__revisions-count">
|
|
111
|
-
{ revisionsCount }
|
|
112
|
-
</WCBadge>
|
|
113
|
-
</HStack>
|
|
114
|
-
}
|
|
115
|
-
initialOpen={ false }
|
|
116
|
-
>
|
|
117
|
-
<VStack className="editor-post-revisions-panel">
|
|
118
|
-
<DataViews
|
|
119
|
-
view={ view }
|
|
120
|
-
onChangeView={ noop }
|
|
121
|
-
fields={ fields }
|
|
122
|
-
data={ revisions || EMPTY_ARRAY }
|
|
123
|
-
isLoading={ isLoading }
|
|
124
|
-
paginationInfo={ paginationInfo }
|
|
125
|
-
defaultLayouts={ defaultLayouts }
|
|
126
|
-
getItemId={ ( item ) => item[ revisionKey ] }
|
|
127
|
-
isItemClickable={ () => true }
|
|
128
|
-
onClickItem={ ( item ) => {
|
|
129
|
-
setCurrentRevisionId( item[ revisionKey ] );
|
|
130
|
-
} }
|
|
131
|
-
>
|
|
132
|
-
<DataViews.Layout />
|
|
133
|
-
</DataViews>
|
|
134
|
-
<Button
|
|
135
|
-
className="editor-post-revisions-panel__view-all"
|
|
136
|
-
__next40pxDefaultSize
|
|
137
|
-
variant="secondary"
|
|
138
|
-
onClick={ () => setCurrentRevisionId( lastRevisionId ) }
|
|
139
|
-
>
|
|
140
|
-
{ __( 'View all revisions' ) }
|
|
141
|
-
</Button>
|
|
142
|
-
</VStack>
|
|
143
|
-
</PanelBody>
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
export default function PostRevisionsPanel() {
|
|
148
|
-
const disableVisualRevisions = useSelect(
|
|
149
|
-
( select ) =>
|
|
150
|
-
!! select( editorStore ).getEditorSettings().disableVisualRevisions,
|
|
151
|
-
[]
|
|
152
|
-
);
|
|
153
|
-
if ( disableVisualRevisions ) {
|
|
154
|
-
return null;
|
|
155
|
-
}
|
|
156
|
-
return (
|
|
157
|
-
<PostLastRevisionCheck>
|
|
158
|
-
<PostRevisionsPanelContent />
|
|
159
|
-
</PostLastRevisionCheck>
|
|
160
|
-
);
|
|
161
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
.editor-post-revisions-panel {
|
|
2
|
-
.editor-post-revisions-panel__view-all {
|
|
3
|
-
justify-content: center;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.editor-post-revisions-panel__revision-date {
|
|
7
|
-
text-transform: uppercase;
|
|
8
|
-
font-weight: 600;
|
|
9
|
-
font-size: 12px;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.editor-post-revisions-panel__revisions-count {
|
|
14
|
-
margin-top: -4.5px;
|
|
15
|
-
margin-bottom: -4.5px;
|
|
16
|
-
}
|
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { View } from 'react-native';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { Component } from '@wordpress/element';
|
|
10
|
-
import { create, toHTMLString, insert } from '@wordpress/rich-text';
|
|
11
|
-
import { decodeEntities } from '@wordpress/html-entities';
|
|
12
|
-
import { withDispatch, withSelect } from '@wordpress/data';
|
|
13
|
-
import { withFocusOutside } from '@wordpress/components';
|
|
14
|
-
import { withInstanceId, compose } from '@wordpress/compose';
|
|
15
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
16
|
-
import { pasteHandler } from '@wordpress/blocks';
|
|
17
|
-
import { store as blockEditorStore, RichText } from '@wordpress/block-editor';
|
|
18
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
19
|
-
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
|
|
20
|
-
|
|
21
|
-
/** @typedef {import('./types').RichTextValue} RichTextValue */
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Internal dependencies
|
|
25
|
-
*/
|
|
26
|
-
import styles from './style.scss';
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Inserts content with title
|
|
30
|
-
*
|
|
31
|
-
* This function processes the given content and title, updating the title
|
|
32
|
-
* and content based on certain conditions. If the content is an array of
|
|
33
|
-
* blocks, it will check the first block for a heading or paragraph to use
|
|
34
|
-
* as the title. If the content is a string, it will strip HTML and update
|
|
35
|
-
* the title and content accordingly.
|
|
36
|
-
*
|
|
37
|
-
* @param {string} title The post title.
|
|
38
|
-
* @param {Array | string} content The content to be processed. It can be an array of blocks or a string.
|
|
39
|
-
* @param {Function} onUpdateTitle Callback function to update the title.
|
|
40
|
-
* @param {Function} onUpdateContent Callback function to update the content.
|
|
41
|
-
* @param {RichTextValue} value The initial value object, default is an object with empty text.
|
|
42
|
-
*/
|
|
43
|
-
export function insertContentWithTitle(
|
|
44
|
-
title,
|
|
45
|
-
content,
|
|
46
|
-
onUpdateTitle,
|
|
47
|
-
onUpdateContent,
|
|
48
|
-
value = create( { text: '' } )
|
|
49
|
-
) {
|
|
50
|
-
if ( ! content.length ) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if ( typeof content !== 'string' ) {
|
|
55
|
-
const [ firstBlock ] = content;
|
|
56
|
-
|
|
57
|
-
if (
|
|
58
|
-
! title &&
|
|
59
|
-
( firstBlock.name === 'core/heading' ||
|
|
60
|
-
firstBlock.name === 'core/paragraph' )
|
|
61
|
-
) {
|
|
62
|
-
// Strip HTML to avoid unwanted HTML being added to the title.
|
|
63
|
-
// In the majority of cases it is assumed that HTML in the title
|
|
64
|
-
// is undesirable.
|
|
65
|
-
const contentNoHTML = stripHTML( firstBlock.attributes.content );
|
|
66
|
-
onUpdateTitle( contentNoHTML );
|
|
67
|
-
onUpdateContent( content.slice( 1 ) );
|
|
68
|
-
} else {
|
|
69
|
-
onUpdateContent( content );
|
|
70
|
-
}
|
|
71
|
-
} else {
|
|
72
|
-
// Strip HTML to avoid unwanted HTML being added to the title.
|
|
73
|
-
// In the majority of cases it is assumed that HTML in the title
|
|
74
|
-
// is undesirable.
|
|
75
|
-
const contentNoHTML = stripHTML( content );
|
|
76
|
-
|
|
77
|
-
const newValue = insert( value, create( { html: contentNoHTML } ) );
|
|
78
|
-
onUpdateTitle( toHTMLString( { value: newValue } ) );
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
class PostTitle extends Component {
|
|
83
|
-
constructor( props ) {
|
|
84
|
-
super( props );
|
|
85
|
-
|
|
86
|
-
this.setRef = this.setRef.bind( this );
|
|
87
|
-
this.onPaste = this.onPaste.bind( this );
|
|
88
|
-
}
|
|
89
|
-
componentDidUpdate( prevProps ) {
|
|
90
|
-
// Unselect if any other block is selected and blur the RichText.
|
|
91
|
-
if (
|
|
92
|
-
this.props.isSelected &&
|
|
93
|
-
! prevProps.isAnyBlockSelected &&
|
|
94
|
-
this.props.isAnyBlockSelected
|
|
95
|
-
) {
|
|
96
|
-
if ( this.richTextRef ) {
|
|
97
|
-
this.richTextRef.blur();
|
|
98
|
-
}
|
|
99
|
-
this.props.onUnselect();
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
componentDidMount() {
|
|
104
|
-
if ( this.props.innerRef ) {
|
|
105
|
-
this.props.innerRef( this );
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
handleFocusOutside() {
|
|
110
|
-
this.props.onUnselect();
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
focus() {
|
|
114
|
-
this.props.onSelect();
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
onPaste( { value, plainText, html } ) {
|
|
118
|
-
const {
|
|
119
|
-
title,
|
|
120
|
-
onInsertBlockAfter: onInsertBlocks,
|
|
121
|
-
onUpdate,
|
|
122
|
-
} = this.props;
|
|
123
|
-
|
|
124
|
-
const content = pasteHandler( {
|
|
125
|
-
HTML: html,
|
|
126
|
-
plainText,
|
|
127
|
-
} );
|
|
128
|
-
|
|
129
|
-
insertContentWithTitle(
|
|
130
|
-
title,
|
|
131
|
-
content,
|
|
132
|
-
onUpdate,
|
|
133
|
-
onInsertBlocks,
|
|
134
|
-
value
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
setRef( richText ) {
|
|
139
|
-
this.richTextRef = richText;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
getTitle( title, postType ) {
|
|
143
|
-
if ( 'page' === postType ) {
|
|
144
|
-
return ! title
|
|
145
|
-
? /* translators: accessibility text. empty page title. */
|
|
146
|
-
__( 'Page title. Empty' )
|
|
147
|
-
: sprintf(
|
|
148
|
-
/* translators: accessibility text. %s: text content of the page title. */
|
|
149
|
-
__( 'Page title. %s' ),
|
|
150
|
-
title
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return ! title
|
|
155
|
-
? /* translators: accessibility text. empty post title. */
|
|
156
|
-
__( 'Post title. Empty' )
|
|
157
|
-
: sprintf(
|
|
158
|
-
/* translators: accessibility text. %s: text content of the post title. */
|
|
159
|
-
__( 'Post title. %s' ),
|
|
160
|
-
title
|
|
161
|
-
);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
render() {
|
|
165
|
-
const {
|
|
166
|
-
placeholder,
|
|
167
|
-
style,
|
|
168
|
-
title,
|
|
169
|
-
focusedBorderColor,
|
|
170
|
-
borderStyle,
|
|
171
|
-
isDimmed,
|
|
172
|
-
postType,
|
|
173
|
-
globalStyles,
|
|
174
|
-
} = this.props;
|
|
175
|
-
|
|
176
|
-
const decodedPlaceholder = decodeEntities( placeholder );
|
|
177
|
-
const borderColor = this.props.isSelected
|
|
178
|
-
? focusedBorderColor
|
|
179
|
-
: 'transparent';
|
|
180
|
-
const titleStyles = {
|
|
181
|
-
...style,
|
|
182
|
-
...( globalStyles?.text && {
|
|
183
|
-
color: globalStyles.text,
|
|
184
|
-
placeholderColor: globalStyles.text,
|
|
185
|
-
} ),
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
return (
|
|
189
|
-
<View
|
|
190
|
-
testID="post-title"
|
|
191
|
-
style={ [
|
|
192
|
-
styles.titleContainer,
|
|
193
|
-
borderStyle,
|
|
194
|
-
{ borderColor },
|
|
195
|
-
isDimmed && styles.dimmed,
|
|
196
|
-
] }
|
|
197
|
-
accessible={ ! this.props.isSelected }
|
|
198
|
-
accessibilityLabel={ this.getTitle( title, postType ) }
|
|
199
|
-
accessibilityHint={ __( 'Updates the title.' ) }
|
|
200
|
-
>
|
|
201
|
-
<RichText.Raw
|
|
202
|
-
ref={ this.setRef }
|
|
203
|
-
accessibilityLabel={ this.getTitle( title, postType ) }
|
|
204
|
-
tagName="p"
|
|
205
|
-
tagsToEliminate={ [ 'strong' ] }
|
|
206
|
-
unstableOnFocus={ this.props.onSelect }
|
|
207
|
-
onBlur={ this.props.onBlur } // Always assign onBlur as a props.
|
|
208
|
-
style={ titleStyles }
|
|
209
|
-
styles={ styles }
|
|
210
|
-
fontSize={ 24 }
|
|
211
|
-
lineHeight={ 1 }
|
|
212
|
-
fontWeight="bold"
|
|
213
|
-
deleteEnter
|
|
214
|
-
onChange={ ( value ) => {
|
|
215
|
-
this.props.onUpdate( value );
|
|
216
|
-
} }
|
|
217
|
-
onPaste={ this.onPaste }
|
|
218
|
-
placeholder={ decodedPlaceholder }
|
|
219
|
-
value={ title }
|
|
220
|
-
onSelectionChange={ () => {} }
|
|
221
|
-
onEnter={ this.props.onEnterPress }
|
|
222
|
-
disableEditingMenu
|
|
223
|
-
__unstableIsSelected={ this.props.isSelected }
|
|
224
|
-
__unstableOnCreateUndoLevel={ () => {} }
|
|
225
|
-
/>
|
|
226
|
-
</View>
|
|
227
|
-
);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
export default compose(
|
|
232
|
-
withSelect( ( select ) => {
|
|
233
|
-
const { isPostTitleSelected, getEditedPostAttribute } =
|
|
234
|
-
select( editorStore );
|
|
235
|
-
const { getSelectedBlockClientId, getBlockRootClientId, getSettings } =
|
|
236
|
-
select( blockEditorStore );
|
|
237
|
-
|
|
238
|
-
const selectedId = getSelectedBlockClientId();
|
|
239
|
-
const selectionIsNested = !! getBlockRootClientId( selectedId );
|
|
240
|
-
const globalStyles =
|
|
241
|
-
getSettings()?.__experimentalGlobalStylesBaseStyles?.color;
|
|
242
|
-
|
|
243
|
-
return {
|
|
244
|
-
postType: getEditedPostAttribute( 'type' ),
|
|
245
|
-
title: getEditedPostAttribute( 'title' ),
|
|
246
|
-
isAnyBlockSelected: !! selectedId,
|
|
247
|
-
isSelected: isPostTitleSelected(),
|
|
248
|
-
isDimmed: selectionIsNested,
|
|
249
|
-
globalStyles,
|
|
250
|
-
};
|
|
251
|
-
} ),
|
|
252
|
-
withDispatch( ( dispatch ) => {
|
|
253
|
-
const { undo, redo, togglePostTitleSelection, editPost } =
|
|
254
|
-
dispatch( editorStore );
|
|
255
|
-
|
|
256
|
-
const { clearSelectedBlock, insertDefaultBlock, insertBlocks } =
|
|
257
|
-
dispatch( blockEditorStore );
|
|
258
|
-
|
|
259
|
-
return {
|
|
260
|
-
onEnterPress() {
|
|
261
|
-
insertDefaultBlock( undefined, undefined, 0 );
|
|
262
|
-
},
|
|
263
|
-
onUndo: undo,
|
|
264
|
-
onRedo: redo,
|
|
265
|
-
onSelect() {
|
|
266
|
-
togglePostTitleSelection( true );
|
|
267
|
-
clearSelectedBlock();
|
|
268
|
-
},
|
|
269
|
-
onUnselect() {
|
|
270
|
-
togglePostTitleSelection( false );
|
|
271
|
-
},
|
|
272
|
-
onUpdate( title ) {
|
|
273
|
-
editPost( { title } );
|
|
274
|
-
},
|
|
275
|
-
onInsertBlockAfter( blocks ) {
|
|
276
|
-
insertBlocks( blocks, 0 );
|
|
277
|
-
},
|
|
278
|
-
};
|
|
279
|
-
} ),
|
|
280
|
-
withInstanceId,
|
|
281
|
-
withFocusOutside
|
|
282
|
-
)( PostTitle );
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`PostTitle does not update title with existing content when pasting HTML 1`] = `
|
|
4
|
-
"<!-- wp:heading -->
|
|
5
|
-
<h2 class="wp-block-heading">Howdy</h2>
|
|
6
|
-
<!-- /wp:heading -->
|
|
7
|
-
|
|
8
|
-
<!-- wp:heading -->
|
|
9
|
-
<h2 class="wp-block-heading">This is a heading.</h2>
|
|
10
|
-
<!-- /wp:heading -->
|
|
11
|
-
|
|
12
|
-
<!-- wp:paragraph -->
|
|
13
|
-
<p>This is a paragraph.</p>
|
|
14
|
-
<!-- /wp:paragraph -->"
|
|
15
|
-
`;
|
|
16
|
-
|
|
17
|
-
exports[`PostTitle populates empty title with first block content when pasting HTML 1`] = `
|
|
18
|
-
"<!-- wp:heading -->
|
|
19
|
-
<h2 class="wp-block-heading">This is a heading.</h2>
|
|
20
|
-
<!-- /wp:heading -->
|
|
21
|
-
|
|
22
|
-
<!-- wp:paragraph -->
|
|
23
|
-
<p>This is a paragraph.</p>
|
|
24
|
-
<!-- /wp:paragraph -->"
|
|
25
|
-
`;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
getEditorHtml,
|
|
6
|
-
getEditorTitle,
|
|
7
|
-
initializeEditor,
|
|
8
|
-
pasteIntoRichText,
|
|
9
|
-
selectRangeInRichText,
|
|
10
|
-
screen,
|
|
11
|
-
setupCoreBlocks,
|
|
12
|
-
within,
|
|
13
|
-
} from 'test/helpers';
|
|
14
|
-
|
|
15
|
-
setupCoreBlocks();
|
|
16
|
-
|
|
17
|
-
const HTML_MULTIPLE_TAGS = `<h2>Howdy</h2>
|
|
18
|
-
<h2>This is a heading.</h2>
|
|
19
|
-
<p>This is a paragraph.</p>`;
|
|
20
|
-
|
|
21
|
-
describe( 'PostTitle', () => {
|
|
22
|
-
it( 'populates empty title with first block content when pasting HTML', async () => {
|
|
23
|
-
await initializeEditor( { initialTitle: '' } );
|
|
24
|
-
|
|
25
|
-
const postTitle = within(
|
|
26
|
-
screen.getByTestId( 'post-title' )
|
|
27
|
-
).getByPlaceholderText( 'Add title' );
|
|
28
|
-
pasteIntoRichText( postTitle, { html: HTML_MULTIPLE_TAGS } );
|
|
29
|
-
|
|
30
|
-
expect( console ).toHaveLogged();
|
|
31
|
-
expect( getEditorTitle() ).toBe( 'Howdy' );
|
|
32
|
-
expect( getEditorHtml() ).toMatchSnapshot();
|
|
33
|
-
} );
|
|
34
|
-
|
|
35
|
-
it( 'does not update title with existing content when pasting HTML', async () => {
|
|
36
|
-
const initialTitle = 'Hello';
|
|
37
|
-
await initializeEditor( { initialTitle } );
|
|
38
|
-
|
|
39
|
-
const postTitle = within(
|
|
40
|
-
screen.getByTestId( 'post-title' )
|
|
41
|
-
).getByPlaceholderText( 'Add title' );
|
|
42
|
-
selectRangeInRichText( postTitle, 0 );
|
|
43
|
-
pasteIntoRichText( postTitle, { html: HTML_MULTIPLE_TAGS } );
|
|
44
|
-
|
|
45
|
-
expect( console ).toHaveLogged();
|
|
46
|
-
expect( getEditorTitle() ).toBe( initialTitle );
|
|
47
|
-
expect( getEditorHtml() ).toMatchSnapshot();
|
|
48
|
-
} );
|
|
49
|
-
|
|
50
|
-
it( 'updates title with existing content when pasting text', async () => {
|
|
51
|
-
await initializeEditor( { initialTitle: 'World' } );
|
|
52
|
-
|
|
53
|
-
const postTitle = within(
|
|
54
|
-
screen.getByTestId( 'post-title' )
|
|
55
|
-
).getByPlaceholderText( 'Add title' );
|
|
56
|
-
selectRangeInRichText( postTitle, 0 );
|
|
57
|
-
pasteIntoRichText( postTitle, { text: 'Hello' } );
|
|
58
|
-
|
|
59
|
-
expect( console ).toHaveLogged();
|
|
60
|
-
expect( getEditorTitle() ).toBe( 'HelloWorld' );
|
|
61
|
-
expect( getEditorHtml() ).toBe( '' );
|
|
62
|
-
} );
|
|
63
|
-
|
|
64
|
-
it( 'does not add HTML to title when pasting span tag', async () => {
|
|
65
|
-
const pasteHTML = `<span style="border: 1px solid black">l</span>`;
|
|
66
|
-
await initializeEditor( { initialTitle: 'Helo' } );
|
|
67
|
-
|
|
68
|
-
const postTitle = within(
|
|
69
|
-
screen.getByTestId( 'post-title' )
|
|
70
|
-
).getByPlaceholderText( 'Add title' );
|
|
71
|
-
selectRangeInRichText( postTitle, 2 );
|
|
72
|
-
pasteIntoRichText( postTitle, { html: pasteHTML } );
|
|
73
|
-
|
|
74
|
-
expect( console ).toHaveLogged();
|
|
75
|
-
expect( getEditorTitle() ).toBe( 'Hello' );
|
|
76
|
-
expect( getEditorHtml() ).toBe( '' );
|
|
77
|
-
} );
|
|
78
|
-
} );
|