@tiptap/extension-subscript 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +5 -1
- package/dist/index.cjs +78 -57
- package/dist/index.cjs.map +1 -1
- package/dist/{packages/extension-subscript/src/subscript.d.ts → index.d.cts} +6 -3
- package/dist/index.d.ts +38 -0
- package/dist/index.js +53 -54
- package/dist/index.js.map +1 -1
- package/package.json +13 -9
- package/src/subscript.ts +20 -14
- package/dist/index.umd.js +0 -65
- package/dist/index.umd.js.map +0 -1
- package/dist/packages/core/src/CommandManager.d.ts +0 -20
- package/dist/packages/core/src/Editor.d.ts +0 -161
- package/dist/packages/core/src/EventEmitter.d.ts +0 -11
- package/dist/packages/core/src/Extension.d.ts +0 -343
- package/dist/packages/core/src/ExtensionManager.d.ts +0 -55
- package/dist/packages/core/src/InputRule.d.ts +0 -42
- package/dist/packages/core/src/Mark.d.ts +0 -451
- package/dist/packages/core/src/Node.d.ts +0 -611
- package/dist/packages/core/src/NodePos.d.ts +0 -44
- package/dist/packages/core/src/NodeView.d.ts +0 -31
- package/dist/packages/core/src/PasteRule.d.ts +0 -50
- package/dist/packages/core/src/Tracker.d.ts +0 -11
- package/dist/packages/core/src/commands/blur.d.ts +0 -13
- package/dist/packages/core/src/commands/clearContent.d.ts +0 -14
- package/dist/packages/core/src/commands/clearNodes.d.ts +0 -13
- package/dist/packages/core/src/commands/command.d.ts +0 -18
- package/dist/packages/core/src/commands/createParagraphNear.d.ts +0 -13
- package/dist/packages/core/src/commands/cut.d.ts +0 -20
- package/dist/packages/core/src/commands/deleteCurrentNode.d.ts +0 -13
- package/dist/packages/core/src/commands/deleteNode.d.ts +0 -15
- package/dist/packages/core/src/commands/deleteRange.d.ts +0 -14
- package/dist/packages/core/src/commands/deleteSelection.d.ts +0 -13
- package/dist/packages/core/src/commands/enter.d.ts +0 -13
- package/dist/packages/core/src/commands/exitCode.d.ts +0 -13
- package/dist/packages/core/src/commands/extendMarkRange.d.ts +0 -25
- package/dist/packages/core/src/commands/first.d.ts +0 -14
- package/dist/packages/core/src/commands/focus.d.ts +0 -27
- package/dist/packages/core/src/commands/forEach.d.ts +0 -14
- package/dist/packages/core/src/commands/index.d.ts +0 -55
- package/dist/packages/core/src/commands/insertContent.d.ts +0 -34
- package/dist/packages/core/src/commands/insertContentAt.d.ts +0 -47
- package/dist/packages/core/src/commands/join.d.ts +0 -41
- package/dist/packages/core/src/commands/joinItemBackward.d.ts +0 -13
- package/dist/packages/core/src/commands/joinItemForward.d.ts +0 -13
- package/dist/packages/core/src/commands/joinTextblockBackward.d.ts +0 -12
- package/dist/packages/core/src/commands/joinTextblockForward.d.ts +0 -12
- package/dist/packages/core/src/commands/keyboardShortcut.d.ts +0 -14
- package/dist/packages/core/src/commands/lift.d.ts +0 -17
- package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +0 -13
- package/dist/packages/core/src/commands/liftListItem.d.ts +0 -15
- package/dist/packages/core/src/commands/newlineInCode.d.ts +0 -13
- package/dist/packages/core/src/commands/resetAttributes.d.ts +0 -16
- package/dist/packages/core/src/commands/scrollIntoView.d.ts +0 -13
- package/dist/packages/core/src/commands/selectAll.d.ts +0 -13
- package/dist/packages/core/src/commands/selectNodeBackward.d.ts +0 -13
- package/dist/packages/core/src/commands/selectNodeForward.d.ts +0 -13
- package/dist/packages/core/src/commands/selectParentNode.d.ts +0 -13
- package/dist/packages/core/src/commands/selectTextblockEnd.d.ts +0 -13
- package/dist/packages/core/src/commands/selectTextblockStart.d.ts +0 -13
- package/dist/packages/core/src/commands/setContent.d.ts +0 -40
- package/dist/packages/core/src/commands/setMark.d.ts +0 -15
- package/dist/packages/core/src/commands/setMeta.d.ts +0 -15
- package/dist/packages/core/src/commands/setNode.d.ts +0 -16
- package/dist/packages/core/src/commands/setNodeSelection.d.ts +0 -14
- package/dist/packages/core/src/commands/setTextSelection.d.ts +0 -14
- package/dist/packages/core/src/commands/sinkListItem.d.ts +0 -15
- package/dist/packages/core/src/commands/splitBlock.d.ts +0 -17
- package/dist/packages/core/src/commands/splitListItem.d.ts +0 -15
- package/dist/packages/core/src/commands/toggleList.d.ts +0 -18
- package/dist/packages/core/src/commands/toggleMark.d.ts +0 -30
- package/dist/packages/core/src/commands/toggleNode.d.ts +0 -17
- package/dist/packages/core/src/commands/toggleWrap.d.ts +0 -16
- package/dist/packages/core/src/commands/undoInputRule.d.ts +0 -13
- package/dist/packages/core/src/commands/unsetAllMarks.d.ts +0 -13
- package/dist/packages/core/src/commands/unsetMark.d.ts +0 -25
- package/dist/packages/core/src/commands/updateAttributes.d.ts +0 -24
- package/dist/packages/core/src/commands/wrapIn.d.ts +0 -16
- package/dist/packages/core/src/commands/wrapInList.d.ts +0 -16
- package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +0 -5
- package/dist/packages/core/src/extensions/commands.d.ts +0 -3
- package/dist/packages/core/src/extensions/editable.d.ts +0 -2
- package/dist/packages/core/src/extensions/focusEvents.d.ts +0 -2
- package/dist/packages/core/src/extensions/index.d.ts +0 -6
- package/dist/packages/core/src/extensions/keymap.d.ts +0 -2
- package/dist/packages/core/src/extensions/tabindex.d.ts +0 -2
- package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +0 -10
- package/dist/packages/core/src/helpers/createChainableState.d.ts +0 -10
- package/dist/packages/core/src/helpers/createDocument.d.ts +0 -12
- package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +0 -15
- package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +0 -7
- package/dist/packages/core/src/helpers/findChildren.d.ts +0 -9
- package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +0 -10
- package/dist/packages/core/src/helpers/findParentNode.d.ts +0 -16
- package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +0 -17
- package/dist/packages/core/src/helpers/generateHTML.d.ts +0 -8
- package/dist/packages/core/src/helpers/generateJSON.d.ts +0 -8
- package/dist/packages/core/src/helpers/generateText.d.ts +0 -12
- package/dist/packages/core/src/helpers/getAttributes.d.ts +0 -9
- package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +0 -6
- package/dist/packages/core/src/helpers/getChangedRanges.d.ts +0 -11
- package/dist/packages/core/src/helpers/getDebugJSON.d.ts +0 -8
- package/dist/packages/core/src/helpers/getExtensionField.d.ts +0 -9
- package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +0 -2
- package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getMarkRange.d.ts +0 -3
- package/dist/packages/core/src/helpers/getMarkType.d.ts +0 -2
- package/dist/packages/core/src/helpers/getMarksBetween.d.ts +0 -3
- package/dist/packages/core/src/helpers/getNodeAtPosition.d.ts +0 -11
- package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getNodeType.d.ts +0 -2
- package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getSchema.d.ts +0 -4
- package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +0 -10
- package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +0 -8
- package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +0 -8
- package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +0 -9
- package/dist/packages/core/src/helpers/getText.d.ts +0 -15
- package/dist/packages/core/src/helpers/getTextBetween.d.ts +0 -14
- package/dist/packages/core/src/helpers/getTextContentFromNodes.d.ts +0 -8
- package/dist/packages/core/src/helpers/getTextSerializersFromSchema.d.ts +0 -8
- package/dist/packages/core/src/helpers/index.d.ts +0 -50
- package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +0 -9
- package/dist/packages/core/src/helpers/isActive.d.ts +0 -2
- package/dist/packages/core/src/helpers/isAtEndOfNode.d.ts +0 -2
- package/dist/packages/core/src/helpers/isAtStartOfNode.d.ts +0 -2
- package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +0 -2
- package/dist/packages/core/src/helpers/isList.d.ts +0 -2
- package/dist/packages/core/src/helpers/isMarkActive.d.ts +0 -3
- package/dist/packages/core/src/helpers/isNodeActive.d.ts +0 -3
- package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +0 -2
- package/dist/packages/core/src/helpers/isNodeSelection.d.ts +0 -2
- package/dist/packages/core/src/helpers/isTextSelection.d.ts +0 -2
- package/dist/packages/core/src/helpers/posToDOMRect.d.ts +0 -2
- package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +0 -4
- package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +0 -2
- package/dist/packages/core/src/helpers/splitExtensions.d.ts +0 -9
- package/dist/packages/core/src/index.d.ts +0 -24
- package/dist/packages/core/src/inputRules/index.d.ts +0 -5
- package/dist/packages/core/src/inputRules/markInputRule.d.ts +0 -13
- package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +0 -23
- package/dist/packages/core/src/inputRules/textInputRule.d.ts +0 -10
- package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +0 -15
- package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +0 -28
- package/dist/packages/core/src/pasteRules/index.d.ts +0 -3
- package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +0 -13
- package/dist/packages/core/src/pasteRules/nodePasteRule.d.ts +0 -13
- package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +0 -10
- package/dist/packages/core/src/style.d.ts +0 -1
- package/dist/packages/core/src/types.d.ts +0 -255
- package/dist/packages/core/src/utilities/callOrReturn.d.ts +0 -9
- package/dist/packages/core/src/utilities/createStyleTag.d.ts +0 -1
- package/dist/packages/core/src/utilities/deleteProps.d.ts +0 -6
- package/dist/packages/core/src/utilities/elementFromString.d.ts +0 -1
- package/dist/packages/core/src/utilities/escapeForRegEx.d.ts +0 -1
- package/dist/packages/core/src/utilities/findDuplicates.d.ts +0 -1
- package/dist/packages/core/src/utilities/fromString.d.ts +0 -1
- package/dist/packages/core/src/utilities/index.d.ts +0 -20
- package/dist/packages/core/src/utilities/isAndroid.d.ts +0 -1
- package/dist/packages/core/src/utilities/isEmptyObject.d.ts +0 -1
- package/dist/packages/core/src/utilities/isFunction.d.ts +0 -1
- package/dist/packages/core/src/utilities/isMacOS.d.ts +0 -1
- package/dist/packages/core/src/utilities/isNumber.d.ts +0 -1
- package/dist/packages/core/src/utilities/isPlainObject.d.ts +0 -1
- package/dist/packages/core/src/utilities/isRegExp.d.ts +0 -1
- package/dist/packages/core/src/utilities/isString.d.ts +0 -1
- package/dist/packages/core/src/utilities/isiOS.d.ts +0 -1
- package/dist/packages/core/src/utilities/mergeAttributes.d.ts +0 -1
- package/dist/packages/core/src/utilities/mergeDeep.d.ts +0 -1
- package/dist/packages/core/src/utilities/minMax.d.ts +0 -1
- package/dist/packages/core/src/utilities/objectIncludes.d.ts +0 -8
- package/dist/packages/core/src/utilities/removeDuplicates.d.ts +0 -8
- package/dist/packages/extension-subscript/src/index.d.ts +0 -3
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025, Tiptap GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
# @tiptap/extension-subscript
|
|
2
|
+
|
|
2
3
|
[](https://www.npmjs.com/package/@tiptap/extension-subscript)
|
|
3
4
|
[](https://npmcharts.com/compare/tiptap?minimal=true)
|
|
4
5
|
[](https://www.npmjs.com/package/@tiptap/extension-subscript)
|
|
5
6
|
[](https://github.com/sponsors/ueberdosis)
|
|
6
7
|
|
|
7
8
|
## Introduction
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
Tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a toolkit for building rich text WYSIWYG editors, which is already in use at many well-known companies such as _New York Times_, _The Guardian_ or _Atlassian_.
|
|
9
11
|
|
|
10
12
|
## Official Documentation
|
|
13
|
+
|
|
11
14
|
Documentation can be found on the [Tiptap website](https://tiptap.dev).
|
|
12
15
|
|
|
13
16
|
## License
|
|
17
|
+
|
|
14
18
|
Tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap/blob/main/LICENSE.md).
|
package/dist/index.cjs
CHANGED
|
@@ -1,61 +1,82 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2
19
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
Subscript: () => Subscript,
|
|
24
|
+
default: () => index_default
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
6
27
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return {
|
|
54
|
-
'Mod-,': () => this.editor.commands.toggleSubscript(),
|
|
55
|
-
};
|
|
56
|
-
},
|
|
28
|
+
// src/subscript.ts
|
|
29
|
+
var import_core = require("@tiptap/core");
|
|
30
|
+
var Subscript = import_core.Mark.create({
|
|
31
|
+
name: "subscript",
|
|
32
|
+
addOptions() {
|
|
33
|
+
return {
|
|
34
|
+
HTMLAttributes: {}
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
parseHTML() {
|
|
38
|
+
return [
|
|
39
|
+
{
|
|
40
|
+
tag: "sub"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
style: "vertical-align",
|
|
44
|
+
getAttrs(value) {
|
|
45
|
+
if (value !== "sub") {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
];
|
|
52
|
+
},
|
|
53
|
+
renderHTML({ HTMLAttributes }) {
|
|
54
|
+
return ["sub", (0, import_core.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
55
|
+
},
|
|
56
|
+
addCommands() {
|
|
57
|
+
return {
|
|
58
|
+
setSubscript: () => ({ commands }) => {
|
|
59
|
+
return commands.setMark(this.name);
|
|
60
|
+
},
|
|
61
|
+
toggleSubscript: () => ({ commands }) => {
|
|
62
|
+
return commands.toggleMark(this.name);
|
|
63
|
+
},
|
|
64
|
+
unsetSubscript: () => ({ commands }) => {
|
|
65
|
+
return commands.unsetMark(this.name);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
addKeyboardShortcuts() {
|
|
70
|
+
return {
|
|
71
|
+
"Mod-,": () => this.editor.commands.toggleSubscript()
|
|
72
|
+
};
|
|
73
|
+
}
|
|
57
74
|
});
|
|
58
75
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
76
|
+
// src/index.ts
|
|
77
|
+
var index_default = Subscript;
|
|
78
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
79
|
+
0 && (module.exports = {
|
|
80
|
+
Subscript
|
|
81
|
+
});
|
|
82
|
+
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/subscript.ts"],"sourcesContent":["import { Subscript } from './subscript.js'\n\nexport * from './subscript.js'\n\nexport default Subscript\n","import { Mark, mergeAttributes } from '@tiptap/core'\nimport type { StyleParseRule } from '@tiptap/pm/model'\n\nexport interface SubscriptExtensionOptions {\n /**\n * HTML attributes to add to the subscript element.\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n subscript: {\n /**\n * Set a subscript mark\n * @example editor.commands.setSubscript()\n */\n setSubscript: () => ReturnType\n /**\n * Toggle a subscript mark\n * @example editor.commands.toggleSubscript()\n */\n toggleSubscript: () => ReturnType\n /**\n * Unset a subscript mark\n * @example editor.commands.unsetSubscript()\n */\n unsetSubscript: () => ReturnType\n }\n }\n}\n\n/**\n * This extension allows you to create subscript text.\n * @see https://www.tiptap.dev/api/marks/subscript\n */\nexport const Subscript = Mark.create<SubscriptExtensionOptions>({\n name: 'subscript',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n }\n },\n\n parseHTML() {\n return [\n {\n tag: 'sub',\n },\n {\n style: 'vertical-align',\n getAttrs(value) {\n // Don’t match this rule if the vertical align isn’t sub.\n if (value !== 'sub') {\n return false\n }\n\n // If it falls through we’ll match, and this mark will be applied.\n return null\n },\n } as StyleParseRule,\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['sub', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n addCommands() {\n return {\n setSubscript:\n () =>\n ({ commands }) => {\n return commands.setMark(this.name)\n },\n toggleSubscript:\n () =>\n ({ commands }) => {\n return commands.toggleMark(this.name)\n },\n unsetSubscript:\n () =>\n ({ commands }) => {\n return commands.unsetMark(this.name)\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-,': () => this.editor.commands.toggleSubscript(),\n }\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAsC;AAsC/B,IAAM,YAAY,iBAAK,OAAkC;AAAA,EAC9D,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,gBAAgB,CAAC;AAAA,IACnB;AAAA,EACF;AAAA,EAEA,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MACP;AAAA,MACA;AAAA,QACE,OAAO;AAAA,QACP,SAAS,OAAO;AAEd,cAAI,UAAU,OAAO;AACnB,mBAAO;AAAA,UACT;AAGA,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,WAAW,EAAE,eAAe,GAAG;AAC7B,WAAO,CAAC,WAAO,6BAAgB,KAAK,QAAQ,gBAAgB,cAAc,GAAG,CAAC;AAAA,EAChF;AAAA,EAEA,cAAc;AACZ,WAAO;AAAA,MACL,cACE,MACA,CAAC,EAAE,SAAS,MAAM;AAChB,eAAO,SAAS,QAAQ,KAAK,IAAI;AAAA,MACnC;AAAA,MACF,iBACE,MACA,CAAC,EAAE,SAAS,MAAM;AAChB,eAAO,SAAS,WAAW,KAAK,IAAI;AAAA,MACtC;AAAA,MACF,gBACE,MACA,CAAC,EAAE,SAAS,MAAM;AAChB,eAAO,SAAS,UAAU,KAAK,IAAI;AAAA,MACrC;AAAA,IACJ;AAAA,EACF;AAAA,EAEA,uBAAuB;AACrB,WAAO;AAAA,MACL,SAAS,MAAM,KAAK,OAAO,SAAS,gBAAgB;AAAA,IACtD;AAAA,EACF;AACF,CAAC;;;AD5FD,IAAO,gBAAQ;","names":[]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Mark } from '@tiptap/core';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
interface SubscriptExtensionOptions {
|
|
3
4
|
/**
|
|
4
5
|
* HTML attributes to add to the subscript element.
|
|
5
6
|
* @default {}
|
|
6
7
|
* @example { class: 'foo' }
|
|
7
8
|
*/
|
|
8
|
-
HTMLAttributes:
|
|
9
|
+
HTMLAttributes: Record<string, any>;
|
|
9
10
|
}
|
|
10
11
|
declare module '@tiptap/core' {
|
|
11
12
|
interface Commands<ReturnType> {
|
|
@@ -32,4 +33,6 @@ declare module '@tiptap/core' {
|
|
|
32
33
|
* This extension allows you to create subscript text.
|
|
33
34
|
* @see https://www.tiptap.dev/api/marks/subscript
|
|
34
35
|
*/
|
|
35
|
-
|
|
36
|
+
declare const Subscript: Mark<SubscriptExtensionOptions, any>;
|
|
37
|
+
|
|
38
|
+
export { Subscript, type SubscriptExtensionOptions, Subscript as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Mark } from '@tiptap/core';
|
|
2
|
+
|
|
3
|
+
interface SubscriptExtensionOptions {
|
|
4
|
+
/**
|
|
5
|
+
* HTML attributes to add to the subscript element.
|
|
6
|
+
* @default {}
|
|
7
|
+
* @example { class: 'foo' }
|
|
8
|
+
*/
|
|
9
|
+
HTMLAttributes: Record<string, any>;
|
|
10
|
+
}
|
|
11
|
+
declare module '@tiptap/core' {
|
|
12
|
+
interface Commands<ReturnType> {
|
|
13
|
+
subscript: {
|
|
14
|
+
/**
|
|
15
|
+
* Set a subscript mark
|
|
16
|
+
* @example editor.commands.setSubscript()
|
|
17
|
+
*/
|
|
18
|
+
setSubscript: () => ReturnType;
|
|
19
|
+
/**
|
|
20
|
+
* Toggle a subscript mark
|
|
21
|
+
* @example editor.commands.toggleSubscript()
|
|
22
|
+
*/
|
|
23
|
+
toggleSubscript: () => ReturnType;
|
|
24
|
+
/**
|
|
25
|
+
* Unset a subscript mark
|
|
26
|
+
* @example editor.commands.unsetSubscript()
|
|
27
|
+
*/
|
|
28
|
+
unsetSubscript: () => ReturnType;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* This extension allows you to create subscript text.
|
|
34
|
+
* @see https://www.tiptap.dev/api/marks/subscript
|
|
35
|
+
*/
|
|
36
|
+
declare const Subscript: Mark<SubscriptExtensionOptions, any>;
|
|
37
|
+
|
|
38
|
+
export { Subscript, type SubscriptExtensionOptions, Subscript as default };
|
package/dist/index.js
CHANGED
|
@@ -1,56 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
},
|
|
48
|
-
addKeyboardShortcuts() {
|
|
49
|
-
return {
|
|
50
|
-
'Mod-,': () => this.editor.commands.toggleSubscript(),
|
|
51
|
-
};
|
|
52
|
-
},
|
|
1
|
+
// src/subscript.ts
|
|
2
|
+
import { Mark, mergeAttributes } from "@tiptap/core";
|
|
3
|
+
var Subscript = Mark.create({
|
|
4
|
+
name: "subscript",
|
|
5
|
+
addOptions() {
|
|
6
|
+
return {
|
|
7
|
+
HTMLAttributes: {}
|
|
8
|
+
};
|
|
9
|
+
},
|
|
10
|
+
parseHTML() {
|
|
11
|
+
return [
|
|
12
|
+
{
|
|
13
|
+
tag: "sub"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
style: "vertical-align",
|
|
17
|
+
getAttrs(value) {
|
|
18
|
+
if (value !== "sub") {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
];
|
|
25
|
+
},
|
|
26
|
+
renderHTML({ HTMLAttributes }) {
|
|
27
|
+
return ["sub", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
28
|
+
},
|
|
29
|
+
addCommands() {
|
|
30
|
+
return {
|
|
31
|
+
setSubscript: () => ({ commands }) => {
|
|
32
|
+
return commands.setMark(this.name);
|
|
33
|
+
},
|
|
34
|
+
toggleSubscript: () => ({ commands }) => {
|
|
35
|
+
return commands.toggleMark(this.name);
|
|
36
|
+
},
|
|
37
|
+
unsetSubscript: () => ({ commands }) => {
|
|
38
|
+
return commands.unsetMark(this.name);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
addKeyboardShortcuts() {
|
|
43
|
+
return {
|
|
44
|
+
"Mod-,": () => this.editor.commands.toggleSubscript()
|
|
45
|
+
};
|
|
46
|
+
}
|
|
53
47
|
});
|
|
54
48
|
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
// src/index.ts
|
|
50
|
+
var index_default = Subscript;
|
|
51
|
+
export {
|
|
52
|
+
Subscript,
|
|
53
|
+
index_default as default
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/subscript.ts","../src/index.ts"],"sourcesContent":["import { Mark, mergeAttributes } from '@tiptap/core'\nimport type { StyleParseRule } from '@tiptap/pm/model'\n\nexport interface SubscriptExtensionOptions {\n /**\n * HTML attributes to add to the subscript element.\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n subscript: {\n /**\n * Set a subscript mark\n * @example editor.commands.setSubscript()\n */\n setSubscript: () => ReturnType\n /**\n * Toggle a subscript mark\n * @example editor.commands.toggleSubscript()\n */\n toggleSubscript: () => ReturnType\n /**\n * Unset a subscript mark\n * @example editor.commands.unsetSubscript()\n */\n unsetSubscript: () => ReturnType\n }\n }\n}\n\n/**\n * This extension allows you to create subscript text.\n * @see https://www.tiptap.dev/api/marks/subscript\n */\nexport const Subscript = Mark.create<SubscriptExtensionOptions>({\n name: 'subscript',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n }\n },\n\n parseHTML() {\n return [\n {\n tag: 'sub',\n },\n {\n style: 'vertical-align',\n getAttrs(value) {\n // Don’t match this rule if the vertical align isn’t sub.\n if (value !== 'sub') {\n return false\n }\n\n // If it falls through we’ll match, and this mark will be applied.\n return null\n },\n } as StyleParseRule,\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['sub', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n addCommands() {\n return {\n setSubscript:\n () =>\n ({ commands }) => {\n return commands.setMark(this.name)\n },\n toggleSubscript:\n () =>\n ({ commands }) => {\n return commands.toggleMark(this.name)\n },\n unsetSubscript:\n () =>\n ({ commands }) => {\n return commands.unsetMark(this.name)\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-,': () => this.editor.commands.toggleSubscript(),\n }\n },\n})\n","import { Subscript } from './subscript.js'\n\nexport * from './subscript.js'\n\nexport default Subscript\n"],"mappings":";AAAA,SAAS,MAAM,uBAAuB;AAsC/B,IAAM,YAAY,KAAK,OAAkC;AAAA,EAC9D,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,gBAAgB,CAAC;AAAA,IACnB;AAAA,EACF;AAAA,EAEA,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MACP;AAAA,MACA;AAAA,QACE,OAAO;AAAA,QACP,SAAS,OAAO;AAEd,cAAI,UAAU,OAAO;AACnB,mBAAO;AAAA,UACT;AAGA,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,WAAW,EAAE,eAAe,GAAG;AAC7B,WAAO,CAAC,OAAO,gBAAgB,KAAK,QAAQ,gBAAgB,cAAc,GAAG,CAAC;AAAA,EAChF;AAAA,EAEA,cAAc;AACZ,WAAO;AAAA,MACL,cACE,MACA,CAAC,EAAE,SAAS,MAAM;AAChB,eAAO,SAAS,QAAQ,KAAK,IAAI;AAAA,MACnC;AAAA,MACF,iBACE,MACA,CAAC,EAAE,SAAS,MAAM;AAChB,eAAO,SAAS,WAAW,KAAK,IAAI;AAAA,MACtC;AAAA,MACF,gBACE,MACA,CAAC,EAAE,SAAS,MAAM;AAChB,eAAO,SAAS,UAAU,KAAK,IAAI;AAAA,MACrC;AAAA,IACJ;AAAA,EACF;AAAA,EAEA,uBAAuB;AACrB,WAAO;AAAA,MACL,SAAS,MAAM,KAAK,OAAO,SAAS,gBAAgB;AAAA,IACtD;AAAA,EACF;AACF,CAAC;;;AC5FD,IAAO,gBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiptap/extension-subscript",
|
|
3
3
|
"description": "subscript extension for tiptap",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.2",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -15,24 +15,28 @@
|
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
-
"types":
|
|
18
|
+
"types": {
|
|
19
|
+
"import": "./dist/index.d.ts",
|
|
20
|
+
"require": "./dist/index.d.cts"
|
|
21
|
+
},
|
|
19
22
|
"import": "./dist/index.js",
|
|
20
23
|
"require": "./dist/index.cjs"
|
|
21
24
|
}
|
|
22
25
|
},
|
|
23
26
|
"main": "dist/index.cjs",
|
|
24
27
|
"module": "dist/index.js",
|
|
25
|
-
"
|
|
26
|
-
"types": "dist/packages/extension-subscript/src/index.d.ts",
|
|
28
|
+
"types": "dist/index.d.ts",
|
|
27
29
|
"files": [
|
|
28
30
|
"src",
|
|
29
31
|
"dist"
|
|
30
32
|
],
|
|
31
33
|
"devDependencies": {
|
|
32
|
-
"@tiptap/core": "^3.0.
|
|
34
|
+
"@tiptap/core": "^3.0.2",
|
|
35
|
+
"@tiptap/pm": "^3.0.2"
|
|
33
36
|
},
|
|
34
37
|
"peerDependencies": {
|
|
35
|
-
"@tiptap/core": "^3.0.
|
|
38
|
+
"@tiptap/core": "^3.0.2",
|
|
39
|
+
"@tiptap/pm": "^3.0.2"
|
|
36
40
|
},
|
|
37
41
|
"repository": {
|
|
38
42
|
"type": "git",
|
|
@@ -40,7 +44,7 @@
|
|
|
40
44
|
"directory": "packages/extension-subscript"
|
|
41
45
|
},
|
|
42
46
|
"scripts": {
|
|
43
|
-
"
|
|
44
|
-
"
|
|
47
|
+
"build": "tsup",
|
|
48
|
+
"lint": "prettier ./src/ --check && eslint --cache --quiet --no-error-on-unmatched-pattern ./src/"
|
|
45
49
|
}
|
|
46
|
-
}
|
|
50
|
+
}
|
package/src/subscript.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface SubscriptExtensionOptions {
|
|
|
7
7
|
* @default {}
|
|
8
8
|
* @example { class: 'foo' }
|
|
9
9
|
*/
|
|
10
|
-
HTMLAttributes:
|
|
10
|
+
HTMLAttributes: Record<string, any>
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
declare module '@tiptap/core' {
|
|
@@ -17,17 +17,17 @@ declare module '@tiptap/core' {
|
|
|
17
17
|
* Set a subscript mark
|
|
18
18
|
* @example editor.commands.setSubscript()
|
|
19
19
|
*/
|
|
20
|
-
setSubscript: () => ReturnType
|
|
20
|
+
setSubscript: () => ReturnType
|
|
21
21
|
/**
|
|
22
22
|
* Toggle a subscript mark
|
|
23
23
|
* @example editor.commands.toggleSubscript()
|
|
24
24
|
*/
|
|
25
|
-
toggleSubscript: () => ReturnType
|
|
25
|
+
toggleSubscript: () => ReturnType
|
|
26
26
|
/**
|
|
27
27
|
* Unset a subscript mark
|
|
28
28
|
* @example editor.commands.unsetSubscript()
|
|
29
29
|
*/
|
|
30
|
-
unsetSubscript: () => ReturnType
|
|
30
|
+
unsetSubscript: () => ReturnType
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -61,7 +61,7 @@ export const Subscript = Mark.create<SubscriptExtensionOptions>({
|
|
|
61
61
|
// If it falls through we’ll match, and this mark will be applied.
|
|
62
62
|
return null
|
|
63
63
|
},
|
|
64
|
-
}
|
|
64
|
+
} as StyleParseRule,
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
67
|
|
|
@@ -71,15 +71,21 @@ export const Subscript = Mark.create<SubscriptExtensionOptions>({
|
|
|
71
71
|
|
|
72
72
|
addCommands() {
|
|
73
73
|
return {
|
|
74
|
-
setSubscript:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
74
|
+
setSubscript:
|
|
75
|
+
() =>
|
|
76
|
+
({ commands }) => {
|
|
77
|
+
return commands.setMark(this.name)
|
|
78
|
+
},
|
|
79
|
+
toggleSubscript:
|
|
80
|
+
() =>
|
|
81
|
+
({ commands }) => {
|
|
82
|
+
return commands.toggleMark(this.name)
|
|
83
|
+
},
|
|
84
|
+
unsetSubscript:
|
|
85
|
+
() =>
|
|
86
|
+
({ commands }) => {
|
|
87
|
+
return commands.unsetMark(this.name)
|
|
88
|
+
},
|
|
83
89
|
}
|
|
84
90
|
},
|
|
85
91
|
|
package/dist/index.umd.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tiptap/core')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@tiptap/core'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@tiptap/extension-subscript"] = {}, global.core));
|
|
5
|
-
})(this, (function (exports, core) { 'use strict';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* This extension allows you to create subscript text.
|
|
9
|
-
* @see https://www.tiptap.dev/api/marks/subscript
|
|
10
|
-
*/
|
|
11
|
-
const Subscript = core.Mark.create({
|
|
12
|
-
name: 'subscript',
|
|
13
|
-
addOptions() {
|
|
14
|
-
return {
|
|
15
|
-
HTMLAttributes: {},
|
|
16
|
-
};
|
|
17
|
-
},
|
|
18
|
-
parseHTML() {
|
|
19
|
-
return [
|
|
20
|
-
{
|
|
21
|
-
tag: 'sub',
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
style: 'vertical-align',
|
|
25
|
-
getAttrs(value) {
|
|
26
|
-
// Don’t match this rule if the vertical align isn’t sub.
|
|
27
|
-
if (value !== 'sub') {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
// If it falls through we’ll match, and this mark will be applied.
|
|
31
|
-
return null;
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
];
|
|
35
|
-
},
|
|
36
|
-
renderHTML({ HTMLAttributes }) {
|
|
37
|
-
return ['sub', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
38
|
-
},
|
|
39
|
-
addCommands() {
|
|
40
|
-
return {
|
|
41
|
-
setSubscript: () => ({ commands }) => {
|
|
42
|
-
return commands.setMark(this.name);
|
|
43
|
-
},
|
|
44
|
-
toggleSubscript: () => ({ commands }) => {
|
|
45
|
-
return commands.toggleMark(this.name);
|
|
46
|
-
},
|
|
47
|
-
unsetSubscript: () => ({ commands }) => {
|
|
48
|
-
return commands.unsetMark(this.name);
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
},
|
|
52
|
-
addKeyboardShortcuts() {
|
|
53
|
-
return {
|
|
54
|
-
'Mod-,': () => this.editor.commands.toggleSubscript(),
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
exports.Subscript = Subscript;
|
|
60
|
-
exports.default = Subscript;
|
|
61
|
-
|
|
62
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
63
|
-
|
|
64
|
-
}));
|
|
65
|
-
//# sourceMappingURL=index.umd.js.map
|
package/dist/index.umd.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../src/subscript.ts"],"sourcesContent":["import { Mark, mergeAttributes } from '@tiptap/core'\nimport type { StyleParseRule } from '@tiptap/pm/model'\n\nexport interface SubscriptExtensionOptions {\n /**\n * HTML attributes to add to the subscript element.\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Object,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n subscript: {\n /**\n * Set a subscript mark\n * @example editor.commands.setSubscript()\n */\n setSubscript: () => ReturnType,\n /**\n * Toggle a subscript mark\n * @example editor.commands.toggleSubscript()\n */\n toggleSubscript: () => ReturnType,\n /**\n * Unset a subscript mark\n * @example editor.commands.unsetSubscript()\n */\n unsetSubscript: () => ReturnType,\n }\n }\n}\n\n/**\n * This extension allows you to create subscript text.\n * @see https://www.tiptap.dev/api/marks/subscript\n */\nexport const Subscript = Mark.create<SubscriptExtensionOptions>({\n name: 'subscript',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n }\n },\n\n parseHTML() {\n return [\n {\n tag: 'sub',\n },\n {\n style: 'vertical-align',\n getAttrs(value) {\n // Don’t match this rule if the vertical align isn’t sub.\n if (value !== 'sub') {\n return false\n }\n\n // If it falls through we’ll match, and this mark will be applied.\n return null\n },\n } satisfies StyleParseRule,\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['sub', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n addCommands() {\n return {\n setSubscript: () => ({ commands }) => {\n return commands.setMark(this.name)\n },\n toggleSubscript: () => ({ commands }) => {\n return commands.toggleMark(this.name)\n },\n unsetSubscript: () => ({ commands }) => {\n return commands.unsetMark(this.name)\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-,': () => this.editor.commands.toggleSubscript(),\n }\n },\n})\n"],"names":["Mark","mergeAttributes"],"mappings":";;;;;;EAkCA;;;EAGG;AACU,QAAA,SAAS,GAAGA,SAAI,CAAC,MAAM,CAA4B;EAC9D,IAAA,IAAI,EAAE,WAAW;MAEjB,UAAU,GAAA;UACR,OAAO;EACL,YAAA,cAAc,EAAE,EAAE;WACnB,CAAA;OACF;MAED,SAAS,GAAA;UACP,OAAO;EACL,YAAA;EACE,gBAAA,GAAG,EAAE,KAAK;EACX,aAAA;EACD,YAAA;EACE,gBAAA,KAAK,EAAE,gBAAgB;EACvB,gBAAA,QAAQ,CAAC,KAAK,EAAA;;EAEZ,oBAAA,IAAI,KAAK,KAAK,KAAK,EAAE;EACnB,wBAAA,OAAO,KAAK,CAAA;uBACb;;EAGD,oBAAA,OAAO,IAAI,CAAA;mBACZ;EACuB,aAAA;WAC3B,CAAA;OACF;MAED,UAAU,CAAC,EAAE,cAAc,EAAE,EAAA;EAC3B,QAAA,OAAO,CAAC,KAAK,EAAEC,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;OAChF;MAED,WAAW,GAAA;UACT,OAAO;cACL,YAAY,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;kBACnC,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;eACnC;cACD,eAAe,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;kBACtC,OAAO,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;eACtC;cACD,cAAc,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;kBACrC,OAAO,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;eACrC;WACF,CAAA;OACF;MAED,oBAAoB,GAAA;UAClB,OAAO;cACL,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE;WACtD,CAAA;OACF;EACF,CAAA;;;;;;;;;;;"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { EditorState, Transaction } from '@tiptap/pm/state';
|
|
2
|
-
import { Editor } from './Editor.js';
|
|
3
|
-
import { AnyCommands, CanCommands, ChainedCommands, CommandProps, SingleCommands } from './types.js';
|
|
4
|
-
export declare class CommandManager {
|
|
5
|
-
editor: Editor;
|
|
6
|
-
rawCommands: AnyCommands;
|
|
7
|
-
customState?: EditorState;
|
|
8
|
-
constructor(props: {
|
|
9
|
-
editor: Editor;
|
|
10
|
-
state?: EditorState;
|
|
11
|
-
});
|
|
12
|
-
get hasCustomState(): boolean;
|
|
13
|
-
get state(): EditorState;
|
|
14
|
-
get commands(): SingleCommands;
|
|
15
|
-
get chain(): () => ChainedCommands;
|
|
16
|
-
get can(): () => CanCommands;
|
|
17
|
-
createChain(startTr?: Transaction, shouldDispatch?: boolean): ChainedCommands;
|
|
18
|
-
createCan(startTr?: Transaction): CanCommands;
|
|
19
|
-
buildProps(tr: Transaction, shouldDispatch?: boolean): CommandProps;
|
|
20
|
-
}
|