@wordpress/format-library 5.32.0 → 5.32.1-next.47f435fc9.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/bold/index.js +69 -58
- package/build/bold/index.js.map +7 -1
- package/build/code/index.js +62 -54
- package/build/code/index.js.map +7 -1
- package/build/default-formats.js +52 -24
- package/build/default-formats.js.map +7 -1
- package/build/image/index.js +185 -153
- package/build/image/index.js.map +7 -1
- package/build/index.js +28 -18
- package/build/index.js.map +7 -1
- package/build/italic/index.js +69 -58
- package/build/italic/index.js.map +7 -1
- package/build/keyboard/index.js +47 -36
- package/build/keyboard/index.js.map +7 -1
- package/build/language/index.js +145 -113
- package/build/language/index.js.map +7 -1
- package/build/link/css-classes-setting.js +81 -0
- package/build/link/css-classes-setting.js.map +7 -0
- package/build/link/index.js +162 -167
- package/build/link/index.js.map +7 -1
- package/build/link/inline.js +186 -174
- package/build/link/inline.js.map +7 -1
- package/build/link/use-link-instance-key.js +25 -19
- package/build/link/use-link-instance-key.js.map +7 -1
- package/build/link/utils.js +66 -115
- package/build/link/utils.js.map +7 -1
- package/build/lock-unlock.js +31 -15
- package/build/lock-unlock.js.map +7 -1
- package/build/non-breaking-space/index.js +44 -28
- package/build/non-breaking-space/index.js.map +7 -1
- package/build/strikethrough/index.js +57 -42
- package/build/strikethrough/index.js.map +7 -1
- package/build/subscript/index.js +47 -36
- package/build/subscript/index.js.map +7 -1
- package/build/superscript/index.js +47 -36
- package/build/superscript/index.js.map +7 -1
- package/build/text-color/index.js +102 -70
- package/build/text-color/index.js.map +7 -1
- package/build/text-color/inline.js +118 -116
- package/build/text-color/inline.js.map +7 -1
- package/build/underline/index.js +62 -40
- package/build/underline/index.js.map +7 -1
- package/build/unknown/index.js +51 -37
- package/build/unknown/index.js.map +7 -1
- package/build-module/bold/index.js +52 -52
- package/build-module/bold/index.js.map +7 -1
- package/build-module/code/index.js +41 -46
- package/build-module/code/index.js.map +7 -1
- package/build-module/default-formats.js +34 -19
- package/build-module/default-formats.js.map +7 -1
- package/build-module/image/index.js +174 -144
- package/build-module/image/index.js.map +7 -1
- package/build-module/index.js +6 -14
- package/build-module/index.js.map +7 -1
- package/build-module/italic/index.js +52 -52
- package/build-module/italic/index.js.map +7 -1
- package/build-module/keyboard/index.js +25 -30
- package/build-module/keyboard/index.js.map +7 -1
- package/build-module/language/index.js +128 -105
- package/build-module/language/index.js.map +7 -1
- package/build-module/link/css-classes-setting.js +67 -0
- package/build-module/link/css-classes-setting.js.map +7 -0
- package/build-module/link/index.js +128 -146
- package/build-module/link/index.js.map +7 -1
- package/build-module/link/inline.js +158 -154
- package/build-module/link/inline.js.map +7 -1
- package/build-module/link/use-link-instance-key.js +7 -14
- package/build-module/link/use-link-instance-key.js.map +7 -1
- package/build-module/link/utils.js +46 -101
- package/build-module/link/utils.js.map +7 -1
- package/build-module/lock-unlock.js +8 -7
- package/build-module/lock-unlock.js.map +7 -1
- package/build-module/non-breaking-space/index.js +22 -22
- package/build-module/non-breaking-space/index.js.map +7 -1
- package/build-module/strikethrough/index.js +38 -36
- package/build-module/strikethrough/index.js.map +7 -1
- package/build-module/subscript/index.js +25 -30
- package/build-module/subscript/index.js.map +7 -1
- package/build-module/superscript/index.js +25 -30
- package/build-module/superscript/index.js.map +7 -1
- package/build-module/text-color/index.js +72 -61
- package/build-module/text-color/index.js.map +7 -1
- package/build-module/text-color/inline.js +107 -106
- package/build-module/text-color/inline.js.map +7 -1
- package/build-module/underline/index.js +43 -34
- package/build-module/underline/index.js.map +7 -1
- package/build-module/unknown/index.js +26 -28
- package/build-module/unknown/index.js.map +7 -1
- package/build-style/style-rtl.css +0 -194
- package/build-style/style.css +0 -194
- package/package.json +21 -15
- package/src/image/style.scss +3 -0
- package/src/link/css-classes-setting.js +89 -0
- package/src/link/index.js +1 -0
- package/src/link/inline.js +19 -0
- package/src/link/style.scss +3 -0
- package/src/link/test/css-classes-setting.js +144 -0
- package/src/link/utils.js +8 -0
- package/src/style.scss +4 -4
- package/src/text-color/style.scss +2 -0
- package/build/default-formats.native.js +0 -16
- package/build/default-formats.native.js.map +0 -1
- package/build/link/index.native.js +0 -174
- package/build/link/index.native.js.map +0 -1
- package/build/link/modal-screens/link-picker-screen.native.js +0 -67
- package/build/link/modal-screens/link-picker-screen.native.js.map +0 -1
- package/build/link/modal-screens/link-settings-screen.native.js +0 -226
- package/build/link/modal-screens/link-settings-screen.native.js.map +0 -1
- package/build/link/modal-screens/screens.native.js +0 -11
- package/build/link/modal-screens/screens.native.js.map +0 -1
- package/build/link/modal.native.js +0 -53
- package/build/link/modal.native.js.map +0 -1
- package/build/text-color/index.native.js +0 -134
- package/build/text-color/index.native.js.map +0 -1
- package/build/text-color/inline.native.js +0 -150
- package/build/text-color/inline.native.js.map +0 -1
- package/build-module/default-formats.native.js +0 -10
- package/build-module/default-formats.native.js.map +0 -1
- package/build-module/link/index.native.js +0 -166
- package/build-module/link/index.native.js.map +0 -1
- package/build-module/link/modal-screens/link-picker-screen.native.js +0 -59
- package/build-module/link/modal-screens/link-picker-screen.native.js.map +0 -1
- package/build-module/link/modal-screens/link-settings-screen.native.js +0 -218
- package/build-module/link/modal-screens/link-settings-screen.native.js.map +0 -1
- package/build-module/link/modal-screens/screens.native.js +0 -5
- package/build-module/link/modal-screens/screens.native.js.map +0 -1
- package/build-module/link/modal.native.js +0 -45
- package/build-module/link/modal.native.js.map +0 -1
- package/build-module/text-color/index.native.js +0 -126
- package/build-module/text-color/index.native.js.map +0 -1
- package/build-module/text-color/inline.native.js +0 -142
- package/build-module/text-color/inline.native.js.map +0 -1
package/build/bold/index.js
CHANGED
|
@@ -1,70 +1,81 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name2 in all)
|
|
7
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var bold_exports = {};
|
|
19
|
+
__export(bold_exports, {
|
|
20
|
+
bold: () => bold
|
|
5
21
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Internal dependencies
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
const {
|
|
22
|
-
essentialFormatKey
|
|
23
|
-
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
24
|
-
const name = 'core/bold';
|
|
25
|
-
const title = (0, _i18n.__)('Bold');
|
|
26
|
-
const bold = exports.bold = {
|
|
22
|
+
module.exports = __toCommonJS(bold_exports);
|
|
23
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
24
|
+
var import_i18n = require("@wordpress/i18n");
|
|
25
|
+
var import_rich_text = require("@wordpress/rich-text");
|
|
26
|
+
var import_block_editor = require("@wordpress/block-editor");
|
|
27
|
+
var import_icons = require("@wordpress/icons");
|
|
28
|
+
var import_lock_unlock = require("../lock-unlock");
|
|
29
|
+
const { essentialFormatKey } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
|
|
30
|
+
const name = "core/bold";
|
|
31
|
+
const title = (0, import_i18n.__)("Bold");
|
|
32
|
+
const bold = {
|
|
27
33
|
name,
|
|
28
34
|
title,
|
|
29
|
-
tagName:
|
|
35
|
+
tagName: "strong",
|
|
30
36
|
className: null,
|
|
31
37
|
[essentialFormatKey]: true,
|
|
32
|
-
edit({
|
|
33
|
-
isActive,
|
|
34
|
-
value,
|
|
35
|
-
onChange,
|
|
36
|
-
onFocus
|
|
37
|
-
}) {
|
|
38
|
+
edit({ isActive, value, onChange, onFocus }) {
|
|
38
39
|
function onToggle() {
|
|
39
|
-
onChange((0,
|
|
40
|
-
type: name,
|
|
41
|
-
title
|
|
42
|
-
}));
|
|
40
|
+
onChange((0, import_rich_text.toggleFormat)(value, { type: name, title }));
|
|
43
41
|
}
|
|
44
42
|
function onClick() {
|
|
45
|
-
onChange((0,
|
|
46
|
-
type: name
|
|
47
|
-
}));
|
|
43
|
+
onChange((0, import_rich_text.toggleFormat)(value, { type: name }));
|
|
48
44
|
onFocus();
|
|
49
45
|
}
|
|
50
|
-
return
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
46
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
47
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
48
|
+
import_block_editor.RichTextShortcut,
|
|
49
|
+
{
|
|
50
|
+
type: "primary",
|
|
51
|
+
character: "b",
|
|
52
|
+
onUse: onToggle
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
56
|
+
import_block_editor.RichTextToolbarButton,
|
|
57
|
+
{
|
|
58
|
+
name: "bold",
|
|
59
|
+
icon: import_icons.formatBold,
|
|
60
|
+
title,
|
|
61
|
+
onClick,
|
|
62
|
+
isActive,
|
|
63
|
+
shortcutType: "primary",
|
|
64
|
+
shortcutCharacter: "b"
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
68
|
+
import_block_editor.__unstableRichTextInputEvent,
|
|
69
|
+
{
|
|
70
|
+
inputType: "formatBold",
|
|
71
|
+
onInput: onToggle
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
] });
|
|
68
75
|
}
|
|
69
76
|
};
|
|
70
|
-
|
|
77
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
78
|
+
0 && (module.exports = {
|
|
79
|
+
bold
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=index.js.map
|
package/build/bold/index.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/bold/index.js"],
|
|
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": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwCG;AArCH,kBAAmB;AACnB,uBAA6B;AAC7B,0BAKO;AACP,mBAA2B;AAK3B,yBAAuB;AAEvB,MAAM,EAAE,mBAAmB,QAAI,2BAAQ,oBAAAA,WAAuB;AAE9D,MAAM,OAAO;AACb,MAAM,YAAQ,gBAAI,MAAO;AAElB,MAAM,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,mBAAU,+BAAc,OAAO,EAAE,MAAM,MAAM,MAAM,CAAE,CAAE;AAAA,IACxD;AAEA,aAAS,UAAU;AAClB,mBAAU,+BAAc,OAAO,EAAE,MAAM,KAAK,CAAE,CAAE;AAChD,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,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
|
+
"names": ["blockEditorPrivateApis"]
|
|
7
|
+
}
|
package/build/code/index.js
CHANGED
|
@@ -1,34 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name2 in all)
|
|
7
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var code_exports = {};
|
|
19
|
+
__export(code_exports, {
|
|
20
|
+
code: () => code
|
|
5
21
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const name = 'core/code';
|
|
17
|
-
const title = (0, _i18n.__)('Inline code');
|
|
18
|
-
const code = exports.code = {
|
|
22
|
+
module.exports = __toCommonJS(code_exports);
|
|
23
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
24
|
+
var import_i18n = require("@wordpress/i18n");
|
|
25
|
+
var import_rich_text = require("@wordpress/rich-text");
|
|
26
|
+
var import_block_editor = require("@wordpress/block-editor");
|
|
27
|
+
var import_icons = require("@wordpress/icons");
|
|
28
|
+
const name = "core/code";
|
|
29
|
+
const title = (0, import_i18n.__)("Inline code");
|
|
30
|
+
const code = {
|
|
19
31
|
name,
|
|
20
32
|
title,
|
|
21
|
-
tagName:
|
|
33
|
+
tagName: "code",
|
|
22
34
|
className: null,
|
|
23
35
|
__unstableInputRule(value) {
|
|
24
|
-
const BACKTICK =
|
|
25
|
-
const {
|
|
26
|
-
start,
|
|
27
|
-
text
|
|
28
|
-
} = value;
|
|
36
|
+
const BACKTICK = "`";
|
|
37
|
+
const { start, text } = value;
|
|
29
38
|
const characterBefore = text[start - 1];
|
|
30
|
-
|
|
31
|
-
// Quick check the text for the necessary character.
|
|
32
39
|
if (characterBefore !== BACKTICK) {
|
|
33
40
|
return value;
|
|
34
41
|
}
|
|
@@ -44,39 +51,40 @@ const code = exports.code = {
|
|
|
44
51
|
if (startIndex === endIndex) {
|
|
45
52
|
return value;
|
|
46
53
|
}
|
|
47
|
-
value = (0,
|
|
48
|
-
value = (0,
|
|
49
|
-
value = (0,
|
|
50
|
-
type: name
|
|
51
|
-
}, startIndex, endIndex);
|
|
54
|
+
value = (0, import_rich_text.remove)(value, startIndex, startIndex + 1);
|
|
55
|
+
value = (0, import_rich_text.remove)(value, endIndex, endIndex + 1);
|
|
56
|
+
value = (0, import_rich_text.applyFormat)(value, { type: name }, startIndex, endIndex);
|
|
52
57
|
return value;
|
|
53
58
|
},
|
|
54
|
-
edit({
|
|
55
|
-
value,
|
|
56
|
-
onChange,
|
|
57
|
-
onFocus,
|
|
58
|
-
isActive
|
|
59
|
-
}) {
|
|
59
|
+
edit({ value, onChange, onFocus, isActive }) {
|
|
60
60
|
function onClick() {
|
|
61
|
-
onChange((0,
|
|
62
|
-
type: name,
|
|
63
|
-
title
|
|
64
|
-
}));
|
|
61
|
+
onChange((0, import_rich_text.toggleFormat)(value, { type: name, title }));
|
|
65
62
|
onFocus();
|
|
66
63
|
}
|
|
67
|
-
return
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
64
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
65
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
66
|
+
import_block_editor.RichTextShortcut,
|
|
67
|
+
{
|
|
68
|
+
type: "access",
|
|
69
|
+
character: "x",
|
|
70
|
+
onUse: onClick
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
74
|
+
import_block_editor.RichTextToolbarButton,
|
|
75
|
+
{
|
|
76
|
+
icon: import_icons.code,
|
|
77
|
+
title,
|
|
78
|
+
onClick,
|
|
79
|
+
isActive,
|
|
80
|
+
role: "menuitemcheckbox"
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
] });
|
|
80
84
|
}
|
|
81
85
|
};
|
|
82
|
-
|
|
86
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
87
|
+
0 && (module.exports = {
|
|
88
|
+
code
|
|
89
|
+
});
|
|
90
|
+
//# sourceMappingURL=index.js.map
|
package/build/code/index.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/code/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { toggleFormat, remove, applyFormat } from '@wordpress/rich-text';\nimport {\n\tRichTextToolbarButton,\n\tRichTextShortcut,\n} from '@wordpress/block-editor';\nimport { code as codeIcon } from '@wordpress/icons';\n\nconst name = 'core/code';\nconst title = __( 'Inline code' );\n\nexport const code = {\n\tname,\n\ttitle,\n\ttagName: 'code',\n\tclassName: null,\n\t__unstableInputRule( value ) {\n\t\tconst BACKTICK = '`';\n\t\tconst { start, text } = value;\n\t\tconst characterBefore = text[ start - 1 ];\n\n\t\t// Quick check the text for the necessary character.\n\t\tif ( characterBefore !== BACKTICK ) {\n\t\t\treturn value;\n\t\t}\n\n\t\tif ( start - 2 < 0 ) {\n\t\t\treturn value;\n\t\t}\n\n\t\tconst indexBefore = text.lastIndexOf( BACKTICK, start - 2 );\n\t\tif ( indexBefore === -1 ) {\n\t\t\treturn value;\n\t\t}\n\n\t\tconst startIndex = indexBefore;\n\t\tconst endIndex = start - 2;\n\n\t\tif ( startIndex === endIndex ) {\n\t\t\treturn value;\n\t\t}\n\n\t\tvalue = remove( value, startIndex, startIndex + 1 );\n\t\tvalue = remove( value, endIndex, endIndex + 1 );\n\t\tvalue = applyFormat( value, { type: name }, startIndex, endIndex );\n\n\t\treturn value;\n\t},\n\tedit( { value, onChange, onFocus, isActive } ) {\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=\"x\"\n\t\t\t\t\tonUse={ onClick }\n\t\t\t\t/>\n\t\t\t\t<RichTextToolbarButton\n\t\t\t\t\ticon={ codeIcon }\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": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA0DG;AAvDH,kBAAmB;AACnB,uBAAkD;AAClD,0BAGO;AACP,mBAAiC;AAEjC,MAAM,OAAO;AACb,MAAM,YAAQ,gBAAI,aAAc;AAEzB,MAAM,OAAO;AAAA,EACnB;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,WAAW;AAAA,EACX,oBAAqB,OAAQ;AAC5B,UAAM,WAAW;AACjB,UAAM,EAAE,OAAO,KAAK,IAAI;AACxB,UAAM,kBAAkB,KAAM,QAAQ,CAAE;AAGxC,QAAK,oBAAoB,UAAW;AACnC,aAAO;AAAA,IACR;AAEA,QAAK,QAAQ,IAAI,GAAI;AACpB,aAAO;AAAA,IACR;AAEA,UAAM,cAAc,KAAK,YAAa,UAAU,QAAQ,CAAE;AAC1D,QAAK,gBAAgB,IAAK;AACzB,aAAO;AAAA,IACR;AAEA,UAAM,aAAa;AACnB,UAAM,WAAW,QAAQ;AAEzB,QAAK,eAAe,UAAW;AAC9B,aAAO;AAAA,IACR;AAEA,gBAAQ,yBAAQ,OAAO,YAAY,aAAa,CAAE;AAClD,gBAAQ,yBAAQ,OAAO,UAAU,WAAW,CAAE;AAC9C,gBAAQ,8BAAa,OAAO,EAAE,MAAM,KAAK,GAAG,YAAY,QAAS;AAEjE,WAAO;AAAA,EACR;AAAA,EACA,KAAM,EAAE,OAAO,UAAU,SAAS,SAAS,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,aAAAA;AAAA,UACP;AAAA,UACA;AAAA,UACA;AAAA,UACA,MAAK;AAAA;AAAA,MACN;AAAA,OACD;AAAA,EAEF;AACD;",
|
|
6
|
+
"names": ["codeIcon"]
|
|
7
|
+
}
|
package/build/default-formats.js
CHANGED
|
@@ -1,25 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var default_formats_exports = {};
|
|
19
|
+
__export(default_formats_exports, {
|
|
20
|
+
default: () => default_formats_default
|
|
5
21
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
module.exports = __toCommonJS(default_formats_exports);
|
|
23
|
+
var import_bold = require("./bold");
|
|
24
|
+
var import_code = require("./code");
|
|
25
|
+
var import_image = require("./image");
|
|
26
|
+
var import_italic = require("./italic");
|
|
27
|
+
var import_link = require("./link");
|
|
28
|
+
var import_strikethrough = require("./strikethrough");
|
|
29
|
+
var import_underline = require("./underline");
|
|
30
|
+
var import_text_color = require("./text-color");
|
|
31
|
+
var import_subscript = require("./subscript");
|
|
32
|
+
var import_superscript = require("./superscript");
|
|
33
|
+
var import_keyboard = require("./keyboard");
|
|
34
|
+
var import_unknown = require("./unknown");
|
|
35
|
+
var import_language = require("./language");
|
|
36
|
+
var import_non_breaking_space = require("./non-breaking-space");
|
|
37
|
+
var default_formats_default = [
|
|
38
|
+
import_bold.bold,
|
|
39
|
+
import_code.code,
|
|
40
|
+
import_image.image,
|
|
41
|
+
import_italic.italic,
|
|
42
|
+
import_link.link,
|
|
43
|
+
import_strikethrough.strikethrough,
|
|
44
|
+
import_underline.underline,
|
|
45
|
+
import_text_color.textColor,
|
|
46
|
+
import_subscript.subscript,
|
|
47
|
+
import_superscript.superscript,
|
|
48
|
+
import_keyboard.keyboard,
|
|
49
|
+
import_unknown.unknown,
|
|
50
|
+
import_language.language,
|
|
51
|
+
import_non_breaking_space.nonBreakingSpace
|
|
52
|
+
];
|
|
53
|
+
//# sourceMappingURL=default-formats.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/default-formats.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { bold } from './bold';\nimport { code } from './code';\nimport { image } from './image';\nimport { italic } from './italic';\nimport { link } from './link';\nimport { strikethrough } from './strikethrough';\nimport { underline } from './underline';\nimport { textColor } from './text-color';\nimport { subscript } from './subscript';\nimport { superscript } from './superscript';\nimport { keyboard } from './keyboard';\nimport { unknown } from './unknown';\nimport { language } from './language';\nimport { nonBreakingSpace } from './non-breaking-space';\n\nexport default [\n\tbold,\n\tcode,\n\timage,\n\titalic,\n\tlink,\n\tstrikethrough,\n\tunderline,\n\ttextColor,\n\tsubscript,\n\tsuperscript,\n\tkeyboard,\n\tunknown,\n\tlanguage,\n\tnonBreakingSpace,\n];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAqB;AACrB,kBAAqB;AACrB,mBAAsB;AACtB,oBAAuB;AACvB,kBAAqB;AACrB,2BAA8B;AAC9B,uBAA0B;AAC1B,wBAA0B;AAC1B,uBAA0B;AAC1B,yBAA4B;AAC5B,sBAAyB;AACzB,qBAAwB;AACxB,sBAAyB;AACzB,gCAAiC;AAEjC,IAAO,0BAAQ;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|