@wordpress/format-library 5.34.0 → 5.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/bold/index.js +7 -5
- package/build/bold/index.js.map +1 -1
- package/build/code/index.js +6 -4
- package/build/code/index.js.map +1 -1
- package/build/default-formats.js +2 -0
- package/build/default-formats.js.map +1 -1
- package/build/image/index.js +7 -5
- package/build/image/index.js.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/italic/index.js +7 -5
- package/build/italic/index.js.map +1 -1
- package/build/keyboard/index.js +6 -4
- package/build/keyboard/index.js.map +1 -1
- package/build/language/index.js +6 -4
- package/build/language/index.js.map +1 -1
- package/build/link/css-classes-setting.js +4 -2
- package/build/link/css-classes-setting.js.map +1 -1
- package/build/link/index.js +7 -5
- package/build/link/index.js.map +1 -1
- package/build/link/inline.js +4 -2
- package/build/link/inline.js.map +1 -1
- package/build/link/use-link-instance-key.js +5 -3
- package/build/link/use-link-instance-key.js.map +1 -1
- package/build/link/utils.js +5 -3
- package/build/link/utils.js.map +1 -1
- package/build/lock-unlock.js +3 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/math/index.js +18 -13
- package/build/math/index.js.map +2 -2
- package/build/non-breaking-space/index.js +6 -4
- package/build/non-breaking-space/index.js.map +1 -1
- package/build/strikethrough/index.js +6 -4
- package/build/strikethrough/index.js.map +1 -1
- package/build/subscript/index.js +6 -4
- package/build/subscript/index.js.map +1 -1
- package/build/superscript/index.js +6 -4
- package/build/superscript/index.js.map +1 -1
- package/build/text-color/index.js +8 -6
- package/build/text-color/index.js.map +1 -1
- package/build/text-color/inline.js +5 -3
- package/build/text-color/inline.js.map +1 -1
- package/build/underline/index.js +6 -4
- package/build/underline/index.js.map +1 -1
- package/build/unknown/index.js +6 -4
- package/build/unknown/index.js.map +1 -1
- package/build-module/bold/index.js +6 -5
- package/build-module/bold/index.js.map +1 -1
- package/build-module/code/index.js +5 -4
- package/build-module/code/index.js.map +1 -1
- package/build-module/default-formats.js +1 -0
- package/build-module/default-formats.js.map +1 -1
- package/build-module/image/index.js +6 -5
- package/build-module/image/index.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/italic/index.js +6 -5
- package/build-module/italic/index.js.map +1 -1
- package/build-module/keyboard/index.js +5 -4
- package/build-module/keyboard/index.js.map +1 -1
- package/build-module/language/index.js +5 -4
- package/build-module/language/index.js.map +1 -1
- package/build-module/link/css-classes-setting.js +3 -2
- package/build-module/link/css-classes-setting.js.map +1 -1
- package/build-module/link/index.js +6 -5
- package/build-module/link/index.js.map +1 -1
- package/build-module/link/inline.js +3 -2
- package/build-module/link/inline.js.map +1 -1
- package/build-module/link/use-link-instance-key.js +4 -3
- package/build-module/link/use-link-instance-key.js.map +1 -1
- package/build-module/link/utils.js +4 -3
- package/build-module/link/utils.js.map +1 -1
- package/build-module/lock-unlock.js +2 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/math/index.js +17 -13
- package/build-module/math/index.js.map +2 -2
- package/build-module/non-breaking-space/index.js +5 -4
- package/build-module/non-breaking-space/index.js.map +1 -1
- package/build-module/strikethrough/index.js +5 -4
- package/build-module/strikethrough/index.js.map +1 -1
- package/build-module/subscript/index.js +5 -4
- package/build-module/subscript/index.js.map +1 -1
- package/build-module/superscript/index.js +5 -4
- package/build-module/superscript/index.js.map +1 -1
- package/build-module/text-color/index.js +7 -6
- package/build-module/text-color/index.js.map +1 -1
- package/build-module/text-color/inline.js +4 -3
- package/build-module/text-color/inline.js.map +1 -1
- package/build-module/underline/index.js +5 -4
- package/build-module/underline/index.js.map +1 -1
- package/build-module/unknown/index.js +5 -4
- package/build-module/unknown/index.js.map +1 -1
- package/build-style/style-rtl.css +4 -0
- package/build-style/style.css +5 -0
- package/package.json +15 -15
- package/src/math/index.js +10 -7
- package/src/math/style.scss +4 -0
- package/src/style.scss +1 -0
package/build/link/utils.js
CHANGED
|
@@ -15,6 +15,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// packages/format-library/src/link/utils.js
|
|
18
20
|
var utils_exports = {};
|
|
19
21
|
__export(utils_exports, {
|
|
20
22
|
createLinkFormat: () => createLinkFormat,
|
|
@@ -151,9 +153,9 @@ function walkToBoundary(formats, initialIndex, targetFormatRef, formatIndex, dir
|
|
|
151
153
|
index = index + inverseDirectionIncrement;
|
|
152
154
|
return index;
|
|
153
155
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
156
|
+
var partialRight = (fn, ...partialArgs) => (...args) => fn(...args, ...partialArgs);
|
|
157
|
+
var walkToStart = partialRight(walkToBoundary, "backwards");
|
|
158
|
+
var walkToEnd = partialRight(walkToBoundary, "forwards");
|
|
157
159
|
// Annotate the CommonJS export names for ESM import in node:
|
|
158
160
|
0 && (module.exports = {
|
|
159
161
|
createLinkFormat,
|
package/build/link/utils.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/link/utils.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tgetProtocol,\n\tisValidProtocol,\n\tgetAuthority,\n\tisValidAuthority,\n\tgetPath,\n\tisValidPath,\n\tgetQueryString,\n\tisValidQueryString,\n\tgetFragment,\n\tisValidFragment,\n} from '@wordpress/url';\n\n/**\n * Check for issues with the provided href.\n *\n * @param {string} href The href.\n *\n * @return {boolean} Is the href invalid?\n */\nexport function isValidHref( href ) {\n\tif ( ! href ) {\n\t\treturn false;\n\t}\n\n\tconst trimmedHref = href.trim();\n\n\tif ( ! trimmedHref ) {\n\t\treturn false;\n\t}\n\n\t// Does the href start with something that looks like a URL protocol?\n\tif ( /^\\S+:/.test( trimmedHref ) ) {\n\t\tconst protocol = getProtocol( trimmedHref );\n\t\tif ( ! isValidProtocol( protocol ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Add some extra checks for http(s) URIs, since these are the most common use-case.\n\t\t// This ensures URIs with an http protocol have exactly two forward slashes following the protocol.\n\t\tif (\n\t\t\tprotocol.startsWith( 'http' ) &&\n\t\t\t! /^https?:\\/\\/[^\\/\\s]/i.test( trimmedHref )\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst authority = getAuthority( trimmedHref );\n\t\tif ( ! isValidAuthority( authority ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst path = getPath( trimmedHref );\n\t\tif ( path && ! isValidPath( path ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst queryString = getQueryString( trimmedHref );\n\t\tif ( queryString && ! isValidQueryString( queryString ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst fragment = getFragment( trimmedHref );\n\t\tif ( fragment && ! isValidFragment( fragment ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t// Validate anchor links.\n\tif ( trimmedHref.startsWith( '#' ) && ! isValidFragment( trimmedHref ) ) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/**\n * Generates the format object that will be applied to the link text.\n *\n * @param {Object} options\n * @param {string} options.url The href of the link.\n * @param {string} options.type The type of the link.\n * @param {string} options.id The ID of the link.\n * @param {boolean} options.opensInNewWindow Whether this link will open in a new window.\n * @param {boolean} options.nofollow Whether this link is marked as no follow relationship.\n * @param {string} options.cssClasses The CSS classes to apply to the link.\n * @return {Object} The final format object.\n */\nexport function createLinkFormat( {\n\turl,\n\ttype,\n\tid,\n\topensInNewWindow,\n\tnofollow,\n\tcssClasses,\n} ) {\n\tconst format = {\n\t\ttype: 'core/link',\n\t\tattributes: {\n\t\t\turl,\n\t\t},\n\t};\n\n\tif ( type ) {\n\t\tformat.attributes.type = type;\n\t}\n\tif ( id ) {\n\t\tformat.attributes.id = id;\n\t}\n\n\tif ( opensInNewWindow ) {\n\t\tformat.attributes.target = '_blank';\n\t\tformat.attributes.rel = format.attributes.rel\n\t\t\t? format.attributes.rel + ' noreferrer noopener'\n\t\t\t: 'noreferrer noopener';\n\t}\n\n\tif ( nofollow ) {\n\t\tformat.attributes.rel = format.attributes.rel\n\t\t\t? format.attributes.rel + ' nofollow'\n\t\t\t: 'nofollow';\n\t}\n\n\tconst trimmedCssClasses = cssClasses?.trim();\n\n\tif ( trimmedCssClasses?.length ) {\n\t\tformat.attributes.class = trimmedCssClasses;\n\t}\n\n\treturn format;\n}\n\n/* eslint-disable jsdoc/no-undefined-types */\n/**\n * Get the start and end boundaries of a given format from a rich text value.\n *\n *\n * @param {RichTextValue} value the rich text value to interrogate.\n * @param {string} format the identifier for the target format (e.g. `core/link`, `core/bold`).\n * @param {number?} startIndex optional startIndex to seek from.\n * @param {number?} endIndex optional endIndex to seek from.\n * @return {Object}\tobject containing start and end values for the given format.\n */\n/* eslint-enable jsdoc/no-undefined-types */\nexport function getFormatBoundary(\n\tvalue,\n\tformat,\n\tstartIndex = value.start,\n\tendIndex = value.end\n) {\n\tconst EMPTY_BOUNDARIES = {\n\t\tstart: null,\n\t\tend: null,\n\t};\n\n\tconst { formats } = value;\n\tlet targetFormat;\n\tlet initialIndex;\n\n\tif ( ! formats?.length ) {\n\t\treturn EMPTY_BOUNDARIES;\n\t}\n\n\t// Clone formats to avoid modifying source formats.\n\tconst newFormats = formats.slice();\n\n\tconst formatAtStart = newFormats[ startIndex ]?.find(\n\t\t( { type } ) => type === format.type\n\t);\n\n\tconst formatAtEnd = newFormats[ endIndex ]?.find(\n\t\t( { type } ) => type === format.type\n\t);\n\n\tconst formatAtEndMinusOne = newFormats[ endIndex - 1 ]?.find(\n\t\t( { type } ) => type === format.type\n\t);\n\n\tif ( !! formatAtStart ) {\n\t\t// Set values to conform to \"start\"\n\t\ttargetFormat = formatAtStart;\n\t\tinitialIndex = startIndex;\n\t} else if ( !! formatAtEnd ) {\n\t\t// Set values to conform to \"end\"\n\t\ttargetFormat = formatAtEnd;\n\t\tinitialIndex = endIndex;\n\t} else if ( !! formatAtEndMinusOne ) {\n\t\t// This is an edge case which will occur if you create a format, then place\n\t\t// the caret just before the format and hit the back ARROW key. The resulting\n\t\t// value object will have start and end +1 beyond the edge of the format boundary.\n\t\ttargetFormat = formatAtEndMinusOne;\n\t\tinitialIndex = endIndex - 1;\n\t} else {\n\t\treturn EMPTY_BOUNDARIES;\n\t}\n\n\tconst index = newFormats[ initialIndex ].indexOf( targetFormat );\n\n\tconst walkingArgs = [ newFormats, initialIndex, targetFormat, index ];\n\n\t// Walk the startIndex \"backwards\" to the leading \"edge\" of the matching format.\n\tstartIndex = walkToStart( ...walkingArgs );\n\n\t// Walk the endIndex \"forwards\" until the trailing \"edge\" of the matching format.\n\tendIndex = walkToEnd( ...walkingArgs );\n\n\t// Safe guard: start index cannot be less than 0.\n\tstartIndex = startIndex < 0 ? 0 : startIndex;\n\n\t// // Return the indices of the \"edges\" as the boundaries.\n\treturn {\n\t\tstart: startIndex,\n\t\tend: endIndex,\n\t};\n}\n\n/**\n * Walks forwards/backwards towards the boundary of a given format within an\n * array of format objects. Returns the index of the boundary.\n *\n * @param {Array} formats the formats to search for the given format type.\n * @param {number} initialIndex the starting index from which to walk.\n * @param {Object} targetFormatRef a reference to the format type object being sought.\n * @param {number} formatIndex the index at which we expect the target format object to be.\n * @param {string} direction either 'forwards' or 'backwards' to indicate the direction.\n * @return {number} the index of the boundary of the given format.\n */\nfunction walkToBoundary(\n\tformats,\n\tinitialIndex,\n\ttargetFormatRef,\n\tformatIndex,\n\tdirection\n) {\n\tlet index = initialIndex;\n\n\tconst directions = {\n\t\tforwards: 1,\n\t\tbackwards: -1,\n\t};\n\n\tconst directionIncrement = directions[ direction ] || 1; // invalid direction arg default to forwards\n\tconst inverseDirectionIncrement = directionIncrement * -1;\n\n\twhile (\n\t\tformats[ index ] &&\n\t\tformats[ index ][ formatIndex ] === targetFormatRef\n\t) {\n\t\t// Increment/decrement in the direction of operation.\n\t\tindex = index + directionIncrement;\n\t}\n\n\t// Restore by one in inverse direction of operation\n\t// to avoid out of bounds.\n\tindex = index + inverseDirectionIncrement;\n\n\treturn index;\n}\n\nconst partialRight =\n\t( fn, ...partialArgs ) =>\n\t( ...args ) =>\n\t\tfn( ...args, ...partialArgs );\n\nconst walkToStart = partialRight( walkToBoundary, 'backwards' );\n\nconst walkToEnd = partialRight( walkToBoundary, 'forwards' );\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/lock-unlock.js
CHANGED
|
@@ -15,6 +15,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// packages/format-library/src/lock-unlock.js
|
|
18
20
|
var lock_unlock_exports = {};
|
|
19
21
|
__export(lock_unlock_exports, {
|
|
20
22
|
lock: () => lock,
|
|
@@ -22,7 +24,7 @@ __export(lock_unlock_exports, {
|
|
|
22
24
|
});
|
|
23
25
|
module.exports = __toCommonJS(lock_unlock_exports);
|
|
24
26
|
var import_private_apis = require("@wordpress/private-apis");
|
|
25
|
-
|
|
27
|
+
var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
|
|
26
28
|
"I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
|
|
27
29
|
"@wordpress/format-library"
|
|
28
30
|
);
|
package/build/lock-unlock.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/lock-unlock.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/format-library'\n\t);\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAiE;AAE1D,IAAM,EAAE,MAAM,OAAO,QAC3B;AAAA,EACC;AAAA,EACA;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/math/index.js
CHANGED
|
@@ -25,12 +25,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
mod
|
|
26
26
|
));
|
|
27
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// packages/format-library/src/math/index.js
|
|
28
30
|
var math_exports = {};
|
|
29
31
|
__export(math_exports, {
|
|
30
32
|
math: () => math
|
|
31
33
|
});
|
|
32
34
|
module.exports = __toCommonJS(math_exports);
|
|
33
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
35
|
var import_i18n = require("@wordpress/i18n");
|
|
35
36
|
var import_element = require("@wordpress/element");
|
|
36
37
|
var import_rich_text = require("@wordpress/rich-text");
|
|
@@ -38,9 +39,10 @@ var import_block_editor = require("@wordpress/block-editor");
|
|
|
38
39
|
var import_components = require("@wordpress/components");
|
|
39
40
|
var import_icons = require("@wordpress/icons");
|
|
40
41
|
var import_lock_unlock = require("../lock-unlock");
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
|
+
var { Badge } = (0, import_lock_unlock.unlock)(import_components.privateApis);
|
|
44
|
+
var name = "core/math";
|
|
45
|
+
var title = (0, import_i18n.__)("Math");
|
|
44
46
|
function InlineUI({
|
|
45
47
|
value,
|
|
46
48
|
onChange,
|
|
@@ -57,14 +59,16 @@ function InlineUI({
|
|
|
57
59
|
settings: math
|
|
58
60
|
});
|
|
59
61
|
const handleLatexChange = (newLatex) => {
|
|
60
|
-
let mathML;
|
|
62
|
+
let mathML = "";
|
|
61
63
|
setLatex(newLatex);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
if (newLatex) {
|
|
65
|
+
try {
|
|
66
|
+
mathML = latexToMathML(newLatex, { displayMode: false });
|
|
67
|
+
setError(null);
|
|
68
|
+
} catch (err) {
|
|
69
|
+
setError(err.message);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
68
72
|
}
|
|
69
73
|
const newReplacements = value.replacements.slice();
|
|
70
74
|
newReplacements[value.start] = {
|
|
@@ -98,7 +102,8 @@ function InlineUI({
|
|
|
98
102
|
value: latex,
|
|
99
103
|
onChange: handleLatexChange,
|
|
100
104
|
placeholder: (0, import_i18n.__)("e.g., x^2, \\frac{a}{b}"),
|
|
101
|
-
autoComplete: "off"
|
|
105
|
+
autoComplete: "off",
|
|
106
|
+
className: "block-editor-format-toolbar__math-input"
|
|
102
107
|
}
|
|
103
108
|
),
|
|
104
109
|
error && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
@@ -163,7 +168,7 @@ function Edit({
|
|
|
163
168
|
)
|
|
164
169
|
] });
|
|
165
170
|
}
|
|
166
|
-
|
|
171
|
+
var math = {
|
|
167
172
|
name,
|
|
168
173
|
title,
|
|
169
174
|
tagName: "math",
|
package/build/math/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/math/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } 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';\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\ttry {\n\t\t\tmathML = latexToMathML( newLatex, { displayMode: false } );\n\t\t\tsetError( null );\n\t\t} catch ( err ) {\n\t\t\tsetError( err.message );\n\t\t\treturn;\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__nextHasNoMarginBottom\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/>\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{ error }\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": "
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } 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';\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\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__nextHasNoMarginBottom\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{ error }\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": "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",
|
|
6
6
|
"names": ["componentsPrivateApis", "VStack", "module", "icon"]
|
|
7
7
|
}
|
|
@@ -15,18 +15,20 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// packages/format-library/src/non-breaking-space/index.js
|
|
18
20
|
var non_breaking_space_exports = {};
|
|
19
21
|
__export(non_breaking_space_exports, {
|
|
20
22
|
nonBreakingSpace: () => nonBreakingSpace
|
|
21
23
|
});
|
|
22
24
|
module.exports = __toCommonJS(non_breaking_space_exports);
|
|
23
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
24
25
|
var import_i18n = require("@wordpress/i18n");
|
|
25
26
|
var import_rich_text = require("@wordpress/rich-text");
|
|
26
27
|
var import_block_editor = require("@wordpress/block-editor");
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
+
var name = "core/non-breaking-space";
|
|
30
|
+
var title = (0, import_i18n.__)("Non breaking space");
|
|
31
|
+
var nonBreakingSpace = {
|
|
30
32
|
name,
|
|
31
33
|
title,
|
|
32
34
|
tagName: "nbsp",
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/non-breaking-space/index.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { insert } from '@wordpress/rich-text';\nimport { RichTextShortcut } from '@wordpress/block-editor';\n\nconst name = 'core/non-breaking-space';\nconst title = __( 'Non breaking space' );\n\nexport const nonBreakingSpace = {\n\tname,\n\ttitle,\n\ttagName: 'nbsp',\n\tclassName: null,\n\tedit( { value, onChange } ) {\n\t\tfunction addNonBreakingSpace() {\n\t\t\tonChange( insert( value, '\\u00a0' ) );\n\t\t}\n\n\t\treturn (\n\t\t\t<RichTextShortcut\n\t\t\t\ttype=\"primaryShift\"\n\t\t\t\tcharacter=\" \"\n\t\t\t\tonUse={ addNonBreakingSpace }\n\t\t\t/>\n\t\t);\n\t},\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,uBAAuB;AACvB,0BAAiC;AAgB9B;AAdH,IAAM,OAAO;AACb,IAAM,YAAQ,gBAAI,oBAAqB;AAEhC,IAAM,mBAAmB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,WAAW;AAAA,EACX,KAAM,EAAE,OAAO,SAAS,GAAI;AAC3B,aAAS,sBAAsB;AAC9B,mBAAU,yBAAQ,OAAO,MAAS,CAAE;AAAA,IACrC;AAEA,WACC;AAAA,MAAC;AAAA;AAAA,QACA,MAAK;AAAA,QACL,WAAU;AAAA,QACV,OAAQ;AAAA;AAAA,IACT;AAAA,EAEF;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -15,19 +15,21 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// packages/format-library/src/strikethrough/index.js
|
|
18
20
|
var strikethrough_exports = {};
|
|
19
21
|
__export(strikethrough_exports, {
|
|
20
22
|
strikethrough: () => strikethrough
|
|
21
23
|
});
|
|
22
24
|
module.exports = __toCommonJS(strikethrough_exports);
|
|
23
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
24
25
|
var import_i18n = require("@wordpress/i18n");
|
|
25
26
|
var import_rich_text = require("@wordpress/rich-text");
|
|
26
27
|
var import_block_editor = require("@wordpress/block-editor");
|
|
27
28
|
var import_icons = require("@wordpress/icons");
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
+
var name = "core/strikethrough";
|
|
31
|
+
var title = (0, import_i18n.__)("Strikethrough");
|
|
32
|
+
var strikethrough = {
|
|
31
33
|
name,
|
|
32
34
|
title,
|
|
33
35
|
tagName: "s",
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/strikethrough/index.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { toggleFormat } from '@wordpress/rich-text';\nimport {\n\tRichTextToolbarButton,\n\tRichTextShortcut,\n} from '@wordpress/block-editor';\nimport { formatStrikethrough } from '@wordpress/icons';\n\nconst name = 'core/strikethrough';\nconst title = __( 'Strikethrough' );\n\nexport const strikethrough = {\n\tname,\n\ttitle,\n\ttagName: 's',\n\tclassName: null,\n\tedit( { isActive, value, onChange, onFocus } ) {\n\t\tfunction onClick() {\n\t\t\tonChange( toggleFormat( value, { type: name, title } ) );\n\t\t\tonFocus();\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<RichTextShortcut\n\t\t\t\t\ttype=\"access\"\n\t\t\t\t\tcharacter=\"d\"\n\t\t\t\t\tonUse={ onClick }\n\t\t\t\t/>\n\t\t\t\t<RichTextToolbarButton\n\t\t\t\t\ticon={ formatStrikethrough }\n\t\t\t\t\ttitle={ title }\n\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\tisActive={ isActive }\n\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,uBAA6B;AAC7B,0BAGO;AACP,mBAAoC;AAiBjC;AAfH,IAAM,OAAO;AACb,IAAM,YAAQ,gBAAI,eAAgB;AAE3B,IAAM,gBAAgB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,WAAW;AAAA,EACX,KAAM,EAAE,UAAU,OAAO,UAAU,QAAQ,GAAI;AAC9C,aAAS,UAAU;AAClB,mBAAU,+BAAc,OAAO,EAAE,MAAM,MAAM,MAAM,CAAE,CAAE;AACvD,cAAQ;AAAA,IACT;AAEA,WACC,4EACC;AAAA;AAAA,QAAC;AAAA;AAAA,UACA,MAAK;AAAA,UACL,WAAU;AAAA,UACV,OAAQ;AAAA;AAAA,MACT;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACA,MAAO;AAAA,UACP;AAAA,UACA;AAAA,UACA;AAAA,UACA,MAAK;AAAA;AAAA,MACN;AAAA,OACD;AAAA,EAEF;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/subscript/index.js
CHANGED
|
@@ -15,19 +15,21 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// packages/format-library/src/subscript/index.js
|
|
18
20
|
var subscript_exports = {};
|
|
19
21
|
__export(subscript_exports, {
|
|
20
22
|
subscript: () => subscript
|
|
21
23
|
});
|
|
22
24
|
module.exports = __toCommonJS(subscript_exports);
|
|
23
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
24
25
|
var import_i18n = require("@wordpress/i18n");
|
|
25
26
|
var import_rich_text = require("@wordpress/rich-text");
|
|
26
27
|
var import_block_editor = require("@wordpress/block-editor");
|
|
27
28
|
var import_icons = require("@wordpress/icons");
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
+
var name = "core/subscript";
|
|
31
|
+
var title = (0, import_i18n.__)("Subscript");
|
|
32
|
+
var subscript = {
|
|
31
33
|
name,
|
|
32
34
|
title,
|
|
33
35
|
tagName: "sub",
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/subscript/index.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { toggleFormat } from '@wordpress/rich-text';\nimport { RichTextToolbarButton } from '@wordpress/block-editor';\nimport { subscript as subscriptIcon } from '@wordpress/icons';\n\nconst name = 'core/subscript';\nconst title = __( 'Subscript' );\n\nexport const subscript = {\n\tname,\n\ttitle,\n\ttagName: 'sub',\n\tclassName: null,\n\tedit( { isActive, value, onChange, onFocus } ) {\n\t\tfunction onToggle() {\n\t\t\tonChange( toggleFormat( value, { type: name, title } ) );\n\t\t}\n\n\t\tfunction onClick() {\n\t\t\tonToggle();\n\t\t\tonFocus();\n\t\t}\n\n\t\treturn (\n\t\t\t<RichTextToolbarButton\n\t\t\t\ticon={ subscriptIcon }\n\t\t\t\ttitle={ title }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tisActive={ isActive }\n\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t/>\n\t\t);\n\t},\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,uBAA6B;AAC7B,0BAAsC;AACtC,mBAA2C;AAqBxC;AAnBH,IAAM,OAAO;AACb,IAAM,YAAQ,gBAAI,WAAY;AAEvB,IAAM,YAAY;AAAA,EACxB;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,WAAW;AAAA,EACX,KAAM,EAAE,UAAU,OAAO,UAAU,QAAQ,GAAI;AAC9C,aAAS,WAAW;AACnB,mBAAU,+BAAc,OAAO,EAAE,MAAM,MAAM,MAAM,CAAE,CAAE;AAAA,IACxD;AAEA,aAAS,UAAU;AAClB,eAAS;AACT,cAAQ;AAAA,IACT;AAEA,WACC;AAAA,MAAC;AAAA;AAAA,QACA,MAAO,aAAAA;AAAA,QACP;AAAA,QACA;AAAA,QACA;AAAA,QACA,MAAK;AAAA;AAAA,IACN;AAAA,EAEF;AACD;",
|
|
6
6
|
"names": ["subscriptIcon"]
|
|
7
7
|
}
|
|
@@ -15,19 +15,21 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// packages/format-library/src/superscript/index.js
|
|
18
20
|
var superscript_exports = {};
|
|
19
21
|
__export(superscript_exports, {
|
|
20
22
|
superscript: () => superscript
|
|
21
23
|
});
|
|
22
24
|
module.exports = __toCommonJS(superscript_exports);
|
|
23
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
24
25
|
var import_i18n = require("@wordpress/i18n");
|
|
25
26
|
var import_rich_text = require("@wordpress/rich-text");
|
|
26
27
|
var import_block_editor = require("@wordpress/block-editor");
|
|
27
28
|
var import_icons = require("@wordpress/icons");
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
+
var name = "core/superscript";
|
|
31
|
+
var title = (0, import_i18n.__)("Superscript");
|
|
32
|
+
var superscript = {
|
|
31
33
|
name,
|
|
32
34
|
title,
|
|
33
35
|
tagName: "sup",
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/superscript/index.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { toggleFormat } from '@wordpress/rich-text';\nimport { RichTextToolbarButton } from '@wordpress/block-editor';\nimport { superscript as superscriptIcon } from '@wordpress/icons';\n\nconst name = 'core/superscript';\nconst title = __( 'Superscript' );\n\nexport const superscript = {\n\tname,\n\ttitle,\n\ttagName: 'sup',\n\tclassName: null,\n\tedit( { isActive, value, onChange, onFocus } ) {\n\t\tfunction onToggle() {\n\t\t\tonChange( toggleFormat( value, { type: name, title } ) );\n\t\t}\n\n\t\tfunction onClick() {\n\t\t\tonToggle();\n\t\t\tonFocus();\n\t\t}\n\n\t\treturn (\n\t\t\t<RichTextToolbarButton\n\t\t\t\ticon={ superscriptIcon }\n\t\t\t\ttitle={ title }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tisActive={ isActive }\n\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t/>\n\t\t);\n\t},\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,uBAA6B;AAC7B,0BAAsC;AACtC,mBAA+C;AAqB5C;AAnBH,IAAM,OAAO;AACb,IAAM,YAAQ,gBAAI,aAAc;AAEzB,IAAM,cAAc;AAAA,EAC1B;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,WAAW;AAAA,EACX,KAAM,EAAE,UAAU,OAAO,UAAU,QAAQ,GAAI;AAC9C,aAAS,WAAW;AACnB,mBAAU,+BAAc,OAAO,EAAE,MAAM,MAAM,MAAM,CAAE,CAAE;AAAA,IACxD;AAEA,aAAS,UAAU;AAClB,eAAS;AACT,cAAQ;AAAA,IACT;AAEA,WACC;AAAA,MAAC;AAAA;AAAA,QACA,MAAO,aAAAA;AAAA,QACP;AAAA,QACA;AAAA,QACA;AAAA,QACA,MAAK;AAAA;AAAA,IACN;AAAA,EAEF;AACD;",
|
|
6
6
|
"names": ["superscriptIcon"]
|
|
7
7
|
}
|
|
@@ -25,23 +25,25 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
mod
|
|
26
26
|
));
|
|
27
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// packages/format-library/src/text-color/index.js
|
|
28
30
|
var text_color_exports = {};
|
|
29
31
|
__export(text_color_exports, {
|
|
30
32
|
textColor: () => textColor,
|
|
31
33
|
transparentValue: () => transparentValue
|
|
32
34
|
});
|
|
33
35
|
module.exports = __toCommonJS(text_color_exports);
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
36
|
var import_i18n = require("@wordpress/i18n");
|
|
36
37
|
var import_element = require("@wordpress/element");
|
|
37
38
|
var import_block_editor = require("@wordpress/block-editor");
|
|
38
39
|
var import_icons = require("@wordpress/icons");
|
|
39
40
|
var import_rich_text = require("@wordpress/rich-text");
|
|
40
41
|
var import_inline = __toESM(require("./inline"));
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
|
+
var transparentValue = "rgba(0, 0, 0, 0)";
|
|
44
|
+
var name = "core/text-color";
|
|
45
|
+
var title = (0, import_i18n.__)("Highlight");
|
|
46
|
+
var EMPTY_ARRAY = [];
|
|
45
47
|
function getComputedStyleProperty(element, property) {
|
|
46
48
|
const { ownerDocument } = element;
|
|
47
49
|
const { defaultView } = ownerDocument;
|
|
@@ -116,7 +118,7 @@ function TextColorEdit({
|
|
|
116
118
|
)
|
|
117
119
|
] });
|
|
118
120
|
}
|
|
119
|
-
|
|
121
|
+
var textColor = {
|
|
120
122
|
name,
|
|
121
123
|
title,
|
|
122
124
|
tagName: "mark",
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/text-color/index.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport { RichTextToolbarButton, useSettings } from '@wordpress/block-editor';\nimport {\n\tIcon,\n\tcolor as colorIcon,\n\ttextColor as textColorIcon,\n} from '@wordpress/icons';\nimport { removeFormat } from '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport { default as InlineColorUI, getActiveColors } from './inline';\n\nexport const transparentValue = 'rgba(0, 0, 0, 0)';\n\nconst name = 'core/text-color';\nconst title = __( 'Highlight' );\n\nconst EMPTY_ARRAY = [];\n\nfunction getComputedStyleProperty( element, property ) {\n\tconst { ownerDocument } = element;\n\tconst { defaultView } = ownerDocument;\n\tconst style = defaultView.getComputedStyle( element );\n\tconst value = style.getPropertyValue( property );\n\n\tif (\n\t\tproperty === 'background-color' &&\n\t\tvalue === transparentValue &&\n\t\telement.parentElement\n\t) {\n\t\treturn getComputedStyleProperty( element.parentElement, property );\n\t}\n\n\treturn value;\n}\n\nfunction fillComputedColors( element, { color, backgroundColor } ) {\n\tif ( ! color && ! backgroundColor ) {\n\t\treturn;\n\t}\n\n\treturn {\n\t\tcolor: color || getComputedStyleProperty( element, 'color' ),\n\t\tbackgroundColor:\n\t\t\tbackgroundColor === transparentValue\n\t\t\t\t? getComputedStyleProperty( element, 'background-color' )\n\t\t\t\t: backgroundColor,\n\t};\n}\n\nfunction TextColorEdit( {\n\tvalue,\n\tonChange,\n\tisActive,\n\tactiveAttributes,\n\tcontentRef,\n} ) {\n\tconst [ allowCustomControl, colors = EMPTY_ARRAY ] = useSettings(\n\t\t'color.custom',\n\t\t'color.palette'\n\t);\n\tconst [ isAddingColor, setIsAddingColor ] = useState( false );\n\tconst colorIndicatorStyle = useMemo(\n\t\t() =>\n\t\t\tfillComputedColors(\n\t\t\t\tcontentRef.current,\n\t\t\t\tgetActiveColors( value, name, colors )\n\t\t\t),\n\t\t[ contentRef, value, colors ]\n\t);\n\n\tconst hasColorsToChoose = !! colors.length || allowCustomControl;\n\tif ( ! hasColorsToChoose && ! isActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<RichTextToolbarButton\n\t\t\t\tclassName=\"format-library-text-color-button\"\n\t\t\t\tisActive={ isActive }\n\t\t\t\ticon={\n\t\t\t\t\t<Icon\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\tObject.keys( activeAttributes ).length\n\t\t\t\t\t\t\t\t? textColorIcon\n\t\t\t\t\t\t\t\t: colorIcon\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstyle={ colorIndicatorStyle }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\ttitle={ title }\n\t\t\t\t// If has no colors to choose but a color is active remove the color onClick.\n\t\t\t\tonClick={\n\t\t\t\t\thasColorsToChoose\n\t\t\t\t\t\t? () => setIsAddingColor( true )\n\t\t\t\t\t\t: () => onChange( removeFormat( value, name ) )\n\t\t\t\t}\n\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t/>\n\t\t\t{ isAddingColor && (\n\t\t\t\t<InlineColorUI\n\t\t\t\t\tname={ name }\n\t\t\t\t\tonClose={ () => setIsAddingColor( false ) }\n\t\t\t\t\tactiveAttributes={ activeAttributes }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\tisActive={ isActive }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport const textColor = {\n\tname,\n\ttitle,\n\ttagName: 'mark',\n\tclassName: 'has-inline-color',\n\tattributes: {\n\t\tstyle: 'style',\n\t\tclass: 'class',\n\t},\n\tedit: TextColorEdit,\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,qBAAkC;AAClC,0BAAmD;AACnD,mBAIO;AACP,uBAA6B;AAK7B,oBAA0D;AAmExD;AAjEK,IAAM,mBAAmB;AAEhC,IAAM,OAAO;AACb,IAAM,YAAQ,gBAAI,WAAY;AAE9B,IAAM,cAAc,CAAC;AAErB,SAAS,yBAA0B,SAAS,UAAW;AACtD,QAAM,EAAE,cAAc,IAAI;AAC1B,QAAM,EAAE,YAAY,IAAI;AACxB,QAAM,QAAQ,YAAY,iBAAkB,OAAQ;AACpD,QAAM,QAAQ,MAAM,iBAAkB,QAAS;AAE/C,MACC,aAAa,sBACb,UAAU,oBACV,QAAQ,eACP;AACD,WAAO,yBAA0B,QAAQ,eAAe,QAAS;AAAA,EAClE;AAEA,SAAO;AACR;AAEA,SAAS,mBAAoB,SAAS,EAAE,OAAO,gBAAgB,GAAI;AAClE,MAAK,CAAE,SAAS,CAAE,iBAAkB;AACnC;AAAA,EACD;AAEA,SAAO;AAAA,IACN,OAAO,SAAS,yBAA0B,SAAS,OAAQ;AAAA,IAC3D,iBACC,oBAAoB,mBACjB,yBAA0B,SAAS,kBAAmB,IACtD;AAAA,EACL;AACD;AAEA,SAAS,cAAe;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,CAAE,oBAAoB,SAAS,WAAY,QAAI;AAAA,IACpD;AAAA,IACA;AAAA,EACD;AACA,QAAM,CAAE,eAAe,gBAAiB,QAAI,yBAAU,KAAM;AAC5D,QAAM,0BAAsB;AAAA,IAC3B,MACC;AAAA,MACC,WAAW;AAAA,UACX,+BAAiB,OAAO,MAAM,MAAO;AAAA,IACtC;AAAA,IACD,CAAE,YAAY,OAAO,MAAO;AAAA,EAC7B;AAEA,QAAM,oBAAoB,CAAC,CAAE,OAAO,UAAU;AAC9C,MAAK,CAAE,qBAAqB,CAAE,UAAW;AACxC,WAAO;AAAA,EACR;AAEA,SACC,4EACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV;AAAA,QACA,MACC;AAAA,UAAC;AAAA;AAAA,YACA,MACC,OAAO,KAAM,gBAAiB,EAAE,SAC7B,aAAAA,YACA,aAAAC;AAAA,YAEJ,OAAQ;AAAA;AAAA,QACT;AAAA,QAED;AAAA,QAEA,SACC,oBACG,MAAM,iBAAkB,IAAK,IAC7B,MAAM,aAAU,+BAAc,OAAO,IAAK,CAAE;AAAA,QAEhD,MAAK;AAAA;AAAA,IACN;AAAA,IACE,iBACD;AAAA,MAAC,cAAAC;AAAA,MAAA;AAAA,QACA;AAAA,QACA,SAAU,MAAM,iBAAkB,KAAM;AAAA,QACxC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;AAEO,IAAM,YAAY;AAAA,EACxB;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,WAAW;AAAA,EACX,YAAY;AAAA,IACX,OAAO;AAAA,IACP,OAAO;AAAA,EACR;AAAA,EACA,MAAM;AACP;",
|
|
6
6
|
"names": ["textColorIcon", "colorIcon", "InlineColorUI"]
|
|
7
7
|
}
|
|
@@ -15,6 +15,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// packages/format-library/src/text-color/inline.js
|
|
18
20
|
var inline_exports = {};
|
|
19
21
|
__export(inline_exports, {
|
|
20
22
|
default: () => InlineColorUI,
|
|
@@ -22,7 +24,6 @@ __export(inline_exports, {
|
|
|
22
24
|
parseClassName: () => parseClassName
|
|
23
25
|
});
|
|
24
26
|
module.exports = __toCommonJS(inline_exports);
|
|
25
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
27
|
var import_element = require("@wordpress/element");
|
|
27
28
|
var import_data = require("@wordpress/data");
|
|
28
29
|
var import_rich_text = require("@wordpress/rich-text");
|
|
@@ -31,8 +32,9 @@ var import_components = require("@wordpress/components");
|
|
|
31
32
|
var import_i18n = require("@wordpress/i18n");
|
|
32
33
|
var import_index = require("./index");
|
|
33
34
|
var import_lock_unlock = require("../lock-unlock");
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var { Tabs } = (0, import_lock_unlock.unlock)(import_components.privateApis);
|
|
37
|
+
var TABS = [
|
|
36
38
|
{ name: "color", title: (0, import_i18n.__)("Text") },
|
|
37
39
|
{ name: "backgroundColor", title: (0, import_i18n.__)("Background") }
|
|
38
40
|
];
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/text-color/inline.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tapplyFormat,\n\tremoveFormat,\n\tgetActiveFormat,\n\tuseAnchor,\n} from '@wordpress/rich-text';\nimport {\n\tColorPalette,\n\tgetColorClassName,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tPopover,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { textColor as settings, transparentValue } from './index';\nimport { unlock } from '../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst TABS = [\n\t{ name: 'color', title: __( 'Text' ) },\n\t{ name: 'backgroundColor', title: __( 'Background' ) },\n];\n\nfunction parseCSS( css = '' ) {\n\treturn css.split( ';' ).reduce( ( accumulator, rule ) => {\n\t\tif ( rule ) {\n\t\t\tconst [ property, value ] = rule.split( ':' );\n\t\t\tif ( property === 'color' ) {\n\t\t\t\taccumulator.color = value;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tproperty === 'background-color' &&\n\t\t\t\tvalue !== transparentValue\n\t\t\t) {\n\t\t\t\taccumulator.backgroundColor = value;\n\t\t\t}\n\t\t}\n\t\treturn accumulator;\n\t}, {} );\n}\n\nexport function parseClassName( className = '', colorSettings ) {\n\treturn className.split( ' ' ).reduce( ( accumulator, name ) => {\n\t\t// `colorSlug` could contain dashes, so simply match the start and end.\n\t\tif ( name.startsWith( 'has-' ) && name.endsWith( '-color' ) ) {\n\t\t\tconst colorSlug = name\n\t\t\t\t.replace( /^has-/, '' )\n\t\t\t\t.replace( /-color$/, '' );\n\t\t\tconst colorObject = getColorObjectByAttributeValues(\n\t\t\t\tcolorSettings,\n\t\t\t\tcolorSlug\n\t\t\t);\n\t\t\taccumulator.color = colorObject.color;\n\t\t}\n\t\treturn accumulator;\n\t}, {} );\n}\n\nexport function getActiveColors( value, name, colorSettings ) {\n\tconst activeColorFormat = getActiveFormat( value, name );\n\n\tif ( ! activeColorFormat ) {\n\t\treturn {};\n\t}\n\n\treturn {\n\t\t...parseCSS( activeColorFormat.attributes.style ),\n\t\t...parseClassName( activeColorFormat.attributes.class, colorSettings ),\n\t};\n}\n\nfunction setColors( value, name, colorSettings, colors ) {\n\tconst { color, backgroundColor } = {\n\t\t...getActiveColors( value, name, colorSettings ),\n\t\t...colors,\n\t};\n\n\tif ( ! color && ! backgroundColor ) {\n\t\treturn removeFormat( value, name );\n\t}\n\n\tconst styles = [];\n\tconst classNames = [];\n\tconst attributes = {};\n\n\tif ( backgroundColor ) {\n\t\tstyles.push( [ 'background-color', backgroundColor ].join( ':' ) );\n\t} else {\n\t\t// Override default browser color for mark element.\n\t\tstyles.push( [ 'background-color', transparentValue ].join( ':' ) );\n\t}\n\n\tif ( color ) {\n\t\tconst colorObject = getColorObjectByColorValue( colorSettings, color );\n\n\t\tif ( colorObject ) {\n\t\t\tclassNames.push( getColorClassName( 'color', colorObject.slug ) );\n\t\t} else {\n\t\t\tstyles.push( [ 'color', color ].join( ':' ) );\n\t\t}\n\t}\n\n\tif ( styles.length ) {\n\t\tattributes.style = styles.join( ';' );\n\t}\n\tif ( classNames.length ) {\n\t\tattributes.class = classNames.join( ' ' );\n\t}\n\n\treturn applyFormat( value, { type: name, attributes } );\n}\n\nfunction ColorPicker( { name, property, value, onChange } ) {\n\tconst colors = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().colors ?? [];\n\t}, [] );\n\tconst activeColors = useMemo(\n\t\t() => getActiveColors( value, name, colors ),\n\t\t[ name, value, colors ]\n\t);\n\n\treturn (\n\t\t<ColorPalette\n\t\t\tvalue={ activeColors[ property ] }\n\t\t\tonChange={ ( color ) => {\n\t\t\t\tonChange(\n\t\t\t\t\tsetColors( value, name, colors, { [ property ]: color } )\n\t\t\t\t);\n\t\t\t} }\n\t\t\tenableAlpha\n\t\t\t// Prevent the text and color picker from overlapping.\n\t\t\t__experimentalIsRenderedInSidebar\n\t\t/>\n\t);\n}\n\nexport default function InlineColorUI( {\n\tname,\n\tvalue,\n\tonChange,\n\tonClose,\n\tcontentRef,\n\tisActive,\n} ) {\n\tconst popoverAnchor = useAnchor( {\n\t\teditableContentElement: contentRef.current,\n\t\tsettings: { ...settings, isActive },\n\t} );\n\n\treturn (\n\t\t<Popover\n\t\t\tonClose={ onClose }\n\t\t\tclassName=\"format-library__inline-color-popover\"\n\t\t\tanchor={ popoverAnchor }\n\t\t>\n\t\t\t<Tabs>\n\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t{ TABS.map( ( tab ) => (\n\t\t\t\t\t\t<Tabs.Tab tabId={ tab.name } key={ tab.name }>\n\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t) ) }\n\t\t\t\t</Tabs.TabList>\n\t\t\t\t{ TABS.map( ( tab ) => (\n\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\ttabId={ tab.name }\n\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\tproperty={ tab.name }\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t) ) }\n\t\t\t</Tabs>\n\t\t</Popover>\n\t);\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAwB;AACxB,kBAA0B;AAC1B,uBAKO;AACP,0BAMO;AACP,wBAGO;AACP,kBAAmB;AAKnB,mBAAwD;AACxD,yBAAuB;AA6GrB;AA3GF,IAAM,EAAE,KAAK,QAAI,2BAAQ,kBAAAA,WAAsB;AAE/C,IAAM,OAAO;AAAA,EACZ,EAAE,MAAM,SAAS,WAAO,gBAAI,MAAO,EAAE;AAAA,EACrC,EAAE,MAAM,mBAAmB,WAAO,gBAAI,YAAa,EAAE;AACtD;AAEA,SAAS,SAAU,MAAM,IAAK;AAC7B,SAAO,IAAI,MAAO,GAAI,EAAE,OAAQ,CAAE,aAAa,SAAU;AACxD,QAAK,MAAO;AACX,YAAM,CAAE,UAAU,KAAM,IAAI,KAAK,MAAO,GAAI;AAC5C,UAAK,aAAa,SAAU;AAC3B,oBAAY,QAAQ;AAAA,MACrB;AACA,UACC,aAAa,sBACb,UAAU,+BACT;AACD,oBAAY,kBAAkB;AAAA,MAC/B;AAAA,IACD;AACA,WAAO;AAAA,EACR,GAAG,CAAC,CAAE;AACP;AAEO,SAAS,eAAgB,YAAY,IAAI,eAAgB;AAC/D,SAAO,UAAU,MAAO,GAAI,EAAE,OAAQ,CAAE,aAAa,SAAU;AAE9D,QAAK,KAAK,WAAY,MAAO,KAAK,KAAK,SAAU,QAAS,GAAI;AAC7D,YAAM,YAAY,KAChB,QAAS,SAAS,EAAG,EACrB,QAAS,WAAW,EAAG;AACzB,YAAM,kBAAc;AAAA,QACnB;AAAA,QACA;AAAA,MACD;AACA,kBAAY,QAAQ,YAAY;AAAA,IACjC;AACA,WAAO;AAAA,EACR,GAAG,CAAC,CAAE;AACP;AAEO,SAAS,gBAAiB,OAAO,MAAM,eAAgB;AAC7D,QAAM,wBAAoB,kCAAiB,OAAO,IAAK;AAEvD,MAAK,CAAE,mBAAoB;AAC1B,WAAO,CAAC;AAAA,EACT;AAEA,SAAO;AAAA,IACN,GAAG,SAAU,kBAAkB,WAAW,KAAM;AAAA,IAChD,GAAG,eAAgB,kBAAkB,WAAW,OAAO,aAAc;AAAA,EACtE;AACD;AAEA,SAAS,UAAW,OAAO,MAAM,eAAe,QAAS;AACxD,QAAM,EAAE,OAAO,gBAAgB,IAAI;AAAA,IAClC,GAAG,gBAAiB,OAAO,MAAM,aAAc;AAAA,IAC/C,GAAG;AAAA,EACJ;AAEA,MAAK,CAAE,SAAS,CAAE,iBAAkB;AACnC,eAAO,+BAAc,OAAO,IAAK;AAAA,EAClC;AAEA,QAAM,SAAS,CAAC;AAChB,QAAM,aAAa,CAAC;AACpB,QAAM,aAAa,CAAC;AAEpB,MAAK,iBAAkB;AACtB,WAAO,KAAM,CAAE,oBAAoB,eAAgB,EAAE,KAAM,GAAI,CAAE;AAAA,EAClE,OAAO;AAEN,WAAO,KAAM,CAAE,oBAAoB,6BAAiB,EAAE,KAAM,GAAI,CAAE;AAAA,EACnE;AAEA,MAAK,OAAQ;AACZ,UAAM,kBAAc,gDAA4B,eAAe,KAAM;AAErE,QAAK,aAAc;AAClB,iBAAW,SAAM,uCAAmB,SAAS,YAAY,IAAK,CAAE;AAAA,IACjE,OAAO;AACN,aAAO,KAAM,CAAE,SAAS,KAAM,EAAE,KAAM,GAAI,CAAE;AAAA,IAC7C;AAAA,EACD;AAEA,MAAK,OAAO,QAAS;AACpB,eAAW,QAAQ,OAAO,KAAM,GAAI;AAAA,EACrC;AACA,MAAK,WAAW,QAAS;AACxB,eAAW,QAAQ,WAAW,KAAM,GAAI;AAAA,EACzC;AAEA,aAAO,8BAAa,OAAO,EAAE,MAAM,MAAM,WAAW,CAAE;AACvD;AAEA,SAAS,YAAa,EAAE,MAAM,UAAU,OAAO,SAAS,GAAI;AAC3D,QAAM,aAAS,uBAAW,CAAE,WAAY;AACvC,UAAM,EAAE,YAAY,IAAI,OAAQ,oBAAAC,KAAiB;AACjD,WAAO,YAAY,EAAE,UAAU,CAAC;AAAA,EACjC,GAAG,CAAC,CAAE;AACN,QAAM,mBAAe;AAAA,IACpB,MAAM,gBAAiB,OAAO,MAAM,MAAO;AAAA,IAC3C,CAAE,MAAM,OAAO,MAAO;AAAA,EACvB;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ,aAAc,QAAS;AAAA,MAC/B,UAAW,CAAE,UAAW;AACvB;AAAA,UACC,UAAW,OAAO,MAAM,QAAQ,EAAE,CAAE,QAAS,GAAG,MAAM,CAAE;AAAA,QACzD;AAAA,MACD;AAAA,MACA,aAAW;AAAA,MAEX,mCAAiC;AAAA;AAAA,EAClC;AAEF;AAEe,SAAR,cAAgC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,oBAAgB,4BAAW;AAAA,IAChC,wBAAwB,WAAW;AAAA,IACnC,UAAU,EAAE,GAAG,aAAAC,WAAU,SAAS;AAAA,EACnC,CAAE;AAEF,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,WAAU;AAAA,MACV,QAAS;AAAA,MAET,uDAAC,QACA;AAAA,oDAAC,KAAK,SAAL,EACE,eAAK,IAAK,CAAE,QACb,4CAAC,KAAK,KAAL,EAAS,OAAQ,IAAI,MACnB,cAAI,SAD4B,IAAI,IAEvC,CACC,GACH;AAAA,QACE,KAAK,IAAK,CAAE,QACb;AAAA,UAAC,KAAK;AAAA,UAAL;AAAA,YACA,OAAQ,IAAI;AAAA,YACZ,WAAY;AAAA,YAGZ;AAAA,cAAC;AAAA;AAAA,gBACA;AAAA,gBACA,UAAW,IAAI;AAAA,gBACf;AAAA,gBACA;AAAA;AAAA,YACD;AAAA;AAAA,UAPM,IAAI;AAAA,QAQX,CACC;AAAA,SACH;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": ["componentsPrivateApis", "blockEditorStore", "settings"]
|
|
7
7
|
}
|
package/build/underline/index.js
CHANGED
|
@@ -15,18 +15,20 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// packages/format-library/src/underline/index.js
|
|
18
20
|
var underline_exports = {};
|
|
19
21
|
__export(underline_exports, {
|
|
20
22
|
underline: () => underline
|
|
21
23
|
});
|
|
22
24
|
module.exports = __toCommonJS(underline_exports);
|
|
23
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
24
25
|
var import_i18n = require("@wordpress/i18n");
|
|
25
26
|
var import_rich_text = require("@wordpress/rich-text");
|
|
26
27
|
var import_block_editor = require("@wordpress/block-editor");
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
+
var name = "core/underline";
|
|
30
|
+
var title = (0, import_i18n.__)("Underline");
|
|
31
|
+
var underline = {
|
|
30
32
|
name,
|
|
31
33
|
title,
|
|
32
34
|
tagName: "span",
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/underline/index.js"],
|
|
4
4
|
"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"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,uBAA6B;AAC7B,0BAGO;AA2BJ;AAzBH,IAAM,OAAO;AACb,IAAM,YAAQ,gBAAI,WAAY;AAEvB,IAAM,YAAY;AAAA,EACxB;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,WAAW;AAAA,EACX,YAAY;AAAA,IACX,OAAO;AAAA,EACR;AAAA,EACA,KAAM,EAAE,OAAO,SAAS,GAAI;AAC3B,UAAM,WAAW,MAAM;AACtB;AAAA,YACC,+BAAc,OAAO;AAAA,UACpB,MAAM;AAAA,UACN,YAAY;AAAA,YACX,OAAO;AAAA,UACR;AAAA,UACA;AAAA,QACD,CAAE;AAAA,MACH;AAAA,IACD;AAEA,WACC,4EACC;AAAA;AAAA,QAAC;AAAA;AAAA,UACA,MAAK;AAAA,UACL,WAAU;AAAA,UACV,OAAQ;AAAA;AAAA,MACT;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACA,WAAU;AAAA,UACV,SAAU;AAAA;AAAA,MACX;AAAA,OACD;AAAA,EAEF;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/unknown/index.js
CHANGED
|
@@ -15,18 +15,20 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// packages/format-library/src/unknown/index.js
|
|
18
20
|
var unknown_exports = {};
|
|
19
21
|
__export(unknown_exports, {
|
|
20
22
|
unknown: () => unknown
|
|
21
23
|
});
|
|
22
24
|
module.exports = __toCommonJS(unknown_exports);
|
|
23
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
24
25
|
var import_i18n = require("@wordpress/i18n");
|
|
25
26
|
var import_rich_text = require("@wordpress/rich-text");
|
|
26
27
|
var import_block_editor = require("@wordpress/block-editor");
|
|
27
28
|
var import_icons = require("@wordpress/icons");
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
+
var name = "core/unknown";
|
|
31
|
+
var title = (0, import_i18n.__)("Clear Unknown Formatting");
|
|
30
32
|
function selectionContainsUnknownFormats(value) {
|
|
31
33
|
if ((0, import_rich_text.isCollapsed)(value)) {
|
|
32
34
|
return false;
|
|
@@ -36,7 +38,7 @@ function selectionContainsUnknownFormats(value) {
|
|
|
36
38
|
return formats.some((format) => format.type === name);
|
|
37
39
|
});
|
|
38
40
|
}
|
|
39
|
-
|
|
41
|
+
var unknown = {
|
|
40
42
|
name,
|
|
41
43
|
title,
|
|
42
44
|
tagName: "*",
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/unknown/index.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { removeFormat, slice, isCollapsed } from '@wordpress/rich-text';\nimport { RichTextToolbarButton } from '@wordpress/block-editor';\nimport { help } from '@wordpress/icons';\n\nconst name = 'core/unknown';\nconst title = __( 'Clear Unknown Formatting' );\n\nfunction selectionContainsUnknownFormats( value ) {\n\tif ( isCollapsed( value ) ) {\n\t\treturn false;\n\t}\n\n\tconst selectedValue = slice( value );\n\treturn selectedValue.formats.some( ( formats ) => {\n\t\treturn formats.some( ( format ) => format.type === name );\n\t} );\n}\n\nexport const unknown = {\n\tname,\n\ttitle,\n\ttagName: '*',\n\tclassName: null,\n\tedit( { isActive, value, onChange, onFocus } ) {\n\t\tif ( ! isActive && ! selectionContainsUnknownFormats( value ) ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tfunction onClick() {\n\t\t\tonChange( removeFormat( value, name ) );\n\t\t\tonFocus();\n\t\t}\n\n\t\treturn (\n\t\t\t<RichTextToolbarButton\n\t\t\t\tname=\"unknown\"\n\t\t\t\ticon={ help }\n\t\t\t\ttitle={ title }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tisActive\n\t\t\t/>\n\t\t);\n\t},\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,uBAAiD;AACjD,0BAAsC;AACtC,mBAAqB;AAgClB;AA9BH,IAAM,OAAO;AACb,IAAM,YAAQ,gBAAI,0BAA2B;AAE7C,SAAS,gCAAiC,OAAQ;AACjD,UAAK,8BAAa,KAAM,GAAI;AAC3B,WAAO;AAAA,EACR;AAEA,QAAM,oBAAgB,wBAAO,KAAM;AACnC,SAAO,cAAc,QAAQ,KAAM,CAAE,YAAa;AACjD,WAAO,QAAQ,KAAM,CAAE,WAAY,OAAO,SAAS,IAAK;AAAA,EACzD,CAAE;AACH;AAEO,IAAM,UAAU;AAAA,EACtB;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,WAAW;AAAA,EACX,KAAM,EAAE,UAAU,OAAO,UAAU,QAAQ,GAAI;AAC9C,QAAK,CAAE,YAAY,CAAE,gCAAiC,KAAM,GAAI;AAC/D,aAAO;AAAA,IACR;AAEA,aAAS,UAAU;AAClB,mBAAU,+BAAc,OAAO,IAAK,CAAE;AACtC,cAAQ;AAAA,IACT;AAEA,WACC;AAAA,MAAC;AAAA;AAAA,QACA,MAAK;AAAA,QACL,MAAO;AAAA,QACP;AAAA,QACA;AAAA,QACA,UAAQ;AAAA;AAAA,IACT;AAAA,EAEF;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/format-library/src/bold/index.js
|
|
2
2
|
import { __ } from "@wordpress/i18n";
|
|
3
3
|
import { toggleFormat } from "@wordpress/rich-text";
|
|
4
4
|
import {
|
|
@@ -9,10 +9,11 @@ import {
|
|
|
9
9
|
} from "@wordpress/block-editor";
|
|
10
10
|
import { formatBold } from "@wordpress/icons";
|
|
11
11
|
import { unlock } from "../lock-unlock";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
var { essentialFormatKey } = unlock(blockEditorPrivateApis);
|
|
14
|
+
var name = "core/bold";
|
|
15
|
+
var title = __("Bold");
|
|
16
|
+
var bold = {
|
|
16
17
|
name,
|
|
17
18
|
title,
|
|
18
19
|
tagName: "strong",
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/bold/index.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { toggleFormat } from '@wordpress/rich-text';\nimport {\n\tRichTextToolbarButton,\n\tRichTextShortcut,\n\t__unstableRichTextInputEvent,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { formatBold } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\nconst { essentialFormatKey } = unlock( blockEditorPrivateApis );\n\nconst name = 'core/bold';\nconst title = __( 'Bold' );\n\nexport const bold = {\n\tname,\n\ttitle,\n\ttagName: 'strong',\n\tclassName: null,\n\t[ essentialFormatKey ]: true,\n\tedit( { isActive, value, onChange, onFocus } ) {\n\t\tfunction onToggle() {\n\t\t\tonChange( toggleFormat( value, { type: name, title } ) );\n\t\t}\n\n\t\tfunction onClick() {\n\t\t\tonChange( toggleFormat( value, { type: name } ) );\n\t\t\tonFocus();\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=\"b\"\n\t\t\t\t\tonUse={ onToggle }\n\t\t\t\t/>\n\t\t\t\t<RichTextToolbarButton\n\t\t\t\t\tname=\"bold\"\n\t\t\t\t\ticon={ formatBold }\n\t\t\t\t\ttitle={ title }\n\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\tisActive={ isActive }\n\t\t\t\t\tshortcutType=\"primary\"\n\t\t\t\t\tshortcutCharacter=\"b\"\n\t\t\t\t/>\n\t\t\t\t<__unstableRichTextInputEvent\n\t\t\t\t\tinputType=\"formatBold\"\n\t\t\t\t\tonInput={ onToggle }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,oBAAoB;AAC7B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,OACT;AACP,SAAS,kBAAkB;AAK3B,SAAS,cAAc;AAwBpB,mBACC,KADD;AAtBH,IAAM,EAAE,mBAAmB,IAAI,OAAQ,sBAAuB;AAE9D,IAAM,OAAO;AACb,IAAM,QAAQ,GAAI,MAAO;AAElB,IAAM,OAAO;AAAA,EACnB;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,WAAW;AAAA,EACX,CAAE,kBAAmB,GAAG;AAAA,EACxB,KAAM,EAAE,UAAU,OAAO,UAAU,QAAQ,GAAI;AAC9C,aAAS,WAAW;AACnB,eAAU,aAAc,OAAO,EAAE,MAAM,MAAM,MAAM,CAAE,CAAE;AAAA,IACxD;AAEA,aAAS,UAAU;AAClB,eAAU,aAAc,OAAO,EAAE,MAAM,KAAK,CAAE,CAAE;AAChD,cAAQ;AAAA,IACT;AAEA,WACC,iCACC;AAAA;AAAA,QAAC;AAAA;AAAA,UACA,MAAK;AAAA,UACL,WAAU;AAAA,UACV,OAAQ;AAAA;AAAA,MACT;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACA,MAAK;AAAA,UACL,MAAO;AAAA,UACP;AAAA,UACA;AAAA,UACA;AAAA,UACA,cAAa;AAAA,UACb,mBAAkB;AAAA;AAAA,MACnB;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACA,WAAU;AAAA,UACV,SAAU;AAAA;AAAA,MACX;AAAA,OACD;AAAA,EAEF;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|