@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.
Files changed (154) hide show
  1. package/README.md +66 -0
  2. package/dist/abbr/abbr.cjs +1 -32
  3. package/dist/abbr/abbr.cjs.map +1 -1
  4. package/dist/abbr/abbr.d.ts +12 -12
  5. package/dist/abbr/abbr.js +13 -17
  6. package/dist/abbr/abbr.js.map +1 -1
  7. package/dist/alert/alert.cjs +1 -32
  8. package/dist/alert/alert.cjs.map +1 -1
  9. package/dist/alert/alert.js +22 -20
  10. package/dist/alert/alert.js.map +1 -1
  11. package/dist/attachment/attachment-transformer.cjs +2 -0
  12. package/dist/attachment/attachment-transformer.cjs.map +1 -0
  13. package/dist/attachment/attachment-transformer.d.ts +12 -0
  14. package/dist/attachment/attachment-transformer.js +76 -0
  15. package/dist/attachment/attachment-transformer.js.map +1 -0
  16. package/dist/attachment/attachment.cjs +1 -73
  17. package/dist/attachment/attachment.cjs.map +1 -1
  18. package/dist/attachment/attachment.d.ts +6 -6
  19. package/dist/attachment/attachment.js +29 -40
  20. package/dist/attachment/attachment.js.map +1 -1
  21. package/dist/attachment/index.d.ts +1 -0
  22. package/dist/audio/audio.cjs +2 -52
  23. package/dist/audio/audio.cjs.map +1 -1
  24. package/dist/audio/audio.d.ts +13 -17
  25. package/dist/audio/audio.js +25 -28
  26. package/dist/audio/audio.js.map +1 -1
  27. package/dist/font-size/font-size.cjs +1 -48
  28. package/dist/font-size/font-size.cjs.map +1 -1
  29. package/dist/font-size/font-size.d.ts +13 -13
  30. package/dist/font-size/font-size.js +17 -29
  31. package/dist/font-size/font-size.js.map +1 -1
  32. package/dist/heading/heading.cjs +1 -61
  33. package/dist/heading/heading.cjs.map +1 -1
  34. package/dist/heading/heading.d.ts +12 -10
  35. package/dist/heading/heading.js +25 -39
  36. package/dist/heading/heading.js.map +1 -1
  37. package/dist/highlight/highlight.cjs +1 -25
  38. package/dist/highlight/highlight.cjs.map +1 -1
  39. package/dist/highlight/highlight.d.ts +1 -4
  40. package/dist/highlight/highlight.js +13 -11
  41. package/dist/highlight/highlight.js.map +1 -1
  42. package/dist/hyperlink/hyperlink.cjs +1 -47
  43. package/dist/hyperlink/hyperlink.cjs.map +1 -1
  44. package/dist/hyperlink/hyperlink.d.ts +24 -27
  45. package/dist/hyperlink/hyperlink.js +19 -21
  46. package/dist/hyperlink/hyperlink.js.map +1 -1
  47. package/dist/iframe/iframe.cjs +1 -69
  48. package/dist/iframe/iframe.cjs.map +1 -1
  49. package/dist/iframe/iframe.d.ts +14 -12
  50. package/dist/iframe/iframe.js +32 -48
  51. package/dist/iframe/iframe.js.map +1 -1
  52. package/dist/image/image.cjs +2 -0
  53. package/dist/image/image.cjs.map +1 -0
  54. package/dist/image/image.d.ts +26 -0
  55. package/dist/image/image.js +178 -0
  56. package/dist/image/image.js.map +1 -0
  57. package/dist/image/index.d.ts +3 -3
  58. package/dist/index.cjs +1 -43
  59. package/dist/index.js +24 -22
  60. package/dist/index.js.map +1 -1
  61. package/dist/line-height/line-height.cjs +1 -33
  62. package/dist/line-height/line-height.cjs.map +1 -1
  63. package/dist/line-height/line-height.js +15 -18
  64. package/dist/line-height/line-height.js.map +1 -1
  65. package/dist/linker/linker.cjs +1 -95
  66. package/dist/linker/linker.cjs.map +1 -1
  67. package/dist/linker/linker.d.ts +17 -17
  68. package/dist/linker/linker.js +49 -57
  69. package/dist/linker/linker.js.map +1 -1
  70. package/dist/mathjax/mathjax.cjs +1 -47
  71. package/dist/mathjax/mathjax.cjs.map +1 -1
  72. package/dist/mathjax/mathjax.js +20 -30
  73. package/dist/mathjax/mathjax.js.map +1 -1
  74. package/dist/paragraph/paragraph.cjs +1 -13
  75. package/dist/paragraph/paragraph.cjs.map +1 -1
  76. package/dist/paragraph/paragraph.d.ts +1 -4
  77. package/dist/paragraph/paragraph.js +8 -6
  78. package/dist/paragraph/paragraph.js.map +1 -1
  79. package/dist/speech-recognition/speech-recognition.cjs +1 -76
  80. package/dist/speech-recognition/speech-recognition.cjs.map +1 -1
  81. package/dist/speech-recognition/speech-recognition.d.ts +12 -12
  82. package/dist/speech-recognition/speech-recognition.js +36 -57
  83. package/dist/speech-recognition/speech-recognition.js.map +1 -1
  84. package/dist/speech-synthesis/speech-synthesis.cjs +1 -32
  85. package/dist/speech-synthesis/speech-synthesis.cjs.map +1 -1
  86. package/dist/speech-synthesis/speech-synthesis.d.ts +9 -9
  87. package/dist/speech-synthesis/speech-synthesis.js +10 -19
  88. package/dist/speech-synthesis/speech-synthesis.js.map +1 -1
  89. package/dist/table-cell/table-cell.cjs +1 -27
  90. package/dist/table-cell/table-cell.cjs.map +1 -1
  91. package/dist/table-cell/table-cell.d.ts +1 -4
  92. package/dist/table-cell/table-cell.js +12 -17
  93. package/dist/table-cell/table-cell.js.map +1 -1
  94. package/dist/transform/html-to-json/html-to-json.cjs +1 -4
  95. package/dist/transform/html-to-json/html-to-json.d.ts +1 -4
  96. package/dist/transform/html-to-json/html-to-json.js +4 -2
  97. package/dist/transform/json-to-html/json-to-html.cjs +1 -4
  98. package/dist/transform/json-to-html/json-to-html.js +4 -2
  99. package/dist/video/video.cjs +2 -111
  100. package/dist/video/video.cjs.map +1 -1
  101. package/dist/video/video.d.ts +19 -28
  102. package/dist/video/video.js +90 -114
  103. package/dist/video/video.js.map +1 -1
  104. package/package.json +27 -16
  105. package/.turbo/turbo-build.log +0 -58
  106. package/.turbo/turbo-format.log +0 -142
  107. package/.turbo/turbo-lint.log +0 -5
  108. package/dist/image/custom-image.cjs +0 -163
  109. package/dist/image/custom-image.cjs.map +0 -1
  110. package/dist/image/custom-image.d.ts +0 -27
  111. package/dist/image/custom-image.js +0 -181
  112. package/dist/image/custom-image.js.map +0 -1
  113. package/src/abbr/abbr.ts +0 -57
  114. package/src/abbr/index.ts +0 -5
  115. package/src/alert/alert.ts +0 -46
  116. package/src/alert/index.ts +0 -5
  117. package/src/attachment/attachment.ts +0 -113
  118. package/src/attachment/index.ts +0 -5
  119. package/src/audio/audio.ts +0 -81
  120. package/src/audio/index.ts +0 -5
  121. package/src/font-size/font-size.ts +0 -74
  122. package/src/font-size/index.ts +0 -5
  123. package/src/heading/heading.ts +0 -90
  124. package/src/heading/index.ts +0 -5
  125. package/src/highlight/highlight.ts +0 -27
  126. package/src/highlight/index.ts +0 -5
  127. package/src/hyperlink/hyperlink.ts +0 -92
  128. package/src/hyperlink/index.ts +0 -5
  129. package/src/iframe/iframe.ts +0 -112
  130. package/src/iframe/index.ts +0 -5
  131. package/src/image/custom-image.ts +0 -226
  132. package/src/image/index.ts +0 -5
  133. package/src/index.ts +0 -19
  134. package/src/line-height/index.ts +0 -5
  135. package/src/line-height/line-height.ts +0 -37
  136. package/src/linker/index.ts +0 -5
  137. package/src/linker/linker.ts +0 -153
  138. package/src/mathjax/index.ts +0 -5
  139. package/src/mathjax/mathjax.ts +0 -55
  140. package/src/paragraph/index.ts +0 -5
  141. package/src/paragraph/paragraph.ts +0 -25
  142. package/src/speech-recognition/index.ts +0 -5
  143. package/src/speech-recognition/speech-recognition.ts +0 -123
  144. package/src/speech-synthesis/index.ts +0 -5
  145. package/src/speech-synthesis/speech-synthesis.ts +0 -52
  146. package/src/table-cell/index.ts +0 -5
  147. package/src/table-cell/table-cell.ts +0 -28
  148. package/src/transform/html-to-json/html-to-json.ts +0 -5
  149. package/src/transform/index.ts +0 -4
  150. package/src/transform/json-to-html/json-to-html.ts +0 -5
  151. package/src/video/index.ts +0 -5
  152. package/src/video/video.ts +0 -173
  153. package/tsconfig.json +0 -20
  154. 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
- });
@@ -1,5 +0,0 @@
1
- import { TableCell } from './table-cell';
2
-
3
- export * from './table-cell';
4
-
5
- export default TableCell;
@@ -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
- });
@@ -1,5 +0,0 @@
1
- import { Extensions, HTMLContent, generateJSON } from '@tiptap/core';
2
-
3
- export default (html: HTMLContent, extensions: Extensions) => {
4
- return generateJSON(html, extensions);
5
- };
@@ -1,4 +0,0 @@
1
- import htmlToJson from './html-to-json/html-to-json';
2
- import jsonToHtml from './json-to-html/json-to-html';
3
-
4
- export { htmlToJson, jsonToHtml };
@@ -1,5 +0,0 @@
1
- import { Extensions, JSONContent, generateHTML } from '@tiptap/core';
2
-
3
- export default (json: JSONContent, extensions: Extensions) => {
4
- return generateHTML(json, extensions);
5
- };
@@ -1,5 +0,0 @@
1
- import { Video } from './video';
2
-
3
- export * from './video';
4
-
5
- export default Video;
@@ -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
- });