@wordpress/format-library 5.36.1-next.6deb34194.0 → 5.36.1-next.76cff8c98.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/LICENSE.md +1 -1
- package/build/bold/{index.js → index.cjs} +2 -2
- package/build/code/{index.js → index.cjs} +1 -1
- package/build/{default-formats.js → default-formats.cjs} +16 -16
- package/build/image/{index.js → index.cjs} +1 -2
- package/build/image/{index.js.map → index.cjs.map} +2 -2
- package/build/{index.js → index.cjs} +2 -2
- package/build/italic/{index.js → index.cjs} +2 -2
- package/build/keyboard/{index.js → index.cjs} +1 -1
- package/build/language/{index.js → index.cjs} +1 -3
- package/build/language/{index.js.map → index.cjs.map} +2 -2
- package/build/link/{css-classes-setting.js → css-classes-setting.cjs} +1 -2
- package/build/link/{css-classes-setting.js.map → css-classes-setting.cjs.map} +2 -2
- package/build/link/{index.js → index.cjs} +4 -4
- package/build/link/{inline.js → inline.cjs} +4 -4
- package/build/link/{use-link-instance-key.js → use-link-instance-key.cjs} +1 -1
- package/build/link/{utils.js → utils.cjs} +1 -1
- package/build/{lock-unlock.js → lock-unlock.cjs} +1 -1
- package/build/math/{index.js → index.cjs} +2 -3
- package/build/math/{index.js.map → index.cjs.map} +2 -2
- package/build/non-breaking-space/{index.js → index.cjs} +1 -1
- package/build/strikethrough/{index.js → index.cjs} +1 -1
- package/build/subscript/{index.js → index.cjs} +1 -1
- package/build/superscript/{index.js → index.cjs} +1 -1
- package/build/text-color/{index.js → index.cjs} +2 -2
- package/build/text-color/{inline.js → inline.cjs} +3 -3
- package/build/underline/{index.js → index.cjs} +1 -1
- package/build/unknown/{index.js → index.cjs} +1 -1
- package/build-module/bold/{index.js → index.mjs} +2 -2
- package/build-module/code/{index.js → index.mjs} +1 -1
- package/build-module/default-formats.mjs +37 -0
- package/build-module/image/{index.js → index.mjs} +1 -2
- package/build-module/image/{index.js.map → index.mjs.map} +2 -2
- package/build-module/{index.js → index.mjs} +2 -2
- package/build-module/italic/{index.js → index.mjs} +2 -2
- package/build-module/keyboard/{index.js → index.mjs} +1 -1
- package/build-module/language/{index.js → index.mjs} +1 -3
- package/build-module/language/{index.js.map → index.mjs.map} +2 -2
- package/build-module/link/{css-classes-setting.js → css-classes-setting.mjs} +1 -2
- package/build-module/link/{css-classes-setting.js.map → css-classes-setting.mjs.map} +2 -2
- package/build-module/link/{index.js → index.mjs} +4 -4
- package/build-module/link/{inline.js → inline.mjs} +4 -4
- package/build-module/link/{use-link-instance-key.js → use-link-instance-key.mjs} +1 -1
- package/build-module/link/{utils.js → utils.mjs} +1 -1
- package/build-module/{lock-unlock.js → lock-unlock.mjs} +1 -1
- package/build-module/math/{index.js → index.mjs} +2 -3
- package/build-module/math/index.mjs.map +7 -0
- package/build-module/non-breaking-space/{index.js → index.mjs} +1 -1
- package/build-module/strikethrough/{index.js → index.mjs} +1 -1
- package/build-module/subscript/{index.js → index.mjs} +1 -1
- package/build-module/superscript/{index.js → index.mjs} +1 -1
- package/build-module/text-color/{index.js → index.mjs} +2 -2
- package/build-module/text-color/{inline.js → inline.mjs} +3 -3
- package/build-module/underline/{index.js → index.mjs} +1 -1
- package/build-module/unknown/{index.js → index.mjs} +1 -1
- package/package.json +27 -19
- package/src/image/index.js +0 -1
- package/src/language/index.js +0 -2
- package/src/link/css-classes-setting.js +0 -1
- package/src/link/test/utils.js +31 -31
- package/src/math/index.js +0 -1
- package/build-module/default-formats.js +0 -37
- package/build-module/math/index.js.map +0 -7
- /package/build/bold/{index.js.map → index.cjs.map} +0 -0
- /package/build/code/{index.js.map → index.cjs.map} +0 -0
- /package/build/{default-formats.js.map → default-formats.cjs.map} +0 -0
- /package/build/{index.js.map → index.cjs.map} +0 -0
- /package/build/italic/{index.js.map → index.cjs.map} +0 -0
- /package/build/keyboard/{index.js.map → index.cjs.map} +0 -0
- /package/build/link/{index.js.map → index.cjs.map} +0 -0
- /package/build/link/{inline.js.map → inline.cjs.map} +0 -0
- /package/build/link/{use-link-instance-key.js.map → use-link-instance-key.cjs.map} +0 -0
- /package/build/link/{utils.js.map → utils.cjs.map} +0 -0
- /package/build/{lock-unlock.js.map → lock-unlock.cjs.map} +0 -0
- /package/build/non-breaking-space/{index.js.map → index.cjs.map} +0 -0
- /package/build/strikethrough/{index.js.map → index.cjs.map} +0 -0
- /package/build/subscript/{index.js.map → index.cjs.map} +0 -0
- /package/build/superscript/{index.js.map → index.cjs.map} +0 -0
- /package/build/text-color/{index.js.map → index.cjs.map} +0 -0
- /package/build/text-color/{inline.js.map → inline.cjs.map} +0 -0
- /package/build/underline/{index.js.map → index.cjs.map} +0 -0
- /package/build/unknown/{index.js.map → index.cjs.map} +0 -0
- /package/build-module/bold/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/code/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/{default-formats.js.map → default-formats.mjs.map} +0 -0
- /package/build-module/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/italic/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/keyboard/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/link/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/link/{inline.js.map → inline.mjs.map} +0 -0
- /package/build-module/link/{use-link-instance-key.js.map → use-link-instance-key.mjs.map} +0 -0
- /package/build-module/link/{utils.js.map → utils.mjs.map} +0 -0
- /package/build-module/{lock-unlock.js.map → lock-unlock.mjs.map} +0 -0
- /package/build-module/non-breaking-space/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/strikethrough/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/subscript/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/superscript/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/text-color/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/text-color/{inline.js.map → inline.mjs.map} +0 -0
- /package/build-module/underline/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/unknown/{index.js.map → index.mjs.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/image/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tPath,\n\tSVG,\n\tPopover,\n\tButton,\n\tExternalLink,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalNumberControl as NumberControl,\n\tTextareaControl,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { insertObject, useAnchor } from '@wordpress/rich-text';\nimport {\n\tMediaUpload,\n\tRichTextToolbarButton,\n\tMediaUploadCheck,\n} from '@wordpress/block-editor';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\n\nconst name = 'core/image';\nconst title = __( 'Inline image' );\n\n/**\n * Extracts the image ID from the className attribute.\n *\n * @param {Object} activeObjectAttributes The attributes of the active object.\n * @return {number|undefined} The extracted image ID or undefined if not found.\n */\nfunction getCurrentImageId( activeObjectAttributes ) {\n\tif ( ! activeObjectAttributes?.className ) {\n\t\treturn undefined;\n\t}\n\n\tconst [ , id ] =\n\t\tactiveObjectAttributes.className.match( /wp-image-(\\d+)/ ) ?? [];\n\n\treturn id ? parseInt( id, 10 ) : undefined;\n}\n\nexport const image = {\n\tname,\n\ttitle,\n\tkeywords: [ __( 'photo' ), __( 'media' ) ],\n\tobject: true,\n\ttagName: 'img',\n\tclassName: null,\n\tattributes: {\n\t\tclassName: 'class',\n\t\tstyle: 'style',\n\t\turl: 'src',\n\t\talt: 'alt',\n\t},\n\tedit: Edit,\n};\n\nfunction InlineUI( { value, onChange, activeObjectAttributes, contentRef } ) {\n\tconst { style, alt } = activeObjectAttributes;\n\tconst width = style?.replace( /\\D/g, '' );\n\tconst [ editedWidth, setEditedWidth ] = useState( width );\n\tconst [ editedAlt, setEditedAlt ] = useState( alt );\n\tconst hasChanged = editedWidth !== width || editedAlt !== alt;\n\tconst popoverAnchor = useAnchor( {\n\t\teditableContentElement: contentRef.current,\n\t\tsettings: image,\n\t} );\n\n\treturn (\n\t\t<Popover\n\t\t\tfocusOnMount={ false }\n\t\t\tanchor={ popoverAnchor }\n\t\t\tclassName=\"block-editor-format-toolbar__image-popover\"\n\t\t>\n\t\t\t<form\n\t\t\t\tclassName=\"block-editor-format-toolbar__image-container-content\"\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tconst newReplacements = value.replacements.slice();\n\n\t\t\t\t\tnewReplacements[ value.start ] = {\n\t\t\t\t\t\ttype: name,\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t...activeObjectAttributes,\n\t\t\t\t\t\t\tstyle: editedWidth\n\t\t\t\t\t\t\t\t? `width: ${ editedWidth }px;`\n\t\t\t\t\t\t\t\t: '',\n\t\t\t\t\t\t\talt: editedAlt,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\n\t\t\t\t\tonChange( {\n\t\t\t\t\t\t...value,\n\t\t\t\t\t\treplacements: newReplacements,\n\t\t\t\t\t} );\n\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\tvalue={ editedWidth }\n\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\tonChange={ ( newWidth ) => {\n\t\t\t\t\t\t\tsetEditedWidth( newWidth );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,EACxB,+BAA+B;AAAA,EAC/B;AAAA,OACM;AACP,SAAS,UAAU;AACnB,SAAS,gBAAgB;AACzB,SAAS,cAAc,iBAAiB;AACxC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAkFF,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tPath,\n\tSVG,\n\tPopover,\n\tButton,\n\tExternalLink,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalNumberControl as NumberControl,\n\tTextareaControl,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { insertObject, useAnchor } from '@wordpress/rich-text';\nimport {\n\tMediaUpload,\n\tRichTextToolbarButton,\n\tMediaUploadCheck,\n} from '@wordpress/block-editor';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\n\nconst name = 'core/image';\nconst title = __( 'Inline image' );\n\n/**\n * Extracts the image ID from the className attribute.\n *\n * @param {Object} activeObjectAttributes The attributes of the active object.\n * @return {number|undefined} The extracted image ID or undefined if not found.\n */\nfunction getCurrentImageId( activeObjectAttributes ) {\n\tif ( ! activeObjectAttributes?.className ) {\n\t\treturn undefined;\n\t}\n\n\tconst [ , id ] =\n\t\tactiveObjectAttributes.className.match( /wp-image-(\\d+)/ ) ?? [];\n\n\treturn id ? parseInt( id, 10 ) : undefined;\n}\n\nexport const image = {\n\tname,\n\ttitle,\n\tkeywords: [ __( 'photo' ), __( 'media' ) ],\n\tobject: true,\n\ttagName: 'img',\n\tclassName: null,\n\tattributes: {\n\t\tclassName: 'class',\n\t\tstyle: 'style',\n\t\turl: 'src',\n\t\talt: 'alt',\n\t},\n\tedit: Edit,\n};\n\nfunction InlineUI( { value, onChange, activeObjectAttributes, contentRef } ) {\n\tconst { style, alt } = activeObjectAttributes;\n\tconst width = style?.replace( /\\D/g, '' );\n\tconst [ editedWidth, setEditedWidth ] = useState( width );\n\tconst [ editedAlt, setEditedAlt ] = useState( alt );\n\tconst hasChanged = editedWidth !== width || editedAlt !== alt;\n\tconst popoverAnchor = useAnchor( {\n\t\teditableContentElement: contentRef.current,\n\t\tsettings: image,\n\t} );\n\n\treturn (\n\t\t<Popover\n\t\t\tfocusOnMount={ false }\n\t\t\tanchor={ popoverAnchor }\n\t\t\tclassName=\"block-editor-format-toolbar__image-popover\"\n\t\t>\n\t\t\t<form\n\t\t\t\tclassName=\"block-editor-format-toolbar__image-container-content\"\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tconst newReplacements = value.replacements.slice();\n\n\t\t\t\t\tnewReplacements[ value.start ] = {\n\t\t\t\t\t\ttype: name,\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t...activeObjectAttributes,\n\t\t\t\t\t\t\tstyle: editedWidth\n\t\t\t\t\t\t\t\t? `width: ${ editedWidth }px;`\n\t\t\t\t\t\t\t\t: '',\n\t\t\t\t\t\t\talt: editedAlt,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\n\t\t\t\t\tonChange( {\n\t\t\t\t\t\t...value,\n\t\t\t\t\t\treplacements: newReplacements,\n\t\t\t\t\t} );\n\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\tvalue={ editedWidth }\n\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\tonChange={ ( newWidth ) => {\n\t\t\t\t\t\t\tsetEditedWidth( newWidth );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\tvalue={ editedAlt }\n\t\t\t\t\t\tonChange={ ( newAlt ) => {\n\t\t\t\t\t\t\tsetEditedAlt( newAlt );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={\n\t\t\t\t\t\t\t\t\t\t// translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations.\n\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t'https://www.w3.org/WAI/tutorials/images/decision-tree/'\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\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t{ __( 'Leave empty if decorative.' ) }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tdisabled={ ! hasChanged }\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Apply' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Popover>\n\t);\n}\n\nfunction Edit( {\n\tvalue,\n\tonChange,\n\tonFocus,\n\tisObjectActive,\n\tactiveObjectAttributes,\n\tcontentRef,\n} ) {\n\treturn (\n\t\t<MediaUploadCheck>\n\t\t\t<MediaUpload\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tvalue={ getCurrentImageId( activeObjectAttributes ) }\n\t\t\t\tonSelect={ ( { id, url, alt, width: imgWidth } ) => {\n\t\t\t\t\tonChange(\n\t\t\t\t\t\tinsertObject( value, {\n\t\t\t\t\t\t\ttype: name,\n\t\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t\tclassName: `wp-image-${ id }`,\n\t\t\t\t\t\t\t\tstyle: `width: ${ Math.min(\n\t\t\t\t\t\t\t\t\timgWidth,\n\t\t\t\t\t\t\t\t\t150\n\t\t\t\t\t\t\t\t) }px;`,\n\t\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t\talt,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t\tonFocus();\n\t\t\t\t} }\n\t\t\t\trender={ ( { open } ) => (\n\t\t\t\t\t<RichTextToolbarButton\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<SVG\n\t\t\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Path d=\"M4 18.5h16V17H4v1.5zM16 13v1.5h4V13h-4zM5.1 15h7.8c.6 0 1.1-.5 1.1-1.1V6.1c0-.6-.5-1.1-1.1-1.1H5.1C4.5 5 4 5.5 4 6.1v7.8c0 .6.5 1.1 1.1 1.1zm.4-8.5h7V10l-1-1c-.3-.3-.8-.3-1 0l-1.6 1.5-1.2-.7c-.3-.2-.6-.2-.9 0l-1.3 1V6.5zm0 6.1l1.8-1.3 1.3.8c.3.2.7.2.9-.1l1.5-1.4 1.5 1.4v1.5h-7v-.9z\" />\n\t\t\t\t\t\t\t</SVG>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttitle={ isObjectActive ? __( 'Replace image' ) : title }\n\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\tisActive={ isObjectActive }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t{ isObjectActive && (\n\t\t\t\t<InlineUI\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tactiveObjectAttributes={ activeObjectAttributes }\n\t\t\t\t\tcontentRef={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registerFormatType } from "@wordpress/rich-text";
|
|
3
|
-
import formats from "./default-formats";
|
|
3
|
+
import formats from "./default-formats.mjs";
|
|
4
4
|
formats.forEach(
|
|
5
5
|
({ name, ...settings }) => registerFormatType(name, settings)
|
|
6
6
|
);
|
|
7
|
-
//# sourceMappingURL=index.
|
|
7
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
privateApis as blockEditorPrivateApis
|
|
9
9
|
} from "@wordpress/block-editor";
|
|
10
10
|
import { formatItalic } from "@wordpress/icons";
|
|
11
|
-
import { unlock } from "../lock-unlock";
|
|
11
|
+
import { unlock } from "../lock-unlock.mjs";
|
|
12
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
var { essentialFormatKey } = unlock(blockEditorPrivateApis);
|
|
14
14
|
var name = "core/italic";
|
|
@@ -61,4 +61,4 @@ var italic = {
|
|
|
61
61
|
export {
|
|
62
62
|
italic
|
|
63
63
|
};
|
|
64
|
-
//# sourceMappingURL=index.
|
|
64
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -93,7 +93,6 @@ function InlineLanguageUI({ value, contentRef, onChange, onClose }) {
|
|
|
93
93
|
TextControl,
|
|
94
94
|
{
|
|
95
95
|
__next40pxDefaultSize: true,
|
|
96
|
-
__nextHasNoMarginBottom: true,
|
|
97
96
|
label: title,
|
|
98
97
|
value: lang,
|
|
99
98
|
onChange: (val) => setLang(val),
|
|
@@ -106,7 +105,6 @@ function InlineLanguageUI({ value, contentRef, onChange, onClose }) {
|
|
|
106
105
|
SelectControl,
|
|
107
106
|
{
|
|
108
107
|
__next40pxDefaultSize: true,
|
|
109
|
-
__nextHasNoMarginBottom: true,
|
|
110
108
|
label: __("Text direction"),
|
|
111
109
|
value: dir,
|
|
112
110
|
options: [
|
|
@@ -140,4 +138,4 @@ function InlineLanguageUI({ value, contentRef, onChange, onClose }) {
|
|
|
140
138
|
export {
|
|
141
139
|
language
|
|
142
140
|
};
|
|
143
|
-
//# sourceMappingURL=index.
|
|
141
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/language/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * WordPress dependencies\n */\nimport { RichTextToolbarButton } from '@wordpress/block-editor';\nimport {\n\tTextControl,\n\tSelectControl,\n\tButton,\n\tPopover,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { applyFormat, removeFormat, useAnchor } from '@wordpress/rich-text';\nimport { language as languageIcon } from '@wordpress/icons';\n\nconst name = 'core/language';\nconst title = __( 'Language' );\n\nexport const language = {\n\tname,\n\ttagName: 'bdo',\n\tclassName: null,\n\tedit: Edit,\n\ttitle,\n};\n\nfunction Edit( { isActive, value, onChange, contentRef } ) {\n\tconst [ isPopoverVisible, setIsPopoverVisible ] = useState( false );\n\tconst togglePopover = () => {\n\t\tsetIsPopoverVisible( ( state ) => ! state );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<RichTextToolbarButton\n\t\t\t\ticon={ languageIcon }\n\t\t\t\tlabel={ title }\n\t\t\t\ttitle={ title }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tif ( isActive ) {\n\t\t\t\t\t\tonChange( removeFormat( value, name ) );\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttogglePopover();\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t\tisActive={ isActive }\n\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t/>\n\t\t\t{ isPopoverVisible && (\n\t\t\t\t<InlineLanguageUI\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tonClose={ togglePopover }\n\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction InlineLanguageUI( { value, contentRef, onChange, onClose } ) {\n\tconst popoverAnchor = useAnchor( {\n\t\teditableContentElement: contentRef.current,\n\t\tsettings: language,\n\t} );\n\n\tconst [ lang, setLang ] = useState( '' );\n\tconst [ dir, setDir ] = useState( 'ltr' );\n\n\treturn (\n\t\t<Popover\n\t\t\tclassName=\"block-editor-format-toolbar__language-popover\"\n\t\t\tanchor={ popoverAnchor }\n\t\t\tonClose={ onClose }\n\t\t>\n\t\t\t<VStack\n\t\t\t\tas=\"form\"\n\t\t\t\tspacing={ 4 }\n\t\t\t\tclassName=\"block-editor-format-toolbar__language-container-content\"\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tonChange(\n\t\t\t\t\t\tapplyFormat( value, {\n\t\t\t\t\t\t\ttype: name,\n\t\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t\tlang,\n\t\t\t\t\t\t\t\tdir,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t\tonClose();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<TextControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\
|
|
5
|
-
"mappings": ";AAGA,SAAS,UAAU;AAKnB,SAAS,6BAA6B;AACtC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,OAClB;AACP,SAAS,gBAAgB;AACzB,SAAS,aAAa,cAAc,iBAAiB;AACrD,SAAS,YAAY,oBAAoB;AAoBvC,mBACC,KADD;AAlBF,IAAM,OAAO;AACb,IAAM,QAAQ,GAAI,UAAW;AAEtB,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,EACT,WAAW;AAAA,EACX,MAAM;AAAA,EACN;AACD;AAEA,SAAS,KAAM,EAAE,UAAU,OAAO,UAAU,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ies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * WordPress dependencies\n */\nimport { RichTextToolbarButton } from '@wordpress/block-editor';\nimport {\n\tTextControl,\n\tSelectControl,\n\tButton,\n\tPopover,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { applyFormat, removeFormat, useAnchor } from '@wordpress/rich-text';\nimport { language as languageIcon } from '@wordpress/icons';\n\nconst name = 'core/language';\nconst title = __( 'Language' );\n\nexport const language = {\n\tname,\n\ttagName: 'bdo',\n\tclassName: null,\n\tedit: Edit,\n\ttitle,\n};\n\nfunction Edit( { isActive, value, onChange, contentRef } ) {\n\tconst [ isPopoverVisible, setIsPopoverVisible ] = useState( false );\n\tconst togglePopover = () => {\n\t\tsetIsPopoverVisible( ( state ) => ! state );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<RichTextToolbarButton\n\t\t\t\ticon={ languageIcon }\n\t\t\t\tlabel={ title }\n\t\t\t\ttitle={ title }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tif ( isActive ) {\n\t\t\t\t\t\tonChange( removeFormat( value, name ) );\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttogglePopover();\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t\tisActive={ isActive }\n\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t/>\n\t\t\t{ isPopoverVisible && (\n\t\t\t\t<InlineLanguageUI\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tonClose={ togglePopover }\n\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction InlineLanguageUI( { value, contentRef, onChange, onClose } ) {\n\tconst popoverAnchor = useAnchor( {\n\t\teditableContentElement: contentRef.current,\n\t\tsettings: language,\n\t} );\n\n\tconst [ lang, setLang ] = useState( '' );\n\tconst [ dir, setDir ] = useState( 'ltr' );\n\n\treturn (\n\t\t<Popover\n\t\t\tclassName=\"block-editor-format-toolbar__language-popover\"\n\t\t\tanchor={ popoverAnchor }\n\t\t\tonClose={ onClose }\n\t\t>\n\t\t\t<VStack\n\t\t\t\tas=\"form\"\n\t\t\t\tspacing={ 4 }\n\t\t\t\tclassName=\"block-editor-format-toolbar__language-container-content\"\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tonChange(\n\t\t\t\t\t\tapplyFormat( value, {\n\t\t\t\t\t\t\ttype: name,\n\t\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t\tlang,\n\t\t\t\t\t\t\t\tdir,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t\tonClose();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<TextControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ title }\n\t\t\t\t\tvalue={ lang }\n\t\t\t\t\tonChange={ ( val ) => setLang( val ) }\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'A valid language attribute, like \"en\" or \"fr\".'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<SelectControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'Text direction' ) }\n\t\t\t\t\tvalue={ dir }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Left to right' ),\n\t\t\t\t\t\t\tvalue: 'ltr',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Right to left' ),\n\t\t\t\t\t\t\tvalue: 'rtl',\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t\tonChange={ ( val ) => setDir( val ) }\n\t\t\t\t/>\n\t\t\t\t<HStack alignment=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\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AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -37,7 +37,6 @@ var CSSClassesSettingComponent = ({ setting, value, onChange }) => {
|
|
|
37
37
|
/* @__PURE__ */ jsx(
|
|
38
38
|
CheckboxControl,
|
|
39
39
|
{
|
|
40
|
-
__nextHasNoMarginBottom: true,
|
|
41
40
|
label: setting.title,
|
|
42
41
|
onChange: handleCheckboxChange,
|
|
43
42
|
checked: isSettingActive || hasValue,
|
|
@@ -65,4 +64,4 @@ var css_classes_setting_default = CSSClassesSettingComponent;
|
|
|
65
64
|
export {
|
|
66
65
|
css_classes_setting_default as default
|
|
67
66
|
};
|
|
68
|
-
//# sourceMappingURL=css-classes-setting.
|
|
67
|
+
//# sourceMappingURL=css-classes-setting.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/link/css-classes-setting.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalInputControl as InputControl,\n\tCheckboxControl,\n\tVisuallyHidden,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\n/**\n * CSSClassesSettingComponent\n *\n * Presents a toggleable text input for editing link CSS classes. The input\n * is shown when the toggle is enabled or when there is already a value. When\n * toggled off and a value exists, it resets the value to an empty string.\n *\n * @param {Object} props - Component props.\n * @param {Object} props.setting - Setting configuration object.\n * @param {Object} props.value - Current link value object.\n * @param {Function} props.onChange - Callback when value changes.\n */\nconst CSSClassesSettingComponent = ( { setting, value, onChange } ) => {\n\tconst hasValue = value ? value?.cssClasses?.length > 0 : false;\n\tconst [ isSettingActive, setIsSettingActive ] = useState( hasValue );\n\tconst instanceId = useInstanceId( CSSClassesSettingComponent );\n\tconst controlledRegionId = `css-classes-setting-${ instanceId }`;\n\n\t// Sanitize user input: replace commas with spaces, collapse repeated spaces, and trim\n\tconst handleSettingChange = ( newValue ) => {\n\t\tconst sanitizedValue =\n\t\t\ttypeof newValue === 'string'\n\t\t\t\t? newValue.replace( /,/g, ' ' ).replace( /\\s+/g, ' ' ).trim()\n\t\t\t\t: newValue;\n\t\tonChange( {\n\t\t\t...value,\n\t\t\t[ setting.id ]: sanitizedValue,\n\t\t} );\n\t};\n\n\tconst handleCheckboxChange = () => {\n\t\tif ( isSettingActive ) {\n\t\t\tif ( hasValue ) {\n\t\t\t\t// Reset the value when hiding the input and a value exists.\n\t\t\t\thandleSettingChange( '' );\n\t\t\t}\n\t\t\tsetIsSettingActive( false );\n\t\t} else {\n\t\t\tsetIsSettingActive( true );\n\t\t}\n\t};\n\n\treturn (\n\t\t<fieldset>\n\t\t\t<VisuallyHidden as=\"legend\">{ setting.title }</VisuallyHidden>\n\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t<CheckboxControl\n\t\t\t\t\
|
|
5
|
-
"mappings": ";AAGA,SAAS,gBAAgB;AACzB,SAAS,qBAAqB;AAC9B,SAAS,UAAU;AACnB;AAAA,EACC,8BAA8B;AAAA,EAC9B;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,OAClB;AA8CJ,cACA,YADA;AAhCH,IAAM,6BAA6B,CAAE,EAAE,SAAS,OAAO,SAAS,MAAO;AACtE,QAAM,WAAW,QAAQ,OAAO,YAAY,SAAS,IAAI;AACzD,QAAM,CAAE,iBAAiB,kBAAmB,IAAI,SAAU,QAAS;AACnE,QAAM,aAAa,cAAe,0BAA2B;AAC7D,QAAM,qBAAqB,uBAAwB,UAAW;AAG9D,QAAM,sBAAsB,CAAE,aAAc;AAC3C,UAAM,iBACL,OAAO,aAAa,WACjB,SAAS,QAAS,MAAM,GAAI,EAAE,QAAS,QAAQ,GAAI,EAAE,KAAK,IAC1D;AACJ,aAAU;AAAA,MACT,GAAG;AAAA,MACH,CAAE,QAAQ,EAAG,GAAG;AAAA,IACjB,CAAE;AAAA,EACH;AAEA,QAAM,uBAAuB,MAAM;AAClC,QAAK,iBAAkB;AACtB,UAAK,UAAW;AAEf,4BAAqB,EAAG;AAAA,MACzB;AACA,yBAAoB,KAAM;AAAA,IAC3B,OAAO;AACN,yBAAoB,IAAK;AAAA,IAC1B;AAAA,EACD;AAEA,SACC,qBAAC,cACA;AAAA,wBAAC,kBAAe,IAAG,UAAW,kBAAQ,OAAO;AAAA,IAC7C,qBAAC,UAAO,SAAU,GACjB;AAAA;AAAA,QAAC;AAAA;AAAA,UACA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalInputControl as InputControl,\n\tCheckboxControl,\n\tVisuallyHidden,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\n/**\n * CSSClassesSettingComponent\n *\n * Presents a toggleable text input for editing link CSS classes. The input\n * is shown when the toggle is enabled or when there is already a value. When\n * toggled off and a value exists, it resets the value to an empty string.\n *\n * @param {Object} props - Component props.\n * @param {Object} props.setting - Setting configuration object.\n * @param {Object} props.value - Current link value object.\n * @param {Function} props.onChange - Callback when value changes.\n */\nconst CSSClassesSettingComponent = ( { setting, value, onChange } ) => {\n\tconst hasValue = value ? value?.cssClasses?.length > 0 : false;\n\tconst [ isSettingActive, setIsSettingActive ] = useState( hasValue );\n\tconst instanceId = useInstanceId( CSSClassesSettingComponent );\n\tconst controlledRegionId = `css-classes-setting-${ instanceId }`;\n\n\t// Sanitize user input: replace commas with spaces, collapse repeated spaces, and trim\n\tconst handleSettingChange = ( newValue ) => {\n\t\tconst sanitizedValue =\n\t\t\ttypeof newValue === 'string'\n\t\t\t\t? newValue.replace( /,/g, ' ' ).replace( /\\s+/g, ' ' ).trim()\n\t\t\t\t: newValue;\n\t\tonChange( {\n\t\t\t...value,\n\t\t\t[ setting.id ]: sanitizedValue,\n\t\t} );\n\t};\n\n\tconst handleCheckboxChange = () => {\n\t\tif ( isSettingActive ) {\n\t\t\tif ( hasValue ) {\n\t\t\t\t// Reset the value when hiding the input and a value exists.\n\t\t\t\thandleSettingChange( '' );\n\t\t\t}\n\t\t\tsetIsSettingActive( false );\n\t\t} else {\n\t\t\tsetIsSettingActive( true );\n\t\t}\n\t};\n\n\treturn (\n\t\t<fieldset>\n\t\t\t<VisuallyHidden as=\"legend\">{ setting.title }</VisuallyHidden>\n\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t<CheckboxControl\n\t\t\t\t\tlabel={ setting.title }\n\t\t\t\t\tonChange={ handleCheckboxChange }\n\t\t\t\t\tchecked={ isSettingActive || hasValue }\n\t\t\t\t\taria-expanded={ isSettingActive }\n\t\t\t\t\taria-controls={\n\t\t\t\t\t\tisSettingActive ? controlledRegionId : undefined\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ isSettingActive && (\n\t\t\t\t\t<div id={ controlledRegionId }>\n\t\t\t\t\t\t<InputControl\n\t\t\t\t\t\t\tlabel={ __( 'CSS classes' ) }\n\t\t\t\t\t\t\tvalue={ value?.cssClasses }\n\t\t\t\t\t\t\tonChange={ handleSettingChange }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Separate multiple classes with spaces.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t__unstableInputWidth=\"100%\"\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t</fieldset>\n\t);\n};\n\nexport default CSSClassesSettingComponent;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,gBAAgB;AACzB,SAAS,qBAAqB;AAC9B,SAAS,UAAU;AACnB;AAAA,EACC,8BAA8B;AAAA,EAC9B;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,OAClB;AA8CJ,cACA,YADA;AAhCH,IAAM,6BAA6B,C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9 @@ import {
|
|
|
19
19
|
import { decodeEntities } from "@wordpress/html-entities";
|
|
20
20
|
import { link as linkIcon } from "@wordpress/icons";
|
|
21
21
|
import { speak } from "@wordpress/a11y";
|
|
22
|
-
import InlineLinkUI from "./inline";
|
|
23
|
-
import { isValidHref } from "./utils";
|
|
24
|
-
import { unlock } from "../lock-unlock";
|
|
22
|
+
import InlineLinkUI from "./inline.mjs";
|
|
23
|
+
import { isValidHref } from "./utils.mjs";
|
|
24
|
+
import { unlock } from "../lock-unlock.mjs";
|
|
25
25
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
26
26
|
var { essentialFormatKey } = unlock(blockEditorPrivateApis);
|
|
27
27
|
var name = "core/link";
|
|
@@ -210,4 +210,4 @@ var link = {
|
|
|
210
210
|
export {
|
|
211
211
|
link
|
|
212
212
|
};
|
|
213
|
-
//# sourceMappingURL=index.
|
|
213
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -21,9 +21,9 @@ import {
|
|
|
21
21
|
store as blockEditorStore
|
|
22
22
|
} from "@wordpress/block-editor";
|
|
23
23
|
import { useDispatch, useSelect } from "@wordpress/data";
|
|
24
|
-
import { createLinkFormat, isValidHref, getFormatBoundary } from "./utils";
|
|
25
|
-
import { link as settings } from "./index";
|
|
26
|
-
import CSSClassesSettingComponent from "./css-classes-setting";
|
|
24
|
+
import { createLinkFormat, isValidHref, getFormatBoundary } from "./utils.mjs";
|
|
25
|
+
import { link as settings } from "./index.mjs";
|
|
26
|
+
import CSSClassesSettingComponent from "./css-classes-setting.mjs";
|
|
27
27
|
import { jsx } from "react/jsx-runtime";
|
|
28
28
|
var LINK_SETTINGS = [
|
|
29
29
|
...LinkControl.DEFAULT_LINK_SETTINGS,
|
|
@@ -248,4 +248,4 @@ var inline_default = InlineLinkUI;
|
|
|
248
248
|
export {
|
|
249
249
|
inline_default as default
|
|
250
250
|
};
|
|
251
|
-
//# sourceMappingURL=inline.
|
|
251
|
+
//# sourceMappingURL=inline.mjs.map
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "@wordpress/components";
|
|
12
12
|
import { math as icon } from "@wordpress/icons";
|
|
13
13
|
import { speak } from "@wordpress/a11y";
|
|
14
|
-
import { unlock } from "../lock-unlock";
|
|
14
|
+
import { unlock } from "../lock-unlock.mjs";
|
|
15
15
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
16
16
|
var { Badge } = unlock(componentsPrivateApis);
|
|
17
17
|
var name = "core/math";
|
|
@@ -75,7 +75,6 @@ function InlineUI({
|
|
|
75
75
|
/* @__PURE__ */ jsx(
|
|
76
76
|
TextControl,
|
|
77
77
|
{
|
|
78
|
-
__nextHasNoMarginBottom: true,
|
|
79
78
|
__next40pxDefaultSize: true,
|
|
80
79
|
hideLabelFromVision: true,
|
|
81
80
|
label: __("LaTeX math syntax"),
|
|
@@ -166,4 +165,4 @@ var math = {
|
|
|
166
165
|
export {
|
|
167
166
|
math
|
|
168
167
|
};
|
|
169
|
-
//# sourceMappingURL=index.
|
|
168
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/math/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport { insertObject, useAnchor } from '@wordpress/rich-text';\nimport { RichTextToolbarButton } from '@wordpress/block-editor';\nimport {\n\tPopover,\n\tTextControl,\n\t__experimentalVStack as VStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { math as icon } from '@wordpress/icons';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\nconst { Badge } = unlock( componentsPrivateApis );\n\nconst name = 'core/math';\nconst title = __( 'Math' );\n\nfunction InlineUI( {\n\tvalue,\n\tonChange,\n\tactiveAttributes,\n\tcontentRef,\n\tlatexToMathML,\n} ) {\n\tconst [ latex, setLatex ] = useState(\n\t\tactiveAttributes?.[ 'data-latex' ] || ''\n\t);\n\tconst [ error, setError ] = useState( null );\n\n\tconst popoverAnchor = useAnchor( {\n\t\teditableContentElement: contentRef.current,\n\t\tsettings: math,\n\t} );\n\n\t// Update the math object in real-time as the user types\n\tconst handleLatexChange = ( newLatex ) => {\n\t\tlet mathML = '';\n\n\t\tsetLatex( newLatex );\n\n\t\tif ( newLatex ) {\n\t\t\ttry {\n\t\t\t\tmathML = latexToMathML( newLatex, { displayMode: false } );\n\t\t\t\tsetError( null );\n\t\t\t} catch ( err ) {\n\t\t\t\tsetError( err.message );\n\t\t\t\tspeak(\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t/* translators: %s: error message returned when parsing LaTeX. */\n\t\t\t\t\t\t__( 'Error parsing mathematical expression: %s' ),\n\t\t\t\t\t\terr.message\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tconst newReplacements = value.replacements.slice();\n\t\tnewReplacements[ value.start ] = {\n\t\t\ttype: name,\n\t\t\tattributes: {\n\t\t\t\t'data-latex': newLatex,\n\t\t\t},\n\t\t\tinnerHTML: mathML,\n\t\t};\n\n\t\tonChange( {\n\t\t\t...value,\n\t\t\treplacements: newReplacements,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<Popover\n\t\t\tplacement=\"bottom-start\"\n\t\t\toffset={ 8 }\n\t\t\tfocusOnMount={ false }\n\t\t\tanchor={ popoverAnchor }\n\t\t\tclassName=\"block-editor-format-toolbar__math-popover\"\n\t\t>\n\t\t\t<div style={ { minWidth: '300px', padding: '4px' } }>\n\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tlabel={ __( 'LaTeX math syntax' ) }\n\t\t\t\t\t\tvalue={ latex }\n\t\t\t\t\t\tonChange={ handleLatexChange }\n\t\t\t\t\t\tplaceholder={ __( 'e.g., x^2, \\\\frac{a}{b}' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\tclassName=\"block-editor-format-toolbar__math-input\"\n\t\t\t\t\t/>\n\t\t\t\t\t{ error && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<Badge\n\t\t\t\t\t\t\t\tintent=\"error\"\n\t\t\t\t\t\t\t\tclassName=\"wp-block-math__error\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: error message returned when parsing LaTeX. */\n\t\t\t\t\t\t\t\t\t__( 'Error: %s' ),\n\t\t\t\t\t\t\t\t\terror\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</Badge>\n\t\t\t\t\t\t\t<style children=\".wp-block-math__error .components-badge__content{white-space:normal}\" />\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</VStack>\n\t\t\t</div>\n\t\t</Popover>\n\t);\n}\n\nfunction Edit( {\n\tvalue,\n\tonChange,\n\tonFocus,\n\tisObjectActive,\n\tactiveObjectAttributes,\n\tcontentRef,\n} ) {\n\tconst [ latexToMathML, setLatexToMathML ] = useState();\n\n\tuseEffect( () => {\n\t\timport( '@wordpress/latex-to-mathml' ).then( ( module ) => {\n\t\t\tsetLatexToMathML( () => module.default );\n\t\t} );\n\t}, [] );\n\treturn (\n\t\t<>\n\t\t\t<RichTextToolbarButton\n\t\t\t\ticon={ icon }\n\t\t\t\ttitle={ title }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tconst newValue = insertObject( value, {\n\t\t\t\t\t\ttype: name,\n\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t'data-latex': '',\n\t\t\t\t\t\t},\n\t\t\t\t\t\tinnerHTML: '',\n\t\t\t\t\t} );\n\t\t\t\t\tnewValue.start = newValue.end - 1;\n\t\t\t\t\tonChange( newValue );\n\t\t\t\t\tonFocus();\n\t\t\t\t} }\n\t\t\t\tisActive={ isObjectActive }\n\t\t\t/>\n\t\t\t{ isObjectActive && (\n\t\t\t\t<InlineUI\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tactiveAttributes={ activeObjectAttributes }\n\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\tlatexToMathML={ latexToMathML }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport const math = {\n\tname,\n\ttitle,\n\ttagName: 'math',\n\tclassName: null,\n\tattributes: {\n\t\t'data-latex': 'data-latex',\n\t},\n\tcontentEditable: false,\n\tedit: Edit,\n};\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,IAAI,eAAe;AAC5B,SAAS,UAAU,iBAAiB;AACpC,SAAS,cAAc,iBAAiB;AACxC,SAAS,6BAA6B;AACtC;AAAA,EACC;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB,eAAe;AAAA,OACT;AACP,SAAS,QAAQ,YAAY;AAC7B,SAAS,aAAa;AAKtB,SAAS,cAAc;AAwElB,SAWC,UAXD,KAWC,YAXD;AAtEL,IAAM,EAAE,MAAM,IAAI,OAAQ,qBAAsB;AAEhD,IAAM,OAAO;AACb,IAAM,QAAQ,GAAI,MAAO;AAEzB,SAAS,SAAU;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,CAAE,OAAO,QAAS,IAAI;AAAA,IAC3B,mBAAoB,YAAa,KAAK;AAAA,EACvC;AACA,QAAM,CAAE,OAAO,QAAS,IAAI,SAAU,IAAK;AAE3C,QAAM,gBAAgB,UAAW;AAAA,IAChC,wBAAwB,WAAW;AAAA,IACnC,UAAU;AAAA,EACX,CAAE;AAGF,QAAM,oBAAoB,CAAE,aAAc;AACzC,QAAI,SAAS;AAEb,aAAU,QAAS;AAEnB,QAAK,UA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AAA,EACA;AACD,GAAI;AACH,QAAM,CAAE,eAAe,gBAAiB,IAAI,SAAS;AAErD,YAAW,MAAM;AAChB,WAAQ,4BAA6B,EAAE,KAAM,CAAE,WAAY;AAC1D,uBAAkB,MAAM,OAAO,OAAQ;AAAA,IACxC,CAAE;AAAA,EACH,GAAG,CAAC,CAAE;AACN,SACC,iCACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA,SAAU,MAAM;AACf,gBAAM,WAAW,aAAc,OAAO;AAAA,YACrC,MAAM;AAAA,YACN,YAAY;AAAA,cACX,cAAc;AAAA,YACf;AAAA,YACA,WAAW;AAAA,UACZ,CAAE;AACF,mBAAS,QAAQ,SAAS,MAAM;AAChC,mBAAU,QAAS;AACnB,kBAAQ;AAAA,QACT;AAAA,QACA,UAAW;AAAA;AAAA,IACZ;AAAA,IACE,kBACD;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA,kBAAmB;AAAA,QACnB;AAAA,QACA;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;AAEO,IAAM,OAAO;AAAA,EACnB;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,WAAW;AAAA,EACX,YAAY;AAAA,IACX,cAAc;AAAA,EACf;AAAA,EACA,iBAAiB;AAAA,EACjB,MAAM;AACP;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
textColor as textColorIcon
|
|
9
9
|
} from "@wordpress/icons";
|
|
10
10
|
import { removeFormat } from "@wordpress/rich-text";
|
|
11
|
-
import { default as InlineColorUI, getActiveColors } from "./inline";
|
|
11
|
+
import { default as InlineColorUI, getActiveColors } from "./inline.mjs";
|
|
12
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
var transparentValue = "rgba(0, 0, 0, 0)";
|
|
14
14
|
var name = "core/text-color";
|
|
@@ -103,4 +103,4 @@ export {
|
|
|
103
103
|
textColor,
|
|
104
104
|
transparentValue
|
|
105
105
|
};
|
|
106
|
-
//# sourceMappingURL=index.
|
|
106
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -19,8 +19,8 @@ import {
|
|
|
19
19
|
privateApis as componentsPrivateApis
|
|
20
20
|
} from "@wordpress/components";
|
|
21
21
|
import { __ } from "@wordpress/i18n";
|
|
22
|
-
import { textColor as settings, transparentValue } from "./index";
|
|
23
|
-
import { unlock } from "../lock-unlock";
|
|
22
|
+
import { textColor as settings, transparentValue } from "./index.mjs";
|
|
23
|
+
import { unlock } from "../lock-unlock.mjs";
|
|
24
24
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
25
25
|
var { Tabs } = unlock(componentsPrivateApis);
|
|
26
26
|
var TABS = [
|
|
@@ -165,4 +165,4 @@ export {
|
|
|
165
165
|
getActiveColors,
|
|
166
166
|
parseClassName
|
|
167
167
|
};
|
|
168
|
-
//# sourceMappingURL=inline.
|
|
168
|
+
//# sourceMappingURL=inline.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/format-library",
|
|
3
|
-
"version": "5.36.1-next.
|
|
3
|
+
"version": "5.36.1-next.76cff8c98.0",
|
|
4
4
|
"description": "Format library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -22,31 +22,39 @@
|
|
|
22
22
|
"node": ">=18.12.0",
|
|
23
23
|
"npm": ">=8.19.2"
|
|
24
24
|
},
|
|
25
|
-
"
|
|
26
|
-
|
|
25
|
+
"files": [
|
|
26
|
+
"src",
|
|
27
|
+
"build",
|
|
28
|
+
"build-module",
|
|
29
|
+
"build-style",
|
|
30
|
+
"build-types",
|
|
31
|
+
"*.md"
|
|
32
|
+
],
|
|
33
|
+
"main": "build/index.cjs",
|
|
34
|
+
"module": "build-module/index.mjs",
|
|
27
35
|
"exports": {
|
|
28
36
|
".": {
|
|
29
|
-
"import": "./build-module/index.
|
|
30
|
-
"require": "./build/index.
|
|
37
|
+
"import": "./build-module/index.mjs",
|
|
38
|
+
"require": "./build/index.cjs"
|
|
31
39
|
},
|
|
32
40
|
"./package.json": "./package.json"
|
|
33
41
|
},
|
|
34
42
|
"react-native": "src/index",
|
|
35
43
|
"wpScript": true,
|
|
36
44
|
"dependencies": {
|
|
37
|
-
"@wordpress/a11y": "^4.36.1-next.
|
|
38
|
-
"@wordpress/block-editor": "^15.9.1-next.
|
|
39
|
-
"@wordpress/components": "^31.0.1-next.
|
|
40
|
-
"@wordpress/compose": "^7.36.1-next.
|
|
41
|
-
"@wordpress/data": "^10.36.1-next.
|
|
42
|
-
"@wordpress/element": "^6.36.1-next.
|
|
43
|
-
"@wordpress/html-entities": "^4.36.1-next.
|
|
44
|
-
"@wordpress/i18n": "^6.9.1-next.
|
|
45
|
-
"@wordpress/icons": "^11.3.1-next.
|
|
46
|
-
"@wordpress/latex-to-mathml": "^1.4.1-next.
|
|
47
|
-
"@wordpress/private-apis": "^1.36.1-next.
|
|
48
|
-
"@wordpress/rich-text": "^7.36.1-next.
|
|
49
|
-
"@wordpress/url": "^4.36.1-next.
|
|
45
|
+
"@wordpress/a11y": "^4.36.1-next.76cff8c98.0",
|
|
46
|
+
"@wordpress/block-editor": "^15.9.1-next.76cff8c98.0",
|
|
47
|
+
"@wordpress/components": "^31.0.1-next.76cff8c98.0",
|
|
48
|
+
"@wordpress/compose": "^7.36.1-next.76cff8c98.0",
|
|
49
|
+
"@wordpress/data": "^10.36.1-next.76cff8c98.0",
|
|
50
|
+
"@wordpress/element": "^6.36.1-next.76cff8c98.0",
|
|
51
|
+
"@wordpress/html-entities": "^4.36.1-next.76cff8c98.0",
|
|
52
|
+
"@wordpress/i18n": "^6.9.1-next.76cff8c98.0",
|
|
53
|
+
"@wordpress/icons": "^11.3.1-next.76cff8c98.0",
|
|
54
|
+
"@wordpress/latex-to-mathml": "^1.4.1-next.76cff8c98.0",
|
|
55
|
+
"@wordpress/private-apis": "^1.36.1-next.76cff8c98.0",
|
|
56
|
+
"@wordpress/rich-text": "^7.36.1-next.76cff8c98.0",
|
|
57
|
+
"@wordpress/url": "^4.36.1-next.76cff8c98.0"
|
|
50
58
|
},
|
|
51
59
|
"peerDependencies": {
|
|
52
60
|
"react": "^18.0.0",
|
|
@@ -55,5 +63,5 @@
|
|
|
55
63
|
"publishConfig": {
|
|
56
64
|
"access": "public"
|
|
57
65
|
},
|
|
58
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "368727f14b858e75179e140967c2d9ec965c8790"
|
|
59
67
|
}
|
package/src/image/index.js
CHANGED
|
@@ -112,7 +112,6 @@ function InlineUI( { value, onChange, activeObjectAttributes, contentRef } ) {
|
|
|
112
112
|
/>
|
|
113
113
|
<TextareaControl
|
|
114
114
|
label={ __( 'Alternative text' ) }
|
|
115
|
-
__nextHasNoMarginBottom
|
|
116
115
|
value={ editedAlt }
|
|
117
116
|
onChange={ ( newAlt ) => {
|
|
118
117
|
setEditedAlt( newAlt );
|
package/src/language/index.js
CHANGED
|
@@ -99,7 +99,6 @@ function InlineLanguageUI( { value, contentRef, onChange, onClose } ) {
|
|
|
99
99
|
>
|
|
100
100
|
<TextControl
|
|
101
101
|
__next40pxDefaultSize
|
|
102
|
-
__nextHasNoMarginBottom
|
|
103
102
|
label={ title }
|
|
104
103
|
value={ lang }
|
|
105
104
|
onChange={ ( val ) => setLang( val ) }
|
|
@@ -109,7 +108,6 @@ function InlineLanguageUI( { value, contentRef, onChange, onClose } ) {
|
|
|
109
108
|
/>
|
|
110
109
|
<SelectControl
|
|
111
110
|
__next40pxDefaultSize
|
|
112
|
-
__nextHasNoMarginBottom
|
|
113
111
|
label={ __( 'Text direction' ) }
|
|
114
112
|
value={ dir }
|
|
115
113
|
options={ [
|
|
@@ -58,7 +58,6 @@ const CSSClassesSettingComponent = ( { setting, value, onChange } ) => {
|
|
|
58
58
|
<VisuallyHidden as="legend">{ setting.title }</VisuallyHidden>
|
|
59
59
|
<VStack spacing={ 3 }>
|
|
60
60
|
<CheckboxControl
|
|
61
|
-
__nextHasNoMarginBottom
|
|
62
61
|
label={ setting.title }
|
|
63
62
|
onChange={ handleCheckboxChange }
|
|
64
63
|
checked={ isSettingActive || hasValue }
|
package/src/link/test/utils.js
CHANGED
|
@@ -17,61 +17,61 @@ describe( 'isValidHref', () => {
|
|
|
17
17
|
describe( 'URLs beginning with a protocol', () => {
|
|
18
18
|
it( 'returns true for valid URLs', () => {
|
|
19
19
|
expect( isValidHref( 'tel:+123456789' ) ).toBe( true );
|
|
20
|
-
expect( isValidHref( 'mailto:test@
|
|
20
|
+
expect( isValidHref( 'mailto:test@example.org' ) ).toBe( true );
|
|
21
21
|
expect( isValidHref( 'file:///c:/WINDOWS/winamp.exe' ) ).toBe(
|
|
22
22
|
true
|
|
23
23
|
);
|
|
24
|
-
expect( isValidHref( 'http://
|
|
25
|
-
expect( isValidHref( 'https://
|
|
26
|
-
expect( isValidHref( 'http://test-with-hyphen.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
expect( isValidHref( 'http://
|
|
24
|
+
expect( isValidHref( 'http://example.org' ) ).toBe( true );
|
|
25
|
+
expect( isValidHref( 'https://example.org' ) ).toBe( true );
|
|
26
|
+
expect( isValidHref( 'http://test-with-hyphen.local' ) ).toBe(
|
|
27
|
+
true
|
|
28
|
+
);
|
|
29
|
+
expect( isValidHref( 'http://example.org/' ) ).toBe( true );
|
|
30
|
+
expect( isValidHref( 'http://example.org#fragment' ) ).toBe( true );
|
|
31
|
+
expect( isValidHref( 'http://example.org/path#fragment' ) ).toBe(
|
|
30
32
|
true
|
|
31
33
|
);
|
|
32
34
|
expect(
|
|
33
|
-
isValidHref( 'http://
|
|
35
|
+
isValidHref( 'http://example.org/with/path/separators' )
|
|
34
36
|
).toBe( true );
|
|
35
37
|
expect(
|
|
36
|
-
isValidHref( 'http://
|
|
38
|
+
isValidHref( 'http://example.org/with?query=string¶ms' )
|
|
37
39
|
).toBe( true );
|
|
38
40
|
} );
|
|
39
41
|
|
|
40
42
|
it( 'returns false for invalid urls', () => {
|
|
41
43
|
expect( isValidHref( 'tel:+12 345 6789' ) ).toBe( false );
|
|
42
|
-
expect( isValidHref( 'mailto:test @
|
|
43
|
-
|
|
44
|
-
);
|
|
45
|
-
expect( isValidHref( 'mailto: test@somewhere.com' ) ).toBe( false );
|
|
44
|
+
expect( isValidHref( 'mailto:test @ example.org' ) ).toBe( false );
|
|
45
|
+
expect( isValidHref( 'mailto: test@example.org' ) ).toBe( false );
|
|
46
46
|
expect( isValidHref( 'ht#tp://this/is/invalid' ) ).toBe( false );
|
|
47
47
|
expect( isValidHref( 'ht#tp://th&is/is/invalid' ) ).toBe( false );
|
|
48
|
-
expect( isValidHref( 'http:/
|
|
49
|
-
expect( isValidHref( 'http://?
|
|
50
|
-
expect( isValidHref( 'http://#
|
|
51
|
-
expect( isValidHref( 'http://
|
|
52
|
-
false
|
|
53
|
-
);
|
|
54
|
-
expect( isValidHref( 'http://test.com#double#anchor' ) ).toBe(
|
|
55
|
-
false
|
|
56
|
-
);
|
|
57
|
-
expect( isValidHref( 'http://test.com?path/after/params' ) ).toBe(
|
|
48
|
+
expect( isValidHref( 'http:/example.org' ) ).toBe( false );
|
|
49
|
+
expect( isValidHref( 'http://?example.org' ) ).toBe( false );
|
|
50
|
+
expect( isValidHref( 'http://#example.org' ) ).toBe( false );
|
|
51
|
+
expect( isValidHref( 'http://example.org?double?params' ) ).toBe(
|
|
58
52
|
false
|
|
59
53
|
);
|
|
60
|
-
expect( isValidHref( 'http://
|
|
54
|
+
expect( isValidHref( 'http://example.org#double#anchor' ) ).toBe(
|
|
61
55
|
false
|
|
62
56
|
);
|
|
57
|
+
expect(
|
|
58
|
+
isValidHref( 'http://example.org?path/after/params' )
|
|
59
|
+
).toBe( false );
|
|
60
|
+
expect(
|
|
61
|
+
isValidHref( 'http://example.org#path/after/fragment' )
|
|
62
|
+
).toBe( false );
|
|
63
63
|
} );
|
|
64
64
|
|
|
65
65
|
it( 'returns false if the URL has whitespace', () => {
|
|
66
|
-
expect( isValidHref( 'http:/ /
|
|
67
|
-
expect( isValidHref( 'http://
|
|
68
|
-
expect( isValidHref( 'http://
|
|
69
|
-
expect( isValidHref( 'http://
|
|
70
|
-
expect( isValidHref( 'http://
|
|
71
|
-
expect( isValidHref( 'http://
|
|
66
|
+
expect( isValidHref( 'http:/ /example.org' ) ).toBe( false );
|
|
67
|
+
expect( isValidHref( 'http://exam ple.org' ) ).toBe( false );
|
|
68
|
+
expect( isValidHref( 'http:// example.org' ) ).toBe( false );
|
|
69
|
+
expect( isValidHref( 'http://example.o rg' ) ).toBe( false );
|
|
70
|
+
expect( isValidHref( 'http://example.org/ee ee/' ) ).toBe( false );
|
|
71
|
+
expect( isValidHref( 'http://example.org/eeee?qwd qwdw' ) ).toBe(
|
|
72
72
|
false
|
|
73
73
|
);
|
|
74
|
-
expect( isValidHref( 'http://
|
|
74
|
+
expect( isValidHref( 'http://example.org/eeee#qwd qwdw' ) ).toBe(
|
|
75
75
|
false
|
|
76
76
|
);
|
|
77
77
|
expect( isValidHref( 'this: is invalid' ) ).toBe( false );
|
package/src/math/index.js
CHANGED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// packages/format-library/src/default-formats.js
|
|
2
|
-
import { bold } from "./bold";
|
|
3
|
-
import { code } from "./code";
|
|
4
|
-
import { image } from "./image";
|
|
5
|
-
import { italic } from "./italic";
|
|
6
|
-
import { link } from "./link";
|
|
7
|
-
import { strikethrough } from "./strikethrough";
|
|
8
|
-
import { underline } from "./underline";
|
|
9
|
-
import { textColor } from "./text-color";
|
|
10
|
-
import { subscript } from "./subscript";
|
|
11
|
-
import { superscript } from "./superscript";
|
|
12
|
-
import { keyboard } from "./keyboard";
|
|
13
|
-
import { unknown } from "./unknown";
|
|
14
|
-
import { language } from "./language";
|
|
15
|
-
import { math } from "./math";
|
|
16
|
-
import { nonBreakingSpace } from "./non-breaking-space";
|
|
17
|
-
var default_formats_default = [
|
|
18
|
-
bold,
|
|
19
|
-
code,
|
|
20
|
-
image,
|
|
21
|
-
italic,
|
|
22
|
-
link,
|
|
23
|
-
strikethrough,
|
|
24
|
-
underline,
|
|
25
|
-
textColor,
|
|
26
|
-
subscript,
|
|
27
|
-
superscript,
|
|
28
|
-
keyboard,
|
|
29
|
-
unknown,
|
|
30
|
-
language,
|
|
31
|
-
math,
|
|
32
|
-
nonBreakingSpace
|
|
33
|
-
];
|
|
34
|
-
export {
|
|
35
|
-
default_formats_default as default
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=default-formats.js.map
|