@wordpress/format-library 3.0.17 → 3.0.18-next.33ec3857e2.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/build/default-formats.native.js +3 -1
- package/build/default-formats.native.js.map +1 -1
- package/build/text-color/index.native.js +190 -0
- package/build/text-color/index.native.js.map +1 -0
- package/build/text-color/inline.js +1 -0
- package/build/text-color/inline.js.map +1 -1
- package/build/text-color/inline.native.js +169 -0
- package/build/text-color/inline.native.js.map +1 -0
- package/build-module/default-formats.native.js +2 -1
- package/build-module/default-formats.native.js.map +1 -1
- package/build-module/text-color/index.native.js +171 -0
- package/build-module/text-color/index.native.js.map +1 -0
- package/build-module/text-color/inline.js +1 -2
- package/build-module/text-color/inline.js.map +1 -1
- package/build-module/text-color/inline.native.js +156 -0
- package/build-module/text-color/inline.native.js.map +1 -0
- package/package.json +15 -15
- package/src/default-formats.native.js +2 -1
- package/src/text-color/index.native.js +191 -0
- package/src/text-color/inline.js +1 -1
- package/src/text-color/inline.native.js +163 -0
- package/src/text-color/style.native.scss +23 -0
|
@@ -13,9 +13,11 @@ var _link = require("./link");
|
|
|
13
13
|
|
|
14
14
|
var _strikethrough = require("./strikethrough");
|
|
15
15
|
|
|
16
|
+
var _textColor = require("./text-color");
|
|
17
|
+
|
|
16
18
|
/**
|
|
17
19
|
* Internal dependencies
|
|
18
20
|
*/
|
|
19
|
-
var _default = [_bold.bold, _italic.italic, _link.link, _strikethrough.strikethrough];
|
|
21
|
+
var _default = [_bold.bold, _italic.italic, _link.link, _strikethrough.strikethrough, _textColor.textColor];
|
|
20
22
|
exports.default = _default;
|
|
21
23
|
//# sourceMappingURL=default-formats.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/format-library/src/default-formats.native.js"],"names":["bold","italic","link","strikethrough"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/format-library/src/default-formats.native.js"],"names":["bold","italic","link","strikethrough","textColor"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAPA;AACA;AACA;eAOe,CAAEA,UAAF,EAAQC,cAAR,EAAgBC,UAAhB,EAAsBC,4BAAtB,EAAqCC,oBAArC,C","sourcesContent":["/**\n * Internal dependencies\n */\nimport { bold } from './bold';\nimport { italic } from './italic';\nimport { link } from './link';\nimport { strikethrough } from './strikethrough';\nimport { textColor } from './text-color';\n\nexport default [ bold, italic, link, strikethrough, textColor ];\n"]}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.textColor = void 0;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _lodash = require("lodash");
|
|
13
|
+
|
|
14
|
+
var _reactNative = require("react-native");
|
|
15
|
+
|
|
16
|
+
var _i18n = require("@wordpress/i18n");
|
|
17
|
+
|
|
18
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
19
|
+
|
|
20
|
+
var _components = require("@wordpress/components");
|
|
21
|
+
|
|
22
|
+
var _icons = require("@wordpress/icons");
|
|
23
|
+
|
|
24
|
+
var _richText = require("@wordpress/rich-text");
|
|
25
|
+
|
|
26
|
+
var _compose = require("@wordpress/compose");
|
|
27
|
+
|
|
28
|
+
var _inline = require("./inline.js");
|
|
29
|
+
|
|
30
|
+
var _index = require("./index.js");
|
|
31
|
+
|
|
32
|
+
var _inline2 = _interopRequireDefault(require("./inline"));
|
|
33
|
+
|
|
34
|
+
var _style = _interopRequireDefault(require("./style.scss"));
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* External dependencies
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* WordPress dependencies
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Internal dependencies
|
|
46
|
+
*/
|
|
47
|
+
const name = 'core/text-color';
|
|
48
|
+
const title = (0, _i18n.__)('Text color');
|
|
49
|
+
const EMPTY_ARRAY = [];
|
|
50
|
+
|
|
51
|
+
function getComputedStyleProperty(element, property) {
|
|
52
|
+
const {
|
|
53
|
+
props: {
|
|
54
|
+
style = {}
|
|
55
|
+
}
|
|
56
|
+
} = element;
|
|
57
|
+
|
|
58
|
+
if (property === 'background-color') {
|
|
59
|
+
var _baseColors$color;
|
|
60
|
+
|
|
61
|
+
const {
|
|
62
|
+
backgroundColor,
|
|
63
|
+
baseColors
|
|
64
|
+
} = style;
|
|
65
|
+
|
|
66
|
+
if (backgroundColor !== 'transparent') {
|
|
67
|
+
return backgroundColor;
|
|
68
|
+
} else if (baseColors && baseColors !== null && baseColors !== void 0 && (_baseColors$color = baseColors.color) !== null && _baseColors$color !== void 0 && _baseColors$color.background) {
|
|
69
|
+
var _baseColors$color2;
|
|
70
|
+
|
|
71
|
+
return baseColors === null || baseColors === void 0 ? void 0 : (_baseColors$color2 = baseColors.color) === null || _baseColors$color2 === void 0 ? void 0 : _baseColors$color2.background;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return 'transparent';
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function fillComputedColors(element, _ref) {
|
|
79
|
+
let {
|
|
80
|
+
color,
|
|
81
|
+
backgroundColor
|
|
82
|
+
} = _ref;
|
|
83
|
+
|
|
84
|
+
if (!color && !backgroundColor) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return {
|
|
89
|
+
color: color || getComputedStyleProperty(element, 'color'),
|
|
90
|
+
backgroundColor: getComputedStyleProperty(element, 'background-color')
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function TextColorEdit(_ref2) {
|
|
95
|
+
let {
|
|
96
|
+
value,
|
|
97
|
+
onChange,
|
|
98
|
+
isActive,
|
|
99
|
+
activeAttributes,
|
|
100
|
+
contentRef
|
|
101
|
+
} = _ref2;
|
|
102
|
+
const allowCustomControl = (0, _blockEditor.useSetting)('color.custom');
|
|
103
|
+
const colors = (0, _blockEditor.useSetting)('color.palette') || EMPTY_ARRAY;
|
|
104
|
+
const [isAddingColor, setIsAddingColor] = (0, _element.useState)(false);
|
|
105
|
+
const enableIsAddingColor = (0, _element.useCallback)(() => setIsAddingColor(true), [setIsAddingColor]);
|
|
106
|
+
const disableIsAddingColor = (0, _element.useCallback)(() => setIsAddingColor(false), [setIsAddingColor]);
|
|
107
|
+
const colorIndicatorStyle = (0, _element.useMemo)(() => fillComputedColors(contentRef, (0, _inline.getActiveColors)(value, name, colors)), [value, colors]);
|
|
108
|
+
const hasColorsToChoose = !(0, _lodash.isEmpty)(colors) || !allowCustomControl;
|
|
109
|
+
const onPressButton = (0, _element.useCallback)(() => {
|
|
110
|
+
if (hasColorsToChoose) {
|
|
111
|
+
enableIsAddingColor();
|
|
112
|
+
} else {
|
|
113
|
+
onChange((0, _richText.removeFormat)(value, name));
|
|
114
|
+
}
|
|
115
|
+
}, [hasColorsToChoose, value]);
|
|
116
|
+
const outlineStyle = (0, _compose.usePreferredColorSchemeStyle)(_style.default['components-inline-color__outline'], _style.default['components-inline-color__outline--dark']);
|
|
117
|
+
|
|
118
|
+
if (!hasColorsToChoose && !isActive) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const isActiveStyle = { ...colorIndicatorStyle,
|
|
123
|
+
...(!(colorIndicatorStyle !== null && colorIndicatorStyle !== void 0 && colorIndicatorStyle.backgroundColor) ? {
|
|
124
|
+
backgroundColor: 'transparent'
|
|
125
|
+
} : {}),
|
|
126
|
+
..._style.default['components-inline-color--is-active']
|
|
127
|
+
};
|
|
128
|
+
const customContainerStyles = _style.default['components-inline-color__button-container'];
|
|
129
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_blockEditor.BlockControls, null, (0, _element.createElement)(_components.ToolbarGroup, null, isActive && (0, _element.createElement)(_reactNative.View, {
|
|
130
|
+
style: outlineStyle,
|
|
131
|
+
pointerEvents: "none"
|
|
132
|
+
}), (0, _element.createElement)(_components.ToolbarButton, {
|
|
133
|
+
name: "text-color",
|
|
134
|
+
isActive: isActive,
|
|
135
|
+
icon: (0, _element.createElement)(_icons.Icon, {
|
|
136
|
+
icon: _icons.textColor,
|
|
137
|
+
style: (colorIndicatorStyle === null || colorIndicatorStyle === void 0 ? void 0 : colorIndicatorStyle.color) && {
|
|
138
|
+
color: colorIndicatorStyle.color
|
|
139
|
+
}
|
|
140
|
+
}),
|
|
141
|
+
title: title,
|
|
142
|
+
extraProps: {
|
|
143
|
+
isActiveStyle,
|
|
144
|
+
customContainerStyles
|
|
145
|
+
} // If has no colors to choose but a color is active remove the color onClick
|
|
146
|
+
,
|
|
147
|
+
onClick: onPressButton
|
|
148
|
+
}))), isAddingColor && (0, _element.createElement)(_inline2.default, {
|
|
149
|
+
name: name,
|
|
150
|
+
onClose: disableIsAddingColor,
|
|
151
|
+
activeAttributes: activeAttributes,
|
|
152
|
+
value: value,
|
|
153
|
+
onChange: onChange,
|
|
154
|
+
contentRef: contentRef
|
|
155
|
+
}));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const textColor = {
|
|
159
|
+
name,
|
|
160
|
+
title,
|
|
161
|
+
tagName: 'mark',
|
|
162
|
+
className: 'has-inline-color',
|
|
163
|
+
attributes: {
|
|
164
|
+
style: 'style',
|
|
165
|
+
class: 'class'
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
/*
|
|
169
|
+
* Since this format relies on the <mark> tag, it's important to
|
|
170
|
+
* prevent the default yellow background color applied by most
|
|
171
|
+
* browsers. The solution is to detect when this format is used with a
|
|
172
|
+
* text color but no background color, and in such cases to override
|
|
173
|
+
* the default styling with a transparent background.
|
|
174
|
+
*
|
|
175
|
+
* @see https://github.com/WordPress/gutenberg/pull/35516
|
|
176
|
+
*/
|
|
177
|
+
__unstableFilterAttributeValue(key, value) {
|
|
178
|
+
if (key !== 'style') return value; // We should not add a background-color if it's already set
|
|
179
|
+
|
|
180
|
+
if (value && value.includes('background-color')) return value;
|
|
181
|
+
const addedCSS = ['background-color', _index.transparentValue].join(':'); // Prepend `addedCSS` to avoid a double `;;` as any the existing CSS
|
|
182
|
+
// rules will already include a `;`.
|
|
183
|
+
|
|
184
|
+
return value ? [addedCSS, value].join(';') : addedCSS;
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
edit: TextColorEdit
|
|
188
|
+
};
|
|
189
|
+
exports.textColor = textColor;
|
|
190
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/format-library/src/text-color/index.native.js"],"names":["name","title","EMPTY_ARRAY","getComputedStyleProperty","element","property","props","style","backgroundColor","baseColors","color","background","fillComputedColors","TextColorEdit","value","onChange","isActive","activeAttributes","contentRef","allowCustomControl","colors","isAddingColor","setIsAddingColor","enableIsAddingColor","disableIsAddingColor","colorIndicatorStyle","hasColorsToChoose","onPressButton","outlineStyle","styles","isActiveStyle","customContainerStyles","textColorIcon","textColor","tagName","className","attributes","class","__unstableFilterAttributeValue","key","includes","addedCSS","transparentValue","join","edit"],"mappings":";;;;;;;;;AAUA;;AAPA;;AACA;;AAKA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAvBA;AACA;AACA;;AAIA;AACA;AACA;;AASA;AACA;AACA;AAMA,MAAMA,IAAI,GAAG,iBAAb;AACA,MAAMC,KAAK,GAAG,cAAI,YAAJ,CAAd;AAEA,MAAMC,WAAW,GAAG,EAApB;;AAEA,SAASC,wBAAT,CAAmCC,OAAnC,EAA4CC,QAA5C,EAAuD;AACtD,QAAM;AACLC,IAAAA,KAAK,EAAE;AA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,GAAG,CAAE,kBAAF,EAAsBC,uBAAtB,EAAyCC,IAAzC,CAA+C,GAA/C,CAAjB,CAJ4C,CAK5C;AACA;;AACA,WAAO7B,KAAK,GAAG,CAAE2B,QAAF,EAAY3B,KAAZ,EAAoB6B,IAApB,CAA0B,GAA1B,CAAH,GAAqCF,QAAjD;AACA,GA1BuB;;AA2BxBG,EAAAA,IAAI,EAAE/B;AA3BkB,CAAlB","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty } from 'lodash';\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback, useMemo, useState } from '@wordpress/element';\nimport { BlockControls, useSetting } from '@wordpress/block-editor';\nimport { ToolbarGroup, ToolbarButton } from '@wordpress/components';\nimport { Icon, textColor as textColorIcon } from '@wordpress/icons';\nimport { removeFormat } from '@wordpress/rich-text';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { getActiveColors } from './inline.js';\nimport { transparentValue } from './index.js';\nimport { default as InlineColorUI } from './inline';\nimport styles from './style.scss';\n\nconst name = 'core/text-color';\nconst title = __( 'Text color' );\n\nconst EMPTY_ARRAY = [];\n\nfunction getComputedStyleProperty( element, property ) {\n\tconst {\n\t\tprops: { style = {} },\n\t} = element;\n\n\tif ( property === 'background-color' ) {\n\t\tconst { backgroundColor, baseColors } = style;\n\n\t\tif ( backgroundColor !== 'transparent' ) {\n\t\t\treturn backgroundColor;\n\t\t} else if ( baseColors && baseColors?.color?.background ) {\n\t\t\treturn baseColors?.color?.background;\n\t\t}\n\n\t\treturn 'transparent';\n\t}\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: getComputedStyleProperty(\n\t\t\telement,\n\t\t\t'background-color'\n\t\t),\n\t};\n}\n\nfunction TextColorEdit( {\n\tvalue,\n\tonChange,\n\tisActive,\n\tactiveAttributes,\n\tcontentRef,\n} ) {\n\tconst allowCustomControl = useSetting( 'color.custom' );\n\tconst colors = useSetting( 'color.palette' ) || EMPTY_ARRAY;\n\tconst [ isAddingColor, setIsAddingColor ] = useState( false );\n\tconst enableIsAddingColor = useCallback( () => setIsAddingColor( true ), [\n\t\tsetIsAddingColor,\n\t] );\n\tconst disableIsAddingColor = useCallback( () => setIsAddingColor( false ), [\n\t\tsetIsAddingColor,\n\t] );\n\tconst colorIndicatorStyle = useMemo(\n\t\t() =>\n\t\t\tfillComputedColors(\n\t\t\t\tcontentRef,\n\t\t\t\tgetActiveColors( value, name, colors )\n\t\t\t),\n\t\t[ value, colors ]\n\t);\n\n\tconst hasColorsToChoose = ! isEmpty( colors ) || ! allowCustomControl;\n\n\tconst onPressButton = useCallback( () => {\n\t\tif ( hasColorsToChoose ) {\n\t\t\tenableIsAddingColor();\n\t\t} else {\n\t\t\tonChange( removeFormat( value, name ) );\n\t\t}\n\t}, [ hasColorsToChoose, value ] );\n\n\tconst outlineStyle = usePreferredColorSchemeStyle(\n\t\tstyles[ 'components-inline-color__outline' ],\n\t\tstyles[ 'components-inline-color__outline--dark' ]\n\t);\n\n\tif ( ! hasColorsToChoose && ! isActive ) {\n\t\treturn null;\n\t}\n\n\tconst isActiveStyle = {\n\t\t...colorIndicatorStyle,\n\t\t...( ! colorIndicatorStyle?.backgroundColor\n\t\t\t? { backgroundColor: 'transparent' }\n\t\t\t: {} ),\n\t\t...styles[ 'components-inline-color--is-active' ],\n\t};\n\n\tconst customContainerStyles =\n\t\tstyles[ 'components-inline-color__button-container' ];\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t{ isActive && (\n\t\t\t\t\t\t<View style={ outlineStyle } pointerEvents=\"none\" />\n\t\t\t\t\t) }\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"text-color\"\n\t\t\t\t\t\tisActive={ isActive }\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\ticon={ textColorIcon }\n\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\tcolorIndicatorStyle?.color && {\n\t\t\t\t\t\t\t\t\t\tcolor: colorIndicatorStyle.color,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\textraProps={ {\n\t\t\t\t\t\t\tisActiveStyle,\n\t\t\t\t\t\t\tcustomContainerStyles,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t// If has no colors to choose but a color is active remove the color onClick\n\t\t\t\t\t\tonClick={ onPressButton }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t{ isAddingColor && (\n\t\t\t\t<InlineColorUI\n\t\t\t\t\tname={ name }\n\t\t\t\t\tonClose={ disableIsAddingColor }\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/>\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\t/*\n\t * Since this format relies on the <mark> tag, it's important to\n\t * prevent the default yellow background color applied by most\n\t * browsers. The solution is to detect when this format is used with a\n\t * text color but no background color, and in such cases to override\n\t * the default styling with a transparent background.\n\t *\n\t * @see https://github.com/WordPress/gutenberg/pull/35516\n\t */\n\t__unstableFilterAttributeValue( key, value ) {\n\t\tif ( key !== 'style' ) return value;\n\t\t// We should not add a background-color if it's already set\n\t\tif ( value && value.includes( 'background-color' ) ) return value;\n\t\tconst addedCSS = [ 'background-color', transparentValue ].join( ':' );\n\t\t// Prepend `addedCSS` to avoid a double `;;` as any the existing CSS\n\t\t// rules will already include a `;`.\n\t\treturn value ? [ addedCSS, value ].join( ';' ) : addedCSS;\n\t},\n\tedit: TextColorEdit,\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/format-library/src/text-color/inline.js"],"names":["parseCSS","css","split","reduce","accumulator","rule","property","value","color","transparentValue","backgroundColor","parseClassName","className","colorSettings","name","startsWith","endsWith","colorSlug","replace","colorObject","getActiveColors","activeColorFormat","attributes","style","class","setColors","colors","styles","classNames","push","join","slug","length","type","ColorPicker","onChange","select","getSettings","blockEditorStore","onColorChange","activeColors","InlineColorUI","onClose","contentRef","anchorRef","ref","settings","title","tab"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/format-library/src/text-color/inline.js"],"names":["parseCSS","css","split","reduce","accumulator","rule","property","value","color","transparentValue","backgroundColor","parseClassName","className","colorSettings","name","startsWith","endsWith","colorSlug","replace","colorObject","getActiveColors","activeColorFormat","attributes","style","class","setColors","colors","styles","classNames","push","join","slug","length","type","ColorPicker","onChange","select","getSettings","blockEditorStore","onColorChange","activeColors","InlineColorUI","onClose","contentRef","anchorRef","ref","settings","title","tab"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AAMA;;AAQA;;AACA;;AAKA;;AA9BA;AACA;AACA;;AAGA;AACA;AACA;;AAoBA;AACA;AACA;AAGA,SAASA,QAAT,GAA8B;AAAA,MAAXC,GAAW,uEAAL,EAAK;AAC7B,SAAOA,GAAG,CAACC,KAAJ,CAAW,GAAX,EAAiBC,MAAjB,CAAyB,CAAEC,WAAF,EAAeC,IAAf,KAAyB;AACxD,QAAKA,IAAL,EAAY;AACX,YAAM,CAAEC,QAAF,EAAYC,KAAZ,IAAsBF,IAAI,CAACH,KAAL,CAAY,GAAZ,CAA5B;AACA,UAAKI,QAAQ,KAAK,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,UAAP;AAAmBpC,IAAAA,KAAnB;AAA0BuC,IAAAA,QAAQ,EAARA;AAA1B,GAAd,CADiB,CAAlB;AAIA,SACC,4BAAC,mBAAD;AACC,IAAA,OAAO,EAAGJ,OADX;AAEC,IAAA,SAAS,EAAC,iCAFX;AAGC,IAAA,SAAS,EAAGE;AAHb,KAKC,4BAAC,oBAAD;AACC,IAAA,IAAI,EAAG,CACN;AACC9B,MAAAA,IAAI,EAAE,OADP;AAECiC,MAAAA,KAAK,EAAE,cAAI,MAAJ;AAFR,KADM,EAKN;AACCjC,MAAAA,IAAI,EAAE,iBADP;AAECiC,MAAAA,KAAK,EAAE,cAAI,YAAJ;AAFR,KALM;AADR,KAYKC,GAAF,IACD,4BAAC,WAAD;AACC,IAAA,IAAI,EAAGlC,IADR;AAEC,IAAA,QAAQ,EAAGkC,GAAG,CAAClC,IAFhB;AAGC,IAAA,KAAK,EAAGP,KAHT;AAIC,IAAA,QAAQ,EAAG4B;AAJZ,IAbF,CALD,CADD;AA6BA","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tapplyFormat,\n\tremoveFormat,\n\tgetActiveFormat,\n\tuseAnchorRef,\n} from '@wordpress/rich-text';\nimport {\n\tColorPalette,\n\tgetColorClassName,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n\tstore as blockEditorStore,\n\tuseCachedTruthy,\n} from '@wordpress/block-editor';\nimport { Popover, TabPanel } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { textColor as settings, transparentValue } from './index';\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' ) accumulator.color = value;\n\t\t\tif ( property === 'background-color' && value !== transparentValue )\n\t\t\t\taccumulator.backgroundColor = value;\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 ) attributes.style = styles.join( ';' );\n\tif ( classNames.length ) attributes.class = classNames.join( ' ' );\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 get( getSettings(), [ 'colors' ], [] );\n\t}, [] );\n\tconst onColorChange = useCallback(\n\t\t( color ) => {\n\t\t\tonChange(\n\t\t\t\tsetColors( value, name, colors, { [ property ]: color } )\n\t\t\t);\n\t\t},\n\t\t[ colors, onChange, property ]\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={ onColorChange }\n\t\t/>\n\t);\n}\n\nexport default function InlineColorUI( {\n\tname,\n\tvalue,\n\tonChange,\n\tonClose,\n\tcontentRef,\n} ) {\n\t/* \n\t As you change the text color by typing a HEX value into a field,\n\t the return value of document.getSelection jumps to the field you're editing,\n\t not the highlighted text. Given that useAnchorRef uses document.getSelection,\n\t it will return null, since it can't find the <mark> element within the HEX input.\n\t This caches the last truthy value of the selection anchor reference.\n\t */\n\tconst anchorRef = useCachedTruthy(\n\t\tuseAnchorRef( { ref: contentRef, value, settings } )\n\t);\n\n\treturn (\n\t\t<Popover\n\t\t\tonClose={ onClose }\n\t\t\tclassName=\"components-inline-color-popover\"\n\t\t\tanchorRef={ anchorRef }\n\t\t>\n\t\t\t<TabPanel\n\t\t\t\ttabs={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'color',\n\t\t\t\t\t\ttitle: __( 'Text' ),\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'backgroundColor',\n\t\t\t\t\t\ttitle: __( 'Background' ),\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t{ ( tab ) => (\n\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\tproperty={ tab.name }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</TabPanel>\n\t\t</Popover>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = InlineColorUI;
|
|
7
|
+
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
|
|
10
|
+
var _richText = require("@wordpress/rich-text");
|
|
11
|
+
|
|
12
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
13
|
+
|
|
14
|
+
var _components = require("@wordpress/components");
|
|
15
|
+
|
|
16
|
+
var _index = require("./index");
|
|
17
|
+
|
|
18
|
+
var _index2 = require("./index.js");
|
|
19
|
+
|
|
20
|
+
var _inline = require("./inline.js");
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* WordPress dependencies
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Internal dependencies
|
|
28
|
+
*/
|
|
29
|
+
function parseCSS() {
|
|
30
|
+
let css = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
31
|
+
return css.split(';').reduce((accumulator, rule) => {
|
|
32
|
+
if (rule) {
|
|
33
|
+
const [property, value] = rule.replace(/ /g, '').split(':');
|
|
34
|
+
if (property === 'color') accumulator.color = value;
|
|
35
|
+
if (property === 'background-color' && value !== _index2.transparentValue) accumulator.backgroundColor = value;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return accumulator;
|
|
39
|
+
}, {});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function getActiveColors(value, name, colorSettings) {
|
|
43
|
+
const activeColorFormat = (0, _richText.getActiveFormat)(value, name);
|
|
44
|
+
|
|
45
|
+
if (!activeColorFormat) {
|
|
46
|
+
return {};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return { ...parseCSS(activeColorFormat.attributes.style),
|
|
50
|
+
...(0, _inline.parseClassName)(activeColorFormat.attributes.class, colorSettings)
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function setColors(value, name, colorSettings, colors) {
|
|
55
|
+
var _value$text;
|
|
56
|
+
|
|
57
|
+
const {
|
|
58
|
+
color,
|
|
59
|
+
backgroundColor
|
|
60
|
+
} = { ...getActiveColors(value, name, colorSettings),
|
|
61
|
+
...colors
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
if (!color && !backgroundColor) {
|
|
65
|
+
return (0, _richText.removeFormat)(value, name);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const styles = [];
|
|
69
|
+
const classNames = [];
|
|
70
|
+
const attributes = {};
|
|
71
|
+
|
|
72
|
+
if (backgroundColor) {
|
|
73
|
+
styles.push(['background-color', backgroundColor].join(':'));
|
|
74
|
+
} else {
|
|
75
|
+
// Override default browser color for mark element.
|
|
76
|
+
styles.push(['background-color', _index2.transparentValue].join(':'));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (color) {
|
|
80
|
+
const colorObject = (0, _blockEditor.getColorObjectByColorValue)(colorSettings, color);
|
|
81
|
+
|
|
82
|
+
if (colorObject) {
|
|
83
|
+
classNames.push((0, _blockEditor.getColorClassName)('color', colorObject.slug));
|
|
84
|
+
styles.push(['color', colorObject.color].join(':'));
|
|
85
|
+
} else {
|
|
86
|
+
styles.push(['color', color].join(':'));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (styles.length) attributes.style = styles.join(';');
|
|
91
|
+
if (classNames.length) attributes.class = classNames.join(' ');
|
|
92
|
+
const format = {
|
|
93
|
+
type: name,
|
|
94
|
+
attributes
|
|
95
|
+
}; // For cases when there is no text selected, formatting is forced
|
|
96
|
+
// for the first empty character
|
|
97
|
+
|
|
98
|
+
if ((value === null || value === void 0 ? void 0 : value.start) === (value === null || value === void 0 ? void 0 : value.end) && ((value === null || value === void 0 ? void 0 : value.text.length) === 0 || ((_value$text = value.text) === null || _value$text === void 0 ? void 0 : _value$text.charAt(value.end - 1)) === ' ')) {
|
|
99
|
+
return (0, _richText.applyFormat)(value, format, (value === null || value === void 0 ? void 0 : value.start) - 1, (value === null || value === void 0 ? void 0 : value.end) + 1);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return (0, _richText.applyFormat)(value, format);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function ColorPicker(_ref) {
|
|
106
|
+
let {
|
|
107
|
+
name,
|
|
108
|
+
value,
|
|
109
|
+
onChange
|
|
110
|
+
} = _ref;
|
|
111
|
+
const property = 'color';
|
|
112
|
+
|
|
113
|
+
const colors = (0, _blockEditor.useSetting)('color.palette') || _index.textColor.colors;
|
|
114
|
+
|
|
115
|
+
const colorSettings = {
|
|
116
|
+
colors
|
|
117
|
+
};
|
|
118
|
+
const onColorChange = (0, _element.useCallback)(color => {
|
|
119
|
+
var _value$text2;
|
|
120
|
+
|
|
121
|
+
if (color !== '') {
|
|
122
|
+
onChange(setColors(value, name, colors, {
|
|
123
|
+
[property]: color
|
|
124
|
+
})); // Remove formatting if the color was reset, there's no
|
|
125
|
+
// current selection and the previous character is a space
|
|
126
|
+
} else if ((value === null || value === void 0 ? void 0 : value.start) === (value === null || value === void 0 ? void 0 : value.end) && ((_value$text2 = value.text) === null || _value$text2 === void 0 ? void 0 : _value$text2.charAt((value === null || value === void 0 ? void 0 : value.end) - 1)) === ' ') {
|
|
127
|
+
onChange((0, _richText.removeFormat)(value, name, value.end - 1, value.end));
|
|
128
|
+
} else {
|
|
129
|
+
onChange((0, _richText.removeFormat)(value, name));
|
|
130
|
+
}
|
|
131
|
+
}, [colors, onChange, property]);
|
|
132
|
+
const activeColors = (0, _element.useMemo)(() => getActiveColors(value, name, colors), [name, value, colors]);
|
|
133
|
+
return (0, _element.createElement)(_components.ColorSettings, {
|
|
134
|
+
colorValue: activeColors[property],
|
|
135
|
+
onColorChange: onColorChange,
|
|
136
|
+
defaultSettings: colorSettings,
|
|
137
|
+
hideNavigation: true
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function InlineColorUI(_ref2) {
|
|
142
|
+
let {
|
|
143
|
+
name,
|
|
144
|
+
value,
|
|
145
|
+
onChange,
|
|
146
|
+
onClose
|
|
147
|
+
} = _ref2;
|
|
148
|
+
return (0, _element.createElement)(_components.BottomSheet, {
|
|
149
|
+
isVisible: true,
|
|
150
|
+
onClose: onClose,
|
|
151
|
+
hideHeader: true,
|
|
152
|
+
contentStyle: {
|
|
153
|
+
paddingLeft: 0,
|
|
154
|
+
paddingRight: 0
|
|
155
|
+
},
|
|
156
|
+
hasNavigation: true,
|
|
157
|
+
leftButton: null
|
|
158
|
+
}, (0, _element.createElement)(_components.BottomSheet.NavigationContainer, {
|
|
159
|
+
animate: true,
|
|
160
|
+
main: true
|
|
161
|
+
}, (0, _element.createElement)(_components.BottomSheet.NavigationScreen, {
|
|
162
|
+
name: "text-color"
|
|
163
|
+
}, (0, _element.createElement)(ColorPicker, {
|
|
164
|
+
name: name,
|
|
165
|
+
value: value,
|
|
166
|
+
onChange: onChange
|
|
167
|
+
}))));
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=inline.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/format-library/src/text-color/inline.native.js"],"names":["parseCSS","css","split","reduce","accumulator","rule","property","value","replace","color","transparentValue","backgroundColor","getActiveColors","name","colorSettings","activeColorFormat","attributes","style","class","setColors","colors","styles","classNames","push","join","colorObject","slug","length","format","type","start","end","text","charAt","ColorPicker","onChange","settings","onColorChange","activeColors","InlineColorUI","onClose","paddingLeft","paddingRight"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AAKA;;AAKA;;AACA;;AACA;;AArBA;AACA;AACA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BAAb;AAAiC,IAAA,OAAO,MAAxC;AAAyC,IAAA,IAAI;AAA7C,KACC,4BAAC,uBAAD,CAAa,gBAAb;AAA8B,IAAA,IAAI,EAAC;AAAnC,KACC,4BAAC,WAAD;AACC,IAAA,IAAI,EAAG7B,IADR;AAEC,IAAA,KAAK,EAAGN,KAFT;AAGC,IAAA,QAAQ,EAAG4B;AAHZ,IADD,CADD,CARD,CADD;AAoBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback, useMemo } from '@wordpress/element';\nimport {\n\tapplyFormat,\n\tremoveFormat,\n\tgetActiveFormat,\n} from '@wordpress/rich-text';\nimport {\n\tuseSetting,\n\tgetColorClassName,\n\tgetColorObjectByColorValue,\n} from '@wordpress/block-editor';\nimport { BottomSheet, ColorSettings } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { textColor as settings } from './index';\nimport { transparentValue } from './index.js';\nimport { parseClassName } from './inline.js';\n\nfunction parseCSS( css = '' ) {\n\treturn css.split( ';' ).reduce( ( accumulator, rule ) => {\n\t\tif ( rule ) {\n\t\t\tconst [ property, value ] = rule.replace( / /g, '' ).split( ':' );\n\t\t\tif ( property === 'color' ) accumulator.color = value;\n\t\t\tif ( property === 'background-color' && value !== transparentValue )\n\t\t\t\taccumulator.backgroundColor = value;\n\t\t}\n\t\treturn accumulator;\n\t}, {} );\n}\n\nfunction 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\tstyles.push( [ 'color', colorObject.color ].join( ':' ) );\n\t\t} else {\n\t\t\tstyles.push( [ 'color', color ].join( ':' ) );\n\t\t}\n\t}\n\n\tif ( styles.length ) attributes.style = styles.join( ';' );\n\tif ( classNames.length ) attributes.class = classNames.join( ' ' );\n\n\tconst format = { type: name, attributes };\n\n\t// For cases when there is no text selected, formatting is forced\n\t// for the first empty character\n\tif (\n\t\tvalue?.start === value?.end &&\n\t\t( value?.text.length === 0 ||\n\t\t\tvalue.text?.charAt( value.end - 1 ) === ' ' )\n\t) {\n\t\treturn applyFormat( value, format, value?.start - 1, value?.end + 1 );\n\t}\n\n\treturn applyFormat( value, format );\n}\n\nfunction ColorPicker( { name, value, onChange } ) {\n\tconst property = 'color';\n\tconst colors = useSetting( 'color.palette' ) || settings.colors;\n\tconst colorSettings = {\n\t\tcolors,\n\t};\n\n\tconst onColorChange = useCallback(\n\t\t( color ) => {\n\t\t\tif ( 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\t// Remove formatting if the color was reset, there's no\n\t\t\t\t// current selection and the previous character is a space\n\t\t\t} else if (\n\t\t\t\tvalue?.start === value?.end &&\n\t\t\t\tvalue.text?.charAt( value?.end - 1 ) === ' '\n\t\t\t) {\n\t\t\t\tonChange(\n\t\t\t\t\tremoveFormat( value, name, value.end - 1, value.end )\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tonChange( removeFormat( value, name ) );\n\t\t\t}\n\t\t},\n\t\t[ colors, onChange, property ]\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<ColorSettings\n\t\t\tcolorValue={ activeColors[ property ] }\n\t\t\tonColorChange={ onColorChange }\n\t\t\tdefaultSettings={ colorSettings }\n\t\t\thideNavigation\n\t\t/>\n\t);\n}\n\nexport default function InlineColorUI( { name, value, onChange, onClose } ) {\n\treturn (\n\t\t<BottomSheet\n\t\t\tisVisible\n\t\t\tonClose={ onClose }\n\t\t\thideHeader\n\t\t\tcontentStyle={ { paddingLeft: 0, paddingRight: 0 } }\n\t\t\thasNavigation\n\t\t\tleftButton={ null }\n\t\t>\n\t\t\t<BottomSheet.NavigationContainer animate main>\n\t\t\t\t<BottomSheet.NavigationScreen name=\"text-color\">\n\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t</BottomSheet.NavigationScreen>\n\t\t\t</BottomSheet.NavigationContainer>\n\t\t</BottomSheet>\n\t);\n}\n"]}
|
|
@@ -5,5 +5,6 @@ import { bold } from './bold';
|
|
|
5
5
|
import { italic } from './italic';
|
|
6
6
|
import { link } from './link';
|
|
7
7
|
import { strikethrough } from './strikethrough';
|
|
8
|
-
|
|
8
|
+
import { textColor } from './text-color';
|
|
9
|
+
export default [bold, italic, link, strikethrough, textColor];
|
|
9
10
|
//# sourceMappingURL=default-formats.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/format-library/src/default-formats.native.js"],"names":["bold","italic","link","strikethrough"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;AACA,SAASC,MAAT,QAAuB,UAAvB;AACA,SAASC,IAAT,QAAqB,QAArB;AACA,SAASC,aAAT,QAA8B,iBAA9B;AAEA,eAAe,
|
|
1
|
+
{"version":3,"sources":["@wordpress/format-library/src/default-formats.native.js"],"names":["bold","italic","link","strikethrough","textColor"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;AACA,SAASC,MAAT,QAAuB,UAAvB;AACA,SAASC,IAAT,QAAqB,QAArB;AACA,SAASC,aAAT,QAA8B,iBAA9B;AACA,SAASC,SAAT,QAA0B,cAA1B;AAEA,eAAe,CAAEJ,IAAF,EAAQC,MAAR,EAAgBC,IAAhB,EAAsBC,aAAtB,EAAqCC,SAArC,CAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport { bold } from './bold';\nimport { italic } from './italic';\nimport { link } from './link';\nimport { strikethrough } from './strikethrough';\nimport { textColor } from './text-color';\n\nexport default [ bold, italic, link, strikethrough, textColor ];\n"]}
|