@edifice.io/tiptap-extensions 1.5.16-develop-rc.2 → 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 +66 -0
- 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 +27 -16
- package/.turbo/turbo-build.log +0 -58
- package/.turbo/turbo-format.log +0 -142
- package/.turbo/turbo-lint.log +0 -5
- 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
- package/src/abbr/abbr.ts +0 -57
- package/src/abbr/index.ts +0 -5
- package/src/alert/alert.ts +0 -46
- package/src/alert/index.ts +0 -5
- package/src/attachment/attachment.ts +0 -113
- package/src/attachment/index.ts +0 -5
- package/src/audio/audio.ts +0 -81
- package/src/audio/index.ts +0 -5
- package/src/font-size/font-size.ts +0 -74
- package/src/font-size/index.ts +0 -5
- package/src/heading/heading.ts +0 -90
- package/src/heading/index.ts +0 -5
- package/src/highlight/highlight.ts +0 -27
- package/src/highlight/index.ts +0 -5
- package/src/hyperlink/hyperlink.ts +0 -92
- package/src/hyperlink/index.ts +0 -5
- package/src/iframe/iframe.ts +0 -112
- package/src/iframe/index.ts +0 -5
- package/src/image/custom-image.ts +0 -226
- package/src/image/index.ts +0 -5
- package/src/index.ts +0 -19
- package/src/line-height/index.ts +0 -5
- package/src/line-height/line-height.ts +0 -37
- package/src/linker/index.ts +0 -5
- package/src/linker/linker.ts +0 -153
- package/src/mathjax/index.ts +0 -5
- package/src/mathjax/mathjax.ts +0 -55
- package/src/paragraph/index.ts +0 -5
- package/src/paragraph/paragraph.ts +0 -25
- package/src/speech-recognition/index.ts +0 -5
- package/src/speech-recognition/speech-recognition.ts +0 -123
- package/src/speech-synthesis/index.ts +0 -5
- package/src/speech-synthesis/speech-synthesis.ts +0 -52
- package/src/table-cell/index.ts +0 -5
- package/src/table-cell/table-cell.ts +0 -28
- package/src/transform/html-to-json/html-to-json.ts +0 -5
- package/src/transform/index.ts +0 -4
- package/src/transform/json-to-html/json-to-html.ts +0 -5
- package/src/video/index.ts +0 -5
- package/src/video/video.ts +0 -173
- package/tsconfig.json +0 -20
- package/vite.config.ts +0 -46
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Node } from '@tiptap/core';
|
|
2
|
-
|
|
3
|
-
export interface SpeechSynthesisOptions {
|
|
4
|
-
lang: string;
|
|
5
|
-
pitch: number;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
declare module '@tiptap/core' {
|
|
9
|
-
interface Commands<ReturnType> {
|
|
10
|
-
speechSynthesis: {
|
|
11
|
-
startSpeechSynthesis: () => ReturnType;
|
|
12
|
-
stopSpeechSynthesis: () => ReturnType;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
class SS_Node<O = any, S = any> extends Node<O, S> {
|
|
18
|
-
static create<O = any, S = any>(config?: any) {
|
|
19
|
-
return Node.create(config) as SS_Node<O, S>;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const SpeechSynthesis = SS_Node.create<SpeechSynthesisOptions>({
|
|
24
|
-
name: 'speechSynthesis',
|
|
25
|
-
addOptions() {
|
|
26
|
-
return {
|
|
27
|
-
lang: 'fr-FR',
|
|
28
|
-
pitch: 1,
|
|
29
|
-
};
|
|
30
|
-
},
|
|
31
|
-
addCommands() {
|
|
32
|
-
return {
|
|
33
|
-
startSpeechSynthesis:
|
|
34
|
-
() =>
|
|
35
|
-
({ commands }) => {
|
|
36
|
-
this.speechSynthesis = new SpeechSynthesisUtterance();
|
|
37
|
-
this.speechSynthesis.lang = this.options.lang;
|
|
38
|
-
this.speechSynthesis.pitch = this.options.pitch;
|
|
39
|
-
this.speechSynthesis.text = this.editor.getText();
|
|
40
|
-
|
|
41
|
-
window.speechSynthesis.speak(this.speechSynthesis);
|
|
42
|
-
return commands;
|
|
43
|
-
},
|
|
44
|
-
stopSpeechSynthesis:
|
|
45
|
-
() =>
|
|
46
|
-
({ commands }) => {
|
|
47
|
-
window.speechSynthesis.cancel();
|
|
48
|
-
return commands;
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
},
|
|
52
|
-
});
|
package/src/table-cell/index.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { TableCell as TipTapTableCell } from '@tiptap/extension-table-cell';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* This custom extension allows setting a background-color to table cells.
|
|
5
|
-
* Apply with ̀`editor.chain().focus().setCellAttribute("backgroundColor", color).run()`
|
|
6
|
-
*/
|
|
7
|
-
export const TableCell = TipTapTableCell.extend({
|
|
8
|
-
addAttributes() {
|
|
9
|
-
return {
|
|
10
|
-
...this.parent?.(),
|
|
11
|
-
backgroundColor: {
|
|
12
|
-
default: null,
|
|
13
|
-
renderHTML: (attributes: { backgroundColor?: string }) => {
|
|
14
|
-
if (!attributes.backgroundColor) {
|
|
15
|
-
return {};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
style: `background-color: ${attributes.backgroundColor}`,
|
|
20
|
-
};
|
|
21
|
-
},
|
|
22
|
-
parseHTML: (element: { style?: { backgroundColor: string } }) => {
|
|
23
|
-
return element.style?.backgroundColor?.replace(/['"]+/g, '');
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
},
|
|
28
|
-
});
|
package/src/transform/index.ts
DELETED
package/src/video/index.ts
DELETED
package/src/video/video.ts
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { mergeAttributes, Node, nodeInputRule } from '@tiptap/core';
|
|
2
|
-
|
|
3
|
-
export interface VideoOptions {
|
|
4
|
-
url: string;
|
|
5
|
-
width: number;
|
|
6
|
-
height: number;
|
|
7
|
-
HTMLAttributes: Record<string, any>;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
declare module '@tiptap/core' {
|
|
11
|
-
interface Commands<ReturnType> {
|
|
12
|
-
video: {
|
|
13
|
-
/**
|
|
14
|
-
* Set a video node
|
|
15
|
-
* @param options.updateSelection set to true will select the newly inserted content
|
|
16
|
-
*/
|
|
17
|
-
setVideo: (
|
|
18
|
-
id: string,
|
|
19
|
-
src: string,
|
|
20
|
-
isCaptation: boolean,
|
|
21
|
-
width?: number,
|
|
22
|
-
height?: number,
|
|
23
|
-
controls?: boolean,
|
|
24
|
-
controlslist?: string,
|
|
25
|
-
options?: { updateSelection: boolean },
|
|
26
|
-
) => ReturnType;
|
|
27
|
-
/**
|
|
28
|
-
* Toggle a video
|
|
29
|
-
*/
|
|
30
|
-
toggleVideo: (src: string) => ReturnType;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const VIDEO_INPUT_REGEX = /!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\)/;
|
|
36
|
-
|
|
37
|
-
export const Video = Node.create({
|
|
38
|
-
name: 'video',
|
|
39
|
-
group: 'block',
|
|
40
|
-
draggable: true,
|
|
41
|
-
selectable: true,
|
|
42
|
-
|
|
43
|
-
addAttributes() {
|
|
44
|
-
return {
|
|
45
|
-
src: {
|
|
46
|
-
default: null,
|
|
47
|
-
parseHTML: (el: any) => (el as HTMLSpanElement).getAttribute('src'),
|
|
48
|
-
renderHTML: (attrs: any) => ({ src: attrs.src }),
|
|
49
|
-
},
|
|
50
|
-
controls: {
|
|
51
|
-
default: true,
|
|
52
|
-
parseHTML: (el: any) => {
|
|
53
|
-
if ((el as HTMLSpanElement).getAttribute('controls')) {
|
|
54
|
-
return (el as HTMLSpanElement).getAttribute('controls');
|
|
55
|
-
} else if ((el as HTMLSpanElement).hasAttribute('controls')) {
|
|
56
|
-
return true;
|
|
57
|
-
} else {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
renderHTML: (attrs: any) => ({ controls: attrs.controls }),
|
|
62
|
-
},
|
|
63
|
-
documentId: {
|
|
64
|
-
default: '',
|
|
65
|
-
renderHTML: (attributes: any) => {
|
|
66
|
-
return { 'data-document-id': attributes.documentId };
|
|
67
|
-
},
|
|
68
|
-
parseHTML: (element: any) => element.getAttribute('data-document-id'),
|
|
69
|
-
},
|
|
70
|
-
isCaptation: {
|
|
71
|
-
default: false,
|
|
72
|
-
renderHTML: (attributes: any) => {
|
|
73
|
-
return { 'data-document-is-captation': attributes.isCaptation };
|
|
74
|
-
},
|
|
75
|
-
parseHTML: (element: any) =>
|
|
76
|
-
element.getAttribute('data-document-is-captation'),
|
|
77
|
-
},
|
|
78
|
-
videoResolution: {
|
|
79
|
-
default: '404x720',
|
|
80
|
-
renderHTML: (attributes: any) => {
|
|
81
|
-
return { 'data-video-resolution': attributes.videoResolution };
|
|
82
|
-
},
|
|
83
|
-
parseHTML: (element: any) =>
|
|
84
|
-
element.getAttribute('data-video-resolution'),
|
|
85
|
-
},
|
|
86
|
-
width: {
|
|
87
|
-
renderHTML: (attributes: any) => {
|
|
88
|
-
return {
|
|
89
|
-
width: parseInt(attributes.width),
|
|
90
|
-
};
|
|
91
|
-
},
|
|
92
|
-
parseHTML: (element) => element.getAttribute('width'),
|
|
93
|
-
},
|
|
94
|
-
height: {
|
|
95
|
-
renderHTML: (attributes: any) => {
|
|
96
|
-
return {
|
|
97
|
-
height: parseInt(attributes.height),
|
|
98
|
-
};
|
|
99
|
-
},
|
|
100
|
-
parseHTML: (element) => element.getAttribute('height'),
|
|
101
|
-
},
|
|
102
|
-
};
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
parseHTML() {
|
|
106
|
-
return [
|
|
107
|
-
{
|
|
108
|
-
tag: 'div.video-wrapper>video,video',
|
|
109
|
-
getAttrs: (el: any) => ({
|
|
110
|
-
src: (el as HTMLVideoElement).getAttribute('src'),
|
|
111
|
-
}),
|
|
112
|
-
},
|
|
113
|
-
];
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
renderHTML({ HTMLAttributes }) {
|
|
117
|
-
return [
|
|
118
|
-
'div',
|
|
119
|
-
{ class: 'video-wrapper' },
|
|
120
|
-
['video', mergeAttributes(HTMLAttributes)],
|
|
121
|
-
];
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
addCommands() {
|
|
125
|
-
return {
|
|
126
|
-
setVideo:
|
|
127
|
-
(
|
|
128
|
-
id: string,
|
|
129
|
-
src: string,
|
|
130
|
-
isCaptation: boolean,
|
|
131
|
-
width = 350,
|
|
132
|
-
height = 197,
|
|
133
|
-
controls = true,
|
|
134
|
-
controlslist = 'nodownload',
|
|
135
|
-
options,
|
|
136
|
-
) =>
|
|
137
|
-
({ commands, state }) => {
|
|
138
|
-
return commands.insertContentAt(
|
|
139
|
-
state.selection,
|
|
140
|
-
`<video
|
|
141
|
-
controls="${controls}"
|
|
142
|
-
controlslist="${controlslist}"
|
|
143
|
-
src="${src}"
|
|
144
|
-
width="${width}"
|
|
145
|
-
height="${height}"
|
|
146
|
-
data-document-id="${id}"
|
|
147
|
-
data-document-is-captation="${isCaptation}"
|
|
148
|
-
data-video-resolution="${width}x${height}" />`,
|
|
149
|
-
options,
|
|
150
|
-
);
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
toggleVideo:
|
|
154
|
-
() =>
|
|
155
|
-
({ commands }) =>
|
|
156
|
-
commands.toggleNode(this.name, 'paragraph'),
|
|
157
|
-
};
|
|
158
|
-
},
|
|
159
|
-
|
|
160
|
-
addInputRules() {
|
|
161
|
-
return [
|
|
162
|
-
nodeInputRule({
|
|
163
|
-
find: VIDEO_INPUT_REGEX,
|
|
164
|
-
type: this.type,
|
|
165
|
-
getAttributes: (match) => {
|
|
166
|
-
const [, , src] = match;
|
|
167
|
-
|
|
168
|
-
return { src };
|
|
169
|
-
},
|
|
170
|
-
}),
|
|
171
|
-
];
|
|
172
|
-
},
|
|
173
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2016",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"lib": ["ES2016", "DOM"],
|
|
6
|
-
"resolveJsonModule": true,
|
|
7
|
-
"moduleResolution": "node",
|
|
8
|
-
"declaration": true,
|
|
9
|
-
"isolatedModules": true,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"noEmit": true,
|
|
12
|
-
"noUnusedLocals": true,
|
|
13
|
-
"noUnusedParameters": false,
|
|
14
|
-
"noImplicitReturns": false,
|
|
15
|
-
"skipLibCheck": true,
|
|
16
|
-
"sourceMap": true
|
|
17
|
-
},
|
|
18
|
-
"exclude": ["dist", "node_modules"],
|
|
19
|
-
"include": ["src"]
|
|
20
|
-
}
|
package/vite.config.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { resolve } from 'path';
|
|
2
|
-
|
|
3
|
-
import { defineConfig } from 'vite';
|
|
4
|
-
import dts from 'vite-plugin-dts';
|
|
5
|
-
|
|
6
|
-
import { dependencies } from './package.json';
|
|
7
|
-
|
|
8
|
-
export default defineConfig({
|
|
9
|
-
esbuild: {
|
|
10
|
-
minifyIdentifiers: false,
|
|
11
|
-
},
|
|
12
|
-
build: {
|
|
13
|
-
sourcemap: true,
|
|
14
|
-
lib: {
|
|
15
|
-
entry: {
|
|
16
|
-
index: resolve(__dirname, 'src/index.ts'),
|
|
17
|
-
},
|
|
18
|
-
formats: ['es', 'cjs'],
|
|
19
|
-
},
|
|
20
|
-
rollupOptions: {
|
|
21
|
-
output: [
|
|
22
|
-
{
|
|
23
|
-
preserveModules: true,
|
|
24
|
-
preserveModulesRoot: 'src',
|
|
25
|
-
entryFileNames: ({ name: fileName }) => {
|
|
26
|
-
return `${fileName}.js`;
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
preserveModules: true,
|
|
31
|
-
preserveModulesRoot: 'src',
|
|
32
|
-
format: 'cjs',
|
|
33
|
-
entryFileNames: ({ name: fileName }) => {
|
|
34
|
-
return `${fileName}.cjs`;
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
external: [...Object.keys(dependencies)],
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
plugins: [
|
|
42
|
-
dts({
|
|
43
|
-
tsconfigPath: './tsconfig.json',
|
|
44
|
-
}),
|
|
45
|
-
],
|
|
46
|
-
});
|