@edifice.io/tiptap-extensions 1.5.16-develop-rc.3 → 1.7.4-develop-pedago.20241211160712
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 +8 -5
- package/dist/abbr/abbr.cjs +1 -32
- package/dist/abbr/abbr.cjs.map +1 -1
- package/dist/abbr/abbr.d.ts +12 -12
- package/dist/abbr/abbr.js +13 -17
- package/dist/abbr/abbr.js.map +1 -1
- package/dist/alert/alert.cjs +1 -32
- package/dist/alert/alert.cjs.map +1 -1
- package/dist/alert/alert.js +22 -20
- package/dist/alert/alert.js.map +1 -1
- package/dist/attachment/attachment-transformer.cjs +2 -0
- package/dist/attachment/attachment-transformer.cjs.map +1 -0
- package/dist/attachment/attachment-transformer.d.ts +12 -0
- package/dist/attachment/attachment-transformer.js +76 -0
- package/dist/attachment/attachment-transformer.js.map +1 -0
- package/dist/attachment/attachment.cjs +1 -73
- package/dist/attachment/attachment.cjs.map +1 -1
- package/dist/attachment/attachment.d.ts +6 -6
- package/dist/attachment/attachment.js +29 -40
- package/dist/attachment/attachment.js.map +1 -1
- package/dist/attachment/index.d.ts +1 -0
- package/dist/audio/audio.cjs +2 -52
- package/dist/audio/audio.cjs.map +1 -1
- package/dist/audio/audio.d.ts +13 -17
- package/dist/audio/audio.js +25 -28
- package/dist/audio/audio.js.map +1 -1
- package/dist/font-size/font-size.cjs +1 -48
- 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 +17 -29
- package/dist/font-size/font-size.js.map +1 -1
- package/dist/heading/heading.cjs +1 -61
- package/dist/heading/heading.cjs.map +1 -1
- package/dist/heading/heading.d.ts +12 -10
- package/dist/heading/heading.js +25 -39
- package/dist/heading/heading.js.map +1 -1
- package/dist/highlight/highlight.cjs +1 -25
- package/dist/highlight/highlight.cjs.map +1 -1
- package/dist/highlight/highlight.d.ts +1 -4
- package/dist/highlight/highlight.js +13 -11
- package/dist/highlight/highlight.js.map +1 -1
- package/dist/hyperlink/hyperlink.cjs +1 -47
- package/dist/hyperlink/hyperlink.cjs.map +1 -1
- package/dist/hyperlink/hyperlink.d.ts +24 -27
- package/dist/hyperlink/hyperlink.js +19 -21
- package/dist/hyperlink/hyperlink.js.map +1 -1
- package/dist/iframe/iframe.cjs +1 -69
- package/dist/iframe/iframe.cjs.map +1 -1
- package/dist/iframe/iframe.d.ts +14 -12
- package/dist/iframe/iframe.js +32 -48
- package/dist/iframe/iframe.js.map +1 -1
- package/dist/image/image.cjs +2 -0
- package/dist/image/image.cjs.map +1 -0
- package/dist/image/image.d.ts +26 -0
- package/dist/image/image.js +178 -0
- package/dist/image/image.js.map +1 -0
- package/dist/image/index.d.ts +3 -3
- package/dist/index.cjs +1 -43
- package/dist/index.js +24 -22
- package/dist/index.js.map +1 -1
- package/dist/line-height/line-height.cjs +1 -33
- package/dist/line-height/line-height.cjs.map +1 -1
- package/dist/line-height/line-height.js +15 -18
- package/dist/line-height/line-height.js.map +1 -1
- package/dist/linker/linker.cjs +1 -95
- package/dist/linker/linker.cjs.map +1 -1
- package/dist/linker/linker.d.ts +17 -17
- package/dist/linker/linker.js +49 -57
- package/dist/linker/linker.js.map +1 -1
- package/dist/mathjax/mathjax.cjs +1 -47
- package/dist/mathjax/mathjax.cjs.map +1 -1
- package/dist/mathjax/mathjax.js +20 -30
- package/dist/mathjax/mathjax.js.map +1 -1
- package/dist/paragraph/paragraph.cjs +1 -13
- package/dist/paragraph/paragraph.cjs.map +1 -1
- package/dist/paragraph/paragraph.d.ts +1 -4
- package/dist/paragraph/paragraph.js +8 -6
- package/dist/paragraph/paragraph.js.map +1 -1
- package/dist/speech-recognition/speech-recognition.cjs +1 -76
- 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 +36 -57
- package/dist/speech-recognition/speech-recognition.js.map +1 -1
- package/dist/speech-synthesis/speech-synthesis.cjs +1 -32
- 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 +10 -19
- package/dist/speech-synthesis/speech-synthesis.js.map +1 -1
- package/dist/table-cell/table-cell.cjs +1 -27
- package/dist/table-cell/table-cell.cjs.map +1 -1
- package/dist/table-cell/table-cell.d.ts +1 -4
- package/dist/table-cell/table-cell.js +12 -17
- package/dist/table-cell/table-cell.js.map +1 -1
- package/dist/transform/html-to-json/html-to-json.cjs +1 -4
- package/dist/transform/html-to-json/html-to-json.d.ts +1 -4
- package/dist/transform/html-to-json/html-to-json.js +4 -2
- package/dist/transform/json-to-html/json-to-html.cjs +1 -4
- package/dist/transform/json-to-html/json-to-html.js +4 -2
- package/dist/video/video.cjs +2 -111
- package/dist/video/video.cjs.map +1 -1
- package/dist/video/video.d.ts +19 -28
- package/dist/video/video.js +90 -114
- package/dist/video/video.js.map +1 -1
- package/package.json +24 -16
- package/dist/image/custom-image.cjs +0 -163
- package/dist/image/custom-image.cjs.map +0 -1
- package/dist/image/custom-image.d.ts +0 -27
- package/dist/image/custom-image.js +0 -181
- package/dist/image/custom-image.js.map +0 -1
|
@@ -1,77 +1,56 @@
|
|
|
1
|
-
import { Node } from
|
|
1
|
+
import { Node } from "@tiptap/core";
|
|
2
2
|
class SR_Node extends Node {
|
|
3
3
|
constructor() {
|
|
4
|
-
super(),
|
|
4
|
+
super(), this.isStarted = !1;
|
|
5
5
|
}
|
|
6
6
|
static create(config) {
|
|
7
7
|
return Node.create(config);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
const SpeechRecognition = SR_Node.create({
|
|
11
|
-
name:
|
|
11
|
+
name: "SpeechRecognition",
|
|
12
12
|
addOptions() {
|
|
13
13
|
return {
|
|
14
|
-
lang:
|
|
14
|
+
lang: "fr-FR"
|
|
15
15
|
};
|
|
16
16
|
},
|
|
17
17
|
onCreate() {
|
|
18
|
-
|
|
19
|
-
'
|
|
20
|
-
|
|
21
|
-
'"speechrecognition extension from @edifice.io/tiptap-extensions" requires a browser supporting the SpeechRecognition API".',
|
|
22
|
-
);
|
|
18
|
+
"SpeechRecognition" in window || "webkitSpeechRecognition" in window || console.warn(
|
|
19
|
+
'"@edifice.io/tiptap-extensions/speechrecognition" requires a browser supporting the SpeechRecognition API".'
|
|
20
|
+
);
|
|
23
21
|
},
|
|
24
22
|
addCommands() {
|
|
25
23
|
return {
|
|
26
|
-
startSpeechRecognition:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const isFinal = event.results[event.results.length - 1].isFinal;
|
|
44
|
-
this.editor.commands.deleteRange({ from, to }),
|
|
45
|
-
this.editor.commands.insertContentAt(
|
|
46
|
-
from,
|
|
47
|
-
isFinal ? currentResult : `<code>${currentResult}</code>`,
|
|
48
|
-
{ updateSelection: !isFinal },
|
|
49
|
-
),
|
|
50
|
-
(to = this.editor.state.selection.to),
|
|
51
|
-
isFinal && (from = to);
|
|
52
|
-
}),
|
|
53
|
-
(this.recognition.onerror = (event) => {
|
|
54
|
-
console.log(
|
|
55
|
-
`[speechrecognition from @edifice.io/tiptap-extensions][error][${event.error}]: ${event.message}`,
|
|
56
|
-
);
|
|
57
|
-
}),
|
|
58
|
-
(this.recognition.onstart = () => {
|
|
59
|
-
this.isStarted = !0;
|
|
60
|
-
}),
|
|
61
|
-
(this.recognition.onend = () => {
|
|
62
|
-
this.isStarted = !1;
|
|
63
|
-
}),
|
|
64
|
-
commands
|
|
24
|
+
startSpeechRecognition: () => ({ commands }) => {
|
|
25
|
+
const SpeechRecognition2 = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
26
|
+
this.recognition = new SpeechRecognition2(), this.recognition.lang = this.options.lang, this.recognition.interimResults = !0, this.recognition.maxAlternatives = 1, this.recognition.continuous = !0, this.recognition.start();
|
|
27
|
+
let { from, to } = this.editor.state.selection;
|
|
28
|
+
return this.recognition.onresult = (event) => {
|
|
29
|
+
let currentResult = "";
|
|
30
|
+
for (let i = event.resultIndex; i < event.results.length; i++)
|
|
31
|
+
currentResult += event.results[i][0].transcript;
|
|
32
|
+
const isFinal = event.results[event.results.length - 1].isFinal;
|
|
33
|
+
this.editor.commands.deleteRange({ from, to }), this.editor.commands.insertContentAt(
|
|
34
|
+
from,
|
|
35
|
+
isFinal ? currentResult : `<code>${currentResult}</code>`,
|
|
36
|
+
{ updateSelection: !isFinal }
|
|
37
|
+
), to = this.editor.state.selection.to, isFinal && (from = to);
|
|
38
|
+
}, this.recognition.onerror = (event) => {
|
|
39
|
+
console.log(
|
|
40
|
+
`[@edifice.io/tiptap-extensions/speech-recognition][error][${event.error}]: ${event.message}`
|
|
65
41
|
);
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
() =>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
42
|
+
}, this.recognition.onstart = () => {
|
|
43
|
+
this.isStarted = !0;
|
|
44
|
+
}, this.recognition.onend = () => {
|
|
45
|
+
this.isStarted = !1;
|
|
46
|
+
}, commands;
|
|
47
|
+
},
|
|
48
|
+
stopSpeechRecognition: () => ({ commands }) => (this.recognition.stop(), this.editor.commands.focus(), commands),
|
|
49
|
+
isSpeechRecognitionStarted: () => () => this.isStarted
|
|
73
50
|
};
|
|
74
|
-
}
|
|
51
|
+
}
|
|
75
52
|
});
|
|
76
|
-
export {
|
|
53
|
+
export {
|
|
54
|
+
SpeechRecognition
|
|
55
|
+
};
|
|
77
56
|
//# sourceMappingURL=speech-recognition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speech-recognition.js","sources":["../../src/speech-recognition/speech-recognition.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface SpeechRecognitionOptions {\n lang: string;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n SpeechRecognition: {\n startSpeechRecognition: () => ReturnType;\n stopSpeechRecognition: () => ReturnType;\n isSpeechRecognitionStarted: () => boolean;\n };\n }\n}\n\nclass SR_Node<O = any, S = any> extends Node<O, S> {\n protected constructor() {\n super();\n }\n\n recognition: SpeechRecognition | undefined;\n readonly isStarted: boolean = false;\n\n static create<O = any, S = any>(config?: any) {\n return Node.create(config) as SR_Node<O, S>;\n }\n}\n\nexport const SpeechRecognition = SR_Node.create<SpeechRecognitionOptions>({\n name: 'SpeechRecognition',\n\n addOptions() {\n return {\n lang: 'fr-FR',\n };\n },\n\n onCreate() {\n if (\n !('SpeechRecognition' in window || 'webkitSpeechRecognition' in window)\n ) {\n console.warn(\n '\"
|
|
1
|
+
{"version":3,"file":"speech-recognition.js","sources":["../../src/speech-recognition/speech-recognition.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface SpeechRecognitionOptions {\n lang: string;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n SpeechRecognition: {\n startSpeechRecognition: () => ReturnType;\n stopSpeechRecognition: () => ReturnType;\n isSpeechRecognitionStarted: () => boolean;\n };\n }\n}\n\nclass SR_Node<O = any, S = any> extends Node<O, S> {\n protected constructor() {\n super();\n }\n\n recognition: SpeechRecognition | undefined;\n readonly isStarted: boolean = false;\n\n static create<O = any, S = any>(config?: any) {\n return Node.create(config) as SR_Node<O, S>;\n }\n}\n\nexport const SpeechRecognition = SR_Node.create<SpeechRecognitionOptions>({\n name: 'SpeechRecognition',\n\n addOptions() {\n return {\n lang: 'fr-FR',\n };\n },\n\n onCreate() {\n if (\n !('SpeechRecognition' in window || 'webkitSpeechRecognition' in window)\n ) {\n console.warn(\n '\"@edifice.io/tiptap-extensions/speechrecognition\" requires a browser supporting the SpeechRecognition API\".',\n );\n }\n },\n\n addCommands() {\n return {\n startSpeechRecognition:\n () =>\n ({ commands }) => {\n const SpeechRecognition =\n window.SpeechRecognition || window.webkitSpeechRecognition;\n this.recognition = new SpeechRecognition();\n\n this.recognition.lang = this.options.lang;\n this.recognition.interimResults = true;\n this.recognition.maxAlternatives = 1;\n this.recognition.continuous = true;\n\n this.recognition.start();\n\n // Memoize initial caret positions\n let { from, to } = this.editor.state.selection;\n\n this.recognition.onresult = (event: SpeechRecognitionEvent) => {\n let currentResult = '';\n\n // Add to the currentResult variable the content of the last recognized sentence\n for (let i = event.resultIndex; i < event.results.length; i++) {\n currentResult += event.results[i][0].transcript;\n }\n\n // Is this the final recognition ?\n const isFinal = event.results[event.results.length - 1].isFinal;\n\n // Replace selection by the last recognized sentence (+ style and select, if not final)\n this.editor.commands.deleteRange({ from, to });\n this.editor.commands.insertContentAt(\n from,\n isFinal ? currentResult : `<code>${currentResult}</code>`,\n { updateSelection: !isFinal },\n );\n to = this.editor.state.selection.to;\n\n if (isFinal) {\n // Next content will go after last insertion\n from = to;\n }\n };\n\n this.recognition.onerror = (event: SpeechRecognitionErrorEvent) => {\n // TODO create a \"feedback\" tiptap extension, to display user friendly error messages ?\n console.log(\n `[@edifice.io/tiptap-extensions/speech-recognition][error][${event.error}]: ${event.message}`,\n );\n };\n\n this.recognition.onstart = () => {\n this.isStarted = true;\n };\n\n this.recognition.onend = () => {\n this.isStarted = false;\n };\n\n return commands;\n },\n\n stopSpeechRecognition:\n () =>\n ({ commands }) => {\n this.recognition.stop();\n this.editor.commands.focus();\n return commands;\n },\n\n isSpeechRecognitionStarted: () => () => this.isStarted,\n };\n },\n});\n"],"names":["SpeechRecognition"],"mappings":";AAgBA,MAAM,gBAAkC,KAAW;AAAA,EACvC,cAAc;AAChB,UAAA,GAIR,KAAS,YAAqB;AAAA,EAAA;AAAA,EAE9B,OAAO,OAAyB,QAAc;AACrC,WAAA,KAAK,OAAO,MAAM;AAAA,EAAA;AAE7B;AAEa,MAAA,oBAAoB,QAAQ,OAAiC;AAAA,EACxE,MAAM;AAAA,EAEN,aAAa;AACJ,WAAA;AAAA,MACL,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EAEA,WAAW;AACT,IACI,uBAAuB,UAAU,6BAA6B,UAExD,QAAA;AAAA,MACN;AAAA,IACF;AAAA,EAEJ;AAAA,EAEA,cAAc;AACL,WAAA;AAAA,MACL,wBACE,MACA,CAAC,EAAE,eAAe;AACVA,cAAAA,qBACJ,OAAO,qBAAqB,OAAO;AAChC,aAAA,cAAc,IAAIA,mBAAkB,GAEpC,KAAA,YAAY,OAAO,KAAK,QAAQ,MACrC,KAAK,YAAY,iBAAiB,IAClC,KAAK,YAAY,kBAAkB,GACnC,KAAK,YAAY,aAAa,IAE9B,KAAK,YAAY,MAAM;AAGvB,YAAI,EAAE,MAAM,GAAA,IAAO,KAAK,OAAO,MAAM;AAEhC,oBAAA,YAAY,WAAW,CAAC,UAAkC;AAC7D,cAAI,gBAAgB;AAGpB,mBAAS,IAAI,MAAM,aAAa,IAAI,MAAM,QAAQ,QAAQ;AACxD,6BAAiB,MAAM,QAAQ,CAAC,EAAE,CAAC,EAAE;AAIvC,gBAAM,UAAU,MAAM,QAAQ,MAAM,QAAQ,SAAS,CAAC,EAAE;AAGxD,eAAK,OAAO,SAAS,YAAY,EAAE,MAAM,IAAI,GAC7C,KAAK,OAAO,SAAS;AAAA,YACnB;AAAA,YACA,UAAU,gBAAgB,SAAS,aAAa;AAAA,YAChD,EAAE,iBAAiB,CAAC,QAAQ;AAAA,UAC9B,GACK,KAAA,KAAK,OAAO,MAAM,UAAU,IAE7B,YAEK,OAAA;AAAA,QAEX,GAEK,KAAA,YAAY,UAAU,CAAC,UAAuC;AAEzD,kBAAA;AAAA,YACN,6DAA6D,MAAM,KAAK,MAAM,MAAM,OAAO;AAAA,UAC7F;AAAA,QACF,GAEK,KAAA,YAAY,UAAU,MAAM;AAC/B,eAAK,YAAY;AAAA,QACnB,GAEK,KAAA,YAAY,QAAQ,MAAM;AAC7B,eAAK,YAAY;AAAA,QACnB,GAEO;AAAA,MACT;AAAA,MAEF,uBACE,MACA,CAAC,EAAE,gBACD,KAAK,YAAY,KAAK,GACjB,KAAA,OAAO,SAAS,MAAM,GACpB;AAAA,MAGX,4BAA4B,MAAM,MAAM,KAAK;AAAA,IAC/C;AAAA,EAAA;AAEJ,CAAC;"}
|
|
@@ -1,33 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
|
-
const core = require('@tiptap/core');
|
|
4
|
-
class SS_Node extends core.Node {
|
|
5
|
-
static create(config) {
|
|
6
|
-
return core.Node.create(config);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
const SpeechSynthesis = SS_Node.create({
|
|
10
|
-
name: 'speechSynthesis',
|
|
11
|
-
addOptions() {
|
|
12
|
-
return { lang: 'fr-FR', pitch: 1 };
|
|
13
|
-
},
|
|
14
|
-
addCommands() {
|
|
15
|
-
return {
|
|
16
|
-
startSpeechSynthesis:
|
|
17
|
-
() =>
|
|
18
|
-
({ commands }) => (
|
|
19
|
-
(this.speechSynthesis = new SpeechSynthesisUtterance()),
|
|
20
|
-
(this.speechSynthesis.lang = this.options.lang),
|
|
21
|
-
(this.speechSynthesis.pitch = this.options.pitch),
|
|
22
|
-
(this.speechSynthesis.text = this.editor.getText()),
|
|
23
|
-
window.speechSynthesis.speak(this.speechSynthesis),
|
|
24
|
-
commands
|
|
25
|
-
),
|
|
26
|
-
stopSpeechSynthesis:
|
|
27
|
-
() =>
|
|
28
|
-
({ commands }) => (window.speechSynthesis.cancel(), commands),
|
|
29
|
-
};
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
exports.SpeechSynthesis = SpeechSynthesis;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core");class SS_Node extends core.Node{static create(config){return core.Node.create(config)}}const SpeechSynthesis=SS_Node.create({name:"speechSynthesis",addOptions(){return{lang:"fr-FR",pitch:1}},addCommands(){return{startSpeechSynthesis:()=>({commands})=>(this.speechSynthesis=new SpeechSynthesisUtterance,this.speechSynthesis.lang=this.options.lang,this.speechSynthesis.pitch=this.options.pitch,this.speechSynthesis.text=this.editor.getText(),window.speechSynthesis.speak(this.speechSynthesis),commands),stopSpeechSynthesis:()=>({commands})=>(window.speechSynthesis.cancel(),commands)}}});exports.SpeechSynthesis=SpeechSynthesis;
|
|
33
2
|
//# sourceMappingURL=speech-synthesis.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speech-synthesis.cjs","sources":["../../src/speech-synthesis/speech-synthesis.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface SpeechSynthesisOptions {\n lang: string;\n pitch: number;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n speechSynthesis: {\n startSpeechSynthesis: () => ReturnType;\n stopSpeechSynthesis: () => ReturnType;\n };\n }\n}\n\nclass SS_Node<O = any, S = any> extends Node<O, S> {\n static create<O = any, S = any>(config?: any) {\n return Node.create(config) as SS_Node<O, S>;\n }\n}\n\nexport const SpeechSynthesis = SS_Node.create<SpeechSynthesisOptions>({\n name: 'speechSynthesis',\n addOptions() {\n return {\n lang: 'fr-FR',\n pitch: 1,\n };\n },\n addCommands() {\n return {\n startSpeechSynthesis:\n () =>\n ({ commands }) => {\n this.speechSynthesis = new SpeechSynthesisUtterance();\n this.speechSynthesis.lang = this.options.lang;\n this.speechSynthesis.pitch = this.options.pitch;\n this.speechSynthesis.text = this.editor.getText();\n\n window.speechSynthesis.speak(this.speechSynthesis);\n return commands;\n },\n stopSpeechSynthesis:\n () =>\n ({ commands }) => {\n window.speechSynthesis.cancel();\n return commands;\n },\n };\n },\n});\n"],"names":["Node"],"mappings":"mHAgBA,MAAM,gBAAkCA,KAAAA,IAAW,CACjD,OAAO,OAAyB,OAAc,CACrC,OAAAA,KAAA,KAAK,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"speech-synthesis.cjs","sources":["../../src/speech-synthesis/speech-synthesis.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface SpeechSynthesisOptions {\n lang: string;\n pitch: number;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n speechSynthesis: {\n startSpeechSynthesis: () => ReturnType;\n stopSpeechSynthesis: () => ReturnType;\n };\n }\n}\n\nclass SS_Node<O = any, S = any> extends Node<O, S> {\n static create<O = any, S = any>(config?: any) {\n return Node.create(config) as SS_Node<O, S>;\n }\n}\n\nexport const SpeechSynthesis = SS_Node.create<SpeechSynthesisOptions>({\n name: 'speechSynthesis',\n addOptions() {\n return {\n lang: 'fr-FR',\n pitch: 1,\n };\n },\n addCommands() {\n return {\n startSpeechSynthesis:\n () =>\n ({ commands }) => {\n this.speechSynthesis = new SpeechSynthesisUtterance();\n this.speechSynthesis.lang = this.options.lang;\n this.speechSynthesis.pitch = this.options.pitch;\n this.speechSynthesis.text = this.editor.getText();\n\n window.speechSynthesis.speak(this.speechSynthesis);\n return commands;\n },\n stopSpeechSynthesis:\n () =>\n ({ commands }) => {\n window.speechSynthesis.cancel();\n return commands;\n },\n };\n },\n});\n"],"names":["Node"],"mappings":"mHAgBA,MAAM,gBAAkCA,KAAAA,IAAW,CACjD,OAAO,OAAyB,OAAc,CACrC,OAAAA,KAAA,KAAK,OAAO,MAAM,CAAA,CAE7B,CAEa,MAAA,gBAAkB,QAAQ,OAA+B,CACpE,KAAM,kBACN,YAAa,CACJ,MAAA,CACL,KAAM,QACN,MAAO,CACT,CACF,EACA,aAAc,CACL,MAAA,CACL,qBACE,IACA,CAAC,CAAE,aACI,KAAA,gBAAkB,IAAI,yBACtB,KAAA,gBAAgB,KAAO,KAAK,QAAQ,KACpC,KAAA,gBAAgB,MAAQ,KAAK,QAAQ,MAC1C,KAAK,gBAAgB,KAAO,KAAK,OAAO,QAAQ,EAEzC,OAAA,gBAAgB,MAAM,KAAK,eAAe,EAC1C,UAEX,oBACE,IACA,CAAC,CAAE,aACD,OAAO,gBAAgB,OAAO,EACvB,SAEb,CAAA,CAEJ,CAAC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { Node } from '@tiptap/core';
|
|
2
2
|
export interface SpeechSynthesisOptions {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
lang: string;
|
|
4
|
+
pitch: number;
|
|
5
5
|
}
|
|
6
6
|
declare module '@tiptap/core' {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
interface Commands<ReturnType> {
|
|
8
|
+
speechSynthesis: {
|
|
9
|
+
startSpeechSynthesis: () => ReturnType;
|
|
10
|
+
stopSpeechSynthesis: () => ReturnType;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
13
|
}
|
|
14
14
|
declare class SS_Node<O = any, S = any> extends Node<O, S> {
|
|
15
|
-
|
|
15
|
+
static create<O = any, S = any>(config?: any): SS_Node<O, S>;
|
|
16
16
|
}
|
|
17
17
|
export declare const SpeechSynthesis: SS_Node<SpeechSynthesisOptions, any>;
|
|
18
18
|
export {};
|
|
@@ -1,34 +1,25 @@
|
|
|
1
|
-
import { Node } from
|
|
1
|
+
import { Node } from "@tiptap/core";
|
|
2
2
|
class SS_Node extends Node {
|
|
3
3
|
static create(config) {
|
|
4
4
|
return Node.create(config);
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
7
|
const SpeechSynthesis = SS_Node.create({
|
|
8
|
-
name:
|
|
8
|
+
name: "speechSynthesis",
|
|
9
9
|
addOptions() {
|
|
10
10
|
return {
|
|
11
|
-
lang:
|
|
12
|
-
pitch: 1
|
|
11
|
+
lang: "fr-FR",
|
|
12
|
+
pitch: 1
|
|
13
13
|
};
|
|
14
14
|
},
|
|
15
15
|
addCommands() {
|
|
16
16
|
return {
|
|
17
|
-
startSpeechSynthesis:
|
|
18
|
-
|
|
19
|
-
({ commands }) => (
|
|
20
|
-
(this.speechSynthesis = new SpeechSynthesisUtterance()),
|
|
21
|
-
(this.speechSynthesis.lang = this.options.lang),
|
|
22
|
-
(this.speechSynthesis.pitch = this.options.pitch),
|
|
23
|
-
(this.speechSynthesis.text = this.editor.getText()),
|
|
24
|
-
window.speechSynthesis.speak(this.speechSynthesis),
|
|
25
|
-
commands
|
|
26
|
-
),
|
|
27
|
-
stopSpeechSynthesis:
|
|
28
|
-
() =>
|
|
29
|
-
({ commands }) => (window.speechSynthesis.cancel(), commands),
|
|
17
|
+
startSpeechSynthesis: () => ({ commands }) => (this.speechSynthesis = new SpeechSynthesisUtterance(), this.speechSynthesis.lang = this.options.lang, this.speechSynthesis.pitch = this.options.pitch, this.speechSynthesis.text = this.editor.getText(), window.speechSynthesis.speak(this.speechSynthesis), commands),
|
|
18
|
+
stopSpeechSynthesis: () => ({ commands }) => (window.speechSynthesis.cancel(), commands)
|
|
30
19
|
};
|
|
31
|
-
}
|
|
20
|
+
}
|
|
32
21
|
});
|
|
33
|
-
export {
|
|
22
|
+
export {
|
|
23
|
+
SpeechSynthesis
|
|
24
|
+
};
|
|
34
25
|
//# sourceMappingURL=speech-synthesis.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speech-synthesis.js","sources":["../../src/speech-synthesis/speech-synthesis.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface SpeechSynthesisOptions {\n lang: string;\n pitch: number;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n speechSynthesis: {\n startSpeechSynthesis: () => ReturnType;\n stopSpeechSynthesis: () => ReturnType;\n };\n }\n}\n\nclass SS_Node<O = any, S = any> extends Node<O, S> {\n static create<O = any, S = any>(config?: any) {\n return Node.create(config) as SS_Node<O, S>;\n }\n}\n\nexport const SpeechSynthesis = SS_Node.create<SpeechSynthesisOptions>({\n name: 'speechSynthesis',\n addOptions() {\n return {\n lang: 'fr-FR',\n pitch: 1,\n };\n },\n addCommands() {\n return {\n startSpeechSynthesis:\n () =>\n ({ commands }) => {\n this.speechSynthesis = new SpeechSynthesisUtterance();\n this.speechSynthesis.lang = this.options.lang;\n this.speechSynthesis.pitch = this.options.pitch;\n this.speechSynthesis.text = this.editor.getText();\n\n window.speechSynthesis.speak(this.speechSynthesis);\n return commands;\n },\n stopSpeechSynthesis:\n () =>\n ({ commands }) => {\n window.speechSynthesis.cancel();\n return commands;\n },\n };\n },\n});\n"],"names":[],"mappings":";AAgBA,MAAM,gBAAkC,KAAW;AAAA,EACjD,OAAO,OAAyB,QAAc;AACrC,WAAA,KAAK,OAAO,MAAM;AAAA,
|
|
1
|
+
{"version":3,"file":"speech-synthesis.js","sources":["../../src/speech-synthesis/speech-synthesis.ts"],"sourcesContent":["import { Node } from '@tiptap/core';\n\nexport interface SpeechSynthesisOptions {\n lang: string;\n pitch: number;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n speechSynthesis: {\n startSpeechSynthesis: () => ReturnType;\n stopSpeechSynthesis: () => ReturnType;\n };\n }\n}\n\nclass SS_Node<O = any, S = any> extends Node<O, S> {\n static create<O = any, S = any>(config?: any) {\n return Node.create(config) as SS_Node<O, S>;\n }\n}\n\nexport const SpeechSynthesis = SS_Node.create<SpeechSynthesisOptions>({\n name: 'speechSynthesis',\n addOptions() {\n return {\n lang: 'fr-FR',\n pitch: 1,\n };\n },\n addCommands() {\n return {\n startSpeechSynthesis:\n () =>\n ({ commands }) => {\n this.speechSynthesis = new SpeechSynthesisUtterance();\n this.speechSynthesis.lang = this.options.lang;\n this.speechSynthesis.pitch = this.options.pitch;\n this.speechSynthesis.text = this.editor.getText();\n\n window.speechSynthesis.speak(this.speechSynthesis);\n return commands;\n },\n stopSpeechSynthesis:\n () =>\n ({ commands }) => {\n window.speechSynthesis.cancel();\n return commands;\n },\n };\n },\n});\n"],"names":[],"mappings":";AAgBA,MAAM,gBAAkC,KAAW;AAAA,EACjD,OAAO,OAAyB,QAAc;AACrC,WAAA,KAAK,OAAO,MAAM;AAAA,EAAA;AAE7B;AAEa,MAAA,kBAAkB,QAAQ,OAA+B;AAAA,EACpE,MAAM;AAAA,EACN,aAAa;AACJ,WAAA;AAAA,MACL,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,EACF;AAAA,EACA,cAAc;AACL,WAAA;AAAA,MACL,sBACE,MACA,CAAC,EAAE,gBACI,KAAA,kBAAkB,IAAI,yBAAyB,GAC/C,KAAA,gBAAgB,OAAO,KAAK,QAAQ,MACpC,KAAA,gBAAgB,QAAQ,KAAK,QAAQ,OAC1C,KAAK,gBAAgB,OAAO,KAAK,OAAO,QAAQ,GAEzC,OAAA,gBAAgB,MAAM,KAAK,eAAe,GAC1C;AAAA,MAEX,qBACE,MACA,CAAC,EAAE,gBACD,OAAO,gBAAgB,OAAO,GACvB;AAAA,IAEb;AAAA,EAAA;AAEJ,CAAC;"}
|
|
@@ -1,28 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
|
-
const extensionTableCell = require('@tiptap/extension-table-cell'),
|
|
4
|
-
TableCell = extensionTableCell.TableCell.extend({
|
|
5
|
-
addAttributes() {
|
|
6
|
-
var _a;
|
|
7
|
-
return {
|
|
8
|
-
...((_a = this.parent) == null ? void 0 : _a.call(this)),
|
|
9
|
-
backgroundColor: {
|
|
10
|
-
default: null,
|
|
11
|
-
renderHTML: (attributes) =>
|
|
12
|
-
attributes.backgroundColor
|
|
13
|
-
? { style: `background-color: ${attributes.backgroundColor}` }
|
|
14
|
-
: {},
|
|
15
|
-
parseHTML: (element) => {
|
|
16
|
-
var _a2, _b;
|
|
17
|
-
return (_b =
|
|
18
|
-
(_a2 = element.style) == null ? void 0 : _a2.backgroundColor) ==
|
|
19
|
-
null
|
|
20
|
-
? void 0
|
|
21
|
-
: _b.replace(/['"]+/g, '');
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
exports.TableCell = TableCell;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const extensionTableCell=require("@tiptap/extension-table-cell"),TableCell=extensionTableCell.TableCell.extend({addAttributes(){var _a;return{...(_a=this.parent)==null?void 0:_a.call(this),backgroundColor:{default:null,renderHTML:attributes=>attributes.backgroundColor?{style:`background-color: ${attributes.backgroundColor}`}:{},parseHTML:element=>{var _a2,_b;return(_b=(_a2=element.style)==null?void 0:_a2.backgroundColor)==null?void 0:_b.replace(/['"]+/g,"")}}}}});exports.TableCell=TableCell;
|
|
28
2
|
//# sourceMappingURL=table-cell.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-cell.cjs","sources":["../../src/table-cell/table-cell.ts"],"sourcesContent":["import { TableCell as TipTapTableCell } from '@tiptap/extension-table-cell';\n\n/**\n * This custom extension allows setting a background-color to table cells.\n * Apply with ̀`editor.chain().focus().setCellAttribute(\"backgroundColor\", color).run()`\n */\nexport const TableCell = TipTapTableCell.extend({\n addAttributes() {\n return {\n ...this.parent?.(),\n backgroundColor: {\n default: null,\n renderHTML: (attributes: { backgroundColor?: string }) => {\n if (!attributes.backgroundColor) {\n return {};\n }\n\n return {\n style: `background-color: ${attributes.backgroundColor}`,\n };\n },\n parseHTML: (element: { style?: { backgroundColor: string } }) => {\n return element.style?.backgroundColor?.replace(/['\"]+/g, '');\n },\n },\n };\n },\n});\n"],"names":["TipTapTableCell","_a"],"mappings":"iJAMa,UAAYA,6BAAgB,OAAO,CAC9C,eAAgB,QACP,MAAA,CACL,IAAG,QAAK,SAAL,0BACH,gBAAiB,CACf,QAAS,KACT,WAAa,YACN,WAAW,gBAIT,CACL,MAAO,qBAAqB,WAAW,eAAe,
|
|
1
|
+
{"version":3,"file":"table-cell.cjs","sources":["../../src/table-cell/table-cell.ts"],"sourcesContent":["import { TableCell as TipTapTableCell } from '@tiptap/extension-table-cell';\n\n/**\n * This custom extension allows setting a background-color to table cells.\n * Apply with ̀`editor.chain().focus().setCellAttribute(\"backgroundColor\", color).run()`\n */\nexport const TableCell = TipTapTableCell.extend({\n addAttributes() {\n return {\n ...this.parent?.(),\n backgroundColor: {\n default: null,\n renderHTML: (attributes: { backgroundColor?: string }) => {\n if (!attributes.backgroundColor) {\n return {};\n }\n\n return {\n style: `background-color: ${attributes.backgroundColor}`,\n };\n },\n parseHTML: (element: { style?: { backgroundColor: string } }) => {\n return element.style?.backgroundColor?.replace(/['\"]+/g, '');\n },\n },\n };\n },\n});\n"],"names":["TipTapTableCell","_a"],"mappings":"iJAMa,UAAYA,6BAAgB,OAAO,CAC9C,eAAgB,QACP,MAAA,CACL,IAAG,QAAK,SAAL,0BACH,gBAAiB,CACf,QAAS,KACT,WAAa,YACN,WAAW,gBAIT,CACL,MAAO,qBAAqB,WAAW,eAAe,EACxD,EALS,CAAC,EAOZ,UAAY,SAAqD,YAC/D,OAAO,IAAAC,IAAA,QAAQ,QAAR,YAAAA,IAAe,kBAAf,eAAgC,QAAQ,SAAU,GAAE,CAC7D,CAEJ,CAAA,CAEJ,CAAC"}
|
|
@@ -2,7 +2,4 @@
|
|
|
2
2
|
* This custom extension allows setting a background-color to table cells.
|
|
3
3
|
* Apply with ̀`editor.chain().focus().setCellAttribute("backgroundColor", color).run()`
|
|
4
4
|
*/
|
|
5
|
-
export declare const TableCell: import('@tiptap/core').Node<
|
|
6
|
-
import('@tiptap/extension-table-cell').TableCellOptions,
|
|
7
|
-
any
|
|
8
|
-
>;
|
|
5
|
+
export declare const TableCell: import('@tiptap/core').Node<import('@tiptap/extension-table-cell').TableCellOptions, any>;
|
|
@@ -1,28 +1,23 @@
|
|
|
1
|
-
import { TableCell as TableCell$1 } from
|
|
1
|
+
import { TableCell as TableCell$1 } from "@tiptap/extension-table-cell";
|
|
2
2
|
const TableCell = TableCell$1.extend({
|
|
3
3
|
addAttributes() {
|
|
4
4
|
var _a;
|
|
5
5
|
return {
|
|
6
|
-
...(
|
|
6
|
+
...(_a = this.parent) == null ? void 0 : _a.call(this),
|
|
7
7
|
backgroundColor: {
|
|
8
8
|
default: null,
|
|
9
|
-
renderHTML: (attributes) =>
|
|
10
|
-
attributes.backgroundColor
|
|
11
|
-
|
|
12
|
-
style: `background-color: ${attributes.backgroundColor}`,
|
|
13
|
-
}
|
|
14
|
-
: {},
|
|
9
|
+
renderHTML: (attributes) => attributes.backgroundColor ? {
|
|
10
|
+
style: `background-color: ${attributes.backgroundColor}`
|
|
11
|
+
} : {},
|
|
15
12
|
parseHTML: (element) => {
|
|
16
13
|
var _a2, _b;
|
|
17
|
-
return (_b =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
? void 0
|
|
21
|
-
: _b.replace(/['"]+/g, '');
|
|
22
|
-
},
|
|
23
|
-
},
|
|
14
|
+
return (_b = (_a2 = element.style) == null ? void 0 : _a2.backgroundColor) == null ? void 0 : _b.replace(/['"]+/g, "");
|
|
15
|
+
}
|
|
16
|
+
}
|
|
24
17
|
};
|
|
25
|
-
}
|
|
18
|
+
}
|
|
26
19
|
});
|
|
27
|
-
export {
|
|
20
|
+
export {
|
|
21
|
+
TableCell
|
|
22
|
+
};
|
|
28
23
|
//# sourceMappingURL=table-cell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-cell.js","sources":["../../src/table-cell/table-cell.ts"],"sourcesContent":["import { TableCell as TipTapTableCell } from '@tiptap/extension-table-cell';\n\n/**\n * This custom extension allows setting a background-color to table cells.\n * Apply with ̀`editor.chain().focus().setCellAttribute(\"backgroundColor\", color).run()`\n */\nexport const TableCell = TipTapTableCell.extend({\n addAttributes() {\n return {\n ...this.parent?.(),\n backgroundColor: {\n default: null,\n renderHTML: (attributes: { backgroundColor?: string }) => {\n if (!attributes.backgroundColor) {\n return {};\n }\n\n return {\n style: `background-color: ${attributes.backgroundColor}`,\n };\n },\n parseHTML: (element: { style?: { backgroundColor: string } }) => {\n return element.style?.backgroundColor?.replace(/['\"]+/g, '');\n },\n },\n };\n },\n});\n"],"names":["TipTapTableCell","_a"],"mappings":";AAMa,MAAA,YAAYA,YAAgB,OAAO;AAAA,EAC9C,gBAAgB;;AACP,WAAA;AAAA,MACL,IAAG,UAAK,WAAL;AAAA,MACH,iBAAiB;AAAA,QACf,SAAS;AAAA,QACT,YAAY,CAAC,eACN,WAAW,kBAIT;AAAA,UACL,OAAO,qBAAqB,WAAW,eAAe;AAAA,
|
|
1
|
+
{"version":3,"file":"table-cell.js","sources":["../../src/table-cell/table-cell.ts"],"sourcesContent":["import { TableCell as TipTapTableCell } from '@tiptap/extension-table-cell';\n\n/**\n * This custom extension allows setting a background-color to table cells.\n * Apply with ̀`editor.chain().focus().setCellAttribute(\"backgroundColor\", color).run()`\n */\nexport const TableCell = TipTapTableCell.extend({\n addAttributes() {\n return {\n ...this.parent?.(),\n backgroundColor: {\n default: null,\n renderHTML: (attributes: { backgroundColor?: string }) => {\n if (!attributes.backgroundColor) {\n return {};\n }\n\n return {\n style: `background-color: ${attributes.backgroundColor}`,\n };\n },\n parseHTML: (element: { style?: { backgroundColor: string } }) => {\n return element.style?.backgroundColor?.replace(/['\"]+/g, '');\n },\n },\n };\n },\n});\n"],"names":["TipTapTableCell","_a"],"mappings":";AAMa,MAAA,YAAYA,YAAgB,OAAO;AAAA,EAC9C,gBAAgB;;AACP,WAAA;AAAA,MACL,IAAG,UAAK,WAAL;AAAA,MACH,iBAAiB;AAAA,QACf,SAAS;AAAA,QACT,YAAY,CAAC,eACN,WAAW,kBAIT;AAAA,UACL,OAAO,qBAAqB,WAAW,eAAe;AAAA,QACxD,IALS,CAAC;AAAA,QAOZ,WAAW,CAAC,YAAqD;;AAC/D,kBAAO,MAAAC,MAAA,QAAQ,UAAR,gBAAAA,IAAe,oBAAf,mBAAgC,QAAQ,UAAU;AAAA,QAAE;AAAA,MAC7D;AAAA,IAEJ;AAAA,EAAA;AAEJ,CAAC;"}
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
const core = require('@tiptap/core'),
|
|
3
|
-
htmlToJson = (html, extensions) => core.generateJSON(html, extensions);
|
|
4
|
-
module.exports = htmlToJson;
|
|
1
|
+
"use strict";const core=require("@tiptap/core"),htmlToJson=(html,extensions)=>core.generateJSON(html,extensions);module.exports=htmlToJson;
|
|
5
2
|
//# sourceMappingURL=html-to-json.cjs.map
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import { Extensions, HTMLContent } from '@tiptap/core';
|
|
2
|
-
declare const _default: (
|
|
3
|
-
html: HTMLContent,
|
|
4
|
-
extensions: Extensions,
|
|
5
|
-
) => Record<string, any>;
|
|
2
|
+
declare const _default: (html: HTMLContent, extensions: Extensions) => Record<string, any>;
|
|
6
3
|
export default _default;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { generateJSON } from
|
|
1
|
+
import { generateJSON } from "@tiptap/core";
|
|
2
2
|
const htmlToJson = (html, extensions) => generateJSON(html, extensions);
|
|
3
|
-
export {
|
|
3
|
+
export {
|
|
4
|
+
htmlToJson as default
|
|
5
|
+
};
|
|
4
6
|
//# sourceMappingURL=html-to-json.js.map
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
const core = require('@tiptap/core'),
|
|
3
|
-
jsonToHtml = (json, extensions) => core.generateHTML(json, extensions);
|
|
4
|
-
module.exports = jsonToHtml;
|
|
1
|
+
"use strict";const core=require("@tiptap/core"),jsonToHtml=(json,extensions)=>core.generateHTML(json,extensions);module.exports=jsonToHtml;
|
|
5
2
|
//# sourceMappingURL=json-to-html.cjs.map
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { generateHTML } from
|
|
1
|
+
import { generateHTML } from "@tiptap/core";
|
|
2
2
|
const jsonToHtml = (json, extensions) => generateHTML(json, extensions);
|
|
3
|
-
export {
|
|
3
|
+
export {
|
|
4
|
+
jsonToHtml as default
|
|
5
|
+
};
|
|
4
6
|
//# sourceMappingURL=json-to-html.js.map
|
package/dist/video/video.cjs
CHANGED
|
@@ -1,91 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
|
-
const core = require('@tiptap/core'),
|
|
4
|
-
VIDEO_INPUT_REGEX = /!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\)/,
|
|
5
|
-
Video = core.Node.create({
|
|
6
|
-
name: 'video',
|
|
7
|
-
group: 'block',
|
|
8
|
-
draggable: !0,
|
|
9
|
-
selectable: !0,
|
|
10
|
-
addAttributes() {
|
|
11
|
-
return {
|
|
12
|
-
src: {
|
|
13
|
-
default: null,
|
|
14
|
-
parseHTML: (el) => el.getAttribute('src'),
|
|
15
|
-
renderHTML: (attrs) => ({ src: attrs.src }),
|
|
16
|
-
},
|
|
17
|
-
controls: {
|
|
18
|
-
default: !0,
|
|
19
|
-
parseHTML: (el) =>
|
|
20
|
-
el.getAttribute('controls')
|
|
21
|
-
? el.getAttribute('controls')
|
|
22
|
-
: !!el.hasAttribute('controls'),
|
|
23
|
-
renderHTML: (attrs) => ({ controls: attrs.controls }),
|
|
24
|
-
},
|
|
25
|
-
documentId: {
|
|
26
|
-
default: '',
|
|
27
|
-
renderHTML: (attributes) => ({
|
|
28
|
-
'data-document-id': attributes.documentId,
|
|
29
|
-
}),
|
|
30
|
-
parseHTML: (element) => element.getAttribute('data-document-id'),
|
|
31
|
-
},
|
|
32
|
-
isCaptation: {
|
|
33
|
-
default: !1,
|
|
34
|
-
renderHTML: (attributes) => ({
|
|
35
|
-
'data-document-is-captation': attributes.isCaptation,
|
|
36
|
-
}),
|
|
37
|
-
parseHTML: (element) =>
|
|
38
|
-
element.getAttribute('data-document-is-captation'),
|
|
39
|
-
},
|
|
40
|
-
videoResolution: {
|
|
41
|
-
default: '404x720',
|
|
42
|
-
renderHTML: (attributes) => ({
|
|
43
|
-
'data-video-resolution': attributes.videoResolution,
|
|
44
|
-
}),
|
|
45
|
-
parseHTML: (element) => element.getAttribute('data-video-resolution'),
|
|
46
|
-
},
|
|
47
|
-
width: {
|
|
48
|
-
renderHTML: (attributes) => ({ width: parseInt(attributes.width) }),
|
|
49
|
-
parseHTML: (element) => element.getAttribute('width'),
|
|
50
|
-
},
|
|
51
|
-
height: {
|
|
52
|
-
renderHTML: (attributes) => ({ height: parseInt(attributes.height) }),
|
|
53
|
-
parseHTML: (element) => element.getAttribute('height'),
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
parseHTML() {
|
|
58
|
-
return [
|
|
59
|
-
{
|
|
60
|
-
tag: 'div.video-wrapper>video,video',
|
|
61
|
-
getAttrs: (el) => ({ src: el.getAttribute('src') }),
|
|
62
|
-
},
|
|
63
|
-
];
|
|
64
|
-
},
|
|
65
|
-
renderHTML({ HTMLAttributes }) {
|
|
66
|
-
return [
|
|
67
|
-
'div',
|
|
68
|
-
{ class: 'video-wrapper' },
|
|
69
|
-
['video', core.mergeAttributes(HTMLAttributes)],
|
|
70
|
-
];
|
|
71
|
-
},
|
|
72
|
-
addCommands() {
|
|
73
|
-
return {
|
|
74
|
-
setVideo:
|
|
75
|
-
(
|
|
76
|
-
id,
|
|
77
|
-
src,
|
|
78
|
-
isCaptation,
|
|
79
|
-
width = 350,
|
|
80
|
-
height = 197,
|
|
81
|
-
controls = !0,
|
|
82
|
-
controlslist = 'nodownload',
|
|
83
|
-
options,
|
|
84
|
-
) =>
|
|
85
|
-
({ commands, state }) =>
|
|
86
|
-
commands.insertContentAt(
|
|
87
|
-
state.selection,
|
|
88
|
-
`<video
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),VIDEO_INPUT_REGEX=/!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\)/,Video=core.Node.create({name:"video",group:"block",draggable:!0,selectable:!0,addAttributes(){return{src:{default:null,parseHTML:el=>el.getAttribute("src"),renderHTML:attrs=>({src:attrs.src})},controls:{default:!0,parseHTML:el=>el.getAttribute("controls")?el.getAttribute("controls"):!!el.hasAttribute("controls"),renderHTML:attrs=>({controls:attrs.controls})},documentId:{default:"",renderHTML:attributes=>({"data-document-id":attributes.documentId}),parseHTML:element=>element.getAttribute("data-document-id")},isCaptation:{default:!1,renderHTML:attributes=>({"data-document-is-captation":attributes.isCaptation}),parseHTML:element=>element.getAttribute("data-document-is-captation")},videoResolution:{default:"404x720",renderHTML:attributes=>({"data-video-resolution":attributes.videoResolution}),parseHTML:element=>element.getAttribute("data-video-resolution")},width:{renderHTML:attributes=>({width:parseInt(attributes.width)}),parseHTML:element=>element.getAttribute("width")},height:{renderHTML:attributes=>({height:parseInt(attributes.height)}),parseHTML:element=>element.getAttribute("height")}}},parseHTML(){return[{tag:"div.video-wrapper>video,video",getAttrs:el=>({src:el.getAttribute("src")})}]},renderHTML({HTMLAttributes}){return["div",{class:"video-wrapper"},["video",core.mergeAttributes(HTMLAttributes)]]},addCommands(){return{setVideo:(id,src,isCaptation,width=350,height=197,controls=!0,controlslist="nodownload",options)=>({commands,state})=>commands.insertContentAt(state.selection,`<video
|
|
89
2
|
controls="${controls}"
|
|
90
3
|
controlslist="${controlslist}"
|
|
91
4
|
src="${src}"
|
|
@@ -93,27 +6,5 @@ const core = require('@tiptap/core'),
|
|
|
93
6
|
height="${height}"
|
|
94
7
|
data-document-id="${id}"
|
|
95
8
|
data-document-is-captation="${isCaptation}"
|
|
96
|
-
data-video-resolution="${width}x${height}" />`,
|
|
97
|
-
options,
|
|
98
|
-
),
|
|
99
|
-
toggleVideo:
|
|
100
|
-
() =>
|
|
101
|
-
({ commands }) =>
|
|
102
|
-
commands.toggleNode(this.name, 'paragraph'),
|
|
103
|
-
};
|
|
104
|
-
},
|
|
105
|
-
addInputRules() {
|
|
106
|
-
return [
|
|
107
|
-
core.nodeInputRule({
|
|
108
|
-
find: VIDEO_INPUT_REGEX,
|
|
109
|
-
type: this.type,
|
|
110
|
-
getAttributes: (match) => {
|
|
111
|
-
const [, , src] = match;
|
|
112
|
-
return { src };
|
|
113
|
-
},
|
|
114
|
-
}),
|
|
115
|
-
];
|
|
116
|
-
},
|
|
117
|
-
});
|
|
118
|
-
exports.Video = Video;
|
|
9
|
+
data-video-resolution="${width}x${height}" />`,options),toggleVideo:()=>({commands})=>commands.toggleNode(this.name,"paragraph")}},addInputRules(){return[core.nodeInputRule({find:VIDEO_INPUT_REGEX,type:this.type,getAttributes:match=>{const[,,src]=match;return{src}}})]}});exports.Video=Video;
|
|
119
10
|
//# sourceMappingURL=video.cjs.map
|
package/dist/video/video.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video.cjs","sources":["../../src/video/video.ts"],"sourcesContent":["import { mergeAttributes, Node, nodeInputRule } from '@tiptap/core';\n\nexport interface VideoOptions {\n url: string;\n width: number;\n height: number;\n HTMLAttributes: Record<string, any>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n video: {\n /**\n * Set a video node\n * @param options.updateSelection set to true will select the newly inserted content\n */\n setVideo: (\n id: string,\n src: string,\n isCaptation: boolean,\n width?: number,\n height?: number,\n controls?: boolean,\n controlslist?: string,\n options?: { updateSelection: boolean },\n ) => ReturnType;\n /**\n * Toggle a video\n */\n toggleVideo: (src: string) => ReturnType;\n };\n }\n}\n\nconst VIDEO_INPUT_REGEX = /!\\[(.+|:?)]\\((\\S+)(?:(?:\\s+)[\"'](\\S+)[\"'])?\\)/;\n\nexport const Video = Node.create({\n name: 'video',\n group: 'block',\n draggable: true,\n selectable: true,\n\n addAttributes() {\n return {\n src: {\n default: null,\n parseHTML: (el: any) => (el as HTMLSpanElement).getAttribute('src'),\n renderHTML: (attrs: any) => ({ src: attrs.src }),\n },\n controls: {\n default: true,\n parseHTML: (el: any) => {\n if ((el as HTMLSpanElement).getAttribute('controls')) {\n return (el as HTMLSpanElement).getAttribute('controls');\n } else if ((el as HTMLSpanElement).hasAttribute('controls')) {\n return true;\n } else {\n return false;\n }\n },\n renderHTML: (attrs: any) => ({ controls: attrs.controls }),\n },\n documentId: {\n default: '',\n renderHTML: (attributes: any) => {\n return { 'data-document-id': attributes.documentId };\n },\n parseHTML: (element: any) => element.getAttribute('data-document-id'),\n },\n isCaptation: {\n default: false,\n renderHTML: (attributes: any) => {\n return { 'data-document-is-captation': attributes.isCaptation };\n },\n parseHTML: (element: any) =>\n element.getAttribute('data-document-is-captation'),\n },\n videoResolution: {\n default: '404x720',\n renderHTML: (attributes: any) => {\n return { 'data-video-resolution': attributes.videoResolution };\n },\n parseHTML: (element: any) =>\n element.getAttribute('data-video-resolution'),\n },\n width: {\n renderHTML: (attributes: any) => {\n return {\n width: parseInt(attributes.width),\n };\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes: any) => {\n return {\n height: parseInt(attributes.height),\n };\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'div.video-wrapper>video,video',\n getAttrs: (el: any) => ({\n src: (el as HTMLVideoElement).getAttribute('src'),\n }),\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n { class: 'video-wrapper' },\n ['video', mergeAttributes(HTMLAttributes)],\n ];\n },\n\n addCommands() {\n return {\n setVideo:\n (\n id: string,\n src: string,\n isCaptation: boolean,\n width = 350,\n height = 197,\n controls = true,\n controlslist = 'nodownload',\n options,\n ) =>\n ({ commands, state }) => {\n return commands.insertContentAt(\n state.selection,\n `<video \n controls=\"${controls}\" \n controlslist=\"${controlslist}\"\n src=\"${src}\" \n width=\"${width}\"\n height=\"${height}\"\n data-document-id=\"${id}\" \n data-document-is-captation=\"${isCaptation}\"\n data-video-resolution=\"${width}x${height}\" />`,\n options,\n );\n },\n\n toggleVideo:\n () =>\n ({ commands }) =>\n commands.toggleNode(this.name, 'paragraph'),\n };\n },\n\n addInputRules() {\n return [\n nodeInputRule({\n find: VIDEO_INPUT_REGEX,\n type: this.type,\n getAttributes: (match) => {\n const [, , src] = match;\n\n return { src };\n },\n }),\n ];\n },\n});\n"],"names":["Node","mergeAttributes","nodeInputRule"],"mappings":"mHAkCM,kBAAoB,gDAEb,MAAQA,UAAK,OAAO,CAC/B,KAAM,QACN,MAAO,QACP,UAAW,GACX,WAAY,GAEZ,eAAgB,CACP,MAAA,CACL,IAAK,CACH,QAAS,KACT,UAAY,IAAa,GAAuB,aAAa,KAAK,EAClE,WAAa,QAAgB,CAAE,IAAK,MAAM,GAAI,EAChD,EACA,SAAU,CACR,QAAS,GACT,UAAY,IACL,GAAuB,aAAa,UAAU,EACzC,GAAuB,aAAa,UAAU,EAC5C,KAAuB,aAAa,UAAU,EAM5D,WAAa,QAAgB,CAAE,SAAU,MAAM,QAAS,EAC1D,EACA,WAAY,CACV,QAAS,GACT,WAAa,aACJ,CAAE,mBAAoB,WAAW,
|
|
1
|
+
{"version":3,"file":"video.cjs","sources":["../../src/video/video.ts"],"sourcesContent":["import { mergeAttributes, Node, nodeInputRule } from '@tiptap/core';\n\nexport interface VideoOptions {\n url: string;\n width: number;\n height: number;\n HTMLAttributes: Record<string, any>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n video: {\n /**\n * Set a video node\n * @param options.updateSelection set to true will select the newly inserted content\n */\n setVideo: (\n id: string,\n src: string,\n isCaptation: boolean,\n width?: number,\n height?: number,\n controls?: boolean,\n controlslist?: string,\n options?: { updateSelection: boolean },\n ) => ReturnType;\n /**\n * Toggle a video\n */\n toggleVideo: (src: string) => ReturnType;\n };\n }\n}\n\nconst VIDEO_INPUT_REGEX = /!\\[(.+|:?)]\\((\\S+)(?:(?:\\s+)[\"'](\\S+)[\"'])?\\)/;\n\nexport const Video = Node.create({\n name: 'video',\n group: 'block',\n draggable: true,\n selectable: true,\n\n addAttributes() {\n return {\n src: {\n default: null,\n parseHTML: (el: any) => (el as HTMLSpanElement).getAttribute('src'),\n renderHTML: (attrs: any) => ({ src: attrs.src }),\n },\n controls: {\n default: true,\n parseHTML: (el: any) => {\n if ((el as HTMLSpanElement).getAttribute('controls')) {\n return (el as HTMLSpanElement).getAttribute('controls');\n } else if ((el as HTMLSpanElement).hasAttribute('controls')) {\n return true;\n } else {\n return false;\n }\n },\n renderHTML: (attrs: any) => ({ controls: attrs.controls }),\n },\n documentId: {\n default: '',\n renderHTML: (attributes: any) => {\n return { 'data-document-id': attributes.documentId };\n },\n parseHTML: (element: any) => element.getAttribute('data-document-id'),\n },\n isCaptation: {\n default: false,\n renderHTML: (attributes: any) => {\n return { 'data-document-is-captation': attributes.isCaptation };\n },\n parseHTML: (element: any) =>\n element.getAttribute('data-document-is-captation'),\n },\n videoResolution: {\n default: '404x720',\n renderHTML: (attributes: any) => {\n return { 'data-video-resolution': attributes.videoResolution };\n },\n parseHTML: (element: any) =>\n element.getAttribute('data-video-resolution'),\n },\n width: {\n renderHTML: (attributes: any) => {\n return {\n width: parseInt(attributes.width),\n };\n },\n parseHTML: (element) => element.getAttribute('width'),\n },\n height: {\n renderHTML: (attributes: any) => {\n return {\n height: parseInt(attributes.height),\n };\n },\n parseHTML: (element) => element.getAttribute('height'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'div.video-wrapper>video,video',\n getAttrs: (el: any) => ({\n src: (el as HTMLVideoElement).getAttribute('src'),\n }),\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n { class: 'video-wrapper' },\n ['video', mergeAttributes(HTMLAttributes)],\n ];\n },\n\n addCommands() {\n return {\n setVideo:\n (\n id: string,\n src: string,\n isCaptation: boolean,\n width = 350,\n height = 197,\n controls = true,\n controlslist = 'nodownload',\n options,\n ) =>\n ({ commands, state }) => {\n return commands.insertContentAt(\n state.selection,\n `<video \n controls=\"${controls}\" \n controlslist=\"${controlslist}\"\n src=\"${src}\" \n width=\"${width}\"\n height=\"${height}\"\n data-document-id=\"${id}\" \n data-document-is-captation=\"${isCaptation}\"\n data-video-resolution=\"${width}x${height}\" />`,\n options,\n );\n },\n\n toggleVideo:\n () =>\n ({ commands }) =>\n commands.toggleNode(this.name, 'paragraph'),\n };\n },\n\n addInputRules() {\n return [\n nodeInputRule({\n find: VIDEO_INPUT_REGEX,\n type: this.type,\n getAttributes: (match) => {\n const [, , src] = match;\n\n return { src };\n },\n }),\n ];\n },\n});\n"],"names":["Node","mergeAttributes","nodeInputRule"],"mappings":"mHAkCM,kBAAoB,gDAEb,MAAQA,UAAK,OAAO,CAC/B,KAAM,QACN,MAAO,QACP,UAAW,GACX,WAAY,GAEZ,eAAgB,CACP,MAAA,CACL,IAAK,CACH,QAAS,KACT,UAAY,IAAa,GAAuB,aAAa,KAAK,EAClE,WAAa,QAAgB,CAAE,IAAK,MAAM,GAAI,EAChD,EACA,SAAU,CACR,QAAS,GACT,UAAY,IACL,GAAuB,aAAa,UAAU,EACzC,GAAuB,aAAa,UAAU,EAC5C,KAAuB,aAAa,UAAU,EAM5D,WAAa,QAAgB,CAAE,SAAU,MAAM,QAAS,EAC1D,EACA,WAAY,CACV,QAAS,GACT,WAAa,aACJ,CAAE,mBAAoB,WAAW,UAAW,GAErD,UAAY,SAAiB,QAAQ,aAAa,kBAAkB,CACtE,EACA,YAAa,CACX,QAAS,GACT,WAAa,aACJ,CAAE,6BAA8B,WAAW,WAAY,GAEhE,UAAY,SACV,QAAQ,aAAa,4BAA4B,CACrD,EACA,gBAAiB,CACf,QAAS,UACT,WAAa,aACJ,CAAE,wBAAyB,WAAW,eAAgB,GAE/D,UAAY,SACV,QAAQ,aAAa,uBAAuB,CAChD,EACA,MAAO,CACL,WAAa,aACJ,CACL,MAAO,SAAS,WAAW,KAAK,CAClC,GAEF,UAAY,SAAY,QAAQ,aAAa,OAAO,CACtD,EACA,OAAQ,CACN,WAAa,aACJ,CACL,OAAQ,SAAS,WAAW,MAAM,CACpC,GAEF,UAAY,SAAY,QAAQ,aAAa,QAAQ,CAAA,CAEzD,CACF,EAEA,WAAY,CACH,MAAA,CACL,CACE,IAAK,gCACL,SAAW,KAAa,CACtB,IAAM,GAAwB,aAAa,KAAK,CAClD,EAAA,CAEJ,CACF,EAEA,WAAW,CAAE,gBAAkB,CACtB,MAAA,CACL,MACA,CAAE,MAAO,eAAgB,EACzB,CAAC,QAASC,KAAgB,gBAAA,cAAc,CAAC,CAC3C,CACF,EAEA,aAAc,CACL,MAAA,CACL,SACE,CACE,GACA,IACA,YACA,MAAQ,IACR,OAAS,IACT,SAAW,GACX,aAAe,aACf,UAEF,CAAC,CAAE,SAAU,SACJ,SAAS,gBACd,MAAM,UACN;AAAA,0BACc,QAAQ;AAAA,8BACJ,YAAY;AAAA,qBACrB,GAAG;AAAA,uBACD,KAAK;AAAA,wBACJ,MAAM;AAAA,kCACI,EAAE;AAAA,4CACQ,WAAW;AAAA,uCAChB,KAAK,IAAI,MAAM,OAC1C,OACF,EAGJ,YACE,IACA,CAAC,CAAE,YACD,SAAS,WAAW,KAAK,KAAM,WAAW,CAChD,CACF,EAEA,eAAgB,CACP,MAAA,CACLC,mBAAc,CACZ,KAAM,kBACN,KAAM,KAAK,KACX,cAAgB,OAAU,CACxB,KAAM,CAAA,CAAA,CAAK,GAAG,EAAI,MAElB,MAAO,CAAE,GAAI,CAAA,CAEhB,CAAA,CACH,CAAA,CAEJ,CAAC"}
|