@edifice.io/tiptap-extensions 2.0.0-develop-rc.12 → 2.0.0-develop-rc.13
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 +36 -47
|
@@ -1,25 +1,34 @@
|
|
|
1
|
-
import { Node
|
|
2
|
-
class
|
|
3
|
-
static create(
|
|
4
|
-
return
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
class SS_Node extends Node {
|
|
3
|
+
static create(config) {
|
|
4
|
+
return Node.create(config);
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
-
const
|
|
8
|
-
name:
|
|
7
|
+
const SpeechSynthesis = SS_Node.create({
|
|
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
|
-
|
|
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),
|
|
19
30
|
};
|
|
20
|
-
}
|
|
31
|
+
},
|
|
21
32
|
});
|
|
22
|
-
export {
|
|
23
|
-
i as SpeechSynthesis
|
|
24
|
-
};
|
|
33
|
+
export { SpeechSynthesis };
|
|
25
34
|
//# 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":[
|
|
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,EAC3B;AACF;AAEa,MAAA,kBAAkB,QAAQ,OAA+B;AAAA,EACpE,MAAM;AAAA,EACN,aAAa;AACJ,WAAA;AAAA,MACL,MAAM;AAAA,MACN,OAAO;AAAA,IAAA;AAAA,EAEX;AAAA,EACA,cAAc;AACL,WAAA;AAAA,MACL,sBACE,MACA,CAAC,EAAE,gBACI,KAAA,kBAAkB,IAAI,4BACtB,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,UAChB;AAAA,IACT;AAAA,EAEN;AACF,CAAC;"}
|
|
@@ -1,2 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
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;
|
|
2
28
|
//# 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":["
|
|
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,EAAA,EAJ/C,GAOX,UAAY,SAAqD,YAC/D,OAAO,IAAAC,IAAA,QAAQ,QAAR,YAAAA,IAAe,kBAAf,eAAgC,QAAQ,SAAU,GAC3D,CACF,CAAA,CAEJ,CACF,CAAC"}
|
|
@@ -2,4 +2,7 @@
|
|
|
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<
|
|
5
|
+
export declare const TableCell: import('@tiptap/core').Node<
|
|
6
|
+
import('@tiptap/extension-table-cell').TableCellOptions,
|
|
7
|
+
any
|
|
8
|
+
>;
|
|
@@ -1,23 +1,28 @@
|
|
|
1
|
-
import { TableCell as
|
|
2
|
-
const
|
|
1
|
+
import { TableCell as TableCell$1 } from '@tiptap/extension-table-cell';
|
|
2
|
+
const TableCell = TableCell$1.extend({
|
|
3
3
|
addAttributes() {
|
|
4
|
-
var
|
|
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: (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
renderHTML: (attributes) =>
|
|
10
|
+
attributes.backgroundColor
|
|
11
|
+
? {
|
|
12
|
+
style: `background-color: ${attributes.backgroundColor}`,
|
|
13
|
+
}
|
|
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
|
+
},
|
|
17
24
|
};
|
|
18
|
-
}
|
|
25
|
+
},
|
|
19
26
|
});
|
|
20
|
-
export {
|
|
21
|
-
t as TableCell
|
|
22
|
-
};
|
|
27
|
+
export { TableCell };
|
|
23
28
|
//# 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":["
|
|
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,QAAA,IAJ/C;QAOX,WAAW,CAAC,YAAqD;;AAC/D,kBAAO,MAAAC,MAAA,QAAQ,UAAR,gBAAAA,IAAe,oBAAf,mBAAgC,QAAQ,UAAU;AAAA,QAC3D;AAAA,MACF;AAAA,IAAA;AAAA,EAEJ;AACF,CAAC;"}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
const core = require('@tiptap/core'),
|
|
3
|
+
htmlToJson = (html, extensions) => core.generateJSON(html, extensions);
|
|
4
|
+
module.exports = htmlToJson;
|
|
2
5
|
//# sourceMappingURL=html-to-json.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-to-json.cjs","sources":["../../../src/transform/html-to-json/html-to-json.ts"],"sourcesContent":["import { Extensions, HTMLContent, generateJSON } from '@tiptap/core';\n\nexport default (html: HTMLContent, extensions: Extensions) => {\n return generateJSON(html, extensions);\n};\n"],"names":["
|
|
1
|
+
{"version":3,"file":"html-to-json.cjs","sources":["../../../src/transform/html-to-json/html-to-json.ts"],"sourcesContent":["import { Extensions, HTMLContent, generateJSON } from '@tiptap/core';\n\nexport default (html: HTMLContent, extensions: Extensions) => {\n return generateJSON(html, extensions);\n};\n"],"names":["generateJSON"],"mappings":"gDAEA,WAAe,CAAC,KAAmB,aAC1BA,KAAA,aAAa,KAAM,UAAU"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { Extensions, HTMLContent } from '@tiptap/core';
|
|
2
|
-
declare const _default: (
|
|
2
|
+
declare const _default: (
|
|
3
|
+
html: HTMLContent,
|
|
4
|
+
extensions: Extensions,
|
|
5
|
+
) => Record<string, any>;
|
|
3
6
|
export default _default;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { generateJSON
|
|
2
|
-
const
|
|
3
|
-
export {
|
|
4
|
-
n as default
|
|
5
|
-
};
|
|
1
|
+
import { generateJSON } from '@tiptap/core';
|
|
2
|
+
const htmlToJson = (html, extensions) => generateJSON(html, extensions);
|
|
3
|
+
export { htmlToJson as default };
|
|
6
4
|
//# sourceMappingURL=html-to-json.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-to-json.js","sources":["../../../src/transform/html-to-json/html-to-json.ts"],"sourcesContent":["import { Extensions, HTMLContent, generateJSON } from '@tiptap/core';\n\nexport default (html: HTMLContent, extensions: Extensions) => {\n return generateJSON(html, extensions);\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"html-to-json.js","sources":["../../../src/transform/html-to-json/html-to-json.ts"],"sourcesContent":["import { Extensions, HTMLContent, generateJSON } from '@tiptap/core';\n\nexport default (html: HTMLContent, extensions: Extensions) => {\n return generateJSON(html, extensions);\n};\n"],"names":[],"mappings":";AAEA,MAAA,aAAe,CAAC,MAAmB,eAC1B,aAAa,MAAM,UAAU;"}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
const core = require('@tiptap/core'),
|
|
3
|
+
jsonToHtml = (json, extensions) => core.generateHTML(json, extensions);
|
|
4
|
+
module.exports = jsonToHtml;
|
|
2
5
|
//# sourceMappingURL=json-to-html.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-to-html.cjs","sources":["../../../src/transform/json-to-html/json-to-html.ts"],"sourcesContent":["import { Extensions, JSONContent, generateHTML } from '@tiptap/core';\n\nexport default (json: JSONContent, extensions: Extensions) => {\n return generateHTML(json, extensions);\n};\n"],"names":["
|
|
1
|
+
{"version":3,"file":"json-to-html.cjs","sources":["../../../src/transform/json-to-html/json-to-html.ts"],"sourcesContent":["import { Extensions, JSONContent, generateHTML } from '@tiptap/core';\n\nexport default (json: JSONContent, extensions: Extensions) => {\n return generateHTML(json, extensions);\n};\n"],"names":["generateHTML"],"mappings":"gDAEA,WAAe,CAAC,KAAmB,aAC1BA,KAAA,aAAa,KAAM,UAAU"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { generateHTML
|
|
2
|
-
const
|
|
3
|
-
export {
|
|
4
|
-
n as default
|
|
5
|
-
};
|
|
1
|
+
import { generateHTML } from '@tiptap/core';
|
|
2
|
+
const jsonToHtml = (json, extensions) => generateHTML(json, extensions);
|
|
3
|
+
export { jsonToHtml as default };
|
|
6
4
|
//# sourceMappingURL=json-to-html.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-to-html.js","sources":["../../../src/transform/json-to-html/json-to-html.ts"],"sourcesContent":["import { Extensions, JSONContent, generateHTML } from '@tiptap/core';\n\nexport default (json: JSONContent, extensions: Extensions) => {\n return generateHTML(json, extensions);\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"json-to-html.js","sources":["../../../src/transform/json-to-html/json-to-html.ts"],"sourcesContent":["import { Extensions, JSONContent, generateHTML } from '@tiptap/core';\n\nexport default (json: JSONContent, extensions: Extensions) => {\n return generateHTML(json, extensions);\n};\n"],"names":[],"mappings":";AAEA,MAAA,aAAe,CAAC,MAAmB,eAC1B,aAAa,MAAM,UAAU;"}
|
package/dist/video/video.cjs
CHANGED
|
@@ -1,10 +1,119 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
'use strict';
|
|
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
|
|
89
|
+
controls="${controls}"
|
|
90
|
+
controlslist="${controlslist}"
|
|
91
|
+
src="${src}"
|
|
92
|
+
width="${width}"
|
|
93
|
+
height="${height}"
|
|
94
|
+
data-document-id="${id}"
|
|
95
|
+
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;
|
|
10
119
|
//# 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":["
|
|
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,aAE1C,UAAY,SAAiB,QAAQ,aAAa,kBAAkB,CACtE,EACA,YAAa,CACX,QAAS,GACT,WAAa,aACJ,CAAE,6BAA8B,WAAW,cAEpD,UAAY,SACV,QAAQ,aAAa,4BAA4B,CACrD,EACA,gBAAiB,CACf,QAAS,UACT,WAAa,aACJ,CAAE,wBAAyB,WAAW,kBAE/C,UAAY,SACV,QAAQ,aAAa,uBAAuB,CAChD,EACA,MAAO,CACL,WAAa,aACJ,CACL,MAAO,SAAS,WAAW,KAAK,CAAA,GAGpC,UAAY,SAAY,QAAQ,aAAa,OAAO,CACtD,EACA,OAAQ,CACN,WAAa,aACJ,CACL,OAAQ,SAAS,WAAW,MAAM,CAAA,GAGtC,UAAY,SAAY,QAAQ,aAAa,QAAQ,CACvD,CAAA,CAEJ,EAEA,WAAY,CACH,MAAA,CACL,CACE,IAAK,gCACL,SAAW,KAAa,CACtB,IAAM,GAAwB,aAAa,KAAK,CAAA,EAEpD,CAAA,CAEJ,EAEA,WAAW,CAAE,gBAAkB,CACtB,MAAA,CACL,MACA,CAAE,MAAO,eAAgB,EACzB,CAAC,QAASC,qBAAgB,cAAc,CAAC,CAAA,CAE7C,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,OAAA,EAIN,YACE,IACA,CAAC,CAAE,YACD,SAAS,WAAW,KAAK,KAAM,WAAW,CAAA,CAElD,EAEA,eAAgB,CACP,MAAA,CACLC,mBAAc,CACZ,KAAM,kBACN,KAAM,KAAK,KACX,cAAgB,OAAU,CACxB,KAAM,CAAK,CAAA,CAAA,GAAG,EAAI,MAElB,MAAO,CAAE,GAAI,CACf,CAAA,CACD,CAAA,CAEL,CACF,CAAC"}
|
package/dist/video/video.d.ts
CHANGED
|
@@ -1,25 +1,34 @@
|
|
|
1
1
|
import { Node } from '@tiptap/core';
|
|
2
2
|
export interface VideoOptions {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
url: string;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
HTMLAttributes: Record<string, any>;
|
|
7
7
|
}
|
|
8
8
|
declare module '@tiptap/core' {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
interface Commands<ReturnType> {
|
|
10
|
+
video: {
|
|
11
|
+
/**
|
|
12
|
+
* Set a video node
|
|
13
|
+
* @param options.updateSelection set to true will select the newly inserted content
|
|
14
|
+
*/
|
|
15
|
+
setVideo: (
|
|
16
|
+
id: string,
|
|
17
|
+
src: string,
|
|
18
|
+
isCaptation: boolean,
|
|
19
|
+
width?: number,
|
|
20
|
+
height?: number,
|
|
21
|
+
controls?: boolean,
|
|
22
|
+
controlslist?: string,
|
|
23
|
+
options?: {
|
|
24
|
+
updateSelection: boolean;
|
|
25
|
+
},
|
|
26
|
+
) => ReturnType;
|
|
27
|
+
/**
|
|
28
|
+
* Toggle a video
|
|
29
|
+
*/
|
|
30
|
+
toggleVideo: (src: string) => ReturnType;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
24
33
|
}
|
|
25
34
|
export declare const Video: Node<any, any>;
|