@blocknote/core 0.14.0 → 0.14.2
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/dist/blocknote.js +2169 -1744
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +5 -5
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +2 -2
- package/src/api/exporters/markdown/__snapshots__/lists/basic/markdown.md +2 -2
- package/src/api/exporters/markdown/__snapshots__/lists/nested/markdown.md +2 -2
- package/src/api/exporters/markdown/markdownExporter.ts +1 -1
- package/src/api/parsers/acceptedMIMETypes.ts +6 -0
- package/src/api/parsers/fileDropExtension.ts +51 -0
- package/src/api/parsers/handleFileInsertion.ts +99 -0
- package/src/api/parsers/pasteExtension.ts +16 -16
- package/src/editor/Block.css +4 -3
- package/src/editor/BlockNoteEditor.ts +6 -7
- package/src/editor/BlockNoteExtensions.ts +5 -1
- package/src/extensions/FilePanel/FilePanelPlugin.ts +4 -4
- package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +2 -2
- package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +12 -4
- package/src/extensions/Placeholder/PlaceholderPlugin.ts +11 -2
- package/src/extensions/SideMenu/SideMenuPlugin.ts +59 -17
- package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +7 -5
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +1 -1
- package/src/extensions/TableHandles/TableHandlesPlugin.ts +46 -24
- package/src/i18n/locales/ar.ts +288 -0
- package/src/i18n/locales/index.ts +1 -0
- package/types/src/api/parsers/acceptedMIMETypes.d.ts +1 -0
- package/types/src/api/parsers/fileDropExtension.d.ts +6 -0
- package/types/src/api/parsers/handleFileInsertion.d.ts +3 -0
- package/types/src/editor/BlockNoteEditor.d.ts +1 -1
- package/types/src/editor/BlockNoteExtensions.d.ts +2 -2
- package/types/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.d.ts +1 -1
- package/types/src/i18n/locales/ar.d.ts +2 -0
- package/types/src/i18n/locales/index.d.ts +1 -0
|
@@ -128,7 +128,7 @@ function setDragImage(view: EditorView, from: number, to = from) {
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
// dataTransfer.setDragImage(element) only works if element is attached to the DOM.
|
|
131
|
-
unsetDragImage();
|
|
131
|
+
unsetDragImage(view.root);
|
|
132
132
|
dragImageElement = parentClone;
|
|
133
133
|
|
|
134
134
|
// TODO: This is hacky, need a better way of assigning classes to the editor so that they can also be applied to the
|
|
@@ -146,12 +146,21 @@ function setDragImage(view: EditorView, from: number, to = from) {
|
|
|
146
146
|
dragImageElement.className =
|
|
147
147
|
dragImageElement.className + " bn-drag-preview " + inheritedClasses;
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
if (view.root instanceof ShadowRoot) {
|
|
150
|
+
view.root.appendChild(dragImageElement);
|
|
151
|
+
} else {
|
|
152
|
+
view.root.body.appendChild(dragImageElement);
|
|
153
|
+
}
|
|
150
154
|
}
|
|
151
155
|
|
|
152
|
-
function unsetDragImage() {
|
|
156
|
+
function unsetDragImage(rootEl: Document | ShadowRoot) {
|
|
153
157
|
if (dragImageElement !== undefined) {
|
|
154
|
-
|
|
158
|
+
if (rootEl instanceof ShadowRoot) {
|
|
159
|
+
rootEl.removeChild(dragImageElement);
|
|
160
|
+
} else {
|
|
161
|
+
rootEl.body.appendChild(dragImageElement);
|
|
162
|
+
}
|
|
163
|
+
|
|
155
164
|
dragImageElement = undefined;
|
|
156
165
|
}
|
|
157
166
|
}
|
|
@@ -177,7 +186,7 @@ function dragStart<
|
|
|
177
186
|
top: e.clientY,
|
|
178
187
|
};
|
|
179
188
|
|
|
180
|
-
const elements =
|
|
189
|
+
const elements = view.root.elementsFromPoint(coords.left, coords.top);
|
|
181
190
|
let blockEl = undefined;
|
|
182
191
|
|
|
183
192
|
for (const element of elements) {
|
|
@@ -283,22 +292,37 @@ export class SideMenuView<
|
|
|
283
292
|
this.pmView.dom.firstChild! as HTMLElement
|
|
284
293
|
).getBoundingClientRect().x;
|
|
285
294
|
|
|
286
|
-
|
|
287
|
-
|
|
295
|
+
this.pmView.root.addEventListener(
|
|
296
|
+
"drop",
|
|
297
|
+
this.onDrop as EventListener,
|
|
298
|
+
true
|
|
299
|
+
);
|
|
300
|
+
this.pmView.root.addEventListener(
|
|
301
|
+
"dragover",
|
|
302
|
+
this.onDragOver as EventListener
|
|
303
|
+
);
|
|
288
304
|
this.pmView.dom.addEventListener("dragstart", this.onDragStart);
|
|
289
305
|
|
|
290
306
|
// Shows or updates menu position whenever the cursor moves, if the menu isn't frozen.
|
|
291
|
-
|
|
307
|
+
this.pmView.root.addEventListener(
|
|
308
|
+
"mousemove",
|
|
309
|
+
this.onMouseMove as EventListener,
|
|
310
|
+
true
|
|
311
|
+
);
|
|
292
312
|
|
|
293
313
|
// Unfreezes the menu whenever the user clicks.
|
|
294
314
|
this.pmView.dom.addEventListener("mousedown", this.onMouseDown);
|
|
295
315
|
// Hides and unfreezes the menu whenever the user presses a key.
|
|
296
|
-
|
|
316
|
+
this.pmView.root.addEventListener(
|
|
317
|
+
"keydown",
|
|
318
|
+
this.onKeyDown as EventListener,
|
|
319
|
+
true
|
|
320
|
+
);
|
|
297
321
|
|
|
298
322
|
// Setting capture=true ensures that any parent container of the editor that
|
|
299
323
|
// gets scrolled will trigger the scroll event. Scroll events do not bubble
|
|
300
324
|
// and so won't propagate to the document by default.
|
|
301
|
-
|
|
325
|
+
this.pmView.root.addEventListener("scroll", this.onScroll, true);
|
|
302
326
|
}
|
|
303
327
|
|
|
304
328
|
updateState = () => {
|
|
@@ -322,7 +346,10 @@ export class SideMenuView<
|
|
|
322
346
|
top: this.mousePos.y,
|
|
323
347
|
};
|
|
324
348
|
|
|
325
|
-
const elements =
|
|
349
|
+
const elements = this.pmView.root.elementsFromPoint(
|
|
350
|
+
coords.left,
|
|
351
|
+
coords.top
|
|
352
|
+
);
|
|
326
353
|
let block = undefined;
|
|
327
354
|
|
|
328
355
|
for (const element of elements) {
|
|
@@ -553,13 +580,28 @@ export class SideMenuView<
|
|
|
553
580
|
this.state.show = false;
|
|
554
581
|
this.emitUpdate(this.state);
|
|
555
582
|
}
|
|
556
|
-
|
|
557
|
-
|
|
583
|
+
this.pmView.root.removeEventListener(
|
|
584
|
+
"mousemove",
|
|
585
|
+
this.onMouseMove as EventListener,
|
|
586
|
+
true
|
|
587
|
+
);
|
|
588
|
+
this.pmView.root.removeEventListener(
|
|
589
|
+
"dragover",
|
|
590
|
+
this.onDragOver as EventListener
|
|
591
|
+
);
|
|
558
592
|
this.pmView.dom.removeEventListener("dragstart", this.onDragStart);
|
|
559
|
-
|
|
560
|
-
|
|
593
|
+
this.pmView.root.removeEventListener(
|
|
594
|
+
"drop",
|
|
595
|
+
this.onDrop as EventListener,
|
|
596
|
+
true
|
|
597
|
+
);
|
|
598
|
+
this.pmView.root.removeEventListener("scroll", this.onScroll, true);
|
|
561
599
|
this.pmView.dom.removeEventListener("mousedown", this.onMouseDown);
|
|
562
|
-
|
|
600
|
+
this.pmView.root.removeEventListener(
|
|
601
|
+
"keydown",
|
|
602
|
+
this.onKeyDown as EventListener,
|
|
603
|
+
true
|
|
604
|
+
);
|
|
563
605
|
}
|
|
564
606
|
|
|
565
607
|
addBlock() {
|
|
@@ -665,7 +707,7 @@ export class SideMenuProsemirrorPlugin<
|
|
|
665
707
|
/**
|
|
666
708
|
* Handles drag & drop events for blocks.
|
|
667
709
|
*/
|
|
668
|
-
blockDragEnd = () => unsetDragImage();
|
|
710
|
+
blockDragEnd = () => unsetDragImage(this.editor.prosemirrorView.root);
|
|
669
711
|
/**
|
|
670
712
|
* Freezes the side menu. When frozen, the side menu will stay
|
|
671
713
|
* attached to the same block regardless of which block is hovered by the
|
|
@@ -20,7 +20,7 @@ class SuggestionMenuView<
|
|
|
20
20
|
> {
|
|
21
21
|
public state?: SuggestionMenuState;
|
|
22
22
|
public emitUpdate: (triggerCharacter: string) => void;
|
|
23
|
-
|
|
23
|
+
private rootEl?: Document | ShadowRoot;
|
|
24
24
|
pluginState: SuggestionPluginState;
|
|
25
25
|
|
|
26
26
|
constructor(
|
|
@@ -37,15 +37,17 @@ class SuggestionMenuView<
|
|
|
37
37
|
emitUpdate(menuName, this.state);
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
+
this.rootEl = this.editor._tiptapEditor.view.root;
|
|
41
|
+
|
|
40
42
|
// Setting capture=true ensures that any parent container of the editor that
|
|
41
43
|
// gets scrolled will trigger the scroll event. Scroll events do not bubble
|
|
42
44
|
// and so won't propagate to the document by default.
|
|
43
|
-
|
|
45
|
+
this.rootEl.addEventListener("scroll", this.handleScroll, true);
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
handleScroll = () => {
|
|
47
49
|
if (this.state?.show) {
|
|
48
|
-
const decorationNode =
|
|
50
|
+
const decorationNode = this.rootEl?.querySelector(
|
|
49
51
|
`[data-decoration-id="${this.pluginState!.decorationId}"]`
|
|
50
52
|
);
|
|
51
53
|
this.state.referencePos = decorationNode!.getBoundingClientRect();
|
|
@@ -79,7 +81,7 @@ class SuggestionMenuView<
|
|
|
79
81
|
return;
|
|
80
82
|
}
|
|
81
83
|
|
|
82
|
-
const decorationNode =
|
|
84
|
+
const decorationNode = this.rootEl?.querySelector(
|
|
83
85
|
`[data-decoration-id="${this.pluginState!.decorationId}"]`
|
|
84
86
|
);
|
|
85
87
|
|
|
@@ -95,7 +97,7 @@ class SuggestionMenuView<
|
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
destroy() {
|
|
98
|
-
|
|
100
|
+
this.rootEl?.removeEventListener("scroll", this.handleScroll, true);
|
|
99
101
|
}
|
|
100
102
|
|
|
101
103
|
closeMenu = () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
1
2
|
import { Block, PartialBlock } from "../../blocks/defaultBlocks";
|
|
2
3
|
import { checkDefaultBlockTypeInSchema } from "../../blocks/defaultBlockTypeGuards";
|
|
3
|
-
import { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
4
4
|
import {
|
|
5
5
|
BlockSchema,
|
|
6
6
|
InlineContentSchema,
|
|
@@ -36,7 +36,7 @@ export type TableHandlesState<
|
|
|
36
36
|
| undefined;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
function setHiddenDragImage() {
|
|
39
|
+
function setHiddenDragImage(rootEl: Document | ShadowRoot) {
|
|
40
40
|
if (dragImageElement) {
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
@@ -46,12 +46,20 @@ function setHiddenDragImage() {
|
|
|
46
46
|
dragImageElement.style.opacity = "0";
|
|
47
47
|
dragImageElement.style.height = "1px";
|
|
48
48
|
dragImageElement.style.width = "1px";
|
|
49
|
-
|
|
49
|
+
if (rootEl instanceof Document) {
|
|
50
|
+
rootEl.body.appendChild(dragImageElement);
|
|
51
|
+
} else {
|
|
52
|
+
rootEl.appendChild(dragImageElement);
|
|
53
|
+
}
|
|
50
54
|
}
|
|
51
55
|
|
|
52
|
-
function unsetHiddenDragImage() {
|
|
56
|
+
function unsetHiddenDragImage(rootEl: Document | ShadowRoot) {
|
|
53
57
|
if (dragImageElement) {
|
|
54
|
-
|
|
58
|
+
if (rootEl instanceof Document) {
|
|
59
|
+
rootEl.body.removeChild(dragImageElement);
|
|
60
|
+
} else {
|
|
61
|
+
rootEl.removeChild(dragImageElement);
|
|
62
|
+
}
|
|
55
63
|
dragImageElement = undefined;
|
|
56
64
|
}
|
|
57
65
|
}
|
|
@@ -73,9 +81,13 @@ function domCellAround(target: Element | null): Element | null {
|
|
|
73
81
|
}
|
|
74
82
|
|
|
75
83
|
// Hides elements in the DOMwith the provided class names.
|
|
76
|
-
function hideElementsWithClassNames(
|
|
84
|
+
function hideElementsWithClassNames(
|
|
85
|
+
classNames: string[],
|
|
86
|
+
rootEl: Document | ShadowRoot
|
|
87
|
+
) {
|
|
77
88
|
classNames.forEach((className) => {
|
|
78
|
-
const elementsToHide =
|
|
89
|
+
const elementsToHide = rootEl.querySelectorAll(className);
|
|
90
|
+
|
|
79
91
|
for (let i = 0; i < elementsToHide.length; i++) {
|
|
80
92
|
(elementsToHide[i] as HTMLElement).style.visibility = "hidden";
|
|
81
93
|
}
|
|
@@ -116,13 +128,16 @@ export class TableHandlesView<
|
|
|
116
128
|
|
|
117
129
|
pmView.dom.addEventListener("mousemove", this.mouseMoveHandler);
|
|
118
130
|
|
|
119
|
-
|
|
120
|
-
|
|
131
|
+
pmView.root.addEventListener(
|
|
132
|
+
"dragover",
|
|
133
|
+
this.dragOverHandler as EventListener
|
|
134
|
+
);
|
|
135
|
+
pmView.root.addEventListener("drop", this.dropHandler as EventListener);
|
|
121
136
|
|
|
122
137
|
// Setting capture=true ensures that any parent container of the editor that
|
|
123
138
|
// gets scrolled will trigger the scroll event. Scroll events do not bubble
|
|
124
139
|
// and so won't propagate to the document by default.
|
|
125
|
-
|
|
140
|
+
pmView.root.addEventListener("scroll", this.scrollHandler, true);
|
|
126
141
|
}
|
|
127
142
|
|
|
128
143
|
mouseMoveHandler = (event: MouseEvent) => {
|
|
@@ -220,11 +235,14 @@ export class TableHandlesView<
|
|
|
220
235
|
event.preventDefault();
|
|
221
236
|
event.dataTransfer!.dropEffect = "move";
|
|
222
237
|
|
|
223
|
-
hideElementsWithClassNames(
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
238
|
+
hideElementsWithClassNames(
|
|
239
|
+
[
|
|
240
|
+
"column-resize-handle",
|
|
241
|
+
"prosemirror-dropcursor-block",
|
|
242
|
+
"prosemirror-dropcursor-inline",
|
|
243
|
+
],
|
|
244
|
+
this.pmView.root
|
|
245
|
+
);
|
|
228
246
|
|
|
229
247
|
// The mouse cursor coordinates, bounded to the table's bounding box. The
|
|
230
248
|
// bounding box is shrunk by 1px on each side to ensure that the bounded
|
|
@@ -242,7 +260,7 @@ export class TableHandlesView<
|
|
|
242
260
|
|
|
243
261
|
// Gets the table cell element that the bounded mouse cursor coordinates lie
|
|
244
262
|
// in.
|
|
245
|
-
const tableCellElements =
|
|
263
|
+
const tableCellElements = this.pmView.root
|
|
246
264
|
.elementsFromPoint(boundedMouseCoords.left, boundedMouseCoords.top)
|
|
247
265
|
.filter(
|
|
248
266
|
(element) => element.tagName === "TD" || element.tagName === "TH"
|
|
@@ -343,7 +361,7 @@ export class TableHandlesView<
|
|
|
343
361
|
|
|
344
362
|
scrollHandler = () => {
|
|
345
363
|
if (this.state?.show) {
|
|
346
|
-
const tableElement =
|
|
364
|
+
const tableElement = this.pmView.root.querySelector(
|
|
347
365
|
`[data-node-type="blockContainer"][data-id="${this.tableId}"] table`
|
|
348
366
|
)!;
|
|
349
367
|
const cellElement = tableElement.querySelector(
|
|
@@ -360,11 +378,15 @@ export class TableHandlesView<
|
|
|
360
378
|
|
|
361
379
|
destroy() {
|
|
362
380
|
this.pmView.dom.removeEventListener("mousemove", this.mouseMoveHandler);
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
381
|
+
this.pmView.root.removeEventListener(
|
|
382
|
+
"dragover",
|
|
383
|
+
this.dragOverHandler as EventListener
|
|
384
|
+
);
|
|
385
|
+
this.pmView.root.removeEventListener(
|
|
386
|
+
"drop",
|
|
387
|
+
this.dropHandler as EventListener
|
|
388
|
+
);
|
|
389
|
+
this.pmView.root.removeEventListener("scroll", this.scrollHandler, true);
|
|
368
390
|
}
|
|
369
391
|
}
|
|
370
392
|
|
|
@@ -559,7 +581,7 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
559
581
|
})
|
|
560
582
|
);
|
|
561
583
|
|
|
562
|
-
setHiddenDragImage();
|
|
584
|
+
setHiddenDragImage(this.editor._tiptapEditor.view.root);
|
|
563
585
|
event.dataTransfer!.setDragImage(dragImageElement!, 0, 0);
|
|
564
586
|
event.dataTransfer!.effectAllowed = "move";
|
|
565
587
|
};
|
|
@@ -595,7 +617,7 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
595
617
|
})
|
|
596
618
|
);
|
|
597
619
|
|
|
598
|
-
setHiddenDragImage();
|
|
620
|
+
setHiddenDragImage(this.editor._tiptapEditor.view.root);
|
|
599
621
|
event.dataTransfer!.setDragImage(dragImageElement!, 0, 0);
|
|
600
622
|
event.dataTransfer!.effectAllowed = "copyMove";
|
|
601
623
|
};
|
|
@@ -618,7 +640,7 @@ export class TableHandlesProsemirrorPlugin<
|
|
|
618
640
|
this.editor._tiptapEditor.state.tr.setMeta(tableHandlesPluginKey, null)
|
|
619
641
|
);
|
|
620
642
|
|
|
621
|
-
unsetHiddenDragImage();
|
|
643
|
+
unsetHiddenDragImage(this.editor._tiptapEditor.view.root);
|
|
622
644
|
};
|
|
623
645
|
|
|
624
646
|
/**
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import type { Dictionary } from "../dictionary";
|
|
2
|
+
|
|
3
|
+
export const ar: Dictionary = {
|
|
4
|
+
slash_menu: {
|
|
5
|
+
heading: {
|
|
6
|
+
title: "عنوان 1",
|
|
7
|
+
subtext: "يستخدم لعناوين المستوى الأعلى",
|
|
8
|
+
aliases: ["ع", "عنوان1", "ع1"],
|
|
9
|
+
group: "العناوين",
|
|
10
|
+
},
|
|
11
|
+
heading_2: {
|
|
12
|
+
title: "عنوان 2",
|
|
13
|
+
subtext: "يستخدم للأقسام الرئيسية",
|
|
14
|
+
aliases: ["ع2", "عنوان2", "عنوان فرعي"],
|
|
15
|
+
group: "العناوين",
|
|
16
|
+
},
|
|
17
|
+
heading_3: {
|
|
18
|
+
title: "عنوان 3",
|
|
19
|
+
subtext: "يستخدم للأقسام الفرعية والعناوين المجموعة",
|
|
20
|
+
aliases: ["ع3", "عنوان3", "عنوان فرعي"],
|
|
21
|
+
group: "العناوين",
|
|
22
|
+
},
|
|
23
|
+
numbered_list: {
|
|
24
|
+
title: "قائمة مرقمة",
|
|
25
|
+
subtext: "تستخدم لعرض قائمة مرقمة",
|
|
26
|
+
aliases: ["ق", "عناصر قائمة", "قائمة", "قائمة مرقمة"],
|
|
27
|
+
group: "الكتل الأساسية",
|
|
28
|
+
},
|
|
29
|
+
bullet_list: {
|
|
30
|
+
title: "قائمة نقطية",
|
|
31
|
+
subtext: "تستخدم لعرض قائمة غير مرتبة",
|
|
32
|
+
aliases: ["ق", "عناصر قائمة", "قائمة", "قائمة نقطية"],
|
|
33
|
+
group: "الكتل الأساسية",
|
|
34
|
+
},
|
|
35
|
+
check_list: {
|
|
36
|
+
title: "قائمة تحقق",
|
|
37
|
+
subtext: "تستخدم لعرض قائمة بمربعات التحقق",
|
|
38
|
+
aliases: [
|
|
39
|
+
"قوائم غير مرتبة",
|
|
40
|
+
"عناصر قائمة",
|
|
41
|
+
"قائمة",
|
|
42
|
+
"قائمة تحقق",
|
|
43
|
+
"قائمة التحقق",
|
|
44
|
+
"قائمة مشطوبة",
|
|
45
|
+
"مربع التحقق",
|
|
46
|
+
],
|
|
47
|
+
group: "الكتل الأساسية",
|
|
48
|
+
},
|
|
49
|
+
paragraph: {
|
|
50
|
+
title: "فقرة",
|
|
51
|
+
subtext: "تستخدم لنص الوثيقة الأساسي",
|
|
52
|
+
aliases: ["ف", "فقرة"],
|
|
53
|
+
group: "الكتل الأساسية",
|
|
54
|
+
},
|
|
55
|
+
table: {
|
|
56
|
+
title: "جدول",
|
|
57
|
+
subtext: "يستخدم للجداول",
|
|
58
|
+
aliases: ["جدول"],
|
|
59
|
+
group: "متقدم",
|
|
60
|
+
},
|
|
61
|
+
image: {
|
|
62
|
+
title: "صورة",
|
|
63
|
+
subtext: "إدراج صورة",
|
|
64
|
+
aliases: ["صورة", "رفع صورة", "تحميل", "صورة", "صورة", "وسائط", "رابط"],
|
|
65
|
+
group: "وسائط",
|
|
66
|
+
},
|
|
67
|
+
video: {
|
|
68
|
+
title: "فيديو",
|
|
69
|
+
subtext: "إدراج فيديو",
|
|
70
|
+
aliases: [
|
|
71
|
+
"فيديو",
|
|
72
|
+
"رفع فيديو",
|
|
73
|
+
"تحميل",
|
|
74
|
+
"فيديو",
|
|
75
|
+
"فيلم",
|
|
76
|
+
"وسائط",
|
|
77
|
+
"رابط",
|
|
78
|
+
],
|
|
79
|
+
group: "وسائط",
|
|
80
|
+
},
|
|
81
|
+
audio: {
|
|
82
|
+
title: "صوت",
|
|
83
|
+
subtext: "إدراج صوت",
|
|
84
|
+
aliases: ["صوت", "رفع صوت", "تحميل", "صوت", "صوت", "وسائط", "رابط"],
|
|
85
|
+
group: "وسائط",
|
|
86
|
+
},
|
|
87
|
+
file: {
|
|
88
|
+
title: "ملف",
|
|
89
|
+
subtext: "إدراج ملف",
|
|
90
|
+
aliases: ["ملف", "تحميل", "تضمين", "وسائط", "رابط"],
|
|
91
|
+
group: "وسائط",
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
placeholders: {
|
|
95
|
+
default: "أدخل نصًا أو اكتب '/' للأوامر",
|
|
96
|
+
heading: "عنوان",
|
|
97
|
+
bulletListItem: "قائمة",
|
|
98
|
+
numberedListItem: "قائمة",
|
|
99
|
+
checkListItem: "قائمة",
|
|
100
|
+
},
|
|
101
|
+
file_blocks: {
|
|
102
|
+
image: {
|
|
103
|
+
add_button_text: "إضافة صورة",
|
|
104
|
+
},
|
|
105
|
+
video: {
|
|
106
|
+
add_button_text: "إضافة فيديو",
|
|
107
|
+
},
|
|
108
|
+
audio: {
|
|
109
|
+
add_button_text: "إضافة صوت",
|
|
110
|
+
},
|
|
111
|
+
file: {
|
|
112
|
+
add_button_text: "إضافة ملف",
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
// from react package:
|
|
116
|
+
side_menu: {
|
|
117
|
+
add_block_label: "إضافة محتوي",
|
|
118
|
+
drag_handle_label: "فتح قائمة المحتويات",
|
|
119
|
+
},
|
|
120
|
+
drag_handle: {
|
|
121
|
+
delete_menuitem: "حذف",
|
|
122
|
+
colors_menuitem: "ألوان",
|
|
123
|
+
},
|
|
124
|
+
table_handle: {
|
|
125
|
+
delete_column_menuitem: "حذف عمود",
|
|
126
|
+
delete_row_menuitem: "حذف صف",
|
|
127
|
+
add_left_menuitem: "إضافة عمود إلى اليسار",
|
|
128
|
+
add_right_menuitem: "إضافة عمود إلى اليمين",
|
|
129
|
+
add_above_menuitem: "إضافة صف أعلى",
|
|
130
|
+
add_below_menuitem: "إضافة صف أسفل",
|
|
131
|
+
},
|
|
132
|
+
suggestion_menu: {
|
|
133
|
+
no_items_title: "لم يتم العثور على عناصر",
|
|
134
|
+
loading: "جارٍ التحميل…",
|
|
135
|
+
},
|
|
136
|
+
color_picker: {
|
|
137
|
+
text_title: "نص",
|
|
138
|
+
background_title: "خلفية",
|
|
139
|
+
colors: {
|
|
140
|
+
default: "افتراضي",
|
|
141
|
+
gray: "رمادي",
|
|
142
|
+
brown: "بني",
|
|
143
|
+
red: "أحمر",
|
|
144
|
+
orange: "برتقالي",
|
|
145
|
+
yellow: "أصفر",
|
|
146
|
+
green: "أخضر",
|
|
147
|
+
blue: "أزرق",
|
|
148
|
+
purple: "أرجواني",
|
|
149
|
+
pink: "وردي",
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
formatting_toolbar: {
|
|
154
|
+
bold: {
|
|
155
|
+
tooltip: "عريض",
|
|
156
|
+
secondary_tooltip: "Mod+B",
|
|
157
|
+
},
|
|
158
|
+
italic: {
|
|
159
|
+
tooltip: "مائل",
|
|
160
|
+
secondary_tooltip: "Mod+I",
|
|
161
|
+
},
|
|
162
|
+
underline: {
|
|
163
|
+
tooltip: "تحته خط",
|
|
164
|
+
secondary_tooltip: "Mod+U",
|
|
165
|
+
},
|
|
166
|
+
strike: {
|
|
167
|
+
tooltip: "مشطوب",
|
|
168
|
+
secondary_tooltip: "Mod+Shift+X",
|
|
169
|
+
},
|
|
170
|
+
code: {
|
|
171
|
+
tooltip: "كود",
|
|
172
|
+
secondary_tooltip: "",
|
|
173
|
+
},
|
|
174
|
+
colors: {
|
|
175
|
+
tooltip: "ألوان",
|
|
176
|
+
},
|
|
177
|
+
link: {
|
|
178
|
+
tooltip: "إنشاء رابط",
|
|
179
|
+
secondary_tooltip: "Mod+K",
|
|
180
|
+
},
|
|
181
|
+
file_caption: {
|
|
182
|
+
tooltip: "تحرير التسمية التوضيحية",
|
|
183
|
+
input_placeholder: "تحرير التسمية التوضيحية",
|
|
184
|
+
},
|
|
185
|
+
file_replace: {
|
|
186
|
+
tooltip: {
|
|
187
|
+
image: "استبدال الصورة",
|
|
188
|
+
video: "استبدال الفيديو",
|
|
189
|
+
audio: "استبدال الصوت",
|
|
190
|
+
file: "استبدال الملف",
|
|
191
|
+
} as Record<string, string>,
|
|
192
|
+
},
|
|
193
|
+
file_rename: {
|
|
194
|
+
tooltip: {
|
|
195
|
+
image: "إعادة تسمية الصورة",
|
|
196
|
+
video: "إعادة تسمية الفيديو",
|
|
197
|
+
audio: "إعادة تسمية الصوت",
|
|
198
|
+
file: "إعادة تسمية الملف",
|
|
199
|
+
} as Record<string, string>,
|
|
200
|
+
input_placeholder: {
|
|
201
|
+
image: "إعادة تسمية الصورة",
|
|
202
|
+
video: "إعادة تسمية الفيديو",
|
|
203
|
+
audio: "إعادة تسمية الصوت",
|
|
204
|
+
file: "إعادة تسمية الملف",
|
|
205
|
+
} as Record<string, string>,
|
|
206
|
+
},
|
|
207
|
+
file_download: {
|
|
208
|
+
tooltip: {
|
|
209
|
+
image: "تنزيل الصورة",
|
|
210
|
+
video: "تنزيل الفيديو",
|
|
211
|
+
audio: "تنزيل الصوت",
|
|
212
|
+
file: "تنزيل الملف",
|
|
213
|
+
} as Record<string, string>,
|
|
214
|
+
},
|
|
215
|
+
file_delete: {
|
|
216
|
+
tooltip: {
|
|
217
|
+
image: "حذف الصورة",
|
|
218
|
+
video: "حذف الفيديو",
|
|
219
|
+
audio: "حذف الصوت",
|
|
220
|
+
file: "حذف الملف",
|
|
221
|
+
} as Record<string, string>,
|
|
222
|
+
},
|
|
223
|
+
file_preview_toggle: {
|
|
224
|
+
tooltip: "تبديل المعاينة",
|
|
225
|
+
},
|
|
226
|
+
nest: {
|
|
227
|
+
tooltip: "محتويات متداخلة",
|
|
228
|
+
secondary_tooltip: "Tab",
|
|
229
|
+
},
|
|
230
|
+
unnest: {
|
|
231
|
+
tooltip: "إلغاء التداخل",
|
|
232
|
+
secondary_tooltip: "Shift+Tab",
|
|
233
|
+
},
|
|
234
|
+
align_left: {
|
|
235
|
+
tooltip: "محاذاة النص إلى اليسار",
|
|
236
|
+
},
|
|
237
|
+
align_center: {
|
|
238
|
+
tooltip: "محاذاة النص في المنتصف",
|
|
239
|
+
},
|
|
240
|
+
align_right: {
|
|
241
|
+
tooltip: "محاذاة النص إلى اليمين",
|
|
242
|
+
},
|
|
243
|
+
align_justify: {
|
|
244
|
+
tooltip: "ضبط النص",
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
file_panel: {
|
|
248
|
+
upload: {
|
|
249
|
+
title: "تحميل",
|
|
250
|
+
file_placeholder: {
|
|
251
|
+
image: "تحميل صورة",
|
|
252
|
+
video: "تحميل فيديو",
|
|
253
|
+
audio: "تحميل صوت",
|
|
254
|
+
file: "تحميل ملف",
|
|
255
|
+
} as Record<string, string>,
|
|
256
|
+
upload_error: "خطأ: فشل التحميل",
|
|
257
|
+
},
|
|
258
|
+
embed: {
|
|
259
|
+
title: "تضمين",
|
|
260
|
+
embed_button: {
|
|
261
|
+
image: "تضمين صورة",
|
|
262
|
+
video: "تضمين فيديو",
|
|
263
|
+
audio: "تضمين صوت",
|
|
264
|
+
file: "تضمين ملف",
|
|
265
|
+
} as Record<string, string>,
|
|
266
|
+
url_placeholder: "أدخل الرابط",
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
link_toolbar: {
|
|
270
|
+
delete: {
|
|
271
|
+
tooltip: "إزالة الرابط",
|
|
272
|
+
},
|
|
273
|
+
edit: {
|
|
274
|
+
text: "تحرير الرابط",
|
|
275
|
+
tooltip: "تحرير",
|
|
276
|
+
},
|
|
277
|
+
open: {
|
|
278
|
+
tooltip: "فتح في تبويب جديد",
|
|
279
|
+
},
|
|
280
|
+
form: {
|
|
281
|
+
title_placeholder: "تحرير العنوان",
|
|
282
|
+
url_placeholder: "تحرير الرابط",
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
generic: {
|
|
286
|
+
ctrl_shortcut: "Ctrl",
|
|
287
|
+
},
|
|
288
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const acceptedMIMETypes: readonly ["blocknote/html", "Files", "text/html", "text/plain"];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Extension } from "@tiptap/core";
|
|
2
|
+
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
3
|
+
import { InlineContentSchema, StyleSchema } from "../../schema";
|
|
4
|
+
export declare const createDropFileExtension: <BSchema extends Record<string, import("../../schema").BlockConfig>, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>) => Extension<{
|
|
5
|
+
editor: BlockNoteEditor<BSchema, I, S>;
|
|
6
|
+
}, undefined>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
|
|
2
|
+
import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema";
|
|
3
|
+
export declare function handleFileInsertion<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(event: DragEvent | ClipboardEvent, editor: BlockNoteEditor<BSchema, I, S>): Promise<void>;
|
|
@@ -18,7 +18,7 @@ import { Dictionary } from "../i18n/dictionary";
|
|
|
18
18
|
import "./Block.css";
|
|
19
19
|
import "./editor.css";
|
|
20
20
|
export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends InlineContentSchema, SSchema extends StyleSchema> = {
|
|
21
|
-
|
|
21
|
+
disableExtensions: string[];
|
|
22
22
|
/**
|
|
23
23
|
* A dictionary object containing translations for the editor.
|
|
24
24
|
*/
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Extensions } from "@tiptap/core";
|
|
2
1
|
import type { BlockNoteEditor } from "./BlockNoteEditor";
|
|
3
2
|
import * as Y from "yjs";
|
|
4
3
|
import { BlockNoteDOMAttributes, BlockSpecs, InlineContentSchema, InlineContentSpecs, StyleSchema, StyleSpecs } from "../schema";
|
|
@@ -22,4 +21,5 @@ export declare const getBlockNoteExtensions: <BSchema extends Record<string, imp
|
|
|
22
21
|
provider: any;
|
|
23
22
|
renderCursor?: (user: any) => HTMLElement;
|
|
24
23
|
};
|
|
25
|
-
|
|
24
|
+
disableExtensions: string[] | undefined;
|
|
25
|
+
}) => import("@tiptap/core").AnyExtension[];
|