@tiptap/extension-underline 2.0.0-beta.20 → 2.0.0-beta.200

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.
@@ -0,0 +1,3 @@
1
+ import { Underline } from './underline';
2
+ export * from './underline';
3
+ export default Underline;
@@ -0,0 +1,23 @@
1
+ import { Mark } from '@tiptap/core';
2
+ export interface UnderlineOptions {
3
+ HTMLAttributes: Record<string, any>;
4
+ }
5
+ declare module '@tiptap/core' {
6
+ interface Commands<ReturnType> {
7
+ underline: {
8
+ /**
9
+ * Set an underline mark
10
+ */
11
+ setUnderline: () => ReturnType;
12
+ /**
13
+ * Toggle an underline mark
14
+ */
15
+ toggleUnderline: () => ReturnType;
16
+ /**
17
+ * Unset an underline mark
18
+ */
19
+ unsetUnderline: () => ReturnType;
20
+ };
21
+ }
22
+ }
23
+ export declare const Underline: Mark<UnderlineOptions, any>;
@@ -0,0 +1,52 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var core = require('@tiptap/core');
6
+
7
+ const Underline = core.Mark.create({
8
+ name: 'underline',
9
+ addOptions() {
10
+ return {
11
+ HTMLAttributes: {},
12
+ };
13
+ },
14
+ parseHTML() {
15
+ return [
16
+ {
17
+ tag: 'u',
18
+ },
19
+ {
20
+ style: 'text-decoration',
21
+ consuming: false,
22
+ getAttrs: style => (style.includes('underline') ? {} : false),
23
+ },
24
+ ];
25
+ },
26
+ renderHTML({ HTMLAttributes }) {
27
+ return ['u', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
28
+ },
29
+ addCommands() {
30
+ return {
31
+ setUnderline: () => ({ commands }) => {
32
+ return commands.setMark(this.name);
33
+ },
34
+ toggleUnderline: () => ({ commands }) => {
35
+ return commands.toggleMark(this.name);
36
+ },
37
+ unsetUnderline: () => ({ commands }) => {
38
+ return commands.unsetMark(this.name);
39
+ },
40
+ };
41
+ },
42
+ addKeyboardShortcuts() {
43
+ return {
44
+ 'Mod-u': () => this.editor.commands.toggleUnderline(),
45
+ 'Mod-U': () => this.editor.commands.toggleUnderline(),
46
+ };
47
+ },
48
+ });
49
+
50
+ exports.Underline = Underline;
51
+ exports["default"] = Underline;
52
+ //# sourceMappingURL=tiptap-extension-underline.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tiptap-extension-underline.cjs.js","sources":["../src/underline.ts"],"sourcesContent":["import { Mark, mergeAttributes } from '@tiptap/core'\n\nexport interface UnderlineOptions {\n HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n underline: {\n /**\n * Set an underline mark\n */\n setUnderline: () => ReturnType,\n /**\n * Toggle an underline mark\n */\n toggleUnderline: () => ReturnType,\n /**\n * Unset an underline mark\n */\n unsetUnderline: () => ReturnType,\n }\n }\n}\n\nexport const Underline = Mark.create<UnderlineOptions>({\n name: 'underline',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n }\n },\n\n parseHTML() {\n return [\n {\n tag: 'u',\n },\n {\n style: 'text-decoration',\n consuming: false,\n getAttrs: style => ((style as string).includes('underline') ? {} : false),\n },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['u', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n addCommands() {\n return {\n setUnderline: () => ({ commands }) => {\n return commands.setMark(this.name)\n },\n toggleUnderline: () => ({ commands }) => {\n return commands.toggleMark(this.name)\n },\n unsetUnderline: () => ({ commands }) => {\n return commands.unsetMark(this.name)\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-u': () => this.editor.commands.toggleUnderline(),\n 'Mod-U': () => this.editor.commands.toggleUnderline(),\n }\n },\n})\n"],"names":["Mark","mergeAttributes"],"mappings":";;;;;;AAyBa,MAAA,SAAS,GAAGA,SAAI,CAAC,MAAM,CAAmB;AACrD,IAAA,IAAI,EAAE,WAAW;IAEjB,UAAU,GAAA;QACR,OAAO;AACL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
5
+ addOptions() {
6
+ return {
7
+ HTMLAttributes: {},
8
+ };
9
+ },
10
+ parseHTML() {
11
+ return [
12
+ {
13
+ tag: 'u',
14
+ },
15
+ {
16
+ style: 'text-decoration',
17
+ consuming: false,
18
+ getAttrs: style => (style.includes('underline') ? {} : false),
19
+ },
20
+ ];
21
+ },
22
+ renderHTML({ HTMLAttributes }) {
23
+ return ['u', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
24
+ },
25
+ addCommands() {
26
+ return {
27
+ setUnderline: () => ({ commands }) => {
28
+ return commands.setMark(this.name);
29
+ },
30
+ toggleUnderline: () => ({ commands }) => {
31
+ return commands.toggleMark(this.name);
32
+ },
33
+ unsetUnderline: () => ({ commands }) => {
34
+ return commands.unsetMark(this.name);
35
+ },
36
+ };
37
+ },
38
+ addKeyboardShortcuts() {
39
+ return {
40
+ 'Mod-u': () => this.editor.commands.toggleUnderline(),
41
+ 'Mod-U': () => this.editor.commands.toggleUnderline(),
42
+ };
43
+ },
44
+ });
45
+
46
+ export { Underline, Underline as default };
47
+ //# sourceMappingURL=tiptap-extension-underline.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tiptap-extension-underline.esm.js","sources":["../src/underline.ts"],"sourcesContent":["import { Mark, mergeAttributes } from '@tiptap/core'\n\nexport interface UnderlineOptions {\n HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n underline: {\n /**\n * Set an underline mark\n */\n setUnderline: () => ReturnType,\n /**\n * Toggle an underline mark\n */\n toggleUnderline: () => ReturnType,\n /**\n * Unset an underline mark\n */\n unsetUnderline: () => ReturnType,\n }\n }\n}\n\nexport const Underline = Mark.create<UnderlineOptions>({\n name: 'underline',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n }\n },\n\n parseHTML() {\n return [\n {\n tag: 'u',\n },\n {\n style: 'text-decoration',\n consuming: false,\n getAttrs: style => ((style as string).includes('underline') ? {} : false),\n },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['u', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n addCommands() {\n return {\n setUnderline: () => ({ commands }) => {\n return commands.setMark(this.name)\n },\n toggleUnderline: () => ({ commands }) => {\n return commands.toggleMark(this.name)\n },\n unsetUnderline: () => ({ commands }) => {\n return commands.unsetMark(this.name)\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-u': () => this.editor.commands.toggleUnderline(),\n 'Mod-U': () => this.editor.commands.toggleUnderline(),\n }\n },\n})\n"],"names":[],"mappings":";;AAyBa,MAAA,SAAS,GAAG,IAAI,CAAC,MAAM,CAAmB;AACrD,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,GAAG;AACT,aAAA;AACD,YAAA;AACE,gBAAA,KAAK,EAAE,iBAAiB;AACxB,gBAAA,SAAS,EAAE,KAAK;gBAChB,QAAQ,EAAE,KAAK,KAAM,KAAgB,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;AAC1E,aAAA;SACF,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE,EAAA;AAC3B,QAAA,OAAO,CAAC,GAAG,EAAE,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;KAC9E;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;YACrD,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE;SACtD,CAAA;KACF;AACF,CAAA;;;;"}
@@ -0,0 +1,56 @@
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-underline"] = {}, global.core));
5
+ })(this, (function (exports, core) { 'use strict';
6
+
7
+ const Underline = core.Mark.create({
8
+ name: 'underline',
9
+ addOptions() {
10
+ return {
11
+ HTMLAttributes: {},
12
+ };
13
+ },
14
+ parseHTML() {
15
+ return [
16
+ {
17
+ tag: 'u',
18
+ },
19
+ {
20
+ style: 'text-decoration',
21
+ consuming: false,
22
+ getAttrs: style => (style.includes('underline') ? {} : false),
23
+ },
24
+ ];
25
+ },
26
+ renderHTML({ HTMLAttributes }) {
27
+ return ['u', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
28
+ },
29
+ addCommands() {
30
+ return {
31
+ setUnderline: () => ({ commands }) => {
32
+ return commands.setMark(this.name);
33
+ },
34
+ toggleUnderline: () => ({ commands }) => {
35
+ return commands.toggleMark(this.name);
36
+ },
37
+ unsetUnderline: () => ({ commands }) => {
38
+ return commands.unsetMark(this.name);
39
+ },
40
+ };
41
+ },
42
+ addKeyboardShortcuts() {
43
+ return {
44
+ 'Mod-u': () => this.editor.commands.toggleUnderline(),
45
+ 'Mod-U': () => this.editor.commands.toggleUnderline(),
46
+ };
47
+ },
48
+ });
49
+
50
+ exports.Underline = Underline;
51
+ exports["default"] = Underline;
52
+
53
+ Object.defineProperty(exports, '__esModule', { value: true });
54
+
55
+ }));
56
+ //# sourceMappingURL=tiptap-extension-underline.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tiptap-extension-underline.umd.js","sources":["../src/underline.ts"],"sourcesContent":["import { Mark, mergeAttributes } from '@tiptap/core'\n\nexport interface UnderlineOptions {\n HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n underline: {\n /**\n * Set an underline mark\n */\n setUnderline: () => ReturnType,\n /**\n * Toggle an underline mark\n */\n toggleUnderline: () => ReturnType,\n /**\n * Unset an underline mark\n */\n unsetUnderline: () => ReturnType,\n }\n }\n}\n\nexport const Underline = Mark.create<UnderlineOptions>({\n name: 'underline',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n }\n },\n\n parseHTML() {\n return [\n {\n tag: 'u',\n },\n {\n style: 'text-decoration',\n consuming: false,\n getAttrs: style => ((style as string).includes('underline') ? {} : false),\n },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['u', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n addCommands() {\n return {\n setUnderline: () => ({ commands }) => {\n return commands.setMark(this.name)\n },\n toggleUnderline: () => ({ commands }) => {\n return commands.toggleMark(this.name)\n },\n unsetUnderline: () => ({ commands }) => {\n return commands.unsetMark(this.name)\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-u': () => this.editor.commands.toggleUnderline(),\n 'Mod-U': () => this.editor.commands.toggleUnderline(),\n }\n },\n})\n"],"names":["Mark","mergeAttributes"],"mappings":";;;;;;AAyBa,QAAA,SAAS,GAAGA,SAAI,CAAC,MAAM,CAAmB;EACrD,IAAA,IAAI,EAAE,WAAW;MAEjB,UAAU,GAAA;UACR,OA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"underline extension for tiptap",
4
- "version": "2.0.0-beta.20",
4
+ "version": "2.0.0-beta.200",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -21,12 +21,11 @@
21
21
  "dist"
22
22
  ],
