@wordpress/editor 14.33.3-next.36001005c.0 → 14.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/bindings/post-data.js +10 -17
- package/build/bindings/post-data.js.map +2 -2
- package/build/bindings/post-meta.js +7 -14
- package/build/bindings/post-meta.js.map +2 -2
- package/build/bindings/term-data.js +6 -16
- package/build/bindings/term-data.js.map +2 -2
- package/build/components/collab-sidebar/add-comment.js +26 -3
- package/build/components/collab-sidebar/add-comment.js.map +3 -3
- package/build/components/collab-sidebar/comment-author-info.js +26 -14
- package/build/components/collab-sidebar/comment-author-info.js.map +2 -2
- package/build/components/collab-sidebar/comment-indicator-toolbar.js +6 -22
- package/build/components/collab-sidebar/comment-indicator-toolbar.js.map +3 -3
- package/build/components/collab-sidebar/comments.js +105 -28
- package/build/components/collab-sidebar/comments.js.map +3 -3
- package/build/components/collab-sidebar/hooks.js +3 -4
- package/build/components/collab-sidebar/hooks.js.map +2 -2
- package/build/components/collab-sidebar/index.js +42 -57
- package/build/components/collab-sidebar/index.js.map +3 -3
- package/build/components/document-bar/index.js +16 -3
- package/build/components/document-bar/index.js.map +2 -2
- package/build/components/editor/index.js +25 -4
- package/build/components/editor/index.js.map +3 -3
- package/build/components/editor-interface/index.js +15 -10
- package/build/components/editor-interface/index.js.map +3 -3
- package/build/components/entities-saved-states/entity-type-list.js +19 -15
- package/build/components/entities-saved-states/entity-type-list.js.map +3 -3
- package/build/components/global-styles/block-link.js +70 -0
- package/build/components/global-styles/block-link.js.map +7 -0
- package/build/components/global-styles/header.js +54 -0
- package/build/components/global-styles/header.js.map +7 -0
- package/build/components/global-styles/hooks.js +176 -0
- package/build/components/global-styles/hooks.js.map +7 -0
- package/build/components/global-styles/index.js +138 -0
- package/build/components/global-styles/index.js.map +7 -0
- package/build/components/global-styles/menu.js +95 -0
- package/build/components/global-styles/menu.js.map +7 -0
- package/build/components/global-styles-provider/index.js +3 -49
- package/build/components/global-styles-provider/index.js.map +3 -3
- package/build/components/global-styles-renderer/index.js +55 -0
- package/build/components/global-styles-renderer/index.js.map +7 -0
- package/build/components/global-styles-sidebar/default-sidebar.js +66 -0
- package/build/components/global-styles-sidebar/default-sidebar.js.map +7 -0
- package/build/components/global-styles-sidebar/index.js +182 -0
- package/build/components/global-styles-sidebar/index.js.map +7 -0
- package/build/components/global-styles-sidebar/welcome-guide-image.js +37 -0
- package/build/components/global-styles-sidebar/welcome-guide-image.js.map +7 -0
- package/build/components/global-styles-sidebar/welcome-guide.js +143 -0
- package/build/components/global-styles-sidebar/welcome-guide.js.map +7 -0
- package/build/components/header/index.js +12 -12
- package/build/components/header/index.js.map +3 -3
- package/build/components/post-featured-image/index.js +32 -1
- package/build/components/post-featured-image/index.js.map +3 -3
- package/build/components/post-template/hooks.js +7 -38
- package/build/components/post-template/hooks.js.map +2 -2
- package/build/components/provider/index.js +1 -1
- package/build/components/provider/index.js.map +2 -2
- package/build/components/style-book/categories.js +86 -0
- package/build/components/style-book/categories.js.map +7 -0
- package/build/components/style-book/color-examples.js +64 -0
- package/build/components/style-book/color-examples.js.map +7 -0
- package/build/components/style-book/constants.js +319 -0
- package/build/components/style-book/constants.js.map +7 -0
- package/build/components/style-book/duotone-examples.js +68 -0
- package/build/components/style-book/duotone-examples.js.map +7 -0
- package/build/components/style-book/examples.js +237 -0
- package/build/components/style-book/examples.js.map +7 -0
- package/build/components/style-book/index.js +627 -0
- package/build/components/style-book/index.js.map +7 -0
- package/build/components/style-book/types.js +17 -0
- package/build/components/style-book/types.js.map +7 -0
- package/build/components/styles-canvas/index.js +138 -0
- package/build/components/styles-canvas/index.js.map +7 -0
- package/build/components/styles-canvas/revisions.js +121 -0
- package/build/components/styles-canvas/revisions.js.map +7 -0
- package/build/components/styles-canvas/style-book.js +68 -0
- package/build/components/styles-canvas/style-book.js.map +7 -0
- package/build/components/visual-editor/index.js +4 -3
- package/build/components/visual-editor/index.js.map +2 -2
- package/build/dataviews/fields/content-preview/content-preview-view.js.map +2 -2
- package/build/hooks/index.js +1 -0
- package/build/hooks/index.js.map +2 -2
- package/build/hooks/media-upload.js +15 -4
- package/build/hooks/media-upload.js.map +3 -3
- package/build/hooks/push-changes-to-global-styles/index.js +322 -0
- package/build/hooks/push-changes-to-global-styles/index.js.map +7 -0
- package/build/hooks/use-global-styles-output.js +74 -0
- package/build/hooks/use-global-styles-output.js.map +7 -0
- package/build/private-apis.js +10 -5
- package/build/private-apis.js.map +3 -3
- package/build/store/actions.js +1 -1
- package/build/store/actions.js.map +2 -2
- package/build/store/private-actions.js +23 -0
- package/build/store/private-actions.js.map +2 -2
- package/build/store/private-selectors.js +10 -0
- package/build/store/private-selectors.js.map +2 -2
- package/build/store/reducer.js +24 -0
- package/build/store/reducer.js.map +2 -2
- package/build/{components/editor-interface/content-slot-fill.js → utils/set-nested-value.js} +24 -10
- package/build/utils/set-nested-value.js.map +7 -0
- package/build-module/bindings/post-data.js +10 -17
- package/build-module/bindings/post-data.js.map +2 -2
- package/build-module/bindings/post-meta.js +7 -14
- package/build-module/bindings/post-meta.js.map +2 -2
- package/build-module/bindings/term-data.js +6 -16
- package/build-module/bindings/term-data.js.map +2 -2
- package/build-module/components/collab-sidebar/add-comment.js +27 -4
- package/build-module/components/collab-sidebar/add-comment.js.map +2 -2
- package/build-module/components/collab-sidebar/comment-author-info.js +26 -14
- package/build-module/components/collab-sidebar/comment-author-info.js.map +2 -2
- package/build-module/components/collab-sidebar/comment-indicator-toolbar.js +6 -12
- package/build-module/components/collab-sidebar/comment-indicator-toolbar.js.map +2 -2
- package/build-module/components/collab-sidebar/comments.js +114 -31
- package/build-module/components/collab-sidebar/comments.js.map +2 -2
- package/build-module/components/collab-sidebar/hooks.js +3 -4
- package/build-module/components/collab-sidebar/hooks.js.map +2 -2
- package/build-module/components/collab-sidebar/index.js +42 -57
- package/build-module/components/collab-sidebar/index.js.map +2 -2
- package/build-module/components/document-bar/index.js +16 -3
- package/build-module/components/document-bar/index.js.map +2 -2
- package/build-module/components/editor/index.js +25 -4
- package/build-module/components/editor/index.js.map +2 -2
- package/build-module/components/editor-interface/index.js +15 -10
- package/build-module/components/editor-interface/index.js.map +2 -2
- package/build-module/components/entities-saved-states/entity-type-list.js +18 -14
- package/build-module/components/entities-saved-states/entity-type-list.js.map +2 -2
- package/build-module/components/global-styles/block-link.js +46 -0
- package/build-module/components/global-styles/block-link.js.map +7 -0
- package/build-module/components/global-styles/header.js +41 -0
- package/build-module/components/global-styles/header.js.map +7 -0
- package/build-module/components/global-styles/hooks.js +154 -0
- package/build-module/components/global-styles/hooks.js.map +7 -0
- package/build-module/components/global-styles/index.js +112 -0
- package/build-module/components/global-styles/index.js.map +7 -0
- package/build-module/components/global-styles/menu.js +71 -0
- package/build-module/components/global-styles/menu.js.map +7 -0
- package/build-module/components/global-styles-provider/index.js +3 -37
- package/build-module/components/global-styles-provider/index.js.map +2 -2
- package/build-module/components/global-styles-renderer/index.js +31 -0
- package/build-module/components/global-styles-renderer/index.js.map +7 -0
- package/build-module/components/global-styles-sidebar/default-sidebar.js +49 -0
- package/build-module/components/global-styles-sidebar/default-sidebar.js.map +7 -0
- package/build-module/components/global-styles-sidebar/index.js +152 -0
- package/build-module/components/global-styles-sidebar/index.js.map +7 -0
- package/build-module/components/global-styles-sidebar/welcome-guide-image.js +17 -0
- package/build-module/components/global-styles-sidebar/welcome-guide-image.js.map +7 -0
- package/build-module/components/global-styles-sidebar/welcome-guide.js +113 -0
- package/build-module/components/global-styles-sidebar/welcome-guide.js.map +7 -0
- package/build-module/components/header/index.js +12 -12
- package/build-module/components/header/index.js.map +2 -2
- package/build-module/components/post-featured-image/index.js +35 -3
- package/build-module/components/post-featured-image/index.js.map +2 -2
- package/build-module/components/post-template/hooks.js +7 -38
- package/build-module/components/post-template/hooks.js.map +2 -2
- package/build-module/components/provider/index.js +1 -1
- package/build-module/components/provider/index.js.map +2 -2
- package/build-module/components/style-book/categories.js +64 -0
- package/build-module/components/style-book/categories.js.map +7 -0
- package/build-module/components/style-book/color-examples.js +37 -0
- package/build-module/components/style-book/color-examples.js.map +7 -0
- package/build-module/components/style-book/constants.js +290 -0
- package/build-module/components/style-book/constants.js.map +7 -0
- package/build-module/components/style-book/duotone-examples.js +48 -0
- package/build-module/components/style-book/duotone-examples.js.map +7 -0
- package/build-module/components/style-book/examples.js +208 -0
- package/build-module/components/style-book/examples.js.map +7 -0
- package/build-module/components/style-book/index.js +618 -0
- package/build-module/components/style-book/index.js.map +7 -0
- package/build-module/components/style-book/types.js +1 -0
- package/build-module/components/style-book/types.js.map +7 -0
- package/build-module/components/styles-canvas/index.js +104 -0
- package/build-module/components/styles-canvas/index.js.map +7 -0
- package/build-module/components/styles-canvas/revisions.js +107 -0
- package/build-module/components/styles-canvas/revisions.js.map +7 -0
- package/build-module/components/styles-canvas/style-book.js +38 -0
- package/build-module/components/styles-canvas/style-book.js.map +7 -0
- package/build-module/components/visual-editor/index.js +4 -3
- package/build-module/components/visual-editor/index.js.map +2 -2
- package/build-module/dataviews/fields/content-preview/content-preview-view.js.map +2 -2
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +2 -2
- package/build-module/hooks/media-upload.js +19 -5
- package/build-module/hooks/media-upload.js.map +2 -2
- package/build-module/hooks/push-changes-to-global-styles/index.js +309 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +7 -0
- package/build-module/hooks/use-global-styles-output.js +49 -0
- package/build-module/hooks/use-global-styles-output.js.map +7 -0
- package/build-module/private-apis.js +10 -8
- package/build-module/private-apis.js.map +2 -2
- package/build-module/store/actions.js +1 -1
- package/build-module/store/actions.js.map +2 -2
- package/build-module/store/private-actions.js +20 -0
- package/build-module/store/private-actions.js.map +2 -2
- package/build-module/store/private-selectors.js +8 -0
- package/build-module/store/private-selectors.js.map +2 -2
- package/build-module/store/reducer.js +22 -0
- package/build-module/store/reducer.js.map +2 -2
- package/build-module/utils/set-nested-value.js +23 -0
- package/build-module/utils/set-nested-value.js.map +7 -0
- package/build-style/style-rtl.css +3011 -16
- package/build-style/style.css +3012 -16
- package/build-types/bindings/post-data.d.ts +6 -16
- package/build-types/bindings/post-meta.d.ts +6 -13
- package/build-types/bindings/term-data.d.ts +6 -16
- package/build-types/components/collab-sidebar/add-comment.d.ts +6 -1
- package/build-types/components/collab-sidebar/add-comment.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/comment-author-info.d.ts +5 -16
- package/build-types/components/collab-sidebar/comment-author-info.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts +1 -2
- package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/comments.d.ts +12 -26
- package/build-types/components/collab-sidebar/comments.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/hooks.d.ts +0 -1
- package/build-types/components/collab-sidebar/hooks.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/index.d.ts +1 -4
- package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
- package/build-types/components/document-bar/index.d.ts +2 -2
- package/build-types/components/document-bar/index.d.ts.map +1 -1
- package/build-types/components/editor/index.d.ts.map +1 -1
- package/build-types/components/editor-interface/index.d.ts +1 -3
- package/build-types/components/editor-interface/index.d.ts.map +1 -1
- package/build-types/components/entities-saved-states/entity-type-list.d.ts.map +1 -1
- package/build-types/components/global-styles/block-link.d.ts +12 -0
- package/build-types/components/global-styles/block-link.d.ts.map +1 -0
- package/build-types/components/global-styles/header.d.ts +7 -0
- package/build-types/components/global-styles/header.d.ts.map +1 -0
- package/build-types/components/global-styles/hooks.d.ts +24 -0
- package/build-types/components/global-styles/hooks.d.ts.map +1 -0
- package/build-types/components/global-styles/index.d.ts +6 -0
- package/build-types/components/global-styles/index.d.ts.map +1 -0
- package/build-types/components/global-styles/menu.d.ts +13 -0
- package/build-types/components/global-styles/menu.d.ts.map +1 -0
- package/build-types/components/global-styles-provider/index.d.ts +1 -5
- package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
- package/build-types/components/global-styles-renderer/index.d.ts +4 -0
- package/build-types/components/global-styles-renderer/index.d.ts.map +1 -0
- package/build-types/components/global-styles-sidebar/default-sidebar.d.ts +13 -0
- package/build-types/components/global-styles-sidebar/default-sidebar.d.ts.map +1 -0
- package/build-types/components/global-styles-sidebar/index.d.ts +2 -0
- package/build-types/components/global-styles-sidebar/index.d.ts.map +1 -0
- package/build-types/components/global-styles-sidebar/welcome-guide-image.d.ts +5 -0
- package/build-types/components/global-styles-sidebar/welcome-guide-image.d.ts.map +1 -0
- package/build-types/components/global-styles-sidebar/welcome-guide.d.ts +2 -0
- package/build-types/components/global-styles-sidebar/welcome-guide.d.ts.map +1 -0
- package/build-types/components/header/index.d.ts +1 -3
- package/build-types/components/header/index.d.ts.map +1 -1
- package/build-types/components/post-template/hooks.d.ts +1 -1
- package/build-types/components/post-template/hooks.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/style-book/categories.d.ts +18 -0
- package/build-types/components/style-book/categories.d.ts.map +1 -0
- package/build-types/components/style-book/color-examples.d.ts +7 -0
- package/build-types/components/style-book/color-examples.d.ts.map +1 -0
- package/build-types/components/style-book/constants.d.ts +11 -0
- package/build-types/components/style-book/constants.d.ts.map +1 -0
- package/build-types/components/style-book/duotone-examples.d.ts +9 -0
- package/build-types/components/style-book/duotone-examples.d.ts.map +1 -0
- package/build-types/components/style-book/examples.d.ts +12 -0
- package/build-types/components/style-book/examples.d.ts.map +1 -0
- package/build-types/components/style-book/index.d.ts +31 -0
- package/build-types/components/style-book/index.d.ts.map +1 -0
- package/build-types/components/style-book/types.d.ts +72 -0
- package/build-types/components/style-book/types.d.ts.map +1 -0
- package/build-types/components/styles-canvas/index.d.ts +16 -0
- package/build-types/components/styles-canvas/index.d.ts.map +1 -0
- package/build-types/components/styles-canvas/revisions.d.ts +5 -0
- package/build-types/components/styles-canvas/revisions.d.ts.map +1 -0
- package/build-types/components/styles-canvas/style-book.d.ts +6 -0
- package/build-types/components/styles-canvas/style-book.d.ts.map +1 -0
- package/build-types/components/visual-editor/index.d.ts +1 -2
- package/build-types/components/visual-editor/index.d.ts.map +1 -1
- package/build-types/dataviews/fields/content-preview/content-preview-view.d.ts.map +1 -1
- package/build-types/hooks/push-changes-to-global-styles/index.d.ts +2 -0
- package/build-types/hooks/push-changes-to-global-styles/index.d.ts.map +1 -0
- package/build-types/hooks/use-global-styles-output.d.ts +18 -0
- package/build-types/hooks/use-global-styles-output.d.ts.map +1 -0
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts +20 -0
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +14 -0
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +20 -0
- package/build-types/store/reducer.d.ts.map +1 -1
- package/build-types/utils/set-nested-value.d.ts +20 -0
- package/build-types/utils/set-nested-value.d.ts.map +1 -0
- package/package.json +40 -40
- package/src/bindings/post-data.js +9 -20
- package/src/bindings/post-meta.js +6 -17
- package/src/bindings/term-data.js +6 -21
- package/src/components/collab-sidebar/add-comment.js +31 -3
- package/src/components/collab-sidebar/comment-author-info.js +32 -25
- package/src/components/collab-sidebar/comment-indicator-toolbar.js +6 -22
- package/src/components/collab-sidebar/comments.js +108 -35
- package/src/components/collab-sidebar/hooks.js +3 -4
- package/src/components/collab-sidebar/index.js +34 -42
- package/src/components/collab-sidebar/style.scss +1 -22
- package/src/components/document-bar/index.js +18 -3
- package/src/components/editor/index.js +27 -1
- package/src/components/editor-interface/index.js +40 -39
- package/src/components/entities-saved-states/entity-type-list.js +19 -17
- package/src/components/global-styles/block-link.js +65 -0
- package/src/components/global-styles/header.js +48 -0
- package/src/components/global-styles/hooks.js +216 -0
- package/src/components/global-styles/index.js +125 -0
- package/src/components/global-styles/menu.js +101 -0
- package/src/components/global-styles/style.scss +11 -0
- package/src/components/global-styles-provider/index.js +3 -45
- package/src/components/global-styles-renderer/index.js +39 -0
- package/src/components/global-styles-sidebar/default-sidebar.js +46 -0
- package/src/components/global-styles-sidebar/index.js +177 -0
- package/src/components/global-styles-sidebar/style.scss +119 -0
- package/src/components/global-styles-sidebar/welcome-guide-image.js +11 -0
- package/src/components/global-styles-sidebar/welcome-guide.js +136 -0
- package/src/components/header/index.js +11 -13
- package/src/components/post-featured-image/index.js +44 -1
- package/src/components/post-template/hooks.js +10 -51
- package/src/components/provider/index.js +1 -4
- package/src/components/style-book/categories.ts +97 -0
- package/src/components/style-book/color-examples.tsx +56 -0
- package/src/components/style-book/constants.ts +308 -0
- package/src/components/style-book/duotone-examples.tsx +56 -0
- package/src/components/style-book/examples.tsx +273 -0
- package/src/components/style-book/index.js +794 -0
- package/src/components/style-book/style.scss +44 -0
- package/src/components/style-book/test/categories.js +166 -0
- package/src/components/style-book/types.ts +80 -0
- package/src/components/styles-canvas/index.js +126 -0
- package/src/components/styles-canvas/revisions.js +144 -0
- package/src/components/styles-canvas/style-book.js +57 -0
- package/src/components/styles-canvas/style.scss +40 -0
- package/src/components/visual-editor/index.js +2 -1
- package/src/dataviews/fields/content-preview/content-preview-view.tsx +2 -0
- package/src/hooks/index.js +1 -0
- package/src/hooks/media-upload.js +25 -5
- package/src/hooks/push-changes-to-global-styles/index.js +391 -0
- package/src/hooks/push-changes-to-global-styles/style.scss +4 -0
- package/src/hooks/use-global-styles-output.js +76 -0
- package/src/private-apis.js +10 -8
- package/src/store/actions.js +4 -1
- package/src/store/private-actions.js +37 -0
- package/src/store/private-selectors.js +20 -0
- package/src/store/reducer.js +36 -0
- package/src/style.scss +7 -0
- package/src/utils/set-nested-value.js +39 -0
- package/tsconfig.json +3 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/editor-interface/content-slot-fill.js.map +0 -7
- package/build-module/components/editor-interface/content-slot-fill.js +0 -9
- package/build-module/components/editor-interface/content-slot-fill.js.map +0 -7
- package/build-types/components/editor-interface/content-slot-fill.d.ts +0 -14
- package/build-types/components/editor-interface/content-slot-fill.d.ts.map +0 -1
- package/src/components/editor-interface/content-slot-fill.js +0 -10
|
@@ -28,7 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var collab_sidebar_exports = {};
|
|
30
30
|
__export(collab_sidebar_exports, {
|
|
31
|
-
default: () =>
|
|
31
|
+
default: () => NotesSidebarContainer
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(collab_sidebar_exports);
|
|
34
34
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -43,15 +43,14 @@ var import_interface = require("@wordpress/interface");
|
|
|
43
43
|
var import_plugin_sidebar = __toESM(require("../plugin-sidebar"));
|
|
44
44
|
var import_constants = require("./constants");
|
|
45
45
|
var import_comments = require("./comments");
|
|
46
|
-
var import_add_comment = require("./add-comment");
|
|
47
46
|
var import_store = require("../../store");
|
|
48
47
|
var import_comment_menu_item = __toESM(require("./comment-menu-item"));
|
|
49
48
|
var import_comment_indicator_toolbar = __toESM(require("./comment-indicator-toolbar"));
|
|
50
49
|
var import_global_styles_provider = require("../global-styles-provider");
|
|
51
50
|
var import_hooks = require("./hooks");
|
|
52
51
|
var import_utils = require("./utils");
|
|
53
|
-
var
|
|
54
|
-
function
|
|
52
|
+
var import_post_type_support_check = __toESM(require("../post-type-support-check"));
|
|
53
|
+
function NotesSidebarContent({
|
|
55
54
|
showCommentBoard,
|
|
56
55
|
setShowCommentBoard,
|
|
57
56
|
styles,
|
|
@@ -62,7 +61,7 @@ function CollabSidebarContent({
|
|
|
62
61
|
isFloating = false
|
|
63
62
|
}) {
|
|
64
63
|
const { onCreate, onEdit, onDelete } = (0, import_hooks.useBlockCommentsActions)(reflowComments);
|
|
65
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.
|
|
64
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
66
65
|
import_components.__experimentalVStack,
|
|
67
66
|
{
|
|
68
67
|
className: "editor-collab-sidebar-panel",
|
|
@@ -75,47 +74,31 @@ function CollabSidebarContent({
|
|
|
75
74
|
commentSidebarRef.current = node;
|
|
76
75
|
}
|
|
77
76
|
},
|
|
78
|
-
children:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
onAddReply: onCreate,
|
|
94
|
-
onCommentDelete: onDelete,
|
|
95
|
-
showCommentBoard,
|
|
96
|
-
setShowCommentBoard,
|
|
97
|
-
commentSidebarRef,
|
|
98
|
-
reflowComments,
|
|
99
|
-
commentLastUpdated,
|
|
100
|
-
isFloating
|
|
101
|
-
}
|
|
102
|
-
)
|
|
103
|
-
]
|
|
77
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
78
|
+
import_comments.Comments,
|
|
79
|
+
{
|
|
80
|
+
threads: comments,
|
|
81
|
+
onEditComment: onEdit,
|
|
82
|
+
onAddReply: onCreate,
|
|
83
|
+
onCommentDelete: onDelete,
|
|
84
|
+
showCommentBoard,
|
|
85
|
+
setShowCommentBoard,
|
|
86
|
+
commentSidebarRef,
|
|
87
|
+
reflowComments,
|
|
88
|
+
commentLastUpdated,
|
|
89
|
+
isFloating
|
|
90
|
+
}
|
|
91
|
+
)
|
|
104
92
|
}
|
|
105
93
|
);
|
|
106
94
|
}
|
|
107
|
-
function
|
|
95
|
+
function NotesSidebar({ postId, mode }) {
|
|
108
96
|
const [showCommentBoard, setShowCommentBoard] = (0, import_element.useState)(false);
|
|
109
97
|
const { getActiveComplementaryArea } = (0, import_data.useSelect)(import_interface.store);
|
|
110
98
|
const { enableComplementaryArea } = (0, import_data.useDispatch)(import_interface.store);
|
|
111
99
|
const isLargeViewport = (0, import_compose.useViewportMatch)("medium");
|
|
112
100
|
const commentSidebarRef = (0, import_element.useRef)(null);
|
|
113
|
-
const
|
|
114
|
-
const { getCurrentPostId } = select(import_store.store);
|
|
115
|
-
return {
|
|
116
|
-
postId: getCurrentPostId()
|
|
117
|
-
};
|
|
118
|
-
}, []);
|
|
101
|
+
const showFloatingSidebar = isLargeViewport && mode === "post-only";
|
|
119
102
|
const blockCommentId = (0, import_data.useSelect)((select) => {
|
|
120
103
|
const { getBlockAttributes, getSelectedBlockClientId } = select(import_block_editor.store);
|
|
121
104
|
const clientId = getSelectedBlockClientId();
|
|
@@ -124,27 +107,24 @@ function CollabSidebar() {
|
|
|
124
107
|
const {
|
|
125
108
|
resultComments,
|
|
126
109
|
unresolvedSortedThreads,
|
|
127
|
-
totalPages,
|
|
128
110
|
reflowComments,
|
|
129
111
|
commentLastUpdated
|
|
130
112
|
} = (0, import_hooks.useBlockComments)(postId);
|
|
131
113
|
(0, import_hooks.useEnableFloatingSidebar)(
|
|
132
|
-
|
|
114
|
+
showFloatingSidebar && (unresolvedSortedThreads.length > 0 || showCommentBoard)
|
|
133
115
|
);
|
|
134
|
-
const hasMoreComments = totalPages && totalPages > 1;
|
|
135
116
|
const { merged: GlobalStyles } = (0, import_global_styles_provider.useGlobalStylesContext)();
|
|
136
117
|
const backgroundColor = GlobalStyles?.styles?.color?.background;
|
|
137
118
|
const currentThread = blockCommentId ? resultComments.find((thread) => thread.id === blockCommentId) : null;
|
|
138
|
-
if (!(!!postId && typeof postId === "number")) {
|
|
139
|
-
return null;
|
|
140
|
-
}
|
|
141
119
|
async function openTheSidebar() {
|
|
142
120
|
const prevArea = await getActiveComplementaryArea("core");
|
|
143
121
|
const activeNotesArea = import_constants.SIDEBARS.find((name) => name === prevArea);
|
|
144
|
-
if (
|
|
122
|
+
if (currentThread?.status === "approved") {
|
|
123
|
+
enableComplementaryArea("core", import_constants.collabHistorySidebarName);
|
|
124
|
+
} else if (!activeNotesArea) {
|
|
145
125
|
enableComplementaryArea(
|
|
146
126
|
"core",
|
|
147
|
-
|
|
127
|
+
showFloatingSidebar ? import_constants.collabSidebarName : import_constants.collabHistorySidebarName
|
|
148
128
|
);
|
|
149
129
|
}
|
|
150
130
|
const currentArea = await getActiveComplementaryArea("core");
|
|
@@ -164,7 +144,6 @@ function CollabSidebar() {
|
|
|
164
144
|
import_comment_indicator_toolbar.default,
|
|
165
145
|
{
|
|
166
146
|
thread: currentThread,
|
|
167
|
-
hasMoreComments,
|
|
168
147
|
onClick: openTheSidebar
|
|
169
148
|
}
|
|
170
149
|
),
|
|
@@ -173,11 +152,12 @@ function CollabSidebar() {
|
|
|
173
152
|
import_plugin_sidebar.default,
|
|
174
153
|
{
|
|
175
154
|
identifier: import_constants.collabHistorySidebarName,
|
|
155
|
+
name: import_constants.collabHistorySidebarName,
|
|
176
156
|
title: (0, import_i18n.__)("Notes"),
|
|
177
157
|
icon: import_icons.comment,
|
|
178
158
|
closeLabel: (0, import_i18n.__)("Close Notes"),
|
|
179
159
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
180
|
-
|
|
160
|
+
NotesSidebarContent,
|
|
181
161
|
{
|
|
182
162
|
comments: resultComments,
|
|
183
163
|
showCommentBoard,
|
|
@@ -199,7 +179,7 @@ function CollabSidebar() {
|
|
|
199
179
|
headerClassName: "editor-collab-sidebar__header",
|
|
200
180
|
backgroundColor,
|
|
201
181
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
202
|
-
|
|
182
|
+
NotesSidebarContent,
|
|
203
183
|
{
|
|
204
184
|
comments: unresolvedSortedThreads,
|
|
205
185
|
showCommentBoard,
|
|
@@ -214,15 +194,20 @@ function CollabSidebar() {
|
|
|
214
194
|
}
|
|
215
195
|
)
|
|
216
196
|
}
|
|
217
|
-
),
|
|
218
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
219
|
-
import_plugin_more_menu_item.default,
|
|
220
|
-
{
|
|
221
|
-
icon: import_icons.comment,
|
|
222
|
-
onClick: () => enableComplementaryArea("core", import_constants.collabHistorySidebarName),
|
|
223
|
-
children: (0, import_i18n.__)("Notes")
|
|
224
|
-
}
|
|
225
197
|
)
|
|
226
198
|
] });
|
|
227
199
|
}
|
|
200
|
+
function NotesSidebarContainer() {
|
|
201
|
+
const { postId, mode } = (0, import_data.useSelect)((select) => {
|
|
202
|
+
const { getCurrentPostId, getRenderingMode } = select(import_store.store);
|
|
203
|
+
return {
|
|
204
|
+
postId: getCurrentPostId(),
|
|
205
|
+
mode: getRenderingMode()
|
|
206
|
+
};
|
|
207
|
+
}, []);
|
|
208
|
+
if (!postId || typeof postId !== "number") {
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_type_support_check.default, { supportKeys: "editor.notes", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NotesSidebar, { postId, mode }) });
|
|
212
|
+
}
|
|
228
213
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/collab-sidebar/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport { useState, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { comment as commentIcon } from '@wordpress/icons';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport PluginSidebar from '../plugin-sidebar';\nimport {\n\tcollabHistorySidebarName,\n\tcollabSidebarName,\n\tSIDEBARS,\n} from './constants';\nimport { Comments } from './comments';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
6
|
-
"names": ["VStack", "interfaceStore", "
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport { useState, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { comment as commentIcon } from '@wordpress/icons';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport PluginSidebar from '../plugin-sidebar';\nimport {\n\tcollabHistorySidebarName,\n\tcollabSidebarName,\n\tSIDEBARS,\n} from './constants';\nimport { Comments } from './comments';\nimport { store as editorStore } from '../../store';\nimport AddCommentMenuItem from './comment-menu-item';\nimport CommentAvatarIndicator from './comment-indicator-toolbar';\nimport { useGlobalStylesContext } from '../global-styles-provider';\nimport {\n\tuseBlockComments,\n\tuseBlockCommentsActions,\n\tuseEnableFloatingSidebar,\n} from './hooks';\nimport { focusCommentThread } from './utils';\nimport PostTypeSupportCheck from '../post-type-support-check';\n\nfunction NotesSidebarContent( {\n\tshowCommentBoard,\n\tsetShowCommentBoard,\n\tstyles,\n\tcomments,\n\tcommentSidebarRef,\n\treflowComments,\n\tcommentLastUpdated,\n\tisFloating = false,\n} ) {\n\tconst { onCreate, onEdit, onDelete } =\n\t\tuseBlockCommentsActions( reflowComments );\n\n\treturn (\n\t\t<VStack\n\t\t\tclassName=\"editor-collab-sidebar-panel\"\n\t\t\tstyle={ styles }\n\t\t\trole=\"list\"\n\t\t\tspacing=\"3\"\n\t\t\tjustify=\"flex-start\"\n\t\t\tref={ ( node ) => {\n\t\t\t\t// Sometimes previous sidebar unmounts after the new one mounts.\n\t\t\t\t// This ensures we always have the latest reference.\n\t\t\t\tif ( node ) {\n\t\t\t\t\tcommentSidebarRef.current = node;\n\t\t\t\t}\n\t\t\t} }\n\t\t>\n\t\t\t<Comments\n\t\t\t\tthreads={ comments }\n\t\t\t\tonEditComment={ onEdit }\n\t\t\t\tonAddReply={ onCreate }\n\t\t\t\tonCommentDelete={ onDelete }\n\t\t\t\tshowCommentBoard={ showCommentBoard }\n\t\t\t\tsetShowCommentBoard={ setShowCommentBoard }\n\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t\treflowComments={ reflowComments }\n\t\t\t\tcommentLastUpdated={ commentLastUpdated }\n\t\t\t\tisFloating={ isFloating }\n\t\t\t/>\n\t\t</VStack>\n\t);\n}\n\nfunction NotesSidebar( { postId, mode } ) {\n\tconst [ showCommentBoard, setShowCommentBoard ] = useState( false );\n\tconst { getActiveComplementaryArea } = useSelect( interfaceStore );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst commentSidebarRef = useRef( null );\n\n\tconst showFloatingSidebar = isLargeViewport && mode === 'post-only';\n\n\tconst blockCommentId = useSelect( ( select ) => {\n\t\tconst { getBlockAttributes, getSelectedBlockClientId } =\n\t\t\tselect( blockEditorStore );\n\t\tconst clientId = getSelectedBlockClientId();\n\t\treturn clientId\n\t\t\t? getBlockAttributes( clientId )?.metadata?.noteId\n\t\t\t: null;\n\t}, [] );\n\n\tconst {\n\t\tresultComments,\n\t\tunresolvedSortedThreads,\n\t\treflowComments,\n\t\tcommentLastUpdated,\n\t} = useBlockComments( postId );\n\tuseEnableFloatingSidebar(\n\t\tshowFloatingSidebar &&\n\t\t\t( unresolvedSortedThreads.length > 0 || showCommentBoard )\n\t);\n\n\t// Get the global styles to set the background color of the sidebar.\n\tconst { merged: GlobalStyles } = useGlobalStylesContext();\n\tconst backgroundColor = GlobalStyles?.styles?.color?.background;\n\n\t// Find the current thread for the selected block.\n\tconst currentThread = blockCommentId\n\t\t? resultComments.find( ( thread ) => thread.id === blockCommentId )\n\t\t: null;\n\n\tasync function openTheSidebar() {\n\t\tconst prevArea = await getActiveComplementaryArea( 'core' );\n\t\tconst activeNotesArea = SIDEBARS.find( ( name ) => name === prevArea );\n\n\t\tif ( currentThread?.status === 'approved' ) {\n\t\t\tenableComplementaryArea( 'core', collabHistorySidebarName );\n\t\t} else if ( ! activeNotesArea ) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core',\n\t\t\t\tshowFloatingSidebar\n\t\t\t\t\t? collabSidebarName\n\t\t\t\t\t: collabHistorySidebarName\n\t\t\t);\n\t\t}\n\n\t\tconst currentArea = await getActiveComplementaryArea( 'core' );\n\t\t// Bail out if the current active area is not one of note sidebars.\n\t\tif ( ! SIDEBARS.includes( currentArea ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetShowCommentBoard( ! blockCommentId );\n\t\tfocusCommentThread(\n\t\t\tblockCommentId,\n\t\t\tcommentSidebarRef.current,\n\t\t\t// Focus a comment thread when there's a selected block with a comment.\n\t\t\t! blockCommentId ? 'textarea' : undefined\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ blockCommentId && (\n\t\t\t\t<CommentAvatarIndicator\n\t\t\t\t\tthread={ currentThread }\n\t\t\t\t\tonClick={ openTheSidebar }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<AddCommentMenuItem onClick={ openTheSidebar } />\n\t\t\t<PluginSidebar\n\t\t\t\tidentifier={ collabHistorySidebarName }\n\t\t\t\tname={ collabHistorySidebarName }\n\t\t\t\ttitle={ __( 'Notes' ) }\n\t\t\t\ticon={ commentIcon }\n\t\t\t\tcloseLabel={ __( 'Close Notes' ) }\n\t\t\t>\n\t\t\t\t<NotesSidebarContent\n\t\t\t\t\tcomments={ resultComments }\n\t\t\t\t\tshowCommentBoard={ showCommentBoard }\n\t\t\t\t\tsetShowCommentBoard={ setShowCommentBoard }\n\t\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t\tcommentLastUpdated={ commentLastUpdated }\n\t\t\t\t/>\n\t\t\t</PluginSidebar>\n\t\t\t{ isLargeViewport && (\n\t\t\t\t<PluginSidebar\n\t\t\t\t\tisPinnable={ false }\n\t\t\t\t\theader={ false }\n\t\t\t\t\tidentifier={ collabSidebarName }\n\t\t\t\t\tclassName=\"editor-collab-sidebar\"\n\t\t\t\t\theaderClassName=\"editor-collab-sidebar__header\"\n\t\t\t\t\tbackgroundColor={ backgroundColor }\n\t\t\t\t>\n\t\t\t\t\t<NotesSidebarContent\n\t\t\t\t\t\tcomments={ unresolvedSortedThreads }\n\t\t\t\t\t\tshowCommentBoard={ showCommentBoard }\n\t\t\t\t\t\tsetShowCommentBoard={ setShowCommentBoard }\n\t\t\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t\t\tcommentLastUpdated={ commentLastUpdated }\n\t\t\t\t\t\tstyles={ {\n\t\t\t\t\t\t\tbackgroundColor,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisFloating\n\t\t\t\t\t/>\n\t\t\t\t</PluginSidebar>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default function NotesSidebarContainer() {\n\tconst { postId, mode } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getRenderingMode } = select( editorStore );\n\t\treturn {\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tmode: getRenderingMode(),\n\t\t};\n\t}, [] );\n\n\tif ( ! postId || typeof postId !== 'number' ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"editor.notes\">\n\t\t\t<NotesSidebar postId={ postId } mode={ mode } />\n\t\t</PostTypeSupportCheck>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8DG;AA3DH,kBAAmB;AACnB,kBAAuC;AACvC,wBAA+C;AAC/C,qBAAiC;AACjC,qBAAiC;AACjC,mBAAuC;AACvC,0BAA0C;AAC1C,uBAAwC;AAKx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ACA,UAAW;AAAA,YACX;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA;AAAA,QACD;AAAA;AAAA,IACD;AAAA,IACE,mBACD;AAAA,MAAC,sBAAAD;AAAA,MAAA;AAAA,QACA,YAAa;AAAA,QACb,QAAS;AAAA,QACT,YAAa;AAAA,QACb,WAAU;AAAA,QACV,iBAAgB;AAAA,QAChB;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACA,UAAW;AAAA,YACX;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,QAAS;AAAA,cACR;AAAA,YACD;AAAA,YACA,YAAU;AAAA;AAAA,QACX;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;AAEe,SAAR,wBAAyC;AAC/C,QAAM,EAAE,QAAQ,KAAK,QAAI,uBAAW,CAAE,WAAY;AACjD,UAAM,EAAE,kBAAkB,iBAAiB,IAAI,OAAQ,aAAAE,KAAY;AACnE,WAAO;AAAA,MACN,QAAQ,iBAAiB;AAAA,MACzB,MAAM,iBAAiB;AAAA,IACxB;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,MAAK,CAAE,UAAU,OAAO,WAAW,UAAW;AAC7C,WAAO;AAAA,EACR;AAEA,SACC,4CAAC,+BAAAC,SAAA,EAAqB,aAAY,gBACjC,sDAAC,gBAAa,QAAkB,MAAc,GAC/C;AAEF;",
|
|
6
|
+
"names": ["VStack", "interfaceStore", "blockEditorStore", "CommentAvatarIndicator", "AddCommentMenuItem", "PluginSidebar", "commentIcon", "editorStore", "PostTypeSupportCheck"]
|
|
7
7
|
}
|
|
@@ -49,6 +49,8 @@ var import_constants = require("../../store/constants");
|
|
|
49
49
|
var import_store = require("../../store");
|
|
50
50
|
var import_pageTypeBadge = __toESM(require("../../utils/pageTypeBadge"));
|
|
51
51
|
var import_get_template_info = require("../../utils/get-template-info");
|
|
52
|
+
var import_styles_canvas = require("../styles-canvas");
|
|
53
|
+
var import_lock_unlock = require("../../lock-unlock");
|
|
52
54
|
const MotionButton = import_components.__unstableMotion.create(import_components.Button);
|
|
53
55
|
function DocumentBar(props) {
|
|
54
56
|
const {
|
|
@@ -59,7 +61,8 @@ function DocumentBar(props) {
|
|
|
59
61
|
isNotFound,
|
|
60
62
|
templateTitle,
|
|
61
63
|
onNavigateToPreviousEntityRecord,
|
|
62
|
-
isTemplatePreview
|
|
64
|
+
isTemplatePreview,
|
|
65
|
+
stylesCanvasTitle
|
|
63
66
|
} = (0, import_data.useSelect)((select) => {
|
|
64
67
|
const {
|
|
65
68
|
getCurrentPostType,
|
|
@@ -86,6 +89,15 @@ function DocumentBar(props) {
|
|
|
86
89
|
template: _document
|
|
87
90
|
});
|
|
88
91
|
const _postTypeLabel = getPostType(_postType)?.labels?.singular_name;
|
|
92
|
+
const { getStylesPath, getShowStylebook } = (0, import_lock_unlock.unlock)(
|
|
93
|
+
select(import_store.store)
|
|
94
|
+
);
|
|
95
|
+
const _stylesPath = getStylesPath();
|
|
96
|
+
const _showStylebook = getShowStylebook();
|
|
97
|
+
const _stylesCanvasTitle = (0, import_styles_canvas.getStylesCanvasTitle)(
|
|
98
|
+
_stylesPath,
|
|
99
|
+
_showStylebook
|
|
100
|
+
);
|
|
89
101
|
return {
|
|
90
102
|
postId: _postId,
|
|
91
103
|
postType: _postType,
|
|
@@ -99,7 +111,8 @@ function DocumentBar(props) {
|
|
|
99
111
|
),
|
|
100
112
|
templateTitle: _templateInfo.title,
|
|
101
113
|
onNavigateToPreviousEntityRecord: getEditorSettings().onNavigateToPreviousEntityRecord,
|
|
102
|
-
isTemplatePreview: getRenderingMode() === "template-locked"
|
|
114
|
+
isTemplatePreview: getRenderingMode() === "template-locked",
|
|
115
|
+
stylesCanvasTitle: _stylesCanvasTitle
|
|
103
116
|
};
|
|
104
117
|
}, []);
|
|
105
118
|
const { open: openCommandCenter } = (0, import_data.useDispatch)(import_commands.store);
|
|
@@ -107,7 +120,7 @@ function DocumentBar(props) {
|
|
|
107
120
|
const isTemplate = import_constants.TEMPLATE_POST_TYPES.includes(postType);
|
|
108
121
|
const hasBackButton = !!onNavigateToPreviousEntityRecord;
|
|
109
122
|
const entityTitle = isTemplate ? templateTitle : documentTitle;
|
|
110
|
-
const title = props.title || entityTitle;
|
|
123
|
+
const title = props.title || stylesCanvasTitle || entityTitle;
|
|
111
124
|
const icon = props.icon;
|
|
112
125
|
const pageTypeBadge = (0, import_pageTypeBadge.default)(postId);
|
|
113
126
|
const mountedRef = (0, import_element.useRef)(false);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/document-bar/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { chevronLeftSmall, chevronRightSmall, layout } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as commandsStore } from '@wordpress/commands';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPES } from '../../store/constants';\nimport { store as editorStore } from '../../store';\nimport usePageTypeBadge from '../../utils/pageTypeBadge';\nimport { getTemplateInfo } from '../../utils/get-template-info';\n\n/** @typedef {import(\"@wordpress/components\").IconType} IconType */\n\nconst MotionButton = motion.create( Button );\n\n/**\n * This component renders a navigation bar at the top of the editor. It displays the title of the current document,\n * a back button (if applicable), and a command center button. It also handles different states of the document,\n * such as \"not found\" or \"unsynced\".\n *\n * @example\n * ```jsx\n * <DocumentBar />\n * ```\n * @param {Object} props The component props.\n * @param {string} props.title A title for the document, defaulting to the document or
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { chevronLeftSmall, chevronRightSmall, layout } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as commandsStore } from '@wordpress/commands';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPES } from '../../store/constants';\nimport { store as editorStore } from '../../store';\nimport usePageTypeBadge from '../../utils/pageTypeBadge';\nimport { getTemplateInfo } from '../../utils/get-template-info';\nimport { getStylesCanvasTitle } from '../styles-canvas';\nimport { unlock } from '../../lock-unlock';\n\n/** @typedef {import(\"@wordpress/components\").IconType} IconType */\n\nconst MotionButton = motion.create( Button );\n\n/**\n * This component renders a navigation bar at the top of the editor. It displays the title of the current document,\n * a back button (if applicable), and a command center button. It also handles different states of the document,\n * such as \"not found\" or \"unsynced\".\n *\n * @example\n * ```jsx\n * <DocumentBar />\n * ```\n *\n * @param {Object} props The component props.\n * @param {string} props.title A title for the document, defaulting to the document or template title currently being edited.\n * @param {IconType} props.icon An icon for the document, no default.\n * (A default icon indicating the document post type is no longer used.)\n *\n * @return {React.ReactNode} The rendered DocumentBar component.\n */\nexport default function DocumentBar( props ) {\n\tconst {\n\t\tpostId,\n\t\tpostType,\n\t\tpostTypeLabel,\n\t\tdocumentTitle,\n\t\tisNotFound,\n\t\ttemplateTitle,\n\t\tonNavigateToPreviousEntityRecord,\n\t\tisTemplatePreview,\n\t\tstylesCanvasTitle,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPostId,\n\t\t\tgetEditorSettings,\n\t\t\tgetRenderingMode,\n\t\t} = select( editorStore );\n\n\t\tconst {\n\t\t\tgetEditedEntityRecord,\n\t\t\tgetPostType,\n\t\t\tgetCurrentTheme,\n\t\t\tisResolving: isResolvingSelector,\n\t\t} = select( coreStore );\n\t\tconst _postType = getCurrentPostType();\n\t\tconst _postId = getCurrentPostId();\n\t\tconst _document = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t_postType,\n\t\t\t_postId\n\t\t);\n\n\t\tconst { default_template_types: templateTypes = [] } =\n\t\t\tgetCurrentTheme() ?? {};\n\n\t\tconst _templateInfo = getTemplateInfo( {\n\t\t\ttemplateTypes,\n\t\t\ttemplate: _document,\n\t\t} );\n\t\tconst _postTypeLabel = getPostType( _postType )?.labels?.singular_name;\n\n\t\t// Check if styles canvas is active and get its title\n\t\tconst { getStylesPath, getShowStylebook } = unlock(\n\t\t\tselect( editorStore )\n\t\t);\n\t\tconst _stylesPath = getStylesPath();\n\t\tconst _showStylebook = getShowStylebook();\n\t\tconst _stylesCanvasTitle = getStylesCanvasTitle(\n\t\t\t_stylesPath,\n\t\t\t_showStylebook\n\t\t);\n\n\t\treturn {\n\t\t\tpostId: _postId,\n\t\t\tpostType: _postType,\n\t\t\tpostTypeLabel: _postTypeLabel,\n\t\t\tdocumentTitle: _document.title,\n\t\t\tisNotFound:\n\t\t\t\t! _document &&\n\t\t\t\t! isResolvingSelector(\n\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\t'postType',\n\t\t\t\t\t_postType,\n\t\t\t\t\t_postId\n\t\t\t\t),\n\t\t\ttemplateTitle: _templateInfo.title,\n\t\t\tonNavigateToPreviousEntityRecord:\n\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord,\n\t\t\tisTemplatePreview: getRenderingMode() === 'template-locked',\n\t\t\tstylesCanvasTitle: _stylesCanvasTitle,\n\t\t};\n\t}, [] );\n\n\tconst { open: openCommandCenter } = useDispatch( commandsStore );\n\tconst isReducedMotion = useReducedMotion();\n\n\tconst isTemplate = TEMPLATE_POST_TYPES.includes( postType );\n\tconst hasBackButton = !! onNavigateToPreviousEntityRecord;\n\tconst entityTitle = isTemplate ? templateTitle : documentTitle;\n\tconst title = props.title || stylesCanvasTitle || entityTitle;\n\tconst icon = props.icon;\n\n\tconst pageTypeBadge = usePageTypeBadge( postId );\n\n\tconst mountedRef = useRef( false );\n\tuseEffect( () => {\n\t\tmountedRef.current = true;\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'editor-document-bar', {\n\t\t\t\t'has-back-button': hasBackButton,\n\t\t\t} ) }\n\t\t>\n\t\t\t<AnimatePresence>\n\t\t\t\t{ hasBackButton && (\n\t\t\t\t\t<MotionButton\n\t\t\t\t\t\tclassName=\"editor-document-bar__back\"\n\t\t\t\t\t\ticon={ isRTL() ? chevronRightSmall : chevronLeftSmall }\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\tonNavigateToPreviousEntityRecord();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tmountedRef.current\n\t\t\t\t\t\t\t\t? { opacity: 0, transform: 'translateX(15%)' }\n\t\t\t\t\t\t\t\t: false // Don't show entry animation when DocumentBar mounts.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={ { opacity: 1, transform: 'translateX(0%)' } }\n\t\t\t\t\t\texit={ { opacity: 0, transform: 'translateX(15%)' } }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisReducedMotion ? { duration: 0 } : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t</MotionButton>\n\t\t\t\t) }\n\t\t\t</AnimatePresence>\n\t\t\t{ ! isTemplate && isTemplatePreview && ! hasBackButton && (\n\t\t\t\t<BlockIcon\n\t\t\t\t\ticon={ layout }\n\t\t\t\t\tclassName=\"editor-document-bar__icon-layout\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isNotFound ? (\n\t\t\t\t<Text>{ __( 'Document not found' ) }</Text>\n\t\t\t) : (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"editor-document-bar__command\"\n\t\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName=\"editor-document-bar__title\"\n\t\t\t\t\t\t// Force entry animation when the back button is added or removed.\n\t\t\t\t\t\tkey={ hasBackButton }\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tmountedRef.current\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\t\t\ttransform: hasBackButton\n\t\t\t\t\t\t\t\t\t\t\t? 'translateX(15%)'\n\t\t\t\t\t\t\t\t\t\t\t: 'translateX(-15%)',\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: false // Don't show entry animation when DocumentBar mounts.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\ttransform: 'translateX(0%)',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisReducedMotion ? { duration: 0 } : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ icon && <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\t<Text size=\"body\" as=\"h1\">\n\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-title\">\n\t\t\t\t\t\t\t\t{ title\n\t\t\t\t\t\t\t\t\t? stripHTML( title )\n\t\t\t\t\t\t\t\t\t: __( 'No title' ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t{ pageTypeBadge && (\n\t\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-type-label\">\n\t\t\t\t\t\t\t\t\t{ `\u00B7 ${ pageTypeBadge }` }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ postTypeLabel &&\n\t\t\t\t\t\t\t\t! props.title &&\n\t\t\t\t\t\t\t\t! pageTypeBadge && (\n\t\t\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-type-label\">\n\t\t\t\t\t\t\t\t\t\t{ `\u00B7 ${ decodeEntities(\n\t\t\t\t\t\t\t\t\t\t\tpostTypeLabel\n\t\t\t\t\t\t\t\t\t\t) }` }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</motion.div>\n\t\t\t\t\t<span className=\"editor-document-bar__shortcut\">\n\t\t\t\t\t\t{ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t</span>\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2JK;AAxJL,kBAAiB;AAKjB,kBAA0B;AAC1B,kBAAuC;AACvC,wBAKO;AACP,0BAA0B;AAC1B,mBAA4D;AAC5D,sBAAgC;AAChC,uBAAmC;AACnC,sBAAuC;AACvC,qBAAkC;AAClC,qBAAiC;AACjC,2BAA+B;AAC/B,iBAAiD;AAKjD,uBAAoC;AACp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BAAA,EAAO,8BAAI,oBAAqB,GAAG,IAEpC;AAAA,UAAC;AAAA;AAAA,YACA,WAAU;AAAA,YACV,SAAU,MAAM,kBAAkB;AAAA,YAClC,MAAK;AAAA,YAEL;AAAA;AAAA,gBAAC,kBAAAP,iBAAO;AAAA,gBAAP;AAAA,kBACA,WAAU;AAAA,kBAGV,SACC,WAAW,UACR;AAAA,oBACA,SAAS;AAAA,oBACT,WAAW,gBACR,oBACA;AAAA,kBACH,IACA;AAAA,kBAEJ,SAAU;AAAA,oBACT,SAAS;AAAA,oBACT,WAAW;AAAA,kBACZ;AAAA,kBACA,YACC,kBAAkB,EAAE,UAAU,EAAE,IAAI;AAAA,kBAGnC;AAAA,4BAAQ,4CAAC,iCAAU,MAAc;AAAA,oBACnC,6CAAC,kBAAAO,oBAAA,EAAK,MAAK,QAAO,IAAG,MACpB;AAAA,kEAAC,UAAK,WAAU,mCACb,sBACC,WAAAC,qBAAW,KAAM,QACjB,gBAAI,UAAW,GACnB;AAAA,sBACE,iBACD,4CAAC,UAAK,WAAU,wCACb,kBAAM,aAAc,IACvB;AAAA,sBAEC,iBACD,CAAE,MAAM,SACR,CAAE,iBACD,4CAAC,UAAK,WAAU,wCACb,sBAAM;AAAA,wBACP;AAAA,sBACD,CAAE,IACH;AAAA,uBAEH;AAAA;AAAA;AAAA,gBAxCM;AAAA,cAyCP;AAAA,cACA,4CAAC,UAAK,WAAU,iCACb,0CAAgB,QAAS,GAAI,GAChC;AAAA;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EAEF;AAEF;",
|
|
6
6
|
"names": ["motion", "editorStore", "coreStore", "commandsStore", "usePageTypeBadge", "clsx", "AnimatePresence", "Text", "stripHTML"]
|
|
7
7
|
}
|
|
@@ -36,10 +36,14 @@ var import_data = require("@wordpress/data");
|
|
|
36
36
|
var import_core_data = require("@wordpress/core-data");
|
|
37
37
|
var import_components = require("@wordpress/components");
|
|
38
38
|
var import_i18n = require("@wordpress/i18n");
|
|
39
|
+
var import_store = require("../../store");
|
|
39
40
|
var import_constants = require("../../store/constants");
|
|
40
41
|
var import_editor_interface = __toESM(require("../editor-interface"));
|
|
41
42
|
var import_provider = require("../provider");
|
|
42
43
|
var import_sidebar = __toESM(require("../sidebar"));
|
|
44
|
+
var import_collab_sidebar = __toESM(require("../collab-sidebar"));
|
|
45
|
+
var import_global_styles_sidebar = __toESM(require("../global-styles-sidebar"));
|
|
46
|
+
var import_global_styles_renderer = require("../global-styles-renderer");
|
|
43
47
|
function Editor({
|
|
44
48
|
postType,
|
|
45
49
|
postId,
|
|
@@ -55,14 +59,26 @@ function Editor({
|
|
|
55
59
|
extraSidebarPanels,
|
|
56
60
|
...props
|
|
57
61
|
}) {
|
|
58
|
-
const {
|
|
62
|
+
const {
|
|
63
|
+
post,
|
|
64
|
+
template,
|
|
65
|
+
hasLoadedPost,
|
|
66
|
+
error,
|
|
67
|
+
isBlockTheme,
|
|
68
|
+
showGlobalStyles
|
|
69
|
+
} = (0, import_data.useSelect)(
|
|
59
70
|
(select) => {
|
|
60
71
|
const {
|
|
61
72
|
getEntityRecord,
|
|
62
73
|
getResolutionError,
|
|
63
|
-
hasFinishedResolution
|
|
74
|
+
hasFinishedResolution,
|
|
75
|
+
getCurrentTheme
|
|
64
76
|
} = select(import_core_data.store);
|
|
77
|
+
const { getRenderingMode, getCurrentPostType } = select(import_store.store);
|
|
65
78
|
const postArgs = ["postType", postType, postId];
|
|
79
|
+
const renderingMode = getRenderingMode();
|
|
80
|
+
const currentPostType = getCurrentPostType();
|
|
81
|
+
const _isBlockTheme = getCurrentTheme()?.is_block_theme;
|
|
66
82
|
return {
|
|
67
83
|
post: getEntityRecord(...postArgs),
|
|
68
84
|
template: templateId ? getEntityRecord(
|
|
@@ -74,7 +90,9 @@ function Editor({
|
|
|
74
90
|
"getEntityRecord",
|
|
75
91
|
postArgs
|
|
76
92
|
),
|
|
77
|
-
error: getResolutionError("getEntityRecord", postArgs)?.message
|
|
93
|
+
error: getResolutionError("getEntityRecord", postArgs)?.message,
|
|
94
|
+
isBlockTheme: _isBlockTheme,
|
|
95
|
+
showGlobalStyles: _isBlockTheme && (currentPostType === "wp_template" || renderingMode === "template-locked")
|
|
78
96
|
};
|
|
79
97
|
},
|
|
80
98
|
[postType, postId, templateId]
|
|
@@ -101,13 +119,16 @@ function Editor({
|
|
|
101
119
|
children: [
|
|
102
120
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_editor_interface.default, { ...props, children: extraContent }),
|
|
103
121
|
children,
|
|
122
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_collab_sidebar.default, {}),
|
|
104
123
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
105
124
|
import_sidebar.default,
|
|
106
125
|
{
|
|
107
126
|
onActionPerformed,
|
|
108
127
|
extraPanels: extraSidebarPanels
|
|
109
128
|
}
|
|
110
|
-
)
|
|
129
|
+
),
|
|
130
|
+
isBlockTheme && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_global_styles_renderer.GlobalStylesRenderer, {}),
|
|
131
|
+
showGlobalStyles && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_global_styles_sidebar.default, {})
|
|
111
132
|
]
|
|
112
133
|
}
|
|
113
134
|
)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/editor/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { Notice } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../store/constants';\nimport EditorInterface from '../editor-interface';\nimport { ExperimentalEditorProvider } from '../provider';\nimport Sidebar from '../sidebar';\n\nfunction Editor( {\n\tpostType,\n\tpostId,\n\ttemplateId,\n\tsettings,\n\tchildren,\n\tinitialEdits,\n\n\t// This could be part of the settings.\n\tonActionPerformed,\n\n\t// The following abstractions are not ideal but necessary\n\t// to account for site editor and post editor differences for now.\n\textraContent,\n\textraSidebarPanels,\n\t...props\n} ) {\n\tconst {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
6
|
-
"names": ["coreStore", "EditorInterface", "Sidebar"]
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { Notice } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { TEMPLATE_POST_TYPE } from '../../store/constants';\nimport EditorInterface from '../editor-interface';\nimport { ExperimentalEditorProvider } from '../provider';\nimport Sidebar from '../sidebar';\nimport NotesSidebar from '../collab-sidebar';\nimport GlobalStylesSidebar from '../global-styles-sidebar';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\n\nfunction Editor( {\n\tpostType,\n\tpostId,\n\ttemplateId,\n\tsettings,\n\tchildren,\n\tinitialEdits,\n\n\t// This could be part of the settings.\n\tonActionPerformed,\n\n\t// The following abstractions are not ideal but necessary\n\t// to account for site editor and post editor differences for now.\n\textraContent,\n\textraSidebarPanels,\n\t...props\n} ) {\n\tconst {\n\t\tpost,\n\t\ttemplate,\n\t\thasLoadedPost,\n\t\terror,\n\t\tisBlockTheme,\n\t\tshowGlobalStyles,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEntityRecord,\n\t\t\t\tgetResolutionError,\n\t\t\t\thasFinishedResolution,\n\t\t\t\tgetCurrentTheme,\n\t\t\t} = select( coreStore );\n\t\t\tconst { getRenderingMode, getCurrentPostType } =\n\t\t\t\tselect( editorStore );\n\n\t\t\tconst postArgs = [ 'postType', postType, postId ];\n\t\t\tconst renderingMode = getRenderingMode();\n\t\t\tconst currentPostType = getCurrentPostType();\n\t\t\tconst _isBlockTheme = getCurrentTheme()?.is_block_theme;\n\n\t\t\treturn {\n\t\t\t\tpost: getEntityRecord( ...postArgs ),\n\t\t\t\ttemplate: templateId\n\t\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\t\t\ttemplateId\n\t\t\t\t\t )\n\t\t\t\t\t: undefined,\n\t\t\t\thasLoadedPost: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecord',\n\t\t\t\t\tpostArgs\n\t\t\t\t),\n\t\t\t\terror: getResolutionError( 'getEntityRecord', postArgs )\n\t\t\t\t\t?.message,\n\t\t\t\tisBlockTheme: _isBlockTheme,\n\t\t\t\tshowGlobalStyles:\n\t\t\t\t\t_isBlockTheme &&\n\t\t\t\t\t( currentPostType === 'wp_template' ||\n\t\t\t\t\t\trenderingMode === 'template-locked' ),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId, templateId ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ hasLoadedPost && ! post && (\n\t\t\t\t<Notice\n\t\t\t\t\tstatus={ !! error ? 'error' : 'warning' }\n\t\t\t\t\tisDismissible={ false }\n\t\t\t\t>\n\t\t\t\t\t{ ! error\n\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: error }\n\t\t\t\t</Notice>\n\t\t\t) }\n\t\t\t{ !! post && (\n\t\t\t\t<ExperimentalEditorProvider\n\t\t\t\t\tpost={ post }\n\t\t\t\t\t__unstableTemplate={ template }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t>\n\t\t\t\t\t<EditorInterface { ...props }>\n\t\t\t\t\t\t{ extraContent }\n\t\t\t\t\t</EditorInterface>\n\t\t\t\t\t{ children }\n\t\t\t\t\t<NotesSidebar />\n\t\t\t\t\t<Sidebar\n\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\textraPanels={ extraSidebarPanels }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isBlockTheme && <GlobalStylesRenderer /> }\n\t\t\t\t\t{ showGlobalStyles && <GlobalStylesSidebar /> }\n\t\t\t\t</ExperimentalEditorProvider>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Editor;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsFE;AAnFF,kBAA0B;AAC1B,uBAAmC;AACnC,wBAAuB;AACvB,kBAAmB;AAKnB,mBAAqC;AACrC,uBAAmC;AACnC,8BAA4B;AAC5B,sBAA2C;AAC3C,qBAAoB;AACpB,4BAAyB;AACzB,mCAAgC;AAChC,oCAAqC;AAErC,SAAS,OAAQ;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAGA;AAAA;AAAA;AAAA,EAIA;AAAA,EACA;AAAA,EACA,GAAG;AACJ,GAAI;AACH,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,QAAI;AAAA,IACH,CAAE,WAAY;AACb,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD,IAAI,OAAQ,iBAAAA,KAAU;AACtB,YAAM,EAAE,kBAAkB,mBAAmB,IAC5C,OAAQ,aAAAC,KAAY;AAErB,YAAM,WAAW,CAAE,YAAY,UAAU,MAAO;AAChD,YAAM,gBAAgB,iBAAiB;AACvC,YAAM,kBAAkB,mBAAmB;AAC3C,YAAM,gBAAgB,gBAAgB,GAAG;AAEzC,aAAO;AAAA,QACN,MAAM,gBAAiB,GAAG,QAAS;AAAA,QACnC,UAAU,aACP;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACA,IACA;AAAA,QACH,eAAe;AAAA,UACd;AAAA,UACA;AAAA,QACD;AAAA,QACA,OAAO,mBAAoB,mBAAmB,QAAS,GACpD;AAAA,QACH,cAAc;AAAA,QACd,kBACC,kBACE,oBAAoB,iBACrB,kBAAkB;AAAA,MACrB;AAAA,IACD;AAAA,IACA,CAAE,UAAU,QAAQ,UAAW;AAAA,EAChC;AAEA,SACC,4EACG;AAAA,qBAAiB,CAAE,QACpB;AAAA,MAAC;AAAA;AAAA,QACA,QAAS,CAAC,CAAE,QAAQ,UAAU;AAAA,QAC9B,eAAgB;AAAA,QAEd,WAAE,YACD;AAAA,UACA;AAAA,QACA,IACA;AAAA;AAAA,IACJ;AAAA,IAEC,CAAC,CAAE,QACJ;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA,oBAAqB;AAAA,QACrB;AAAA,QACA;AAAA,QACA,gBAAiB;AAAA,QAEjB;AAAA,sDAAC,wBAAAC,SAAA,EAAkB,GAAG,OACnB,wBACH;AAAA,UACE;AAAA,UACF,4CAAC,sBAAAC,SAAA,EAAa;AAAA,UACd;AAAA,YAAC,eAAAC;AAAA,YAAA;AAAA,cACA;AAAA,cACA,aAAc;AAAA;AAAA,UACf;AAAA,UACE,gBAAgB,4CAAC,sDAAqB;AAAA,UACtC,oBAAoB,4CAAC,6BAAAC,SAAA,EAAoB;AAAA;AAAA;AAAA,IAC5C;AAAA,KAEF;AAEF;AAEA,IAAO,iBAAQ;",
|
|
6
|
+
"names": ["coreStore", "editorStore", "EditorInterface", "NotesSidebar", "Sidebar", "GlobalStylesSidebar"]
|
|
7
7
|
}
|
|
@@ -41,6 +41,7 @@ var import_block_editor = require("@wordpress/block-editor");
|
|
|
41
41
|
var import_compose = require("@wordpress/compose");
|
|
42
42
|
var import_element = require("@wordpress/element");
|
|
43
43
|
var import_store = require("../../store");
|
|
44
|
+
var import_lock_unlock = require("../../lock-unlock");
|
|
44
45
|
var import_editor_notices = __toESM(require("../editor-notices"));
|
|
45
46
|
var import_header = __toESM(require("../header"));
|
|
46
47
|
var import_inserter_sidebar = __toESM(require("../inserter-sidebar"));
|
|
@@ -48,7 +49,7 @@ var import_list_view_sidebar = __toESM(require("../list-view-sidebar"));
|
|
|
48
49
|
var import_save_publish_panels = __toESM(require("../save-publish-panels"));
|
|
49
50
|
var import_text_editor = __toESM(require("../text-editor"));
|
|
50
51
|
var import_visual_editor = __toESM(require("../visual-editor"));
|
|
51
|
-
var
|
|
52
|
+
var import_styles_canvas = __toESM(require("../styles-canvas"));
|
|
52
53
|
const interfaceLabels = {
|
|
53
54
|
/* translators: accessibility text for the editor top bar landmark region. */
|
|
54
55
|
header: (0, import_i18n.__)("Editor top bar"),
|
|
@@ -63,7 +64,6 @@ const interfaceLabels = {
|
|
|
63
64
|
};
|
|
64
65
|
function EditorInterface({
|
|
65
66
|
className,
|
|
66
|
-
styles,
|
|
67
67
|
children,
|
|
68
68
|
forceIsDirty,
|
|
69
69
|
contentRef,
|
|
@@ -72,7 +72,6 @@ function EditorInterface({
|
|
|
72
72
|
customSaveButton,
|
|
73
73
|
customSavePanel,
|
|
74
74
|
forceDisableBlockTools,
|
|
75
|
-
title,
|
|
76
75
|
iframeProps
|
|
77
76
|
}) {
|
|
78
77
|
const {
|
|
@@ -82,10 +81,15 @@ function EditorInterface({
|
|
|
82
81
|
isDistractionFree,
|
|
83
82
|
isPreviewMode,
|
|
84
83
|
showBlockBreadcrumbs,
|
|
85
|
-
documentLabel
|
|
84
|
+
documentLabel,
|
|
85
|
+
stylesPath,
|
|
86
|
+
showStylebook
|
|
86
87
|
} = (0, import_data.useSelect)((select) => {
|
|
87
88
|
const { get } = select(import_preferences.store);
|
|
88
89
|
const { getEditorSettings, getPostTypeLabel } = select(import_store.store);
|
|
90
|
+
const { getStylesPath, getShowStylebook } = (0, import_lock_unlock.unlock)(
|
|
91
|
+
select(import_store.store)
|
|
92
|
+
);
|
|
89
93
|
const editorSettings = getEditorSettings();
|
|
90
94
|
const postTypeLabel = getPostTypeLabel();
|
|
91
95
|
let _mode = select(import_store.store).getEditorMode();
|
|
@@ -105,11 +109,14 @@ function EditorInterface({
|
|
|
105
109
|
documentLabel: (
|
|
106
110
|
// translators: Default label for the Document in the Block Breadcrumb.
|
|
107
111
|
postTypeLabel || (0, import_i18n._x)("Document", "noun, breadcrumb")
|
|
108
|
-
)
|
|
112
|
+
),
|
|
113
|
+
stylesPath: getStylesPath(),
|
|
114
|
+
showStylebook: getShowStylebook()
|
|
109
115
|
};
|
|
110
116
|
}, []);
|
|
111
117
|
const isLargeViewport = (0, import_compose.useViewportMatch)("medium");
|
|
112
118
|
const secondarySidebarLabel = isListViewOpened ? (0, import_i18n.__)("Document Overview") : (0, import_i18n.__)("Block Library");
|
|
119
|
+
const shouldShowStylesCanvas = showStylebook || stylesPath?.startsWith("/revisions");
|
|
113
120
|
const [entitiesSavedStatesCallback, setEntitiesSavedStatesCallback] = (0, import_element.useState)(false);
|
|
114
121
|
const closeEntitiesSavedStates = (0, import_element.useCallback)(
|
|
115
122
|
(arg) => {
|
|
@@ -138,8 +145,7 @@ function EditorInterface({
|
|
|
138
145
|
forceIsDirty,
|
|
139
146
|
setEntitiesSavedStatesCallback,
|
|
140
147
|
customSaveButton,
|
|
141
|
-
forceDisableBlockTools
|
|
142
|
-
title
|
|
148
|
+
forceDisableBlockTools
|
|
143
149
|
}
|
|
144
150
|
),
|
|
145
151
|
editorNotices: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_editor_notices.default, {}),
|
|
@@ -147,7 +153,7 @@ function EditorInterface({
|
|
|
147
153
|
sidebar: !isPreviewMode && !isDistractionFree && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_interface.ComplementaryArea.Slot, { scope: "core" }),
|
|
148
154
|
content: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
149
155
|
!isDistractionFree && !isPreviewMode && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_editor_notices.default, {}),
|
|
150
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
156
|
+
shouldShowStylesCanvas ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles_canvas.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
151
157
|
!isPreviewMode && mode === "text" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
152
158
|
import_text_editor.default,
|
|
153
159
|
{
|
|
@@ -158,7 +164,6 @@ function EditorInterface({
|
|
|
158
164
|
(isPreviewMode || mode === "visual") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
159
165
|
import_visual_editor.default,
|
|
160
166
|
{
|
|
161
|
-
styles,
|
|
162
167
|
contentRef,
|
|
163
168
|
disableIframe,
|
|
164
169
|
autoFocus,
|
|
@@ -166,7 +171,7 @@ function EditorInterface({
|
|
|
166
171
|
}
|
|
167
172
|
),
|
|
168
173
|
children
|
|
169
|
-
] })
|
|
174
|
+
] })
|
|
170
175
|
] }),
|
|
171
176
|
footer: !isPreviewMode && !isDistractionFree && isLargeViewport && showBlockBreadcrumbs && mode === "visual" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockBreadcrumb, { rootLabelText: documentLabel }),
|
|
172
177
|
actions: !isPreviewMode ? customSavePanel || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|