@tiptap/extension-subscript 2.0.0-beta.9 → 2.0.0-rc.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/README.md CHANGED
@@ -1,14 +1,14 @@
1
- # @tiptap/extension-superscript
2
- [![Version](https://img.shields.io/npm/v/@tiptap/extension-superscript.svg?label=version)](https://www.npmjs.com/package/@tiptap/extension-superscript)
3
- [![Downloads](https://img.shields.io/npm/dm/@tiptap/extension-superscript.svg)](https://npmcharts.com/compare/tiptap?minimal=true)
4
- [![License](https://img.shields.io/npm/l/@tiptap/extension-superscript.svg)](https://www.npmjs.com/package/@tiptap/extension-superscript)
1
+ # @tiptap/extension-subscript
2
+ [![Version](https://img.shields.io/npm/v/@tiptap/extension-subscript.svg?label=version)](https://www.npmjs.com/package/@tiptap/extension-subscript)
3
+ [![Downloads](https://img.shields.io/npm/dm/@tiptap/extension-subscript.svg)](https://npmcharts.com/compare/tiptap?minimal=true)
4
+ [![License](https://img.shields.io/npm/l/@tiptap/extension-subscript.svg)](https://www.npmjs.com/package/@tiptap/extension-subscript)
5
5
  [![Sponsor](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub)](https://github.com/sponsors/ueberdosis)
6
6
 
7
7
  ## Introduction
8
- 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*.
8
+ 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
9
 
10
10
  ## Official Documentation
11
- Documentation can be found on the [tiptap website](https://tiptap.dev).
11
+ Documentation can be found on the [Tiptap website](https://tiptap.dev).
12
12
 
13
13
  ## License
14
- tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap/blob/main/LICENSE.md).
14
+ Tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap/blob/main/LICENSE.md).
@@ -24,6 +24,7 @@ const Subscript = core.Mark.create({
24
24
  return false;
25
25
  }
26
26
  // If it falls through we’ll match, and this mark will be applied.
27
+ return null;
27
28
  },
28
29
  },
29
30
  ];
@@ -34,13 +35,13 @@ const Subscript = core.Mark.create({
34
35
  addCommands() {
35
36
  return {
36
37
  setSubscript: () => ({ commands }) => {
37
- return commands.setMark('subscript');
38
+ return commands.setMark(this.name);
38
39
  },
39
40
  toggleSubscript: () => ({ commands }) => {
40
- return commands.toggleMark('subscript');
41
+ return commands.toggleMark(this.name);
41
42
  },
42
43
  unsetSubscript: () => ({ commands }) => {
43
- return commands.unsetMark('subscript');
44
+ return commands.unsetMark(this.name);
44
45
  },
45
46
  };
46
47
  },
@@ -53,4 +54,4 @@ const Subscript = core.Mark.create({
53
54
 
54
55
  exports.Subscript = Subscript;
55
56
  exports["default"] = Subscript;
56
- //# sourceMappingURL=tiptap-extension-subscript.cjs.js.map
57
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../src/subscript.ts"],"sourcesContent":["import { Mark, mergeAttributes } from '@tiptap/core'\n\nexport interface SubscriptExtensionOptions {\n HTMLAttributes: Object,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n subscript: {\n /**\n * Set a subscript mark\n */\n setSubscript: () => ReturnType,\n /**\n * Toggle a subscript mark\n */\n toggleSubscript: () => ReturnType,\n /**\n * Unset a subscript mark\n */\n unsetSubscript: () => ReturnType,\n }\n }\n}\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 },\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":";;;;;;AAyBa,MAAA,SAAS,GAAGA,SAAI,CAAC,MAAM,CAA4B;AAC9D,IAAA,IAAI,EAAE,WAAW;IAEjB,UAAU,GAAA;QACR,OAAO;AACL,YAAA,cAAc,EAAE,EAAE;SACnB,CAAA;KACF;IAED,SAAS,GAAA;QACP,OAAO;AACL,YAAA;AACE,gBAAA,GAAG,EAAE,KAAK;AACX,aAAA;AACD,YAAA;AACE,gBAAA,KAAK,EAAE,gBAAgB;AACvB,gBAAA,QAAQ,CAAC,KAAK,EAAA;;oBAEZ,IAAI,KAAK,KAAK,KAAK,EAAE;AACnB,wBAAA,OAAO,KAAK,CAAA;AACb,qBAAA;;AAGD,oBAAA,OAAO,IAAI,CAAA;iBACZ;AACF,aAAA;SACF,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE,EAAA;AAC3B,QAAA,OAAO,CAAC,KAAK,EAAEC,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;KAChF;IAED,WAAW,GAAA;QACT,OAAO;YACL,YAAY,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;gBACnC,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;aACnC;YACD,eAAe,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;gBACtC,OAAO,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;aACtC;YACD,cAAc,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;gBACrC,OAAO,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;aACrC;SACF,CAAA;KACF;IAED,oBAAoB,GAAA;QAClB,OAAO;YACL,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE;SACtD,CAAA;KACF;AACF,CAAA;;;;;"}
@@ -20,6 +20,7 @@ const Subscript = Mark.create({
20
20
  return false;
21
21
  }
22
22
  // If it falls through we’ll match, and this mark will be applied.
23
+ return null;
23
24
  },
24
25
  },
25
26
  ];
@@ -30,13 +31,13 @@ const Subscript = Mark.create({
30
31
  addCommands() {
31
32
  return {
32
33
  setSubscript: () => ({ commands }) => {
33
- return commands.setMark('subscript');
34
+ return commands.setMark(this.name);
34
35
  },
35
36
  toggleSubscript: () => ({ commands }) => {
36
- return commands.toggleMark('subscript');
37
+ return commands.toggleMark(this.name);
37
38
  },
38
39
  unsetSubscript: () => ({ commands }) => {
39
- return commands.unsetMark('subscript');
40
+ return commands.unsetMark(this.name);
40
41
  },
41
42
  };
42
43
  },
@@ -48,4 +49,4 @@ const Subscript = Mark.create({
48
49
  });
49
50
 
50
51
  export { Subscript, Subscript as default };
51
- //# sourceMappingURL=tiptap-extension-subscript.esm.js.map
52
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/subscript.ts"],"sourcesContent":["import { Mark, mergeAttributes } from '@tiptap/core'\n\nexport interface SubscriptExtensionOptions {\n HTMLAttributes: Object,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n subscript: {\n /**\n * Set a subscript mark\n */\n setSubscript: () => ReturnType,\n /**\n * Toggle a subscript mark\n */\n toggleSubscript: () => ReturnType,\n /**\n * Unset a subscript mark\n */\n unsetSubscript: () => ReturnType,\n }\n }\n}\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 },\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":[],"mappings":";;AAyBa,MAAA,SAAS,GAAG,IAAI,CAAC,MAAM,CAA4B;AAC9D,IAAA,IAAI,EAAE,WAAW;IAEjB,UAAU,GAAA;QACR,OAAO;AACL,YAAA,cAAc,EAAE,EAAE;SACnB,CAAA;KACF;IAED,SAAS,GAAA;QACP,OAAO;AACL,YAAA;AACE,gBAAA,GAAG,EAAE,KAAK;AACX,aAAA;AACD,YAAA;AACE,gBAAA,KAAK,EAAE,gBAAgB;AACvB,gBAAA,QAAQ,CAAC,KAAK,EAAA;;oBAEZ,IAAI,KAAK,KAAK,KAAK,EAAE;AACnB,wBAAA,OAAO,KAAK,CAAA;AACb,qBAAA;;AAGD,oBAAA,OAAO,IAAI,CAAA;iBACZ;AACF,aAAA;SACF,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE,EAAA;AAC3B,QAAA,OAAO,CAAC,KAAK,EAAE,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;KAChF;IAED,WAAW,GAAA;QACT,OAAO;YACL,YAAY,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;gBACnC,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;aACnC;YACD,eAAe,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;gBACtC,OAAO,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;aACtC;YACD,cAAc,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;gBACrC,OAAO,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;aACrC;SACF,CAAA;KACF;IAED,oBAAoB,GAAA;QAClB,OAAO;YACL,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE;SACtD,CAAA;KACF;AACF,CAAA;;;;"}
@@ -24,6 +24,7 @@
24
24
  return false;
25
25
  }
26
26
  // If it falls through we’ll match, and this mark will be applied.
27
+ return null;
27
28
  },
28
29
  },
29
30
  ];
@@ -34,13 +35,13 @@
34
35
  addCommands() {
35
36
  return {
36
37
  setSubscript: () => ({ commands }) => {
37
- return commands.setMark('subscript');
38
+ return commands.setMark(this.name);
38
39
  },
39
40
  toggleSubscript: () => ({ commands }) => {
40
- return commands.toggleMark('subscript');
41
+ return commands.toggleMark(this.name);
41
42
  },
42
43
  unsetSubscript: () => ({ commands }) => {
43
- return commands.unsetMark('subscript');
44
+ return commands.unsetMark(this.name);
44
45
  },
45
46
  };
46
47
  },
@@ -57,4 +58,4 @@
57
58
  Object.defineProperty(exports, '__esModule', { value: true });
58
59
 
59
60
  }));
60
- //# sourceMappingURL=tiptap-extension-subscript.umd.js.map
61
+ //# sourceMappingURL=index.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.umd.js","sources":["../src/subscript.ts"],"sourcesContent":["import { Mark, mergeAttributes } from '@tiptap/core'\n\nexport interface SubscriptExtensionOptions {\n HTMLAttributes: Object,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n subscript: {\n /**\n * Set a subscript mark\n */\n setSubscript: () => ReturnType,\n /**\n * Toggle a subscript mark\n */\n toggleSubscript: () => ReturnType,\n /**\n * Unset a subscript mark\n */\n unsetSubscript: () => ReturnType,\n }\n }\n}\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 },\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":";;;;;;AAyBa,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;;sBAEZ,IAAI,KAAK,KAAK,KAAK,EAAE;EACnB,wBAAA,OAAO,KAAK,CAAA;EACb,qBAAA;;EAGD,oBAAA,OAAO,IAAI,CAAA;mBACZ;EACF,aAAA;WACF,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;;;;;;;;;;;"}
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": "2.0.0-beta.9",
4
+ "version": "2.0.0-rc.2",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -12,21 +12,35 @@
12
12
  "type": "github",
13
13
  "url": "https://github.com/sponsors/ueberdosis"
14
14
  },
15
- "main": "dist/tiptap-extension-subscript.cjs.js",
16
- "umd": "dist/tiptap-extension-subscript.umd.js",
17
- "module": "dist/tiptap-extension-subscript.esm.js",
15
+ "type": "module",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/packages/extension-subscript/src/index.d.ts",
19
+ "import": "./dist/index.js",
20
+ "require": "./dist/index.cjs"
21
+ }
22
+ },
23
+ "main": "dist/index.cjs",
24
+ "module": "dist/index.js",
25
+ "umd": "dist/index.umd.js",
18
26
  "types": "dist/packages/extension-subscript/src/index.d.ts",
19
27
  "files": [
20
28
  "src",
21
29
  "dist"
22
30
  ],
23
31
  "peerDependencies": {
24
- "@tiptap/core": "^2.0.0-beta.1"
32
+ "@tiptap/core": "^2.0.0-rc.1"
33
+ },
34
+ "devDependencies": {
35
+ "@tiptap/core": "^2.0.0-rc.1"
25
36
  },
26
37
  "repository": {
27
38
  "type": "git",
28
39
  "url": "https://github.com/ueberdosis/tiptap",
29
40
  "directory": "packages/extension-subscript"
30
41
  },
31
- "gitHead": "621cfa2f7e98a48525fa22f9d97a92fc08368966"
32
- }
42
+ "scripts": {
43
+ "clean": "rm -rf dist",
44
+ "build": "npm run clean && rollup -c"
45
+ }
46
+ }
package/src/subscript.ts CHANGED
@@ -46,6 +46,7 @@ export const Subscript = Mark.create<SubscriptExtensionOptions>({
46
46
  }
47
47
 
48
48
  // If it falls through we’ll match, and this mark will be applied.
49
+ return null
49
50
  },
