@wordpress/block-library 9.41.1-next.v.202603161435.0 → 9.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/form-input/edit.cjs +36 -29
- package/build/form-input/edit.cjs.map +2 -2
- package/build/form-input/variations.cjs +10 -0
- package/build/form-input/variations.cjs.map +2 -2
- package/build/group/block.json +3 -1
- package/build/html/modal.cjs +151 -229
- package/build/html/modal.cjs.map +2 -2
- package/build/image/image.cjs +13 -4
- package/build/image/image.cjs.map +2 -2
- package/build/latest-comments/deprecated.cjs +33 -0
- package/build/latest-comments/deprecated.cjs.map +2 -2
- package/build/list-item/block.json +1 -0
- package/build/navigation/edit/index.cjs +123 -119
- package/build/navigation/edit/index.cjs.map +3 -3
- package/build/navigation/edit/navigation-menu-selector.cjs +2 -1
- package/build/navigation/edit/navigation-menu-selector.cjs.map +2 -2
- package/build/post-date/block.json +1 -3
- package/build/post-date/deprecated.cjs +82 -6
- package/build/post-date/deprecated.cjs.map +3 -3
- package/build/post-date/edit.cjs +49 -62
- package/build/post-date/edit.cjs.map +3 -3
- package/build/site-logo/edit.cjs +19 -13
- package/build/site-logo/edit.cjs.map +3 -3
- package/build/site-tagline/deprecated.cjs +2 -1
- package/build/site-tagline/deprecated.cjs.map +2 -2
- package/build/site-title/index.cjs +5 -1
- package/build/site-title/index.cjs.map +2 -2
- package/build/tab/save.cjs +2 -4
- package/build/tab/save.cjs.map +2 -2
- package/build/tabs/save.cjs +2 -4
- package/build/tabs/save.cjs.map +2 -2
- package/build/utils/media-control.cjs +1 -1
- package/build/utils/media-control.cjs.map +2 -2
- package/build-module/form-input/edit.mjs +36 -29
- package/build-module/form-input/edit.mjs.map +2 -2
- package/build-module/form-input/variations.mjs +10 -0
- package/build-module/form-input/variations.mjs.map +2 -2
- package/build-module/group/block.json +3 -1
- package/build-module/html/modal.mjs +151 -229
- package/build-module/html/modal.mjs.map +2 -2
- package/build-module/image/image.mjs +13 -4
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/latest-comments/deprecated.mjs +33 -0
- package/build-module/latest-comments/deprecated.mjs.map +2 -2
- package/build-module/list-item/block.json +1 -0
- package/build-module/navigation/edit/index.mjs +123 -119
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/navigation-menu-selector.mjs +2 -1
- package/build-module/navigation/edit/navigation-menu-selector.mjs.map +2 -2
- package/build-module/post-date/block.json +1 -3
- package/build-module/post-date/deprecated.mjs +82 -6
- package/build-module/post-date/deprecated.mjs.map +2 -2
- package/build-module/post-date/edit.mjs +49 -63
- package/build-module/post-date/edit.mjs.map +2 -2
- package/build-module/site-logo/edit.mjs +21 -14
- package/build-module/site-logo/edit.mjs.map +2 -2
- package/build-module/site-tagline/deprecated.mjs +2 -1
- package/build-module/site-tagline/deprecated.mjs.map +2 -2
- package/build-module/site-title/index.mjs +5 -1
- package/build-module/site-title/index.mjs.map +2 -2
- package/build-module/tab/save.mjs +2 -4
- package/build-module/tab/save.mjs.map +2 -2
- package/build-module/tabs/save.mjs +2 -4
- package/build-module/tabs/save.mjs.map +2 -2
- package/build-module/utils/media-control.mjs +1 -1
- package/build-module/utils/media-control.mjs.map +2 -2
- package/build-style/editor-rtl.css +15 -5
- package/build-style/editor.css +15 -5
- package/build-style/form-input/editor-rtl.css +6 -5
- package/build-style/form-input/editor.css +6 -5
- package/build-style/icon/editor-rtl.css +5 -0
- package/build-style/icon/editor.css +5 -0
- package/build-style/image/editor-rtl.css +4 -0
- package/build-style/image/editor.css +4 -0
- package/build-style/navigation/style-rtl.css +4 -1
- package/build-style/navigation/style.css +4 -1
- package/build-style/style-rtl.css +4 -1
- package/build-style/style.css +4 -1
- package/package.json +38 -38
- package/src/form-input/edit.js +19 -15
- package/src/form-input/editor.scss +6 -6
- package/src/form-input/variations.js +10 -0
- package/src/group/block.json +3 -1
- package/src/home-link/index.php +14 -33
- package/src/html/modal.js +6 -77
- package/src/icon/editor.scss +5 -0
- package/src/image/editor.scss +5 -0
- package/src/image/image.js +18 -3
- package/src/latest-comments/deprecated.js +33 -0
- package/src/list-item/block.json +1 -0
- package/src/loginout/index.php +13 -0
- package/src/navigation/edit/index.js +134 -130
- package/src/navigation/edit/navigation-menu-selector.js +2 -1
- package/src/navigation/index.php +24 -6
- package/src/navigation/style.scss +5 -3
- package/src/navigation-link/index.php +10 -38
- package/src/navigation-link/shared/build-css-font-sizes.php +43 -0
- package/src/navigation-submenu/index.php +10 -38
- package/src/page-list/index.php +14 -41
- package/src/post-date/block.json +1 -3
- package/src/post-date/deprecated.js +86 -6
- package/src/post-date/edit.js +65 -82
- package/src/site-logo/edit.js +24 -13
- package/src/site-tagline/deprecated.js +1 -0
- package/src/site-title/index.js +5 -1
- package/src/tab/save.js +2 -6
- package/src/tabs/save.js +2 -6
- package/src/utils/media-control.js +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -110,23 +110,38 @@ function InputFieldBlock({ attributes, setAttributes, className }) {
|
|
|
110
110
|
]
|
|
111
111
|
}
|
|
112
112
|
) }),
|
|
113
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
113
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_block_editor.InspectorControls, { group: "advanced", children: [
|
|
114
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
115
|
+
import_components.TextControl,
|
|
116
|
+
{
|
|
117
|
+
__next40pxDefaultSize: true,
|
|
118
|
+
autoComplete: "off",
|
|
119
|
+
label: (0, import_i18n.__)("Name"),
|
|
120
|
+
value: name,
|
|
121
|
+
onChange: (newVal) => {
|
|
122
|
+
setAttributes({
|
|
123
|
+
name: newVal
|
|
124
|
+
});
|
|
125
|
+
},
|
|
126
|
+
help: (0, import_i18n.__)(
|
|
127
|
+
'Affects the "name" attribute of the input element, and is used as a name for the form submission results.'
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
"hidden" === type && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
132
|
+
import_components.TextControl,
|
|
133
|
+
{
|
|
134
|
+
__next40pxDefaultSize: true,
|
|
135
|
+
autoComplete: "off",
|
|
136
|
+
label: (0, import_i18n.__)("Value"),
|
|
137
|
+
value,
|
|
138
|
+
onChange: (newVal) => setAttributes({ value: newVal }),
|
|
139
|
+
help: (0, import_i18n.__)(
|
|
140
|
+
"Sets the stored value for this hidden field."
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
)
|
|
144
|
+
] })
|
|
130
145
|
] });
|
|
131
146
|
const content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
132
147
|
import_block_editor.RichText,
|
|
@@ -141,21 +156,13 @@ function InputFieldBlock({ attributes, setAttributes, className }) {
|
|
|
141
156
|
}
|
|
142
157
|
);
|
|
143
158
|
if ("hidden" === type) {
|
|
144
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ...blockProps, children: [
|
|
145
160
|
controls,
|
|
146
161
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
147
|
-
"
|
|
162
|
+
"span",
|
|
148
163
|
{
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
className,
|
|
152
|
-
"wp-block-form-input__input",
|
|
153
|
-
colorProps.className,
|
|
154
|
-
borderProps.className
|
|
155
|
-
),
|
|
156
|
-
"aria-label": (0, import_i18n.__)("Value"),
|
|
157
|
-
value,
|
|
158
|
-
onChange: (event) => setAttributes({ value: event.target.value })
|
|
164
|
+
className: "wp-block-form-input__label is-input-hidden",
|
|
165
|
+
"data-message": (0, import_i18n.__)("Hidden field")
|
|
159
166
|
}
|
|
160
167
|
)
|
|
161
168
|
] });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/form-input/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n} from '@wordpress/block-editor';\nimport {\n\tTextControl,\n\tCheckboxControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nfunction InputFieldBlock( { attributes, setAttributes, className } ) {\n\tconst { type, name, label, inlineLabel, required, placeholder, value } =\n\t\tattributes;\n\tconst blockProps = useBlockProps();\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst ref = useRef();\n\tconst TagName = type === 'textarea' ? 'textarea' : 'input';\n\n\tconst borderProps = useBorderProps( attributes );\n\tconst colorProps = useColorProps( attributes );\n\tif ( ref.current ) {\n\t\tref.current.focus();\n\t}\n\n\t// Note: radio inputs aren't implemented yet.\n\tconst isCheckboxOrRadio = type === 'checkbox' || type === 'radio';\n\n\tconst controls = (\n\t\t<>\n\t\t\t{ 'hidden' !== type && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tinlineLabel: false,\n\t\t\t\t\t\t\t\trequired: false,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ 'checkbox' !== type && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Inline label' ) }\n\t\t\t\t\t\t\t\thasValue={ () => !! inlineLabel }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { inlineLabel: false } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Inline label' ) }\n\t\t\t\t\t\t\t\t\tchecked={ inlineLabel }\n\t\t\t\t\t\t\t\t\tonChange={ ( newVal ) => {\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\tinlineLabel: newVal,\n\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Required' ) }\n\t\t\t\t\t\t\thasValue={ () => !! required }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { required: false } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Required' ) }\n\t\t\t\t\t\t\t\tchecked={ required }\n\t\t\t\t\t\t\t\tonChange={ ( newVal ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\trequired: newVal,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t</ToolsPanel>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\tvalue={ name }\n\t\t\t\t\tonChange={ ( newVal ) => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tname: newVal,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'Affects the \"name\" attribute of the input element, and is used as a name for the form submission results.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tconst content = (\n\t\t<RichText\n\t\t\ttagName=\"span\"\n\t\t\tclassName=\"wp-block-form-input__label-content\"\n\t\t\tvalue={ label }\n\t\t\tonChange={ ( newLabel ) => setAttributes( { label: newLabel } ) }\n\t\t\taria-label={ label ? __( 'Label' ) : __( 'Empty label' ) }\n\t\t\tdata-empty={ ! label }\n\t\t\tplaceholder={ __( 'Type the label for this input' ) }\n\t\t/>\n\t);\n\n\tif ( 'hidden' === type ) {\n\t\treturn (\n\t\t\t
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAAmB;AACnB,0BAMO;AACP,wBAKO;AACP,qBAAuB;AAKvB,mBAA+C;AAoB7C;AAlBF,SAAS,gBAAiB,EAAE,YAAY,eAAe,UAAU,GAAI;AACpE,QAAM,EAAE,MAAM,MAAM,OAAO,aAAa,UAAU,aAAa,MAAM,IACpE;AACD,QAAM,iBAAa,mCAAc;AACjC,QAAM,wBAAoB,6CAA+B;AACzD,QAAM,UAAM,uBAAO;AACnB,QAAM,UAAU,SAAS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;AAAA,UACD;AAAA;AAAA;AAAA,IACD,GACD;AAAA,IAED,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n} from '@wordpress/block-editor';\nimport {\n\tTextControl,\n\tCheckboxControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nfunction InputFieldBlock( { attributes, setAttributes, className } ) {\n\tconst { type, name, label, inlineLabel, required, placeholder, value } =\n\t\tattributes;\n\tconst blockProps = useBlockProps();\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst ref = useRef();\n\tconst TagName = type === 'textarea' ? 'textarea' : 'input';\n\n\tconst borderProps = useBorderProps( attributes );\n\tconst colorProps = useColorProps( attributes );\n\tif ( ref.current ) {\n\t\tref.current.focus();\n\t}\n\n\t// Note: radio inputs aren't implemented yet.\n\tconst isCheckboxOrRadio = type === 'checkbox' || type === 'radio';\n\n\tconst controls = (\n\t\t<>\n\t\t\t{ 'hidden' !== type && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tinlineLabel: false,\n\t\t\t\t\t\t\t\trequired: false,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ 'checkbox' !== type && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Inline label' ) }\n\t\t\t\t\t\t\t\thasValue={ () => !! inlineLabel }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { inlineLabel: false } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Inline label' ) }\n\t\t\t\t\t\t\t\t\tchecked={ inlineLabel }\n\t\t\t\t\t\t\t\t\tonChange={ ( newVal ) => {\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\tinlineLabel: newVal,\n\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Required' ) }\n\t\t\t\t\t\t\thasValue={ () => !! required }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { required: false } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Required' ) }\n\t\t\t\t\t\t\t\tchecked={ required }\n\t\t\t\t\t\t\t\tonChange={ ( newVal ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\trequired: newVal,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t</ToolsPanel>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\tvalue={ name }\n\t\t\t\t\tonChange={ ( newVal ) => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tname: newVal,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'Affects the \"name\" attribute of the input element, and is used as a name for the form submission results.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t{ 'hidden' === type && (\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\tlabel={ __( 'Value' ) }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tonChange={ ( newVal ) =>\n\t\t\t\t\t\t\tsetAttributes( { value: newVal } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Sets the stored value for this hidden field.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tconst content = (\n\t\t<RichText\n\t\t\ttagName=\"span\"\n\t\t\tclassName=\"wp-block-form-input__label-content\"\n\t\t\tvalue={ label }\n\t\t\tonChange={ ( newLabel ) => setAttributes( { label: newLabel } ) }\n\t\t\taria-label={ label ? __( 'Label' ) : __( 'Empty label' ) }\n\t\t\tdata-empty={ ! label }\n\t\t\tplaceholder={ __( 'Type the label for this input' ) }\n\t\t/>\n\t);\n\n\tif ( 'hidden' === type ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ controls }\n\t\t\t\t<span\n\t\t\t\t\tclassName=\"wp-block-form-input__label is-input-hidden\"\n\t\t\t\t\tdata-message={ __( 'Hidden field' ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t{ controls }\n\t\t\t<span\n\t\t\t\tclassName={ clsx( 'wp-block-form-input__label', {\n\t\t\t\t\t'is-label-inline': inlineLabel || 'checkbox' === type,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t{ ! isCheckboxOrRadio && content }\n\t\t\t\t<TagName\n\t\t\t\t\ttype={ 'textarea' === type ? undefined : type }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t'wp-block-form-input__input',\n\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\tborderProps.className\n\t\t\t\t\t) }\n\t\t\t\t\taria-label={ __( 'Optional placeholder text' ) }\n\t\t\t\t\t// We hide the placeholder field's placeholder when there is a value. This\n\t\t\t\t\t// stops screen readers from reading the placeholder field's placeholder\n\t\t\t\t\t// which is confusing.\n\t\t\t\t\tplaceholder={\n\t\t\t\t\t\tplaceholder ? undefined : __( 'Optional placeholder\u2026' )\n\t\t\t\t\t}\n\t\t\t\t\tvalue={ placeholder }\n\t\t\t\t\tonChange={ ( event ) =>\n\t\t\t\t\t\tsetAttributes( { placeholder: event.target.value } )\n\t\t\t\t\t}\n\t\t\t\t\taria-required={ required }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t...colorProps.style,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t{ isCheckboxOrRadio && content }\n\t\t\t</span>\n\t\t</div>\n\t);\n}\n\nexport default InputFieldBlock;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAAmB;AACnB,0BAMO;AACP,wBAKO;AACP,qBAAuB;AAKvB,mBAA+C;AAoB7C;AAlBF,SAAS,gBAAiB,EAAE,YAAY,eAAe,UAAU,GAAI;AACpE,QAAM,EA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AM,GAAG,YACP;AAAA;AAAA,IACF;AAAA,MAAC;AAAA;AAAA,QACA,eAAY,YAAAC,SAAM,8BAA8B;AAAA,UAC/C,mBAAmB,eAAe,eAAe;AAAA,QAClD,CAAE;AAAA,QAEA;AAAA,WAAE,qBAAqB;AAAA,UACzB;AAAA,YAAC;AAAA;AAAA,cACA,MAAO,eAAe,OAAO,SAAY;AAAA,cACzC,eAAY,YAAAA;AAAA,gBACX;AAAA,gBACA;AAAA,gBACA,WAAW;AAAA,gBACX,YAAY;AAAA,cACb;AAAA,cACA,kBAAa,gBAAI,2BAA4B;AAAA,cAI7C,aACC,cAAc,aAAY,gBAAI,4BAAwB;AAAA,cAEvD,OAAQ;AAAA,cACR,UAAW,CAAE,UACZ,cAAe,EAAE,aAAa,MAAM,OAAO,MAAM,CAAE;AAAA,cAEpD,iBAAgB;AAAA,cAChB,OAAQ;AAAA,gBACP,GAAG,YAAY;AAAA,gBACf,GAAG,WAAW;AAAA,cACf;AAAA;AAAA,UACD;AAAA,UACE,qBAAqB;AAAA;AAAA;AAAA,IACxB;AAAA,KACD;AAEF;AAEA,IAAO,eAAQ;",
|
|
6
6
|
"names": ["useBorderProps", "useColorProps", "ToolsPanel", "ToolsPanelItem", "clsx"]
|
|
7
7
|
}
|
|
@@ -89,6 +89,16 @@ var variations = [
|
|
|
89
89
|
isDefault: true,
|
|
90
90
|
scope: ["inserter", "transform"],
|
|
91
91
|
isActive: (blockAttributes) => blockAttributes?.type === "number"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: "hidden",
|
|
95
|
+
title: (0, import_i18n.__)("Hidden Input"),
|
|
96
|
+
icon: "visibility",
|
|
97
|
+
description: (0, import_i18n.__)("A hidden input field."),
|
|
98
|
+
attributes: { type: "hidden" },
|
|
99
|
+
isDefault: true,
|
|
100
|
+
scope: ["inserter", "transform"],
|
|
101
|
+
isActive: (blockAttributes) => blockAttributes?.type === "hidden"
|
|
92
102
|
}
|
|
93
103
|
];
|
|
94
104
|
var variations_default = variations;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/form-input/variations.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nconst variations = [\n\t{\n\t\tname: 'text',\n\t\ttitle: __( 'Text Input' ),\n\t\tdescription: __( 'A generic text input.' ),\n\t\tattributes: { type: 'text' },\n\t\tisDefault: true,\n\t\tscope: [ 'inserter', 'transform' ],\n\t\tisActive: ( blockAttributes ) =>\n\t\t\t! blockAttributes?.type || blockAttributes?.type === 'text',\n\t},\n\t{\n\t\tname: 'textarea',\n\t\ttitle: __( 'Textarea Input' ),\n\t\tdescription: __(\n\t\t\t'A textarea input to allow entering multiple lines of text.'\n\t\t),\n\t\tattributes: { type: 'textarea' },\n\t\tisDefault: true,\n\t\tscope: [ 'inserter', 'transform' ],\n\t\tisActive: ( blockAttributes ) => blockAttributes?.type === 'textarea',\n\t},\n\t{\n\t\tname: 'checkbox',\n\t\ttitle: __( 'Checkbox Input' ),\n\t\tdescription: __( 'A simple checkbox input.' ),\n\t\tattributes: { type: 'checkbox', inlineLabel: true },\n\t\tisDefault: true,\n\t\tscope: [ 'inserter', 'transform' ],\n\t\tisActive: ( blockAttributes ) => blockAttributes?.type === 'checkbox',\n\t},\n\t{\n\t\tname: 'email',\n\t\ttitle: __( 'Email Input' ),\n\t\tdescription: __( 'Used for email addresses.' ),\n\t\tattributes: { type: 'email' },\n\t\tisDefault: true,\n\t\tscope: [ 'inserter', 'transform' ],\n\t\tisActive: ( blockAttributes ) => blockAttributes?.type === 'email',\n\t},\n\t{\n\t\tname: 'url',\n\t\ttitle: __( 'URL Input' ),\n\t\tdescription: __( 'Used for URLs.' ),\n\t\tattributes: { type: 'url' },\n\t\tisDefault: true,\n\t\tscope: [ 'inserter', 'transform' ],\n\t\tisActive: ( blockAttributes ) => blockAttributes?.type === 'url',\n\t},\n\t{\n\t\tname: 'tel',\n\t\ttitle: __( 'Telephone Input' ),\n\t\tdescription: __( 'Used for phone numbers.' ),\n\t\tattributes: { type: 'tel' },\n\t\tisDefault: true,\n\t\tscope: [ 'inserter', 'transform' ],\n\t\tisActive: ( blockAttributes ) => blockAttributes?.type === 'tel',\n\t},\n\t{\n\t\tname: 'number',\n\t\ttitle: __( 'Number Input' ),\n\t\tdescription: __( 'A numeric input.' ),\n\t\tattributes: { type: 'number' },\n\t\tisDefault: true,\n\t\tscope: [ 'inserter', 'transform' ],\n\t\tisActive: ( blockAttributes ) => blockAttributes?.type === 'number',\n\t},\n];\n\nexport default variations;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AAEnB,IAAM,aAAa;AAAA,EAClB;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,YAAa;AAAA,IACxB,iBAAa,gBAAI,uBAAwB;AAAA,IACzC,YAAY,EAAE,MAAM,OAAO;AAAA,IAC3B,WAAW;AAAA,IACX,OAAO,CAAE,YAAY,WAAY;AAAA,IACjC,UAAU,CAAE,oBACX,CAAE,iBAAiB,QAAQ,iBAAiB,SAAS;AAAA,EACvD;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,gBAAiB;AAAA,IAC5B,iBAAa;AAAA,MACZ;AAAA,IACD;AAAA,IACA,YAAY,EAAE,MAAM,WAAW;AAAA,IAC/B,WAAW;AAAA,IACX,OAAO,CAAE,YAAY,WAAY;AAAA,IACjC,UAAU,CAAE,oBAAqB,iBAAiB,SAAS;AAAA,EAC5D;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,gBAAiB;AAAA,IAC5B,iBAAa,gBAAI,0BAA2B;AAAA,IAC5C,YAAY,EAAE,MAAM,YAAY,aAAa,KAAK;AAAA,IAClD,WAAW;AAAA,IACX,OAAO,CAAE,YAAY,WAAY;AAAA,IACjC,UAAU,CAAE,oBAAqB,iBAAiB,SAAS;AAAA,EAC5D;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,aAAc;AAAA,IACzB,iBAAa,gBAAI,2BAA4B;AAAA,IAC7C,YAAY,EAAE,MAAM,QAAQ;AAAA,IAC5B,WAAW;AAAA,IACX,OAAO,CAAE,YAAY,WAAY;AAAA,IACjC,UAAU,CAAE,oBAAqB,iBAAiB,SAAS;AAAA,EAC5D;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,WAAY;AAAA,IACvB,iBAAa,gBAAI,gBAAiB;AAAA,IAClC,YAAY,EAAE,MAAM,MAAM;AAAA,IAC1B,WAAW;AAAA,IACX,OAAO,CAAE,YAAY,WAAY;AAAA,IACjC,UAAU,CAAE,oBAAqB,iBAAiB,SAAS;AAAA,EAC5D;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,iBAAkB;AAAA,IAC7B,iBAAa,gBAAI,yBAA0B;AAAA,IAC3C,YAAY,EAAE,MAAM,MAAM;AAAA,IAC1B,WAAW;AAAA,IACX,OAAO,CAAE,YAAY,WAAY;AAAA,IACjC,UAAU,CAAE,oBAAqB,iBAAiB,SAAS;AAAA,EAC5D;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,cAAe;AAAA,IAC1B,iBAAa,gBAAI,kBAAmB;AAAA,IACpC,YAAY,EAAE,MAAM,SAAS;AAAA,IAC7B,WAAW;AAAA,IACX,OAAO,CAAE,YAAY,WAAY;AAAA,IACjC,UAAU,CAAE,oBAAqB,iBAAiB,SAAS;AAAA,EAC5D;AACD;AAEA,IAAO,qBAAQ;",
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nconst variations = [\n\t{\n\t\tname: 'text',\n\t\ttitle: __( 'Text Input' ),\n\t\tdescription: __( 'A generic text input.' ),\n\t\tattributes: { type: 'text' },\n\t\tisDefault: true,\n\t\tscope: [ 'inserter', 'transform' ],\n\t\tisActive: ( blockAttributes ) =>\n\t\t\t! blockAttributes?.type || blockAttributes?.type === 'text',\n\t},\n\t{\n\t\tname: 'textarea',\n\t\ttitle: __( 'Textarea Input' ),\n\t\tdescription: __(\n\t\t\t'A textarea input to allow entering multiple lines of text.'\n\t\t),\n\t\tattributes: { type: 'textarea' },\n\t\tisDefault: true,\n\t\tscope: [ 'inserter', 'transform' ],\n\t\tisActive: ( blockAttributes ) => blockAttributes?.type === 'textarea',\n\t},\n\t{\n\t\tname: 'checkbox',\n\t\ttitle: __( 'Checkbox Input' ),\n\t\tdescription: __( 'A simple checkbox input.' ),\n\t\tattributes: { type: 'checkbox', inlineLabel: true },\n\t\tisDefault: true,\n\t\tscope: [ 'inserter', 'transform' ],\n\t\tisActive: ( blockAttributes ) => blockAttributes?.type === 'checkbox',\n\t},\n\t{\n\t\tname: 'email',\n\t\ttitle: __( 'Email Input' ),\n\t\tdescription: __( 'Used for email addresses.' ),\n\t\tattributes: { type: 'email' },\n\t\tisDefault: true,\n\t\tscope: [ 'inserter', 'transform' ],\n\t\tisActive: ( blockAttributes ) => blockAttributes?.type === 'email',\n\t},\n\t{\n\t\tname: 'url',\n\t\ttitle: __( 'URL Input' ),\n\t\tdescription: __( 'Used for URLs.' ),\n\t\tattributes: { type: 'url' },\n\t\tisDefault: true,\n\t\tscope: [ 'inserter', 'transform' ],\n\t\tisActive: ( blockAttributes ) => blockAttributes?.type === 'url',\n\t},\n\t{\n\t\tname: 'tel',\n\t\ttitle: __( 'Telephone Input' ),\n\t\tdescription: __( 'Used for phone numbers.' ),\n\t\tattributes: { type: 'tel' },\n\t\tisDefault: true,\n\t\tscope: [ 'inserter', 'transform' ],\n\t\tisActive: ( blockAttributes ) => blockAttributes?.type === 'tel',\n\t},\n\t{\n\t\tname: 'number',\n\t\ttitle: __( 'Number Input' ),\n\t\tdescription: __( 'A numeric input.' ),\n\t\tattributes: { type: 'number' },\n\t\tisDefault: true,\n\t\tscope: [ 'inserter', 'transform' ],\n\t\tisActive: ( blockAttributes ) => blockAttributes?.type === 'number',\n\t},\n\t{\n\t\tname: 'hidden',\n\t\ttitle: __( 'Hidden Input' ),\n\t\ticon: 'visibility',\n\t\tdescription: __( 'A hidden input field.' ),\n\t\tattributes: { type: 'hidden' },\n\t\tisDefault: true,\n\t\tscope: [ 'inserter', 'transform' ],\n\t\tisActive: ( blockAttributes ) => blockAttributes?.type === 'hidden',\n\t},\n];\n\nexport default variations;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AAEnB,IAAM,aAAa;AAAA,EAClB;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,YAAa;AAAA,IACxB,iBAAa,gBAAI,uBAAwB;AAAA,IACzC,YAAY,EAAE,MAAM,OAAO;AAAA,IAC3B,WAAW;AAAA,IACX,OAAO,CAAE,YAAY,WAAY;AAAA,IACjC,UAAU,CAAE,oBACX,CAAE,iBAAiB,QAAQ,iBAAiB,SAAS;AAAA,EACvD;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,gBAAiB;AAAA,IAC5B,iBAAa;AAAA,MACZ;AAAA,IACD;AAAA,IACA,YAAY,EAAE,MAAM,WAAW;AAAA,IAC/B,WAAW;AAAA,IACX,OAAO,CAAE,YAAY,WAAY;AAAA,IACjC,UAAU,CAAE,oBAAqB,iBAAiB,SAAS;AAAA,EAC5D;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,WAAO,gBAAI,gBAAiB;AAAA,IAC5B,iBAAa,gBAAI,0BAA2B;AAAA,IAC5C,YAAY,EAAE,MAAM,YAAY,aAAa,KAAK;AAAA,IAClD,WAAW;AAAA,IACX,OAAO,CAAE,YAAY,WAAY;AAAA,IACjC,UAAU,CAAE,oBAAqB,iBAAiB,SAAS;AAAA,EAC5D;AAAA,EACA;AAAA,IACC,M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AO,qBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/group/block.json
CHANGED
package/build/html/modal.cjs
CHANGED
|
@@ -55,8 +55,6 @@ function HTMLEditModal({
|
|
|
55
55
|
const [editedHtml, setEditedHtml] = (0, import_element.useState)(html);
|
|
56
56
|
const [editedCss, setEditedCss] = (0, import_element.useState)(css);
|
|
57
57
|
const [editedJs, setEditedJs] = (0, import_element.useState)(js);
|
|
58
|
-
const [isDirty, setIsDirty] = (0, import_element.useState)(false);
|
|
59
|
-
const [showUnsavedWarning, setShowUnsavedWarning] = (0, import_element.useState)(false);
|
|
60
58
|
const [isFullscreen, setIsFullscreen] = (0, import_element.useState)(false);
|
|
61
59
|
const isMobileViewport = (0, import_compose.useViewportMatch)("small", "<");
|
|
62
60
|
const { canUserUseUnfilteredHTML } = (0, import_data.useSelect)((select) => {
|
|
@@ -69,18 +67,6 @@ function HTMLEditModal({
|
|
|
69
67
|
if (!isOpen) {
|
|
70
68
|
return null;
|
|
71
69
|
}
|
|
72
|
-
const handleHtmlChange = (value) => {
|
|
73
|
-
setEditedHtml(value);
|
|
74
|
-
setIsDirty(true);
|
|
75
|
-
};
|
|
76
|
-
const handleCssChange = (value) => {
|
|
77
|
-
setEditedCss(value);
|
|
78
|
-
setIsDirty(true);
|
|
79
|
-
};
|
|
80
|
-
const handleJsChange = (value) => {
|
|
81
|
-
setEditedJs(value);
|
|
82
|
-
setIsDirty(true);
|
|
83
|
-
};
|
|
84
70
|
const handleUpdate = () => {
|
|
85
71
|
setAttributes({
|
|
86
72
|
content: (0, import_utils.serializeContent)({
|
|
@@ -89,25 +75,6 @@ function HTMLEditModal({
|
|
|
89
75
|
js: canUserUseUnfilteredHTML ? editedJs : ""
|
|
90
76
|
})
|
|
91
77
|
});
|
|
92
|
-
setIsDirty(false);
|
|
93
|
-
};
|
|
94
|
-
const handleCancel = () => {
|
|
95
|
-
setIsDirty(false);
|
|
96
|
-
onRequestClose();
|
|
97
|
-
};
|
|
98
|
-
const handleRequestClose = () => {
|
|
99
|
-
if (isDirty) {
|
|
100
|
-
setShowUnsavedWarning(true);
|
|
101
|
-
} else {
|
|
102
|
-
onRequestClose();
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
const handleDiscardChanges = () => {
|
|
106
|
-
setShowUnsavedWarning(false);
|
|
107
|
-
onRequestClose();
|
|
108
|
-
};
|
|
109
|
-
const handleContinueEditing = () => {
|
|
110
|
-
setShowUnsavedWarning(false);
|
|
111
78
|
};
|
|
112
79
|
const handleUpdateAndClose = () => {
|
|
113
80
|
handleUpdate();
|
|
@@ -116,210 +83,165 @@ function HTMLEditModal({
|
|
|
116
83
|
const toggleFullscreen = () => {
|
|
117
84
|
setIsFullscreen((prevState) => !prevState);
|
|
118
85
|
};
|
|
119
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
label: (0, import_i18n.__)(
|
|
150
|
-
"Enable/disable fullscreen"
|
|
151
|
-
),
|
|
152
|
-
onClick: toggleFullscreen,
|
|
153
|
-
variant: "tertiary"
|
|
154
|
-
}
|
|
155
|
-
) })
|
|
156
|
-
]
|
|
157
|
-
}
|
|
158
|
-
),
|
|
159
|
-
hasRestrictedContent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
160
|
-
import_components.Notice,
|
|
161
|
-
{
|
|
162
|
-
status: "warning",
|
|
163
|
-
isDismissible: false,
|
|
164
|
-
className: "block-library-html__modal-notice",
|
|
165
|
-
children: (0, import_i18n.__)(
|
|
166
|
-
"This block contains CSS or JavaScript that will be removed when you save because you do not have permission to use unfiltered HTML."
|
|
167
|
-
)
|
|
168
|
-
}
|
|
169
|
-
),
|
|
170
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
171
|
-
import_components.Flex,
|
|
172
|
-
{
|
|
173
|
-
direction: isMobileViewport ? "column" : "row",
|
|
174
|
-
className: "block-library-html__modal-tabs",
|
|
175
|
-
align: "stretch",
|
|
176
|
-
gap: 8,
|
|
177
|
-
children: [
|
|
178
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "block-library-html__modal-content", children: [
|
|
179
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
180
|
-
Tabs.TabPanel,
|
|
181
|
-
{
|
|
182
|
-
tabId: "html",
|
|
183
|
-
focusable: false,
|
|
184
|
-
className: "block-library-html__modal-tab",
|
|
185
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
186
|
-
import_block_editor.PlainText,
|
|
187
|
-
{
|
|
188
|
-
value: editedHtml,
|
|
189
|
-
onChange: handleHtmlChange,
|
|
190
|
-
placeholder: (0, import_i18n.__)("Write HTML\u2026"),
|
|
191
|
-
"aria-label": (0, import_i18n.__)("HTML"),
|
|
192
|
-
className: "block-library-html__modal-editor"
|
|
193
|
-
}
|
|
194
|
-
)
|
|
195
|
-
}
|
|
196
|
-
),
|
|
197
|
-
canUserUseUnfilteredHTML && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
198
|
-
Tabs.TabPanel,
|
|
199
|
-
{
|
|
200
|
-
tabId: "css",
|
|
201
|
-
focusable: false,
|
|
202
|
-
className: "block-library-html__modal-tab",
|
|
203
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
204
|
-
import_block_editor.PlainText,
|
|
205
|
-
{
|
|
206
|
-
value: editedCss,
|
|
207
|
-
onChange: handleCssChange,
|
|
208
|
-
placeholder: (0, import_i18n.__)("Write CSS\u2026"),
|
|
209
|
-
"aria-label": (0, import_i18n.__)("CSS"),
|
|
210
|
-
className: "block-library-html__modal-editor"
|
|
211
|
-
}
|
|
212
|
-
)
|
|
213
|
-
}
|
|
86
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
87
|
+
import_components.Modal,
|
|
88
|
+
{
|
|
89
|
+
title: (0, import_i18n.__)("Edit HTML"),
|
|
90
|
+
onRequestClose,
|
|
91
|
+
className: "block-library-html__modal",
|
|
92
|
+
size: "large",
|
|
93
|
+
isDismissible: false,
|
|
94
|
+
shouldCloseOnClickOutside: false,
|
|
95
|
+
isFullScreen: isFullscreen,
|
|
96
|
+
__experimentalHideHeader: true,
|
|
97
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tabs, { orientation: "horizontal", defaultTabId: "html", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalVStack, { expanded: true, children: [
|
|
98
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
99
|
+
import_components.__experimentalHStack,
|
|
100
|
+
{
|
|
101
|
+
justify: "space-between",
|
|
102
|
+
className: "block-library-html__modal-header",
|
|
103
|
+
children: [
|
|
104
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tabs.TabList, { children: [
|
|
105
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tabs.Tab, { tabId: "html", children: "HTML" }),
|
|
106
|
+
canUserUseUnfilteredHTML && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tabs.Tab, { tabId: "css", children: "CSS" }),
|
|
107
|
+
canUserUseUnfilteredHTML && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tabs.Tab, { tabId: "js", children: (0, import_i18n.__)("JavaScript") })
|
|
108
|
+
] }) }),
|
|
109
|
+
!isMobileViewport && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
110
|
+
import_components.Button,
|
|
111
|
+
{
|
|
112
|
+
__next40pxDefaultSize: true,
|
|
113
|
+
icon: isFullscreen ? import_icons.square : import_icons.fullscreen,
|
|
114
|
+
label: (0, import_i18n.__)(
|
|
115
|
+
"Enable/disable fullscreen"
|
|
214
116
|
),
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
117
|
+
onClick: toggleFullscreen,
|
|
118
|
+
variant: "tertiary"
|
|
119
|
+
}
|
|
120
|
+
) })
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
hasRestrictedContent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
125
|
+
import_components.Notice,
|
|
126
|
+
{
|
|
127
|
+
status: "warning",
|
|
128
|
+
isDismissible: false,
|
|
129
|
+
className: "block-library-html__modal-notice",
|
|
130
|
+
children: (0, import_i18n.__)(
|
|
131
|
+
"This block contains CSS or JavaScript that will be removed when you save because you do not have permission to use unfiltered HTML."
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
136
|
+
import_components.Flex,
|
|
137
|
+
{
|
|
138
|
+
direction: isMobileViewport ? "column" : "row",
|
|
139
|
+
className: "block-library-html__modal-tabs",
|
|
140
|
+
align: "stretch",
|
|
141
|
+
gap: 8,
|
|
142
|
+
children: [
|
|
143
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "block-library-html__modal-content", children: [
|
|
144
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
145
|
+
Tabs.TabPanel,
|
|
238
146
|
{
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
147
|
+
tabId: "html",
|
|
148
|
+
focusable: false,
|
|
149
|
+
className: "block-library-html__modal-tab",
|
|
150
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
151
|
+
import_block_editor.PlainText,
|
|
152
|
+
{
|
|
153
|
+
value: editedHtml,
|
|
154
|
+
onChange: setEditedHtml,
|
|
155
|
+
placeholder: (0, import_i18n.__)("Write HTML\u2026"),
|
|
156
|
+
"aria-label": (0, import_i18n.__)("HTML"),
|
|
157
|
+
className: "block-library-html__modal-editor"
|
|
158
|
+
}
|
|
159
|
+
)
|
|
244
160
|
}
|
|
245
|
-
)
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
),
|
|
249
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
250
|
-
import_components.__experimentalHStack,
|
|
251
|
-
{
|
|
252
|
-
alignment: "center",
|
|
253
|
-
justify: "flex-end",
|
|
254
|
-
spacing: 4,
|
|
255
|
-
className: "block-library-html__modal-footer",
|
|
256
|
-
children: [
|
|
257
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
258
|
-
import_components.Button,
|
|
161
|
+
),
|
|
162
|
+
canUserUseUnfilteredHTML && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
163
|
+
Tabs.TabPanel,
|
|
259
164
|
{
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
children: (0,
|
|
165
|
+
tabId: "css",
|
|
166
|
+
focusable: false,
|
|
167
|
+
className: "block-library-html__modal-tab",
|
|
168
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
169
|
+
import_block_editor.PlainText,
|
|
170
|
+
{
|
|
171
|
+
value: editedCss,
|
|
172
|
+
onChange: setEditedCss,
|
|
173
|
+
placeholder: (0, import_i18n.__)("Write CSS\u2026"),
|
|
174
|
+
"aria-label": (0, import_i18n.__)("CSS"),
|
|
175
|
+
className: "block-library-html__modal-editor"
|
|
176
|
+
}
|
|
177
|
+
)
|
|
264
178
|
}
|
|
265
179
|
),
|
|
266
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
267
|
-
|
|
180
|
+
canUserUseUnfilteredHTML && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
181
|
+
Tabs.TabPanel,
|
|
268
182
|
{
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
children: (0,
|
|
183
|
+
tabId: "js",
|
|
184
|
+
focusable: false,
|
|
185
|
+
className: "block-library-html__modal-tab",
|
|
186
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
187
|
+
import_block_editor.PlainText,
|
|
188
|
+
{
|
|
189
|
+
value: editedJs,
|
|
190
|
+
onChange: setEditedJs,
|
|
191
|
+
placeholder: (0, import_i18n.__)(
|
|
192
|
+
"Write JavaScript\u2026"
|
|
193
|
+
),
|
|
194
|
+
"aria-label": (0, import_i18n.__)("JavaScript"),
|
|
195
|
+
className: "block-library-html__modal-editor"
|
|
196
|
+
}
|
|
197
|
+
)
|
|
273
198
|
}
|
|
274
199
|
)
|
|
275
|
-
]
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
}
|
|
322
|
-
)
|
|
323
|
-
] });
|
|
200
|
+
] }),
|
|
201
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "block-library-html__preview", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
202
|
+
import_preview.default,
|
|
203
|
+
{
|
|
204
|
+
content: (0, import_utils.serializeContent)({
|
|
205
|
+
html: editedHtml,
|
|
206
|
+
css: editedCss,
|
|
207
|
+
js: editedJs
|
|
208
|
+
})
|
|
209
|
+
}
|
|
210
|
+
) })
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
),
|
|
214
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
215
|
+
import_components.__experimentalHStack,
|
|
216
|
+
{
|
|
217
|
+
alignment: "center",
|
|
218
|
+
justify: "flex-end",
|
|
219
|
+
spacing: 4,
|
|
220
|
+
className: "block-library-html__modal-footer",
|
|
221
|
+
children: [
|
|
222
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
223
|
+
import_components.Button,
|
|
224
|
+
{
|
|
225
|
+
__next40pxDefaultSize: true,
|
|
226
|
+
variant: "tertiary",
|
|
227
|
+
onClick: onRequestClose,
|
|
228
|
+
children: (0, import_i18n.__)("Cancel")
|
|
229
|
+
}
|
|
230
|
+
),
|
|
231
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
232
|
+
import_components.Button,
|
|
233
|
+
{
|
|
234
|
+
__next40pxDefaultSize: true,
|
|
235
|
+
variant: "primary",
|
|
236
|
+
onClick: handleUpdateAndClose,
|
|
237
|
+
children: (0, import_i18n.__)("Update")
|
|
238
|
+
}
|
|
239
|
+
)
|
|
240
|
+
]
|
|
241
|
+
}
|
|
242
|
+
)
|
|
243
|
+
] }) })
|
|
244
|
+
}
|
|
245
|
+
) });
|
|
324
246
|
}
|
|
325
247
|
//# sourceMappingURL=modal.cjs.map
|