23
23
  "peerDependencies": {
24
- "@tiptap/core": "^2.0.0-beta.1"
24
+ "@tiptap/core": "^2.0.0-beta.193"
25
25
  },
26
26
  "repository": {
27
27
  "type": "git",
28
28
  "url": "https://github.com/ueberdosis/tiptap",
29
29
  "directory": "packages/extension-underline"
30
- },
31
- "gitHead": "fce16e805824972834d5a8ce8d60e3ff41d63c7e"
30
+ }
32
31
  }
package/src/underline.ts CHANGED
@@ -52,13 +52,13 @@ export const Underline = Mark.create<UnderlineOptions>({
52
52
  addCommands() {
53
53
  return {
54
54
  setUnderline: () => ({ commands }) => {
55
- return commands.setMark('underline')
55
+ return commands.setMark(this.name)
56
56
  },
57
57
  toggleUnderline: () => ({ commands }) => {
58
- return commands.toggleMark('underline')
58
+ return commands.toggleMark(this.name)
59
59
  },
60
60
  unsetUnderline: () => ({ commands }) => {
61
- return commands.unsetMark('underline')
61
+ return commands.unsetMark(this.name)
62
62
  },
63
63
  }
64
64
  },
@@ -66,6 +66,7 @@ export const Underline = Mark.create<UnderlineOptions>({
66
66
  addKeyboardShortcuts() {
67
67
  return {
68
68
  'Mod-u': () => this.editor.commands.toggleUnderline(),
69
+ 'Mod-U': () => this.editor.commands.toggleUnderline(),
69
70
  }
70
71
  },
71
72
  })
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.