@wordpress/block-editor 17.1.0 → 17.2.1-next.v.202609171837.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 +32 -0
- package/README.md +214 -214
- package/build/autocompleters/block.cjs.map +2 -2
- package/build/components/alignment-control/ui.cjs.map +2 -2
- package/build/components/background-image-control/index.cjs +1 -1
- package/build/components/background-image-control/index.cjs.map +2 -2
- package/build/components/block-alignment-control/ui.cjs +21 -7
- package/build/components/block-alignment-control/ui.cjs.map +3 -3
- package/build/components/block-alignment-control/use-available-alignments.cjs +60 -13
- package/build/components/block-alignment-control/use-available-alignments.cjs.map +2 -2
- package/build/components/block-allowed-blocks/allowed-blocks-control.cjs.map +2 -2
- package/build/components/block-bindings/attribute-control.cjs +30 -30
- package/build/components/block-bindings/attribute-control.cjs.map +3 -3
- package/build/components/block-bindings/source-fields-list.cjs +27 -32
- package/build/components/block-bindings/source-fields-list.cjs.map +3 -3
- package/build/components/block-canvas/index.cjs.map +2 -2
- package/build/components/block-card/index.cjs +1 -2
- package/build/components/block-card/index.cjs.map +3 -3
- package/build/components/block-edit/edit.cjs.map +2 -2
- package/build/components/block-heading-level-dropdown/index.cjs.map +2 -2
- package/build/components/block-icon/index.cjs.map +2 -2
- package/build/components/block-inspector/edit-contents.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +27 -8
- package/build/components/block-inspector/index.cjs.map +3 -3
- package/build/components/block-keyboard-shortcuts/index.cjs.map +2 -2
- package/build/components/block-list/block-html.cjs +1 -12
- package/build/components/block-list/block-html.cjs.map +3 -3
- package/build/components/block-list/block.cjs +2 -4
- package/build/components/block-list/block.cjs.map +2 -2
- package/build/components/block-list/layout.cjs +1 -1
- package/build/components/block-list/layout.cjs.map +2 -2
- package/build/components/block-list/use-block-props/index.cjs.map +2 -2
- package/build/components/block-lock/modal.cjs +1 -3
- package/build/components/block-lock/modal.cjs.map +2 -2
- package/build/components/block-parent-selector/index.cjs +8 -5
- package/build/components/block-parent-selector/index.cjs.map +2 -2
- package/build/components/block-popover/index.cjs.map +2 -2
- package/build/components/block-rename/modal.cjs.map +2 -2
- package/build/components/block-settings-menu/block-settings-dropdown.cjs.map +2 -2
- package/build/components/block-styles/utils.cjs.map +2 -2
- package/build/components/block-switcher/index.cjs.map +2 -2
- package/build/components/block-toolbar/edit-section-button.cjs.map +2 -2
- package/build/components/block-toolbar/index.cjs +6 -4
- package/build/components/block-toolbar/index.cjs.map +2 -2
- package/build/components/block-toolbar/switch-section-style.cjs.map +2 -2
- package/build/components/block-variation-transforms/index.cjs +28 -18
- package/build/components/block-variation-transforms/index.cjs.map +3 -3
- package/build/components/block-visibility/modal.cjs.map +2 -2
- package/build/components/block-visibility/viewport-visibility-info.cjs.map +2 -2
- package/build/components/border-radius-control/index.cjs.map +2 -2
- package/build/components/color-palette/with-color-context.cjs.map +2 -2
- package/build/components/colors/with-colors.cjs.map +2 -2
- package/build/components/colors-gradients/control.cjs.map +2 -2
- package/build/components/contrast-checker/index.cjs.map +2 -2
- package/build/components/date-format-picker/index.cjs.map +2 -2
- package/build/components/dimensions-tool/aspect-ratio-tool.cjs.map +3 -3
- package/build/components/dimensions-tool/width-height-tool.cjs.map +2 -2
- package/build/components/font-sizes/with-font-sizes.cjs.map +2 -2
- package/build/components/global-styles/background-panel.cjs +1 -1
- package/build/components/global-styles/background-panel.cjs.map +2 -2
- package/build/components/global-styles/border-panel.cjs +1 -1
- package/build/components/global-styles/border-panel.cjs.map +2 -2
- package/build/components/global-styles/color-gradient-dropdown-item.cjs +1 -1
- package/build/components/global-styles/color-gradient-dropdown-item.cjs.map +2 -2
- package/build/components/global-styles/color-panel.cjs +1 -1
- package/build/components/global-styles/color-panel.cjs.map +2 -2
- package/build/components/global-styles/dimensions-panel.cjs +1 -1
- package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
- package/build/components/global-styles/filters-panel.cjs +1 -1
- package/build/components/global-styles/filters-panel.cjs.map +2 -2
- package/build/components/global-styles/hooks.cjs +1 -0
- package/build/components/global-styles/hooks.cjs.map +2 -2
- package/build/components/global-styles/inheritance/index.cjs +3 -3
- package/build/components/global-styles/inheritance/index.cjs.map +2 -2
- package/build/components/global-styles/inherited-value-context.cjs +0 -5
- package/build/components/global-styles/inherited-value-context.cjs.map +2 -2
- package/build/components/global-styles/state-control-badges.cjs +0 -1
- package/build/components/global-styles/state-control-badges.cjs.map +2 -2
- package/build/components/global-styles/state-control.cjs +6 -4
- package/build/components/global-styles/state-control.cjs.map +2 -2
- package/build/components/global-styles/text-shadow-panel.cjs +254 -0
- package/build/components/global-styles/text-shadow-panel.cjs.map +7 -0
- package/build/components/global-styles/typography-panel.cjs +46 -5
- package/build/components/global-styles/typography-panel.cjs.map +2 -2
- package/build/components/global-styles/typography-utils.cjs.map +2 -2
- package/build/components/global-styles/utils.cjs.map +2 -2
- package/build/components/html-element-control/index.cjs.map +3 -3
- package/build/components/iframe/index.cjs.map +2 -2
- package/build/components/iframe/use-scale-canvas.cjs.map +2 -2
- package/build/components/image-size-control/index.cjs.map +3 -3
- package/build/components/inner-blocks/index.cjs +6 -1
- package/build/components/inner-blocks/index.cjs.map +2 -2
- package/build/components/inner-content/index.cjs.map +2 -2
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.cjs +4 -23
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.cjs.map +2 -2
- package/build/components/inserter/block-patterns-tab/utils.cjs +26 -0
- package/build/components/inserter/block-patterns-tab/utils.cjs.map +2 -2
- package/build/components/inserter/hooks/use-block-types-state.cjs.map +2 -2
- package/build/components/inserter/hooks/use-insertion-point.cjs.map +2 -2
- package/build/components/inserter/hooks/use-patterns-state.cjs.map +2 -2
- package/build/components/inserter/media-tab/media-panel.cjs.map +2 -2
- package/build/components/inserter/media-tab/media-preview.cjs.map +2 -2
- package/build/components/inserter-list-item/index.cjs.map +2 -2
- package/build/components/inspector-controls/list-view-content-popover.cjs.map +2 -2
- package/build/components/link-control/search-results.cjs.map +2 -2
- package/build/components/link-control/use-search-handler.cjs +3 -0
- package/build/components/link-control/use-search-handler.cjs.map +2 -2
- package/build/components/list-view/branch.cjs.map +2 -2
- package/build/components/list-view/drop-indicator.cjs.map +2 -2
- package/build/components/list-view/index.cjs.map +2 -2
- package/build/components/list-view/use-list-view-drop-zone.cjs.map +2 -2
- package/build/components/list-view/utils.cjs.map +2 -2
- package/build/components/media-replace-flow/index.cjs +4 -1
- package/build/components/media-replace-flow/index.cjs.map +2 -2
- package/build/components/plain-text/index.cjs +1 -2
- package/build/components/plain-text/index.cjs.map +3 -3
- package/build/components/preset-input-control/index.cjs.map +2 -2
- package/build/components/provider/index.cjs +3 -1
- package/build/components/provider/index.cjs.map +2 -2
- package/build/components/provider/use-block-sync.cjs.map +2 -2
- package/build/components/publish-date-time-picker/index.cjs.map +2 -2
- package/build/components/resizable-box-popover/index.cjs +1 -1
- package/build/components/resizable-box-popover/index.cjs.map +1 -1
- package/build/components/resolution-tool/index.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/enter.cjs +8 -22
- package/build/components/rich-text/event-listeners/enter.cjs.map +2 -2
- package/build/components/rich-text/format-edit.cjs.map +2 -2
- package/build/components/rich-text/index.cjs +20 -0
- package/build/components/rich-text/index.cjs.map +2 -2
- package/build/components/rich-text/multiline.cjs +10 -2
- package/build/components/rich-text/multiline.cjs.map +2 -2
- package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.cjs.map +2 -2
- package/build/components/typewriter/index.cjs.map +2 -2
- package/build/components/use-block-commands/index.cjs.map +2 -2
- package/build/components/writing-flow/index.cjs +3 -0
- package/build/components/writing-flow/index.cjs.map +2 -2
- package/build/components/writing-flow/use-clipboard-handler.cjs.map +2 -2
- package/build/components/writing-flow/use-selection-observer.cjs +5 -3
- package/build/components/writing-flow/use-selection-observer.cjs.map +2 -2
- package/build/hooks/align.cjs +3 -5
- package/build/hooks/align.cjs.map +2 -2
- package/build/hooks/background.cjs.map +2 -2
- package/build/hooks/block-bindings.cjs.map +2 -2
- package/build/hooks/border.cjs.map +2 -2
- package/build/hooks/contrast-checker.cjs.map +2 -2
- package/build/hooks/dimensions.cjs.map +2 -2
- package/build/hooks/duotone.cjs.map +2 -2
- package/build/hooks/elements.cjs.map +2 -2
- package/build/hooks/fit-text.cjs.map +2 -2
- package/build/hooks/gap.cjs +2 -1
- package/build/hooks/gap.cjs.map +3 -3
- package/build/hooks/index.cjs +4 -2
- package/build/hooks/index.cjs.map +3 -3
- package/build/hooks/layout-child.cjs.map +2 -2
- package/build/hooks/layout.cjs +15 -14
- package/build/hooks/layout.cjs.map +3 -3
- package/build/hooks/position.cjs +3 -31
- package/build/hooks/position.cjs.map +2 -2
- package/build/hooks/states.cjs +3 -2
- package/build/hooks/states.cjs.map +2 -2
- package/build/hooks/text-shadow.cjs +100 -0
- package/build/hooks/text-shadow.cjs.map +7 -0
- package/build/hooks/typography.cjs +30 -6
- package/build/hooks/typography.cjs.map +2 -2
- package/build/hooks/utils.cjs +24 -2
- package/build/hooks/utils.cjs.map +2 -2
- package/build/layouts/grid.cjs.map +2 -2
- package/build/layouts/utils.cjs +7 -2
- package/build/layouts/utils.cjs.map +2 -2
- package/build/private-apis.cjs +9 -6
- package/build/private-apis.cjs.map +2 -2
- package/build/store/actions.cjs +26 -4
- package/build/store/actions.cjs.map +3 -3
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs.map +2 -2
- package/build/utils/get-font-styles-and-weights.cjs.map +2 -2
- package/build/utils/transform-styles/index.cjs.map +1 -1
- package/build-module/autocompleters/block.mjs.map +2 -2
- package/build-module/components/alignment-control/ui.mjs.map +2 -2
- package/build-module/components/background-image-control/index.mjs +2 -2
- package/build-module/components/background-image-control/index.mjs.map +2 -2
- package/build-module/components/block-alignment-control/ui.mjs +21 -7
- package/build-module/components/block-alignment-control/ui.mjs.map +2 -2
- package/build-module/components/block-alignment-control/use-available-alignments.mjs +56 -13
- package/build-module/components/block-alignment-control/use-available-alignments.mjs.map +2 -2
- package/build-module/components/block-allowed-blocks/allowed-blocks-control.mjs.map +2 -2
- package/build-module/components/block-bindings/attribute-control.mjs +31 -32
- package/build-module/components/block-bindings/attribute-control.mjs.map +2 -2
- package/build-module/components/block-bindings/source-fields-list.mjs +25 -30
- package/build-module/components/block-bindings/source-fields-list.mjs.map +2 -2
- package/build-module/components/block-canvas/index.mjs.map +2 -2
- package/build-module/components/block-card/index.mjs +3 -8
- package/build-module/components/block-card/index.mjs.map +2 -2
- package/build-module/components/block-edit/edit.mjs.map +2 -2
- package/build-module/components/block-heading-level-dropdown/index.mjs.map +2 -2
- package/build-module/components/block-icon/index.mjs.map +2 -2
- package/build-module/components/block-inspector/edit-contents.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +29 -10
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-keyboard-shortcuts/index.mjs.map +2 -2
- package/build-module/components/block-list/block-html.mjs +1 -2
- package/build-module/components/block-list/block-html.mjs.map +2 -2
- package/build-module/components/block-list/block.mjs +2 -4
- package/build-module/components/block-list/block.mjs.map +2 -2
- package/build-module/components/block-list/layout.mjs +1 -1
- package/build-module/components/block-list/layout.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/index.mjs.map +2 -2
- package/build-module/components/block-lock/modal.mjs +1 -3
- package/build-module/components/block-lock/modal.mjs.map +2 -2
- package/build-module/components/block-parent-selector/index.mjs +8 -5
- package/build-module/components/block-parent-selector/index.mjs.map +2 -2
- package/build-module/components/block-popover/index.mjs.map +2 -2
- package/build-module/components/block-rename/modal.mjs.map +2 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.mjs.map +2 -2
- package/build-module/components/block-styles/utils.mjs.map +2 -2
- package/build-module/components/block-switcher/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/edit-section-button.mjs.map +2 -2
- package/build-module/components/block-toolbar/index.mjs +6 -4
- package/build-module/components/block-toolbar/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/switch-section-style.mjs.map +2 -2
- package/build-module/components/block-variation-transforms/index.mjs +30 -21
- package/build-module/components/block-variation-transforms/index.mjs.map +2 -2
- package/build-module/components/block-visibility/modal.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +2 -2
- package/build-module/components/border-radius-control/index.mjs.map +2 -2
- package/build-module/components/color-palette/with-color-context.mjs.map +2 -2
- package/build-module/components/colors/with-colors.mjs.map +2 -2
- package/build-module/components/colors-gradients/control.mjs.map +2 -2
- package/build-module/components/contrast-checker/index.mjs.map +2 -2
- package/build-module/components/date-format-picker/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs +2 -2
- package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs.map +2 -2
- package/build-module/components/dimensions-tool/width-height-tool.mjs.map +2 -2
- package/build-module/components/font-sizes/with-font-sizes.mjs.map +2 -2
- package/build-module/components/global-styles/background-panel.mjs +2 -2
- package/build-module/components/global-styles/background-panel.mjs.map +2 -2
- package/build-module/components/global-styles/border-panel.mjs +2 -2
- package/build-module/components/global-styles/border-panel.mjs.map +2 -2
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs +2 -2
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs.map +2 -2
- package/build-module/components/global-styles/color-panel.mjs +2 -2
- package/build-module/components/global-styles/color-panel.mjs.map +2 -2
- package/build-module/components/global-styles/dimensions-panel.mjs +2 -2
- package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
- package/build-module/components/global-styles/filters-panel.mjs +2 -2
- package/build-module/components/global-styles/filters-panel.mjs.map +2 -2
- package/build-module/components/global-styles/hooks.mjs +1 -0
- package/build-module/components/global-styles/hooks.mjs.map +2 -2
- package/build-module/components/global-styles/inheritance/index.mjs +2 -2
- package/build-module/components/global-styles/inheritance/index.mjs.map +2 -2
- package/build-module/components/global-styles/inherited-value-context.mjs +0 -5
- package/build-module/components/global-styles/inherited-value-context.mjs.map +2 -2
- package/build-module/components/global-styles/state-control-badges.mjs +0 -1
- package/build-module/components/global-styles/state-control-badges.mjs.map +2 -2
- package/build-module/components/global-styles/state-control.mjs +6 -4
- package/build-module/components/global-styles/state-control.mjs.map +2 -2
- package/build-module/components/global-styles/text-shadow-panel.mjs +224 -0
- package/build-module/components/global-styles/text-shadow-panel.mjs.map +7 -0
- package/build-module/components/global-styles/typography-panel.mjs +47 -6
- package/build-module/components/global-styles/typography-panel.mjs.map +2 -2
- package/build-module/components/global-styles/typography-utils.mjs.map +2 -2
- package/build-module/components/global-styles/utils.mjs.map +2 -2
- package/build-module/components/html-element-control/index.mjs +2 -2
- package/build-module/components/html-element-control/index.mjs.map +2 -2
- package/build-module/components/iframe/index.mjs.map +2 -2
- package/build-module/components/iframe/use-scale-canvas.mjs.map +2 -2
- package/build-module/components/image-size-control/index.mjs +2 -2
- package/build-module/components/image-size-control/index.mjs.map +2 -2
- package/build-module/components/inner-blocks/index.mjs +6 -1
- package/build-module/components/inner-blocks/index.mjs.map +2 -2
- package/build-module/components/inner-content/index.mjs.map +2 -2
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.mjs +6 -24
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.mjs.map +2 -2
- package/build-module/components/inserter/block-patterns-tab/utils.mjs +25 -0
- package/build-module/components/inserter/block-patterns-tab/utils.mjs.map +2 -2
- package/build-module/components/inserter/hooks/use-block-types-state.mjs.map +2 -2
- package/build-module/components/inserter/hooks/use-insertion-point.mjs.map +2 -2
- package/build-module/components/inserter/hooks/use-patterns-state.mjs.map +2 -2
- package/build-module/components/inserter/media-tab/media-panel.mjs.map +2 -2
- package/build-module/components/inserter/media-tab/media-preview.mjs.map +2 -2
- package/build-module/components/inserter-list-item/index.mjs.map +2 -2
- package/build-module/components/inspector-controls/list-view-content-popover.mjs.map +2 -2
- package/build-module/components/link-control/search-results.mjs.map +2 -2
- package/build-module/components/link-control/use-search-handler.mjs +3 -0
- package/build-module/components/link-control/use-search-handler.mjs.map +2 -2
- package/build-module/components/list-view/branch.mjs.map +2 -2
- package/build-module/components/list-view/drop-indicator.mjs.map +2 -2
- package/build-module/components/list-view/index.mjs.map +2 -2
- package/build-module/components/list-view/use-list-view-drop-zone.mjs.map +2 -2
- package/build-module/components/list-view/utils.mjs.map +2 -2
- package/build-module/components/media-replace-flow/index.mjs +4 -1
- package/build-module/components/media-replace-flow/index.mjs.map +2 -2
- package/build-module/components/plain-text/index.mjs +1 -2
- package/build-module/components/plain-text/index.mjs.map +2 -2
- package/build-module/components/preset-input-control/index.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +3 -1
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/use-block-sync.mjs.map +2 -2
- package/build-module/components/publish-date-time-picker/index.mjs.map +2 -2
- package/build-module/components/resizable-box-popover/index.mjs +1 -1
- package/build-module/components/resizable-box-popover/index.mjs.map +1 -1
- package/build-module/components/resolution-tool/index.mjs +2 -2
- package/build-module/components/resolution-tool/index.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs +8 -22
- package/build-module/components/rich-text/event-listeners/enter.mjs.map +2 -2
- package/build-module/components/rich-text/format-edit.mjs.map +2 -2
- package/build-module/components/rich-text/index.mjs +21 -0
- package/build-module/components/rich-text/index.mjs.map +2 -2
- package/build-module/components/rich-text/multiline.mjs +11 -3
- package/build-module/components/rich-text/multiline.mjs.map +2 -2
- package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.mjs.map +2 -2
- package/build-module/components/typewriter/index.mjs.map +2 -2
- package/build-module/components/use-block-commands/index.mjs.map +2 -2
- package/build-module/components/writing-flow/index.mjs +3 -0
- package/build-module/components/writing-flow/index.mjs.map +2 -2
- package/build-module/components/writing-flow/use-clipboard-handler.mjs.map +2 -2
- package/build-module/components/writing-flow/use-selection-observer.mjs +5 -3
- package/build-module/components/writing-flow/use-selection-observer.mjs.map +2 -2
- package/build-module/hooks/align.mjs +6 -6
- package/build-module/hooks/align.mjs.map +2 -2
- package/build-module/hooks/background.mjs.map +2 -2
- package/build-module/hooks/block-bindings.mjs.map +2 -2
- package/build-module/hooks/border.mjs.map +2 -2
- package/build-module/hooks/contrast-checker.mjs.map +2 -2
- package/build-module/hooks/dimensions.mjs.map +2 -2
- package/build-module/hooks/duotone.mjs.map +2 -2
- package/build-module/hooks/elements.mjs.map +2 -2
- package/build-module/hooks/fit-text.mjs.map +2 -2
- package/build-module/hooks/gap.mjs +2 -1
- package/build-module/hooks/gap.mjs.map +2 -2
- package/build-module/hooks/index.mjs +4 -2
- package/build-module/hooks/index.mjs.map +2 -2
- package/build-module/hooks/layout-child.mjs.map +2 -2
- package/build-module/hooks/layout.mjs +6 -5
- package/build-module/hooks/layout.mjs.map +2 -2
- package/build-module/hooks/position.mjs +5 -33
- package/build-module/hooks/position.mjs.map +2 -2
- package/build-module/hooks/states.mjs +3 -2
- package/build-module/hooks/states.mjs.map +2 -2
- package/build-module/hooks/text-shadow.mjs +65 -0
- package/build-module/hooks/text-shadow.mjs.map +7 -0
- package/build-module/hooks/typography.mjs +30 -6
- package/build-module/hooks/typography.mjs.map +2 -2
- package/build-module/hooks/utils.mjs +24 -2
- package/build-module/hooks/utils.mjs.map +2 -2
- package/build-module/layouts/grid.mjs.map +2 -2
- package/build-module/layouts/utils.mjs +5 -1
- package/build-module/layouts/utils.mjs.map +2 -2
- package/build-module/private-apis.mjs +6 -2
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/actions.mjs +28 -5
- package/build-module/store/actions.mjs.map +3 -3
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/get-font-styles-and-weights.mjs.map +2 -2
- package/build-module/utils/transform-styles/index.mjs.map +1 -1
- package/build-style/content-rtl.css +7 -2
- package/build-style/content.css +7 -2
- package/build-style/style-rtl.css +90 -25
- package/build-style/style.css +92 -25
- package/package.json +42 -43
- package/src/autocompleters/block.jsx +4 -4
- package/src/components/alignment-control/ui.jsx +1 -1
- package/src/components/background-image-control/index.jsx +3 -3
- package/src/components/block-alignment-control/test/index.jsdom.test.jsx +267 -0
- package/src/components/block-alignment-control/ui.jsx +47 -9
- package/src/components/block-alignment-control/use-available-alignments.js +106 -20
- package/src/components/block-allowed-blocks/allowed-blocks-control.jsx +1 -1
- package/src/components/block-bindings/attribute-control.jsx +27 -29
- package/src/components/block-bindings/source-fields-list.jsx +22 -32
- package/src/components/block-bindings/test/attribute-control.jsdom.test.jsx +115 -0
- package/src/components/block-canvas/index.jsx +1 -1
- package/src/components/block-card/index.jsx +5 -11
- package/src/components/block-card/style.scss +1 -0
- package/src/components/block-edit/edit.jsx +1 -1
- package/src/components/block-heading-level-dropdown/index.jsx +1 -1
- package/src/components/block-icon/index.jsx +1 -1
- package/src/components/block-icon/test/index.browser.test.jsx +74 -0
- package/src/components/block-inspector/edit-contents.jsx +2 -2
- package/src/components/block-inspector/index.jsx +46 -15
- package/src/components/block-inspector/style.scss +16 -0
- package/src/components/block-keyboard-shortcuts/index.jsx +2 -2
- package/src/components/block-list/block-html.jsx +2 -3
- package/src/components/block-list/block.jsx +7 -5
- package/src/components/block-list/content.scss +3 -2
- package/src/components/block-list/layout.jsx +4 -1
- package/src/components/block-list/test/layout.jsdom.test.js +40 -0
- package/src/components/block-list/use-block-props/index.js +1 -1
- package/src/components/block-lock/modal.jsx +2 -3
- package/src/components/block-lock/style.scss +1 -1
- package/src/components/block-mover/style.scss +0 -13
- package/src/components/block-parent-selector/index.jsx +12 -6
- package/src/components/block-patterns-list/style.scss +1 -1
- package/src/components/block-popover/index.jsx +1 -1
- package/src/components/block-rename/modal.jsx +3 -3
- package/src/components/block-settings-menu/block-settings-dropdown.jsx +1 -1
- package/src/components/block-styles/utils.js +1 -1
- package/src/components/block-switcher/index.jsx +3 -3
- package/src/components/block-toolbar/edit-section-button.jsx +2 -2
- package/src/components/block-toolbar/index.jsx +8 -4
- package/src/components/block-toolbar/switch-section-style.jsx +1 -1
- package/src/components/block-variation-transforms/index.jsx +24 -23
- package/src/components/block-variation-transforms/test/index.jsdom.test.jsx +93 -0
- package/src/components/block-visibility/modal.jsx +7 -7
- package/src/components/block-visibility/style.scss +1 -1
- package/src/components/block-visibility/viewport-visibility-info.jsx +5 -7
- package/src/components/border-radius-control/index.jsx +2 -2
- package/src/components/border-radius-control/test/index.jsdom.test.jsx +0 -22
- package/src/components/border-radius-control/test/select.browser.test.js +30 -0
- package/src/components/color-palette/with-color-context.jsx +1 -1
- package/src/components/colors/with-colors.jsx +1 -1
- package/src/components/colors-gradients/control.jsx +2 -2
- package/src/components/colors-gradients/test/{control.jsdom.test.jsx → control.browser.test.jsx} +6 -9
- package/src/components/contrast-checker/index.jsx +2 -2
- package/src/components/date-format-picker/index.jsx +2 -2
- package/src/components/dimensions-tool/aspect-ratio-tool.jsx +4 -4
- package/src/components/dimensions-tool/test/index.jsdom.test.jsx +17 -11
- package/src/components/dimensions-tool/width-height-tool.jsx +2 -2
- package/src/components/font-sizes/with-font-sizes.jsx +2 -3
- package/src/components/global-styles/background-panel.jsx +2 -2
- package/src/components/global-styles/border-panel.jsx +2 -2
- package/src/components/global-styles/color-gradient-dropdown-item.jsx +3 -3
- package/src/components/global-styles/color-panel.jsx +3 -3
- package/src/components/global-styles/dimensions-panel.jsx +6 -6
- package/src/components/global-styles/filters-panel.jsx +2 -2
- package/src/components/global-styles/hooks.js +1 -0
- package/src/components/global-styles/inheritance/index.jsx +9 -6
- package/src/components/global-styles/inheritance/test/{index.jsdom.test.jsx → index.browser.test.jsx} +34 -28
- package/src/components/global-styles/inherited-value-context.js +1 -9
- package/src/components/global-styles/state-control-badges.jsx +0 -1
- package/src/components/global-styles/state-control.jsx +12 -3
- package/src/components/global-styles/style.scss +68 -0
- package/src/components/global-styles/test/{color-panel.jsdom.test.jsx → color-panel.browser.test.jsx} +53 -54
- package/src/components/global-styles/test/inherited-value-context-core.jsdom.test.js +17 -26
- package/src/components/global-styles/test/{typography-panel-core.jsdom.test.jsx → typography-panel-core.browser.test.jsx} +84 -39
- package/src/components/global-styles/test/{typography-panel.jsdom.test.jsx → typography-panel.browser.test.jsx} +80 -122
- package/src/components/global-styles/text-shadow-panel.tsx +257 -0
- package/src/components/global-styles/typography-panel.jsx +52 -13
- package/src/components/global-styles/typography-utils.js +2 -2
- package/src/components/global-styles/utils.js +1 -1
- package/src/components/html-element-control/index.jsx +2 -2
- package/src/components/iframe/index.jsx +1 -1
- package/src/components/iframe/use-scale-canvas.js +1 -1
- package/src/components/image-size-control/index.jsx +2 -2
- package/src/components/inner-blocks/index.jsx +9 -1
- package/src/components/inner-content/index.jsx +1 -1
- package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +7 -33
- package/src/components/inserter/block-patterns-tab/utils.js +44 -0
- package/src/components/inserter/hooks/use-block-types-state.js +2 -2
- package/src/components/inserter/hooks/use-insertion-point.js +1 -1
- package/src/components/inserter/hooks/use-patterns-state.js +1 -1
- package/src/components/inserter/media-tab/media-panel.jsx +9 -9
- package/src/components/inserter/media-tab/media-preview.jsx +1 -1
- package/src/components/inserter-list-item/index.jsx +1 -1
- package/src/components/inserter-list-item/style.scss +2 -2
- package/src/components/inspector-controls/list-view-content-popover.jsx +1 -1
- package/src/components/link-control/search-results.jsx +1 -1
- package/src/components/link-control/style.scss +1 -1
- package/src/components/link-control/test/index.jsdom.test.jsx +38 -110
- package/src/components/link-control/test/keyboard-selection.browser.test.js +110 -0
- package/src/components/link-control/use-search-handler.js +8 -3
- package/src/components/list-view/branch.jsx +1 -1
- package/src/components/list-view/drop-indicator.jsx +3 -3
- package/src/components/list-view/index.jsx +1 -1
- package/src/components/list-view/style.scss +1 -9
- package/src/components/list-view/use-list-view-drop-zone.js +1 -1
- package/src/components/list-view/utils.js +1 -1
- package/src/components/media-replace-flow/index.jsx +4 -1
- package/src/components/navigable-toolbar/test/index.browser.test.js +6 -7
- package/src/components/plain-text/README.md +3 -2
- package/src/components/plain-text/content.scss +0 -1
- package/src/components/plain-text/index.jsx +2 -3
- package/src/components/plain-text/style.scss +4 -0
- package/src/components/preset-input-control/index.jsx +2 -2
- package/src/components/preset-input-control/test/index.jsdom.test.jsx +0 -56
- package/src/components/preset-input-control/test/interaction.browser.test.js +63 -0
- package/src/components/provider/index.jsx +5 -3
- package/src/components/provider/use-block-sync.js +5 -5
- package/src/components/publish-date-time-picker/index.jsx +1 -1
- package/src/components/resizable-box-popover/index.jsx +1 -1
- package/src/components/resolution-tool/index.jsx +2 -2
- package/src/components/responsive-block-control/style.scss +1 -2
- package/src/components/responsive-block-control/test/index.jsdom.test.jsx +2 -2
- package/src/components/rich-text/event-listeners/enter.js +16 -23
- package/src/components/rich-text/format-edit.jsx +1 -1
- package/src/components/rich-text/index.jsx +39 -2
- package/src/components/rich-text/multiline.jsx +11 -3
- package/src/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
- package/src/components/spacing-sizes-control/test/index.jsdom.test.jsx +0 -21
- package/src/components/spacing-sizes-control/test/select.browser.test.js +58 -0
- package/src/components/typewriter/index.jsx +1 -1
- package/src/components/url-input/test/fixtures/validated-input-control-deprecation.js +1 -1
- package/src/components/use-block-commands/index.js +1 -1
- package/src/components/use-block-drop-zone/test/index.js +2 -2
- package/src/components/writing-flow/index.jsx +8 -0
- package/src/components/writing-flow/use-clipboard-handler.js +1 -1
- package/src/components/writing-flow/use-selection-observer.js +15 -6
- package/src/content.scss +1 -0
- package/src/hooks/align.jsx +22 -6
- package/src/hooks/background.jsx +1 -1
- package/src/hooks/block-bindings.jsx +1 -1
- package/src/hooks/block-hooks.scss +0 -6
- package/src/hooks/border.jsx +2 -2
- package/src/hooks/contrast-checker.js +1 -1
- package/src/hooks/dimensions.jsx +2 -2
- package/src/hooks/duotone.jsx +3 -3
- package/src/hooks/elements.jsx +3 -3
- package/src/hooks/fit-text.jsx +1 -1
- package/src/hooks/gap.js +2 -4
- package/src/hooks/index.js +3 -1
- package/src/hooks/layout-child.jsx +3 -4
- package/src/hooks/layout.jsx +17 -18
- package/src/hooks/position.jsx +5 -36
- package/src/hooks/states.jsx +6 -2
- package/src/hooks/test/layout.jsdom.test.js +44 -1
- package/src/hooks/text-shadow.ts +105 -0
- package/src/hooks/typography.jsx +58 -30
- package/src/hooks/utils.jsx +23 -1
- package/src/layouts/grid.jsx +2 -2
- package/src/layouts/test/flex.jsdom.test.jsx +4 -3
- package/src/layouts/test/utils.js +48 -1
- package/src/layouts/utils.js +19 -0
- package/src/private-apis.js +4 -0
- package/src/store/actions.js +50 -10
- package/src/store/private-selectors.js +5 -5
- package/src/store/reducer.js +6 -6
- package/src/store/selectors.js +3 -3
- package/src/store/test/actions.jsdom.test.js +60 -0
- package/src/style.scss +1 -0
- package/src/utils/get-font-styles-and-weights.ts +1 -1
- package/src/utils/transform-styles/index.ts +1 -1
- package/build/hooks/cross-origin-isolation.cjs +0 -56
- package/build/hooks/cross-origin-isolation.cjs.map +0 -7
- package/build-module/hooks/cross-origin-isolation.mjs +0 -54
- package/build-module/hooks/cross-origin-isolation.mjs.map +0 -7
- package/src/components/block-icon/test/__snapshots__/index.jsdom.test.jsx.snap +0 -27
- package/src/components/block-icon/test/index.jsdom.test.jsx +0 -67
- package/src/hooks/cross-origin-isolation.js +0 -73
- package/src/hooks/test/cross-origin-isolation.jsdom.test.js +0 -173
|
@@ -6,11 +6,15 @@ import {
|
|
|
6
6
|
unregisterBlockType,
|
|
7
7
|
registerBlockType,
|
|
8
8
|
createBlock,
|
|
9
|
+
privateApis as blocksPrivateApis,
|
|
9
10
|
} from '@wordpress/blocks';
|
|
10
11
|
import * as selectors from '../selectors';
|
|
11
12
|
import reducer from '../reducer';
|
|
12
13
|
import * as actions from '../actions';
|
|
13
14
|
import { STORE_NAME as blockEditorStoreName } from '../../store/constants';
|
|
15
|
+
import { unlock } from '../../lock-unlock';
|
|
16
|
+
|
|
17
|
+
const { editableRootKey } = unlock( blocksPrivateApis );
|
|
14
18
|
|
|
15
19
|
const noop = () => {};
|
|
16
20
|
|
|
@@ -460,10 +464,12 @@ describe( 'actions', () => {
|
|
|
460
464
|
getSettings: () => null,
|
|
461
465
|
// The insertion selects the inserted block.
|
|
462
466
|
getSelectedBlockClientId: () => containerBlock.clientId,
|
|
467
|
+
getBlockName: () => 'core/test-container',
|
|
463
468
|
canInsertBlockType: () => true,
|
|
464
469
|
};
|
|
465
470
|
const dispatch = vi.fn();
|
|
466
471
|
dispatch.selectBlock = vi.fn();
|
|
472
|
+
dispatch.selectionChange = vi.fn();
|
|
467
473
|
|
|
468
474
|
insertBlocks(
|
|
469
475
|
[ containerBlock ],
|
|
@@ -484,6 +490,60 @@ describe( 'actions', () => {
|
|
|
484
490
|
);
|
|
485
491
|
} );
|
|
486
492
|
|
|
493
|
+
it( 'selects the start of an inserted editable root block text', () => {
|
|
494
|
+
registerBlockType( 'core/test-host', {
|
|
495
|
+
...defaultBlockSettings,
|
|
496
|
+
attributes: { content: { source: 'rich-text' } },
|
|
497
|
+
[ editableRootKey ]: true,
|
|
498
|
+
} );
|
|
499
|
+
|
|
500
|
+
const block = createBlock( 'core/test-host' );
|
|
501
|
+
const select = {
|
|
502
|
+
getSettings: () => null,
|
|
503
|
+
getSelectedBlockClientId: () => block.clientId,
|
|
504
|
+
getBlockName: () => 'core/test-host',
|
|
505
|
+
canInsertBlockType: () => true,
|
|
506
|
+
};
|
|
507
|
+
const dispatch = vi.fn();
|
|
508
|
+
dispatch.selectionChange = vi.fn();
|
|
509
|
+
|
|
510
|
+
insertBlocks(
|
|
511
|
+
[ block ],
|
|
512
|
+
0,
|
|
513
|
+
undefined,
|
|
514
|
+
true,
|
|
515
|
+
0
|
|
516
|
+
)( {
|
|
517
|
+
select,
|
|
518
|
+
dispatch,
|
|
519
|
+
registry: { batch: ( fn ) => fn() },
|
|
520
|
+
} );
|
|
521
|
+
|
|
522
|
+
expect( dispatch.selectionChange ).toHaveBeenCalledWith(
|
|
523
|
+
block.clientId,
|
|
524
|
+
'content',
|
|
525
|
+
0,
|
|
526
|
+
0
|
|
527
|
+
);
|
|
528
|
+
|
|
529
|
+
// A block that does not opt in is left to place its own caret,
|
|
530
|
+
// since the store cannot know which field it focuses.
|
|
531
|
+
dispatch.selectionChange.mockClear();
|
|
532
|
+
select.getBlockName = () => 'core/test-item';
|
|
533
|
+
registerBlockType( 'core/test-item', {
|
|
534
|
+
...defaultBlockSettings,
|
|
535
|
+
attributes: { content: { source: 'rich-text' } },
|
|
536
|
+
} );
|
|
537
|
+
insertBlocks(
|
|
538
|
+
[ createBlock( 'core/test-item' ) ],
|
|
539
|
+
0,
|
|
540
|
+
undefined,
|
|
541
|
+
true,
|
|
542
|
+
0
|
|
543
|
+
)( { select, dispatch, registry: { batch: ( fn ) => fn() } } );
|
|
544
|
+
expect( dispatch.selectionChange ).not.toHaveBeenCalled();
|
|
545
|
+
} );
|
|
546
|
+
|
|
487
547
|
it( 'should not apply block type templates to blocks with inner blocks', () => {
|
|
488
548
|
registerBlockType( 'core/test-container', {
|
|
489
549
|
...defaultBlockSettings,
|
package/src/style.scss
CHANGED
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
@use "./components/media-placeholder/style.scss" as *;
|
|
52
52
|
@use "./components/media-replace-flow/style.scss" as *;
|
|
53
53
|
@use "./components/multi-selection-inspector/style.scss" as *;
|
|
54
|
+
@use "./components/plain-text/style.scss" as *;
|
|
54
55
|
@use "./components/responsive-block-control/style.scss" as *;
|
|
55
56
|
@use "./components/preset-input-control/style.scss" as *;
|
|
56
57
|
@use "./components/rich-text/style.scss" as *;
|
|
@@ -136,7 +136,7 @@ function transformStyle(
|
|
|
136
136
|
},
|
|
137
137
|
} ),
|
|
138
138
|
baseURL && rebaseUrl( { rootUrl: baseURL } ),
|
|
139
|
-
].filter( Boolean ) as import('postcss').AcceptedPlugin[]
|
|
139
|
+
].filter( Boolean ) as import( 'postcss' ).AcceptedPlugin[]
|
|
140
140
|
).process( css, {} ).css; // use sync PostCSS API
|
|
141
141
|
} catch ( error ) {
|
|
142
142
|
if ( error instanceof CssSyntaxError ) {
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
// packages/block-editor/src/hooks/cross-origin-isolation.js
|
|
4
|
-
function addCrossOriginAttribute(el) {
|
|
5
|
-
if (!el.hasAttribute("crossorigin")) {
|
|
6
|
-
el.setAttribute("crossorigin", "anonymous");
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
if (window.crossOriginIsolated) {
|
|
10
|
-
let startObservingBody = function() {
|
|
11
|
-
if (document.body) {
|
|
12
|
-
observer.observe(document.body, {
|
|
13
|
-
childList: true,
|
|
14
|
-
attributes: true,
|
|
15
|
-
subtree: true
|
|
16
|
-
});
|
|
17
|
-
} else if (document.readyState === "loading") {
|
|
18
|
-
document.addEventListener("DOMContentLoaded", () => {
|
|
19
|
-
if (document.body) {
|
|
20
|
-
observer.observe(document.body, {
|
|
21
|
-
childList: true,
|
|
22
|
-
attributes: true,
|
|
23
|
-
subtree: true
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
startObservingBody2 = startObservingBody;
|
|
30
|
-
const observer = new window.MutationObserver((mutations) => {
|
|
31
|
-
mutations.forEach((mutation) => {
|
|
32
|
-
[mutation.addedNodes, mutation.target].forEach((value) => {
|
|
33
|
-
const nodes = value instanceof window.NodeList ? value : [value];
|
|
34
|
-
nodes.forEach((node) => {
|
|
35
|
-
const el = node;
|
|
36
|
-
if (!el.querySelectorAll) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
el.querySelectorAll("source,script,video,link").forEach(
|
|
40
|
-
(v) => {
|
|
41
|
-
addCrossOriginAttribute(v);
|
|
42
|
-
}
|
|
43
|
-
);
|
|
44
|
-
if (["SOURCE", "SCRIPT", "VIDEO", "LINK"].includes(
|
|
45
|
-
el.nodeName
|
|
46
|
-
)) {
|
|
47
|
-
addCrossOriginAttribute(el);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
startObservingBody();
|
|
54
|
-
}
|
|
55
|
-
var startObservingBody2;
|
|
56
|
-
//# sourceMappingURL=cross-origin-isolation.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/hooks/cross-origin-isolation.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Adds crossorigin=\"anonymous\" to an element if missing.\n *\n * @param {Element} el The element to modify.\n */\nfunction addCrossOriginAttribute( el ) {\n\tif ( ! el.hasAttribute( 'crossorigin' ) ) {\n\t\tel.setAttribute( 'crossorigin', 'anonymous' );\n\t}\n}\n\n// Only add the mutation observer if the site is cross-origin isolated.\nif ( window.crossOriginIsolated ) {\n\t/*\n\t * Detects dynamically added DOM nodes that are missing the `crossorigin` attribute.\n\t */\n\tconst observer = new window.MutationObserver( ( mutations ) => {\n\t\tmutations.forEach( ( mutation ) => {\n\t\t\t[ mutation.addedNodes, mutation.target ].forEach( ( value ) => {\n\t\t\t\tconst nodes =\n\t\t\t\t\tvalue instanceof window.NodeList ? value : [ value ];\n\t\t\t\tnodes.forEach( ( node ) => {\n\t\t\t\t\tconst el = node;\n\n\t\t\t\t\tif ( ! el.querySelectorAll ) {\n\t\t\t\t\t\t// Most likely a text node.\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tel.querySelectorAll( 'source,script,video,link' ).forEach(\n\t\t\t\t\t\t( v ) => {\n\t\t\t\t\t\t\taddCrossOriginAttribute( v );\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t[ 'SOURCE', 'SCRIPT', 'VIDEO', 'LINK' ].includes(\n\t\t\t\t\t\t\tel.nodeName\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\taddCrossOriginAttribute( el );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} );\n\t\t} );\n\t} );\n\n\t/**\n\t * Start observing the document body, waiting for it to be available if needed.\n\t */\n\tfunction startObservingBody() {\n\t\tif ( document.body ) {\n\t\t\tobserver.observe( document.body, {\n\t\t\t\tchildList: true,\n\t\t\t\tattributes: true,\n\t\t\t\tsubtree: true,\n\t\t\t} );\n\t\t} else if ( document.readyState === 'loading' ) {\n\t\t\t// Wait for DOM to be ready.\n\t\t\tdocument.addEventListener( 'DOMContentLoaded', () => {\n\t\t\t\tif ( document.body ) {\n\t\t\t\t\tobserver.observe( document.body, {\n\t\t\t\t\t\tchildList: true,\n\t\t\t\t\t\tattributes: true,\n\t\t\t\t\t\tsubtree: true,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t}\n\n\tstartObservingBody();\n}\n"],
|
|
5
|
-
"mappings": ";;;AAKA,SAAS,wBAAyB,IAAK;AACtC,MAAK,CAAE,GAAG,aAAc,aAAc,GAAI;AACzC,OAAG,aAAc,eAAe,WAAY;AAAA,EAC7C;AACD;AAGA,IAAK,OAAO,qBAAsB;AAsCjC,MAAS,qBAAT,WAA8B;AAC7B,QAAK,SAAS,MAAO;AACpB,eAAS,QAAS,SAAS,MAAM;AAAA,QAChC,WAAW;AAAA,QACX,YAAY;AAAA,QACZ,SAAS;AAAA,MACV,CAAE;AAAA,IACH,WAAY,SAAS,eAAe,WAAY;AAE/C,eAAS,iBAAkB,oBAAoB,MAAM;AACpD,YAAK,SAAS,MAAO;AACpB,mBAAS,QAAS,SAAS,MAAM;AAAA,YAChC,WAAW;AAAA,YACX,YAAY;AAAA,YACZ,SAAS;AAAA,UACV,CAAE;AAAA,QACH;AAAA,MACD,CAAE;AAAA,IACH;AAAA,EACD;AAnBS,EAAAA,sBAAA;AAlCT,QAAM,WAAW,IAAI,OAAO,iBAAkB,CAAE,cAAe;AAC9D,cAAU,QAAS,CAAE,aAAc;AAClC,OAAE,SAAS,YAAY,SAAS,MAAO,EAAE,QAAS,CAAE,UAAW;AAC9D,cAAM,QACL,iBAAiB,OAAO,WAAW,QAAQ,CAAE,KAAM;AACpD,cAAM,QAAS,CAAE,SAAU;AAC1B,gBAAM,KAAK;AAEX,cAAK,CAAE,GAAG,kBAAmB;AAE5B;AAAA,UACD;AAEA,aAAG,iBAAkB,0BAA2B,EAAE;AAAA,YACjD,CAAE,MAAO;AACR,sCAAyB,CAAE;AAAA,YAC5B;AAAA,UACD;AAEA,cACC,CAAE,UAAU,UAAU,SAAS,MAAO,EAAE;AAAA,YACvC,GAAG;AAAA,UACJ,GACC;AACD,oCAAyB,EAAG;AAAA,UAC7B;AAAA,QACD,CAAE;AAAA,MACH,CAAE;AAAA,IACH,CAAE;AAAA,EACH,CAAE;AA0BF,qBAAmB;AACpB;AAtBU,IAAAA;",
|
|
6
|
-
"names": ["startObservingBody"]
|
|
7
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// packages/block-editor/src/hooks/cross-origin-isolation.js
|
|
2
|
-
function addCrossOriginAttribute(el) {
|
|
3
|
-
if (!el.hasAttribute("crossorigin")) {
|
|
4
|
-
el.setAttribute("crossorigin", "anonymous");
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
if (window.crossOriginIsolated) {
|
|
8
|
-
let startObservingBody = function() {
|
|
9
|
-
if (document.body) {
|
|
10
|
-
observer.observe(document.body, {
|
|
11
|
-
childList: true,
|
|
12
|
-
attributes: true,
|
|
13
|
-
subtree: true
|
|
14
|
-
});
|
|
15
|
-
} else if (document.readyState === "loading") {
|
|
16
|
-
document.addEventListener("DOMContentLoaded", () => {
|
|
17
|
-
if (document.body) {
|
|
18
|
-
observer.observe(document.body, {
|
|
19
|
-
childList: true,
|
|
20
|
-
attributes: true,
|
|
21
|
-
subtree: true
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
startObservingBody2 = startObservingBody;
|
|
28
|
-
const observer = new window.MutationObserver((mutations) => {
|
|
29
|
-
mutations.forEach((mutation) => {
|
|
30
|
-
[mutation.addedNodes, mutation.target].forEach((value) => {
|
|
31
|
-
const nodes = value instanceof window.NodeList ? value : [value];
|
|
32
|
-
nodes.forEach((node) => {
|
|
33
|
-
const el = node;
|
|
34
|
-
if (!el.querySelectorAll) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
el.querySelectorAll("source,script,video,link").forEach(
|
|
38
|
-
(v) => {
|
|
39
|
-
addCrossOriginAttribute(v);
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
if (["SOURCE", "SCRIPT", "VIDEO", "LINK"].includes(
|
|
43
|
-
el.nodeName
|
|
44
|
-
)) {
|
|
45
|
-
addCrossOriginAttribute(el);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
startObservingBody();
|
|
52
|
-
}
|
|
53
|
-
var startObservingBody2;
|
|
54
|
-
//# sourceMappingURL=cross-origin-isolation.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/hooks/cross-origin-isolation.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Adds crossorigin=\"anonymous\" to an element if missing.\n *\n * @param {Element} el The element to modify.\n */\nfunction addCrossOriginAttribute( el ) {\n\tif ( ! el.hasAttribute( 'crossorigin' ) ) {\n\t\tel.setAttribute( 'crossorigin', 'anonymous' );\n\t}\n}\n\n// Only add the mutation observer if the site is cross-origin isolated.\nif ( window.crossOriginIsolated ) {\n\t/*\n\t * Detects dynamically added DOM nodes that are missing the `crossorigin` attribute.\n\t */\n\tconst observer = new window.MutationObserver( ( mutations ) => {\n\t\tmutations.forEach( ( mutation ) => {\n\t\t\t[ mutation.addedNodes, mutation.target ].forEach( ( value ) => {\n\t\t\t\tconst nodes =\n\t\t\t\t\tvalue instanceof window.NodeList ? value : [ value ];\n\t\t\t\tnodes.forEach( ( node ) => {\n\t\t\t\t\tconst el = node;\n\n\t\t\t\t\tif ( ! el.querySelectorAll ) {\n\t\t\t\t\t\t// Most likely a text node.\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tel.querySelectorAll( 'source,script,video,link' ).forEach(\n\t\t\t\t\t\t( v ) => {\n\t\t\t\t\t\t\taddCrossOriginAttribute( v );\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t[ 'SOURCE', 'SCRIPT', 'VIDEO', 'LINK' ].includes(\n\t\t\t\t\t\t\tel.nodeName\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\taddCrossOriginAttribute( el );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} );\n\t\t} );\n\t} );\n\n\t/**\n\t * Start observing the document body, waiting for it to be available if needed.\n\t */\n\tfunction startObservingBody() {\n\t\tif ( document.body ) {\n\t\t\tobserver.observe( document.body, {\n\t\t\t\tchildList: true,\n\t\t\t\tattributes: true,\n\t\t\t\tsubtree: true,\n\t\t\t} );\n\t\t} else if ( document.readyState === 'loading' ) {\n\t\t\t// Wait for DOM to be ready.\n\t\t\tdocument.addEventListener( 'DOMContentLoaded', () => {\n\t\t\t\tif ( document.body ) {\n\t\t\t\t\tobserver.observe( document.body, {\n\t\t\t\t\t\tchildList: true,\n\t\t\t\t\t\tattributes: true,\n\t\t\t\t\t\tsubtree: true,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t}\n\n\tstartObservingBody();\n}\n"],
|
|
5
|
-
"mappings": ";AAKA,SAAS,wBAAyB,IAAK;AACtC,MAAK,CAAE,GAAG,aAAc,aAAc,GAAI;AACzC,OAAG,aAAc,eAAe,WAAY;AAAA,EAC7C;AACD;AAGA,IAAK,OAAO,qBAAsB;AAsCjC,MAAS,qBAAT,WAA8B;AAC7B,QAAK,SAAS,MAAO;AACpB,eAAS,QAAS,SAAS,MAAM;AAAA,QAChC,WAAW;AAAA,QACX,YAAY;AAAA,QACZ,SAAS;AAAA,MACV,CAAE;AAAA,IACH,WAAY,SAAS,eAAe,WAAY;AAE/C,eAAS,iBAAkB,oBAAoB,MAAM;AACpD,YAAK,SAAS,MAAO;AACpB,mBAAS,QAAS,SAAS,MAAM;AAAA,YAChC,WAAW;AAAA,YACX,YAAY;AAAA,YACZ,SAAS;AAAA,UACV,CAAE;AAAA,QACH;AAAA,MACD,CAAE;AAAA,IACH;AAAA,EACD;AAnBS,EAAAA,sBAAA;AAlCT,QAAM,WAAW,IAAI,OAAO,iBAAkB,CAAE,cAAe;AAC9D,cAAU,QAAS,CAAE,aAAc;AAClC,OAAE,SAAS,YAAY,SAAS,MAAO,EAAE,QAAS,CAAE,UAAW;AAC9D,cAAM,QACL,iBAAiB,OAAO,WAAW,QAAQ,CAAE,KAAM;AACpD,cAAM,QAAS,CAAE,SAAU;AAC1B,gBAAM,KAAK;AAEX,cAAK,CAAE,GAAG,kBAAmB;AAE5B;AAAA,UACD;AAEA,aAAG,iBAAkB,0BAA2B,EAAE;AAAA,YACjD,CAAE,MAAO;AACR,sCAAyB,CAAE;AAAA,YAC5B;AAAA,UACD;AAEA,cACC,CAAE,UAAU,UAAU,SAAS,MAAO,EAAE;AAAA,YACvC,GAAG;AAAA,UACJ,GACC;AACD,oCAAyB,EAAG;AAAA,UAC7B;AAAA,QACD,CAAE;AAAA,MACH,CAAE;AAAA,IACH,CAAE;AAAA,EACH,CAAE;AA0BF,qBAAmB;AACpB;AAtBU,IAAAA;",
|
|
6
|
-
"names": ["startObservingBody"]
|
|
7
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
|
-
|
|
3
|
-
exports[`BlockIcon renders a Icon 1`] = `
|
|
4
|
-
<div>
|
|
5
|
-
<span
|
|
6
|
-
class="block-editor-block-icon"
|
|
7
|
-
>
|
|
8
|
-
<svg
|
|
9
|
-
aria-hidden="true"
|
|
10
|
-
focusable="false"
|
|
11
|
-
height="24"
|
|
12
|
-
stroke="currentColor"
|
|
13
|
-
stroke-width="1.5"
|
|
14
|
-
style="fill: none;"
|
|
15
|
-
viewBox="0 0 24 24"
|
|
16
|
-
width="24"
|
|
17
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
18
|
-
>
|
|
19
|
-
<path
|
|
20
|
-
d="M3.75 16.2031L8.6 12.7L12 15L16 11L20.25 15.2517M5 20.25H19C19.6904 20.25 20.25 19.6904 20.25 19V5C20.25 4.30964 19.6904 3.75 19 3.75H5C4.30964 3.75 3.75 4.30964 3.75 5V19C3.75 19.6904 4.30964 20.25 5 20.25Z"
|
|
21
|
-
stroke-linejoin="round"
|
|
22
|
-
vector-effect="non-scaling-stroke"
|
|
23
|
-
/>
|
|
24
|
-
</svg>
|
|
25
|
-
</span>
|
|
26
|
-
</div>
|
|
27
|
-
`;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/react';
|
|
2
|
-
import { image } from '@wordpress/icons';
|
|
3
|
-
import BlockIcon from '../';
|
|
4
|
-
|
|
5
|
-
function getIconWrapper( container ) {
|
|
6
|
-
return container.firstChild;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
describe( 'BlockIcon', () => {
|
|
10
|
-
it( 'renders a Icon', () => {
|
|
11
|
-
const { container } = render( <BlockIcon icon={ image } /> );
|
|
12
|
-
|
|
13
|
-
expect( container ).toMatchSnapshot();
|
|
14
|
-
} );
|
|
15
|
-
|
|
16
|
-
it( 'renders a span without the has-colors classname', () => {
|
|
17
|
-
const { container } = render( <BlockIcon icon={ image } /> );
|
|
18
|
-
|
|
19
|
-
expect( getIconWrapper( container ) ).not.toHaveClass( 'has-colors' );
|
|
20
|
-
} );
|
|
21
|
-
|
|
22
|
-
it( 'renders a span with the has-colors classname', () => {
|
|
23
|
-
const { container } = render( <BlockIcon icon={ image } showColors /> );
|
|
24
|
-
|
|
25
|
-
expect( getIconWrapper( container ) ).toHaveClass( 'has-colors' );
|
|
26
|
-
} );
|
|
27
|
-
|
|
28
|
-
it( 'supports adding a className to the wrapper', () => {
|
|
29
|
-
const { container } = render(
|
|
30
|
-
<BlockIcon icon={ image } className="foo-bar" />
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
expect( getIconWrapper( container ) ).toHaveClass( 'foo-bar' );
|
|
34
|
-
} );
|
|
35
|
-
|
|
36
|
-
it( 'skips adding background and foreground styles when colors are not enabled', () => {
|
|
37
|
-
const { container } = render(
|
|
38
|
-
<BlockIcon
|
|
39
|
-
icon={ {
|
|
40
|
-
background: 'white',
|
|
41
|
-
foreground: 'black',
|
|
42
|
-
src: 'image',
|
|
43
|
-
} }
|
|
44
|
-
/>
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
expect( getIconWrapper( container ) ).not.toHaveAttribute( 'style' );
|
|
48
|
-
} );
|
|
49
|
-
|
|
50
|
-
it( 'adds background and foreground styles when colors are enabled', () => {
|
|
51
|
-
const { container } = render(
|
|
52
|
-
<BlockIcon
|
|
53
|
-
icon={ {
|
|
54
|
-
background: 'white',
|
|
55
|
-
foreground: 'black',
|
|
56
|
-
src: 'image',
|
|
57
|
-
} }
|
|
58
|
-
showColors
|
|
59
|
-
/>
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
expect( getIconWrapper( container ) ).toHaveStyle( {
|
|
63
|
-
backgroundColor: 'rgb(255, 255, 255)',
|
|
64
|
-
color: 'rgb(0, 0, 0)',
|
|
65
|
-
} );
|
|
66
|
-
} );
|
|
67
|
-
} );
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adds crossorigin="anonymous" to an element if missing.
|
|
3
|
-
*
|
|
4
|
-
* @param {Element} el The element to modify.
|
|
5
|
-
*/
|
|
6
|
-
function addCrossOriginAttribute( el ) {
|
|
7
|
-
if ( ! el.hasAttribute( 'crossorigin' ) ) {
|
|
8
|
-
el.setAttribute( 'crossorigin', 'anonymous' );
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// Only add the mutation observer if the site is cross-origin isolated.
|
|
13
|
-
if ( window.crossOriginIsolated ) {
|
|
14
|
-
/*
|
|
15
|
-
* Detects dynamically added DOM nodes that are missing the `crossorigin` attribute.
|
|
16
|
-
*/
|
|
17
|
-
const observer = new window.MutationObserver( ( mutations ) => {
|
|
18
|
-
mutations.forEach( ( mutation ) => {
|
|
19
|
-
[ mutation.addedNodes, mutation.target ].forEach( ( value ) => {
|
|
20
|
-
const nodes =
|
|
21
|
-
value instanceof window.NodeList ? value : [ value ];
|
|
22
|
-
nodes.forEach( ( node ) => {
|
|
23
|
-
const el = node;
|
|
24
|
-
|
|
25
|
-
if ( ! el.querySelectorAll ) {
|
|
26
|
-
// Most likely a text node.
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
el.querySelectorAll( 'source,script,video,link' ).forEach(
|
|
31
|
-
( v ) => {
|
|
32
|
-
addCrossOriginAttribute( v );
|
|
33
|
-
}
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
if (
|
|
37
|
-
[ 'SOURCE', 'SCRIPT', 'VIDEO', 'LINK' ].includes(
|
|
38
|
-
el.nodeName
|
|
39
|
-
)
|
|
40
|
-
) {
|
|
41
|
-
addCrossOriginAttribute( el );
|
|
42
|
-
}
|
|
43
|
-
} );
|
|
44
|
-
} );
|
|
45
|
-
} );
|
|
46
|
-
} );
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Start observing the document body, waiting for it to be available if needed.
|
|
50
|
-
*/
|
|
51
|
-
function startObservingBody() {
|
|
52
|
-
if ( document.body ) {
|
|
53
|
-
observer.observe( document.body, {
|
|
54
|
-
childList: true,
|
|
55
|
-
attributes: true,
|
|
56
|
-
subtree: true,
|
|
57
|
-
} );
|
|
58
|
-
} else if ( document.readyState === 'loading' ) {
|
|
59
|
-
// Wait for DOM to be ready.
|
|
60
|
-
document.addEventListener( 'DOMContentLoaded', () => {
|
|
61
|
-
if ( document.body ) {
|
|
62
|
-
observer.observe( document.body, {
|
|
63
|
-
childList: true,
|
|
64
|
-
attributes: true,
|
|
65
|
-
subtree: true,
|
|
66
|
-
} );
|
|
67
|
-
}
|
|
68
|
-
} );
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
startObservingBody();
|
|
73
|
-
}
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
-
|
|
3
|
-
describe( 'cross-origin-isolation', () => {
|
|
4
|
-
let originalCrossOriginIsolated;
|
|
5
|
-
let originalBody;
|
|
6
|
-
let observeSpy;
|
|
7
|
-
|
|
8
|
-
beforeEach( () => {
|
|
9
|
-
vi.resetModules();
|
|
10
|
-
|
|
11
|
-
// Save original values
|
|
12
|
-
originalCrossOriginIsolated = window.crossOriginIsolated;
|
|
13
|
-
originalBody = document.body;
|
|
14
|
-
|
|
15
|
-
// Clear any existing filters
|
|
16
|
-
vi.clearAllMocks();
|
|
17
|
-
|
|
18
|
-
// Spy on MutationObserver.observe
|
|
19
|
-
observeSpy = vi.spyOn( window.MutationObserver.prototype, 'observe' );
|
|
20
|
-
} );
|
|
21
|
-
|
|
22
|
-
afterEach( () => {
|
|
23
|
-
// Restore original values
|
|
24
|
-
if ( originalCrossOriginIsolated !== undefined ) {
|
|
25
|
-
Object.defineProperty( window, 'crossOriginIsolated', {
|
|
26
|
-
value: originalCrossOriginIsolated,
|
|
27
|
-
writable: true,
|
|
28
|
-
configurable: true,
|
|
29
|
-
} );
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if ( originalBody ) {
|
|
33
|
-
Object.defineProperty( document, 'body', {
|
|
34
|
-
value: originalBody,
|
|
35
|
-
writable: true,
|
|
36
|
-
configurable: true,
|
|
37
|
-
} );
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
observeSpy.mockRestore();
|
|
41
|
-
} );
|
|
42
|
-
|
|
43
|
-
it( 'should not observe when crossOriginIsolated is false', async () => {
|
|
44
|
-
Object.defineProperty( window, 'crossOriginIsolated', {
|
|
45
|
-
value: false,
|
|
46
|
-
writable: true,
|
|
47
|
-
configurable: true,
|
|
48
|
-
} );
|
|
49
|
-
|
|
50
|
-
// Re-import the module to trigger the side effects
|
|
51
|
-
await import( '../cross-origin-isolation' );
|
|
52
|
-
|
|
53
|
-
expect( observeSpy ).not.toHaveBeenCalled();
|
|
54
|
-
} );
|
|
55
|
-
|
|
56
|
-
it( 'should observe document.body when crossOriginIsolated is true and body exists', async () => {
|
|
57
|
-
Object.defineProperty( window, 'crossOriginIsolated', {
|
|
58
|
-
value: true,
|
|
59
|
-
writable: true,
|
|
60
|
-
configurable: true,
|
|
61
|
-
} );
|
|
62
|
-
|
|
63
|
-
Object.defineProperty( document, 'readyState', {
|
|
64
|
-
value: 'complete',
|
|
65
|
-
writable: true,
|
|
66
|
-
configurable: true,
|
|
67
|
-
} );
|
|
68
|
-
|
|
69
|
-
// Re-import the module to trigger the side effects
|
|
70
|
-
await import( '../cross-origin-isolation' );
|
|
71
|
-
|
|
72
|
-
expect( observeSpy ).toHaveBeenCalledWith( document.body, {
|
|
73
|
-
childList: true,
|
|
74
|
-
attributes: true,
|
|
75
|
-
subtree: true,
|
|
76
|
-
} );
|
|
77
|
-
} );
|
|
78
|
-
|
|
79
|
-
it( 'should wait for DOMContentLoaded when body is not available and document is loading', async () => {
|
|
80
|
-
Object.defineProperty( window, 'crossOriginIsolated', {
|
|
81
|
-
value: true,
|
|
82
|
-
writable: true,
|
|
83
|
-
configurable: true,
|
|
84
|
-
} );
|
|
85
|
-
|
|
86
|
-
// Simulate document still loading
|
|
87
|
-
Object.defineProperty( document, 'readyState', {
|
|
88
|
-
value: 'loading',
|
|
89
|
-
writable: true,
|
|
90
|
-
configurable: true,
|
|
91
|
-
} );
|
|
92
|
-
|
|
93
|
-
// Temporarily remove body
|
|
94
|
-
Object.defineProperty( document, 'body', {
|
|
95
|
-
value: null,
|
|
96
|
-
writable: true,
|
|
97
|
-
configurable: true,
|
|
98
|
-
} );
|
|
99
|
-
|
|
100
|
-
const addEventListenerSpy = vi.spyOn( document, 'addEventListener' );
|
|
101
|
-
|
|
102
|
-
// Re-import the module to trigger the side effects
|
|
103
|
-
await import( '../cross-origin-isolation' );
|
|
104
|
-
|
|
105
|
-
// Should not observe immediately
|
|
106
|
-
expect( observeSpy ).not.toHaveBeenCalled();
|
|
107
|
-
|
|
108
|
-
// Should have added DOMContentLoaded listener
|
|
109
|
-
expect( addEventListenerSpy ).toHaveBeenCalledWith(
|
|
110
|
-
'DOMContentLoaded',
|
|
111
|
-
expect.any( Function )
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
addEventListenerSpy.mockRestore();
|
|
115
|
-
} );
|
|
116
|
-
|
|
117
|
-
it( 'should not throw error when body is null and document is complete', async () => {
|
|
118
|
-
Object.defineProperty( window, 'crossOriginIsolated', {
|
|
119
|
-
value: true,
|
|
120
|
-
writable: true,
|
|
121
|
-
configurable: true,
|
|
122
|
-
} );
|
|
123
|
-
|
|
124
|
-
Object.defineProperty( document, 'readyState', {
|
|
125
|
-
value: 'complete',
|
|
126
|
-
writable: true,
|
|
127
|
-
configurable: true,
|
|
128
|
-
} );
|
|
129
|
-
|
|
130
|
-
// Temporarily remove body
|
|
131
|
-
Object.defineProperty( document, 'body', {
|
|
132
|
-
value: null,
|
|
133
|
-
writable: true,
|
|
134
|
-
configurable: true,
|
|
135
|
-
} );
|
|
136
|
-
|
|
137
|
-
// This should not throw an error
|
|
138
|
-
await expect(
|
|
139
|
-
import( '../cross-origin-isolation' )
|
|
140
|
-
).resolves.toBeDefined();
|
|
141
|
-
|
|
142
|
-
// Should not attempt to observe null
|
|
143
|
-
expect( observeSpy ).not.toHaveBeenCalled();
|
|
144
|
-
} );
|
|
145
|
-
|
|
146
|
-
it( 'should not add crossorigin="anonymous" to images', async () => {
|
|
147
|
-
Object.defineProperty( window, 'crossOriginIsolated', {
|
|
148
|
-
value: true,
|
|
149
|
-
writable: true,
|
|
150
|
-
configurable: true,
|
|
151
|
-
} );
|
|
152
|
-
|
|
153
|
-
// Re-import the module to trigger the side effects
|
|
154
|
-
await import( '../cross-origin-isolation' );
|
|
155
|
-
|
|
156
|
-
// Create an image and add it to the DOM
|
|
157
|
-
const img = document.createElement( 'img' );
|
|
158
|
-
img.setAttribute( 'src', 'https://example.com/image.jpg' );
|
|
159
|
-
document.body.appendChild( img );
|
|
160
|
-
|
|
161
|
-
// Wait for MutationObserver callback to fire (async microtask).
|
|
162
|
-
await new Promise( ( resolve ) => setTimeout( resolve, 0 ) );
|
|
163
|
-
|
|
164
|
-
// Images should NOT get the crossorigin attribute.
|
|
165
|
-
// Under Document-Isolation-Policy: isolate-and-credentialless,
|
|
166
|
-
// the credentialless mode handles image loading without CORS headers.
|
|
167
|
-
// Adding crossorigin="anonymous" would override this and break
|
|
168
|
-
// external images that don't serve CORS headers.
|
|
169
|
-
expect( img ).not.toHaveAttribute( 'crossorigin' );
|
|
170
|
-
|
|
171
|
-
document.body.removeChild( img );
|
|
172
|
-
} );
|
|
173
|
-
} );
|