@edifice.io/tiptap-extensions 2.0.0-develop-rc.8 → 2.0.0-develop-rc.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/abbr/abbr.cjs +32 -1
- package/dist/abbr/abbr.cjs.map +1 -1
- package/dist/abbr/abbr.d.ts +12 -12
- package/dist/abbr/abbr.js +20 -16
- package/dist/abbr/abbr.js.map +1 -1
- package/dist/alert/alert.cjs +32 -1
- package/dist/alert/alert.cjs.map +1 -1
- package/dist/alert/alert.js +22 -24
- package/dist/alert/alert.js.map +1 -1
- package/dist/attachment/attachment.cjs +73 -1
- package/dist/attachment/attachment.cjs.map +1 -1
- package/dist/attachment/attachment.d.ts +6 -6
- package/dist/attachment/attachment.js +58 -47
- package/dist/attachment/attachment.js.map +1 -1
- package/dist/audio/audio.cjs +53 -3
- package/dist/audio/audio.cjs.map +1 -1
- package/dist/audio/audio.d.ts +17 -13
- package/dist/audio/audio.js +33 -30
- package/dist/audio/audio.js.map +1 -1
- package/dist/font-size/font-size.cjs +48 -1
- package/dist/font-size/font-size.cjs.map +1 -1
- package/dist/font-size/font-size.d.ts +13 -13
- package/dist/font-size/font-size.js +32 -20
- package/dist/font-size/font-size.js.map +1 -1
- package/dist/heading/heading.cjs +61 -1
- package/dist/heading/heading.cjs.map +1 -1
- package/dist/heading/heading.d.ts +10 -12
- package/dist/heading/heading.js +45 -31
- package/dist/heading/heading.js.map +1 -1
- package/dist/highlight/highlight.cjs +25 -1
- package/dist/highlight/highlight.cjs.map +1 -1
- package/dist/highlight/highlight.d.ts +4 -1
- package/dist/highlight/highlight.js +15 -17
- package/dist/highlight/highlight.js.map +1 -1
- package/dist/hyperlink/hyperlink.cjs +47 -1
- package/dist/hyperlink/hyperlink.cjs.map +1 -1
- package/dist/hyperlink/hyperlink.d.ts +27 -24
- package/dist/hyperlink/hyperlink.js +26 -24
- package/dist/hyperlink/hyperlink.js.map +1 -1
- package/dist/iframe/iframe.cjs +69 -1
- package/dist/iframe/iframe.cjs.map +1 -1
- package/dist/iframe/iframe.d.ts +12 -14
- package/dist/iframe/iframe.js +50 -34
- package/dist/iframe/iframe.js.map +1 -1
- package/dist/image/custom-image.cjs +162 -1
- package/dist/image/custom-image.cjs.map +1 -1
- package/dist/image/custom-image.d.ts +19 -16
- package/dist/image/custom-image.js +179 -130
- package/dist/image/custom-image.js.map +1 -1
- package/dist/index.cjs +43 -1
- package/dist/index.js +41 -41
- package/dist/line-height/line-height.cjs +33 -1
- package/dist/line-height/line-height.cjs.map +1 -1
- package/dist/line-height/line-height.js +21 -18
- package/dist/line-height/line-height.js.map +1 -1
- package/dist/linker/linker.cjs +95 -1
- package/dist/linker/linker.cjs.map +1 -1
- package/dist/linker/linker.d.ts +17 -17
- package/dist/linker/linker.js +60 -52
- package/dist/linker/linker.js.map +1 -1
- package/dist/mathjax/mathjax.cjs +47 -1
- package/dist/mathjax/mathjax.cjs.map +1 -1
- package/dist/mathjax/mathjax.js +33 -23
- package/dist/mathjax/mathjax.js.map +1 -1
- package/dist/paragraph/paragraph.cjs +13 -1
- package/dist/paragraph/paragraph.cjs.map +1 -1
- package/dist/paragraph/paragraph.d.ts +4 -1
- package/dist/paragraph/paragraph.js +8 -10
- package/dist/paragraph/paragraph.js.map +1 -1
- package/dist/speech-recognition/speech-recognition.cjs +76 -1
- package/dist/speech-recognition/speech-recognition.cjs.map +1 -1
- package/dist/speech-recognition/speech-recognition.d.ts +12 -12
- package/dist/speech-recognition/speech-recognition.js +61 -45
- package/dist/speech-recognition/speech-recognition.js.map +1 -1
- package/dist/speech-synthesis/speech-synthesis.cjs +32 -1
- package/dist/speech-synthesis/speech-synthesis.cjs.map +1 -1
- package/dist/speech-synthesis/speech-synthesis.d.ts +9 -9
- package/dist/speech-synthesis/speech-synthesis.js +23 -14
- package/dist/speech-synthesis/speech-synthesis.js.map +1 -1
- package/dist/table-cell/table-cell.cjs +27 -1
- package/dist/table-cell/table-cell.cjs.map +1 -1
- package/dist/table-cell/table-cell.d.ts +4 -1
- package/dist/table-cell/table-cell.js +21 -16
- package/dist/table-cell/table-cell.js.map +1 -1
- package/dist/transform/html-to-json/html-to-json.cjs +4 -1
- package/dist/transform/html-to-json/html-to-json.cjs.map +1 -1
- package/dist/transform/html-to-json/html-to-json.d.ts +4 -1
- package/dist/transform/html-to-json/html-to-json.js +3 -5
- package/dist/transform/html-to-json/html-to-json.js.map +1 -1
- package/dist/transform/json-to-html/json-to-html.cjs +4 -1
- package/dist/transform/json-to-html/json-to-html.cjs.map +1 -1
- package/dist/transform/json-to-html/json-to-html.js +3 -5
- package/dist/transform/json-to-html/json-to-html.js.map +1 -1
- package/dist/video/video.cjs +118 -9
- package/dist/video/video.cjs.map +1 -1
- package/dist/video/video.d.ts +28 -19
- package/dist/video/video.js +121 -97
- package/dist/video/video.js.map +1 -1
- package/package.json +39 -50
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|

|
|
4
4
|

