@tiptap/extension-subscript 3.0.0-next.3 → 3.0.0-next.5
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 +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +12 -6
- package/src/subscript.ts +19 -13
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
|
@@ -18,12 +18,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
Subscript: () => Subscript,
|
|
24
|
-
default: () =>
|
|
24
|
+
default: () => index_default
|
|
25
25
|
});
|
|
26
|
-
module.exports = __toCommonJS(
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
27
27
|
|
|
28
28
|
// src/subscript.ts
|
|
29
29
|
var import_core = require("@tiptap/core");
|
|
@@ -74,7 +74,7 @@ var Subscript = import_core.Mark.create({
|
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
// src/index.ts
|
|
77
|
-
var
|
|
77
|
+
var index_default = Subscript;
|
|
78
78
|
// Annotate the CommonJS export names for ESM import in node:
|
|
79
79
|
0 && (module.exports = {
|
|
80
80
|
Subscript
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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:
|
|
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":[]}
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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:
|
|
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.0-next.
|
|
4
|
+
"version": "3.0.0-next.5",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -15,7 +15,10 @@
|
|
|
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
|
}
|
|
@@ -28,10 +31,12 @@
|
|
|
28
31
|
"dist"
|
|
29
32
|
],
|
|
30
33
|
"devDependencies": {
|
|
31
|
-
"@tiptap/core": "^3.0.0-next.
|
|
34
|
+
"@tiptap/core": "^3.0.0-next.5",
|
|
35
|
+
"@tiptap/pm": "^3.0.0-next.5"
|
|
32
36
|
},
|
|
33
37
|
"peerDependencies": {
|
|
34
|
-
"@tiptap/core": "^3.0.0-next.
|
|
38
|
+
"@tiptap/core": "^3.0.0-next.3",
|
|
39
|
+
"@tiptap/pm": "^3.0.0-next.3"
|
|
35
40
|
},
|
|
36
41
|
"repository": {
|
|
37
42
|
"type": "git",
|
|
@@ -39,6 +44,7 @@
|
|
|
39
44
|
"directory": "packages/extension-subscript"
|
|
40
45
|
},
|
|
41
46
|
"scripts": {
|
|
42
|
-
"build": "tsup"
|
|
47
|
+
"build": "tsup",
|
|
48
|
+
"lint": "prettier ./src/ --check && eslint --cache --quiet --no-error-on-unmatched-pattern ./src/"
|
|
43
49
|
}
|
|
44
|
-
}
|
|
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
|
}
|
|
@@ -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
|
|