@tiptap/extension-typography 2.11.6 → 3.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +5 -1
- package/dist/index.cjs +264 -219
- package/dist/index.cjs.map +1 -1
- package/dist/{typography.d.ts → index.d.cts} +28 -25
- package/dist/index.d.ts +144 -4
- package/dist/index.js +217 -194
- package/dist/index.js.map +1 -1
- package/package.json +10 -8
- package/src/typography.ts +153 -131
- package/dist/index.d.ts.map +0 -1
- package/dist/index.umd.js +0 -227
- package/dist/index.umd.js.map +0 -1
- package/dist/typography.d.ts.map +0 -1
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025, Tiptap GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
# @tiptap/extension-typography
|
|
2
|
+
|
|
2
3
|
[](https://www.npmjs.com/package/@tiptap/extension-typography)
|
|
3
4
|
[](https://npmcharts.com/compare/tiptap?minimal=true)
|
|
4
5
|
[](https://www.npmjs.com/package/@tiptap/extension-typography)
|
|
5
6
|
[](https://github.com/sponsors/ueberdosis)
|
|
6
7
|
|
|
7
8
|
## Introduction
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
Tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a toolkit for building rich text WYSIWYG editors, which is already in use at many well-known companies such as _New York Times_, _The Guardian_ or _Atlassian_.
|
|
9
11
|
|
|
10
12
|
## Official Documentation
|
|
13
|
+
|
|
11
14
|
Documentation can be found on the [Tiptap website](https://tiptap.dev).
|
|
12
15
|
|
|
13
16
|
## License
|
|
17
|
+
|
|
14
18
|
Tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap/blob/main/LICENSE.md).
|
package/dist/index.cjs
CHANGED
|
@@ -1,223 +1,268 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2
19
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
Typography: () => Typography,
|
|
24
|
+
closeDoubleQuote: () => closeDoubleQuote,
|
|
25
|
+
closeSingleQuote: () => closeSingleQuote,
|
|
26
|
+
copyright: () => copyright,
|
|
27
|
+
default: () => index_default,
|
|
28
|
+
ellipsis: () => ellipsis,
|
|
29
|
+
emDash: () => emDash,
|
|
30
|
+
laquo: () => laquo,
|
|
31
|
+
leftArrow: () => leftArrow,
|
|
32
|
+
multiplication: () => multiplication,
|
|
33
|
+
notEqual: () => notEqual,
|
|
34
|
+
oneHalf: () => oneHalf,
|
|
35
|
+
oneQuarter: () => oneQuarter,
|
|
36
|
+
openDoubleQuote: () => openDoubleQuote,
|
|
37
|
+
openSingleQuote: () => openSingleQuote,
|
|
38
|
+
plusMinus: () => plusMinus,
|
|
39
|
+
raquo: () => raquo,
|
|
40
|
+
registeredTrademark: () => registeredTrademark,
|
|
41
|
+
rightArrow: () => rightArrow,
|
|
42
|
+
servicemark: () => servicemark,
|
|
43
|
+
superscriptThree: () => superscriptThree,
|
|
44
|
+
superscriptTwo: () => superscriptTwo,
|
|
45
|
+
threeQuarters: () => threeQuarters,
|
|
46
|
+
trademark: () => trademark
|
|
47
|
+
});
|
|
48
|
+
module.exports = __toCommonJS(index_exports);
|
|
6
49
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
return rules;
|
|
196
|
-
},
|
|
50
|
+
// src/typography.ts
|
|
51
|
+
var import_core = require("@tiptap/core");
|
|
52
|
+
var emDash = (override) => (0, import_core.textInputRule)({
|
|
53
|
+
find: /--$/,
|
|
54
|
+
replace: override != null ? override : "\u2014"
|
|
55
|
+
});
|
|
56
|
+
var ellipsis = (override) => (0, import_core.textInputRule)({
|
|
57
|
+
find: /\.\.\.$/,
|
|
58
|
+
replace: override != null ? override : "\u2026"
|
|
59
|
+
});
|
|
60
|
+
var openDoubleQuote = (override) => (0, import_core.textInputRule)({
|
|
61
|
+
find: /(?:^|[\s{[(<'"\u2018\u201C])(")$/,
|
|
62
|
+
replace: override != null ? override : "\u201C"
|
|
63
|
+
});
|
|
64
|
+
var closeDoubleQuote = (override) => (0, import_core.textInputRule)({
|
|
65
|
+
find: /"$/,
|
|
66
|
+
replace: override != null ? override : "\u201D"
|
|
67
|
+
});
|
|
68
|
+
var openSingleQuote = (override) => (0, import_core.textInputRule)({
|
|
69
|
+
find: /(?:^|[\s{[(<'"\u2018\u201C])(')$/,
|
|
70
|
+
replace: override != null ? override : "\u2018"
|
|
71
|
+
});
|
|
72
|
+
var closeSingleQuote = (override) => (0, import_core.textInputRule)({
|
|
73
|
+
find: /'$/,
|
|
74
|
+
replace: override != null ? override : "\u2019"
|
|
75
|
+
});
|
|
76
|
+
var leftArrow = (override) => (0, import_core.textInputRule)({
|
|
77
|
+
find: /<-$/,
|
|
78
|
+
replace: override != null ? override : "\u2190"
|
|
79
|
+
});
|
|
80
|
+
var rightArrow = (override) => (0, import_core.textInputRule)({
|
|
81
|
+
find: /->$/,
|
|
82
|
+
replace: override != null ? override : "\u2192"
|
|
83
|
+
});
|
|
84
|
+
var copyright = (override) => (0, import_core.textInputRule)({
|
|
85
|
+
find: /\(c\)$/,
|
|
86
|
+
replace: override != null ? override : "\xA9"
|
|
87
|
+
});
|
|
88
|
+
var trademark = (override) => (0, import_core.textInputRule)({
|
|
89
|
+
find: /\(tm\)$/,
|
|
90
|
+
replace: override != null ? override : "\u2122"
|
|
91
|
+
});
|
|
92
|
+
var servicemark = (override) => (0, import_core.textInputRule)({
|
|
93
|
+
find: /\(sm\)$/,
|
|
94
|
+
replace: override != null ? override : "\u2120"
|
|
95
|
+
});
|
|
96
|
+
var registeredTrademark = (override) => (0, import_core.textInputRule)({
|
|
97
|
+
find: /\(r\)$/,
|
|
98
|
+
replace: override != null ? override : "\xAE"
|
|
99
|
+
});
|
|
100
|
+
var oneHalf = (override) => (0, import_core.textInputRule)({
|
|
101
|
+
find: /(?:^|\s)(1\/2)\s$/,
|
|
102
|
+
replace: override != null ? override : "\xBD"
|
|
103
|
+
});
|
|
104
|
+
var plusMinus = (override) => (0, import_core.textInputRule)({
|
|
105
|
+
find: /\+\/-$/,
|
|
106
|
+
replace: override != null ? override : "\xB1"
|
|
107
|
+
});
|
|
108
|
+
var notEqual = (override) => (0, import_core.textInputRule)({
|
|
109
|
+
find: /!=$/,
|
|
110
|
+
replace: override != null ? override : "\u2260"
|
|
111
|
+
});
|
|
112
|
+
var laquo = (override) => (0, import_core.textInputRule)({
|
|
113
|
+
find: /<<$/,
|
|
114
|
+
replace: override != null ? override : "\xAB"
|
|
115
|
+
});
|
|
116
|
+
var raquo = (override) => (0, import_core.textInputRule)({
|
|
117
|
+
find: />>$/,
|
|
118
|
+
replace: override != null ? override : "\xBB"
|
|
119
|
+
});
|
|
120
|
+
var multiplication = (override) => (0, import_core.textInputRule)({
|
|
121
|
+
find: /\d+\s?([*x])\s?\d+$/,
|
|
122
|
+
replace: override != null ? override : "\xD7"
|
|
123
|
+
});
|
|
124
|
+
var superscriptTwo = (override) => (0, import_core.textInputRule)({
|
|
125
|
+
find: /\^2$/,
|
|
126
|
+
replace: override != null ? override : "\xB2"
|
|
127
|
+
});
|
|
128
|
+
var superscriptThree = (override) => (0, import_core.textInputRule)({
|
|
129
|
+
find: /\^3$/,
|
|
130
|
+
replace: override != null ? override : "\xB3"
|
|
131
|
+
});
|
|
132
|
+
var oneQuarter = (override) => (0, import_core.textInputRule)({
|
|
133
|
+
find: /(?:^|\s)(1\/4)\s$/,
|
|
134
|
+
replace: override != null ? override : "\xBC"
|
|
135
|
+
});
|
|
136
|
+
var threeQuarters = (override) => (0, import_core.textInputRule)({
|
|
137
|
+
find: /(?:^|\s)(3\/4)\s$/,
|
|
138
|
+
replace: override != null ? override : "\xBE"
|
|
139
|
+
});
|
|
140
|
+
var Typography = import_core.Extension.create({
|
|
141
|
+
name: "typography",
|
|
142
|
+
addOptions() {
|
|
143
|
+
return {
|
|
144
|
+
closeDoubleQuote: "\u201D",
|
|
145
|
+
closeSingleQuote: "\u2019",
|
|
146
|
+
copyright: "\xA9",
|
|
147
|
+
ellipsis: "\u2026",
|
|
148
|
+
emDash: "\u2014",
|
|
149
|
+
laquo: "\xAB",
|
|
150
|
+
leftArrow: "\u2190",
|
|
151
|
+
multiplication: "\xD7",
|
|
152
|
+
notEqual: "\u2260",
|
|
153
|
+
oneHalf: "\xBD",
|
|
154
|
+
oneQuarter: "\xBC",
|
|
155
|
+
openDoubleQuote: "\u201C",
|
|
156
|
+
openSingleQuote: "\u2018",
|
|
157
|
+
plusMinus: "\xB1",
|
|
158
|
+
raquo: "\xBB",
|
|
159
|
+
registeredTrademark: "\xAE",
|
|
160
|
+
rightArrow: "\u2192",
|
|
161
|
+
servicemark: "\u2120",
|
|
162
|
+
superscriptThree: "\xB3",
|
|
163
|
+
superscriptTwo: "\xB2",
|
|
164
|
+
threeQuarters: "\xBE",
|
|
165
|
+
trademark: "\u2122"
|
|
166
|
+
};
|
|
167
|
+
},
|
|
168
|
+
addInputRules() {
|
|
169
|
+
const rules = [];
|
|
170
|
+
if (this.options.emDash !== false) {
|
|
171
|
+
rules.push(emDash(this.options.emDash));
|
|
172
|
+
}
|
|
173
|
+
if (this.options.ellipsis !== false) {
|
|
174
|
+
rules.push(ellipsis(this.options.ellipsis));
|
|
175
|
+
}
|
|
176
|
+
if (this.options.openDoubleQuote !== false) {
|
|
177
|
+
rules.push(openDoubleQuote(this.options.openDoubleQuote));
|
|
178
|
+
}
|
|
179
|
+
if (this.options.closeDoubleQuote !== false) {
|
|
180
|
+
rules.push(closeDoubleQuote(this.options.closeDoubleQuote));
|
|
181
|
+
}
|
|
182
|
+
if (this.options.openSingleQuote !== false) {
|
|
183
|
+
rules.push(openSingleQuote(this.options.openSingleQuote));
|
|
184
|
+
}
|
|
185
|
+
if (this.options.closeSingleQuote !== false) {
|
|
186
|
+
rules.push(closeSingleQuote(this.options.closeSingleQuote));
|
|
187
|
+
}
|
|
188
|
+
if (this.options.leftArrow !== false) {
|
|
189
|
+
rules.push(leftArrow(this.options.leftArrow));
|
|
190
|
+
}
|
|
191
|
+
if (this.options.rightArrow !== false) {
|
|
192
|
+
rules.push(rightArrow(this.options.rightArrow));
|
|
193
|
+
}
|
|
194
|
+
if (this.options.copyright !== false) {
|
|
195
|
+
rules.push(copyright(this.options.copyright));
|
|
196
|
+
}
|
|
197
|
+
if (this.options.trademark !== false) {
|
|
198
|
+
rules.push(trademark(this.options.trademark));
|
|
199
|
+
}
|
|
200
|
+
if (this.options.servicemark !== false) {
|
|
201
|
+
rules.push(servicemark(this.options.servicemark));
|
|
202
|
+
}
|
|
203
|
+
if (this.options.registeredTrademark !== false) {
|
|
204
|
+
rules.push(registeredTrademark(this.options.registeredTrademark));
|
|
205
|
+
}
|
|
206
|
+
if (this.options.oneHalf !== false) {
|
|
207
|
+
rules.push(oneHalf(this.options.oneHalf));
|
|
208
|
+
}
|
|
209
|
+
if (this.options.plusMinus !== false) {
|
|
210
|
+
rules.push(plusMinus(this.options.plusMinus));
|
|
211
|
+
}
|
|
212
|
+
if (this.options.notEqual !== false) {
|
|
213
|
+
rules.push(notEqual(this.options.notEqual));
|
|
214
|
+
}
|
|
215
|
+
if (this.options.laquo !== false) {
|
|
216
|
+
rules.push(laquo(this.options.laquo));
|
|
217
|
+
}
|
|
218
|
+
if (this.options.raquo !== false) {
|
|
219
|
+
rules.push(raquo(this.options.raquo));
|
|
220
|
+
}
|
|
221
|
+
if (this.options.multiplication !== false) {
|
|
222
|
+
rules.push(multiplication(this.options.multiplication));
|
|
223
|
+
}
|
|
224
|
+
if (this.options.superscriptTwo !== false) {
|
|
225
|
+
rules.push(superscriptTwo(this.options.superscriptTwo));
|
|
226
|
+
}
|
|
227
|
+
if (this.options.superscriptThree !== false) {
|
|
228
|
+
rules.push(superscriptThree(this.options.superscriptThree));
|
|
229
|
+
}
|
|
230
|
+
if (this.options.oneQuarter !== false) {
|
|
231
|
+
rules.push(oneQuarter(this.options.oneQuarter));
|
|
232
|
+
}
|
|
233
|
+
if (this.options.threeQuarters !== false) {
|
|
234
|
+
rules.push(threeQuarters(this.options.threeQuarters));
|
|
235
|
+
}
|
|
236
|
+
return rules;
|
|
237
|
+
}
|
|
197
238
|
});
|
|
198
239
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
exports
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
240
|
+
// src/index.ts
|
|
241
|
+
var index_default = Typography;
|
|
242
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
243
|
+
0 && (module.exports = {
|
|
244
|
+
Typography,
|
|
245
|
+
closeDoubleQuote,
|
|
246
|
+
closeSingleQuote,
|
|
247
|
+
copyright,
|
|
248
|
+
ellipsis,
|
|
249
|
+
emDash,
|
|
250
|
+
laquo,
|
|
251
|
+
leftArrow,
|
|
252
|
+
multiplication,
|
|
253
|
+
notEqual,
|
|
254
|
+
oneHalf,
|
|
255
|
+
oneQuarter,
|
|
256
|
+
openDoubleQuote,
|
|
257
|
+
openSingleQuote,
|
|
258
|
+
plusMinus,
|
|
259
|
+
raquo,
|
|
260
|
+
registeredTrademark,
|
|
261
|
+
rightArrow,
|
|
262
|
+
servicemark,
|
|
263
|
+
superscriptThree,
|
|
264
|
+
superscriptTwo,
|
|
265
|
+
threeQuarters,
|
|
266
|
+
trademark
|
|
267
|
+
});
|
|
268
|
+
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/typography.ts"],"sourcesContent":["import { Extension, textInputRule } from '@tiptap/core'\n\nexport interface TypographyOptions {\n /**\n * The em dash character.\n * @default '—'\n */\n emDash: false | string,\n\n /**\n * The ellipsis character.\n * @default '…'\n */\n ellipsis: false | string,\n\n /**\n * The open double quote character.\n * @default '“'\n */\n openDoubleQuote: false | string,\n\n /**\n * The close double quote character.\n * @default '”'\n */\n closeDoubleQuote: false | string,\n\n /**\n * The open single quote character.\n * @default '‘'\n */\n openSingleQuote: false | string,\n\n /**\n * The close single quote character.\n * @default '’'\n */\n closeSingleQuote: false | string,\n\n /**\n * The left arrow character.\n * @default '←'\n */\n leftArrow: false | string,\n\n /**\n * The right arrow character.\n * @default '→'\n */\n rightArrow: false | string,\n\n /**\n * The copyright character.\n * @default '©'\n */\n copyright: false | string,\n\n /**\n * The trademark character.\n * @default '™'\n */\n trademark: false | string,\n\n /**\n * The servicemark character.\n * @default '℠'\n */\n servicemark: false | string,\n\n /**\n * The registered trademark character.\n * @default '®'\n */\n registeredTrademark: false | string,\n\n /**\n * The one half character.\n * @default '½'\n */\n oneHalf: false | string,\n\n /**\n * The plus minus character.\n * @default '±'\n */\n plusMinus: false | string,\n\n /**\n * The not equal character.\n * @default '≠'\n */\n notEqual: false | string,\n\n /**\n * The laquo character.\n * @default '«'\n */\n laquo: false | string,\n\n /**\n * The raquo character.\n * @default '»'\n */\n raquo: false | string,\n\n /**\n * The multiplication character.\n * @default '×'\n */\n multiplication: false | string,\n\n /**\n * The superscript two character.\n * @default '²'\n */\n superscriptTwo: false | string,\n\n /**\n * The superscript three character.\n * @default '³'\n */\n superscriptThree: false | string,\n\n /**\n * The one quarter character.\n * @default '¼'\n */\n oneQuarter: false | string,\n\n /**\n * The three quarters character.\n * @default '¾'\n */\n threeQuarters: false | string,\n}\n\nexport const emDash = (override?: string) => textInputRule({\n find: /--$/,\n replace: override ?? '—',\n})\n\nexport const ellipsis = (override?: string) => textInputRule({\n find: /\\.\\.\\.$/,\n replace: override ?? '…',\n})\n\nexport const openDoubleQuote = (override?: string) => textInputRule({\n find: /(?:^|[\\s{[(<'\"\\u2018\\u201C])(\")$/,\n replace: override ?? '“',\n})\n\nexport const closeDoubleQuote = (override?: string) => textInputRule({\n find: /\"$/,\n replace: override ?? '”',\n})\n\nexport const openSingleQuote = (override?: string) => textInputRule({\n find: /(?:^|[\\s{[(<'\"\\u2018\\u201C])(')$/,\n replace: override ?? '‘',\n})\n\nexport const closeSingleQuote = (override?: string) => textInputRule({\n find: /'$/,\n replace: override ?? '’',\n})\n\nexport const leftArrow = (override?: string) => textInputRule({\n find: /<-$/,\n replace: override ?? '←',\n})\n\nexport const rightArrow = (override?: string) => textInputRule({\n find: /->$/,\n replace: override ?? '→',\n})\n\nexport const copyright = (override?: string) => textInputRule({\n find: /\\(c\\)$/,\n replace: override ?? '©',\n})\n\nexport const trademark = (override?: string) => textInputRule({\n find: /\\(tm\\)$/,\n replace: override ?? '™',\n})\n\nexport const servicemark = (override?: string) => textInputRule({\n find: /\\(sm\\)$/,\n replace: override ?? '℠',\n})\n\nexport const registeredTrademark = (override?: string) => textInputRule({\n find: /\\(r\\)$/,\n replace: override ?? '®',\n})\n\nexport const oneHalf = (override?: string) => textInputRule({\n find: /(?:^|\\s)(1\\/2)\\s$/,\n replace: override ?? '½',\n})\n\nexport const plusMinus = (override?: string) => textInputRule({\n find: /\\+\\/-$/,\n replace: override ?? '±',\n})\n\nexport const notEqual = (override?: string) => textInputRule({\n find: /!=$/,\n replace: override ?? '≠',\n})\n\nexport const laquo = (override?: string) => textInputRule({\n find: /<<$/,\n replace: override ?? '«',\n})\n\nexport const raquo = (override?: string) => textInputRule({\n find: />>$/,\n replace: override ?? '»',\n})\n\nexport const multiplication = (override?: string) => textInputRule({\n find: /\\d+\\s?([*x])\\s?\\d+$/,\n replace: override ?? '×',\n})\n\nexport const superscriptTwo = (override?: string) => textInputRule({\n find: /\\^2$/,\n replace: override ?? '²',\n})\n\nexport const superscriptThree = (override?: string) => textInputRule({\n find: /\\^3$/,\n replace: override ?? '³',\n})\n\nexport const oneQuarter = (override?: string) => textInputRule({\n find: /(?:^|\\s)(1\\/4)\\s$/,\n replace: override ?? '¼',\n})\n\nexport const threeQuarters = (override?: string) => textInputRule({\n find: /(?:^|\\s)(3\\/4)\\s$/,\n replace: override ?? '¾',\n})\n\n/**\n * This extension allows you to add typography replacements for specific characters.\n * @see https://www.tiptap.dev/api/extensions/typography\n */\nexport const Typography = Extension.create<TypographyOptions>({\n name: 'typography',\n\n addOptions() {\n return {\n closeDoubleQuote: '”',\n closeSingleQuote: '’',\n copyright: '©',\n ellipsis: '…',\n emDash: '—',\n laquo: '«',\n leftArrow: '←',\n multiplication: '×',\n notEqual: '≠',\n oneHalf: '½',\n oneQuarter: '¼',\n openDoubleQuote: '“',\n openSingleQuote: '‘',\n plusMinus: '±',\n raquo: '»',\n registeredTrademark: '®',\n rightArrow: '→',\n servicemark: '℠',\n superscriptThree: '³',\n superscriptTwo: '²',\n threeQuarters: '¾',\n trademark: '™',\n }\n },\n\n addInputRules() {\n const rules = []\n\n if (this.options.emDash !== false) {\n rules.push(emDash(this.options.emDash))\n }\n\n if (this.options.ellipsis !== false) {\n rules.push(ellipsis(this.options.ellipsis))\n }\n\n if (this.options.openDoubleQuote !== false) {\n rules.push(openDoubleQuote(this.options.openDoubleQuote))\n }\n\n if (this.options.closeDoubleQuote !== false) {\n rules.push(closeDoubleQuote(this.options.closeDoubleQuote))\n }\n\n if (this.options.openSingleQuote !== false) {\n rules.push(openSingleQuote(this.options.openSingleQuote))\n }\n\n if (this.options.closeSingleQuote !== false) {\n rules.push(closeSingleQuote(this.options.closeSingleQuote))\n }\n\n if (this.options.leftArrow !== false) {\n rules.push(leftArrow(this.options.leftArrow))\n }\n\n if (this.options.rightArrow !== false) {\n rules.push(rightArrow(this.options.rightArrow))\n }\n\n if (this.options.copyright !== false) {\n rules.push(copyright(this.options.copyright))\n }\n\n if (this.options.trademark !== false) {\n rules.push(trademark(this.options.trademark))\n }\n\n if (this.options.servicemark !== false) {\n rules.push(servicemark(this.options.servicemark))\n }\n\n if (this.options.registeredTrademark !== false) {\n rules.push(registeredTrademark(this.options.registeredTrademark))\n }\n\n if (this.options.oneHalf !== false) {\n rules.push(oneHalf(this.options.oneHalf))\n }\n\n if (this.options.plusMinus !== false) {\n rules.push(plusMinus(this.options.plusMinus))\n }\n\n if (this.options.notEqual !== false) {\n rules.push(notEqual(this.options.notEqual))\n }\n\n if (this.options.laquo !== false) {\n rules.push(laquo(this.options.laquo))\n }\n\n if (this.options.raquo !== false) {\n rules.push(raquo(this.options.raquo))\n }\n\n if (this.options.multiplication !== false) {\n rules.push(multiplication(this.options.multiplication))\n }\n\n if (this.options.superscriptTwo !== false) {\n rules.push(superscriptTwo(this.options.superscriptTwo))\n }\n\n if (this.options.superscriptThree !== false) {\n rules.push(superscriptThree(this.options.superscriptThree))\n }\n\n if (this.options.oneQuarter !== false) {\n rules.push(oneQuarter(this.options.oneQuarter))\n }\n\n if (this.options.threeQuarters !== false) {\n rules.push(threeQuarters(this.options.threeQuarters))\n }\n\n return rules\n },\n})\n"],"names":["textInputRule","Extension"],"mappings":";;;;;;AAwIa,MAAA,MAAM,GAAG,CAAC,QAAiB,KAAKA,kBAAa,CAAC;AACzD,IAAA,IAAI,EAAE,KAAK;AACX,IAAA,OAAO,EAAE,QAAQ,KAAA,IAAA,IAAR,QAAQ,KAAR,KAAA,CAAA,GAAA,QAAQ,GAAI,GAAG;AACzB,CAAA;AAEY,MAAA,QAAQ,GAAG,CAAC,QAAiB,KAAKA,kBAAa,CAAC;AAC3D,IAAA,IAAI,EAAE,SAAS;AACf,IAAA,OAAO,EAAE,QAAQ,KAAA,IAAA,IAAR,QAAQ,KAAR,KAAA,CAAA,GAAA,QAAQ,GAAI,GAAG;AACzB,CAAA;AAEY,MAAA,eAAe,GAAG,CAAC,QAAiB,KAAKA,kBAAa,CAAC;AAClE,IAAA,IAAI,EAAE,kCAAkC;AACxC,IAAA,OAAO,EAAE,QAAQ,KAAA,IAAA,IAAR,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Ac,KAAK,KAAK,EAAE;AACzC,YAAA,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;;QAGzD,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,KAAK,KAAK,EAAE;AACzC,YAAA,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;;QAGzD,IAAI,IAAI,CAAC,OAAO,CAAC,gBAAgB,KAAK,KAAK,EAAE;AAC3C,YAAA,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;;QAG7D,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,KAAK,KAAK,EAAE;AACrC,YAAA,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;;QAGjD,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,KAAK,KAAK,EAAE;AACxC,YAAA,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;;AAGvD,QAAA,OAAO,KAAK;KACb;AACF,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/typography.ts"],"sourcesContent":["import { Typography } from './typography.js'\n\nexport * from './typography.js'\n\nexport default Typography\n","import { Extension, textInputRule } from '@tiptap/core'\n\nexport interface TypographyOptions {\n /**\n * The em dash character.\n * @default '—'\n */\n emDash: false | string\n\n /**\n * The ellipsis character.\n * @default '…'\n */\n ellipsis: false | string\n\n /**\n * The open double quote character.\n * @default '“'\n */\n openDoubleQuote: false | string\n\n /**\n * The close double quote character.\n * @default '”'\n */\n closeDoubleQuote: false | string\n\n /**\n * The open single quote character.\n * @default '‘'\n */\n openSingleQuote: false | string\n\n /**\n * The close single quote character.\n * @default '’'\n */\n closeSingleQuote: false | string\n\n /**\n * The left arrow character.\n * @default '←'\n */\n leftArrow: false | string\n\n /**\n * The right arrow character.\n * @default '→'\n */\n rightArrow: false | string\n\n /**\n * The copyright character.\n * @default '©'\n */\n copyright: false | string\n\n /**\n * The trademark character.\n * @default '™'\n */\n trademark: false | string\n\n /**\n * The servicemark character.\n * @default '℠'\n */\n servicemark: false | string\n\n /**\n * The registered trademark character.\n * @default '®'\n */\n registeredTrademark: false | string\n\n /**\n * The one half character.\n * @default '½'\n */\n oneHalf: false | string\n\n /**\n * The plus minus character.\n * @default '±'\n */\n plusMinus: false | string\n\n /**\n * The not equal character.\n * @default '≠'\n */\n notEqual: false | string\n\n /**\n * The laquo character.\n * @default '«'\n */\n laquo: false | string\n\n /**\n * The raquo character.\n * @default '»'\n */\n raquo: false | string\n\n /**\n * The multiplication character.\n * @default '×'\n */\n multiplication: false | string\n\n /**\n * The superscript two character.\n * @default '²'\n */\n superscriptTwo: false | string\n\n /**\n * The superscript three character.\n * @default '³'\n */\n superscriptThree: false | string\n\n /**\n * The one quarter character.\n * @default '¼'\n */\n oneQuarter: false | string\n\n /**\n * The three quarters character.\n * @default '¾'\n */\n threeQuarters: false | string\n}\n\nexport const emDash = (override?: string) =>\n textInputRule({\n find: /--$/,\n replace: override ?? '—',\n })\n\nexport const ellipsis = (override?: string) =>\n textInputRule({\n find: /\\.\\.\\.$/,\n replace: override ?? '…',\n })\n\nexport const openDoubleQuote = (override?: string) =>\n textInputRule({\n find: /(?:^|[\\s{[(<'\"\\u2018\\u201C])(\")$/,\n replace: override ?? '“',\n })\n\nexport const closeDoubleQuote = (override?: string) =>\n textInputRule({\n find: /\"$/,\n replace: override ?? '”',\n })\n\nexport const openSingleQuote = (override?: string) =>\n textInputRule({\n find: /(?:^|[\\s{[(<'\"\\u2018\\u201C])(')$/,\n replace: override ?? '‘',\n })\n\nexport const closeSingleQuote = (override?: string) =>\n textInputRule({\n find: /'$/,\n replace: override ?? '’',\n })\n\nexport const leftArrow = (override?: string) =>\n textInputRule({\n find: /<-$/,\n replace: override ?? '←',\n })\n\nexport const rightArrow = (override?: string) =>\n textInputRule({\n find: /->$/,\n replace: override ?? '→',\n })\n\nexport const copyright = (override?: string) =>\n textInputRule({\n find: /\\(c\\)$/,\n replace: override ?? '©',\n })\n\nexport const trademark = (override?: string) =>\n textInputRule({\n find: /\\(tm\\)$/,\n replace: override ?? '™',\n })\n\nexport const servicemark = (override?: string) =>\n textInputRule({\n find: /\\(sm\\)$/,\n replace: override ?? '℠',\n })\n\nexport const registeredTrademark = (override?: string) =>\n textInputRule({\n find: /\\(r\\)$/,\n replace: override ?? '®',\n })\n\nexport const oneHalf = (override?: string) =>\n textInputRule({\n find: /(?:^|\\s)(1\\/2)\\s$/,\n replace: override ?? '½',\n })\n\nexport const plusMinus = (override?: string) =>\n textInputRule({\n find: /\\+\\/-$/,\n replace: override ?? '±',\n })\n\nexport const notEqual = (override?: string) =>\n textInputRule({\n find: /!=$/,\n replace: override ?? '≠',\n })\n\nexport const laquo = (override?: string) =>\n textInputRule({\n find: /<<$/,\n replace: override ?? '«',\n })\n\nexport const raquo = (override?: string) =>\n textInputRule({\n find: />>$/,\n replace: override ?? '»',\n })\n\nexport const multiplication = (override?: string) =>\n textInputRule({\n find: /\\d+\\s?([*x])\\s?\\d+$/,\n replace: override ?? '×',\n })\n\nexport const superscriptTwo = (override?: string) =>\n textInputRule({\n find: /\\^2$/,\n replace: override ?? '²',\n })\n\nexport const superscriptThree = (override?: string) =>\n textInputRule({\n find: /\\^3$/,\n replace: override ?? '³',\n })\n\nexport const oneQuarter = (override?: string) =>\n textInputRule({\n find: /(?:^|\\s)(1\\/4)\\s$/,\n replace: override ?? '¼',\n })\n\nexport const threeQuarters = (override?: string) =>\n textInputRule({\n find: /(?:^|\\s)(3\\/4)\\s$/,\n replace: override ?? '¾',\n })\n\n/**\n * This extension allows you to add typography replacements for specific characters.\n * @see https://www.tiptap.dev/api/extensions/typography\n */\nexport const Typography = Extension.create<TypographyOptions>({\n name: 'typography',\n\n addOptions() {\n return {\n closeDoubleQuote: '”',\n closeSingleQuote: '’',\n copyright: '©',\n ellipsis: '…',\n emDash: '—',\n laquo: '«',\n leftArrow: '←',\n multiplication: '×',\n notEqual: '≠',\n oneHalf: '½',\n oneQuarter: '¼',\n openDoubleQuote: '“',\n openSingleQuote: '‘',\n plusMinus: '±',\n raquo: '»',\n registeredTrademark: '®',\n rightArrow: '→',\n servicemark: '℠',\n superscriptThree: '³',\n superscriptTwo: '²',\n threeQuarters: '¾',\n trademark: '™',\n }\n },\n\n addInputRules() {\n const rules = []\n\n if (this.options.emDash !== false) {\n rules.push(emDash(this.options.emDash))\n }\n\n if (this.options.ellipsis !== false) {\n rules.push(ellipsis(this.options.ellipsis))\n }\n\n if (this.options.openDoubleQuote !== false) {\n rules.push(openDoubleQuote(this.options.openDoubleQuote))\n }\n\n if (this.options.closeDoubleQuote !== false) {\n rules.push(closeDoubleQuote(this.options.closeDoubleQuote))\n }\n\n if (this.options.openSingleQuote !== false) {\n rules.push(openSingleQuote(this.options.openSingleQuote))\n }\n\n if (this.options.closeSingleQuote !== false) {\n rules.push(closeSingleQuote(this.options.closeSingleQuote))\n }\n\n if (this.options.leftArrow !== false) {\n rules.push(leftArrow(this.options.leftArrow))\n }\n\n if (this.options.rightArrow !== false) {\n rules.push(rightArrow(this.options.rightArrow))\n }\n\n if (this.options.copyright !== false) {\n rules.push(copyright(this.options.copyright))\n }\n\n if (this.options.trademark !== false) {\n rules.push(trademark(this.options.trademark))\n }\n\n if (this.options.servicemark !== false) {\n rules.push(servicemark(this.options.servicemark))\n }\n\n if (this.options.registeredTrademark !== false) {\n rules.push(registeredTrademark(this.options.registeredTrademark))\n }\n\n if (this.options.oneHalf !== false) {\n rules.push(oneHalf(this.options.oneHalf))\n }\n\n if (this.options.plusMinus !== false) {\n rules.push(plusMinus(this.options.plusMinus))\n }\n\n if (this.options.notEqual !== false) {\n rules.push(notEqual(this.options.notEqual))\n }\n\n if (this.options.laquo !== false) {\n rules.push(laquo(this.options.laquo))\n }\n\n if (this.options.raquo !== false) {\n rules.push(raquo(this.options.raquo))\n }\n\n if (this.options.multiplication !== false) {\n rules.push(multiplication(this.options.multiplication))\n }\n\n if (this.options.superscriptTwo !== false) {\n rules.push(superscriptTwo(this.options.superscriptTwo))\n }\n\n if (this.options.superscriptThree !== false) {\n rules.push(superscriptThree(this.options.superscriptThree))\n }\n\n if (this.options.oneQuarter !== false) {\n rules.push(oneQuarter(this.options.oneQuarter))\n }\n\n if (this.options.threeQuarters !== false) {\n rules.push(threeQuarters(this.options.threeQuarters))\n }\n\n return rules\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAyC;AAwIlC,IAAM,SAAS,CAAC,iBACrB,2BAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,WAAW,CAAC,iBACvB,2BAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,kBAAkB,CAAC,iBAC9B,2BAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,mBAAmB,CAAC,iBAC/B,2BAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,kBAAkB,CAAC,iBAC9B,2BAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,mBAAmB,CAAC,iBAC/B,2BAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,YAAY,CAAC,iBACxB,2BAAc;AAAA,EACZ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