@wordpress/format-library 5.9.0 → 5.11.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/image/index.js.map +1 -1
- package/build/link/index.js +2 -1
- package/build/link/index.js.map +1 -1
- package/build/link/inline.js +1 -1
- package/build/link/inline.js.map +1 -1
- package/build/link/use-link-instance-key.js.map +1 -1
- package/build-module/bold/index.js +1 -3
- package/build-module/bold/index.js.map +1 -1
- package/build-module/code/index.js +1 -3
- package/build-module/code/index.js.map +1 -1
- package/build-module/image/index.js +1 -3
- package/build-module/image/index.js.map +1 -1
- package/build-module/italic/index.js +1 -3
- package/build-module/italic/index.js.map +1 -1
- package/build-module/language/index.js +1 -3
- package/build-module/language/index.js.map +1 -1
- package/build-module/link/index.js +3 -4
- package/build-module/link/index.js.map +1 -1
- package/build-module/link/index.native.js +1 -3
- package/build-module/link/index.native.js.map +1 -1
- package/build-module/link/inline.js +1 -1
- package/build-module/link/inline.js.map +1 -1
- package/build-module/link/modal-screens/link-settings-screen.native.js +1 -3
- package/build-module/link/modal-screens/link-settings-screen.native.js.map +1 -1
- package/build-module/link/modal.native.js +1 -2
- package/build-module/link/modal.native.js.map +1 -1
- package/build-module/link/use-link-instance-key.js.map +1 -1
- package/build-module/strikethrough/index.js +1 -3
- package/build-module/strikethrough/index.js.map +1 -1
- package/build-module/text-color/index.js +1 -3
- package/build-module/text-color/index.js.map +1 -1
- package/build-module/text-color/index.native.js +1 -3
- package/build-module/text-color/index.native.js.map +1 -1
- package/build-module/text-color/inline.js +1 -2
- package/build-module/text-color/inline.js.map +1 -1
- package/build-module/underline/index.js +1 -3
- package/build-module/underline/index.js.map +1 -1
- package/package.json +16 -15
- package/src/link/index.js +9 -1
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { toggleFormat } from '@wordpress/rich-text';
|
|
6
6
|
import { RichTextShortcut, __unstableRichTextInputEvent } from '@wordpress/block-editor';
|
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
8
|
const name = 'core/underline';
|
|
11
9
|
const title = __('Underline');
|
|
12
10
|
export const underline = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","toggleFormat","RichTextShortcut","__unstableRichTextInputEvent","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","name","title","underline","tagName","className","attributes","style","edit","value","onChange","onToggle","type","children","character","onUse","inputType","onInput"],"sources":["@wordpress/format-library/src/underline/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { toggleFormat } from '@wordpress/rich-text';\nimport {\n\tRichTextShortcut,\n\t__unstableRichTextInputEvent,\n} from '@wordpress/block-editor';\n\nconst name = 'core/underline';\nconst title = __( 'Underline' );\n\nexport const underline = {\n\tname,\n\ttitle,\n\ttagName: 'span',\n\tclassName: null,\n\tattributes: {\n\t\tstyle: 'style',\n\t},\n\tedit( { value, onChange } ) {\n\t\tconst onToggle = () => {\n\t\t\tonChange(\n\t\t\t\ttoggleFormat( value, {\n\t\t\t\t\ttype: name,\n\t\t\t\t\tattributes: {\n\t\t\t\t\t\tstyle: 'text-decoration: underline;',\n\t\t\t\t\t},\n\t\t\t\t\ttitle,\n\t\t\t\t} )\n\t\t\t);\n\t\t};\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<RichTextShortcut\n\t\t\t\t\ttype=\"primary\"\n\t\t\t\t\tcharacter=\"u\"\n\t\t\t\t\tonUse={ onToggle }\n\t\t\t\t/>\n\t\t\t\t<__unstableRichTextInputEvent\n\t\t\t\t\tinputType=\"formatUnderline\"\n\t\t\t\t\tonInput={ onToggle }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,QAAQ,sBAAsB;AACnD,SACCC,gBAAgB,EAChBC,4BAA4B,QACtB,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA
|
|
1
|
+
{"version":3,"names":["__","toggleFormat","RichTextShortcut","__unstableRichTextInputEvent","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","name","title","underline","tagName","className","attributes","style","edit","value","onChange","onToggle","type","children","character","onUse","inputType","onInput"],"sources":["@wordpress/format-library/src/underline/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { toggleFormat } from '@wordpress/rich-text';\nimport {\n\tRichTextShortcut,\n\t__unstableRichTextInputEvent,\n} from '@wordpress/block-editor';\n\nconst name = 'core/underline';\nconst title = __( 'Underline' );\n\nexport const underline = {\n\tname,\n\ttitle,\n\ttagName: 'span',\n\tclassName: null,\n\tattributes: {\n\t\tstyle: 'style',\n\t},\n\tedit( { value, onChange } ) {\n\t\tconst onToggle = () => {\n\t\t\tonChange(\n\t\t\t\ttoggleFormat( value, {\n\t\t\t\t\ttype: name,\n\t\t\t\t\tattributes: {\n\t\t\t\t\t\tstyle: 'text-decoration: underline;',\n\t\t\t\t\t},\n\t\t\t\t\ttitle,\n\t\t\t\t} )\n\t\t\t);\n\t\t};\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<RichTextShortcut\n\t\t\t\t\ttype=\"primary\"\n\t\t\t\t\tcharacter=\"u\"\n\t\t\t\t\tonUse={ onToggle }\n\t\t\t\t/>\n\t\t\t\t<__unstableRichTextInputEvent\n\t\t\t\t\tinputType=\"formatUnderline\"\n\t\t\t\t\tonInput={ onToggle }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,QAAQ,sBAAsB;AACnD,SACCC,gBAAgB,EAChBC,4BAA4B,QACtB,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAEjC,MAAMC,IAAI,GAAG,gBAAgB;AAC7B,MAAMC,KAAK,GAAGX,EAAE,CAAE,WAAY,CAAC;AAE/B,OAAO,MAAMY,SAAS,GAAG;EACxBF,IAAI;EACJC,KAAK;EACLE,OAAO,EAAE,MAAM;EACfC,SAAS,EAAE,IAAI;EACfC,UAAU,EAAE;IACXC,KAAK,EAAE;EACR,CAAC;EACDC,IAAIA,CAAE;IAAEC,KAAK;IAAEC;EAAS,CAAC,EAAG;IAC3B,MAAMC,QAAQ,GAAGA,CAAA,KAAM;MACtBD,QAAQ,CACPlB,YAAY,CAAEiB,KAAK,EAAE;QACpBG,IAAI,EAAEX,IAAI;QACVK,UAAU,EAAE;UACXC,KAAK,EAAE;QACR,CAAC;QACDL;MACD,CAAE,CACH,CAAC;IACF,CAAC;IAED,oBACCF,KAAA,CAAAF,SAAA;MAAAe,QAAA,gBACCjB,IAAA,CAACH,gBAAgB;QAChBmB,IAAI,EAAC,SAAS;QACdE,SAAS,EAAC,GAAG;QACbC,KAAK,EAAGJ;MAAU,CAClB,CAAC,eACFf,IAAA,CAACF,4BAA4B;QAC5BsB,SAAS,EAAC,iBAAiB;QAC3BC,OAAO,EAAGN;MAAU,CACpB,CAAC;IAAA,CACD,CAAC;EAEL;AACD,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/format-library",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.11.0",
|
|
4
4
|
"description": "Format library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -26,19 +26,19 @@
|
|
|
26
26
|
"module": "build-module/index.js",
|
|
27
27
|
"react-native": "src/index",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@babel/runtime": "
|
|
30
|
-
"@wordpress/a11y": "
|
|
31
|
-
"@wordpress/block-editor": "
|
|
32
|
-
"@wordpress/components": "
|
|
33
|
-
"@wordpress/compose": "
|
|
34
|
-
"@wordpress/data": "
|
|
35
|
-
"@wordpress/element": "
|
|
36
|
-
"@wordpress/html-entities": "
|
|
37
|
-
"@wordpress/i18n": "
|
|
38
|
-
"@wordpress/icons": "
|
|
39
|
-
"@wordpress/private-apis": "
|
|
40
|
-
"@wordpress/rich-text": "
|
|
41
|
-
"@wordpress/url": "
|
|
29
|
+
"@babel/runtime": "7.25.7",
|
|
30
|
+
"@wordpress/a11y": "*",
|
|
31
|
+
"@wordpress/block-editor": "*",
|
|
32
|
+
"@wordpress/components": "*",
|
|
33
|
+
"@wordpress/compose": "*",
|
|
34
|
+
"@wordpress/data": "*",
|
|
35
|
+
"@wordpress/element": "*",
|
|
36
|
+
"@wordpress/html-entities": "*",
|
|
37
|
+
"@wordpress/i18n": "*",
|
|
38
|
+
"@wordpress/icons": "*",
|
|
39
|
+
"@wordpress/private-apis": "*",
|
|
40
|
+
"@wordpress/rich-text": "*",
|
|
41
|
+
"@wordpress/url": "*"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": "^18.0.0",
|
|
@@ -47,5 +47,6 @@
|
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
|
-
"
|
|
50
|
+
"wpScript": true,
|
|
51
|
+
"gitHead": "dcf4613b33b0eda14e203ac30f700ed0db70347f"
|
|
51
52
|
}
|
package/src/link/index.js
CHANGED
|
@@ -170,9 +170,17 @@ function Edit( {
|
|
|
170
170
|
openedBy?.el?.tagName === 'A' && openedBy?.action === 'click'
|
|
171
171
|
);
|
|
172
172
|
|
|
173
|
+
const hasSelection = ! isCollapsed( value );
|
|
174
|
+
|
|
173
175
|
return (
|
|
174
176
|
<>
|
|
175
|
-
|
|
177
|
+
{ hasSelection && (
|
|
178
|
+
<RichTextShortcut
|
|
179
|
+
type="primary"
|
|
180
|
+
character="k"
|
|
181
|
+
onUse={ addLink }
|
|
182
|
+
/>
|
|
183
|
+
) }
|
|
176
184
|
<RichTextShortcut
|
|
177
185
|
type="primaryShift"
|
|
178
186
|
character="k"
|