|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Extensions based on Tiptap Editor
|
|
7
7
|
|
|
8
8
|
## Getting Started
|
|
9
9
|
|
package/dist/abbr/abbr.cjs
CHANGED
|
@@ -1,2 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
|
+
const core = require('@tiptap/core'),
|
|
4
|
+
Abbr = core.Mark.create({
|
|
5
|
+
name: 'abbr',
|
|
6
|
+
addOptions() {
|
|
7
|
+
return { HTMLAttributes: {} };
|
|
8
|
+
},
|
|
9
|
+
parseHTML() {
|
|
10
|
+
return [{ tag: 'abbr' }];
|
|
11
|
+
},
|
|
12
|
+
renderHTML({ HTMLAttributes }) {
|
|
13
|
+
return [
|
|
14
|
+
'abbr',
|
|
15
|
+
core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
|
|
16
|
+
0,
|
|
17
|
+
];
|
|
18
|
+
},
|
|
19
|
+
addCommands() {
|
|
20
|
+
return {
|
|
21
|
+
setAbbr:
|
|
22
|
+
() =>
|
|
23
|
+
({ commands }) =>
|
|
24
|
+
commands.setMark(this.name),
|
|
25
|
+
toggleAbbr:
|
|
26
|
+
() =>
|
|
27
|
+
({ commands }) =>
|
|
28
|
+
commands.toggleMark(this.name),
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
exports.Abbr = Abbr;
|
|
2
33
|
//# sourceMappingURL=abbr.cjs.map
|
package/dist/abbr/abbr.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abbr.cjs","sources":["../../src/abbr/abbr.ts"],"sourcesContent":["import { Mark, mergeAttributes } from '@tiptap/core';\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n abbr: {\n /**\n * Set an abbr mark\n */\n setAbbr: (src: string) => ReturnType;\n /**\n * Toggle an abbr mark\n */\n toggleAbbr: (src: string) => ReturnType;\n };\n }\n}\n\nexport const Abbr = Mark.create({\n name: 'abbr',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'abbr',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'abbr',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setAbbr:\n () =>\n ({ commands }) => {\n return commands.setMark(this.name);\n },\n toggleAbbr:\n () =>\n ({ commands }) => {\n return commands.toggleMark(this.name);\n },\n };\n },\n});\n"],"names":["
|
|
1
|
+
{"version":3,"file":"abbr.cjs","sources":["../../src/abbr/abbr.ts"],"sourcesContent":["import { Mark, mergeAttributes } from '@tiptap/core';\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n abbr: {\n /**\n * Set an abbr mark\n */\n setAbbr: (src: string) => ReturnType;\n /**\n * Toggle an abbr mark\n */\n toggleAbbr: (src: string) => ReturnType;\n };\n }\n}\n\nexport const Abbr = Mark.create({\n name: 'abbr',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'abbr',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'abbr',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setAbbr:\n () =>\n ({ commands }) => {\n return commands.setMark(this.name);\n },\n toggleAbbr:\n () =>\n ({ commands }) => {\n return commands.toggleMark(this.name);\n },\n };\n },\n});\n"],"names":["Mark","mergeAttributes"],"mappings":"mHAiBa,KAAOA,UAAK,OAAO,CAC9B,KAAM,OAEN,YAAa,CACJ,MAAA,CACL,eAAgB,CAAC,CAAA,CAErB,EAEA,WAAY,CACH,MAAA,CACL,CACE,IAAK,MACP,CAAA,CAEJ,EAEA,WAAW,CAAE,gBAAkB,CACtB,MAAA,CACL,OACAC,KAAAA,gBAAgB,KAAK,QAAQ,eAAgB,cAAc,EAC3D,CAAA,CAEJ,EAEA,aAAc,CACL,MAAA,CACL,QACE,IACA,CAAC,CAAE,YACM,SAAS,QAAQ,KAAK,IAAI,EAErC,WACE,IACA,CAAC,CAAE,YACM,SAAS,WAAW,KAAK,IAAI,CACtC,CAEN,CACF,CAAC"}
|
package/dist/abbr/abbr.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Mark } from '@tiptap/core';
|
|
2
2
|
declare module '@tiptap/core' {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
abbr: {
|
|
5
|
+
/**
|
|
6
|
+
* Set an abbr mark
|
|
7
|
+
*/
|
|
8
|
+
setAbbr: (src: string) => ReturnType;
|
|
9
|
+
/**
|
|
10
|
+
* Toggle an abbr mark
|
|
11
|
+
*/
|
|
12
|
+
toggleAbbr: (src: string) => ReturnType;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
15
|
}
|
|
16
16
|
export declare const Abbr: Mark<any, any>;
|
package/dist/abbr/abbr.js
CHANGED
|
@@ -1,33 +1,37 @@
|
|
|
1
|
-
import { Mark
|
|
2
|
-
const
|
|
3
|
-
name:
|
|
1
|
+
import { Mark, mergeAttributes } from '@tiptap/core';
|
|
2
|
+
const Abbr = Mark.create({
|
|
3
|
+
name: 'abbr',
|
|
4
4
|
addOptions() {
|
|
5
5
|
return {
|
|
6
|
-
HTMLAttributes: {}
|
|
6
|
+
HTMLAttributes: {},
|
|
7
7
|
};
|
|
8
8
|
},
|
|
9
9
|
parseHTML() {
|
|
10
10
|
return [
|
|
11
11
|
{
|
|
12
|
-
tag:
|
|
13
|
-
}
|
|
12
|
+
tag: 'abbr',
|
|
13
|
+
},
|
|
14
14
|
];
|
|
15
15
|
},
|
|
16
|
-
renderHTML({ HTMLAttributes
|
|
16
|
+
renderHTML({ HTMLAttributes }) {
|
|
17
17
|
return [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
0
|
|
18
|
+
'abbr',
|
|
19
|
+
mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
|
|
20
|
+
0,
|
|
21
21
|
];
|
|
22
22
|
},
|
|
23
23
|
addCommands() {
|
|
24
24
|
return {
|
|
25
|
-
setAbbr:
|
|
26
|
-
|
|
25
|
+
setAbbr:
|
|
26
|
+
() =>
|
|
27
|
+
({ commands }) =>
|
|
28
|
+
commands.setMark(this.name),
|
|
29
|
+
toggleAbbr:
|
|
30
|
+
() =>
|
|
31
|
+
({ commands }) =>
|
|
32
|
+
commands.toggleMark(this.name),
|
|
27
33
|
};
|
|
28
|
-
}
|
|
34
|
+
},
|
|
29
35
|
});
|
|
30
|
-
export {
|
|
31
|
-
b as Abbr
|
|
32
|
-
};
|
|
36
|
+
export { Abbr };
|
|
33
37
|
//# sourceMappingURL=abbr.js.map
|
package/dist/abbr/abbr.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abbr.js","sources":["../../src/abbr/abbr.ts"],"sourcesContent":["import { Mark, mergeAttributes } from '@tiptap/core';\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n abbr: {\n /**\n * Set an abbr mark\n */\n setAbbr: (src: string) => ReturnType;\n /**\n * Toggle an abbr mark\n */\n toggleAbbr: (src: string) => ReturnType;\n };\n }\n}\n\nexport const Abbr = Mark.create({\n name: 'abbr',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'abbr',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'abbr',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setAbbr:\n () =>\n ({ commands }) => {\n return commands.setMark(this.name);\n },\n toggleAbbr:\n () =>\n ({ commands }) => {\n return commands.toggleMark(this.name);\n },\n };\n },\n});\n"],"names":[
|
|
1
|
+
{"version":3,"file":"abbr.js","sources":["../../src/abbr/abbr.ts"],"sourcesContent":["import { Mark, mergeAttributes } from '@tiptap/core';\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n abbr: {\n /**\n * Set an abbr mark\n */\n setAbbr: (src: string) => ReturnType;\n /**\n * Toggle an abbr mark\n */\n toggleAbbr: (src: string) => ReturnType;\n };\n }\n}\n\nexport const Abbr = Mark.create({\n name: 'abbr',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'abbr',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'abbr',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setAbbr:\n () =>\n ({ commands }) => {\n return commands.setMark(this.name);\n },\n toggleAbbr:\n () =>\n ({ commands }) => {\n return commands.toggleMark(this.name);\n },\n };\n },\n});\n"],"names":[],"mappings":";AAiBa,MAAA,OAAO,KAAK,OAAO;AAAA,EAC9B,MAAM;AAAA,EAEN,aAAa;AACJ,WAAA;AAAA,MACL,gBAAgB,CAAC;AAAA,IAAA;AAAA,EAErB;AAAA,EAEA,YAAY;AACH,WAAA;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MACP;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,WAAW,EAAE,kBAAkB;AACtB,WAAA;AAAA,MACL;AAAA,MACA,gBAAgB,KAAK,QAAQ,gBAAgB,cAAc;AAAA,MAC3D;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,cAAc;AACL,WAAA;AAAA,MACL,SACE,MACA,CAAC,EAAE,eACM,SAAS,QAAQ,KAAK,IAAI;AAAA,MAErC,YACE,MACA,CAAC,EAAE,eACM,SAAS,WAAW,KAAK,IAAI;AAAA,IACtC;AAAA,EAEN;AACF,CAAC;"}
|
package/dist/alert/alert.cjs
CHANGED
|
@@ -1,2 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
|
+
const core = require('@tiptap/core'),
|
|
4
|
+
Alert = core.Node.create({
|
|
5
|
+
name: 'alert',
|
|
6
|
+
content: 'inline+',
|
|
7
|
+
marks: '',
|
|
8
|
+
group: 'block',
|
|
9
|
+
inline: !1,
|
|
10
|
+
selectable: !0,
|
|
11
|
+
draggable: !0,
|
|
12
|
+
parseHTML() {
|
|
13
|
+
return [
|
|
14
|
+
{ tag: 'p.info', priority: 60 },
|
|
15
|
+
{ tag: 'p.warning', priority: 60 },
|
|
16
|
+
{ tag: 'div.info', priority: 60 },
|
|
17
|
+
{ tag: 'div.warning', priority: 60 },
|
|
18
|
+
];
|
|
19
|
+
},
|
|
20
|
+
addAttributes() {
|
|
21
|
+
return {
|
|
22
|
+
class: {
|
|
23
|
+
default: 'info',
|
|
24
|
+
parseHTML: (element) => element.getAttribute('class'),
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
renderHTML({ HTMLAttributes }) {
|
|
29
|
+
return ['div', HTMLAttributes, 0];
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
exports.Alert = Alert;
|
|
2
33
|
//# sourceMappingURL=alert.cjs.map
|
package/dist/alert/alert.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.cjs","sources":["../../src/alert/alert.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport const Alert = Node.create({\n name: 'alert',\n content: 'inline+',\n marks: '',\n group: 'block',\n\n inline: false,\n selectable: true,\n draggable: true,\n\n parseHTML() {\n return [\n {\n tag: 'p.info',\n priority: 60,\n },\n {\n tag: 'p.warning',\n priority: 60,\n },\n {\n tag: 'div.info',\n priority: 60,\n },\n {\n tag: 'div.warning',\n priority: 60,\n },\n ];\n },\n addAttributes() {\n return {\n class: {\n default: 'info',\n parseHTML: (element) => {\n return element.getAttribute('class');\n },\n },\n };\n },\n renderHTML({ HTMLAttributes }) {\n return ['div', HTMLAttributes, 0];\n },\n});\n"],"names":["
|
|
1
|
+
{"version":3,"file":"alert.cjs","sources":["../../src/alert/alert.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport const Alert = Node.create({\n name: 'alert',\n content: 'inline+',\n marks: '',\n group: 'block',\n\n inline: false,\n selectable: true,\n draggable: true,\n\n parseHTML() {\n return [\n {\n tag: 'p.info',\n priority: 60,\n },\n {\n tag: 'p.warning',\n priority: 60,\n },\n {\n tag: 'div.info',\n priority: 60,\n },\n {\n tag: 'div.warning',\n priority: 60,\n },\n ];\n },\n addAttributes() {\n return {\n class: {\n default: 'info',\n parseHTML: (element) => {\n return element.getAttribute('class');\n },\n },\n };\n },\n renderHTML({ HTMLAttributes }) {\n return ['div', HTMLAttributes, 0];\n },\n});\n"],"names":["Node"],"mappings":"mHAEa,MAAQA,UAAK,OAAO,CAC/B,KAAM,QACN,QAAS,UACT,MAAO,GACP,MAAO,QAEP,OAAQ,GACR,WAAY,GACZ,UAAW,GAEX,WAAY,CACH,MAAA,CACL,CACE,IAAK,SACL,SAAU,EACZ,EACA,CACE,IAAK,YACL,SAAU,EACZ,EACA,CACE,IAAK,WACL,SAAU,EACZ,EACA,CACE,IAAK,cACL,SAAU,EACZ,CAAA,CAEJ,EACA,eAAgB,CACP,MAAA,CACL,MAAO,CACL,QAAS,OACT,UAAY,SACH,QAAQ,aAAa,OAAO,CAEvC,CAAA,CAEJ,EACA,WAAW,CAAE,gBAAkB,CACtB,MAAA,CAAC,MAAO,eAAgB,CAAC,CAClC,CACF,CAAC"}
|
package/dist/alert/alert.js
CHANGED
|
@@ -1,45 +1,43 @@
|
|
|
1
|
-
import { Node
|
|
2
|
-
const
|
|
3
|
-
name:
|
|
4
|
-
content:
|
|
5
|
-
marks:
|
|
6
|
-
group:
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
const Alert = Node.create({
|
|
3
|
+
name: 'alert',
|
|
4
|
+
content: 'inline+',
|
|
5
|
+
marks: '',
|
|
6
|
+
group: 'block',
|
|
7
7
|
inline: !1,
|
|
8
8
|
selectable: !0,
|
|
9
9
|
draggable: !0,
|
|
10
10
|
parseHTML() {
|
|
11
11
|
return [
|
|
12
12
|
{
|
|
13
|
-
tag:
|
|
14
|
-
priority: 60
|
|
13
|
+
tag: 'p.info',
|
|
14
|
+
priority: 60,
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
|
-
tag:
|
|
18
|
-
priority: 60
|
|
17
|
+
tag: 'p.warning',
|
|
18
|
+
priority: 60,
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
|
-
tag:
|
|
22
|
-
priority: 60
|
|
21
|
+
tag: 'div.info',
|
|
22
|
+
priority: 60,
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
|
-
tag:
|
|
26
|
-
priority: 60
|
|
27
|
-
}
|
|
25
|
+
tag: 'div.warning',
|
|
26
|
+
priority: 60,
|
|
27
|
+
},
|
|
28
28
|
];
|
|
29
29
|
},
|
|
30
30
|
addAttributes() {
|
|
31
31
|
return {
|
|
32
32
|
class: {
|
|
33
|
-
default:
|
|
34
|
-
parseHTML: (
|
|
35
|
-
}
|
|
33
|
+
default: 'info',
|
|
34
|
+
parseHTML: (element) => element.getAttribute('class'),
|
|
35
|
+
},
|
|
36
36
|
};
|
|
37
37
|
},
|
|
38
|
-
renderHTML({ HTMLAttributes
|
|
39
|
-
return [
|
|
40
|
-
}
|
|
38
|
+
renderHTML({ HTMLAttributes }) {
|
|
39
|
+
return ['div', HTMLAttributes, 0];
|
|
40
|
+
},
|
|
41
41
|
});
|
|
42
|
-
export {
|
|
43
|
-
i as Alert
|
|
44
|
-
};
|
|
42
|
+
export { Alert };
|
|
45
43
|
//# sourceMappingURL=alert.js.map
|
package/dist/alert/alert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.js","sources":["../../src/alert/alert.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport const Alert = Node.create({\n name: 'alert',\n content: 'inline+',\n marks: '',\n group: 'block',\n\n inline: false,\n selectable: true,\n draggable: true,\n\n parseHTML() {\n return [\n {\n tag: 'p.info',\n priority: 60,\n },\n {\n tag: 'p.warning',\n priority: 60,\n },\n {\n tag: 'div.info',\n priority: 60,\n },\n {\n tag: 'div.warning',\n priority: 60,\n },\n ];\n },\n addAttributes() {\n return {\n class: {\n default: 'info',\n parseHTML: (element) => {\n return element.getAttribute('class');\n },\n },\n };\n },\n renderHTML({ HTMLAttributes }) {\n return ['div', HTMLAttributes, 0];\n },\n});\n"],"names":[
|
|
1
|
+
{"version":3,"file":"alert.js","sources":["../../src/alert/alert.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport const Alert = Node.create({\n name: 'alert',\n content: 'inline+',\n marks: '',\n group: 'block',\n\n inline: false,\n selectable: true,\n draggable: true,\n\n parseHTML() {\n return [\n {\n tag: 'p.info',\n priority: 60,\n },\n {\n tag: 'p.warning',\n priority: 60,\n },\n {\n tag: 'div.info',\n priority: 60,\n },\n {\n tag: 'div.warning',\n priority: 60,\n },\n ];\n },\n addAttributes() {\n return {\n class: {\n default: 'info',\n parseHTML: (element) => {\n return element.getAttribute('class');\n },\n },\n };\n },\n renderHTML({ HTMLAttributes }) {\n return ['div', HTMLAttributes, 0];\n },\n});\n"],"names":[],"mappings":";AAEa,MAAA,QAAQ,KAAK,OAAO;AAAA,EAC/B,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EAEP,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,WAAW;AAAA,EAEX,YAAY;AACH,WAAA;AAAA,MACL;AAAA,QACE,KAAK;AAAA,QACL,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,KAAK;AAAA,QACL,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,KAAK;AAAA,QACL,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,KAAK;AAAA,QACL,UAAU;AAAA,MACZ;AAAA,IAAA;AAAA,EAEJ;AAAA,EACA,gBAAgB;AACP,WAAA;AAAA,MACL,OAAO;AAAA,QACL,SAAS;AAAA,QACT,WAAW,CAAC,YACH,QAAQ,aAAa,OAAO;AAAA,MAEvC;AAAA,IAAA;AAAA,EAEJ;AAAA,EACA,WAAW,EAAE,kBAAkB;AACtB,WAAA,CAAC,OAAO,gBAAgB,CAAC;AAAA,EAClC;AACF,CAAC;"}
|
|
@@ -1,2 +1,74 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
|
+
const core = require('@tiptap/core'),
|
|
4
|
+
Attachment = core.Node.create({
|
|
5
|
+
name: 'attachments',
|
|
6
|
+
content: '',
|
|
7
|
+
marks: '',
|
|
8
|
+
group: 'block',
|
|
9
|
+
selectable: !0,
|
|
10
|
+
atom: !0,
|
|
11
|
+
draggable: !0,
|
|
12
|
+
addOptions() {
|
|
13
|
+
return { HTMLAttributes: { class: 'attachments' } };
|
|
14
|
+
},
|
|
15
|
+
parseHTML() {
|
|
16
|
+
return [{ tag: 'div[class=attachments]' }];
|
|
17
|
+
},
|
|
18
|
+
renderHTML({ HTMLAttributes }) {
|
|
19
|
+
const renderedLinks = HTMLAttributes.links.map((el) => [
|
|
20
|
+
'a',
|
|
21
|
+
{
|
|
22
|
+
name: el.name,
|
|
23
|
+
href: el.href,
|
|
24
|
+
documentId: el.documentId,
|
|
25
|
+
dataContentType: el.dataContentType,
|
|
26
|
+
},
|
|
27
|
+
el.name,
|
|
28
|
+
]);
|
|
29
|
+
return ['div', this.options.HTMLAttributes, ...renderedLinks];
|
|
30
|
+
},
|
|
31
|
+
addAttributes() {
|
|
32
|
+
return {
|
|
33
|
+
links: {
|
|
34
|
+
default: [],
|
|
35
|
+
parseHTML: (element) => {
|
|
36
|
+
const links = element.getElementsByTagName('a'),
|
|
37
|
+
parsedLinks = [];
|
|
38
|
+
for (let i = 0; i < links.length; i++) {
|
|
39
|
+
const link = links[i],
|
|
40
|
+
href = link.getAttribute('href'),
|
|
41
|
+
name = link.textContent,
|
|
42
|
+
regexResult = href.match(/([^/]+$)/),
|
|
43
|
+
documentId =
|
|
44
|
+
link.getAttribute('data-document-id') ||
|
|
45
|
+
(regexResult && regexResult[0]),
|
|
46
|
+
dataContentType = link.getAttribute('data-content-type');
|
|
47
|
+
parsedLinks.push({ href, name, documentId, dataContentType });
|
|
48
|
+
}
|
|
49
|
+
return parsedLinks;
|
|
50
|
+
},
|
|
51
|
+
renderHTML: (attributes) => ({
|
|
52
|
+
links: attributes.links.map((link) => ({
|
|
53
|
+
href: link.href,
|
|
54
|
+
name: link.name,
|
|
55
|
+
documentId: link.documentId,
|
|
56
|
+
dataContentType: link.dataContentType,
|
|
57
|
+
})),
|
|
58
|
+
}),
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
addCommands() {
|
|
63
|
+
return {
|
|
64
|
+
setAttachment:
|
|
65
|
+
(
|
|
66
|
+
attrs = { dataContentType: '', name: '', documentId: '', href: '' },
|
|
67
|
+
) =>
|
|
68
|
+
({ chain }) =>
|
|
69
|
+
chain().insertContent({ type: this.name, attrs }).run(),
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
exports.Attachment = Attachment;
|
|
2
74
|
//# sourceMappingURL=attachment.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment.cjs","sources":["../../src/attachment/attachment.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface AttachmentOptions {\n HTMLAttributes: Record<string, string>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n attachment: {\n setAttachment: (attachment) => ReturnType;\n };\n }\n}\n\nexport const Attachment = Node.create<AttachmentOptions>({\n name: 'attachments',\n content: '',\n marks: '',\n group: 'block',\n selectable: true,\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n HTMLAttributes: {\n class: 'attachments',\n },\n };\n },\n\n parseHTML() {\n return [{ tag: 'div[class=attachments]' }];\n },\n\n renderHTML({ HTMLAttributes }) {\n const links = HTMLAttributes.links;\n\n const renderedLinks = links.map((el) => {\n return [\n 'a',\n {\n name: el.name,\n href: el.href,\n documentId: el.documentId,\n dataContentType: el.dataContentType,\n },\n el.name,\n ];\n });\n\n return ['div', this.options.HTMLAttributes, ...renderedLinks];\n },\n\n addAttributes() {\n return {\n links: {\n default: [],\n parseHTML: (element) => {\n const links = element.getElementsByTagName('a');\n const parsedLinks = [];\n\n for (let i = 0; i < links.length; i++) {\n const link = links[i];\n const href = link.getAttribute('href');\n const name = link.textContent;\n const regexResult = href.match(/([^/]+$)/);\n const documentId =\n link.getAttribute('data-document-id') ||\n (regexResult && regexResult[0]);\n const dataContentType = link.getAttribute('data-content-type');\n\n parsedLinks.push({\n href,\n name,\n documentId,\n dataContentType,\n });\n }\n\n return parsedLinks;\n },\n renderHTML: (attributes) => {\n return {\n links: attributes.links.map((link) => ({\n href: link.href,\n name: link.name,\n documentId: link.documentId,\n dataContentType: link.dataContentType,\n })),\n };\n },\n },\n };\n },\n\n addCommands() {\n return {\n setAttachment:\n (\n attrs = {\n dataContentType: '',\n name: '',\n documentId: '',\n href: '',\n },\n ) =>\n ({ chain }) => {\n return chain().insertContent({ type: this.name, attrs }).run();\n },\n };\n },\n});\n"],"names":["
|
|
1
|
+
{"version":3,"file":"attachment.cjs","sources":["../../src/attachment/attachment.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface AttachmentOptions {\n HTMLAttributes: Record<string, string>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n attachment: {\n setAttachment: (attachment) => ReturnType;\n };\n }\n}\n\nexport const Attachment = Node.create<AttachmentOptions>({\n name: 'attachments',\n content: '',\n marks: '',\n group: 'block',\n selectable: true,\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n HTMLAttributes: {\n class: 'attachments',\n },\n };\n },\n\n parseHTML() {\n return [{ tag: 'div[class=attachments]' }];\n },\n\n renderHTML({ HTMLAttributes }) {\n const links = HTMLAttributes.links;\n\n const renderedLinks = links.map((el) => {\n return [\n 'a',\n {\n name: el.name,\n href: el.href,\n documentId: el.documentId,\n dataContentType: el.dataContentType,\n },\n el.name,\n ];\n });\n\n return ['div', this.options.HTMLAttributes, ...renderedLinks];\n },\n\n addAttributes() {\n return {\n links: {\n default: [],\n parseHTML: (element) => {\n const links = element.getElementsByTagName('a');\n const parsedLinks = [];\n\n for (let i = 0; i < links.length; i++) {\n const link = links[i];\n const href = link.getAttribute('href');\n const name = link.textContent;\n const regexResult = href.match(/([^/]+$)/);\n const documentId =\n link.getAttribute('data-document-id') ||\n (regexResult && regexResult[0]);\n const dataContentType = link.getAttribute('data-content-type');\n\n parsedLinks.push({\n href,\n name,\n documentId,\n dataContentType,\n });\n }\n\n return parsedLinks;\n },\n renderHTML: (attributes) => {\n return {\n links: attributes.links.map((link) => ({\n href: link.href,\n name: link.name,\n documentId: link.documentId,\n dataContentType: link.dataContentType,\n })),\n };\n },\n },\n };\n },\n\n addCommands() {\n return {\n setAttachment:\n (\n attrs = {\n dataContentType: '',\n name: '',\n documentId: '',\n href: '',\n },\n ) =>\n ({ chain }) => {\n return chain().insertContent({ type: this.name, attrs }).run();\n },\n };\n },\n});\n"],"names":["Node"],"mappings":"mHAca,WAAaA,UAAK,OAA0B,CACvD,KAAM,cACN,QAAS,GACT,MAAO,GACP,MAAO,QACP,WAAY,GACZ,KAAM,GACN,UAAW,GAEX,YAAa,CACJ,MAAA,CACL,eAAgB,CACd,MAAO,aACT,CAAA,CAEJ,EAEA,WAAY,CACV,MAAO,CAAC,CAAE,IAAK,wBAAA,CAA0B,CAC3C,EAEA,WAAW,CAAE,gBAAkB,CAG7B,MAAM,cAFQ,eAAe,MAED,IAAK,IACxB,CACL,IACA,CACE,KAAM,GAAG,KACT,KAAM,GAAG,KACT,WAAY,GAAG,WACf,gBAAiB,GAAG,eACtB,EACA,GAAG,IAAA,CAEN,EAED,MAAO,CAAC,MAAO,KAAK,QAAQ,eAAgB,GAAG,aAAa,CAC9D,EAEA,eAAgB,CACP,MAAA,CACL,MAAO,CACL,QAAS,CAAC,EACV,UAAY,SAAY,CAChB,MAAA,MAAQ,QAAQ,qBAAqB,GAAG,EACxC,YAAc,CAAA,EAEpB,QAAS,EAAI,EAAG,EAAI,MAAM,OAAQ,IAAK,CAC/B,MAAA,KAAO,MAAM,CAAC,EACd,KAAO,KAAK,aAAa,MAAM,EAC/B,KAAO,KAAK,YACZ,YAAc,KAAK,MAAM,UAAU,EACnC,WACJ,KAAK,aAAa,kBAAkB,GACnC,aAAe,YAAY,CAAC,EACzB,gBAAkB,KAAK,aAAa,mBAAmB,EAE7D,YAAY,KAAK,CACf,KACA,KACA,WACA,eAAA,CACD,CACH,CAEO,OAAA,WACT,EACA,WAAa,aACJ,CACL,MAAO,WAAW,MAAM,IAAK,OAAU,CACrC,KAAM,KAAK,KACX,KAAM,KAAK,KACX,WAAY,KAAK,WACjB,gBAAiB,KAAK,eAAA,EACtB,CAAA,EAGR,CAAA,CAEJ,EAEA,aAAc,CACL,MAAA,CACL,cACE,CACE,MAAQ,CACN,gBAAiB,GACjB,KAAM,GACN,WAAY,GACZ,KAAM,EAAA,IAGV,CAAC,CAAE,SACM,MAAA,EAAQ,cAAc,CAAE,KAAM,KAAK,KAAM,KAAA,CAAO,EAAE,KAC3D,CAEN,CACF,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Node } from '@tiptap/core';
|
|
2
2
|
export interface AttachmentOptions {
|
|
3
|
-
|
|
3
|
+
HTMLAttributes: Record<string, string>;
|
|
4
4
|
}
|
|
5
5
|
declare module '@tiptap/core' {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
interface Commands<ReturnType> {
|
|
7
|
+
attachment: {
|
|
8
|
+
setAttachment: (attachment: any) => ReturnType;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
11
|
}
|
|
12
12
|
export declare const Attachment: Node<AttachmentOptions, any>;
|
|
@@ -1,75 +1,86 @@
|
|
|
1
|
-
import { Node
|
|
2
|
-
const
|
|
3
|
-
name:
|
|
4
|
-
content:
|
|
5
|
-
marks:
|
|
6
|
-
group:
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
const Attachment = Node.create({
|
|
3
|
+
name: 'attachments',
|
|
4
|
+
content: '',
|
|
5
|
+
marks: '',
|
|
6
|
+
group: 'block',
|
|
7
7
|
selectable: !0,
|
|
8
8
|
atom: !0,
|
|
9
9
|
draggable: !0,
|
|
10
10
|
addOptions() {
|
|
11
11
|
return {
|
|
12
12
|
HTMLAttributes: {
|
|
13
|
-
class:
|
|
14
|
-
}
|
|
13
|
+
class: 'attachments',
|
|
14
|
+
},
|
|
15
15
|
};
|
|
16
16
|
},
|
|
17
17
|
parseHTML() {
|
|
18
|
-
return [{ tag:
|
|
18
|
+
return [{ tag: 'div[class=attachments]' }];
|
|
19
19
|
},
|
|
20
|
-
renderHTML({ HTMLAttributes
|
|
21
|
-
const
|
|
22
|
-
|
|
20
|
+
renderHTML({ HTMLAttributes }) {
|
|
21
|
+
const renderedLinks = HTMLAttributes.links.map((el) => [
|
|
22
|
+
'a',
|
|
23
23
|
{
|
|
24
|
-
name:
|
|
25
|
-
href:
|
|
26
|
-
documentId:
|
|
27
|
-
dataContentType:
|
|
24
|
+
name: el.name,
|
|
25
|
+
href: el.href,
|
|
26
|
+
documentId: el.documentId,
|
|
27
|
+
dataContentType: el.dataContentType,
|
|
28
28
|
},
|
|
29
|
-
|
|
29
|
+
el.name,
|
|
30
30
|
]);
|
|
31
|
-
return [
|
|
31
|
+
return ['div', this.options.HTMLAttributes, ...renderedLinks];
|
|
32
32
|
},
|
|
33
33
|
addAttributes() {
|
|
34
34
|
return {
|
|
35
35
|
links: {
|
|
36
36
|
default: [],
|
|
37
|
-
parseHTML: (
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
href
|
|
43
|
-
name
|
|
44
|
-
|
|
45
|
-
|
|
37
|
+
parseHTML: (element) => {
|
|
38
|
+
const links = element.getElementsByTagName('a'),
|
|
39
|
+
parsedLinks = [];
|
|
40
|
+
for (let i = 0; i < links.length; i++) {
|
|
41
|
+
const link = links[i],
|
|
42
|
+
href = link.getAttribute('href'),
|
|
43
|
+
name = link.textContent,
|
|
44
|
+
regexResult = href.match(/([^/]+$)/),
|
|
45
|
+
documentId =
|
|
46
|
+
link.getAttribute('data-document-id') ||
|
|
47
|
+
(regexResult && regexResult[0]),
|
|
48
|
+
dataContentType = link.getAttribute('data-content-type');
|
|
49
|
+
parsedLinks.push({
|
|
50
|
+
href,
|
|
51
|
+
name,
|
|
52
|
+
documentId,
|
|
53
|
+
dataContentType,
|
|
46
54
|
});
|
|
47
55
|
}
|
|
48
|
-
return
|
|
56
|
+
return parsedLinks;
|
|
49
57
|
},
|
|
50
|
-
renderHTML: (
|
|
51
|
-
links:
|
|
52
|
-
href:
|
|
53
|
-
name:
|
|
54
|
-
documentId:
|
|
55
|
-
dataContentType:
|
|
56
|
-
}))
|
|
57
|
-
})
|
|
58
|
-
}
|
|
58
|
+
renderHTML: (attributes) => ({
|
|
59
|
+
links: attributes.links.map((link) => ({
|
|
60
|
+
href: link.href,
|
|
61
|
+
name: link.name,
|
|
62
|
+
documentId: link.documentId,
|
|
63
|
+
dataContentType: link.dataContentType,
|
|
64
|
+
})),
|
|
65
|
+
}),
|
|
66
|
+
},
|
|
59
67
|
};
|
|
60
68
|
},
|
|
61
69
|
addCommands() {
|
|
62
70
|
return {
|
|
63
|
-
setAttachment:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
setAttachment:
|
|
72
|
+
(
|
|
73
|
+
attrs = {
|
|
74
|
+
dataContentType: '',
|
|
75
|
+
name: '',
|
|
76
|
+
documentId: '',
|
|
77
|
+
href: '',
|
|
78
|
+
},
|
|
79
|
+
) =>
|
|
80
|
+
({ chain }) =>
|
|
81
|
+
chain().insertContent({ type: this.name, attrs }).run(),
|
|
69
82
|
};
|
|
70
|
-
}
|
|
83
|
+
},
|
|
71
84
|
});
|
|
72
|
-
export {
|
|
73
|
-
p as Attachment
|
|
74
|
-
};
|
|
85
|
+
export { Attachment };
|
|
75
86
|
//# sourceMappingURL=attachment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment.js","sources":["../../src/attachment/attachment.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface AttachmentOptions {\n HTMLAttributes: Record<string, string>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n attachment: {\n setAttachment: (attachment) => ReturnType;\n };\n }\n}\n\nexport const Attachment = Node.create<AttachmentOptions>({\n name: 'attachments',\n content: '',\n marks: '',\n group: 'block',\n selectable: true,\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n HTMLAttributes: {\n class: 'attachments',\n },\n };\n },\n\n parseHTML() {\n return [{ tag: 'div[class=attachments]' }];\n },\n\n renderHTML({ HTMLAttributes }) {\n const links = HTMLAttributes.links;\n\n const renderedLinks = links.map((el) => {\n return [\n 'a',\n {\n name: el.name,\n href: el.href,\n documentId: el.documentId,\n dataContentType: el.dataContentType,\n },\n el.name,\n ];\n });\n\n return ['div', this.options.HTMLAttributes, ...renderedLinks];\n },\n\n addAttributes() {\n return {\n links: {\n default: [],\n parseHTML: (element) => {\n const links = element.getElementsByTagName('a');\n const parsedLinks = [];\n\n for (let i = 0; i < links.length; i++) {\n const link = links[i];\n const href = link.getAttribute('href');\n const name = link.textContent;\n const regexResult = href.match(/([^/]+$)/);\n const documentId =\n link.getAttribute('data-document-id') ||\n (regexResult && regexResult[0]);\n const dataContentType = link.getAttribute('data-content-type');\n\n parsedLinks.push({\n href,\n name,\n documentId,\n dataContentType,\n });\n }\n\n return parsedLinks;\n },\n renderHTML: (attributes) => {\n return {\n links: attributes.links.map((link) => ({\n href: link.href,\n name: link.name,\n documentId: link.documentId,\n dataContentType: link.dataContentType,\n })),\n };\n },\n },\n };\n },\n\n addCommands() {\n return {\n setAttachment:\n (\n attrs = {\n dataContentType: '',\n name: '',\n documentId: '',\n href: '',\n },\n ) =>\n ({ chain }) => {\n return chain().insertContent({ type: this.name, attrs }).run();\n },\n };\n },\n});\n"],"names":[
|
|
1
|
+
{"version":3,"file":"attachment.js","sources":["../../src/attachment/attachment.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface AttachmentOptions {\n HTMLAttributes: Record<string, string>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n attachment: {\n setAttachment: (attachment) => ReturnType;\n };\n }\n}\n\nexport const Attachment = Node.create<AttachmentOptions>({\n name: 'attachments',\n content: '',\n marks: '',\n group: 'block',\n selectable: true,\n atom: true,\n draggable: true,\n\n addOptions() {\n return {\n HTMLAttributes: {\n class: 'attachments',\n },\n };\n },\n\n parseHTML() {\n return [{ tag: 'div[class=attachments]' }];\n },\n\n renderHTML({ HTMLAttributes }) {\n const links = HTMLAttributes.links;\n\n const renderedLinks = links.map((el) => {\n return [\n 'a',\n {\n name: el.name,\n href: el.href,\n documentId: el.documentId,\n dataContentType: el.dataContentType,\n },\n el.name,\n ];\n });\n\n return ['div', this.options.HTMLAttributes, ...renderedLinks];\n },\n\n addAttributes() {\n return {\n links: {\n default: [],\n parseHTML: (element) => {\n const links = element.getElementsByTagName('a');\n const parsedLinks = [];\n\n for (let i = 0; i < links.length; i++) {\n const link = links[i];\n const href = link.getAttribute('href');\n const name = link.textContent;\n const regexResult = href.match(/([^/]+$)/);\n const documentId =\n link.getAttribute('data-document-id') ||\n (regexResult && regexResult[0]);\n const dataContentType = link.getAttribute('data-content-type');\n\n parsedLinks.push({\n href,\n name,\n documentId,\n dataContentType,\n });\n }\n\n return parsedLinks;\n },\n renderHTML: (attributes) => {\n return {\n links: attributes.links.map((link) => ({\n href: link.href,\n name: link.name,\n documentId: link.documentId,\n dataContentType: link.dataContentType,\n })),\n };\n },\n },\n };\n },\n\n addCommands() {\n return {\n setAttachment:\n (\n attrs = {\n dataContentType: '',\n name: '',\n documentId: '',\n href: '',\n },\n ) =>\n ({ chain }) => {\n return chain().insertContent({ type: this.name, attrs }).run();\n },\n };\n },\n});\n"],"names":[],"mappings":";AAca,MAAA,aAAa,KAAK,OAA0B;AAAA,EACvD,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,WAAW;AAAA,EAEX,aAAa;AACJ,WAAA;AAAA,MACL,gBAAgB;AAAA,QACd,OAAO;AAAA,MACT;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,YAAY;AACV,WAAO,CAAC,EAAE,KAAK,yBAAA,CAA0B;AAAA,EAC3C;AAAA,EAEA,WAAW,EAAE,kBAAkB;AAG7B,UAAM,gBAFQ,eAAe,MAED,IAAI,CAAC,OACxB;AAAA,MACL;AAAA,MACA;AAAA,QACE,MAAM,GAAG;AAAA,QACT,MAAM,GAAG;AAAA,QACT,YAAY,GAAG;AAAA,QACf,iBAAiB,GAAG;AAAA,MACtB;AAAA,MACA,GAAG;AAAA,IAAA,CAEN;AAED,WAAO,CAAC,OAAO,KAAK,QAAQ,gBAAgB,GAAG,aAAa;AAAA,EAC9D;AAAA,EAEA,gBAAgB;AACP,WAAA;AAAA,MACL,OAAO;AAAA,QACL,SAAS,CAAC;AAAA,QACV,WAAW,CAAC,YAAY;AAChB,gBAAA,QAAQ,QAAQ,qBAAqB,GAAG,GACxC,cAAc,CAAA;AAEpB,mBAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AAC/B,kBAAA,OAAO,MAAM,CAAC,GACd,OAAO,KAAK,aAAa,MAAM,GAC/B,OAAO,KAAK,aACZ,cAAc,KAAK,MAAM,UAAU,GACnC,aACJ,KAAK,aAAa,kBAAkB,KACnC,eAAe,YAAY,CAAC,GACzB,kBAAkB,KAAK,aAAa,mBAAmB;AAE7D,wBAAY,KAAK;AAAA,cACf;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,YAAA,CACD;AAAA,UACH;AAEO,iBAAA;AAAA,QACT;AAAA,QACA,YAAY,CAAC,gBACJ;AAAA,UACL,OAAO,WAAW,MAAM,IAAI,CAAC,UAAU;AAAA,YACrC,MAAM,KAAK;AAAA,YACX,MAAM,KAAK;AAAA,YACX,YAAY,KAAK;AAAA,YACjB,iBAAiB,KAAK;AAAA,UAAA,EACtB;AAAA,QAAA;AAAA,MAGR;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,cAAc;AACL,WAAA;AAAA,MACL,eACE,CACE,QAAQ;AAAA,QACN,iBAAiB;AAAA,QACjB,MAAM;AAAA,QACN,YAAY;AAAA,QACZ,MAAM;AAAA,MAAA,MAGV,CAAC,EAAE,YACM,MAAA,EAAQ,cAAc,EAAE,MAAM,KAAK,MAAM,MAAA,CAAO,EAAE;IAC3D;AAAA,EAEN;AACF,CAAC;"}
|
package/dist/audio/audio.cjs
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
|
+
const core = require('@tiptap/core'),
|
|
4
|
+
Audio = core.Node.create({
|
|
5
|
+
name: 'audio',
|
|
6
|
+
group: 'block',
|
|
7
|
+
addAttributes() {
|
|
8
|
+
return {
|
|
9
|
+
src: {
|
|
10
|
+
default: null,
|
|
11
|
+
parseHTML: (el) => el.getAttribute('src'),
|
|
12
|
+
renderHTML: (attrs) => ({ src: attrs.src }),
|
|
13
|
+
},
|
|
14
|
+
documentId: {
|
|
15
|
+
default: '',
|
|
16
|
+
renderHTML: (attributes) => ({
|
|
17
|
+
'data-document-id': attributes.documentId,
|
|
18
|
+
}),
|
|
19
|
+
parseHTML: (element) => element.getAttribute('data-document-id'),
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
parseHTML() {
|
|
24
|
+
return [
|
|
25
|
+
{
|
|
26
|
+
tag: 'div.audio-wrapper>audio,audio',
|
|
27
|
+
getAttrs: (el) => ({ src: el.getAttribute('src') }),
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
},
|
|
31
|
+
renderHTML({ HTMLAttributes }) {
|
|
32
|
+
return [
|
|
33
|
+
'div',
|
|
34
|
+
{ class: 'audio-wrapper' },
|
|
35
|
+
['audio', core.mergeAttributes(HTMLAttributes)],
|
|
36
|
+
];
|
|
37
|
+
},
|
|
38
|
+
addCommands() {
|
|
39
|
+
return {
|
|
40
|
+
setAudio:
|
|
41
|
+
(id, src, options) =>
|
|
42
|
+
({ commands, state }) =>
|
|
43
|
+
commands.insertContentAt(
|
|
44
|
+
state.selection,
|
|
45
|
+
`<audio
|
|
46
|
+
src="${src}"
|
|
3
47
|
controls preload="none"
|
|
4
|
-
data-document-id="${
|
|
48
|
+
data-document-id="${id}"></audio>`,
|
|
49
|
+
options,
|
|
50
|
+
),
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
exports.Audio = Audio;
|
|
5
55
|
//# sourceMappingURL=audio.cjs.map
|