@tiptap/extension-underline 2.0.0-beta.2 → 2.0.0-beta.20
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 +1 -1
- package/README.md +2 -2
- package/package.json +7 -3
- package/src/underline.ts +10 -10
- package/CHANGELOG.md +0 -126
- package/dist/packages/extension-underline/src/index.d.ts +0 -3
- package/dist/packages/extension-underline/src/underline.d.ts +0 -25
- package/dist/tiptap-extension-underline.bundle.umd.min.js +0 -2
- package/dist/tiptap-extension-underline.bundle.umd.min.js.map +0 -1
- package/dist/tiptap-extension-underline.cjs.js +0 -49
- package/dist/tiptap-extension-underline.cjs.js.map +0 -1
- package/dist/tiptap-extension-underline.esm.js +0 -45
- package/dist/tiptap-extension-underline.esm.js.map +0 -1
- package/dist/tiptap-extension-underline.umd.js +0 -53
- package/dist/tiptap-extension-underline.umd.js.map +0 -1
package/LICENSE.md
CHANGED
package/README.md
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
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
|
-
##
|
|
10
|
+
## Official Documentation
|
|
11
11
|
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
|
12
12
|
|
|
13
13
|
## License
|
|
14
|
-
tiptap is open
|
|
14
|
+
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap/blob/main/LICENSE.md).
|
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-beta.
|
|
4
|
+
"version": "2.0.0-beta.20",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
"main": "dist/tiptap-extension-underline.cjs.js",
|
|
16
16
|
"umd": "dist/tiptap-extension-underline.umd.js",
|
|
17
17
|
"module": "dist/tiptap-extension-underline.esm.js",
|
|
18
|
-
"unpkg": "dist/tiptap-extension-underline.bundle.umd.min.js",
|
|
19
18
|
"types": "dist/packages/extension-underline/src/index.d.ts",
|
|
20
19
|
"files": [
|
|
21
20
|
"src",
|
|
@@ -24,5 +23,10 @@
|
|
|
24
23
|
"peerDependencies": {
|
|
25
24
|
"@tiptap/core": "^2.0.0-beta.1"
|
|
26
25
|
},
|
|
27
|
-
"
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/ueberdosis/tiptap",
|
|
29
|
+
"directory": "packages/extension-underline"
|
|
30
|
+
},
|
|
31
|
+
"gitHead": "fce16e805824972834d5a8ce8d60e3ff41d63c7e"
|
|
28
32
|
}
|
package/src/underline.ts
CHANGED
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Mark, mergeAttributes } from '@tiptap/core'
|
|
2
2
|
|
|
3
3
|
export interface UnderlineOptions {
|
|
4
|
-
HTMLAttributes:
|
|
5
|
-
[key: string]: any
|
|
6
|
-
},
|
|
4
|
+
HTMLAttributes: Record<string, any>,
|
|
7
5
|
}
|
|
8
6
|
|
|
9
7
|
declare module '@tiptap/core' {
|
|
10
|
-
interface Commands {
|
|
8
|
+
interface Commands<ReturnType> {
|
|
11
9
|
underline: {
|
|
12
10
|
/**
|
|
13
11
|
* Set an underline mark
|
|
14
12
|
*/
|
|
15
|
-
setUnderline: () =>
|
|
13
|
+
setUnderline: () => ReturnType,
|
|
16
14
|
/**
|
|
17
15
|
* Toggle an underline mark
|
|
18
16
|
*/
|
|
19
|
-
toggleUnderline: () =>
|
|
17
|
+
toggleUnderline: () => ReturnType,
|
|
20
18
|
/**
|
|
21
19
|
* Unset an underline mark
|
|
22
20
|
*/
|
|
23
|
-
unsetUnderline: () =>
|
|
21
|
+
unsetUnderline: () => ReturnType,
|
|
24
22
|
}
|
|
25
23
|
}
|
|
26
24
|
}
|
|
@@ -28,8 +26,10 @@ declare module '@tiptap/core' {
|
|
|
28
26
|
export const Underline = Mark.create<UnderlineOptions>({
|
|
29
27
|
name: 'underline',
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
addOptions() {
|
|
30
|
+
return {
|
|
31
|
+
HTMLAttributes: {},
|
|
32
|
+
}
|
|
33
33
|
},
|
|
34
34
|
|
|
35
35
|
parseHTML() {
|
package/CHANGELOG.md
DELETED
|
@@ -1,126 +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.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-underline@2.0.0-beta.1...@tiptap/extension-underline@2.0.0-beta.2) (2021-04-09)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### Bug Fixes
|
|
10
|
-
|
|
11
|
-
* fix a bug where strike and underline can’t parsed together ([eff2c41](https://github.com/ueberdosis/tiptap-next/commit/eff2c4140a9e15762fa2238caf21dfbc47ffc3df))
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
# [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-underline@2.0.0-alpha.11...@tiptap/extension-underline@2.0.0-beta.1) (2021-03-05)
|
|
18
|
-
|
|
19
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
# [2.0.0-alpha.11](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-underline@2.0.0-alpha.10...@tiptap/extension-underline@2.0.0-alpha.11) (2021-02-16)
|
|
26
|
-
|
|
27
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
# [2.0.0-alpha.10](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-underline@2.0.0-alpha.9...@tiptap/extension-underline@2.0.0-alpha.10) (2021-02-07)
|
|
34
|
-
|
|
35
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
# [2.0.0-alpha.9](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-underline@2.0.0-alpha.8...@tiptap/extension-underline@2.0.0-alpha.9) (2021-02-05)
|
|
42
|
-
|
|
43
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
# [2.0.0-alpha.8](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-underline@2.0.0-alpha.7...@tiptap/extension-underline@2.0.0-alpha.8) (2021-01-29)
|
|
50
|
-
|
|
51
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
# [2.0.0-alpha.7](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-underline@2.0.0-alpha.6...@tiptap/extension-underline@2.0.0-alpha.7) (2021-01-29)
|
|
58
|
-
|
|
59
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
# [2.0.0-alpha.6](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-underline@2.0.0-alpha.5...@tiptap/extension-underline@2.0.0-alpha.6) (2021-01-28)
|
|
66
|
-
|
|
67
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
# [2.0.0-alpha.5](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-underline@2.0.0-alpha.4...@tiptap/extension-underline@2.0.0-alpha.5) (2020-12-18)
|
|
74
|
-
|
|
75
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
# [2.0.0-alpha.4](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-underline@2.0.0-alpha.3...@tiptap/extension-underline@2.0.0-alpha.4) (2020-12-02)
|
|
82
|
-
|
|
83
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
# [2.0.0-alpha.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-underline@2.0.0-alpha.2...@tiptap/extension-underline@2.0.0-alpha.3) (2020-11-19)
|
|
90
|
-
|
|
91
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
# [2.0.0-alpha.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-underline@2.0.0-alpha.1...@tiptap/extension-underline@2.0.0-alpha.2) (2020-11-19)
|
|
98
|
-
|
|
99
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
# [2.0.0-alpha.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-underline@1.0.0-alpha.2...@tiptap/extension-underline@2.0.0-alpha.1) (2020-11-18)
|
|
106
|
-
|
|
107
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
# [1.0.0-alpha.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-underline@1.0.0-alpha.1...@tiptap/extension-underline@1.0.0-alpha.2) (2020-11-16)
|
|
114
|
-
|
|
115
|
-
**Note:** Version bump only for package @tiptap/extension-underline
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
# 1.0.0-alpha.1 (2020-11-16)
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
### Reverts
|
|
125
|
-
|
|
126
|
-
* Revert "use global namespace" ([0c9ce26](https://github.com/ueberdosis/tiptap-next/commit/0c9ce26c02c07d88a757c01b0a9d7f9e2b0b7502))
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Command, Mark } from '@tiptap/core';
|
|
2
|
-
export interface UnderlineOptions {
|
|
3
|
-
HTMLAttributes: {
|
|
4
|
-
[key: string]: any;
|
|
5
|
-
};
|
|
6
|
-
}
|
|
7
|
-
declare module '@tiptap/core' {
|
|
8
|
-
interface Commands {
|
|
9
|
-
underline: {
|
|
10
|
-
/**
|
|
11
|
-
* Set an underline mark
|
|
12
|
-
*/
|
|
13
|
-
setUnderline: () => Command;
|
|
14
|
-
/**
|
|
15
|
-
* Toggle an underline mark
|
|
16
|
-
*/
|
|
17
|
-
toggleUnderline: () => Command;
|
|
18
|
-
/**
|
|
19
|
-
* Unset an underline mark
|
|
20
|
-
*/
|
|
21
|
-
unsetUnderline: () => Command;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export declare const Underline: Mark<UnderlineOptions>;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@tiptap/core")):"function"==typeof define&&define.amd?define(["exports","@tiptap/core"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@tiptap/extension-underline"]={},e["@tiptap/core"])}(this,(function(e,t){"use strict";const n=t.Mark.create({name:"underline",defaultOptions:{HTMLAttributes:{}},parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",t.mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands:()=>({setUnderline:()=>({commands:e})=>e.setMark("underline"),toggleUnderline:()=>({commands:e})=>e.toggleMark("underline"),unsetUnderline:()=>({commands:e})=>e.unsetMark("underline")}),addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline()}}});e.Underline=n,e.default=n,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
2
|
-
//# sourceMappingURL=tiptap-extension-underline.bundle.umd.min.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-extension-underline.bundle.umd.min.js","sources":["../src/underline.ts"],"sourcesContent":["import { Command, Mark, mergeAttributes } from '@tiptap/core'\n\nexport interface UnderlineOptions {\n HTMLAttributes: {\n [key: string]: any\n },\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":["Underline","Mark","create","name","defaultOptions","HTMLAttributes","parseHTML","tag","style","consuming","getAttrs","includes","[object Object]","mergeAttributes","this","options","addCommands","setUnderline","commands","setMark","toggleUnderline","toggleMark","unsetUnderline","unsetMark","Mod-u","editor"],"mappings":"uUA2BaA,EAAYC,OAAKC,OAAyB,CACrDC,KAAM,YAENC,eAAgB,CACdC,eAAgB,IAGlBC,UAAS,IACA,CACL,CACEC,IAAK,KAEP,CACEC,MAAO,kBACPC,WAAW,EACXC,SAAUF,KAAWA,EAAiBG,SAAS,cAAe,KAKpEC,YAAWP,eAAEA,IACX,MAAO,CAAC,IAAKQ,kBAAgBC,KAAKC,QAAQV,eAAgBA,GAAiB,IAG7EW,YAAW,KACF,CACLC,aAAc,IAAM,EAAGC,SAAAA,KACdA,EAASC,QAAQ,aAE1BC,gBAAiB,IAAM,EAAGF,SAAAA,KACjBA,EAASG,WAAW,aAE7BC,eAAgB,IAAM,EAAGJ,SAAAA,KAChBA,EAASK,UAAU,eAKhCX,uBACE,MAAO,CACLY,QAAS,IAAMV,KAAKW,OAAOP,SAASE"}
|
|
@@ -1,49 +0,0 @@
|
|
|
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
|
-
defaultOptions: {
|
|
10
|
-
HTMLAttributes: {},
|
|
11
|
-
},
|
|
12
|
-
parseHTML() {
|
|
13
|
-
return [
|
|
14
|
-
{
|
|
15
|
-
tag: 'u',
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
style: 'text-decoration',
|
|
19
|
-
consuming: false,
|
|
20
|
-
getAttrs: style => (style.includes('underline') ? {} : false),
|
|
21
|
-
},
|
|
22
|
-
];
|
|
23
|
-
},
|
|
24
|
-
renderHTML({ HTMLAttributes }) {
|
|
25
|
-
return ['u', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
26
|
-
},
|
|
27
|
-
addCommands() {
|
|
28
|
-
return {
|
|
29
|
-
setUnderline: () => ({ commands }) => {
|
|
30
|
-
return commands.setMark('underline');
|
|
31
|
-
},
|
|
32
|
-
toggleUnderline: () => ({ commands }) => {
|
|
33
|
-
return commands.toggleMark('underline');
|
|
34
|
-
},
|
|
35
|
-
unsetUnderline: () => ({ commands }) => {
|
|
36
|
-
return commands.unsetMark('underline');
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
},
|
|
40
|
-
addKeyboardShortcuts() {
|
|
41
|
-
return {
|
|
42
|
-
'Mod-u': () => this.editor.commands.toggleUnderline(),
|
|
43
|
-
};
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
exports.Underline = Underline;
|
|
48
|
-
exports.default = Underline;
|
|
49
|
-
//# sourceMappingURL=tiptap-extension-underline.cjs.js.map
|
|
@@ -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: {\n [key: string]: any\n },\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":";;;;;;MA2Ba,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,45 +0,0 @@
|
|
|
1
|
-
import { Mark, mergeAttributes } from '@tiptap/core';
|
|
2
|
-
|
|
3
|
-
const Underline = Mark.create({
|
|
4
|
-
name: 'underline',
|
|
5
|
-
defaultOptions: {
|
|
6
|
-
HTMLAttributes: {},
|
|
7
|
-
},
|
|
8
|
-
parseHTML() {
|
|
9
|
-
return [
|
|
10
|
-
{
|
|
11
|
-
tag: 'u',
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
style: 'text-decoration',
|
|
15
|
-
consuming: false,
|
|
16
|
-
getAttrs: style => (style.includes('underline') ? {} : false),
|
|
17
|
-
},
|
|
18
|
-
];
|
|
19
|
-
},
|
|
20
|
-
renderHTML({ HTMLAttributes }) {
|
|
21
|
-
return ['u', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
22
|
-
},
|
|
23
|
-
addCommands() {
|
|
24
|
-
return {
|
|
25
|
-
setUnderline: () => ({ commands }) => {
|
|
26
|
-
return commands.setMark('underline');
|
|
27
|
-
},
|
|
28
|
-
toggleUnderline: () => ({ commands }) => {
|
|
29
|
-
return commands.toggleMark('underline');
|
|
30
|
-
},
|
|
31
|
-
unsetUnderline: () => ({ commands }) => {
|
|
32
|
-
return commands.unsetMark('underline');
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
addKeyboardShortcuts() {
|
|
37
|
-
return {
|
|
38
|
-
'Mod-u': () => this.editor.commands.toggleUnderline(),
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
export default Underline;
|
|
44
|
-
export { Underline };
|
|
45
|
-
//# sourceMappingURL=tiptap-extension-underline.esm.js.map
|
|
@@ -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: {\n [key: string]: any\n },\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":";;MA2Ba,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,53 +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-underline'] = {}, global.core));
|
|
5
|
-
}(this, (function (exports, core) { 'use strict';
|
|
6
|
-
|
|
7
|
-
const Underline = core.Mark.create({
|
|
8
|
-
name: 'underline',
|
|
9
|
-
defaultOptions: {
|
|
10
|
-
HTMLAttributes: {},
|
|
11
|
-
},
|
|
12
|
-
parseHTML() {
|
|
13
|
-
return [
|
|
14
|
-
{
|
|
15
|
-
tag: 'u',
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
style: 'text-decoration',
|
|
19
|
-
consuming: false,
|
|
20
|
-
getAttrs: style => (style.includes('underline') ? {} : false),
|
|
21
|
-
},
|
|
22
|
-
];
|
|
23
|
-
},
|
|
24
|
-
renderHTML({ HTMLAttributes }) {
|
|
25
|
-
return ['u', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
26
|
-
},
|
|
27
|
-
addCommands() {
|
|
28
|
-
return {
|
|
29
|
-
setUnderline: () => ({ commands }) => {
|
|
30
|
-
return commands.setMark('underline');
|
|
31
|
-
},
|
|
32
|
-
toggleUnderline: () => ({ commands }) => {
|
|
33
|
-
return commands.toggleMark('underline');
|
|
34
|
-
},
|
|
35
|
-
unsetUnderline: () => ({ commands }) => {
|
|
36
|
-
return commands.unsetMark('underline');
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
},
|
|
40
|
-
addKeyboardShortcuts() {
|
|
41
|
-
return {
|
|
42
|
-
'Mod-u': () => this.editor.commands.toggleUnderline(),
|
|
43
|
-
};
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
exports.Underline = Underline;
|
|
48
|
-
exports.default = Underline;
|
|
49
|
-
|
|
50
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
51
|
-
|
|
52
|
-
})));
|
|
53
|
-
//# sourceMappingURL=tiptap-extension-underline.umd.js.map
|
|
@@ -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: {\n [key: string]: any\n },\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":";;;;;;QA2Ba,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;;;;;;;;;;;"}
|