@wordpress/block-editor 14.7.1-next.082ed6819.0 → 14.8.1-next.a9f418477.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/autocompleters/block.js +2 -4
- package/build/autocompleters/block.js.map +1 -1
- package/build/autocompleters/link.js +2 -4
- package/build/autocompleters/link.js.map +1 -1
- package/build/components/block-canvas/index.js +3 -6
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-list/block.js +6 -5
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/index.js +0 -1
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +6 -2
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-firefox-draggable-compatibility.js +87 -0
- package/build/components/block-list/use-block-props/use-firefox-draggable-compatibility.js.map +1 -0
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +98 -5
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build/components/block-lock/modal.js +4 -4
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-parent-selector/index.js +2 -15
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +13 -4
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-popover/inbetween.js +4 -0
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +7 -4
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +1 -1
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-switcher/index.js +12 -22
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/use-transformed-patterns.js +0 -1
- package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build/components/block-switcher/utils.js +0 -1
- package/build/components/block-switcher/utils.js.map +1 -1
- package/build/components/block-toolbar/index.js +17 -9
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +0 -1
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +0 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +1 -0
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/font-family/index.js +10 -0
- package/build/components/font-family/index.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +17 -16
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/get-global-styles-changes.js +0 -1
- package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build/components/iframe/index.js +12 -216
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/iframe/use-scale-canvas.js +398 -0
- package/build/components/iframe/use-scale-canvas.js.map +1 -0
- package/build/components/image-editor/use-save-image.js +22 -3
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/index.js +0 -10
- package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build/components/inserter/menu.js +2 -1
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +19 -10
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inspector-controls/slot.js +2 -13
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +10 -0
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/line-height-control/index.js +1 -0
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/media-placeholder/index.js +18 -18
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/multi-selection-inspector/index.js +9 -25
- package/build/components/multi-selection-inspector/index.js.map +1 -1
- package/build/components/observe-typing/index.js +0 -1
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/recursion-provider/index.js +0 -1
- package/build/components/recursion-provider/index.js.map +1 -1
- package/build/components/rich-text/index.js +5 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/native/use-format-types.js +0 -1
- package/build/components/rich-text/native/use-format-types.js.map +1 -1
- package/build/components/rich-text/use-format-types.js +0 -1
- package/build/components/rich-text/use-format-types.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +0 -1
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/typewriter/index.js +0 -1
- package/build/components/typewriter/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +11 -2
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +15 -2
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +1 -1
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/warning/index.js +2 -3
- package/build/components/warning/index.js.map +1 -1
- package/build/components/writing-flow/use-drag-selection.js +11 -0
- package/build/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +6 -2
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/block-bindings.js +4 -3
- package/build/hooks/block-bindings.js.map +1 -1
- package/build/hooks/gap.js +1 -1
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/generated-class-name.js +0 -1
- package/build/hooks/generated-class-name.js.map +1 -1
- package/build/hooks/use-zoom-out.js +47 -14
- package/build/hooks/use-zoom-out.js.map +1 -1
- package/build/store/private-selectors.js +1 -7
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +478 -2
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +12 -55
- package/build/store/selectors.js.map +1 -1
- package/build/utils/object.js +0 -1
- package/build/utils/object.js.map +1 -1
- package/build-module/autocompleters/block.js +2 -4
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/autocompleters/link.js +2 -4
- package/build-module/autocompleters/link.js.map +1 -1
- package/build-module/components/block-canvas/index.js +3 -6
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-list/block.js +8 -7
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/index.js +0 -1
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +6 -2
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-firefox-draggable-compatibility.js +80 -0
- package/build-module/components/block-list/use-block-props/use-firefox-draggable-compatibility.js.map +1 -0
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +97 -5
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build-module/components/block-lock/modal.js +4 -4
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +2 -15
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +13 -4
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +4 -0
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +7 -4
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +1 -1
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +13 -23
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/use-transformed-patterns.js +0 -1
- package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build-module/components/block-switcher/utils.js +0 -1
- package/build-module/components/block-switcher/utils.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +17 -9
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +0 -1
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +0 -1
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +1 -0
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/font-family/index.js +10 -0
- package/build-module/components/font-family/index.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +17 -16
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/get-global-styles-changes.js +0 -1
- package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build-module/components/iframe/index.js +14 -218
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/iframe/use-scale-canvas.js +392 -0
- package/build-module/components/iframe/use-scale-canvas.js.map +1 -0
- package/build-module/components/image-editor/use-save-image.js +22 -3
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js +1 -11
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build-module/components/inserter/menu.js +2 -1
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +20 -11
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +3 -14
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +9 -0
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js +1 -0
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +18 -18
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/multi-selection-inspector/index.js +9 -25
- package/build-module/components/multi-selection-inspector/index.js.map +1 -1
- package/build-module/components/observe-typing/index.js +0 -1
- package/build-module/components/observe-typing/index.js.map +1 -1
- package/build-module/components/recursion-provider/index.js +0 -1
- package/build-module/components/recursion-provider/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +5 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/native/use-format-types.js +0 -1
- package/build-module/components/rich-text/native/use-format-types.js.map +1 -1
- package/build-module/components/rich-text/use-format-types.js +0 -1
- package/build-module/components/rich-text/use-format-types.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +0 -1
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/typewriter/index.js +0 -1
- package/build-module/components/typewriter/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +11 -2
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +15 -2
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +1 -1
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/warning/index.js +2 -3
- package/build-module/components/warning/index.js.map +1 -1
- package/build-module/components/writing-flow/use-drag-selection.js +11 -0
- package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +6 -2
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/block-bindings.js +4 -3
- package/build-module/hooks/block-bindings.js.map +1 -1
- package/build-module/hooks/gap.js +1 -1
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/generated-class-name.js +0 -1
- package/build-module/hooks/generated-class-name.js.map +1 -1
- package/build-module/hooks/use-zoom-out.js +48 -15
- package/build-module/hooks/use-zoom-out.js.map +1 -1
- package/build-module/store/private-selectors.js +1 -6
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +479 -3
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +12 -55
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/object.js +0 -1
- package/build-module/utils/object.js.map +1 -1
- package/build-style/content-rtl.css +25 -27
- package/build-style/content.css +25 -27
- package/build-style/style-rtl.css +55 -64
- package/build-style/style.css +55 -64
- package/package.json +32 -32
- package/src/autocompleters/block.js +2 -4
- package/src/autocompleters/link.js +2 -4
- package/src/components/alignment-control/stories/aliginment-toolbar.story.js +47 -0
- package/src/components/alignment-control/stories/index.story.js +51 -0
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +5 -5
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +4 -4
- package/src/components/block-canvas/index.js +3 -5
- package/src/components/block-canvas/style.scss +2 -1
- package/src/components/block-draggable/content.scss +11 -5
- package/src/components/block-list/block.js +7 -13
- package/src/components/block-list/content.scss +6 -0
- package/src/components/block-list/use-block-props/index.js +5 -0
- package/src/components/block-list/use-block-props/use-firefox-draggable-compatibility.js +83 -0
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +112 -8
- package/src/components/block-lock/modal.js +4 -6
- package/src/components/block-parent-selector/index.js +1 -19
- package/src/components/block-patterns-list/index.js +12 -1
- package/src/components/block-patterns-list/stories/fixtures.js +1 -0
- package/src/components/block-patterns-list/style.scss +16 -5
- package/src/components/block-popover/inbetween.js +4 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +6 -1
- package/src/components/block-settings-menu-controls/index.js +2 -1
- package/src/components/block-switcher/index.js +19 -21
- package/src/components/block-switcher/style.scss +0 -9
- package/src/components/block-title/test/index.js +2 -0
- package/src/components/block-toolbar/index.js +17 -6
- package/src/components/block-tools/style.scss +44 -0
- package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +3 -3
- package/src/components/color-palette/test/__snapshots__/control.js.snap +2 -2
- package/src/components/dimensions-tool/stories/aspect-ratio-tool.story.js +1 -1
- package/src/components/dimensions-tool/stories/index.story.js +1 -1
- package/src/components/dimensions-tool/stories/scale-tool.story.js +1 -1
- package/src/components/dimensions-tool/stories/width-height-tool.story.js +1 -1
- package/src/components/font-appearance-control/index.js +1 -0
- package/src/components/font-family/index.js +10 -0
- package/src/components/font-family/style.scss +5 -0
- package/src/components/global-styles/dimensions-panel.js +16 -16
- package/src/components/iframe/content.scss +40 -42
- package/src/components/iframe/index.js +13 -313
- package/src/components/iframe/use-scale-canvas.js +490 -0
- package/src/components/image-editor/use-save-image.js +27 -2
- package/src/components/inserter/block-patterns-tab/index.js +1 -17
- package/src/components/inserter/menu.js +8 -1
- package/src/components/inserter-draggable-blocks/index.js +19 -29
- package/src/components/inspector-controls/slot.js +3 -22
- package/src/components/letter-spacing-control/README.md +2 -1
- package/src/components/letter-spacing-control/index.js +17 -0
- package/src/components/line-height-control/index.js +1 -0
- package/src/components/media-placeholder/index.js +25 -28
- package/src/components/multi-selection-inspector/index.js +17 -27
- package/src/components/multi-selection-inspector/style.scss +0 -12
- package/src/components/resolution-tool/stories/index.story.js +1 -1
- package/src/components/rich-text/index.js +5 -0
- package/src/components/spacing-sizes-control/style.scss +0 -29
- package/src/components/text-alignment-control/stories/index.story.js +1 -1
- package/src/components/use-block-drop-zone/index.js +18 -1
- package/src/components/use-moving-animation/index.js +15 -0
- package/src/components/use-resize-canvas/index.js +1 -1
- package/src/components/warning/index.js +3 -4
- package/src/components/warning/test/index.js +3 -1
- package/src/components/writing-flow/use-drag-selection.js +11 -0
- package/src/components/writing-flow/use-tab-nav.js +9 -6
- package/src/hooks/block-bindings.js +8 -4
- package/src/hooks/gap.js +1 -1
- package/src/hooks/use-zoom-out.js +48 -16
- package/src/store/private-selectors.js +2 -17
- package/src/store/reducer.js +639 -2
- package/src/store/selectors.js +19 -69
- package/src/store/test/private-selectors.js +1 -0
- package/src/store/test/reducer.js +849 -0
- package/src/store/test/selectors.js +4 -110
- package/src/style.scss +1 -0
- package/tsconfig.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.8.1-next.a9f418477.0",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -37,37 +37,37 @@
|
|
|
37
37
|
"@emotion/react": "^11.7.1",
|
|
38
38
|
"@emotion/styled": "^11.6.0",
|
|
39
39
|
"@react-spring/web": "^9.4.5",
|
|
40
|
-
"@wordpress/a11y": "^4.
|
|
41
|
-
"@wordpress/api-fetch": "^7.
|
|
42
|
-
"@wordpress/blob": "^4.
|
|
43
|
-
"@wordpress/block-serialization-default-parser": "^5.
|
|
44
|
-
"@wordpress/blocks": "^14.
|
|
45
|
-
"@wordpress/commands": "^1.
|
|
40
|
+
"@wordpress/a11y": "^4.13.1-next.a9f418477.0",
|
|
41
|
+
"@wordpress/api-fetch": "^7.13.1-next.a9f418477.0",
|
|
42
|
+
"@wordpress/blob": "^4.13.1-next.a9f418477.0",
|
|
43
|
+
"@wordpress/block-serialization-default-parser": "^5.13.1-next.a9f418477.0",
|
|
44
|
+
"@wordpress/blocks": "^14.2.1-next.a9f418477.0",
|
|
45
|
+
"@wordpress/commands": "^1.13.1-next.a9f418477.0",
|
|
46
46
|
"@wordpress/components": "*",
|
|
47
|
-
"@wordpress/compose": "^7.
|
|
48
|
-
"@wordpress/data": "
|
|
49
|
-
"@wordpress/date": "^5.
|
|
50
|
-
"@wordpress/deprecated": "^4.
|
|
51
|
-
"@wordpress/dom": "^4.
|
|
52
|
-
"@wordpress/element": "^6.
|
|
53
|
-
"@wordpress/escape-html": "^3.
|
|
54
|
-
"@wordpress/hooks": "^4.
|
|
55
|
-
"@wordpress/html-entities": "^4.
|
|
56
|
-
"@wordpress/i18n": "^5.
|
|
57
|
-
"@wordpress/icons": "^10.
|
|
58
|
-
"@wordpress/is-shallow-equal": "^5.
|
|
59
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
60
|
-
"@wordpress/keycodes": "^4.
|
|
61
|
-
"@wordpress/notices": "^5.
|
|
62
|
-
"@wordpress/preferences": "^4.
|
|
63
|
-
"@wordpress/priority-queue": "^3.
|
|
64
|
-
"@wordpress/private-apis": "^1.
|
|
65
|
-
"@wordpress/rich-text": "^7.
|
|
66
|
-
"@wordpress/style-engine": "^2.
|
|
67
|
-
"@wordpress/token-list": "^3.
|
|
68
|
-
"@wordpress/url": "^4.
|
|
69
|
-
"@wordpress/warning": "^3.
|
|
70
|
-
"@wordpress/wordcount": "^4.
|
|
47
|
+
"@wordpress/compose": "^7.13.1-next.a9f418477.0",
|
|
48
|
+
"@wordpress/data": "^10.13.1-next.a9f418477.0",
|
|
49
|
+
"@wordpress/date": "^5.13.1-next.a9f418477.0",
|
|
50
|
+
"@wordpress/deprecated": "^4.13.1-next.a9f418477.0",
|
|
51
|
+
"@wordpress/dom": "^4.13.1-next.a9f418477.0",
|
|
52
|
+
"@wordpress/element": "^6.13.1-next.a9f418477.0",
|
|
53
|
+
"@wordpress/escape-html": "^3.13.1-next.a9f418477.0",
|
|
54
|
+
"@wordpress/hooks": "^4.13.1-next.a9f418477.0",
|
|
55
|
+
"@wordpress/html-entities": "^4.13.1-next.a9f418477.0",
|
|
56
|
+
"@wordpress/i18n": "^5.13.1-next.a9f418477.0",
|
|
57
|
+
"@wordpress/icons": "^10.13.1-next.a9f418477.0",
|
|
58
|
+
"@wordpress/is-shallow-equal": "^5.13.1-next.a9f418477.0",
|
|
59
|
+
"@wordpress/keyboard-shortcuts": "^5.13.1-next.a9f418477.0",
|
|
60
|
+
"@wordpress/keycodes": "^4.13.1-next.a9f418477.0",
|
|
61
|
+
"@wordpress/notices": "^5.13.1-next.a9f418477.0",
|
|
62
|
+
"@wordpress/preferences": "^4.13.1-next.a9f418477.0",
|
|
63
|
+
"@wordpress/priority-queue": "^3.13.1-next.a9f418477.0",
|
|
64
|
+
"@wordpress/private-apis": "^1.13.1-next.a9f418477.0",
|
|
65
|
+
"@wordpress/rich-text": "^7.13.1-next.a9f418477.0",
|
|
66
|
+
"@wordpress/style-engine": "^2.13.1-next.a9f418477.0",
|
|
67
|
+
"@wordpress/token-list": "^3.13.1-next.a9f418477.0",
|
|
68
|
+
"@wordpress/url": "^4.13.1-next.a9f418477.0",
|
|
69
|
+
"@wordpress/warning": "^3.13.1-next.a9f418477.0",
|
|
70
|
+
"@wordpress/wordcount": "^4.13.1-next.a9f418477.0",
|
|
71
71
|
"change-case": "^4.1.2",
|
|
72
72
|
"clsx": "^2.1.1",
|
|
73
73
|
"colord": "^2.7.0",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"publishConfig": {
|
|
91
91
|
"access": "public"
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "c1a8f3e9cada3b7d8342d1d2595c2dac0433111d"
|
|
94
94
|
}
|
|
@@ -23,12 +23,10 @@ import { orderInserterBlockItems } from '../utils/order-inserter-block-items';
|
|
|
23
23
|
const noop = () => {};
|
|
24
24
|
const SHOWN_BLOCK_TYPES = 9;
|
|
25
25
|
|
|
26
|
-
/** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */
|
|
27
|
-
|
|
28
26
|
/**
|
|
29
27
|
* Creates a blocks repeater for replacing the current block with a selected block type.
|
|
30
28
|
*
|
|
31
|
-
* @return {
|
|
29
|
+
* @return {Object} A blocks completer.
|
|
32
30
|
*/
|
|
33
31
|
function createBlockCompleter() {
|
|
34
32
|
return {
|
|
@@ -157,6 +155,6 @@ function createBlockCompleter() {
|
|
|
157
155
|
/**
|
|
158
156
|
* Creates a blocks repeater for replacing the current block with a selected block type.
|
|
159
157
|
*
|
|
160
|
-
* @return {
|
|
158
|
+
* @return {Object} A blocks completer.
|
|
161
159
|
*/
|
|
162
160
|
export default createBlockCompleter();
|
|
@@ -10,12 +10,10 @@ import { decodeEntities } from '@wordpress/html-entities';
|
|
|
10
10
|
|
|
11
11
|
const SHOWN_SUGGESTIONS = 10;
|
|
12
12
|
|
|
13
|
-
/** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */
|
|
14
|
-
|
|
15
13
|
/**
|
|
16
14
|
* Creates a suggestion list for links to posts or pages.
|
|
17
15
|
*
|
|
18
|
-
* @return {
|
|
16
|
+
* @return {Object} A links completer.
|
|
19
17
|
*/
|
|
20
18
|
function createLinkCompleter() {
|
|
21
19
|
return {
|
|
@@ -60,6 +58,6 @@ function createLinkCompleter() {
|
|
|
60
58
|
/**
|
|
61
59
|
* Creates a suggestion list for links to posts or pages..
|
|
62
60
|
*
|
|
63
|
-
* @return {
|
|
61
|
+
* @return {Object} A link completer.
|
|
64
62
|
*/
|
|
65
63
|
export default createLinkCompleter();
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useState } from '@wordpress/element';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { AlignmentToolbar } from '..';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The `AlignmentToolbar` component renders a dropdown menu that displays alignment options for the selected block in `Toolbar`.
|
|
13
|
+
*/
|
|
14
|
+
const meta = {
|
|
15
|
+
title: 'BlockEditor/AlignmentToolbar',
|
|
16
|
+
component: AlignmentToolbar,
|
|
17
|
+
argTypes: {
|
|
18
|
+
value: {
|
|
19
|
+
control: false,
|
|
20
|
+
defaultValue: 'undefined',
|
|
21
|
+
description: 'The current value of the alignment setting.',
|
|
22
|
+
},
|
|
23
|
+
onChange: {
|
|
24
|
+
action: 'onChange',
|
|
25
|
+
control: false,
|
|
26
|
+
description:
|
|
27
|
+
"A callback function invoked when the toolbar's alignment value is changed via an interaction with any of the toolbar's buttons. Called with the new alignment value (ie: `left`, `center`, `right`, `undefined`) as the only argument.",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
export default meta;
|
|
32
|
+
|
|
33
|
+
export const Default = {
|
|
34
|
+
render: function Template( { onChange, ...args } ) {
|
|
35
|
+
const [ value, setValue ] = useState();
|
|
36
|
+
return (
|
|
37
|
+
<AlignmentToolbar
|
|
38
|
+
{ ...args }
|
|
39
|
+
onChange={ ( ...changeArgs ) => {
|
|
40
|
+
onChange( ...changeArgs );
|
|
41
|
+
setValue( ...changeArgs );
|
|
42
|
+
} }
|
|
43
|
+
value={ value }
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
},
|
|
47
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useState } from '@wordpress/element';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { AlignmentControl } from '../';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The `AlignmentControl` component renders a dropdown menu that displays alignment options for the selected block.
|
|
13
|
+
*
|
|
14
|
+
* This component is mostly used for blocks that display text, such as Heading, Paragraph, Post Author, Post Comments, Verse, Quote, Post Title, etc... And the available alignment options are `left`, `center` or `right` alignment.
|
|
15
|
+
*
|
|
16
|
+
* If you want to use the alignment control in a toolbar, you should use the `AlignmentToolbar` component instead.
|
|
17
|
+
*/
|
|
18
|
+
const meta = {
|
|
19
|
+
title: 'BlockEditor/AlignmentControl',
|
|
20
|
+
component: AlignmentControl,
|
|
21
|
+
argTypes: {
|
|
22
|
+
value: {
|
|
23
|
+
control: false,
|
|
24
|
+
defaultValue: 'undefined',
|
|
25
|
+
description: 'The current value of the alignment setting.',
|
|
26
|
+
},
|
|
27
|
+
onChange: {
|
|
28
|
+
action: 'onChange',
|
|
29
|
+
control: false,
|
|
30
|
+
description:
|
|
31
|
+
"A callback function invoked when the toolbar's alignment value is changed via an interaction with any of the toolbar's buttons. Called with the new alignment value (ie: `left`, `center`, `right`, `undefined`) as the only argument.",
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
export default meta;
|
|
36
|
+
|
|
37
|
+
export const Default = {
|
|
38
|
+
render: function Template( { onChange, ...args } ) {
|
|
39
|
+
const [ value, setValue ] = useState();
|
|
40
|
+
return (
|
|
41
|
+
<AlignmentControl
|
|
42
|
+
{ ...args }
|
|
43
|
+
onChange={ ( ...changeArgs ) => {
|
|
44
|
+
onChange( ...changeArgs );
|
|
45
|
+
setValue( ...changeArgs );
|
|
46
|
+
} }
|
|
47
|
+
value={ value }
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
},
|
|
51
|
+
};
|
|
@@ -12,7 +12,7 @@ exports[`AlignmentUI should allow custom alignment controls to be specified 1`]
|
|
|
12
12
|
align="custom-left"
|
|
13
13
|
aria-label="My custom left"
|
|
14
14
|
aria-pressed="false"
|
|
15
|
-
class="components-button components-toolbar__control has-icon"
|
|
15
|
+
class="components-button components-toolbar__control is-compact has-icon"
|
|
16
16
|
data-toolbar-item="true"
|
|
17
17
|
type="button"
|
|
18
18
|
>
|
|
@@ -35,7 +35,7 @@ exports[`AlignmentUI should allow custom alignment controls to be specified 1`]
|
|
|
35
35
|
align="custom-right"
|
|
36
36
|
aria-label="My custom right"
|
|
37
37
|
aria-pressed="true"
|
|
38
|
-
class="components-button components-toolbar__control is-pressed has-icon"
|
|
38
|
+
class="components-button components-toolbar__control is-compact is-pressed has-icon"
|
|
39
39
|
data-toolbar-item="true"
|
|
40
40
|
type="button"
|
|
41
41
|
>
|
|
@@ -100,7 +100,7 @@ exports[`AlignmentUI should match snapshot when controls are visible 1`] = `
|
|
|
100
100
|
align="left"
|
|
101
101
|
aria-label="Align text left"
|
|
102
102
|
aria-pressed="true"
|
|
103
|
-
class="components-button components-toolbar__control is-pressed has-icon"
|
|
103
|
+
class="components-button components-toolbar__control is-compact is-pressed has-icon"
|
|
104
104
|
data-toolbar-item="true"
|
|
105
105
|
type="button"
|
|
106
106
|
>
|
|
@@ -123,7 +123,7 @@ exports[`AlignmentUI should match snapshot when controls are visible 1`] = `
|
|
|
123
123
|
align="center"
|
|
124
124
|
aria-label="Align text center"
|
|
125
125
|
aria-pressed="false"
|
|
126
|
-
class="components-button components-toolbar__control has-icon"
|
|
126
|
+
class="components-button components-toolbar__control is-compact has-icon"
|
|
127
127
|
data-toolbar-item="true"
|
|
128
128
|
type="button"
|
|
129
129
|
>
|
|
@@ -146,7 +146,7 @@ exports[`AlignmentUI should match snapshot when controls are visible 1`] = `
|
|
|
146
146
|
align="right"
|
|
147
147
|
aria-label="Align text right"
|
|
148
148
|
aria-pressed="false"
|
|
149
|
-
class="components-button components-toolbar__control has-icon"
|
|
149
|
+
class="components-button components-toolbar__control is-compact has-icon"
|
|
150
150
|
data-toolbar-item="true"
|
|
151
151
|
type="button"
|
|
152
152
|
>
|
|
@@ -42,7 +42,7 @@ exports[`BlockAlignmentUI should match snapshot when controls are visible 1`] =
|
|
|
42
42
|
<button
|
|
43
43
|
aria-label="None"
|
|
44
44
|
aria-pressed="false"
|
|
45
|
-
class="components-button components-toolbar__control has-icon"
|
|
45
|
+
class="components-button components-toolbar__control is-compact has-icon"
|
|
46
46
|
data-toolbar-item="true"
|
|
47
47
|
type="button"
|
|
48
48
|
>
|
|
@@ -64,7 +64,7 @@ exports[`BlockAlignmentUI should match snapshot when controls are visible 1`] =
|
|
|
64
64
|
<button
|
|
65
65
|
aria-label="Align left"
|
|
66
66
|
aria-pressed="true"
|
|
67
|
-
class="components-button components-toolbar__control is-pressed has-icon"
|
|
67
|
+
class="components-button components-toolbar__control is-compact is-pressed has-icon"
|
|
68
68
|
data-toolbar-item="true"
|
|
69
69
|
type="button"
|
|
70
70
|
>
|
|
@@ -86,7 +86,7 @@ exports[`BlockAlignmentUI should match snapshot when controls are visible 1`] =
|
|
|
86
86
|
<button
|
|
87
87
|
aria-label="Align center"
|
|
88
88
|
aria-pressed="false"
|
|
89
|
-
class="components-button components-toolbar__control has-icon"
|
|
89
|
+
class="components-button components-toolbar__control is-compact has-icon"
|
|
90
90
|
data-toolbar-item="true"
|
|
91
91
|
type="button"
|
|
92
92
|
>
|
|
@@ -108,7 +108,7 @@ exports[`BlockAlignmentUI should match snapshot when controls are visible 1`] =
|
|
|
108
108
|
<button
|
|
109
109
|
aria-label="Align right"
|
|
110
110
|
aria-pressed="false"
|
|
111
|
-
class="components-button components-toolbar__control has-icon"
|
|
111
|
+
class="components-button components-toolbar__control is-compact has-icon"
|
|
112
112
|
data-toolbar-item="true"
|
|
113
113
|
type="button"
|
|
114
114
|
>
|
|
@@ -56,7 +56,8 @@ export function ExperimentalBlockCanvas( {
|
|
|
56
56
|
return (
|
|
57
57
|
<BlockTools
|
|
58
58
|
__unstableContentRef={ localRef }
|
|
59
|
-
|
|
59
|
+
className="block-editor-block-canvas"
|
|
60
|
+
style={ { height } }
|
|
60
61
|
>
|
|
61
62
|
<EditorStyles
|
|
62
63
|
styles={ styles }
|
|
@@ -67,10 +68,6 @@ export function ExperimentalBlockCanvas( {
|
|
|
67
68
|
ref={ contentRef }
|
|
68
69
|
className="editor-styles-wrapper"
|
|
69
70
|
tabIndex={ -1 }
|
|
70
|
-
style={ {
|
|
71
|
-
height: '100%',
|
|
72
|
-
width: '100%',
|
|
73
|
-
} }
|
|
74
71
|
>
|
|
75
72
|
{ children }
|
|
76
73
|
</WritingFlow>
|
|
@@ -81,6 +78,7 @@ export function ExperimentalBlockCanvas( {
|
|
|
81
78
|
return (
|
|
82
79
|
<BlockTools
|
|
83
80
|
__unstableContentRef={ localRef }
|
|
81
|
+
className="block-editor-block-canvas"
|
|
84
82
|
style={ { height, display: 'flex' } }
|
|
85
83
|
>
|
|
86
84
|
<Iframe
|
|
@@ -4,6 +4,7 @@ iframe[name="editor-canvas"] {
|
|
|
4
4
|
height: 100%;
|
|
5
5
|
display: block;
|
|
6
6
|
// Handles transitions between device previews
|
|
7
|
-
|
|
7
|
+
transition: all 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96);
|
|
8
|
+
@include reduce-motion("transition");
|
|
8
9
|
background-color: $gray-300;
|
|
9
10
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
// This creates a "slot" where the block you're dragging appeared.
|
|
2
2
|
// We use !important as one of the rules are meant to be overridden.
|
|
3
3
|
.block-editor-block-list__layout .is-dragging {
|
|
4
|
-
|
|
5
|
-
opacity: 0.05 !important;
|
|
4
|
+
opacity: 0.1 !important;
|
|
6
5
|
border-radius: $radius-small !important;
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
iframe {
|
|
8
|
+
pointer-events: none;
|
|
9
|
+
}
|
|
11
10
|
|
|
12
11
|
// Hide the multi selection indicator when dragging.
|
|
13
12
|
&::selection {
|
|
@@ -18,3 +17,10 @@
|
|
|
18
17
|
content: none !important;
|
|
19
18
|
}
|
|
20
19
|
}
|
|
20
|
+
|
|
21
|
+
// Images are draggable by default, so disable drag for them if not explicitly
|
|
22
|
+
// set. This is done so that the block can capture the drag event instead.
|
|
23
|
+
.wp-block img:not([draggable]),
|
|
24
|
+
.wp-block svg:not([draggable]) {
|
|
25
|
+
pointer-events: none;
|
|
26
|
+
}
|
|
@@ -6,13 +6,7 @@ import clsx from 'clsx';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
10
|
-
memo,
|
|
11
|
-
useCallback,
|
|
12
|
-
RawHTML,
|
|
13
|
-
useContext,
|
|
14
|
-
useMemo,
|
|
15
|
-
} from '@wordpress/element';
|
|
9
|
+
import { memo, RawHTML, useContext, useMemo } from '@wordpress/element';
|
|
16
10
|
import {
|
|
17
11
|
getBlockType,
|
|
18
12
|
getSaveContent,
|
|
@@ -28,7 +22,7 @@ import {
|
|
|
28
22
|
store as blocksStore,
|
|
29
23
|
} from '@wordpress/blocks';
|
|
30
24
|
import { withFilters } from '@wordpress/components';
|
|
31
|
-
import { withDispatch,
|
|
25
|
+
import { withDispatch, useSelect } from '@wordpress/data';
|
|
32
26
|
import { compose } from '@wordpress/compose';
|
|
33
27
|
import { safeHTML } from '@wordpress/dom';
|
|
34
28
|
|
|
@@ -103,6 +97,7 @@ function BlockListBlock( {
|
|
|
103
97
|
wrapperProps,
|
|
104
98
|
setAttributes,
|
|
105
99
|
onReplace,
|
|
100
|
+
onRemove,
|
|
106
101
|
onInsertBlocksAfter,
|
|
107
102
|
onMerge,
|
|
108
103
|
toggleSelection,
|
|
@@ -113,11 +108,6 @@ function BlockListBlock( {
|
|
|
113
108
|
themeSupportsLayout,
|
|
114
109
|
...context
|
|
115
110
|
} = useContext( PrivateBlockContext );
|
|
116
|
-
const { removeBlock } = useDispatch( blockEditorStore );
|
|
117
|
-
const onRemove = useCallback(
|
|
118
|
-
() => removeBlock( clientId ),
|
|
119
|
-
[ clientId, removeBlock ]
|
|
120
|
-
);
|
|
121
111
|
|
|
122
112
|
const parentLayout = useLayout() || {};
|
|
123
113
|
|
|
@@ -537,6 +527,9 @@ const applyWithDispatch = withDispatch( ( dispatch, ownProps, registry ) => {
|
|
|
537
527
|
initialPosition
|
|
538
528
|
);
|
|
539
529
|
},
|
|
530
|
+
onRemove() {
|
|
531
|
+
removeBlock( ownProps.clientId );
|
|
532
|
+
},
|
|
540
533
|
toggleSelection( selectionEnabled ) {
|
|
541
534
|
toggleSelection( selectionEnabled );
|
|
542
535
|
},
|
|
@@ -797,6 +790,7 @@ function BlockListBlockProvider( props ) {
|
|
|
797
790
|
mayDisplayParentControls,
|
|
798
791
|
originalBlockClientId,
|
|
799
792
|
themeSupportsLayout,
|
|
793
|
+
canMove,
|
|
800
794
|
};
|
|
801
795
|
|
|
802
796
|
// Here we separate between the props passed to BlockListBlock and any other
|
|
@@ -427,3 +427,9 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection="true"] .b
|
|
|
427
427
|
// Additional -1px is required to avoid sub pixel rounding errors allowing background to show.
|
|
428
428
|
margin: 0 calc(-1 * var(--wp--style--root--padding-right) - 1px) 0 calc(-1 * var(--wp--style--root--padding-left) - 1px) !important;
|
|
429
429
|
}
|
|
430
|
+
|
|
431
|
+
// This only works in Firefox, Chrome and Safari don't accept a custom cursor
|
|
432
|
+
// during drag.
|
|
433
|
+
.is-dragging {
|
|
434
|
+
cursor: grabbing;
|
|
435
|
+
}
|
|
@@ -30,6 +30,7 @@ import { useIntersectionObserver } from './use-intersection-observer';
|
|
|
30
30
|
import { useScrollIntoView } from './use-scroll-into-view';
|
|
31
31
|
import { useFlashEditableBlocks } from '../../use-flash-editable-blocks';
|
|
32
32
|
import { canBindBlock } from '../../../hooks/use-bindings-attributes';
|
|
33
|
+
import { useFirefoxDraggableCompatibility } from './use-firefox-draggable-compatibility';
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
36
|
* This hook is used to lightly mark an element as a block element. The element
|
|
@@ -100,11 +101,13 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
|
|
|
100
101
|
isTemporarilyEditingAsBlocks,
|
|
101
102
|
defaultClassName,
|
|
102
103
|
isSectionBlock,
|
|
104
|
+
canMove,
|
|
103
105
|
} = useContext( PrivateBlockContext );
|
|
104
106
|
|
|
105
107
|
// translators: %s: Type of block (i.e. Text, Image etc)
|
|
106
108
|
const blockLabel = sprintf( __( 'Block: %s' ), blockTitle );
|
|
107
109
|
const htmlSuffix = mode === 'html' && ! __unstableIsHtml ? '-visual' : '';
|
|
110
|
+
const ffDragRef = useFirefoxDraggableCompatibility();
|
|
108
111
|
const mergedRefs = useMergeRefs( [
|
|
109
112
|
props.ref,
|
|
110
113
|
useFocusFirstElement( { clientId, initialPosition } ),
|
|
@@ -120,6 +123,7 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
|
|
|
120
123
|
isEnabled: isSectionBlock,
|
|
121
124
|
} ),
|
|
122
125
|
useScrollIntoView( { isSelected } ),
|
|
126
|
+
canMove ? ffDragRef : undefined,
|
|
123
127
|
] );
|
|
124
128
|
|
|
125
129
|
const blockEditContext = useBlockEditContext();
|
|
@@ -152,6 +156,7 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
|
|
|
152
156
|
|
|
153
157
|
return {
|
|
154
158
|
tabIndex: blockEditingMode === 'disabled' ? -1 : 0,
|
|
159
|
+
draggable: canMove && ! hasChildSelected ? true : undefined,
|
|
155
160
|
...wrapperProps,
|
|
156
161
|
...props,
|
|
157
162
|
ref: mergedRefs,
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useRefEffect } from '@wordpress/compose';
|
|
5
|
+
|
|
6
|
+
const nodesByDocument = new Map();
|
|
7
|
+
|
|
8
|
+
function add( doc, node ) {
|
|
9
|
+
let set = nodesByDocument.get( doc );
|
|
10
|
+
if ( ! set ) {
|
|
11
|
+
set = new Set();
|
|
12
|
+
nodesByDocument.set( doc, set );
|
|
13
|
+
doc.addEventListener( 'pointerdown', down );
|
|
14
|
+
}
|
|
15
|
+
set.add( node );
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function remove( doc, node ) {
|
|
19
|
+
const set = nodesByDocument.get( doc );
|
|
20
|
+
if ( set ) {
|
|
21
|
+
set.delete( node );
|
|
22
|
+
restore( node );
|
|
23
|
+
if ( set.size === 0 ) {
|
|
24
|
+
nodesByDocument.delete( doc );
|
|
25
|
+
doc.removeEventListener( 'pointerdown', down );
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function restore( node ) {
|
|
31
|
+
const prevDraggable = node.getAttribute( 'data-draggable' );
|
|
32
|
+
if ( prevDraggable ) {
|
|
33
|
+
node.removeAttribute( 'data-draggable' );
|
|
34
|
+
// Only restore if `draggable` is still removed. It could have been
|
|
35
|
+
// changed by React in the meantime.
|
|
36
|
+
if ( prevDraggable === 'true' && ! node.getAttribute( 'draggable' ) ) {
|
|
37
|
+
node.setAttribute( 'draggable', 'true' );
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function down( event ) {
|
|
43
|
+
const { target } = event;
|
|
44
|
+
const { ownerDocument, isContentEditable } = target;
|
|
45
|
+
const nodes = nodesByDocument.get( ownerDocument );
|
|
46
|
+
|
|
47
|
+
if ( isContentEditable ) {
|
|
48
|
+
// Whenever an editable element is clicked, check which draggable
|
|
49
|
+
// blocks contain this element, and temporarily disable draggability.
|
|
50
|
+
for ( const node of nodes ) {
|
|
51
|
+
if (
|
|
52
|
+
node.getAttribute( 'draggable' ) === 'true' &&
|
|
53
|
+
node.contains( target )
|
|
54
|
+
) {
|
|
55
|
+
node.removeAttribute( 'draggable' );
|
|
56
|
+
node.setAttribute( 'data-draggable', 'true' );
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
} else {
|
|
60
|
+
// Whenever a non-editable element is clicked, re-enable draggability
|
|
61
|
+
// for any blocks that were previously disabled.
|
|
62
|
+
for ( const node of nodes ) {
|
|
63
|
+
restore( node );
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* In Firefox, the `draggable` and `contenteditable` attributes don't play well
|
|
70
|
+
* together. When `contenteditable` is within a `draggable` element, selection
|
|
71
|
+
* doesn't get set in the right place. The only solution is to temporarily
|
|
72
|
+
* remove the `draggable` attribute clicking inside `contenteditable` elements.
|
|
73
|
+
*
|
|
74
|
+
* @return {Function} Cleanup function.
|
|
75
|
+
*/
|
|
76
|
+
export function useFirefoxDraggableCompatibility() {
|
|
77
|
+
return useRefEffect( ( node ) => {
|
|
78
|
+
add( node.ownerDocument, node );
|
|
79
|
+
return () => {
|
|
80
|
+
remove( node.ownerDocument, node );
|
|
81
|
+
};
|
|
82
|
+
}, [] );
|
|
83
|
+
}
|