@wordpress/block-library 10.0.1-next.v.202606191442.0 → 10.1.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 +4 -1
- package/build/audio/edit.cjs +8 -1
- package/build/audio/edit.cjs.map +2 -2
- package/build/breadcrumbs/edit.cjs +0 -1
- package/build/breadcrumbs/edit.cjs.map +2 -2
- package/build/button/edit.cjs +0 -1
- package/build/button/edit.cjs.map +2 -2
- package/build/cover/edit/embed-video-url-input.cjs +0 -1
- package/build/cover/edit/embed-video-url-input.cjs.map +2 -2
- package/build/details/edit.cjs +0 -1
- package/build/details/edit.cjs.map +2 -2
- package/build/form/edit.cjs +0 -2
- package/build/form/edit.cjs.map +2 -2
- package/build/form-input/edit.cjs +0 -2
- package/build/form-input/edit.cjs.map +2 -2
- package/build/freeform/edit.cjs +5 -14
- package/build/freeform/edit.cjs.map +3 -3
- package/build/freeform/migration-notice.cjs.map +2 -2
- package/build/home-link/edit.cjs +0 -1
- package/build/home-link/edit.cjs.map +2 -2
- package/build/html/modal.cjs +6 -3
- package/build/html/modal.cjs.map +2 -2
- package/build/icon/edit.cjs +2 -4
- package/build/icon/edit.cjs.map +2 -2
- package/build/image/image.cjs +0 -2
- package/build/image/image.cjs.map +2 -2
- package/build/image/use-open-image-media-editor-modal.cjs +5 -25
- package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
- package/build/list/ordered-list-settings.cjs +0 -1
- package/build/list/ordered-list-settings.cjs.map +2 -2
- package/build/navigation/edit/index.cjs +9 -9
- package/build/navigation/edit/index.cjs.map +2 -2
- package/build/navigation/edit/navigation-menu-name-control.cjs +0 -1
- package/build/navigation/edit/navigation-menu-name-control.cjs.map +2 -2
- package/build/navigation-link/block.json +1 -1
- package/build/navigation-link/link-ui/page-creator.cjs +0 -1
- package/build/navigation-link/link-ui/page-creator.cjs.map +2 -2
- package/build/navigation-link/shared/controls.cjs +0 -2
- package/build/navigation-link/shared/controls.cjs.map +2 -2
- package/build/playlist-track/edit.cjs +0 -3
- package/build/playlist-track/edit.cjs.map +2 -2
- package/build/post-comment/edit.cjs +0 -1
- package/build/post-comment/edit.cjs.map +2 -2
- package/build/post-featured-image/edit.cjs +0 -1
- package/build/post-featured-image/edit.cjs.map +2 -2
- package/build/post-terms/edit.cjs +0 -1
- package/build/post-terms/edit.cjs.map +2 -2
- package/build/post-title/edit.cjs +0 -1
- package/build/post-title/edit.cjs.map +2 -2
- package/build/query/edit/enhanced-pagination-modal.cjs +10 -1
- package/build/query/edit/enhanced-pagination-modal.cjs.map +3 -3
- package/build/query/edit/inspector-controls/index.cjs +0 -1
- package/build/query/edit/inspector-controls/index.cjs.map +2 -2
- package/build/rss/edit.cjs +0 -1
- package/build/rss/edit.cjs.map +2 -2
- package/build/search/block.json +4 -0
- package/build/search/edit.cjs +242 -204
- package/build/search/edit.cjs.map +2 -2
- package/build/site-logo/edit.cjs +2 -1
- package/build/site-logo/edit.cjs.map +2 -2
- package/build/social-link/edit.cjs +0 -3
- package/build/social-link/edit.cjs.map +2 -2
- package/build/tab-list/block.json +2 -2
- package/build/tab-list/edit.cjs +14 -8
- package/build/tab-list/edit.cjs.map +2 -2
- package/build/tab-list/init.cjs +28 -0
- package/build/tab-list/init.cjs.map +7 -0
- package/build/tab-panel/edit.cjs +0 -9
- package/build/tab-panel/edit.cjs.map +2 -2
- package/build/tab-panel/save.cjs +2 -1
- package/build/tab-panel/save.cjs.map +2 -2
- package/build/tab-panels/block.json +0 -1
- package/build/tab-panels/init.cjs +28 -0
- package/build/tab-panels/init.cjs.map +7 -0
- package/build/table/edit.cjs +0 -2
- package/build/table/edit.cjs.map +2 -2
- package/build/tabs/view.cjs +20 -94
- package/build/tabs/view.cjs.map +2 -2
- package/build/template-part/edit/advanced-controls.cjs +0 -1
- package/build/template-part/edit/advanced-controls.cjs.map +2 -2
- package/build/template-part/edit/title-modal.cjs +1 -2
- package/build/template-part/edit/title-modal.cjs.map +2 -2
- package/build/video/edit.cjs +3 -2
- package/build/video/edit.cjs.map +2 -2
- package/build/video/tracks-editor.cjs +0 -2
- package/build/video/tracks-editor.cjs.map +2 -2
- package/build-module/audio/edit.mjs +8 -2
- package/build-module/audio/edit.mjs.map +2 -2
- package/build-module/breadcrumbs/edit.mjs +0 -1
- package/build-module/breadcrumbs/edit.mjs.map +2 -2
- package/build-module/button/edit.mjs +0 -1
- package/build-module/button/edit.mjs.map +2 -2
- package/build-module/cover/edit/embed-video-url-input.mjs +0 -1
- package/build-module/cover/edit/embed-video-url-input.mjs.map +2 -2
- package/build-module/details/edit.mjs +0 -1
- package/build-module/details/edit.mjs.map +2 -2
- package/build-module/form/edit.mjs +0 -2
- package/build-module/form/edit.mjs.map +2 -2
- package/build-module/form-input/edit.mjs +0 -2
- package/build-module/form-input/edit.mjs.map +2 -2
- package/build-module/freeform/edit.mjs +5 -14
- package/build-module/freeform/edit.mjs.map +2 -2
- package/build-module/freeform/migration-notice.mjs.map +2 -2
- package/build-module/home-link/edit.mjs +0 -1
- package/build-module/home-link/edit.mjs.map +2 -2
- package/build-module/html/modal.mjs +6 -3
- package/build-module/html/modal.mjs.map +2 -2
- package/build-module/icon/edit.mjs +2 -4
- package/build-module/icon/edit.mjs.map +2 -2
- package/build-module/image/image.mjs +0 -2
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/image/use-open-image-media-editor-modal.mjs +5 -25
- package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
- package/build-module/list/ordered-list-settings.mjs +0 -1
- package/build-module/list/ordered-list-settings.mjs.map +2 -2
- package/build-module/navigation/edit/index.mjs +9 -9
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/navigation-menu-name-control.mjs +0 -1
- package/build-module/navigation/edit/navigation-menu-name-control.mjs.map +2 -2
- package/build-module/navigation-link/block.json +1 -1
- package/build-module/navigation-link/link-ui/page-creator.mjs +0 -1
- package/build-module/navigation-link/link-ui/page-creator.mjs.map +2 -2
- package/build-module/navigation-link/shared/controls.mjs +0 -2
- package/build-module/navigation-link/shared/controls.mjs.map +2 -2
- package/build-module/playlist-track/edit.mjs +0 -3
- package/build-module/playlist-track/edit.mjs.map +2 -2
- package/build-module/post-comment/edit.mjs +0 -1
- package/build-module/post-comment/edit.mjs.map +2 -2
- package/build-module/post-featured-image/edit.mjs +0 -1
- package/build-module/post-featured-image/edit.mjs.map +2 -2
- package/build-module/post-terms/edit.mjs +0 -1
- package/build-module/post-terms/edit.mjs.map +2 -2
- package/build-module/post-title/edit.mjs +0 -1
- package/build-module/post-title/edit.mjs.map +2 -2
- package/build-module/query/edit/enhanced-pagination-modal.mjs +10 -1
- package/build-module/query/edit/enhanced-pagination-modal.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/index.mjs +0 -1
- package/build-module/query/edit/inspector-controls/index.mjs.map +2 -2
- package/build-module/rss/edit.mjs +0 -1
- package/build-module/rss/edit.mjs.map +2 -2
- package/build-module/search/block.json +4 -0
- package/build-module/search/edit.mjs +242 -204
- package/build-module/search/edit.mjs.map +2 -2
- package/build-module/site-logo/edit.mjs +2 -1
- package/build-module/site-logo/edit.mjs.map +2 -2
- package/build-module/social-link/edit.mjs +0 -3
- package/build-module/social-link/edit.mjs.map +2 -2
- package/build-module/tab-list/block.json +2 -2
- package/build-module/tab-list/edit.mjs +15 -9
- package/build-module/tab-list/edit.mjs.map +2 -2
- package/build-module/tab-list/init.mjs +7 -0
- package/build-module/tab-list/init.mjs.map +7 -0
- package/build-module/tab-panel/edit.mjs +1 -10
- package/build-module/tab-panel/edit.mjs.map +2 -2
- package/build-module/tab-panel/save.mjs +2 -1
- package/build-module/tab-panel/save.mjs.map +2 -2
- package/build-module/tab-panels/block.json +0 -1
- package/build-module/tab-panels/init.mjs +7 -0
- package/build-module/tab-panels/init.mjs.map +7 -0
- package/build-module/table/edit.mjs +0 -2
- package/build-module/table/edit.mjs.map +2 -2
- package/build-module/tabs/view.mjs +20 -94
- package/build-module/tabs/view.mjs.map +2 -2
- package/build-module/template-part/edit/advanced-controls.mjs +0 -1
- package/build-module/template-part/edit/advanced-controls.mjs.map +2 -2
- package/build-module/template-part/edit/title-modal.mjs +1 -2
- package/build-module/template-part/edit/title-modal.mjs.map +2 -2
- package/build-module/video/edit.mjs +3 -3
- package/build-module/video/edit.mjs.map +2 -2
- package/build-module/video/tracks-editor.mjs +0 -2
- package/build-module/video/tracks-editor.mjs.map +2 -2
- package/build-style/editor-rtl.css +0 -15
- package/build-style/editor.css +0 -15
- package/build-style/style-rtl.css +1 -1
- package/build-style/style.css +1 -1
- package/build-style/tab-list/style-rtl.css +1 -1
- package/build-style/tab-list/style.css +1 -1
- package/package.json +40 -40
- package/src/audio/edit.js +5 -9
- package/src/breadcrumbs/edit.js +0 -1
- package/src/button/edit.js +0 -1
- package/src/cover/edit/embed-video-url-input.js +0 -1
- package/src/cover/test/edit.js +51 -40
- package/src/details/edit.js +0 -1
- package/src/editor.scss +0 -1
- package/src/form/edit.js +0 -2
- package/src/form-input/edit.js +0 -2
- package/src/freeform/edit.js +6 -29
- package/src/freeform/migration-notice.js +2 -4
- package/src/home-link/edit.js +0 -1
- package/src/html/modal.js +3 -0
- package/src/icon/edit.js +0 -2
- package/src/image/image.js +0 -2
- package/src/image/test/use-open-image-media-editor-modal.js +20 -26
- package/src/image/use-open-image-media-editor-modal.js +24 -42
- package/src/list/ordered-list-settings.js +0 -1
- package/src/navigation/edit/index.js +9 -13
- package/src/navigation/edit/navigation-menu-name-control.js +0 -1
- package/src/navigation-link/README.md +1 -1
- package/src/navigation-link/block.json +1 -1
- package/src/navigation-link/link-ui/page-creator.js +0 -1
- package/src/navigation-link/shared/controls.js +0 -2
- package/src/navigation-link/test/__snapshots__/hooks.js.snap +5 -0
- package/src/playlist-track/edit.js +0 -3
- package/src/post-comment/edit.js +0 -1
- package/src/post-featured-image/edit.js +0 -1
- package/src/post-terms/edit.js +0 -1
- package/src/post-title/edit.js +0 -1
- package/src/query/edit/enhanced-pagination-modal.js +11 -1
- package/src/query/edit/inspector-controls/index.js +0 -1
- package/src/rss/edit.js +0 -1
- package/src/search/README.md +1 -0
- package/src/search/block.json +4 -0
- package/src/search/edit.js +106 -55
- package/src/search/index.php +25 -1
- package/src/site-logo/edit.js +3 -1
- package/src/social-link/edit.js +0 -3
- package/src/tab-list/README.md +1 -1
- package/src/tab-list/block.json +2 -2
- package/src/tab-list/edit.js +14 -8
- package/src/tab-list/index.php +4 -6
- package/src/tab-list/init.js +6 -0
- package/src/tab-list/style.scss +1 -2
- package/src/tab-panel/edit.js +1 -14
- package/src/tab-panel/index.php +2 -25
- package/src/tab-panel/save.js +1 -0
- package/src/tab-panels/block.json +0 -1
- package/src/tab-panels/init.js +6 -0
- package/src/table/edit.js +0 -2
- package/src/tabs/index.php +12 -19
- package/src/tabs/view.js +20 -100
- package/src/template-part/edit/advanced-controls.js +0 -1
- package/src/template-part/edit/title-modal.js +0 -1
- package/src/utils/test/style-state.js +26 -26
- package/src/video/edit.js +9 -16
- package/src/video/tracks-editor.js +0 -2
- package/build/freeform/convert-to-blocks-button.cjs +0 -40
- package/build/freeform/convert-to-blocks-button.cjs.map +0 -7
- package/build/list-item/utils.cjs +0 -57
- package/build/list-item/utils.cjs.map +0 -7
- package/build-module/freeform/convert-to-blocks-button.mjs +0 -19
- package/build-module/freeform/convert-to-blocks-button.mjs.map +0 -7
- package/build-module/list-item/utils.mjs +0 -32
- package/build-module/list-item/utils.mjs.map +0 -7
- package/build-style/tab-list/editor-rtl.css +0 -14
- package/build-style/tab-list/editor.css +0 -14
- package/src/freeform/convert-to-blocks-button.js +0 -18
- package/src/list-item/utils.js +0 -34
- package/src/tab-list/editor.scss +0 -17
package/src/tabs/view.js
CHANGED
|
@@ -8,44 +8,8 @@ import {
|
|
|
8
8
|
withSyncEvent,
|
|
9
9
|
} from '@wordpress/interactivity';
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
'push',
|
|
14
|
-
'pop',
|
|
15
|
-
'shift',
|
|
16
|
-
'unshift',
|
|
17
|
-
'splice',
|
|
18
|
-
'sort',
|
|
19
|
-
'reverse',
|
|
20
|
-
'copyWithin',
|
|
21
|
-
'fill',
|
|
22
|
-
] );
|
|
23
|
-
|
|
24
|
-
return new Proxy( obj, {
|
|
25
|
-
get( target, prop ) {
|
|
26
|
-
// If accessing an array mutation method, return a no-op function.
|
|
27
|
-
if ( Array.isArray( target ) && arrayMutationMethods.has( prop ) ) {
|
|
28
|
-
return () => {};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const value = target[ prop ];
|
|
32
|
-
if ( typeof value === 'object' && value !== null ) {
|
|
33
|
-
return createReadOnlyProxy( value );
|
|
34
|
-
}
|
|
35
|
-
return value;
|
|
36
|
-
},
|
|
37
|
-
set() {
|
|
38
|
-
return false;
|
|
39
|
-
},
|
|
40
|
-
deleteProperty() {
|
|
41
|
-
return false;
|
|
42
|
-
},
|
|
43
|
-
} );
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Private store for internal tabs functionality and security.
|
|
47
|
-
const { actions: privateActions, state: privateState } = store(
|
|
48
|
-
'core/tabs/private',
|
|
11
|
+
const { actions, state } = store(
|
|
12
|
+
'core/tabs',
|
|
49
13
|
{
|
|
50
14
|
state: {
|
|
51
15
|
/**
|
|
@@ -56,7 +20,7 @@ const { actions: privateActions, state: privateState } = store(
|
|
|
56
20
|
get tabsList() {
|
|
57
21
|
const context = getContext();
|
|
58
22
|
const tabsId = context?.tabsId;
|
|
59
|
-
const tabsList =
|
|
23
|
+
const tabsList = state[ tabsId ];
|
|
60
24
|
return tabsList;
|
|
61
25
|
},
|
|
62
26
|
/**
|
|
@@ -71,8 +35,8 @@ const { actions: privateActions, state: privateState } = store(
|
|
|
71
35
|
if ( ! tabId ) {
|
|
72
36
|
return null;
|
|
73
37
|
}
|
|
74
|
-
const { tabsList } =
|
|
75
|
-
const tabIndex = tabsList.findIndex( ( t ) => t
|
|
38
|
+
const { tabsList } = state;
|
|
39
|
+
const tabIndex = tabsList.findIndex( ( t ) => t === tabId );
|
|
76
40
|
return tabIndex;
|
|
77
41
|
},
|
|
78
42
|
/**
|
|
@@ -82,7 +46,7 @@ const { actions: privateActions, state: privateState } = store(
|
|
|
82
46
|
*/
|
|
83
47
|
get isActiveTab() {
|
|
84
48
|
const { activeTabIndex } = getContext();
|
|
85
|
-
const { tabIndex } =
|
|
49
|
+
const { tabIndex } = state;
|
|
86
50
|
return activeTabIndex === tabIndex;
|
|
87
51
|
},
|
|
88
52
|
/**
|
|
@@ -92,7 +56,7 @@ const { actions: privateActions, state: privateState } = store(
|
|
|
92
56
|
* @type {number}
|
|
93
57
|
*/
|
|
94
58
|
get tabIndexAttribute() {
|
|
95
|
-
return
|
|
59
|
+
return state.isActiveTab ? 0 : -1;
|
|
96
60
|
},
|
|
97
61
|
},
|
|
98
62
|
actions: {
|
|
@@ -102,7 +66,7 @@ const { actions: privateActions, state: privateState } = store(
|
|
|
102
66
|
* @param {KeyboardEvent} event The keydown event.
|
|
103
67
|
*/
|
|
104
68
|
handleTabKeyDown: withSyncEvent( ( event ) => {
|
|
105
|
-
const { tabIndex } =
|
|
69
|
+
const { tabIndex } = state;
|
|
106
70
|
|
|
107
71
|
if ( tabIndex === null ) {
|
|
108
72
|
return;
|
|
@@ -110,10 +74,10 @@ const { actions: privateActions, state: privateState } = store(
|
|
|
110
74
|
|
|
111
75
|
if ( event.key === 'ArrowRight' ) {
|
|
112
76
|
event.preventDefault();
|
|
113
|
-
|
|
77
|
+
actions.moveFocus( tabIndex + 1 );
|
|
114
78
|
} else if ( event.key === 'ArrowLeft' ) {
|
|
115
79
|
event.preventDefault();
|
|
116
|
-
|
|
80
|
+
actions.moveFocus( tabIndex - 1 );
|
|
117
81
|
}
|
|
118
82
|
} ),
|
|
119
83
|
/**
|
|
@@ -124,9 +88,9 @@ const { actions: privateActions, state: privateState } = store(
|
|
|
124
88
|
handleTabClick: withSyncEvent( ( event ) => {
|
|
125
89
|
event.preventDefault();
|
|
126
90
|
|
|
127
|
-
const { tabIndex } =
|
|
91
|
+
const { tabIndex } = state;
|
|
128
92
|
if ( tabIndex !== null ) {
|
|
129
|
-
|
|
93
|
+
actions.setActiveTab( tabIndex );
|
|
130
94
|
}
|
|
131
95
|
} ),
|
|
132
96
|
/**
|
|
@@ -135,7 +99,7 @@ const { actions: privateActions, state: privateState } = store(
|
|
|
135
99
|
* @param {number} tabIndex The index to move focus to.
|
|
136
100
|
*/
|
|
137
101
|
moveFocus: ( tabIndex ) => {
|
|
138
|
-
const { tabsList } =
|
|
102
|
+
const { tabsList } = state;
|
|
139
103
|
|
|
140
104
|
if ( ! tabsList || tabsList.length === 0 ) {
|
|
141
105
|
return;
|
|
@@ -148,20 +112,20 @@ const { actions: privateActions, state: privateState } = store(
|
|
|
148
112
|
newIndex = 0;
|
|
149
113
|
}
|
|
150
114
|
|
|
151
|
-
const tabId = tabsList[ newIndex ]
|
|
115
|
+
const tabId = tabsList[ newIndex ];
|
|
152
116
|
const tabElement = document.getElementById( 'tab__' + tabId );
|
|
153
117
|
if ( tabElement ) {
|
|
154
118
|
tabElement.focus();
|
|
155
119
|
}
|
|
156
120
|
},
|
|
157
121
|
/**
|
|
158
|
-
* Sets the active tab index
|
|
122
|
+
* Sets the active tab index.
|
|
159
123
|
*
|
|
160
124
|
* @param {number} tabIndex The index of the active tab.
|
|
161
125
|
* @param {boolean} scrollToTab Whether to scroll to the tab element.
|
|
162
126
|
*/
|
|
163
127
|
setActiveTab: ( tabIndex, scrollToTab = false ) => {
|
|
164
|
-
const { tabsList } =
|
|
128
|
+
const { tabsList } = state;
|
|
165
129
|
|
|
166
130
|
if ( ! tabsList || tabsList.length === 0 ) {
|
|
167
131
|
return;
|
|
@@ -178,7 +142,7 @@ const { actions: privateActions, state: privateState } = store(
|
|
|
178
142
|
context.activeTabIndex = newIndex;
|
|
179
143
|
|
|
180
144
|
if ( scrollToTab ) {
|
|
181
|
-
const tabId = tabsList[ newIndex ]
|
|
145
|
+
const tabId = tabsList[ newIndex ];
|
|
182
146
|
const tabElement = document.getElementById( tabId );
|
|
183
147
|
if ( tabElement ) {
|
|
184
148
|
setTimeout( () => {
|
|
@@ -194,17 +158,17 @@ const { actions: privateActions, state: privateState } = store(
|
|
|
194
158
|
*
|
|
195
159
|
*/
|
|
196
160
|
onTabsInit: () => {
|
|
197
|
-
const { tabsList } =
|
|
161
|
+
const { tabsList } = state;
|
|
198
162
|
if ( tabsList.length === 0 ) {
|
|
199
163
|
return;
|
|
200
164
|
}
|
|
201
165
|
|
|
202
166
|
const { hash } = window.location;
|
|
203
167
|
const tabId = hash.replace( '#', '' );
|
|
204
|
-
const tabIndex = tabsList.findIndex( ( t ) => t
|
|
168
|
+
const tabIndex = tabsList.findIndex( ( t ) => t === tabId );
|
|
205
169
|
// Check if tabIndex is a positive number and if so we'll auto activate that tab.
|
|
206
170
|
if ( tabIndex >= 0 ) {
|
|
207
|
-
|
|
171
|
+
actions.setActiveTab( tabIndex, true );
|
|
208
172
|
}
|
|
209
173
|
},
|
|
210
174
|
},
|
|
@@ -213,47 +177,3 @@ const { actions: privateActions, state: privateState } = store(
|
|
|
213
177
|
lock: true,
|
|
214
178
|
}
|
|
215
179
|
);
|
|
216
|
-
|
|
217
|
-
// Public store for third-party extensibility.
|
|
218
|
-
store( 'core/tabs', {
|
|
219
|
-
state: {
|
|
220
|
-
/**
|
|
221
|
-
* Gets a contextually aware list of tabs for the current tabs block.
|
|
222
|
-
* Public API for third-party access.
|
|
223
|
-
*
|
|
224
|
-
* @type {Array}
|
|
225
|
-
*/
|
|
226
|
-
get tabsList() {
|
|
227
|
-
return createReadOnlyProxy( privateState.tabsList );
|
|
228
|
-
},
|
|
229
|
-
/**
|
|
230
|
-
* Gets the index of the active tab element whether it
|
|
231
|
-
* is a tab label or tab panel.
|
|
232
|
-
*
|
|
233
|
-
* @type {number|null}
|
|
234
|
-
*/
|
|
235
|
-
get tabIndex() {
|
|
236
|
-
return privateState.tabIndex;
|
|
237
|
-
},
|
|
238
|
-
/**
|
|
239
|
-
* Whether the tab panel or tab label is the active tab.
|
|
240
|
-
*
|
|
241
|
-
* @type {boolean}
|
|
242
|
-
*/
|
|
243
|
-
get isActiveTab() {
|
|
244
|
-
return privateState.isActiveTab;
|
|
245
|
-
},
|
|
246
|
-
},
|
|
247
|
-
actions: {
|
|
248
|
-
/**
|
|
249
|
-
* Sets the active tab index.
|
|
250
|
-
* Public API for third-party programmatic tab activation.
|
|
251
|
-
*
|
|
252
|
-
* @param {number} tabIndex The index of the active tab.
|
|
253
|
-
* @param {boolean} scrollToTab Whether to scroll to the tab element.
|
|
254
|
-
*/
|
|
255
|
-
setActiveTab: ( tabIndex, scrollToTab = false ) => {
|
|
256
|
-
privateActions.setActiveTab( tabIndex, scrollToTab );
|
|
257
|
-
},
|
|
258
|
-
},
|
|
259
|
-
} );
|
|
@@ -18,7 +18,7 @@ describe( 'style state dimension utilities', () => {
|
|
|
18
18
|
aspectRatio: '1',
|
|
19
19
|
minHeight: '40px',
|
|
20
20
|
},
|
|
21
|
-
mobile: {
|
|
21
|
+
'@mobile': {
|
|
22
22
|
dimensions: {
|
|
23
23
|
aspectRatio: '2',
|
|
24
24
|
},
|
|
@@ -29,7 +29,7 @@ describe( 'style state dimension utilities', () => {
|
|
|
29
29
|
dimensions: {
|
|
30
30
|
minHeight: '40px',
|
|
31
31
|
},
|
|
32
|
-
mobile: {
|
|
32
|
+
'@mobile': {
|
|
33
33
|
dimensions: {
|
|
34
34
|
aspectRatio: '2',
|
|
35
35
|
},
|
|
@@ -42,13 +42,13 @@ describe( 'style state dimension utilities', () => {
|
|
|
42
42
|
dimensions: {
|
|
43
43
|
aspectRatio: '1',
|
|
44
44
|
},
|
|
45
|
-
mobile: {
|
|
45
|
+
'@mobile': {
|
|
46
46
|
dimensions: {
|
|
47
47
|
aspectRatio: '2',
|
|
48
48
|
width: '200px',
|
|
49
49
|
},
|
|
50
50
|
},
|
|
51
|
-
tablet: {
|
|
51
|
+
'@tablet': {
|
|
52
52
|
dimensions: {
|
|
53
53
|
aspectRatio: '3',
|
|
54
54
|
},
|
|
@@ -58,19 +58,19 @@ describe( 'style state dimension utilities', () => {
|
|
|
58
58
|
expect(
|
|
59
59
|
resetStateDimensions(
|
|
60
60
|
style,
|
|
61
|
-
{ viewport: 'mobile', pseudo: 'default' },
|
|
61
|
+
{ viewport: '@mobile', pseudo: 'default' },
|
|
62
62
|
[ 'aspectRatio' ]
|
|
63
63
|
)
|
|
64
64
|
).toEqual( {
|
|
65
65
|
dimensions: {
|
|
66
66
|
aspectRatio: '1',
|
|
67
67
|
},
|
|
68
|
-
mobile: {
|
|
68
|
+
'@mobile': {
|
|
69
69
|
dimensions: {
|
|
70
70
|
width: '200px',
|
|
71
71
|
},
|
|
72
72
|
},
|
|
73
|
-
tablet: {
|
|
73
|
+
'@tablet': {
|
|
74
74
|
dimensions: {
|
|
75
75
|
aspectRatio: '3',
|
|
76
76
|
},
|
|
@@ -80,12 +80,12 @@ describe( 'style state dimension utilities', () => {
|
|
|
80
80
|
|
|
81
81
|
it( 'sets dimensions only for the selected viewport state', () => {
|
|
82
82
|
const style = {
|
|
83
|
-
mobile: {
|
|
83
|
+
'@mobile': {
|
|
84
84
|
dimensions: {
|
|
85
85
|
width: '200px',
|
|
86
86
|
},
|
|
87
87
|
},
|
|
88
|
-
tablet: {
|
|
88
|
+
'@tablet': {
|
|
89
89
|
dimensions: {
|
|
90
90
|
width: '300px',
|
|
91
91
|
},
|
|
@@ -95,17 +95,17 @@ describe( 'style state dimension utilities', () => {
|
|
|
95
95
|
expect(
|
|
96
96
|
setStateDimensions(
|
|
97
97
|
style,
|
|
98
|
-
{ viewport: 'mobile', pseudo: 'default' },
|
|
98
|
+
{ viewport: '@mobile', pseudo: 'default' },
|
|
99
99
|
{ height: '100px' }
|
|
100
100
|
)
|
|
101
101
|
).toEqual( {
|
|
102
|
-
mobile: {
|
|
102
|
+
'@mobile': {
|
|
103
103
|
dimensions: {
|
|
104
104
|
height: '100px',
|
|
105
105
|
width: '200px',
|
|
106
106
|
},
|
|
107
107
|
},
|
|
108
|
-
tablet: {
|
|
108
|
+
'@tablet': {
|
|
109
109
|
dimensions: {
|
|
110
110
|
width: '300px',
|
|
111
111
|
},
|
|
@@ -115,8 +115,8 @@ describe( 'style state dimension utilities', () => {
|
|
|
115
115
|
|
|
116
116
|
it( 'generates a stable key for selected style states', () => {
|
|
117
117
|
expect(
|
|
118
|
-
getStyleStateKey( { viewport: 'mobile', pseudo: ':hover' } )
|
|
119
|
-
).toBe( 'mobile::hover' );
|
|
118
|
+
getStyleStateKey( { viewport: '@mobile', pseudo: ':hover' } )
|
|
119
|
+
).toBe( '@mobile::hover' );
|
|
120
120
|
expect( getStyleStateKey( undefined ) ).toBe( 'default:default' );
|
|
121
121
|
} );
|
|
122
122
|
|
|
@@ -138,14 +138,14 @@ describe( 'style state dimension utilities', () => {
|
|
|
138
138
|
attributes: {
|
|
139
139
|
scale: 'cover',
|
|
140
140
|
style: {
|
|
141
|
-
mobile: {
|
|
141
|
+
'@mobile': {
|
|
142
142
|
dimensions: {
|
|
143
143
|
objectFit: 'contain',
|
|
144
144
|
},
|
|
145
145
|
},
|
|
146
146
|
},
|
|
147
147
|
},
|
|
148
|
-
selectedState: { viewport: 'mobile', pseudo: 'default' },
|
|
148
|
+
selectedState: { viewport: '@mobile', pseudo: 'default' },
|
|
149
149
|
hasSelectedStyleState: true,
|
|
150
150
|
attributeKey: 'scale',
|
|
151
151
|
styleKey: 'objectFit',
|
|
@@ -157,13 +157,13 @@ describe( 'style state dimension utilities', () => {
|
|
|
157
157
|
expect(
|
|
158
158
|
getDimensionUpdateAttributes( {
|
|
159
159
|
style: {
|
|
160
|
-
mobile: {
|
|
160
|
+
'@mobile': {
|
|
161
161
|
dimensions: {
|
|
162
162
|
width: '200px',
|
|
163
163
|
},
|
|
164
164
|
},
|
|
165
165
|
},
|
|
166
|
-
selectedState: { viewport: 'mobile', pseudo: 'default' },
|
|
166
|
+
selectedState: { viewport: '@mobile', pseudo: 'default' },
|
|
167
167
|
hasSelectedStyleState: true,
|
|
168
168
|
nextDimensions: {
|
|
169
169
|
scale: 'contain',
|
|
@@ -174,7 +174,7 @@ describe( 'style state dimension utilities', () => {
|
|
|
174
174
|
} )
|
|
175
175
|
).toEqual( {
|
|
176
176
|
style: {
|
|
177
|
-
mobile: {
|
|
177
|
+
'@mobile': {
|
|
178
178
|
dimensions: {
|
|
179
179
|
objectFit: 'contain',
|
|
180
180
|
width: '200px',
|
|
@@ -207,14 +207,14 @@ describe( 'style state dimension utilities', () => {
|
|
|
207
207
|
expect(
|
|
208
208
|
getDimensionUpdateAttributes( {
|
|
209
209
|
style: {
|
|
210
|
-
mobile: {
|
|
210
|
+
'@mobile': {
|
|
211
211
|
dimensions: {
|
|
212
212
|
height: '100px',
|
|
213
213
|
width: '200px',
|
|
214
214
|
},
|
|
215
215
|
},
|
|
216
216
|
},
|
|
217
|
-
selectedState: { viewport: 'mobile', pseudo: 'default' },
|
|
217
|
+
selectedState: { viewport: '@mobile', pseudo: 'default' },
|
|
218
218
|
hasSelectedStyleState: true,
|
|
219
219
|
nextDimensions: {
|
|
220
220
|
aspectRatio: '16/9',
|
|
@@ -228,7 +228,7 @@ describe( 'style state dimension utilities', () => {
|
|
|
228
228
|
} )
|
|
229
229
|
).toEqual( {
|
|
230
230
|
style: {
|
|
231
|
-
mobile: {
|
|
231
|
+
'@mobile': {
|
|
232
232
|
dimensions: {
|
|
233
233
|
aspectRatio: '16/9',
|
|
234
234
|
objectFit: 'cover',
|
|
@@ -248,14 +248,14 @@ describe( 'style state dimension utilities', () => {
|
|
|
248
248
|
dimensions: {
|
|
249
249
|
width: '300px',
|
|
250
250
|
},
|
|
251
|
-
mobile: {
|
|
251
|
+
'@mobile': {
|
|
252
252
|
dimensions: {
|
|
253
253
|
width: '400px',
|
|
254
254
|
},
|
|
255
255
|
},
|
|
256
256
|
},
|
|
257
257
|
},
|
|
258
|
-
selectedState: { viewport: 'mobile', pseudo: 'default' },
|
|
258
|
+
selectedState: { viewport: '@mobile', pseudo: 'default' },
|
|
259
259
|
hasSelectedStyleState: true,
|
|
260
260
|
keys: [ 'width' ],
|
|
261
261
|
defaultAttributes: {
|
|
@@ -280,7 +280,7 @@ describe( 'style state dimension utilities', () => {
|
|
|
280
280
|
dimensions: {
|
|
281
281
|
width: '300px',
|
|
282
282
|
},
|
|
283
|
-
mobile: {
|
|
283
|
+
'@mobile': {
|
|
284
284
|
dimensions: {
|
|
285
285
|
width: '400px',
|
|
286
286
|
},
|
|
@@ -296,7 +296,7 @@ describe( 'style state dimension utilities', () => {
|
|
|
296
296
|
).toEqual( {
|
|
297
297
|
width: undefined,
|
|
298
298
|
style: {
|
|
299
|
-
mobile: {
|
|
299
|
+
'@mobile': {
|
|
300
300
|
dimensions: {
|
|
301
301
|
width: '400px',
|
|
302
302
|
},
|
package/src/video/edit.js
CHANGED
|
@@ -8,7 +8,6 @@ import clsx from 'clsx';
|
|
|
8
8
|
*/
|
|
9
9
|
import { isBlobURL } from '@wordpress/blob';
|
|
10
10
|
import {
|
|
11
|
-
Disabled,
|
|
12
11
|
Spinner,
|
|
13
12
|
Placeholder,
|
|
14
13
|
__experimentalToolsPanel as ToolsPanel,
|
|
@@ -235,21 +234,15 @@ function VideoEdit( {
|
|
|
235
234
|
</ToolsPanel>
|
|
236
235
|
</InspectorControls>
|
|
237
236
|
<figure { ...blockProps }>
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
src={ src || temporaryURL }
|
|
248
|
-
ref={ videoPlayer }
|
|
249
|
-
>
|
|
250
|
-
<Tracks tracks={ tracks } />
|
|
251
|
-
</video>
|
|
252
|
-
</Disabled>
|
|
237
|
+
<video
|
|
238
|
+
controls={ controls }
|
|
239
|
+
inert={ ! isSingleSelected ? 'true' : undefined }
|
|
240
|
+
poster={ poster }
|
|
241
|
+
src={ src || temporaryURL }
|
|
242
|
+
ref={ videoPlayer }
|
|
243
|
+
>
|
|
244
|
+
<Tracks tracks={ tracks } />
|
|
245
|
+
</video>
|
|
253
246
|
{ !! temporaryURL && <Spinner /> }
|
|
254
247
|
<Caption
|
|
255
248
|
attributes={ attributes }
|
|
@@ -120,7 +120,6 @@ function SingleTrackEditor( {
|
|
|
120
120
|
</span>
|
|
121
121
|
<Grid columns={ 2 } gap={ 4 }>
|
|
122
122
|
<TextControl
|
|
123
|
-
__next40pxDefaultSize
|
|
124
123
|
onChange={ ( newLabel ) =>
|
|
125
124
|
setTrackState( ( prevTrackState ) => ( {
|
|
126
125
|
...prevTrackState,
|
|
@@ -132,7 +131,6 @@ function SingleTrackEditor( {
|
|
|
132
131
|
help={ __( 'Title of track' ) }
|
|
133
132
|
/>
|
|
134
133
|
<TextControl
|
|
135
|
-
__next40pxDefaultSize
|
|
136
134
|
onChange={ ( newSrcLang ) =>
|
|
137
135
|
setTrackState( ( prevTrackState ) => ( {
|
|
138
136
|
...prevTrackState,
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/block-library/src/freeform/convert-to-blocks-button.js
|
|
21
|
-
var convert_to_blocks_button_exports = {};
|
|
22
|
-
__export(convert_to_blocks_button_exports, {
|
|
23
|
-
default: () => convert_to_blocks_button_default
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(convert_to_blocks_button_exports);
|
|
26
|
-
var import_i18n = require("@wordpress/i18n");
|
|
27
|
-
var import_components = require("@wordpress/components");
|
|
28
|
-
var import_blocks = require("@wordpress/blocks");
|
|
29
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
-
var ConvertToBlocksButton = ({ content, onReplace }) => {
|
|
31
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
32
|
-
import_components.ToolbarButton,
|
|
33
|
-
{
|
|
34
|
-
onClick: () => onReplace((0, import_blocks.rawHandler)({ HTML: content })),
|
|
35
|
-
children: (0, import_i18n.__)("Convert to blocks")
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
};
|
|
39
|
-
var convert_to_blocks_button_default = ConvertToBlocksButton;
|
|
40
|
-
//# sourceMappingURL=convert-to-blocks-button.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/freeform/convert-to-blocks-button.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ToolbarButton } from '@wordpress/components';\nimport { rawHandler } from '@wordpress/blocks';\n\nconst ConvertToBlocksButton = ( { content, onReplace } ) => {\n\treturn (\n\t\t<ToolbarButton\n\t\t\tonClick={ () => onReplace( rawHandler( { HTML: content } ) ) }\n\t\t>\n\t\t\t{ __( 'Convert to blocks' ) }\n\t\t</ToolbarButton>\n\t);\n};\n\nexport default ConvertToBlocksButton;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,wBAA8B;AAC9B,oBAA2B;AAIzB;AAFF,IAAM,wBAAwB,CAAE,EAAE,SAAS,UAAU,MAAO;AAC3D,SACC;AAAA,IAAC;AAAA;AAAA,MACA,SAAU,MAAM,cAAW,0BAAY,EAAE,MAAM,QAAQ,CAAE,CAAE;AAAA,MAEzD,8BAAI,mBAAoB;AAAA;AAAA,EAC3B;AAEF;AAEA,IAAO,mCAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/block-library/src/list-item/utils.js
|
|
21
|
-
var utils_exports = {};
|
|
22
|
-
__export(utils_exports, {
|
|
23
|
-
convertToListItems: () => convertToListItems
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(utils_exports);
|
|
26
|
-
var import_blocks = require("@wordpress/blocks");
|
|
27
|
-
function convertBlockToList(block) {
|
|
28
|
-
const list = (0, import_blocks.switchToBlockType)(block, "core/list");
|
|
29
|
-
if (list) {
|
|
30
|
-
return list;
|
|
31
|
-
}
|
|
32
|
-
const paragraph = (0, import_blocks.switchToBlockType)(block, "core/paragraph");
|
|
33
|
-
if (!paragraph) {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
return (0, import_blocks.switchToBlockType)(paragraph, "core/list");
|
|
37
|
-
}
|
|
38
|
-
function convertToListItems(blocks) {
|
|
39
|
-
const listItems = [];
|
|
40
|
-
for (let block of blocks) {
|
|
41
|
-
if (block.name === "core/list-item") {
|
|
42
|
-
listItems.push(block);
|
|
43
|
-
} else if (block.name === "core/list") {
|
|
44
|
-
listItems.push(...block.innerBlocks);
|
|
45
|
-
} else if (block = convertBlockToList(block)) {
|
|
46
|
-
for (const { innerBlocks } of block) {
|
|
47
|
-
listItems.push(...innerBlocks);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return listItems;
|
|
52
|
-
}
|
|
53
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
-
0 && (module.exports = {
|
|
55
|
-
convertToListItems
|
|
56
|
-
});
|
|
57
|
-
//# sourceMappingURL=utils.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/list-item/utils.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { switchToBlockType } from '@wordpress/blocks';\n\nfunction convertBlockToList( block ) {\n\tconst list = switchToBlockType( block, 'core/list' );\n\tif ( list ) {\n\t\treturn list;\n\t}\n\tconst paragraph = switchToBlockType( block, 'core/paragraph' );\n\tif ( ! paragraph ) {\n\t\treturn null;\n\t}\n\treturn switchToBlockType( paragraph, 'core/list' );\n}\n\nexport function convertToListItems( blocks ) {\n\tconst listItems = [];\n\n\tfor ( let block of blocks ) {\n\t\tif ( block.name === 'core/list-item' ) {\n\t\t\tlistItems.push( block );\n\t\t} else if ( block.name === 'core/list' ) {\n\t\t\tlistItems.push( ...block.innerBlocks );\n\t\t} else if ( ( block = convertBlockToList( block ) ) ) {\n\t\t\tfor ( const { innerBlocks } of block ) {\n\t\t\t\tlistItems.push( ...innerBlocks );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn listItems;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAkC;AAElC,SAAS,mBAAoB,OAAQ;AACpC,QAAM,WAAO,iCAAmB,OAAO,WAAY;AACnD,MAAK,MAAO;AACX,WAAO;AAAA,EACR;AACA,QAAM,gBAAY,iCAAmB,OAAO,gBAAiB;AAC7D,MAAK,CAAE,WAAY;AAClB,WAAO;AAAA,EACR;AACA,aAAO,iCAAmB,WAAW,WAAY;AAClD;AAEO,SAAS,mBAAoB,QAAS;AAC5C,QAAM,YAAY,CAAC;AAEnB,WAAU,SAAS,QAAS;AAC3B,QAAK,MAAM,SAAS,kBAAmB;AACtC,gBAAU,KAAM,KAAM;AAAA,IACvB,WAAY,MAAM,SAAS,aAAc;AACxC,gBAAU,KAAM,GAAG,MAAM,WAAY;AAAA,IACtC,WAAc,QAAQ,mBAAoB,KAAM,GAAM;AACrD,iBAAY,EAAE,YAAY,KAAK,OAAQ;AACtC,kBAAU,KAAM,GAAG,WAAY;AAAA,MAChC;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// packages/block-library/src/freeform/convert-to-blocks-button.js
|
|
2
|
-
import { __ } from "@wordpress/i18n";
|
|
3
|
-
import { ToolbarButton } from "@wordpress/components";
|
|
4
|
-
import { rawHandler } from "@wordpress/blocks";
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
var ConvertToBlocksButton = ({ content, onReplace }) => {
|
|
7
|
-
return /* @__PURE__ */ jsx(
|
|
8
|
-
ToolbarButton,
|
|
9
|
-
{
|
|
10
|
-
onClick: () => onReplace(rawHandler({ HTML: content })),
|
|
11
|
-
children: __("Convert to blocks")
|
|
12
|
-
}
|
|
13
|
-
);
|
|
14
|
-
};
|
|
15
|
-
var convert_to_blocks_button_default = ConvertToBlocksButton;
|
|
16
|
-
export {
|
|
17
|
-
convert_to_blocks_button_default as default
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=convert-to-blocks-button.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/freeform/convert-to-blocks-button.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ToolbarButton } from '@wordpress/components';\nimport { rawHandler } from '@wordpress/blocks';\n\nconst ConvertToBlocksButton = ( { content, onReplace } ) => {\n\treturn (\n\t\t<ToolbarButton\n\t\t\tonClick={ () => onReplace( rawHandler( { HTML: content } ) ) }\n\t\t>\n\t\t\t{ __( 'Convert to blocks' ) }\n\t\t</ToolbarButton>\n\t);\n};\n\nexport default ConvertToBlocksButton;\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,qBAAqB;AAC9B,SAAS,kBAAkB;AAIzB;AAFF,IAAM,wBAAwB,CAAE,EAAE,SAAS,UAAU,MAAO;AAC3D,SACC;AAAA,IAAC;AAAA;AAAA,MACA,SAAU,MAAM,UAAW,WAAY,EAAE,MAAM,QAAQ,CAAE,CAAE;AAAA,MAEzD,aAAI,mBAAoB;AAAA;AAAA,EAC3B;AAEF;AAEA,IAAO,mCAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// packages/block-library/src/list-item/utils.js
|
|
2
|
-
import { switchToBlockType } from "@wordpress/blocks";
|
|
3
|
-
function convertBlockToList(block) {
|
|
4
|
-
const list = switchToBlockType(block, "core/list");
|
|
5
|
-
if (list) {
|
|
6
|
-
return list;
|
|
7
|
-
}
|
|
8
|
-
const paragraph = switchToBlockType(block, "core/paragraph");
|
|
9
|
-
if (!paragraph) {
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
return switchToBlockType(paragraph, "core/list");
|
|
13
|
-
}
|
|
14
|
-
function convertToListItems(blocks) {
|
|
15
|
-
const listItems = [];
|
|
16
|
-
for (let block of blocks) {
|
|
17
|
-
if (block.name === "core/list-item") {
|
|
18
|
-
listItems.push(block);
|
|
19
|
-
} else if (block.name === "core/list") {
|
|
20
|
-
listItems.push(...block.innerBlocks);
|
|
21
|
-
} else if (block = convertBlockToList(block)) {
|
|
22
|
-
for (const { innerBlocks } of block) {
|
|
23
|
-
listItems.push(...innerBlocks);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return listItems;
|
|
28
|
-
}
|
|
29
|
-
export {
|
|
30
|
-
convertToListItems
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=utils.mjs.map
|