@tiptap/extension-typography 2.5.0-beta.2 → 2.5.0-beta.3
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/dist/index.cjs +191 -191
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +190 -190
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +191 -191
- package/dist/index.umd.js.map +1 -1
- package/dist/packages/core/src/CommandManager.d.ts +20 -0
- package/dist/packages/core/src/Editor.d.ts +161 -0
- package/dist/packages/core/src/EventEmitter.d.ts +11 -0
- package/dist/packages/core/src/Extension.d.ts +343 -0
- package/dist/packages/core/src/ExtensionManager.d.ts +55 -0
- package/dist/packages/core/src/InputRule.d.ts +42 -0
- package/dist/packages/core/src/Mark.d.ts +451 -0
- package/dist/packages/core/src/Node.d.ts +611 -0
- package/dist/packages/core/src/NodePos.d.ts +44 -0
- package/dist/packages/core/src/NodeView.d.ts +31 -0
- package/dist/packages/core/src/PasteRule.d.ts +50 -0
- package/dist/packages/core/src/Tracker.d.ts +11 -0
- package/dist/packages/core/src/commands/blur.d.ts +13 -0
- package/dist/packages/core/src/commands/clearContent.d.ts +14 -0
- package/dist/packages/core/src/commands/clearNodes.d.ts +13 -0
- package/dist/packages/core/src/commands/command.d.ts +18 -0
- package/dist/packages/core/src/commands/createParagraphNear.d.ts +13 -0
- package/dist/packages/core/src/commands/cut.d.ts +20 -0
- package/dist/packages/core/src/commands/deleteCurrentNode.d.ts +13 -0
- package/dist/packages/core/src/commands/deleteNode.d.ts +15 -0
- package/dist/packages/core/src/commands/deleteRange.d.ts +14 -0
- package/dist/packages/core/src/commands/deleteSelection.d.ts +13 -0
- package/dist/packages/core/src/commands/enter.d.ts +13 -0
- package/dist/packages/core/src/commands/exitCode.d.ts +13 -0
- package/dist/packages/core/src/commands/extendMarkRange.d.ts +25 -0
- package/dist/packages/core/src/commands/first.d.ts +14 -0
- package/dist/packages/core/src/commands/focus.d.ts +27 -0
- package/dist/packages/core/src/commands/forEach.d.ts +14 -0
- package/dist/packages/core/src/commands/index.d.ts +55 -0
- package/dist/packages/core/src/commands/insertContent.d.ts +34 -0
- package/dist/packages/core/src/commands/insertContentAt.d.ts +47 -0
- package/dist/packages/core/src/commands/join.d.ts +41 -0
- package/dist/packages/core/src/commands/joinItemBackward.d.ts +13 -0
- package/dist/packages/core/src/commands/joinItemForward.d.ts +13 -0
- package/dist/packages/core/src/commands/joinTextblockBackward.d.ts +12 -0
- package/dist/packages/core/src/commands/joinTextblockForward.d.ts +12 -0
- package/dist/packages/core/src/commands/keyboardShortcut.d.ts +14 -0
- package/dist/packages/core/src/commands/lift.d.ts +17 -0
- package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +13 -0
- package/dist/packages/core/src/commands/liftListItem.d.ts +15 -0
- package/dist/packages/core/src/commands/newlineInCode.d.ts +13 -0
- package/dist/packages/core/src/commands/resetAttributes.d.ts +16 -0
- package/dist/packages/core/src/commands/scrollIntoView.d.ts +13 -0
- package/dist/packages/core/src/commands/selectAll.d.ts +13 -0
- package/dist/packages/core/src/commands/selectNodeBackward.d.ts +13 -0
- package/dist/packages/core/src/commands/selectNodeForward.d.ts +13 -0
- package/dist/packages/core/src/commands/selectParentNode.d.ts +13 -0
- package/dist/packages/core/src/commands/selectTextblockEnd.d.ts +13 -0
- package/dist/packages/core/src/commands/selectTextblockStart.d.ts +13 -0
- package/dist/packages/core/src/commands/setContent.d.ts +40 -0
- package/dist/packages/core/src/commands/setMark.d.ts +15 -0
- package/dist/packages/core/src/commands/setMeta.d.ts +15 -0
- package/dist/packages/core/src/commands/setNode.d.ts +16 -0
- package/dist/packages/core/src/commands/setNodeSelection.d.ts +14 -0
- package/dist/packages/core/src/commands/setTextSelection.d.ts +14 -0
- package/dist/packages/core/src/commands/sinkListItem.d.ts +15 -0
- package/dist/packages/core/src/commands/splitBlock.d.ts +17 -0
- package/dist/packages/core/src/commands/splitListItem.d.ts +15 -0
- package/dist/packages/core/src/commands/toggleList.d.ts +18 -0
- package/dist/packages/core/src/commands/toggleMark.d.ts +30 -0
- package/dist/packages/core/src/commands/toggleNode.d.ts +17 -0
- package/dist/packages/core/src/commands/toggleWrap.d.ts +16 -0
- package/dist/packages/core/src/commands/undoInputRule.d.ts +13 -0
- package/dist/packages/core/src/commands/unsetAllMarks.d.ts +13 -0
- package/dist/packages/core/src/commands/unsetMark.d.ts +25 -0
- package/dist/packages/core/src/commands/updateAttributes.d.ts +24 -0
- package/dist/packages/core/src/commands/wrapIn.d.ts +16 -0
- package/dist/packages/core/src/commands/wrapInList.d.ts +16 -0
- package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +5 -0
- package/dist/packages/core/src/extensions/commands.d.ts +3 -0
- package/dist/packages/core/src/extensions/editable.d.ts +2 -0
- package/dist/packages/core/src/extensions/focusEvents.d.ts +2 -0
- package/dist/packages/core/src/extensions/index.d.ts +6 -0
- package/dist/packages/core/src/extensions/keymap.d.ts +2 -0
- package/dist/packages/core/src/extensions/tabindex.d.ts +2 -0
- package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +10 -0
- package/dist/packages/core/src/helpers/createChainableState.d.ts +10 -0
- package/dist/packages/core/src/helpers/createDocument.d.ts +12 -0
- package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +15 -0
- package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +7 -0
- package/dist/packages/core/src/helpers/findChildren.d.ts +9 -0
- package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +10 -0
- package/dist/packages/core/src/helpers/findParentNode.d.ts +16 -0
- package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +17 -0
- package/dist/packages/core/src/helpers/generateHTML.d.ts +8 -0
- package/dist/packages/core/src/helpers/generateJSON.d.ts +8 -0
- package/dist/packages/core/src/helpers/generateText.d.ts +12 -0
- package/dist/packages/core/src/helpers/getAttributes.d.ts +9 -0
- package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +6 -0
- package/dist/packages/core/src/helpers/getChangedRanges.d.ts +11 -0
- package/dist/packages/core/src/helpers/getDebugJSON.d.ts +8 -0
- package/dist/packages/core/src/helpers/getExtensionField.d.ts +9 -0
- package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +2 -0
- package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +3 -0
- package/dist/packages/core/src/helpers/getMarkRange.d.ts +3 -0
- package/dist/packages/core/src/helpers/getMarkType.d.ts +2 -0
- package/dist/packages/core/src/helpers/getMarksBetween.d.ts +3 -0
- package/dist/packages/core/src/helpers/getNodeAtPosition.d.ts +11 -0
- package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +3 -0
- package/dist/packages/core/src/helpers/getNodeType.d.ts +2 -0
- package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +3 -0
- package/dist/packages/core/src/helpers/getSchema.d.ts +4 -0
- package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +10 -0
- package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +8 -0
- package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +8 -0
- package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +9 -0
- package/dist/packages/core/src/helpers/getText.d.ts +15 -0
- package/dist/packages/core/src/helpers/getTextBetween.d.ts +14 -0
- package/dist/packages/core/src/helpers/getTextContentFromNodes.d.ts +8 -0
- package/dist/packages/core/src/helpers/getTextSerializersFromSchema.d.ts +8 -0
- package/dist/packages/core/src/helpers/index.d.ts +50 -0
- package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +9 -0
- package/dist/packages/core/src/helpers/isActive.d.ts +2 -0
- package/dist/packages/core/src/helpers/isAtEndOfNode.d.ts +2 -0
- package/dist/packages/core/src/helpers/isAtStartOfNode.d.ts +2 -0
- package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +2 -0
- package/dist/packages/core/src/helpers/isList.d.ts +2 -0
- package/dist/packages/core/src/helpers/isMarkActive.d.ts +3 -0
- package/dist/packages/core/src/helpers/isNodeActive.d.ts +3 -0
- package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +2 -0
- package/dist/packages/core/src/helpers/isNodeSelection.d.ts +2 -0
- package/dist/packages/core/src/helpers/isTextSelection.d.ts +2 -0
- package/dist/packages/core/src/helpers/posToDOMRect.d.ts +2 -0
- package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +4 -0
- package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +2 -0
- package/dist/packages/core/src/helpers/splitExtensions.d.ts +9 -0
- package/dist/packages/core/src/index.d.ts +24 -0
- package/dist/packages/core/src/inputRules/index.d.ts +5 -0
- package/dist/packages/core/src/inputRules/markInputRule.d.ts +13 -0
- package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +23 -0
- package/dist/packages/core/src/inputRules/textInputRule.d.ts +10 -0
- package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +15 -0
- package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +28 -0
- package/dist/packages/core/src/pasteRules/index.d.ts +3 -0
- package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +13 -0
- package/dist/packages/core/src/pasteRules/nodePasteRule.d.ts +13 -0
- package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +10 -0
- package/dist/packages/core/src/style.d.ts +1 -0
- package/dist/packages/core/src/types.d.ts +250 -0
- package/dist/packages/core/src/utilities/callOrReturn.d.ts +9 -0
- package/dist/packages/core/src/utilities/createStyleTag.d.ts +1 -0
- package/dist/packages/core/src/utilities/deleteProps.d.ts +6 -0
- package/dist/packages/core/src/utilities/elementFromString.d.ts +1 -0
- package/dist/packages/core/src/utilities/escapeForRegEx.d.ts +1 -0
- package/dist/packages/core/src/utilities/findDuplicates.d.ts +1 -0
- package/dist/packages/core/src/utilities/fromString.d.ts +1 -0
- package/dist/packages/core/src/utilities/index.d.ts +20 -0
- package/dist/packages/core/src/utilities/isAndroid.d.ts +1 -0
- package/dist/packages/core/src/utilities/isEmptyObject.d.ts +1 -0
- package/dist/packages/core/src/utilities/isFunction.d.ts +1 -0
- package/dist/packages/core/src/utilities/isMacOS.d.ts +1 -0
- package/dist/packages/core/src/utilities/isNumber.d.ts +1 -0
- package/dist/packages/core/src/utilities/isPlainObject.d.ts +1 -0
- package/dist/packages/core/src/utilities/isRegExp.d.ts +1 -0
- package/dist/packages/core/src/utilities/isString.d.ts +1 -0
- package/dist/packages/core/src/utilities/isiOS.d.ts +1 -0
- package/dist/packages/core/src/utilities/mergeAttributes.d.ts +1 -0
- package/dist/packages/core/src/utilities/mergeDeep.d.ts +1 -0
- package/dist/packages/core/src/utilities/minMax.d.ts +1 -0
- package/dist/packages/core/src/utilities/objectIncludes.d.ts +8 -0
- package/dist/packages/core/src/utilities/removeDuplicates.d.ts +8 -0
- package/dist/packages/extension-typography/src/index.d.ts +3 -3
- package/dist/packages/extension-typography/src/typography.d.ts +140 -140
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -4,203 +4,203 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@tiptap/extension-typography"] = {}, global.core));
|
|
5
5
|
})(this, (function (exports, core) { 'use strict';
|
|
6
6
|
|
|
7
|
-
const emDash = (override) => core.textInputRule({
|
|
8
|
-
find: /--$/,
|
|
9
|
-
replace: override !== null && override !== void 0 ? override : '—',
|
|
10
|
-
});
|
|
11
|
-
const ellipsis = (override) => core.textInputRule({
|
|
12
|
-
find: /\.\.\.$/,
|
|
13
|
-
replace: override !== null && override !== void 0 ? override : '…',
|
|
14
|
-
});
|
|
15
|
-
const openDoubleQuote = (override) => core.textInputRule({
|
|
16
|
-
find: /(?:^|[\s{[(<'"\u2018\u201C])(")$/,
|
|
17
|
-
replace: override !== null && override !== void 0 ? override : '“',
|
|
18
|
-
});
|
|
19
|
-
const closeDoubleQuote = (override) => core.textInputRule({
|
|
20
|
-
find: /"$/,
|
|
21
|
-
replace: override !== null && override !== void 0 ? override : '”',
|
|
22
|
-
});
|
|
23
|
-
const openSingleQuote = (override) => core.textInputRule({
|
|
24
|
-
find: /(?:^|[\s{[(<'"\u2018\u201C])(')$/,
|
|
25
|
-
replace: override !== null && override !== void 0 ? override : '‘',
|
|
26
|
-
});
|
|
27
|
-
const closeSingleQuote = (override) => core.textInputRule({
|
|
28
|
-
find: /'$/,
|
|
29
|
-
replace: override !== null && override !== void 0 ? override : '’',
|
|
30
|
-
});
|
|
31
|
-
const leftArrow = (override) => core.textInputRule({
|
|
32
|
-
find: /<-$/,
|
|
33
|
-
replace: override !== null && override !== void 0 ? override : '←',
|
|
34
|
-
});
|
|
35
|
-
const rightArrow = (override) => core.textInputRule({
|
|
36
|
-
find: /->$/,
|
|
37
|
-
replace: override !== null && override !== void 0 ? override : '→',
|
|
38
|
-
});
|
|
39
|
-
const copyright = (override) => core.textInputRule({
|
|
40
|
-
find: /\(c\)$/,
|
|
41
|
-
replace: override !== null && override !== void 0 ? override : '©',
|
|
42
|
-
});
|
|
43
|
-
const trademark = (override) => core.textInputRule({
|
|
44
|
-
find: /\(tm\)$/,
|
|
45
|
-
replace: override !== null && override !== void 0 ? override : '™',
|
|
46
|
-
});
|
|
47
|
-
const servicemark = (override) => core.textInputRule({
|
|
48
|
-
find: /\(sm\)$/,
|
|
49
|
-
replace: override !== null && override !== void 0 ? override : '℠',
|
|
50
|
-
});
|
|
51
|
-
const registeredTrademark = (override) => core.textInputRule({
|
|
52
|
-
find: /\(r\)$/,
|
|
53
|
-
replace: override !== null && override !== void 0 ? override : '®',
|
|
54
|
-
});
|
|
55
|
-
const oneHalf = (override) => core.textInputRule({
|
|
56
|
-
find: /(?:^|\s)(1\/2)\s$/,
|
|
57
|
-
replace: override !== null && override !== void 0 ? override : '½',
|
|
58
|
-
});
|
|
59
|
-
const plusMinus = (override) => core.textInputRule({
|
|
60
|
-
find: /\+\/-$/,
|
|
61
|
-
replace: override !== null && override !== void 0 ? override : '±',
|
|
62
|
-
});
|
|
63
|
-
const notEqual = (override) => core.textInputRule({
|
|
64
|
-
find: /!=$/,
|
|
65
|
-
replace: override !== null && override !== void 0 ? override : '≠',
|
|
66
|
-
});
|
|
67
|
-
const laquo = (override) => core.textInputRule({
|
|
68
|
-
find: /<<$/,
|
|
69
|
-
replace: override !== null && override !== void 0 ? override : '«',
|
|
70
|
-
});
|
|
71
|
-
const raquo = (override) => core.textInputRule({
|
|
72
|
-
find: />>$/,
|
|
73
|
-
replace: override !== null && override !== void 0 ? override : '»',
|
|
74
|
-
});
|
|
75
|
-
const multiplication = (override) => core.textInputRule({
|
|
76
|
-
find: /\d+\s?([*x])\s?\d+$/,
|
|
77
|
-
replace: override !== null && override !== void 0 ? override : '×',
|
|
78
|
-
});
|
|
79
|
-
const superscriptTwo = (override) => core.textInputRule({
|
|
80
|
-
find: /\^2$/,
|
|
81
|
-
replace: override !== null && override !== void 0 ? override : '²',
|
|
82
|
-
});
|
|
83
|
-
const superscriptThree = (override) => core.textInputRule({
|
|
84
|
-
find: /\^3$/,
|
|
85
|
-
replace: override !== null && override !== void 0 ? override : '³',
|
|
86
|
-
});
|
|
87
|
-
const oneQuarter = (override) => core.textInputRule({
|
|
88
|
-
find: /(?:^|\s)(1\/4)\s$/,
|
|
89
|
-
replace: override !== null && override !== void 0 ? override : '¼',
|
|
90
|
-
});
|
|
91
|
-
const threeQuarters = (override) => core.textInputRule({
|
|
92
|
-
find: /(?:^|\s)(3\/4)\s$/,
|
|
93
|
-
replace: override !== null && override !== void 0 ? override : '¾',
|
|
94
|
-
});
|
|
95
|
-
/**
|
|
96
|
-
* This extension allows you to add typography replacements for specific characters.
|
|
97
|
-
* @see https://www.tiptap.dev/api/extensions/typography
|
|
98
|
-
*/
|
|
99
|
-
const Typography = core.Extension.create({
|
|
100
|
-
name: 'typography',
|
|
101
|
-
addOptions() {
|
|
102
|
-
return {
|
|
103
|
-
closeDoubleQuote: '”',
|
|
104
|
-
closeSingleQuote: '’',
|
|
105
|
-
copyright: '©',
|
|
106
|
-
ellipsis: '…',
|
|
107
|
-
emDash: '—',
|
|
108
|
-
laquo: '«',
|
|
109
|
-
leftArrow: '←',
|
|
110
|
-
multiplication: '×',
|
|
111
|
-
notEqual: '≠',
|
|
112
|
-
oneHalf: '½',
|
|
113
|
-
oneQuarter: '¼',
|
|
114
|
-
openDoubleQuote: '“',
|
|
115
|
-
openSingleQuote: '‘',
|
|
116
|
-
plusMinus: '±',
|
|
117
|
-
raquo: '»',
|
|
118
|
-
registeredTrademark: '®',
|
|
119
|
-
rightArrow: '→',
|
|
120
|
-
servicemark: '℠',
|
|
121
|
-
superscriptThree: '³',
|
|
122
|
-
superscriptTwo: '²',
|
|
123
|
-
threeQuarters: '¾',
|
|
124
|
-
trademark: '™',
|
|
125
|
-
};
|
|
126
|
-
},
|
|
127
|
-
addInputRules() {
|
|
128
|
-
const rules = [];
|
|
129
|
-
if (this.options.emDash !== false) {
|
|
130
|
-
rules.push(emDash(this.options.emDash));
|
|
131
|
-
}
|
|
132
|
-
if (this.options.ellipsis !== false) {
|
|
133
|
-
rules.push(ellipsis(this.options.ellipsis));
|
|
134
|
-
}
|
|
135
|
-
if (this.options.openDoubleQuote !== false) {
|
|
136
|
-
rules.push(openDoubleQuote(this.options.openDoubleQuote));
|
|
137
|
-
}
|
|
138
|
-
if (this.options.closeDoubleQuote !== false) {
|
|
139
|
-
rules.push(closeDoubleQuote(this.options.closeDoubleQuote));
|
|
140
|
-
}
|
|
141
|
-
if (this.options.openSingleQuote !== false) {
|
|
142
|
-
rules.push(openSingleQuote(this.options.openSingleQuote));
|
|
143
|
-
}
|
|
144
|
-
if (this.options.closeSingleQuote !== false) {
|
|
145
|
-
rules.push(closeSingleQuote(this.options.closeSingleQuote));
|
|
146
|
-
}
|
|
147
|
-
if (this.options.leftArrow !== false) {
|
|
148
|
-
rules.push(leftArrow(this.options.leftArrow));
|
|
149
|
-
}
|
|
150
|
-
if (this.options.rightArrow !== false) {
|
|
151
|
-
rules.push(rightArrow(this.options.rightArrow));
|
|
152
|
-
}
|
|
153
|
-
if (this.options.copyright !== false) {
|
|
154
|
-
rules.push(copyright(this.options.copyright));
|
|
155
|
-
}
|
|
156
|
-
if (this.options.trademark !== false) {
|
|
157
|
-
rules.push(trademark(this.options.trademark));
|
|
158
|
-
}
|
|
159
|
-
if (this.options.servicemark !== false) {
|
|
160
|
-
rules.push(servicemark(this.options.servicemark));
|
|
161
|
-
}
|
|
162
|
-
if (this.options.registeredTrademark !== false) {
|
|
163
|
-
rules.push(registeredTrademark(this.options.registeredTrademark));
|
|
164
|
-
}
|
|
165
|
-
if (this.options.oneHalf !== false) {
|
|
166
|
-
rules.push(oneHalf(this.options.oneHalf));
|
|
167
|
-
}
|
|
168
|
-
if (this.options.plusMinus !== false) {
|
|
169
|
-
rules.push(plusMinus(this.options.plusMinus));
|
|
170
|
-
}
|
|
171
|
-
if (this.options.notEqual !== false) {
|
|
172
|
-
rules.push(notEqual(this.options.notEqual));
|
|
173
|
-
}
|
|
174
|
-
if (this.options.laquo !== false) {
|
|
175
|
-
rules.push(laquo(this.options.laquo));
|
|
176
|
-
}
|
|
177
|
-
if (this.options.raquo !== false) {
|
|
178
|
-
rules.push(raquo(this.options.raquo));
|
|
179
|
-
}
|
|
180
|
-
if (this.options.multiplication !== false) {
|
|
181
|
-
rules.push(multiplication(this.options.multiplication));
|
|
182
|
-
}
|
|
183
|
-
if (this.options.superscriptTwo !== false) {
|
|
184
|
-
rules.push(superscriptTwo(this.options.superscriptTwo));
|
|
185
|
-
}
|
|
186
|
-
if (this.options.superscriptThree !== false) {
|
|
187
|
-
rules.push(superscriptThree(this.options.superscriptThree));
|
|
188
|
-
}
|
|
189
|
-
if (this.options.oneQuarter !== false) {
|
|
190
|
-
rules.push(oneQuarter(this.options.oneQuarter));
|
|
191
|
-
}
|
|
192
|
-
if (this.options.threeQuarters !== false) {
|
|
193
|
-
rules.push(threeQuarters(this.options.threeQuarters));
|
|
194
|
-
}
|
|
195
|
-
return rules;
|
|
196
|
-
},
|
|
7
|
+
const emDash = (override) => core.textInputRule({
|
|
8
|
+
find: /--$/,
|
|
9
|
+
replace: override !== null && override !== void 0 ? override : '—',
|
|
10
|
+
});
|
|
11
|
+
const ellipsis = (override) => core.textInputRule({
|
|
12
|
+
find: /\.\.\.$/,
|
|
13
|
+
replace: override !== null && override !== void 0 ? override : '…',
|
|
14
|
+
});
|
|
15
|
+
const openDoubleQuote = (override) => core.textInputRule({
|
|
16
|
+
find: /(?:^|[\s{[(<'"\u2018\u201C])(")$/,
|
|
17
|
+
replace: override !== null && override !== void 0 ? override : '“',
|
|
18
|
+
});
|
|
19
|
+
const closeDoubleQuote = (override) => core.textInputRule({
|
|
20
|
+
find: /"$/,
|
|
21
|
+
replace: override !== null && override !== void 0 ? override : '”',
|
|
22
|
+
});
|
|
23
|
+
const openSingleQuote = (override) => core.textInputRule({
|
|
24
|
+
find: /(?:^|[\s{[(<'"\u2018\u201C])(')$/,
|
|
25
|
+
replace: override !== null && override !== void 0 ? override : '‘',
|
|
26
|
+
});
|
|
27
|
+
const closeSingleQuote = (override) => core.textInputRule({
|
|
28
|
+
find: /'$/,
|
|
29
|
+
replace: override !== null && override !== void 0 ? override : '’',
|
|
30
|
+
});
|
|
31
|
+
const leftArrow = (override) => core.textInputRule({
|
|
32
|
+
find: /<-$/,
|
|
33
|
+
replace: override !== null && override !== void 0 ? override : '←',
|
|
34
|
+
});
|
|
35
|
+
const rightArrow = (override) => core.textInputRule({
|
|
36
|
+
find: /->$/,
|
|
37
|
+
replace: override !== null && override !== void 0 ? override : '→',
|
|
38
|
+
});
|
|
39
|
+
const copyright = (override) => core.textInputRule({
|
|
40
|
+
find: /\(c\)$/,
|
|
41
|
+
replace: override !== null && override !== void 0 ? override : '©',
|
|
42
|
+
});
|
|
43
|
+
const trademark = (override) => core.textInputRule({
|
|
44
|
+
find: /\(tm\)$/,
|
|
45
|
+
replace: override !== null && override !== void 0 ? override : '™',
|
|
46
|
+
});
|
|
47
|
+
const servicemark = (override) => core.textInputRule({
|
|
48
|
+
find: /\(sm\)$/,
|
|
49
|
+
replace: override !== null && override !== void 0 ? override : '℠',
|
|
50
|
+
});
|
|
51
|
+
const registeredTrademark = (override) => core.textInputRule({
|
|
52
|
+
find: /\(r\)$/,
|
|
53
|
+
replace: override !== null && override !== void 0 ? override : '®',
|
|
54
|
+
});
|
|
55
|
+
const oneHalf = (override) => core.textInputRule({
|
|
56
|
+
find: /(?:^|\s)(1\/2)\s$/,
|
|
57
|
+
replace: override !== null && override !== void 0 ? override : '½',
|
|
58
|
+
});
|
|
59
|
+
const plusMinus = (override) => core.textInputRule({
|
|
60
|
+
find: /\+\/-$/,
|
|
61
|
+
replace: override !== null && override !== void 0 ? override : '±',
|
|
62
|
+
});
|
|
63
|
+
const notEqual = (override) => core.textInputRule({
|
|
64
|
+
find: /!=$/,
|
|
65
|
+
replace: override !== null && override !== void 0 ? override : '≠',
|
|
66
|
+
});
|
|
67
|
+
const laquo = (override) => core.textInputRule({
|
|
68
|
+
find: /<<$/,
|
|
69
|
+
replace: override !== null && override !== void 0 ? override : '«',
|
|
70
|
+
});
|
|
71
|
+
const raquo = (override) => core.textInputRule({
|
|
72
|
+
find: />>$/,
|
|
73
|
+
replace: override !== null && override !== void 0 ? override : '»',
|
|
74
|
+
});
|
|
75
|
+
const multiplication = (override) => core.textInputRule({
|
|
76
|
+
find: /\d+\s?([*x])\s?\d+$/,
|
|
77
|
+
replace: override !== null && override !== void 0 ? override : '×',
|
|
78
|
+
});
|
|
79
|
+
const superscriptTwo = (override) => core.textInputRule({
|
|
80
|
+
find: /\^2$/,
|
|
81
|
+
replace: override !== null && override !== void 0 ? override : '²',
|
|
82
|
+
});
|
|
83
|
+
const superscriptThree = (override) => core.textInputRule({
|
|
84
|
+
find: /\^3$/,
|
|
85
|
+
replace: override !== null && override !== void 0 ? override : '³',
|
|
86
|
+
});
|
|
87
|
+
const oneQuarter = (override) => core.textInputRule({
|
|
88
|
+
find: /(?:^|\s)(1\/4)\s$/,
|
|
89
|
+
replace: override !== null && override !== void 0 ? override : '¼',
|
|
90
|
+
});
|
|
91
|
+
const threeQuarters = (override) => core.textInputRule({
|
|
92
|
+
find: /(?:^|\s)(3\/4)\s$/,
|
|
93
|
+
replace: override !== null && override !== void 0 ? override : '¾',
|
|
94
|
+
});
|
|
95
|
+
/**
|
|
96
|
+
* This extension allows you to add typography replacements for specific characters.
|
|
97
|
+
* @see https://www.tiptap.dev/api/extensions/typography
|
|
98
|
+
*/
|
|
99
|
+
const Typography = core.Extension.create({
|
|
100
|
+
name: 'typography',
|
|
101
|
+
addOptions() {
|
|
102
|
+
return {
|
|
103
|
+
closeDoubleQuote: '”',
|
|
104
|
+
closeSingleQuote: '’',
|
|
105
|
+
copyright: '©',
|
|
106
|
+
ellipsis: '…',
|
|
107
|
+
emDash: '—',
|
|
108
|
+
laquo: '«',
|
|
109
|
+
leftArrow: '←',
|
|
110
|
+
multiplication: '×',
|
|
111
|
+
notEqual: '≠',
|
|
112
|
+
oneHalf: '½',
|
|
113
|
+
oneQuarter: '¼',
|
|
114
|
+
openDoubleQuote: '“',
|
|
115
|
+
openSingleQuote: '‘',
|
|
116
|
+
plusMinus: '±',
|
|
117
|
+
raquo: '»',
|
|
118
|
+
registeredTrademark: '®',
|
|
119
|
+
rightArrow: '→',
|
|
120
|
+
servicemark: '℠',
|
|
121
|
+
superscriptThree: '³',
|
|
122
|
+
superscriptTwo: '²',
|
|
123
|
+
threeQuarters: '¾',
|
|
124
|
+
trademark: '™',
|
|
125
|
+
};
|
|
126
|
+
},
|
|
127
|
+
addInputRules() {
|
|
128
|
+
const rules = [];
|
|
129
|
+
if (this.options.emDash !== false) {
|
|
130
|
+
rules.push(emDash(this.options.emDash));
|
|
131
|
+
}
|
|
132
|
+
if (this.options.ellipsis !== false) {
|
|
133
|
+
rules.push(ellipsis(this.options.ellipsis));
|
|
134
|
+
}
|
|
135
|
+
if (this.options.openDoubleQuote !== false) {
|
|
136
|
+
rules.push(openDoubleQuote(this.options.openDoubleQuote));
|
|
137
|
+
}
|
|
138
|
+
if (this.options.closeDoubleQuote !== false) {
|
|
139
|
+
rules.push(closeDoubleQuote(this.options.closeDoubleQuote));
|
|
140
|
+
}
|
|
141
|
+
if (this.options.openSingleQuote !== false) {
|
|
142
|
+
rules.push(openSingleQuote(this.options.openSingleQuote));
|
|
143
|
+
}
|
|
144
|
+
if (this.options.closeSingleQuote !== false) {
|
|
145
|
+
rules.push(closeSingleQuote(this.options.closeSingleQuote));
|
|
146
|
+
}
|
|
147
|
+
if (this.options.leftArrow !== false) {
|
|
148
|
+
rules.push(leftArrow(this.options.leftArrow));
|
|
149
|
+
}
|
|
150
|
+
if (this.options.rightArrow !== false) {
|
|
151
|
+
rules.push(rightArrow(this.options.rightArrow));
|
|
152
|
+
}
|
|
153
|
+
if (this.options.copyright !== false) {
|
|
154
|
+
rules.push(copyright(this.options.copyright));
|
|
155
|
+
}
|
|
156
|
+
if (this.options.trademark !== false) {
|
|
157
|
+
rules.push(trademark(this.options.trademark));
|
|
158
|
+
}
|
|
159
|
+
if (this.options.servicemark !== false) {
|
|
160
|
+
rules.push(servicemark(this.options.servicemark));
|
|
161
|
+
}
|
|
162
|
+
if (this.options.registeredTrademark !== false) {
|
|
163
|
+
rules.push(registeredTrademark(this.options.registeredTrademark));
|
|
164
|
+
}
|
|
165
|
+
if (this.options.oneHalf !== false) {
|
|
166
|
+
rules.push(oneHalf(this.options.oneHalf));
|
|
167
|
+
}
|
|
168
|
+
if (this.options.plusMinus !== false) {
|
|
169
|
+
rules.push(plusMinus(this.options.plusMinus));
|
|
170
|
+
}
|
|
171
|
+
if (this.options.notEqual !== false) {
|
|
172
|
+
rules.push(notEqual(this.options.notEqual));
|
|
173
|
+
}
|
|
174
|
+
if (this.options.laquo !== false) {
|
|
175
|
+
rules.push(laquo(this.options.laquo));
|
|
176
|
+
}
|
|
177
|
+
if (this.options.raquo !== false) {
|
|
178
|
+
rules.push(raquo(this.options.raquo));
|
|
179
|
+
}
|
|
180
|
+
if (this.options.multiplication !== false) {
|
|
181
|
+
rules.push(multiplication(this.options.multiplication));
|
|
182
|
+
}
|
|
183
|
+
if (this.options.superscriptTwo !== false) {
|
|
184
|
+
rules.push(superscriptTwo(this.options.superscriptTwo));
|
|
185
|
+
}
|
|
186
|
+
if (this.options.superscriptThree !== false) {
|
|
187
|
+
rules.push(superscriptThree(this.options.superscriptThree));
|
|
188
|
+
}
|
|
189
|
+
if (this.options.oneQuarter !== false) {
|
|
190
|
+
rules.push(oneQuarter(this.options.oneQuarter));
|
|
191
|
+
}
|
|
192
|
+
if (this.options.threeQuarters !== false) {
|
|
193
|
+
rules.push(threeQuarters(this.options.threeQuarters));
|
|
194
|
+
}
|
|
195
|
+
return rules;
|
|
196
|
+
},
|
|
197
197
|
});
|
|
198
198
|
|
|
199
199
|
exports.Typography = Typography;
|
|
200
200
|
exports.closeDoubleQuote = closeDoubleQuote;
|
|
201
201
|
exports.closeSingleQuote = closeSingleQuote;
|
|
202
202
|
exports.copyright = copyright;
|
|
203
|
-
exports
|
|
203
|
+
exports.default = Typography;
|
|
204
204
|
exports.ellipsis = ellipsis;
|
|
205
205
|
exports.emDash = emDash;
|
|
206
206
|
exports.laquo = laquo;
|
package/dist/index.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","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,QAAA,MAAM,GAAG,CAAC,QAAiB,KAAKA,kBAAa,CAAC;EACzD,IAAA,IAAI,EAAE,KAAK;EACX,IAAA,OAAO,EAAE,QAAQ,KAAA,IAAA,IAAR,QAAQ,KAAR,KAAA,CAAA,GAAA,QAAQ,GAAI,GAAG;EACzB,CAAA,EAAC;AAEW,QAAA,QAAQ,GAAG,CAAC,QAAiB,KAAKA,kBAAa,CAAC;EAC3D,IAAA,IAAI,EAAE,SAAS;EACf,IAAA,OAAO,EAAE,QAAQ,KAAA,IAAA,IAAR,QAAQ,KAAR,KAAA,CAAA,GAAA,QAAQ,GAAI,GAAG;EACzB,CAAA,EAAC;AAEW,QAAA,eAAe,GAAG,CAAC,QAAiB,KAAKA,kBAAa,CAAC;EAClE,IAAA,IAAI,EAAE,kCAAkC;EACxC,IAAA,OAAO,EAAE,QAAQ,KAAA,IAAA,IAAR,QAAQ,KAAR,KAAA,CAAA,GAAA,QAAQ,GAAI,GAAG;EACzB,CAAA,EAAC;AAEW,QAAA,gBAAgB,GAAG,CAAC,QAAiB,KAAKA,kBAAa,CAAC;EACnE,IAAA,IAAI,EAAE,IAAI;EACV,IAAA,OAAO,EAAE,QAAQ,KAAA,IAAA,IAAR,QAAQ,KAAR,KAAA,CAAA,GAAA,QAAQ,GAAI,GAAG;EACzB,CAAA,EAAC;AAEW,QAAA,eAAe,GAAG,CAAC,QAAiB,KAAKA,kBAAa,CAAC;EAClE,IAAA,IAAI,EAAE,kCAAkC;EACxC,IAAA,OAAO,EAAE,QAA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AC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;EACtC,SAAA;EAED,QAAA,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,KAAK,KAAK,EAAE;EACzC,YAAA,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAA;EACxD,SAAA;EAED,QAAA,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,KAAK,KAAK,EAAE;EACzC,YAAA,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAA;EACxD,SAAA;EAED,QAAA,IAAI,IAAI,CAAC,OAAO,CAAC,gBAAgB,KAAK,KAAK,EAAE;EAC3C,YAAA,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAA;EAC5D,SAAA;EAED,QAAA,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,KAAK,KAAK,EAAE;EACrC,YAAA,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAA;EAChD,SAAA;EAED,QAAA,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,KAAK,KAAK,EAAE;EACxC,YAAA,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAA;EACtD,SAAA;EAED,QAAA,OAAO,KAAK,CAAA;OACb;EACF,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.umd.js","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,QAAA,MAAM,GAAG,CAAC,QAAiB,KAAKA,kBAAa,CAAC;EACzD,IAAA,IAAI,EAAE,KAAK;EACX,IAAA,OAAO,EAAE,QAAQ,KAAA,IAAA,IAAR,QAAQ,KAAR,KAAA,CAAA,GAAA,QAAQ,GAAI,GAAG;EACzB,CAAA,EAAC;AAEW,QAAA,QAAQ,GAAG,CAAC,QAAiB,KAAKA,kBAAa,CAAC;EAC3D,IAAA,IAAI,EAAE,SAAS;EACf,IAAA,OAAO,EAAE,QAAQ,KAAA,IAAA,IAAR,QAAQ,KAAR,KAAA,CAAA,GAAA,QAAQ,GAAI,GAAG;EACzB,CAAA,EAAC;AAEW,QAAA,eAAe,GAAG,CAAC,QAAiB,KAAKA,kBAAa,CAAC;EAClE,IAAA,IAAI,EAAE,kCAAkC;EACxC,IAAA,OAAO,EAAE,QAAQ,KAAA,IAAA,IAAR,QAAQ,KAAR,KAAA,CAAA,GAAA,QAAQ,GAAI,GAAG;EACzB,CAAA,EAAC;AAEW,QAAA,gBAAgB,GAAG,CAAC,QAAiB,KAAKA,kBAAa,CAAC;EACnE,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AK,KAAK,EAAE;EAChC,YAAA,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;WACtC;UAED,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,KAAK,KAAK,EAAE;EACzC,YAAA,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAA;WACxD;UAED,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,KAAK,KAAK,EAAE;EACzC,YAAA,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAA;WACxD;UAED,IAAI,IAAI,CAAC,OAAO,CAAC,gBAAgB,KAAK,KAAK,EAAE;EAC3C,YAAA,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAA;WAC5D;UAED,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,KAAK,KAAK,EAAE;EACrC,YAAA,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAA;WAChD;UAED,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,KAAK,KAAK,EAAE;EACxC,YAAA,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAA;WACtD;EAED,QAAA,OAAO,KAAK,CAAA;OACb;EACF,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EditorState, Transaction } from '@tiptap/pm/state';
|
|
2
|
+
import { Editor } from './Editor.js';
|
|
3
|
+
import { AnyCommands, CanCommands, ChainedCommands, CommandProps, SingleCommands } from './types.js';
|
|
4
|
+
export declare class CommandManager {
|
|
5
|
+
editor: Editor;
|
|
6
|
+
rawCommands: AnyCommands;
|
|
7
|
+
customState?: EditorState;
|
|
8
|
+
constructor(props: {
|
|
9
|
+
editor: Editor;
|
|
10
|
+
state?: EditorState;
|
|
11
|
+
});
|
|
12
|
+
get hasCustomState(): boolean;
|
|
13
|
+
get state(): EditorState;
|
|
14
|
+
get commands(): SingleCommands;
|
|
15
|
+
get chain(): () => ChainedCommands;
|
|
16
|
+
get can(): () => CanCommands;
|
|
17
|
+
createChain(startTr?: Transaction, shouldDispatch?: boolean): ChainedCommands;
|
|
18
|
+
createCan(startTr?: Transaction): CanCommands;
|
|
19
|
+
buildProps(tr: Transaction, shouldDispatch?: boolean): CommandProps;
|
|
20
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { MarkType, NodeType, Schema } from '@tiptap/pm/model';
|
|
2
|
+
import { EditorState, Plugin, PluginKey, Transaction } from '@tiptap/pm/state';
|
|
3
|
+
import { EditorView } from '@tiptap/pm/view';
|
|
4
|
+
import { EventEmitter } from './EventEmitter.js';
|
|
5
|
+
import { ExtensionManager } from './ExtensionManager.js';
|
|
6
|
+
import { NodePos } from './NodePos.js';
|
|
7
|
+
import { CanCommands, ChainedCommands, EditorEvents, EditorOptions, JSONContent, SingleCommands, TextSerializer } from './types.js';
|
|
8
|
+
export * as extensions from './extensions/index.js';
|
|
9
|
+
declare global {
|
|
10
|
+
interface HTMLElement {
|
|
11
|
+
editor?: Editor;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export declare class Editor extends EventEmitter<EditorEvents> {
|
|
15
|
+
private commandManager;
|
|
16
|
+
extensionManager: ExtensionManager;
|
|
17
|
+
private css;
|
|
18
|
+
schema: Schema;
|
|
19
|
+
view: EditorView;
|
|
20
|
+
isFocused: boolean;
|
|
21
|
+
extensionStorage: Record<string, any>;
|
|
22
|
+
options: EditorOptions;
|
|
23
|
+
constructor(options?: Partial<EditorOptions>);
|
|
24
|
+
/**
|
|
25
|
+
* Returns the editor storage.
|
|
26
|
+
*/
|
|
27
|
+
get storage(): Record<string, any>;
|
|
28
|
+
/**
|
|
29
|
+
* An object of all registered commands.
|
|
30
|
+
*/
|
|
31
|
+
get commands(): SingleCommands;
|
|
32
|
+
/**
|
|
33
|
+
* Create a command chain to call multiple commands at once.
|
|
34
|
+
*/
|
|
35
|
+
chain(): ChainedCommands;
|
|
36
|
+
/**
|
|
37
|
+
* Check if a command or a command chain can be executed. Without executing it.
|
|
38
|
+
*/
|
|
39
|
+
can(): CanCommands;
|
|
40
|
+
/**
|
|
41
|
+
* Inject CSS styles.
|
|
42
|
+
*/
|
|
43
|
+
private injectCSS;
|
|
44
|
+
/**
|
|
45
|
+
* Update editor options.
|
|
46
|
+
*
|
|
47
|
+
* @param options A list of options
|
|
48
|
+
*/
|
|
49
|
+
setOptions(options?: Partial<EditorOptions>): void;
|
|
50
|
+
/**
|
|
51
|
+
* Update editable state of the editor.
|
|
52
|
+
*/
|
|
53
|
+
setEditable(editable: boolean, emitUpdate?: boolean): void;
|
|
54
|
+
/**
|
|
55
|
+
* Returns whether the editor is editable.
|
|
56
|
+
*/
|
|
57
|
+
get isEditable(): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Returns the editor state.
|
|
60
|
+
*/
|
|
61
|
+
get state(): EditorState;
|
|
62
|
+
/**
|
|
63
|
+
* Register a ProseMirror plugin.
|
|
64
|
+
*
|
|
65
|
+
* @param plugin A ProseMirror plugin
|
|
66
|
+
* @param handlePlugins Control how to merge the plugin into the existing plugins.
|
|
67
|
+
*/
|
|
68
|
+
registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): void;
|
|
69
|
+
/**
|
|
70
|
+
* Unregister a ProseMirror plugin.
|
|
71
|
+
*
|
|
72
|
+
* @param nameOrPluginKey The plugins name
|
|
73
|
+
*/
|
|
74
|
+
unregisterPlugin(nameOrPluginKey: string | PluginKey): void;
|
|
75
|
+
/**
|
|
76
|
+
* Creates an extension manager.
|
|
77
|
+
*/
|
|
78
|
+
private createExtensionManager;
|
|
79
|
+
/**
|
|
80
|
+
* Creates an command manager.
|
|
81
|
+
*/
|
|
82
|
+
private createCommandManager;
|
|
83
|
+
/**
|
|
84
|
+
* Creates a ProseMirror schema.
|
|
85
|
+
*/
|
|
86
|
+
private createSchema;
|
|
87
|
+
/**
|
|
88
|
+
* Creates a ProseMirror view.
|
|
89
|
+
*/
|
|
90
|
+
private createView;
|
|
91
|
+
/**
|
|
92
|
+
* Creates all node views.
|
|
93
|
+
*/
|
|
94
|
+
createNodeViews(): void;
|
|
95
|
+
/**
|
|
96
|
+
* Prepend class name to element.
|
|
97
|
+
*/
|
|
98
|
+
prependClass(): void;
|
|
99
|
+
isCapturingTransaction: boolean;
|
|
100
|
+
private capturedTransaction;
|
|
101
|
+
captureTransaction(fn: Function): Transaction | null;
|
|
102
|
+
/**
|
|
103
|
+
* The callback over which to send transactions (state updates) produced by the view.
|
|
104
|
+
*
|
|
105
|
+
* @param transaction An editor state transaction
|
|
106
|
+
*/
|
|
107
|
+
private dispatchTransaction;
|
|
108
|
+
/**
|
|
109
|
+
* Get attributes of the currently selected node or mark.
|
|
110
|
+
*/
|
|
111
|
+
getAttributes(nameOrType: string | NodeType | MarkType): Record<string, any>;
|
|
112
|
+
/**
|
|
113
|
+
* Returns if the currently selected node or mark is active.
|
|
114
|
+
*
|
|
115
|
+
* @param name Name of the node or mark
|
|
116
|
+
* @param attributes Attributes of the node or mark
|
|
117
|
+
*/
|
|
118
|
+
isActive(name: string, attributes?: {}): boolean;
|
|
119
|
+
isActive(attributes: {}): boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Get the document as JSON.
|
|
122
|
+
*/
|
|
123
|
+
getJSON(): JSONContent;
|
|
124
|
+
/**
|
|
125
|
+
* Get the document as HTML.
|
|
126
|
+
*/
|
|
127
|
+
getHTML(): string;
|
|
128
|
+
/**
|
|
129
|
+
* Get the document as text.
|
|
130
|
+
*/
|
|
131
|
+
getText(options?: {
|
|
132
|
+
blockSeparator?: string;
|
|
133
|
+
textSerializers?: Record<string, TextSerializer>;
|
|
134
|
+
}): string;
|
|
135
|
+
/**
|
|
136
|
+
* Check if there is no content.
|
|
137
|
+
*/
|
|
138
|
+
get isEmpty(): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Get the number of characters for the current document.
|
|
141
|
+
*
|
|
142
|
+
* @deprecated
|
|
143
|
+
*/
|
|
144
|
+
getCharacterCount(): number;
|
|
145
|
+
/**
|
|
146
|
+
* Destroy the editor.
|
|
147
|
+
*/
|
|
148
|
+
destroy(): void;
|
|
149
|
+
/**
|
|
150
|
+
* Check if the editor is already destroyed.
|
|
151
|
+
*/
|
|
152
|
+
get isDestroyed(): boolean;
|
|
153
|
+
$node(selector: string, attributes?: {
|
|
154
|
+
[key: string]: any;
|
|
155
|
+
}): NodePos | null;
|
|
156
|
+
$nodes(selector: string, attributes?: {
|
|
157
|
+
[key: string]: any;
|
|
158
|
+
}): NodePos[] | null;
|
|
159
|
+
$pos(pos: number): NodePos;
|
|
160
|
+
get $doc(): NodePos;
|
|
161
|
+
}
|