@wordpress/editor 14.41.2-next.v.202603161435.0 → 14.43.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 +3 -1
- package/build/components/collaborators-overlay/compute-selection.cjs +10 -10
- package/build/components/collaborators-overlay/compute-selection.cjs.map +2 -2
- package/build/components/collaborators-overlay/cursor-registry.cjs +86 -0
- package/build/components/collaborators-overlay/cursor-registry.cjs.map +7 -0
- package/build/components/collaborators-overlay/index.cjs +7 -2
- package/build/components/collaborators-overlay/index.cjs.map +2 -2
- package/build/components/collaborators-overlay/overlay-iframe-styles.cjs +1 -1
- package/build/components/collaborators-overlay/overlay-iframe-styles.cjs.map +2 -2
- package/build/components/collaborators-overlay/overlay.cjs +42 -1
- package/build/components/collaborators-overlay/overlay.cjs.map +2 -2
- package/build/components/collaborators-overlay/timing-utils.cjs +46 -0
- package/build/components/collaborators-overlay/timing-utils.cjs.map +7 -0
- package/build/components/collaborators-overlay/use-render-cursors.cjs +1 -1
- package/build/components/collaborators-overlay/use-render-cursors.cjs.map +2 -2
- package/build/components/collaborators-presence/index.cjs +14 -4
- package/build/components/collaborators-presence/index.cjs.map +2 -2
- package/build/components/collaborators-presence/list.cjs +20 -4
- package/build/components/collaborators-presence/list.cjs.map +2 -2
- package/build/components/post-card-panel/index.cjs +4 -15
- package/build/components/post-card-panel/index.cjs.map +2 -2
- package/build/components/post-content-information/index.cjs +10 -13
- package/build/components/post-content-information/index.cjs.map +2 -2
- package/build/components/post-locked-modal/index.cjs +16 -3
- package/build/components/post-locked-modal/index.cjs.map +2 -2
- package/build/components/post-revisions-panel/index.cjs +164 -0
- package/build/components/post-revisions-panel/index.cjs.map +7 -0
- package/build/components/post-revisions-preview/block-diff.cjs +39 -11
- package/build/components/post-revisions-preview/block-diff.cjs.map +2 -2
- package/build/components/post-revisions-preview/diff-markers.cjs +2 -2
- package/build/components/post-revisions-preview/diff-markers.cjs.map +2 -2
- package/build/components/post-revisions-preview/revisions-canvas.cjs +1 -1
- package/build/components/post-revisions-preview/revisions-canvas.cjs.map +2 -2
- package/build/components/post-revisions-preview/revisions-slider.cjs +24 -5
- package/build/components/post-revisions-preview/revisions-slider.cjs.map +2 -2
- package/build/components/post-template/block-theme.cjs +7 -4
- package/build/components/post-template/block-theme.cjs.map +2 -2
- package/build/components/post-template/create-new-template-modal.cjs +39 -46
- package/build/components/post-template/create-new-template-modal.cjs.map +2 -2
- package/build/components/post-template/hooks.cjs +91 -8
- package/build/components/post-template/hooks.cjs.map +2 -2
- package/build/components/post-template/panel.cjs +5 -42
- package/build/components/post-template/panel.cjs.map +3 -3
- package/build/components/post-template/swap-template-button.cjs +31 -20
- package/build/components/post-template/swap-template-button.cjs.map +2 -2
- package/build/components/preferences-modal/index.cjs +35 -27
- package/build/components/preferences-modal/index.cjs.map +2 -2
- package/build/components/provider/use-block-editor-settings.cjs +2 -0
- package/build/components/provider/use-block-editor-settings.cjs.map +3 -3
- package/build/components/revision-block-diff/index.cjs +61 -0
- package/build/components/revision-block-diff/index.cjs.map +7 -0
- package/build/components/revision-diff-panel/index.cjs +68 -0
- package/build/components/revision-diff-panel/index.cjs.map +7 -0
- package/build/components/revision-fields-diff/index.cjs +96 -0
- package/build/components/revision-fields-diff/index.cjs.map +7 -0
- package/build/components/sidebar/dataform-post-summary.cjs +25 -55
- package/build/components/sidebar/dataform-post-summary.cjs.map +2 -2
- package/build/components/sidebar/index.cjs +30 -23
- package/build/components/sidebar/index.cjs.map +3 -3
- package/build/components/sidebar/post-revision-summary.cjs +74 -0
- package/build/components/sidebar/post-revision-summary.cjs.map +7 -0
- package/build/components/sidebar/post-summary.cjs +35 -42
- package/build/components/sidebar/post-summary.cjs.map +3 -3
- package/build/components/style-book/index.cjs +4 -3
- package/build/components/style-book/index.cjs.map +2 -2
- package/build/components/{sync-connection-modal → sync-connection-error-modal}/index.cjs +89 -80
- package/build/components/sync-connection-error-modal/index.cjs.map +7 -0
- package/build/components/{sync-connection-modal → sync-connection-error-modal}/use-retry-countdown.cjs +14 -27
- package/build/components/sync-connection-error-modal/use-retry-countdown.cjs.map +7 -0
- package/build/components/template-actions-panel/block-theme-content.cjs +188 -0
- package/build/components/template-actions-panel/block-theme-content.cjs.map +7 -0
- package/build/components/template-actions-panel/classic-theme-content.cjs +159 -0
- package/build/components/template-actions-panel/classic-theme-content.cjs.map +7 -0
- package/build/components/template-actions-panel/index.cjs +59 -0
- package/build/components/template-actions-panel/index.cjs.map +7 -0
- package/build/components/visual-editor/index.cjs +2 -2
- package/build/components/visual-editor/index.cjs.map +2 -2
- package/build/dataviews/store/private-actions.cjs +2 -0
- package/build/dataviews/store/private-actions.cjs.map +2 -2
- package/build/store/actions.cjs +1 -3
- package/build/store/actions.cjs.map +2 -2
- package/build/store/private-actions.cjs +21 -2
- package/build/store/private-actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +40 -15
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/utils/media-finalize/index.cjs +43 -0
- package/build/utils/media-finalize/index.cjs.map +7 -0
- package/build/utils/sync-error-messages.cjs +29 -16
- package/build/utils/sync-error-messages.cjs.map +3 -3
- package/build-module/components/collaborators-overlay/compute-selection.mjs +10 -10
- package/build-module/components/collaborators-overlay/compute-selection.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/cursor-registry.mjs +61 -0
- package/build-module/components/collaborators-overlay/cursor-registry.mjs.map +7 -0
- package/build-module/components/collaborators-overlay/index.mjs +7 -2
- package/build-module/components/collaborators-overlay/index.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs +1 -1
- package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/overlay.mjs +43 -2
- package/build-module/components/collaborators-overlay/overlay.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/timing-utils.mjs +21 -0
- package/build-module/components/collaborators-overlay/timing-utils.mjs.map +7 -0
- package/build-module/components/collaborators-overlay/use-render-cursors.mjs +1 -1
- package/build-module/components/collaborators-overlay/use-render-cursors.mjs.map +2 -2
- package/build-module/components/collaborators-presence/index.mjs +14 -4
- package/build-module/components/collaborators-presence/index.mjs.map +2 -2
- package/build-module/components/collaborators-presence/list.mjs +20 -4
- package/build-module/components/collaborators-presence/list.mjs.map +2 -2
- package/build-module/components/post-card-panel/index.mjs +6 -17
- package/build-module/components/post-card-panel/index.mjs.map +2 -2
- package/build-module/components/post-content-information/index.mjs +6 -13
- package/build-module/components/post-content-information/index.mjs.map +2 -2
- package/build-module/components/post-locked-modal/index.mjs +16 -3
- package/build-module/components/post-locked-modal/index.mjs.map +2 -2
- package/build-module/components/post-revisions-panel/index.mjs +139 -0
- package/build-module/components/post-revisions-panel/index.mjs.map +7 -0
- package/build-module/components/post-revisions-preview/block-diff.mjs +39 -11
- package/build-module/components/post-revisions-preview/block-diff.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/diff-markers.mjs +2 -2
- package/build-module/components/post-revisions-preview/diff-markers.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/revisions-canvas.mjs +1 -1
- package/build-module/components/post-revisions-preview/revisions-canvas.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/revisions-slider.mjs +24 -5
- package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
- package/build-module/components/post-template/block-theme.mjs +7 -4
- package/build-module/components/post-template/block-theme.mjs.map +2 -2
- package/build-module/components/post-template/create-new-template-modal.mjs +39 -46
- package/build-module/components/post-template/create-new-template-modal.mjs.map +2 -2
- package/build-module/components/post-template/hooks.mjs +90 -8
- package/build-module/components/post-template/hooks.mjs.map +2 -2
- package/build-module/components/post-template/panel.mjs +5 -42
- package/build-module/components/post-template/panel.mjs.map +2 -2
- package/build-module/components/post-template/swap-template-button.mjs +27 -20
- package/build-module/components/post-template/swap-template-button.mjs.map +2 -2
- package/build-module/components/preferences-modal/index.mjs +35 -27
- package/build-module/components/preferences-modal/index.mjs.map +2 -2
- package/build-module/components/provider/use-block-editor-settings.mjs +2 -0
- package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
- package/build-module/components/revision-block-diff/index.mjs +30 -0
- package/build-module/components/revision-block-diff/index.mjs.map +7 -0
- package/build-module/components/revision-diff-panel/index.mjs +37 -0
- package/build-module/components/revision-diff-panel/index.mjs.map +7 -0
- package/build-module/components/revision-fields-diff/index.mjs +65 -0
- package/build-module/components/revision-fields-diff/index.mjs.map +7 -0
- package/build-module/components/sidebar/dataform-post-summary.mjs +25 -55
- package/build-module/components/sidebar/dataform-post-summary.mjs.map +2 -2
- package/build-module/components/sidebar/index.mjs +30 -23
- package/build-module/components/sidebar/index.mjs.map +2 -2
- package/build-module/components/sidebar/post-revision-summary.mjs +43 -0
- package/build-module/components/sidebar/post-revision-summary.mjs.map +7 -0
- package/build-module/components/sidebar/post-summary.mjs +31 -42
- package/build-module/components/sidebar/post-summary.mjs.map +2 -2
- package/build-module/components/style-book/index.mjs +4 -3
- package/build-module/components/style-book/index.mjs.map +2 -2
- package/build-module/components/sync-connection-error-modal/index.mjs +177 -0
- package/build-module/components/sync-connection-error-modal/index.mjs.map +7 -0
- package/build-module/components/sync-connection-error-modal/use-retry-countdown.mjs +36 -0
- package/build-module/components/sync-connection-error-modal/use-retry-countdown.mjs.map +7 -0
- package/build-module/components/template-actions-panel/block-theme-content.mjs +167 -0
- package/build-module/components/template-actions-panel/block-theme-content.mjs.map +7 -0
- package/build-module/components/template-actions-panel/classic-theme-content.mjs +138 -0
- package/build-module/components/template-actions-panel/classic-theme-content.mjs.map +7 -0
- package/build-module/components/template-actions-panel/index.mjs +28 -0
- package/build-module/components/template-actions-panel/index.mjs.map +7 -0
- package/build-module/components/visual-editor/index.mjs +2 -2
- package/build-module/components/visual-editor/index.mjs.map +2 -2
- package/build-module/dataviews/store/private-actions.mjs +5 -1
- package/build-module/dataviews/store/private-actions.mjs.map +2 -2
- package/build-module/store/actions.mjs +1 -3
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +21 -2
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +40 -15
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/utils/media-finalize/index.mjs +12 -0
- package/build-module/utils/media-finalize/index.mjs.map +7 -0
- package/build-module/utils/sync-error-messages.mjs +24 -16
- package/build-module/utils/sync-error-messages.mjs.map +3 -3
- package/build-style/style-rtl.css +135 -50
- package/build-style/style.css +135 -50
- package/build-types/components/collaborators-overlay/cursor-registry.d.ts +36 -0
- package/build-types/components/collaborators-overlay/cursor-registry.d.ts.map +1 -0
- package/build-types/components/collaborators-overlay/index.d.ts +7 -4
- package/build-types/components/collaborators-overlay/index.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/overlay-iframe-styles.d.ts +1 -1
- package/build-types/components/collaborators-overlay/overlay-iframe-styles.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/overlay.d.ts +4 -1
- package/build-types/components/collaborators-overlay/overlay.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/timing-utils.d.ts +11 -0
- package/build-types/components/collaborators-overlay/timing-utils.d.ts.map +1 -0
- package/build-types/components/collaborators-presence/index.d.ts.map +1 -1
- package/build-types/components/collaborators-presence/list.d.ts +4 -1
- package/build-types/components/collaborators-presence/list.d.ts.map +1 -1
- package/build-types/components/post-card-panel/index.d.ts.map +1 -1
- package/build-types/components/post-content-information/index.d.ts +4 -1
- package/build-types/components/post-content-information/index.d.ts.map +1 -1
- package/build-types/components/post-locked-modal/index.d.ts +2 -2
- package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
- package/build-types/components/post-revisions-panel/index.d.ts +2 -0
- package/build-types/components/post-revisions-panel/index.d.ts.map +1 -0
- package/build-types/components/post-revisions-preview/block-diff.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/revisions-slider.d.ts.map +1 -1
- package/build-types/components/post-template/block-theme.d.ts +1 -3
- package/build-types/components/post-template/block-theme.d.ts.map +1 -1
- package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -1
- package/build-types/components/post-template/hooks.d.ts +2 -1
- package/build-types/components/post-template/hooks.d.ts.map +1 -1
- package/build-types/components/post-template/panel.d.ts.map +1 -1
- package/build-types/components/post-template/swap-template-button.d.ts +4 -0
- package/build-types/components/post-template/swap-template-button.d.ts.map +1 -1
- package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
- package/build-types/components/revision-block-diff/index.d.ts +6 -0
- package/build-types/components/revision-block-diff/index.d.ts.map +1 -0
- package/build-types/components/revision-diff-panel/index.d.ts +14 -0
- package/build-types/components/revision-diff-panel/index.d.ts.map +1 -0
- package/build-types/components/revision-fields-diff/index.d.ts +6 -0
- package/build-types/components/revision-fields-diff/index.d.ts.map +1 -0
- 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 +2 -0
- package/build-types/components/sidebar/post-revision-summary.d.ts.map +1 -0
- package/build-types/components/sidebar/post-summary.d.ts +3 -0
- package/build-types/components/sidebar/post-summary.d.ts.map +1 -1
- package/build-types/components/style-book/index.d.ts +2 -1
- package/build-types/components/style-book/index.d.ts.map +1 -1
- package/build-types/components/sync-connection-error-modal/index.d.ts +22 -0
- package/build-types/components/sync-connection-error-modal/index.d.ts.map +1 -0
- package/build-types/components/sync-connection-error-modal/use-retry-countdown.d.ts +11 -0
- package/build-types/components/sync-connection-error-modal/use-retry-countdown.d.ts.map +1 -0
- package/build-types/components/template-actions-panel/block-theme-content.d.ts +2 -0
- package/build-types/components/template-actions-panel/block-theme-content.d.ts.map +1 -0
- package/build-types/components/template-actions-panel/classic-theme-content.d.ts +2 -0
- package/build-types/components/template-actions-panel/classic-theme-content.d.ts.map +1 -0
- package/build-types/components/template-actions-panel/index.d.ts +2 -0
- package/build-types/components/template-actions-panel/index.d.ts.map +1 -0
- package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
- 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.map +1 -1
- package/build-types/utils/media-finalize/index.d.ts +2 -0
- package/build-types/utils/media-finalize/index.d.ts.map +1 -0
- package/build-types/utils/sync-error-messages.d.ts +17 -3
- package/build-types/utils/sync-error-messages.d.ts.map +1 -1
- package/package.json +45 -44
- package/src/components/collaborators-overlay/compute-selection.ts +13 -13
- package/src/components/collaborators-overlay/cursor-registry.ts +96 -0
- package/src/components/collaborators-overlay/index.tsx +12 -4
- package/src/components/collaborators-overlay/overlay-iframe-styles.ts +1 -1
- package/src/components/collaborators-overlay/overlay.tsx +64 -1
- package/src/components/collaborators-overlay/timing-utils.ts +30 -0
- package/src/components/collaborators-overlay/use-render-cursors.ts +1 -1
- package/src/components/collaborators-presence/index.tsx +9 -1
- package/src/components/collaborators-presence/list.tsx +25 -1
- package/src/components/post-card-panel/index.js +7 -21
- package/src/components/post-content-information/index.js +5 -16
- package/src/components/post-locked-modal/index.js +21 -3
- package/src/components/post-revisions-panel/index.js +151 -0
- package/src/components/post-revisions-panel/style.scss +16 -0
- package/src/components/post-revisions-preview/block-diff.js +59 -20
- package/src/components/post-revisions-preview/diff-markers.js +2 -2
- package/src/components/post-revisions-preview/revisions-canvas.js +1 -1
- package/src/components/post-revisions-preview/revisions-slider.js +29 -7
- package/src/components/post-revisions-preview/test/block-diff.js +69 -31
- package/src/components/post-template/block-theme.js +4 -1
- package/src/components/post-template/create-new-template-modal.js +1 -4
- package/src/components/post-template/hooks.js +107 -9
- package/src/components/post-template/panel.js +5 -59
- package/src/components/post-template/style.scss +0 -6
- package/src/components/post-template/swap-template-button.js +30 -21
- package/src/components/preferences-modal/index.js +37 -25
- package/src/components/provider/use-block-editor-settings.js +2 -0
- package/src/components/revision-block-diff/index.js +39 -0
- package/src/components/revision-diff-panel/index.js +59 -0
- package/src/components/revision-diff-panel/style.scss +13 -0
- package/src/components/revision-fields-diff/index.js +91 -0
- package/src/components/sidebar/dataform-post-summary.js +45 -68
- package/src/components/sidebar/index.js +35 -22
- package/src/components/sidebar/post-revision-summary.js +50 -0
- package/src/components/sidebar/post-summary.js +22 -40
- package/src/components/sidebar/style.scss +7 -0
- package/src/components/style-book/index.js +4 -2
- package/src/components/sync-connection-error-modal/index.tsx +265 -0
- package/src/components/sync-connection-error-modal/style.scss +14 -0
- package/src/components/sync-connection-error-modal/use-retry-countdown.ts +57 -0
- package/src/components/template-actions-panel/block-theme-content.js +196 -0
- package/src/components/template-actions-panel/classic-theme-content.js +170 -0
- package/src/components/template-actions-panel/index.js +32 -0
- package/src/components/template-actions-panel/style.scss +39 -0
- package/src/components/visual-editor/index.js +2 -2
- package/src/dataviews/store/private-actions.ts +6 -0
- package/src/store/actions.js +1 -4
- package/src/store/private-actions.js +24 -3
- package/src/store/private-selectors.js +46 -16
- package/src/style.scss +4 -1
- package/src/utils/media-finalize/index.js +11 -0
- package/src/utils/media-finalize/test/index.js +34 -0
- package/src/utils/sync-error-messages.ts +72 -0
- package/src/utils/test/sync-error-messages.js +9 -32
- package/build/components/sync-connection-modal/index.cjs.map +0 -7
- package/build/components/sync-connection-modal/use-retry-countdown.cjs.map +0 -7
- package/build-module/components/sync-connection-modal/index.mjs +0 -170
- package/build-module/components/sync-connection-modal/index.mjs.map +0 -7
- package/build-module/components/sync-connection-modal/use-retry-countdown.mjs +0 -49
- package/build-module/components/sync-connection-modal/use-retry-countdown.mjs.map +0 -7
- package/build-types/components/sync-connection-modal/index.d.ts +0 -8
- package/build-types/components/sync-connection-modal/index.d.ts.map +0 -1
- package/build-types/components/sync-connection-modal/use-retry-countdown.d.ts +0 -9
- package/build-types/components/sync-connection-modal/use-retry-countdown.d.ts.map +0 -1
- package/src/components/sync-connection-modal/index.js +0 -206
- package/src/components/sync-connection-modal/style.scss +0 -14
- package/src/components/sync-connection-modal/use-retry-countdown.js +0 -70
- package/src/utils/sync-error-messages.js +0 -58
|
@@ -28,6 +28,22 @@ import { unlock } from '../../lock-unlock';
|
|
|
28
28
|
|
|
29
29
|
const { parseRawBlock } = unlock( blocksPrivateApis );
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Safely stringifies a value for display and comparison.
|
|
33
|
+
*
|
|
34
|
+
* @param {*} value The value to stringify.
|
|
35
|
+
* @return {string} The stringified value.
|
|
36
|
+
*/
|
|
37
|
+
function stringifyValue( value ) {
|
|
38
|
+
if ( value === null || value === undefined ) {
|
|
39
|
+
return '';
|
|
40
|
+
}
|
|
41
|
+
if ( typeof value === 'object' ) {
|
|
42
|
+
return JSON.stringify( value, null, 2 );
|
|
43
|
+
}
|
|
44
|
+
return String( value );
|
|
45
|
+
}
|
|
46
|
+
|
|
31
47
|
/**
|
|
32
48
|
* Calculate text similarity using word diff (semantically meaningful).
|
|
33
49
|
* Returns ratio of unchanged words to total words.
|
|
@@ -65,7 +81,7 @@ function pairSimilarBlocks( blocks ) {
|
|
|
65
81
|
|
|
66
82
|
// Separate blocks by status, tracking original indices.
|
|
67
83
|
blocks.forEach( ( block, index ) => {
|
|
68
|
-
const status = block.__revisionDiffStatus;
|
|
84
|
+
const status = block.__revisionDiffStatus?.status;
|
|
69
85
|
if ( status === 'removed' ) {
|
|
70
86
|
removed.push( { block, index } );
|
|
71
87
|
} else if ( status === 'added' ) {
|
|
@@ -120,7 +136,7 @@ function pairSimilarBlocks( blocks ) {
|
|
|
120
136
|
// Create modified block with previous content stored.
|
|
121
137
|
modifications.set( bestMatch.index, {
|
|
122
138
|
...bestMatch.block,
|
|
123
|
-
__revisionDiffStatus: 'modified',
|
|
139
|
+
__revisionDiffStatus: { status: 'modified' },
|
|
124
140
|
__previousRawBlock: rem.block,
|
|
125
141
|
} );
|
|
126
142
|
}
|
|
@@ -176,14 +192,14 @@ function diffRawBlocks( currentRaw, previousRaw ) {
|
|
|
176
192
|
for ( let i = 0; i < part.count; i++ ) {
|
|
177
193
|
result.push( {
|
|
178
194
|
...currentRaw[ currIdx++ ],
|
|
179
|
-
__revisionDiffStatus: 'added',
|
|
195
|
+
__revisionDiffStatus: { status: 'added' },
|
|
180
196
|
} );
|
|
181
197
|
}
|
|
182
198
|
} else if ( part.removed ) {
|
|
183
199
|
for ( let i = 0; i < part.count; i++ ) {
|
|
184
200
|
result.push( {
|
|
185
201
|
...previousRaw[ prevIdx++ ],
|
|
186
|
-
__revisionDiffStatus: 'removed',
|
|
202
|
+
__revisionDiffStatus: { status: 'removed' },
|
|
187
203
|
} );
|
|
188
204
|
}
|
|
189
205
|
} else {
|
|
@@ -481,26 +497,28 @@ function applyRichTextDiff( currentRichText, previousRichText ) {
|
|
|
481
497
|
}
|
|
482
498
|
|
|
483
499
|
/**
|
|
484
|
-
* Apply
|
|
485
|
-
*
|
|
500
|
+
* Apply diffs to a modified block's attributes.
|
|
501
|
+
* - Rich-text attributes: applies inline diff formatting (ins/del marks).
|
|
502
|
+
* - Other attributes: computes word-level diffs for the sidebar panel.
|
|
486
503
|
*
|
|
487
504
|
* @param {Object} currentBlock Current parsed block.
|
|
488
505
|
* @param {Object} previousBlock Previous parsed block.
|
|
506
|
+
* @param {Object} diffStatus The __revisionDiffStatus object to attach changedAttributes to.
|
|
489
507
|
*/
|
|
490
|
-
function
|
|
508
|
+
function applyDiffToBlock( currentBlock, previousBlock, diffStatus ) {
|
|
491
509
|
const blockType = getBlockType( currentBlock.name );
|
|
492
510
|
if ( ! blockType ) {
|
|
493
511
|
return;
|
|
494
512
|
}
|
|
495
513
|
|
|
496
|
-
|
|
514
|
+
const changedAttributes = {};
|
|
515
|
+
|
|
497
516
|
for ( const [ attrName, attrDef ] of Object.entries(
|
|
498
517
|
blockType.attributes
|
|
499
518
|
) ) {
|
|
500
519
|
if ( attrDef.source === 'rich-text' ) {
|
|
501
520
|
const currentRichText = currentBlock.attributes[ attrName ];
|
|
502
521
|
const previousRichText = previousBlock.attributes[ attrName ];
|
|
503
|
-
|
|
504
522
|
if (
|
|
505
523
|
currentRichText instanceof RichTextData &&
|
|
506
524
|
previousRichText instanceof RichTextData
|
|
@@ -510,8 +528,22 @@ function applyRichTextDiffToBlock( currentBlock, previousBlock ) {
|
|
|
510
528
|
previousRichText
|
|
511
529
|
);
|
|
512
530
|
}
|
|
531
|
+
} else {
|
|
532
|
+
const currStr = stringifyValue(
|
|
533
|
+
currentBlock.attributes[ attrName ]
|
|
534
|
+
);
|
|
535
|
+
const prevStr = stringifyValue(
|
|
536
|
+
previousBlock.attributes[ attrName ]
|
|
537
|
+
);
|
|
538
|
+
if ( currStr !== prevStr ) {
|
|
539
|
+
changedAttributes[ attrName ] = diffWords( prevStr, currStr );
|
|
540
|
+
}
|
|
513
541
|
}
|
|
514
542
|
}
|
|
543
|
+
|
|
544
|
+
if ( Object.keys( changedAttributes ).length > 0 ) {
|
|
545
|
+
diffStatus.changedAttributes = changedAttributes;
|
|
546
|
+
}
|
|
515
547
|
}
|
|
516
548
|
|
|
517
549
|
/**
|
|
@@ -525,18 +557,25 @@ function applyRichTextDiffToBlock( currentBlock, previousBlock ) {
|
|
|
525
557
|
function applyDiffRecursively( parsedBlock, rawBlock ) {
|
|
526
558
|
// Copy diff status from raw block to parsed block.
|
|
527
559
|
if ( rawBlock.__revisionDiffStatus ) {
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
560
|
+
// Apply diffs if this block is modified and has a previous raw block.
|
|
561
|
+
if (
|
|
562
|
+
rawBlock.__revisionDiffStatus.status === 'modified' &&
|
|
563
|
+
rawBlock.__previousRawBlock
|
|
564
|
+
) {
|
|
565
|
+
const previousParsed = parseRawBlock( rawBlock.__previousRawBlock );
|
|
566
|
+
if ( previousParsed ) {
|
|
567
|
+
applyDiffToBlock(
|
|
568
|
+
parsedBlock,
|
|
569
|
+
previousParsed,
|
|
570
|
+
rawBlock.__revisionDiffStatus
|
|
571
|
+
);
|
|
572
|
+
}
|
|
539
573
|
}
|
|
574
|
+
|
|
575
|
+
parsedBlock.__revisionDiffStatus = rawBlock.__revisionDiffStatus;
|
|
576
|
+
// Also store in attributes so it survives block-editor store normalization.
|
|
577
|
+
parsedBlock.attributes.__revisionDiffStatus =
|
|
578
|
+
rawBlock.__revisionDiffStatus;
|
|
540
579
|
}
|
|
541
580
|
|
|
542
581
|
// Recursively process inner blocks.
|
|
@@ -32,10 +32,10 @@ const { useBlockElementRef } = unlock( blockEditorPrivateApis );
|
|
|
32
32
|
function collectDiffBlocks( blocks ) {
|
|
33
33
|
const result = [];
|
|
34
34
|
for ( const block of blocks ) {
|
|
35
|
-
if ( block.__revisionDiffStatus ) {
|
|
35
|
+
if ( block.__revisionDiffStatus?.status ) {
|
|
36
36
|
result.push( {
|
|
37
37
|
clientId: block.clientId,
|
|
38
|
-
status: block.__revisionDiffStatus,
|
|
38
|
+
status: block.__revisionDiffStatus.status,
|
|
39
39
|
} );
|
|
40
40
|
}
|
|
41
41
|
if ( block.innerBlocks?.length ) {
|
|
@@ -95,7 +95,7 @@ const REVISION_DIFF_STYLES = `
|
|
|
95
95
|
function withRevisionDiffClasses( BlockListBlock ) {
|
|
96
96
|
return ( props ) => {
|
|
97
97
|
const { block, className } = props;
|
|
98
|
-
const diffStatus = block?.__revisionDiffStatus;
|
|
98
|
+
const diffStatus = block?.__revisionDiffStatus?.status;
|
|
99
99
|
|
|
100
100
|
const enhancedClassName = clsx( className, {
|
|
101
101
|
'is-revision-added': diffStatus === 'added',
|
|
@@ -35,11 +35,23 @@ function RevisionsSlider() {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
const entityConfig = getEntityConfig( 'postType', postType );
|
|
38
|
+
const _revisionKey = entityConfig?.revisionKey || 'id';
|
|
38
39
|
const query = {
|
|
39
40
|
per_page: -1,
|
|
40
41
|
context: 'edit',
|
|
41
|
-
_fields:
|
|
42
|
-
|
|
42
|
+
_fields: [
|
|
43
|
+
...new Set( [
|
|
44
|
+
'id',
|
|
45
|
+
'date',
|
|
46
|
+
'modified',
|
|
47
|
+
'author',
|
|
48
|
+
'meta',
|
|
49
|
+
'title.raw',
|
|
50
|
+
'excerpt.raw',
|
|
51
|
+
'content.raw',
|
|
52
|
+
_revisionKey,
|
|
53
|
+
] ),
|
|
54
|
+
].join(),
|
|
43
55
|
};
|
|
44
56
|
return {
|
|
45
57
|
revisions: getRevisions( 'postType', postType, postId, query ),
|
|
@@ -52,7 +64,7 @@ function RevisionsSlider() {
|
|
|
52
64
|
currentRevisionId: unlock(
|
|
53
65
|
select( editorStore )
|
|
54
66
|
).getCurrentRevisionId(),
|
|
55
|
-
revisionKey:
|
|
67
|
+
revisionKey: _revisionKey,
|
|
56
68
|
};
|
|
57
69
|
},
|
|
58
70
|
[]
|
|
@@ -60,14 +72,21 @@ function RevisionsSlider() {
|
|
|
60
72
|
|
|
61
73
|
const { setCurrentRevisionId } = unlock( useDispatch( editorStore ) );
|
|
62
74
|
|
|
75
|
+
// Template revisions use the template REST API format, which exposes
|
|
76
|
+
// 'modified' instead of 'date'.
|
|
77
|
+
const revisionDateField = revisionKey === 'wp_id' ? 'modified' : 'date';
|
|
78
|
+
|
|
63
79
|
const sortedRevisions = useMemo( () => {
|
|
64
80
|
return (
|
|
65
81
|
revisions
|
|
66
82
|
?.slice()
|
|
67
|
-
.sort(
|
|
68
|
-
|
|
83
|
+
.sort(
|
|
84
|
+
( a, b ) =>
|
|
85
|
+
new Date( a[ revisionDateField ] ) -
|
|
86
|
+
new Date( b[ revisionDateField ] )
|
|
87
|
+
) ?? []
|
|
69
88
|
);
|
|
70
|
-
}, [ revisions ] );
|
|
89
|
+
}, [ revisions, revisionDateField ] );
|
|
71
90
|
|
|
72
91
|
const selectedIndex = sortedRevisions.findIndex(
|
|
73
92
|
( r ) => r[ revisionKey ] === currentRevisionId
|
|
@@ -87,7 +106,10 @@ function RevisionsSlider() {
|
|
|
87
106
|
if ( ! revision ) {
|
|
88
107
|
return index;
|
|
89
108
|
}
|
|
90
|
-
return dateI18n(
|
|
109
|
+
return dateI18n(
|
|
110
|
+
dateSettings.formats.datetime,
|
|
111
|
+
revision[ revisionDateField ]
|
|
112
|
+
);
|
|
91
113
|
};
|
|
92
114
|
|
|
93
115
|
if ( isLoading ) {
|
|
@@ -91,7 +91,7 @@ describe( 'diffRevisionContent', () => {
|
|
|
91
91
|
name: 'core/paragraph',
|
|
92
92
|
attributes: {
|
|
93
93
|
content: 'Hello',
|
|
94
|
-
__revisionDiffStatus: 'added',
|
|
94
|
+
__revisionDiffStatus: { status: 'added' },
|
|
95
95
|
},
|
|
96
96
|
},
|
|
97
97
|
] );
|
|
@@ -108,7 +108,7 @@ describe( 'diffRevisionContent', () => {
|
|
|
108
108
|
name: 'core/paragraph',
|
|
109
109
|
attributes: {
|
|
110
110
|
content: 'Hello',
|
|
111
|
-
__revisionDiffStatus: 'removed',
|
|
111
|
+
__revisionDiffStatus: { status: 'removed' },
|
|
112
112
|
},
|
|
113
113
|
},
|
|
114
114
|
] );
|
|
@@ -144,7 +144,9 @@ describe( 'diffRevisionContent', () => {
|
|
|
144
144
|
{
|
|
145
145
|
name: 'core/paragraph',
|
|
146
146
|
attributes: {
|
|
147
|
-
__revisionDiffStatus:
|
|
147
|
+
__revisionDiffStatus: {
|
|
148
|
+
status: 'modified',
|
|
149
|
+
},
|
|
148
150
|
},
|
|
149
151
|
},
|
|
150
152
|
] );
|
|
@@ -167,7 +169,7 @@ describe( 'diffRevisionContent', () => {
|
|
|
167
169
|
name: 'core/paragraph',
|
|
168
170
|
attributes: {
|
|
169
171
|
content: 'NEW',
|
|
170
|
-
__revisionDiffStatus: 'added',
|
|
172
|
+
__revisionDiffStatus: { status: 'added' },
|
|
171
173
|
},
|
|
172
174
|
},
|
|
173
175
|
{
|
|
@@ -211,14 +213,14 @@ describe( 'diffRevisionContent', () => {
|
|
|
211
213
|
name: 'core/paragraph',
|
|
212
214
|
attributes: {
|
|
213
215
|
content: 'First new block',
|
|
214
|
-
__revisionDiffStatus: 'added',
|
|
216
|
+
__revisionDiffStatus: { status: 'added' },
|
|
215
217
|
},
|
|
216
218
|
},
|
|
217
219
|
{
|
|
218
220
|
name: 'core/paragraph',
|
|
219
221
|
attributes: {
|
|
220
222
|
content: 'Second new block',
|
|
221
|
-
__revisionDiffStatus: 'added',
|
|
223
|
+
__revisionDiffStatus: { status: 'added' },
|
|
222
224
|
},
|
|
223
225
|
},
|
|
224
226
|
{
|
|
@@ -227,7 +229,9 @@ describe( 'diffRevisionContent', () => {
|
|
|
227
229
|
// Inline diff: "existing" → "modified"
|
|
228
230
|
content:
|
|
229
231
|
'This is some <del title="Removed" class="revision-diff-removed">existing</del><ins title="Added" class="revision-diff-added">modified</ins> content',
|
|
230
|
-
__revisionDiffStatus:
|
|
232
|
+
__revisionDiffStatus: {
|
|
233
|
+
status: 'modified',
|
|
234
|
+
},
|
|
231
235
|
},
|
|
232
236
|
},
|
|
233
237
|
] );
|
|
@@ -265,7 +269,7 @@ describe( 'diffRevisionContent', () => {
|
|
|
265
269
|
name: 'core/paragraph',
|
|
266
270
|
attributes: {
|
|
267
271
|
content: 'B',
|
|
268
|
-
__revisionDiffStatus: 'added',
|
|
272
|
+
__revisionDiffStatus: { status: 'added' },
|
|
269
273
|
},
|
|
270
274
|
},
|
|
271
275
|
],
|
|
@@ -305,7 +309,7 @@ describe( 'diffRevisionContent', () => {
|
|
|
305
309
|
name: 'core/paragraph',
|
|
306
310
|
attributes: {
|
|
307
311
|
content: 'B',
|
|
308
|
-
__revisionDiffStatus: 'removed',
|
|
312
|
+
__revisionDiffStatus: { status: 'removed' },
|
|
309
313
|
},
|
|
310
314
|
},
|
|
311
315
|
],
|
|
@@ -342,7 +346,7 @@ describe( 'diffRevisionContent', () => {
|
|
|
342
346
|
name: 'core/paragraph',
|
|
343
347
|
attributes: {
|
|
344
348
|
content: 'Second block content',
|
|
345
|
-
__revisionDiffStatus: 'added',
|
|
349
|
+
__revisionDiffStatus: { status: 'added' },
|
|
346
350
|
},
|
|
347
351
|
},
|
|
348
352
|
{
|
|
@@ -356,7 +360,7 @@ describe( 'diffRevisionContent', () => {
|
|
|
356
360
|
name: 'core/paragraph',
|
|
357
361
|
attributes: {
|
|
358
362
|
content: 'Second block content',
|
|
359
|
-
__revisionDiffStatus: 'removed',
|
|
363
|
+
__revisionDiffStatus: { status: 'removed' },
|
|
360
364
|
},
|
|
361
365
|
},
|
|
362
366
|
] );
|
|
@@ -381,7 +385,17 @@ describe( 'diffRevisionContent', () => {
|
|
|
381
385
|
attributes: {
|
|
382
386
|
content: 'Same content',
|
|
383
387
|
className: 'new-class',
|
|
384
|
-
__revisionDiffStatus:
|
|
388
|
+
__revisionDiffStatus: {
|
|
389
|
+
status: 'modified',
|
|
390
|
+
changedAttributes: {
|
|
391
|
+
className: [
|
|
392
|
+
{
|
|
393
|
+
added: true,
|
|
394
|
+
value: 'new-class',
|
|
395
|
+
},
|
|
396
|
+
],
|
|
397
|
+
},
|
|
398
|
+
},
|
|
385
399
|
},
|
|
386
400
|
},
|
|
387
401
|
] );
|
|
@@ -410,7 +424,9 @@ describe( 'diffRevisionContent', () => {
|
|
|
410
424
|
attributes: {
|
|
411
425
|
content:
|
|
412
426
|
'Second block content<ins title="Added" class="revision-diff-added"> modified</ins>',
|
|
413
|
-
__revisionDiffStatus:
|
|
427
|
+
__revisionDiffStatus: {
|
|
428
|
+
status: 'modified',
|
|
429
|
+
},
|
|
414
430
|
},
|
|
415
431
|
},
|
|
416
432
|
{
|
|
@@ -466,7 +482,9 @@ describe( 'diffRevisionContent', () => {
|
|
|
466
482
|
name: 'core/paragraph',
|
|
467
483
|
attributes: {
|
|
468
484
|
content: 'New',
|
|
469
|
-
__revisionDiffStatus:
|
|
485
|
+
__revisionDiffStatus: {
|
|
486
|
+
status: 'added',
|
|
487
|
+
},
|
|
470
488
|
},
|
|
471
489
|
},
|
|
472
490
|
],
|
|
@@ -490,7 +508,7 @@ describe( 'diffRevisionContent', () => {
|
|
|
490
508
|
{
|
|
491
509
|
name: 'core/group',
|
|
492
510
|
attributes: {
|
|
493
|
-
__revisionDiffStatus: 'added',
|
|
511
|
+
__revisionDiffStatus: { status: 'added' },
|
|
494
512
|
},
|
|
495
513
|
innerBlocks: [
|
|
496
514
|
{
|
|
@@ -526,7 +544,7 @@ describe( 'diffRevisionContent', () => {
|
|
|
526
544
|
{
|
|
527
545
|
name: 'core/group',
|
|
528
546
|
attributes: {
|
|
529
|
-
__revisionDiffStatus: 'removed',
|
|
547
|
+
__revisionDiffStatus: { status: 'removed' },
|
|
530
548
|
},
|
|
531
549
|
innerBlocks: [
|
|
532
550
|
{
|
|
@@ -577,7 +595,7 @@ describe( 'diffRevisionContent', () => {
|
|
|
577
595
|
name: 'core/paragraph',
|
|
578
596
|
attributes: {
|
|
579
597
|
content: 'NEW',
|
|
580
|
-
__revisionDiffStatus: 'added',
|
|
598
|
+
__revisionDiffStatus: { status: 'added' },
|
|
581
599
|
},
|
|
582
600
|
},
|
|
583
601
|
{
|
|
@@ -629,7 +647,9 @@ describe( 'diffRevisionContent', () => {
|
|
|
629
647
|
{
|
|
630
648
|
name: 'core/paragraph',
|
|
631
649
|
attributes: {
|
|
632
|
-
__revisionDiffStatus:
|
|
650
|
+
__revisionDiffStatus: {
|
|
651
|
+
status: 'modified',
|
|
652
|
+
},
|
|
633
653
|
},
|
|
634
654
|
},
|
|
635
655
|
],
|
|
@@ -673,7 +693,7 @@ describe( 'diffRevisionContent', () => {
|
|
|
673
693
|
name: 'core/paragraph',
|
|
674
694
|
attributes: {
|
|
675
695
|
content: 'C',
|
|
676
|
-
__revisionDiffStatus: 'removed',
|
|
696
|
+
__revisionDiffStatus: { status: 'removed' },
|
|
677
697
|
},
|
|
678
698
|
},
|
|
679
699
|
{
|
|
@@ -682,7 +702,9 @@ describe( 'diffRevisionContent', () => {
|
|
|
682
702
|
// B→D modification with inline diff
|
|
683
703
|
content:
|
|
684
704
|
'<del title="Removed" class="revision-diff-removed">B</del><ins title="Added" class="revision-diff-added">D</ins>',
|
|
685
|
-
__revisionDiffStatus:
|
|
705
|
+
__revisionDiffStatus: {
|
|
706
|
+
status: 'modified',
|
|
707
|
+
},
|
|
686
708
|
},
|
|
687
709
|
},
|
|
688
710
|
],
|
|
@@ -739,7 +761,7 @@ describe( 'diffRevisionContent', () => {
|
|
|
739
761
|
attributes: {
|
|
740
762
|
content:
|
|
741
763
|
'The quick brown fox jumps over the lazy dog near the riverbank',
|
|
742
|
-
__revisionDiffStatus: 'removed',
|
|
764
|
+
__revisionDiffStatus: { status: 'removed' },
|
|
743
765
|
},
|
|
744
766
|
},
|
|
745
767
|
{
|
|
@@ -747,7 +769,7 @@ describe( 'diffRevisionContent', () => {
|
|
|
747
769
|
attributes: {
|
|
748
770
|
content:
|
|
749
771
|
'Third paragraph also removed from this post',
|
|
750
|
-
__revisionDiffStatus: 'removed',
|
|
772
|
+
__revisionDiffStatus: { status: 'removed' },
|
|
751
773
|
},
|
|
752
774
|
},
|
|
753
775
|
{
|
|
@@ -755,7 +777,7 @@ describe( 'diffRevisionContent', () => {
|
|
|
755
777
|
attributes: {
|
|
756
778
|
content:
|
|
757
779
|
'Lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod',
|
|
758
|
-
__revisionDiffStatus: 'added',
|
|
780
|
+
__revisionDiffStatus: { status: 'added' },
|
|
759
781
|
},
|
|
760
782
|
},
|
|
761
783
|
],
|
|
@@ -803,7 +825,9 @@ describe( 'diffRevisionContent', () => {
|
|
|
803
825
|
attributes: {
|
|
804
826
|
content:
|
|
805
827
|
'Hello <strong><span title="1 format added" class="revision-diff-format-added">world</span></strong>',
|
|
806
|
-
__revisionDiffStatus:
|
|
828
|
+
__revisionDiffStatus: {
|
|
829
|
+
status: 'modified',
|
|
830
|
+
},
|
|
807
831
|
},
|
|
808
832
|
},
|
|
809
833
|
] );
|
|
@@ -829,7 +853,9 @@ describe( 'diffRevisionContent', () => {
|
|
|
829
853
|
attributes: {
|
|
830
854
|
content:
|
|
831
855
|
'Hello <strong><del title="Removed" class="revision-diff-removed">world</del><ins title="Added" class="revision-diff-added">everyone</ins></strong>',
|
|
832
|
-
__revisionDiffStatus:
|
|
856
|
+
__revisionDiffStatus: {
|
|
857
|
+
status: 'modified',
|
|
858
|
+
},
|
|
833
859
|
},
|
|
834
860
|
},
|
|
835
861
|
] );
|
|
@@ -879,7 +905,9 @@ describe( 'diffRevisionContent', () => {
|
|
|
879
905
|
attributes: {
|
|
880
906
|
content:
|
|
881
907
|
'Visit <a href="https://new-site.com"><span title="1 format changed" class="revision-diff-format-changed">our site</span></a> today',
|
|
882
|
-
__revisionDiffStatus:
|
|
908
|
+
__revisionDiffStatus: {
|
|
909
|
+
status: 'modified',
|
|
910
|
+
},
|
|
883
911
|
},
|
|
884
912
|
},
|
|
885
913
|
] );
|
|
@@ -907,7 +935,9 @@ describe( 'diffRevisionContent', () => {
|
|
|
907
935
|
attributes: {
|
|
908
936
|
content:
|
|
909
937
|
'Visit <a href="https://example.com"><del title="Removed" class="revision-diff-removed">our</del><ins title="Added" class="revision-diff-added">the</ins> <del title="Removed" class="revision-diff-removed">site</del><ins title="Added" class="revision-diff-added">website</ins></a> today',
|
|
910
|
-
__revisionDiffStatus:
|
|
938
|
+
__revisionDiffStatus: {
|
|
939
|
+
status: 'modified',
|
|
940
|
+
},
|
|
911
941
|
},
|
|
912
942
|
},
|
|
913
943
|
] );
|
|
@@ -955,7 +985,9 @@ describe( 'diffRevisionContent', () => {
|
|
|
955
985
|
attributes: {
|
|
956
986
|
content:
|
|
957
987
|
'<span title="1 format removed" class="revision-diff-format-removed">Bold</span> and <span title="1 format removed" class="revision-diff-format-removed">italic</span> text',
|
|
958
|
-
__revisionDiffStatus:
|
|
988
|
+
__revisionDiffStatus: {
|
|
989
|
+
status: 'modified',
|
|
990
|
+
},
|
|
959
991
|
},
|
|
960
992
|
},
|
|
961
993
|
] );
|
|
@@ -981,7 +1013,9 @@ describe( 'diffRevisionContent', () => {
|
|
|
981
1013
|
attributes: {
|
|
982
1014
|
content:
|
|
983
1015
|
'Hello <em><span title="1 format added, 1 format removed" class="revision-diff-format-changed">world</span></em>',
|
|
984
|
-
__revisionDiffStatus:
|
|
1016
|
+
__revisionDiffStatus: {
|
|
1017
|
+
status: 'modified',
|
|
1018
|
+
},
|
|
985
1019
|
},
|
|
986
1020
|
},
|
|
987
1021
|
] );
|
|
@@ -1026,7 +1060,9 @@ describe( 'diffRevisionContent', () => {
|
|
|
1026
1060
|
attributes: {
|
|
1027
1061
|
content:
|
|
1028
1062
|
'<del title="Removed" class="revision-diff-removed">Hello</del><ins title="Added" class="revision-diff-added">Goodbye</ins> <strong>world</strong>!',
|
|
1029
|
-
__revisionDiffStatus:
|
|
1063
|
+
__revisionDiffStatus: {
|
|
1064
|
+
status: 'modified',
|
|
1065
|
+
},
|
|
1030
1066
|
},
|
|
1031
1067
|
},
|
|
1032
1068
|
] );
|
|
@@ -1062,7 +1098,9 @@ describe( 'diffRevisionContent', () => {
|
|
|
1062
1098
|
attributes: {
|
|
1063
1099
|
content:
|
|
1064
1100
|
'<del title="Removed" class="revision-diff-removed">Hello</del><ins title="Added" class="revision-diff-added">Goodbye</ins> <strong><del title="Removed" class="revision-diff-removed">world</del><ins title="Added" class="revision-diff-added">everyone</ins></strong>',
|
|
1065
|
-
__revisionDiffStatus:
|
|
1101
|
+
__revisionDiffStatus: {
|
|
1102
|
+
status: 'modified',
|
|
1103
|
+
},
|
|
1066
1104
|
},
|
|
1067
1105
|
},
|
|
1068
1106
|
],
|
|
@@ -25,18 +25,20 @@ import ResetDefaultTemplate from './reset-default-template';
|
|
|
25
25
|
import { unlock } from '../../lock-unlock';
|
|
26
26
|
import CreateNewTemplate from './create-new-template';
|
|
27
27
|
|
|
28
|
-
export default function BlockThemeControl(
|
|
28
|
+
export default function BlockThemeControl() {
|
|
29
29
|
const {
|
|
30
30
|
isTemplateHidden,
|
|
31
31
|
onNavigateToEntityRecord,
|
|
32
32
|
getEditorSettings,
|
|
33
33
|
hasGoBack,
|
|
34
34
|
hasSpecificTemplate,
|
|
35
|
+
id,
|
|
35
36
|
} = useSelect( ( select ) => {
|
|
36
37
|
const {
|
|
37
38
|
getRenderingMode,
|
|
38
39
|
getEditorSettings: _getEditorSettings,
|
|
39
40
|
getCurrentPost,
|
|
41
|
+
getCurrentTemplateId,
|
|
40
42
|
} = unlock( select( editorStore ) );
|
|
41
43
|
const editorSettings = _getEditorSettings();
|
|
42
44
|
const currentPost = getCurrentPost();
|
|
@@ -48,6 +50,7 @@ export default function BlockThemeControl( { id } ) {
|
|
|
48
50
|
'onNavigateToPreviousEntityRecord'
|
|
49
51
|
),
|
|
50
52
|
hasSpecificTemplate: !! currentPost.template,
|
|
53
|
+
id: getCurrentTemplateId(),
|
|
51
54
|
};
|
|
52
55
|
}, [] );
|
|
53
56
|
|
|
@@ -118,10 +118,7 @@ export default function CreateNewTemplateModal( { onClose } ) {
|
|
|
118
118
|
size="small"
|
|
119
119
|
overlayClassName="editor-post-template__create-template-modal"
|
|
120
120
|
>
|
|
121
|
-
<form
|
|
122
|
-
className="editor-post-template__create-form"
|
|
123
|
-
onSubmit={ submit }
|
|
124
|
-
>
|
|
121
|
+
<form onSubmit={ submit }>
|
|
125
122
|
<VStack spacing="3">
|
|
126
123
|
<TextControl
|
|
127
124
|
__next40pxDefaultSize
|