50
51
  },
51
52
  ]
@@ -58,13 +59,13 @@ export const Subscript = Mark.create<SubscriptExtensionOptions>({
58
59
  addCommands() {
59
60
  return {
60
61
  setSubscript: () => ({ commands }) => {
61
- return commands.setMark('subscript')
62
+ return commands.setMark(this.name)
62
63
  },
63
64
  toggleSubscript: () => ({ commands }) => {
64
- return commands.toggleMark('subscript')
65
+ return commands.toggleMark(this.name)
65
66
  },
66
67
  unsetSubscript: () => ({ commands }) => {
67
- return commands.unsetMark('subscript')
68
+ return commands.unsetMark(this.name)
68
69
  },
69
70
  }
70
71
  },
package/LICENSE.md DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2021, überdosis GbR
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.
@@ -1 +0,0 @@
1
- {"version":3,"file":"tiptap-extension-subscript.cjs.js","sources":["../src/subscript.ts"],"sourcesContent":["import { Mark, mergeAttributes } from '@tiptap/core'\n\nexport interface SubscriptExtensionOptions {\n HTMLAttributes: Object,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n subscript: {\n /**\n * Set a subscript mark\n */\n setSubscript: () => ReturnType,\n /**\n * Toggle a subscript mark\n */\n toggleSubscript: () => ReturnType,\n /**\n * Unset a subscript mark\n */\n unsetSubscript: () => ReturnType,\n }\n }\n}\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 },\n },\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('subscript')\n },\n toggleSubscript: () => ({ commands }) => {\n return commands.toggleMark('subscript')\n },\n unsetSubscript: () => ({ commands }) => {\n return commands.unsetMark('subscript')\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-,': () => this.editor.commands.toggleSubscript(),\n }\n },\n})\n"],"names":["Mark","mergeAttributes"],"mappings":";;;;;;MAyBa,SAAS,GAAGA,SAAI,CAAC,MAAM,CAA4B;IAC9D,IAAI,EAAE,WAAW;IAEjB,UAAU;QACR,OAAO;YACL,cAAc,EAAE,EAAE;SACnB,CAAA;KACF;IAED,SAAS;QACP,OAAO;YACL;gBACE,GAAG,EAAE,KAAK;aACX;YACD;gBACE,KAAK,EAAE,gBAAgB;gBACvB,QAAQ,CAAC,KAAK;;oBAEZ,IAAI,KAAK,KAAK,KAAK,EAAE;wBACnB,OAAO,KAAK,CAAA;qBACb;;iBAGF;aACF;SACF,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE;QAC3B,OAAO,CAAC,KAAK,EAAEC,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;KAChF;IAED,WAAW;QACT,OAAO;YACL,YAAY,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE;gBAC/B,OAAO,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;aACrC;YACD,eAAe,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE;gBAClC,OAAO,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;aACxC;YACD,cAAc,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE;gBACjC,OAAO,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;aACvC;SACF,CAAA;KACF;IAED,oBAAoB;QAClB,OAAO;YACL,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE;SACtD,CAAA;KACF;CACF;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tiptap-extension-subscript.esm.js","sources":["../src/subscript.ts"],"sourcesContent":["import { Mark, mergeAttributes } from '@tiptap/core'\n\nexport interface SubscriptExtensionOptions {\n HTMLAttributes: Object,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n subscript: {\n /**\n * Set a subscript mark\n */\n setSubscript: () => ReturnType,\n /**\n * Toggle a subscript mark\n */\n toggleSubscript: () => ReturnType,\n /**\n * Unset a subscript mark\n */\n unsetSubscript: () => ReturnType,\n }\n }\n}\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 },\n },\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('subscript')\n },\n toggleSubscript: () => ({ commands }) => {\n return commands.toggleMark('subscript')\n },\n unsetSubscript: () => ({ commands }) => {\n return commands.unsetMark('subscript')\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-,': () => this.editor.commands.toggleSubscript(),\n }\n },\n})\n"],"names":[],"mappings":";;MAyBa,SAAS,GAAG,IAAI,CAAC,MAAM,CAA4B;IAC9D,IAAI,EAAE,WAAW;IAEjB,UAAU;QACR,OAAO;YACL,cAAc,EAAE,EAAE;SACnB,CAAA;KACF;IAED,SAAS;QACP,OAAO;YACL;gBACE,GAAG,EAAE,KAAK;aACX;YACD;gBACE,KAAK,EAAE,gBAAgB;gBACvB,QAAQ,CAAC,KAAK;;oBAEZ,IAAI,KAAK,KAAK,KAAK,EAAE;wBACnB,OAAO,KAAK,CAAA;qBACb;;iBAGF;aACF;SACF,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE;QAC3B,OAAO,CAAC,KAAK,EAAE,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;KAChF;IAED,WAAW;QACT,OAAO;YACL,YAAY,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE;gBAC/B,OAAO,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;aACrC;YACD,eAAe,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE;gBAClC,OAAO,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;aACxC;YACD,cAAc,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE;gBACjC,OAAO,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;aACvC;SACF,CAAA;KACF;IAED,oBAAoB;QAClB,OAAO;YACL,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE;SACtD,CAAA;KACF;CACF;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tiptap-extension-subscript.umd.js","sources":["../src/subscript.ts"],"sourcesContent":["import { Mark, mergeAttributes } from '@tiptap/core'\n\nexport interface SubscriptExtensionOptions {\n HTMLAttributes: Object,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n subscript: {\n /**\n * Set a subscript mark\n */\n setSubscript: () => ReturnType,\n /**\n * Toggle a subscript mark\n */\n toggleSubscript: () => ReturnType,\n /**\n * Unset a subscript mark\n */\n unsetSubscript: () => ReturnType,\n }\n }\n}\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 },\n },\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('subscript')\n },\n toggleSubscript: () => ({ commands }) => {\n return commands.toggleMark('subscript')\n },\n unsetSubscript: () => ({ commands }) => {\n return commands.unsetMark('subscript')\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-,': () => this.editor.commands.toggleSubscript(),\n }\n },\n})\n"],"names":["Mark","mergeAttributes"],"mappings":";;;;;;QAyBa,SAAS,GAAGA,SAAI,CAAC,MAAM,CAA4B;MAC9D,IAAI,EAAE,WAAW;MAEjB,UAAU;UACR,OAAO;cACL,cAAc,EAAE,EAAE;WACnB,CAAA;OACF;MAED,SAAS;UACP,OAAO;cACL;kBACE,GAAG,EAAE,KAAK;eACX;cACD;kBACE,KAAK,EAAE,gBAAgB;kBACvB,QAAQ,CAAC,KAAK;;sBAEZ,IAAI,KAAK,KAAK,KAAK,EAAE;0BACnB,OAAO,KAAK,CAAA;uBACb;;mBAGF;eACF;WACF,CAAA;OACF;MAED,UAAU,CAAC,EAAE,cAAc,EAAE;UAC3B,OAAO,CAAC,KAAK,EAAEC,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;OAChF;MAED,WAAW;UACT,OAAO;cACL,YAAY,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE;kBAC/B,OAAO,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;eACrC;cACD,eAAe,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE;kBAClC,OAAO,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;eACxC;cACD,cAAc,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE;kBACjC,OAAO,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;eACvC;WACF,CAAA;OACF;MAED,oBAAoB;UAClB,OAAO;cACL,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE;WACtD,CAAA;OACF;GACF;;;;;;;;;;;"}