@tiptap/extension-underline 2.0.0-beta.9 → 2.0.0-rc.1
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 +4 -4
- package/dist/{tiptap-extension-underline.cjs.js → index.cjs} +10 -7
- package/dist/index.cjs.map +1 -0
- package/dist/{tiptap-extension-underline.esm.js → index.js} +10 -8
- package/dist/index.js.map +1 -0
- package/dist/{tiptap-extension-underline.umd.js → index.umd.js} +13 -10
- package/dist/index.umd.js.map +1 -0
- package/dist/packages/extension-underline/src/underline.d.ts +6 -6
- package/package.json +26 -7
- package/src/underline.ts +13 -10
- package/CHANGELOG.md +0 -182
- package/LICENSE.md +0 -21
- package/dist/tiptap-extension-underline.cjs.js.map +0 -1
- package/dist/tiptap-extension-underline.esm.js.map +0 -1
- package/dist/tiptap-extension-underline.umd.js.map +0 -1
package/README.md
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
[](https://github.com/sponsors/ueberdosis)
|
|
6
6
|
|
|
7
7
|
## Introduction
|
|
8
|
-
|
|
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
|
-
##
|
|
11
|
-
Documentation can be found on the [
|
|
10
|
+
## Official Documentation
|
|
11
|
+
Documentation can be found on the [Tiptap website](https://tiptap.dev).
|
|
12
12
|
|
|
13
13
|
## License
|
|
14
|
-
|
|
14
|
+
Tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap/blob/main/LICENSE.md).
|
|
@@ -6,8 +6,10 @@ var core = require('@tiptap/core');
|
|
|
6
6
|
|
|
7
7
|
const Underline = core.Mark.create({
|
|
8
8
|
name: 'underline',
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
addOptions() {
|
|
10
|
+
return {
|
|
11
|
+
HTMLAttributes: {},
|
|
12
|
+
};
|
|
11
13
|
},
|
|
12
14
|
parseHTML() {
|
|
13
15
|
return [
|
|
@@ -27,23 +29,24 @@ const Underline = core.Mark.create({
|
|
|
27
29
|
addCommands() {
|
|
28
30
|
return {
|
|
29
31
|
setUnderline: () => ({ commands }) => {
|
|
30
|
-
return commands.setMark(
|
|
32
|
+
return commands.setMark(this.name);
|
|
31
33
|
},
|
|
32
34
|
toggleUnderline: () => ({ commands }) => {
|
|
33
|
-
return commands.toggleMark(
|
|
35
|
+
return commands.toggleMark(this.name);
|
|
34
36
|
},
|
|
35
37
|
unsetUnderline: () => ({ commands }) => {
|
|
36
|
-
return commands.unsetMark(
|
|
38
|
+
return commands.unsetMark(this.name);
|
|
37
39
|
},
|
|
38
40
|
};
|
|
39
41
|
},
|
|
40
42
|
addKeyboardShortcuts() {
|
|
41
43
|
return {
|
|
42
44
|
'Mod-u': () => this.editor.commands.toggleUnderline(),
|
|
45
|
+
'Mod-U': () => this.editor.commands.toggleUnderline(),
|
|
43
46
|
};
|
|
44
47
|
},
|
|
45
48
|
});
|
|
46
49
|
|
|
47
50
|
exports.Underline = Underline;
|
|
48
|
-
exports
|
|
49
|
-
//# sourceMappingURL=
|
|
51
|
+
exports["default"] = Underline;
|
|
52
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","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,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,EAAEC,oBAAe,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;;;;;"}
|
|
@@ -2,8 +2,10 @@ import { Mark, mergeAttributes } from '@tiptap/core';
|
|
|
2
2
|
|
|
3
3
|
const Underline = Mark.create({
|
|
4
4
|
name: 'underline',
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
addOptions() {
|
|
6
|
+
return {
|
|
7
|
+
HTMLAttributes: {},
|
|
8
|
+
};
|
|
7
9
|
},
|
|
8
10
|
parseHTML() {
|
|
9
11
|
return [
|
|
@@ -23,23 +25,23 @@ const Underline = Mark.create({
|
|
|
23
25
|
addCommands() {
|
|
24
26
|
return {
|
|
25
27
|
setUnderline: () => ({ commands }) => {
|
|
26
|
-
return commands.setMark(
|
|
28
|
+
return commands.setMark(this.name);
|
|
27
29
|
},
|
|
28
30
|
toggleUnderline: () => ({ commands }) => {
|
|
29
|
-
return commands.toggleMark(
|
|
31
|
+
return commands.toggleMark(this.name);
|
|
30
32
|
},
|
|
31
33
|
unsetUnderline: () => ({ commands }) => {
|
|
32
|
-
return commands.unsetMark(
|
|
34
|
+
return commands.unsetMark(this.name);
|
|
33
35
|
},
|
|
34
36
|
};
|
|
35
37
|
},
|
|
36
38
|
addKeyboardShortcuts() {
|
|
37
39
|
return {
|
|
38
40
|
'Mod-u': () => this.editor.commands.toggleUnderline(),
|
|
41
|
+
'Mod-U': () => this.editor.commands.toggleUnderline(),
|
|
39
42
|
};
|
|
40
43
|
},
|
|
41
44
|
});
|
|
42
45
|
|
|
43
|
-
export default
|
|
44
|
-
|
|
45
|
-
//# sourceMappingURL=tiptap-extension-underline.esm.js.map
|
|
46
|
+
export { Underline, Underline as default };
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.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;;;;"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tiptap/core')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', '@tiptap/core'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global[
|
|
5
|
-
}(this, (function (exports, core) { 'use strict';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@tiptap/extension-underline"] = {}, global.core));
|
|
5
|
+
})(this, (function (exports, core) { 'use strict';
|
|
6
6
|
|
|
7
7
|
const Underline = core.Mark.create({
|
|
8
8
|
name: 'underline',
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
addOptions() {
|
|
10
|
+
return {
|
|
11
|
+
HTMLAttributes: {},
|
|
12
|
+
};
|
|
11
13
|
},
|
|
12
14
|
parseHTML() {
|
|
13
15
|
return [
|
|
@@ -27,27 +29,28 @@
|
|
|
27
29
|
addCommands() {
|
|
28
30
|
return {
|
|
29
31
|
setUnderline: () => ({ commands }) => {
|
|
30
|
-
return commands.setMark(
|
|
32
|
+
return commands.setMark(this.name);
|
|
31
33
|
},
|
|
32
34
|
toggleUnderline: () => ({ commands }) => {
|
|
33
|
-
return commands.toggleMark(
|
|
35
|
+
return commands.toggleMark(this.name);
|
|
34
36
|
},
|
|
35
37
|
unsetUnderline: () => ({ commands }) => {
|
|
36
|
-
return commands.unsetMark(
|
|
38
|
+
return commands.unsetMark(this.name);
|
|
37
39
|
},
|
|
38
40
|
};
|
|
39
41
|
},
|
|
40
42
|
addKeyboardShortcuts() {
|
|
41
43
|
return {
|
|
42
44
|
'Mod-u': () => this.editor.commands.toggleUnderline(),
|
|
45
|
+
'Mod-U': () => this.editor.commands.toggleUnderline(),
|
|
43
46
|
};
|
|
44
47
|
},
|
|
45
48
|
});
|
|
46
49
|
|
|
47
50
|
exports.Underline = Underline;
|
|
48
|
-
exports
|
|
51
|
+
exports["default"] = Underline;
|
|
49
52
|
|
|
50
53
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
51
54
|
|
|
52
|
-
}))
|
|
53
|
-
//# sourceMappingURL=
|
|
55
|
+
}));
|
|
56
|
+
//# sourceMappingURL=index.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.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,OAAO;EACL,YAAA,cAAc,EAAE,EAAE;WACnB,CAAA;OACF;MAED,SAAS,GAAA;UACP,OAAO;EACL,YAAA;EACE,gBAAA,GAAG,EAAE,GAAG;EACT,aAAA;EACD,YAAA;EACE,gBAAA,KAAK,EAAE,iBAAiB;EACxB,gBAAA,SAAS,EAAE,KAAK;kBAChB,QAAQ,EAAE,KAAK,KAAM,KAAgB,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;EAC1E,aAAA;WACF,CAAA;OACF;MAED,UAAU,CAAC,EAAE,cAAc,EAAE,EAAA;EAC3B,QAAA,OAAO,CAAC,GAAG,EAAEC,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;OAC9E;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;cACrD,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE;WACtD,CAAA;OACF;EACF,CAAA;;;;;;;;;;;"}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Mark } from '@tiptap/core';
|
|
2
2
|
export interface UnderlineOptions {
|
|
3
3
|
HTMLAttributes: Record<string, any>;
|
|
4
4
|
}
|
|
5
5
|
declare module '@tiptap/core' {
|
|
6
|
-
interface Commands {
|
|
6
|
+
interface Commands<ReturnType> {
|
|
7
7
|
underline: {
|
|
8
8
|
/**
|
|
9
9
|
* Set an underline mark
|
|
10
10
|
*/
|
|
11
|
-
setUnderline: () =>
|
|
11
|
+
setUnderline: () => ReturnType;
|
|
12
12
|
/**
|
|
13
13
|
* Toggle an underline mark
|
|
14
14
|
*/
|
|
15
|
-
toggleUnderline: () =>
|
|
15
|
+
toggleUnderline: () => ReturnType;
|
|
16
16
|
/**
|
|
17
17
|
* Unset an underline mark
|
|
18
18
|
*/
|
|
19
|
-
unsetUnderline: () =>
|
|
19
|
+
unsetUnderline: () => ReturnType;
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
export declare const Underline: Mark<UnderlineOptions>;
|
|
23
|
+
export declare const Underline: Mark<UnderlineOptions, any>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiptap/extension-underline",
|
|
3
3
|
"description": "underline extension for tiptap",
|
|
4
|
-
"version": "2.0.0-
|
|
4
|
+
"version": "2.0.0-rc.1",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -12,16 +12,35 @@
|
|
|
12
12
|
"type": "github",
|
|
13
13
|
"url": "https://github.com/sponsors/ueberdosis"
|
|
14
14
|
},
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
15
|
+
"type": "module",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/packages/extension-underline/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-underline/src/index.d.ts",
|
|
19
27
|
"files": [
|
|
20
28
|
"src",
|
|
21
29
|
"dist"
|
|
22
30
|
],
|
|
23
31
|
"peerDependencies": {
|
|
24
|
-
"@tiptap/core": "
|
|
32
|
+
"@tiptap/core": "2.0.0-rc.1"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@tiptap/core": "2.0.0-rc.1"
|
|
36
|
+
},
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "https://github.com/ueberdosis/tiptap",
|
|
40
|
+
"directory": "packages/extension-underline"
|
|
25
41
|
},
|
|
26
|
-
"
|
|
27
|
-
|
|
42
|
+
"scripts": {
|
|
43
|
+
"clean": "rm -rf dist",
|
|
44
|
+
"build": "npm run clean && rollup -c"
|
|
45
|
+
}
|
|
46
|
+
}
|
package/src/underline.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Mark, mergeAttributes } from '@tiptap/core'
|
|
2
2
|
|
|
3
3
|
export interface UnderlineOptions {
|
|
4
4
|
HTMLAttributes: Record<string, any>,
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
declare module '@tiptap/core' {
|
|
8
|
-
interface Commands {
|
|
8
|
+
interface Commands<ReturnType> {
|
|
9
9
|
underline: {
|
|
10
10
|
/**
|
|
11
11
|
* Set an underline mark
|
|
12
12
|
*/
|
|
13
|
-
setUnderline: () =>
|
|
13
|
+
setUnderline: () => ReturnType,
|
|
14
14
|
/**
|
|
15
15
|
* Toggle an underline mark
|
|
16
16
|
*/
|
|
17
|
-
toggleUnderline: () =>
|
|
17
|
+
toggleUnderline: () => ReturnType,
|
|
18
18
|
/**
|
|
19
19
|
* Unset an underline mark
|
|
20
20
|
*/
|
|
21
|
-
unsetUnderline: () =>
|
|
21
|
+
unsetUnderline: () => ReturnType,
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -26,8 +26,10 @@ declare module '@tiptap/core' {
|
|
|
26
26
|
export const Underline = Mark.create<UnderlineOptions>({
|
|
27
27
|
name: 'underline',
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
addOptions() {
|
|
30
|
+
return {
|
|
31
|
+
HTMLAttributes: {},
|
|
32
|
+
}
|
|
31
33
|
},
|
|
32
34
|
|
|
33
35
|
parseHTML() {
|
|
@@ -50,13 +52,13 @@ export const Underline = Mark.create<UnderlineOptions>({
|
|
|
50
52
|
addCommands() {
|
|
51
53
|
return {
|
|
52
54
|
setUnderline: () => ({ commands }) => {
|
|
53
|
-
return commands.setMark(
|
|
55
|
+
return commands.setMark(this.name)
|
|
54
56
|
},
|
|
55
57
|
toggleUnderline: () => ({ commands }) => {
|
|
56
|
-
return commands.toggleMark(
|
|
58
|
+
return commands.toggleMark(this.name)
|
|
57
59
|
},
|
|
58
60
|
unsetUnderline: () => ({ commands }) => {
|
|
59
|
-
return commands.unsetMark(
|
|
61
|
+
return commands.unsetMark(this.name)
|
|
60
62
|
},
|
|
61
63
|
}
|
|
62
64
|
},
|
|
@@ -64,6 +66,7 @@ export const Underline = Mark.create<UnderlineOptions>({
|
|
|
64
66
|
addKeyboardShortcuts() {
|
|
65
67
|
return {
|
|
66
68
|
'Mod-u': () => this.editor.commands.toggleUnderline(),
|
|
69
|
+
'Mod-U': () => this.editor.commands.toggleUnderline(),
|
|
67
70
|
}
|
|
68
71
|
},
|
|
69
72
|
})
|
package/CHANGELOG.md
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
# [2.0.0-beta.9](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-underline@2.0.0-beta.8...@tiptap/extension-underline@2.0.0-beta.9) (2021-05-06)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# [2.0.0-beta.8](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-underline@2.0.0-beta.7...@tiptap/extension-underline@2.0.0-beta.8) (2021-05-05)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# [2.0.0-beta.7](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-underline@2.0.0-beta.6...@tiptap/extension-underline@2.0.0-beta.7) (2021-04-23)
|
|
23
|
-
|
|
24
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
# [2.0.0-beta.6](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-underline@2.0.0-beta.5...@tiptap/extension-underline@2.0.0-beta.6) (2021-04-22)
|
|
31
|
-
|
|
32
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
# [2.0.0-beta.5](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-underline@2.0.0-beta.4...@tiptap/extension-underline@2.0.0-beta.5) (2021-04-21)
|
|
39
|
-
|
|
40
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
# [2.0.0-beta.4](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-underline@2.0.0-beta.3...@tiptap/extension-underline@2.0.0-beta.4) (2021-04-16)
|
|
47
|
-
|
|
48
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-underline@2.0.0-beta.2...@tiptap/extension-underline@2.0.0-beta.3) (2021-04-15)
|
|
55
|
-
|
|
56
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-underline@2.0.0-beta.1...@tiptap/extension-underline@2.0.0-beta.2) (2021-04-09)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
### Bug Fixes
|
|
66
|
-
|
|
67
|
-
* fix a bug where strike and underline can’t parsed together ([eff2c41](https://github.com/ueberdosis/tiptap/commit/eff2c4140a9e15762fa2238caf21dfbc47ffc3df))
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
# [2.0.0-beta.1](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-underline@2.0.0-alpha.11...@tiptap/extension-underline@2.0.0-beta.1) (2021-03-05)
|
|
74
|
-
|
|
75
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
# [2.0.0-alpha.11](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-underline@2.0.0-alpha.10...@tiptap/extension-underline@2.0.0-alpha.11) (2021-02-16)
|
|
82
|
-
|
|
83
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
# [2.0.0-alpha.10](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-underline@2.0.0-alpha.9...@tiptap/extension-underline@2.0.0-alpha.10) (2021-02-07)
|
|
90
|
-
|
|
91
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
# [2.0.0-alpha.9](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-underline@2.0.0-alpha.8...@tiptap/extension-underline@2.0.0-alpha.9) (2021-02-05)
|
|
98
|
-
|
|
99
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
# [2.0.0-alpha.8](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-underline@2.0.0-alpha.7...@tiptap/extension-underline@2.0.0-alpha.8) (2021-01-29)
|
|
106
|
-
|
|
107
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
# [2.0.0-alpha.7](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-underline@2.0.0-alpha.6...@tiptap/extension-underline@2.0.0-alpha.7) (2021-01-29)
|
|
114
|
-
|
|
115
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
# [2.0.0-alpha.6](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-underline@2.0.0-alpha.5...@tiptap/extension-underline@2.0.0-alpha.6) (2021-01-28)
|
|
122
|
-
|
|
123
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
# [2.0.0-alpha.5](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-underline@2.0.0-alpha.4...@tiptap/extension-underline@2.0.0-alpha.5) (2020-12-18)
|
|
130
|
-
|
|
131
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
# [2.0.0-alpha.4](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-underline@2.0.0-alpha.3...@tiptap/extension-underline@2.0.0-alpha.4) (2020-12-02)
|
|
138
|
-
|
|
139
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
# [2.0.0-alpha.3](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-underline@2.0.0-alpha.2...@tiptap/extension-underline@2.0.0-alpha.3) (2020-11-19)
|
|
146
|
-
|
|
147
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
# [2.0.0-alpha.2](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-underline@2.0.0-alpha.1...@tiptap/extension-underline@2.0.0-alpha.2) (2020-11-19)
|
|
154
|
-
|
|
155
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
# [2.0.0-alpha.1](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-underline@1.0.0-alpha.2...@tiptap/extension-underline@2.0.0-alpha.1) (2020-11-18)
|
|
162
|
-
|
|
163
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
# [1.0.0-alpha.2](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-underline@1.0.0-alpha.1...@tiptap/extension-underline@1.0.0-alpha.2) (2020-11-16)
|
|
170
|
-
|
|
171
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
# 1.0.0-alpha.1 (2020-11-16)
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
### Reverts
|
|
181
|
-
|
|
182
|
-
* Revert "use global namespace" ([0c9ce26](https://github.com/ueberdosis/tiptap/commit/0c9ce26c02c07d88a757c01b0a9d7f9e2b0b7502))
|
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-underline.cjs.js","sources":["../src/underline.ts"],"sourcesContent":["import { Command, Mark, mergeAttributes } from '@tiptap/core'\n\nexport interface UnderlineOptions {\n HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands {\n underline: {\n /**\n * Set an underline mark\n */\n setUnderline: () => Command,\n /**\n * Toggle an underline mark\n */\n toggleUnderline: () => Command,\n /**\n * Unset an underline mark\n */\n unsetUnderline: () => Command,\n }\n }\n}\n\nexport const Underline = Mark.create<UnderlineOptions>({\n name: 'underline',\n\n defaultOptions: {\n HTMLAttributes: {},\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('underline')\n },\n toggleUnderline: () => ({ commands }) => {\n return commands.toggleMark('underline')\n },\n unsetUnderline: () => ({ commands }) => {\n return commands.unsetMark('underline')\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-u': () => this.editor.commands.toggleUnderline(),\n }\n },\n})\n"],"names":["Mark","mergeAttributes"],"mappings":";;;;;;MAyBa,SAAS,GAAGA,SAAI,CAAC,MAAM,CAAmB;IACrD,IAAI,EAAE,WAAW;IAEjB,cAAc,EAAE;QACd,cAAc,EAAE,EAAE;KACnB;IAED,SAAS;QACP,OAAO;YACL;gBACE,GAAG,EAAE,GAAG;aACT;YACD;gBACE,KAAK,EAAE,iBAAiB;gBACxB,SAAS,EAAE,KAAK;gBAChB,QAAQ,EAAE,KAAK,KAAM,KAAgB,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;aAC1E;SACF,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE;QAC3B,OAAO,CAAC,GAAG,EAAEC,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;KAC9E;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-underline.esm.js","sources":["../src/underline.ts"],"sourcesContent":["import { Command, Mark, mergeAttributes } from '@tiptap/core'\n\nexport interface UnderlineOptions {\n HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands {\n underline: {\n /**\n * Set an underline mark\n */\n setUnderline: () => Command,\n /**\n * Toggle an underline mark\n */\n toggleUnderline: () => Command,\n /**\n * Unset an underline mark\n */\n unsetUnderline: () => Command,\n }\n }\n}\n\nexport const Underline = Mark.create<UnderlineOptions>({\n name: 'underline',\n\n defaultOptions: {\n HTMLAttributes: {},\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('underline')\n },\n toggleUnderline: () => ({ commands }) => {\n return commands.toggleMark('underline')\n },\n unsetUnderline: () => ({ commands }) => {\n return commands.unsetMark('underline')\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-u': () => this.editor.commands.toggleUnderline(),\n }\n },\n})\n"],"names":[],"mappings":";;MAyBa,SAAS,GAAG,IAAI,CAAC,MAAM,CAAmB;IACrD,IAAI,EAAE,WAAW;IAEjB,cAAc,EAAE;QACd,cAAc,EAAE,EAAE;KACnB;IAED,SAAS;QACP,OAAO;YACL;gBACE,GAAG,EAAE,GAAG;aACT;YACD;gBACE,KAAK,EAAE,iBAAiB;gBACxB,SAAS,EAAE,KAAK;gBAChB,QAAQ,EAAE,KAAK,KAAM,KAAgB,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;aAC1E;SACF,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE;QAC3B,OAAO,CAAC,GAAG,EAAE,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;KAC9E;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-underline.umd.js","sources":["../src/underline.ts"],"sourcesContent":["import { Command, Mark, mergeAttributes } from '@tiptap/core'\n\nexport interface UnderlineOptions {\n HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands {\n underline: {\n /**\n * Set an underline mark\n */\n setUnderline: () => Command,\n /**\n * Toggle an underline mark\n */\n toggleUnderline: () => Command,\n /**\n * Unset an underline mark\n */\n unsetUnderline: () => Command,\n }\n }\n}\n\nexport const Underline = Mark.create<UnderlineOptions>({\n name: 'underline',\n\n defaultOptions: {\n HTMLAttributes: {},\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('underline')\n },\n toggleUnderline: () => ({ commands }) => {\n return commands.toggleMark('underline')\n },\n unsetUnderline: () => ({ commands }) => {\n return commands.unsetMark('underline')\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-u': () => this.editor.commands.toggleUnderline(),\n }\n },\n})\n"],"names":["Mark","mergeAttributes"],"mappings":";;;;;;QAyBa,SAAS,GAAGA,SAAI,CAAC,MAAM,CAAmB;MACrD,IAAI,EAAE,WAAW;MAEjB,cAAc,EAAE;UACd,cAAc,EAAE,EAAE;OACnB;MAED,SAAS;UACP,OAAO;cACL;kBACE,GAAG,EAAE,GAAG;eACT;cACD;kBACE,KAAK,EAAE,iBAAiB;kBACxB,SAAS,EAAE,KAAK;kBAChB,QAAQ,EAAE,KAAK,KAAM,KAAgB,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;eAC1E;WACF,CAAA;OACF;MAED,UAAU,CAAC,EAAE,cAAc,EAAE;UAC3B,OAAO,CAAC,GAAG,EAAEC,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;OAC9E;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;;;;;;;;;;;"}
|