@tiptap/extension-superscript 2.0.0-beta.209 → 2.0.0-beta.211
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 +54 -0
- package/dist/{packages/extension-superscript/src/superscript.d.ts → index.d.ts} +26 -23
- package/dist/index.js +54 -0
- package/package.json +23 -10
- package/dist/packages/extension-superscript/src/index.d.ts +0 -3
- package/dist/tiptap-extension-superscript.cjs +0 -57
- package/dist/tiptap-extension-superscript.cjs.map +0 -1
- package/dist/tiptap-extension-superscript.esm.js +0 -52
- package/dist/tiptap-extension-superscript.esm.js.map +0 -1
- package/dist/tiptap-extension-superscript.umd.js +0 -61
- package/dist/tiptap-extension-superscript.umd.js.map +0 -1
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/superscript.ts
|
|
2
|
+
var _core = require('@tiptap/core');
|
|
3
|
+
var Superscript = _core.Mark.create({
|
|
4
|
+
name: "superscript",
|
|
5
|
+
addOptions() {
|
|
6
|
+
return {
|
|
7
|
+
HTMLAttributes: {}
|
|
8
|
+
};
|
|
9
|
+
},
|
|
10
|
+
parseHTML() {
|
|
11
|
+
return [
|
|
12
|
+
{
|
|
13
|
+
tag: "sup"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
style: "vertical-align",
|
|
17
|
+
getAttrs(value) {
|
|
18
|
+
if (value !== "super") {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
];
|
|
25
|
+
},
|
|
26
|
+
renderHTML({ HTMLAttributes }) {
|
|
27
|
+
return ["sup", _core.mergeAttributes.call(void 0, this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
28
|
+
},
|
|
29
|
+
addCommands() {
|
|
30
|
+
return {
|
|
31
|
+
setSuperscript: () => ({ commands }) => {
|
|
32
|
+
return commands.setMark(this.name);
|
|
33
|
+
},
|
|
34
|
+
toggleSuperscript: () => ({ commands }) => {
|
|
35
|
+
return commands.toggleMark(this.name);
|
|
36
|
+
},
|
|
37
|
+
unsetSuperscript: () => ({ commands }) => {
|
|
38
|
+
return commands.unsetMark(this.name);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
addKeyboardShortcuts() {
|
|
43
|
+
return {
|
|
44
|
+
"Mod-.": () => this.editor.commands.toggleSuperscript()
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// src/index.ts
|
|
50
|
+
var src_default = Superscript;
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
exports.Superscript = Superscript; exports.default = src_default;
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import { Mark } from '@tiptap/core';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
1
|
+
import { Mark } from '@tiptap/core';
|
|
2
|
+
|
|
3
|
+
interface SuperscriptExtensionOptions {
|
|
4
|
+
HTMLAttributes: Object;
|
|
5
|
+
}
|
|
6
|
+
declare module '@tiptap/core' {
|
|
7
|
+
interface Commands<ReturnType> {
|
|
8
|
+
superscript: {
|
|
9
|
+
/**
|
|
10
|
+
* Set a superscript mark
|
|
11
|
+
*/
|
|
12
|
+
setSuperscript: () => ReturnType;
|
|
13
|
+
/**
|
|
14
|
+
* Toggle a superscript mark
|
|
15
|
+
*/
|
|
16
|
+
toggleSuperscript: () => ReturnType;
|
|
17
|
+
/**
|
|
18
|
+
* Unset a superscript mark
|
|
19
|
+
*/
|
|
20
|
+
unsetSuperscript: () => ReturnType;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
declare const Superscript: Mark<SuperscriptExtensionOptions, any>;
|
|
25
|
+
|
|
26
|
+
export { Superscript, SuperscriptExtensionOptions, Superscript as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// src/superscript.ts
|
|
2
|
+
import { Mark, mergeAttributes } from "@tiptap/core";
|
|
3
|
+
var Superscript = Mark.create({
|
|
4
|
+
name: "superscript",
|
|
5
|
+
addOptions() {
|
|
6
|
+
return {
|
|
7
|
+
HTMLAttributes: {}
|
|
8
|
+
};
|
|
9
|
+
},
|
|
10
|
+
parseHTML() {
|
|
11
|
+
return [
|
|
12
|
+
{
|
|
13
|
+
tag: "sup"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
style: "vertical-align",
|
|
17
|
+
getAttrs(value) {
|
|
18
|
+
if (value !== "super") {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
];
|
|
25
|
+
},
|
|
26
|
+
renderHTML({ HTMLAttributes }) {
|
|
27
|
+
return ["sup", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
28
|
+
},
|
|
29
|
+
addCommands() {
|
|
30
|
+
return {
|
|
31
|
+
setSuperscript: () => ({ commands }) => {
|
|
32
|
+
return commands.setMark(this.name);
|
|
33
|
+
},
|
|
34
|
+
toggleSuperscript: () => ({ commands }) => {
|
|
35
|
+
return commands.toggleMark(this.name);
|
|
36
|
+
},
|
|
37
|
+
unsetSuperscript: () => ({ commands }) => {
|
|
38
|
+
return commands.unsetMark(this.name);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
addKeyboardShortcuts() {
|
|
43
|
+
return {
|
|
44
|
+
"Mod-.": () => this.editor.commands.toggleSuperscript()
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// src/index.ts
|
|
50
|
+
var src_default = Superscript;
|
|
51
|
+
export {
|
|
52
|
+
Superscript,
|
|
53
|
+
src_default as default
|
|
54
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiptap/extension-superscript",
|
|
3
3
|
"description": "superscript extension for tiptap",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.211",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -15,28 +15,41 @@
|
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
-
"types": "./dist/
|
|
19
|
-
"import": "./dist/
|
|
20
|
-
"require": "./dist/
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js",
|
|
20
|
+
"require": "./dist/index.cjs"
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
|
-
"main": "dist/
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"types": "dist/packages/extension-superscript/src/index.d.ts",
|
|
23
|
+
"main": "dist/index.cjs",
|
|
24
|
+
"module": "dist/index.js",
|
|
25
|
+
"types": "dist/index.d.ts",
|
|
27
26
|
"files": [
|
|
28
27
|
"src",
|
|
29
28
|
"dist"
|
|
30
29
|
],
|
|
31
30
|
"peerDependencies": {
|
|
32
|
-
"@tiptap/core": "^2.0.0-beta.
|
|
31
|
+
"@tiptap/core": "^2.0.0-beta.209"
|
|
33
32
|
},
|
|
34
33
|
"devDependencies": {
|
|
35
|
-
"@tiptap/core": "^2.0.0-beta.
|
|
34
|
+
"@tiptap/core": "^2.0.0-beta.211"
|
|
36
35
|
},
|
|
37
36
|
"repository": {
|
|
38
37
|
"type": "git",
|
|
39
38
|
"url": "https://github.com/ueberdosis/tiptap",
|
|
40
39
|
"directory": "packages/extension-superscript"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsup"
|
|
43
|
+
},
|
|
44
|
+
"tsup": {
|
|
45
|
+
"entry": [
|
|
46
|
+
"src/index.ts"
|
|
47
|
+
],
|
|
48
|
+
"dts": true,
|
|
49
|
+
"splitting": true,
|
|
50
|
+
"format": [
|
|
51
|
+
"esm",
|
|
52
|
+
"cjs"
|
|
53
|
+
]
|
|
41
54
|
}
|
|
42
55
|
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var core = require('@tiptap/core');
|
|
6
|
-
|
|
7
|
-
const Superscript = core.Mark.create({
|
|
8
|
-
name: 'superscript',
|
|
9
|
-
addOptions() {
|
|
10
|
-
return {
|
|
11
|
-
HTMLAttributes: {},
|
|
12
|
-
};
|
|
13
|
-
},
|
|
14
|
-
parseHTML() {
|
|
15
|
-
return [
|
|
16
|
-
{
|
|
17
|
-
tag: 'sup',
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
style: 'vertical-align',
|
|
21
|
-
getAttrs(value) {
|
|
22
|
-
// Don’t match this rule if the vertical align isn’t super.
|
|
23
|
-
if (value !== 'super') {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
// If it falls through we’ll match, and this mark will be applied.
|
|
27
|
-
return null;
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
];
|
|
31
|
-
},
|
|
32
|
-
renderHTML({ HTMLAttributes }) {
|
|
33
|
-
return ['sup', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
34
|
-
},
|
|
35
|
-
addCommands() {
|
|
36
|
-
return {
|
|
37
|
-
setSuperscript: () => ({ commands }) => {
|
|
38
|
-
return commands.setMark(this.name);
|
|
39
|
-
},
|
|
40
|
-
toggleSuperscript: () => ({ commands }) => {
|
|
41
|
-
return commands.toggleMark(this.name);
|
|
42
|
-
},
|
|
43
|
-
unsetSuperscript: () => ({ commands }) => {
|
|
44
|
-
return commands.unsetMark(this.name);
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
},
|
|
48
|
-
addKeyboardShortcuts() {
|
|
49
|
-
return {
|
|
50
|
-
'Mod-.': () => this.editor.commands.toggleSuperscript(),
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
exports.Superscript = Superscript;
|
|
56
|
-
exports["default"] = Superscript;
|
|
57
|
-
//# sourceMappingURL=tiptap-extension-superscript.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-extension-superscript.cjs","sources":["../src/superscript.ts"],"sourcesContent":["import { Mark, mergeAttributes } from '@tiptap/core'\n\nexport interface SuperscriptExtensionOptions {\n HTMLAttributes: Object,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n superscript: {\n /**\n * Set a superscript mark\n */\n setSuperscript: () => ReturnType,\n /**\n * Toggle a superscript mark\n */\n toggleSuperscript: () => ReturnType,\n /**\n * Unset a superscript mark\n */\n unsetSuperscript: () => ReturnType,\n }\n }\n}\n\nexport const Superscript = Mark.create<SuperscriptExtensionOptions>({\n name: 'superscript',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n }\n },\n\n parseHTML() {\n return [\n {\n tag: 'sup',\n },\n {\n style: 'vertical-align',\n getAttrs(value) {\n // Don’t match this rule if the vertical align isn’t super.\n if (value !== 'super') {\n return false\n }\n\n // If it falls through we’ll match, and this mark will be applied.\n return null\n },\n },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['sup', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n addCommands() {\n return {\n setSuperscript: () => ({ commands }) => {\n return commands.setMark(this.name)\n },\n toggleSuperscript: () => ({ commands }) => {\n return commands.toggleMark(this.name)\n },\n unsetSuperscript: () => ({ commands }) => {\n return commands.unsetMark(this.name)\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-.': () => this.editor.commands.toggleSuperscript(),\n }\n },\n})\n"],"names":["Mark","mergeAttributes"],"mappings":";;;;;;AAyBa,MAAA,WAAW,GAAGA,SAAI,CAAC,MAAM,CAA8B;AAClE,IAAA,IAAI,EAAE,aAAa;IAEnB,UAAU,GAAA;QACR,OAAO;AACL,YAAA,cAAc,EAAE,EAAE;SACnB,CAAA;KACF;IAED,SAAS,GAAA;QACP,OAAO;AACL,YAAA;AACE,gBAAA,GAAG,EAAE,KAAK;AACX,aAAA;AACD,YAAA;AACE,gBAAA,KAAK,EAAE,gBAAgB;AACvB,gBAAA,QAAQ,CAAC,KAAK,EAAA;;oBAEZ,IAAI,KAAK,KAAK,OAAO,EAAE;AACrB,wBAAA,OAAO,KAAK,CAAA;AACb,qBAAA;;AAGD,oBAAA,OAAO,IAAI,CAAA;iBACZ;AACF,aAAA;SACF,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE,EAAA;AAC3B,QAAA,OAAO,CAAC,KAAK,EAAEC,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;KAChF;IAED,WAAW,GAAA;QACT,OAAO;YACL,cAAc,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;gBACrC,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;aACnC;YACD,iBAAiB,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;gBACxC,OAAO,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;aACtC;YACD,gBAAgB,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;gBACvC,OAAO,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;aACrC;SACF,CAAA;KACF;IAED,oBAAoB,GAAA;QAClB,OAAO;YACL,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,EAAE;SACxD,CAAA;KACF;AACF,CAAA;;;;;"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Mark, mergeAttributes } from '@tiptap/core';
|
|
2
|
-
|
|
3
|
-
const Superscript = Mark.create({
|
|
4
|
-
name: 'superscript',
|
|
5
|
-
addOptions() {
|
|
6
|
-
return {
|
|
7
|
-
HTMLAttributes: {},
|
|
8
|
-
};
|
|
9
|
-
},
|
|
10
|
-
parseHTML() {
|
|
11
|
-
return [
|
|
12
|
-
{
|
|
13
|
-
tag: 'sup',
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
style: 'vertical-align',
|
|
17
|
-
getAttrs(value) {
|
|
18
|
-
// Don’t match this rule if the vertical align isn’t super.
|
|
19
|
-
if (value !== 'super') {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
// If it falls through we’ll match, and this mark will be applied.
|
|
23
|
-
return null;
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
];
|
|
27
|
-
},
|
|
28
|
-
renderHTML({ HTMLAttributes }) {
|
|
29
|
-
return ['sup', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
30
|
-
},
|
|
31
|
-
addCommands() {
|
|
32
|
-
return {
|
|
33
|
-
setSuperscript: () => ({ commands }) => {
|
|
34
|
-
return commands.setMark(this.name);
|
|
35
|
-
},
|
|
36
|
-
toggleSuperscript: () => ({ commands }) => {
|
|
37
|
-
return commands.toggleMark(this.name);
|
|
38
|
-
},
|
|
39
|
-
unsetSuperscript: () => ({ commands }) => {
|
|
40
|
-
return commands.unsetMark(this.name);
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
},
|
|
44
|
-
addKeyboardShortcuts() {
|
|
45
|
-
return {
|
|
46
|
-
'Mod-.': () => this.editor.commands.toggleSuperscript(),
|
|
47
|
-
};
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
export { Superscript, Superscript as default };
|
|
52
|
-
//# sourceMappingURL=tiptap-extension-superscript.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-extension-superscript.esm.js","sources":["../src/superscript.ts"],"sourcesContent":["import { Mark, mergeAttributes } from '@tiptap/core'\n\nexport interface SuperscriptExtensionOptions {\n HTMLAttributes: Object,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n superscript: {\n /**\n * Set a superscript mark\n */\n setSuperscript: () => ReturnType,\n /**\n * Toggle a superscript mark\n */\n toggleSuperscript: () => ReturnType,\n /**\n * Unset a superscript mark\n */\n unsetSuperscript: () => ReturnType,\n }\n }\n}\n\nexport const Superscript = Mark.create<SuperscriptExtensionOptions>({\n name: 'superscript',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n }\n },\n\n parseHTML() {\n return [\n {\n tag: 'sup',\n },\n {\n style: 'vertical-align',\n getAttrs(value) {\n // Don’t match this rule if the vertical align isn’t super.\n if (value !== 'super') {\n return false\n }\n\n // If it falls through we’ll match, and this mark will be applied.\n return null\n },\n },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['sup', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n addCommands() {\n return {\n setSuperscript: () => ({ commands }) => {\n return commands.setMark(this.name)\n },\n toggleSuperscript: () => ({ commands }) => {\n return commands.toggleMark(this.name)\n },\n unsetSuperscript: () => ({ commands }) => {\n return commands.unsetMark(this.name)\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-.': () => this.editor.commands.toggleSuperscript(),\n }\n },\n})\n"],"names":[],"mappings":";;AAyBa,MAAA,WAAW,GAAG,IAAI,CAAC,MAAM,CAA8B;AAClE,IAAA,IAAI,EAAE,aAAa;IAEnB,UAAU,GAAA;QACR,OAAO;AACL,YAAA,cAAc,EAAE,EAAE;SACnB,CAAA;KACF;IAED,SAAS,GAAA;QACP,OAAO;AACL,YAAA;AACE,gBAAA,GAAG,EAAE,KAAK;AACX,aAAA;AACD,YAAA;AACE,gBAAA,KAAK,EAAE,gBAAgB;AACvB,gBAAA,QAAQ,CAAC,KAAK,EAAA;;oBAEZ,IAAI,KAAK,KAAK,OAAO,EAAE;AACrB,wBAAA,OAAO,KAAK,CAAA;AACb,qBAAA;;AAGD,oBAAA,OAAO,IAAI,CAAA;iBACZ;AACF,aAAA;SACF,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE,EAAA;AAC3B,QAAA,OAAO,CAAC,KAAK,EAAE,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;KAChF;IAED,WAAW,GAAA;QACT,OAAO;YACL,cAAc,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;gBACrC,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;aACnC;YACD,iBAAiB,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;gBACxC,OAAO,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;aACtC;YACD,gBAAgB,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;gBACvC,OAAO,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;aACrC;SACF,CAAA;KACF;IAED,oBAAoB,GAAA;QAClB,OAAO;YACL,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,EAAE;SACxD,CAAA;KACF;AACF,CAAA;;;;"}
|
|
@@ -1,61 +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-superscript"] = {}, global.core));
|
|
5
|
-
})(this, (function (exports, core) { 'use strict';
|
|
6
|
-
|
|
7
|
-
const Superscript = core.Mark.create({
|
|
8
|
-
name: 'superscript',
|
|
9
|
-
addOptions() {
|
|
10
|
-
return {
|
|
11
|
-
HTMLAttributes: {},
|
|
12
|
-
};
|
|
13
|
-
},
|
|
14
|
-
parseHTML() {
|
|
15
|
-
return [
|
|
16
|
-
{
|
|
17
|
-
tag: 'sup',
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
style: 'vertical-align',
|
|
21
|
-
getAttrs(value) {
|
|
22
|
-
// Don’t match this rule if the vertical align isn’t super.
|
|
23
|
-
if (value !== 'super') {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
// If it falls through we’ll match, and this mark will be applied.
|
|
27
|
-
return null;
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
];
|
|
31
|
-
},
|
|
32
|
-
renderHTML({ HTMLAttributes }) {
|
|
33
|
-
return ['sup', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
34
|
-
},
|
|
35
|
-
addCommands() {
|
|
36
|
-
return {
|
|
37
|
-
setSuperscript: () => ({ commands }) => {
|
|
38
|
-
return commands.setMark(this.name);
|
|
39
|
-
},
|
|
40
|
-
toggleSuperscript: () => ({ commands }) => {
|
|
41
|
-
return commands.toggleMark(this.name);
|
|
42
|
-
},
|
|
43
|
-
unsetSuperscript: () => ({ commands }) => {
|
|
44
|
-
return commands.unsetMark(this.name);
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
},
|
|
48
|
-
addKeyboardShortcuts() {
|
|
49
|
-
return {
|
|
50
|
-
'Mod-.': () => this.editor.commands.toggleSuperscript(),
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
exports.Superscript = Superscript;
|
|
56
|
-
exports["default"] = Superscript;
|
|
57
|
-
|
|
58
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
59
|
-
|
|
60
|
-
}));
|
|
61
|
-
//# sourceMappingURL=tiptap-extension-superscript.umd.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-extension-superscript.umd.js","sources":["../src/superscript.ts"],"sourcesContent":["import { Mark, mergeAttributes } from '@tiptap/core'\n\nexport interface SuperscriptExtensionOptions {\n HTMLAttributes: Object,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n superscript: {\n /**\n * Set a superscript mark\n */\n setSuperscript: () => ReturnType,\n /**\n * Toggle a superscript mark\n */\n toggleSuperscript: () => ReturnType,\n /**\n * Unset a superscript mark\n */\n unsetSuperscript: () => ReturnType,\n }\n }\n}\n\nexport const Superscript = Mark.create<SuperscriptExtensionOptions>({\n name: 'superscript',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n }\n },\n\n parseHTML() {\n return [\n {\n tag: 'sup',\n },\n {\n style: 'vertical-align',\n getAttrs(value) {\n // Don’t match this rule if the vertical align isn’t super.\n if (value !== 'super') {\n return false\n }\n\n // If it falls through we’ll match, and this mark will be applied.\n return null\n },\n },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['sup', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n addCommands() {\n return {\n setSuperscript: () => ({ commands }) => {\n return commands.setMark(this.name)\n },\n toggleSuperscript: () => ({ commands }) => {\n return commands.toggleMark(this.name)\n },\n unsetSuperscript: () => ({ commands }) => {\n return commands.unsetMark(this.name)\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-.': () => this.editor.commands.toggleSuperscript(),\n }\n },\n})\n"],"names":["Mark","mergeAttributes"],"mappings":";;;;;;AAyBa,QAAA,WAAW,GAAGA,SAAI,CAAC,MAAM,CAA8B;EAClE,IAAA,IAAI,EAAE,aAAa;MAEnB,UAAU,GAAA;UACR,OAAO;EACL,YAAA,cAAc,EAAE,EAAE;WACnB,CAAA;OACF;MAED,SAAS,GAAA;UACP,OAAO;EACL,YAAA;EACE,gBAAA,GAAG,EAAE,KAAK;EACX,aAAA;EACD,YAAA;EACE,gBAAA,KAAK,EAAE,gBAAgB;EACvB,gBAAA,QAAQ,CAAC,KAAK,EAAA;;sBAEZ,IAAI,KAAK,KAAK,OAAO,EAAE;EACrB,wBAAA,OAAO,KAAK,CAAA;EACb,qBAAA;;EAGD,oBAAA,OAAO,IAAI,CAAA;mBACZ;EACF,aAAA;WACF,CAAA;OACF;MAED,UAAU,CAAC,EAAE,cAAc,EAAE,EAAA;EAC3B,QAAA,OAAO,CAAC,KAAK,EAAEC,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;OAChF;MAED,WAAW,GAAA;UACT,OAAO;cACL,cAAc,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;kBACrC,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;eACnC;cACD,iBAAiB,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;kBACxC,OAAO,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;eACtC;cACD,gBAAgB,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;kBACvC,OAAO,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;eACrC;WACF,CAAA;OACF;MAED,oBAAoB,GAAA;UAClB,OAAO;cACL,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,EAAE;WACxD,CAAA;OACF;EACF,CAAA;;;;;;;;;;;"}
|