@blocknote/core 0.14.2 → 0.14.4
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 +793 -463
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +4 -4
- 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/html/__snapshots_fragment_edge_cases__/selectionLeavesBlockChildren.html +1 -0
- package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionSpansBlocksChildren.html +1 -0
- package/src/api/exporters/html/__snapshots_fragment_edge_cases__/selectionWithinBlockChildren.html +1 -0
- package/src/api/exporters/html/htmlConversion.test.ts +140 -0
- package/src/api/exporters/html/util/simplifyBlocksRehypePlugin.ts +31 -8
- package/src/editor/BlockNoteExtensions.ts +1 -0
- package/src/editor/editor.css +1 -1
- package/src/extensions/SideMenu/SideMenuPlugin.ts +1 -1
- package/src/i18n/locales/index.ts +2 -1
- package/src/i18n/locales/ru.ts +323 -0
- package/types/src/editor/BlockNoteExtensions.d.ts +1 -0
- package/types/src/i18n/locales/index.d.ts +1 -0
- package/types/src/i18n/locales/ru.d.ts +2 -0
package/dist/blocknote.js
CHANGED
|
@@ -5,14 +5,14 @@ import { Slice as D, Fragment as L, DOMSerializer as we, DOMParser as Tt, Node a
|
|
|
5
5
|
import qe from "rehype-parse";
|
|
6
6
|
import Xe from "rehype-stringify";
|
|
7
7
|
import { unified as ve } from "unified";
|
|
8
|
-
import { Extension as M, combineTransactionSteps as Lt, getChangedRanges as It, findChildrenInRange as At, Node as
|
|
8
|
+
import { Extension as M, combineTransactionSteps as Lt, getChangedRanges as It, findChildrenInRange as At, Node as $, Mark as xe, InputRule as ee, callOrReturn as Nt, getExtensionField as Pt, mergeAttributes as Ht, selectionToInsertionEnd as Ut, isTextSelection as Dt, isNodeSelection as Vt, posToDOMRect as ke, getMarkRange as Pe, findParentNode as Rt, findChildren as He, extensions as J, Editor as Ot, createDocument as jt } from "@tiptap/core";
|
|
9
9
|
import { Plugin as y, PluginKey as S, Selection as he, NodeSelection as ne, TextSelection as Y, EditorState as zt } from "prosemirror-state";
|
|
10
10
|
import { v4 as Ft } from "uuid";
|
|
11
11
|
import { fromDom as _e } from "hast-util-from-dom";
|
|
12
12
|
import Gt from "@tiptap/extension-bold";
|
|
13
13
|
import Wt from "@tiptap/extension-code";
|
|
14
|
-
import
|
|
15
|
-
import
|
|
14
|
+
import Kt from "@tiptap/extension-italic";
|
|
15
|
+
import $t from "@tiptap/extension-strike";
|
|
16
16
|
import qt from "@tiptap/extension-underline";
|
|
17
17
|
import { TableCell as Xt } from "@tiptap/extension-table-cell";
|
|
18
18
|
import { TableHeader as Zt } from "@tiptap/extension-table-header";
|
|
@@ -3311,7 +3311,325 @@ const fo = {
|
|
|
3311
3311
|
generic: {
|
|
3312
3312
|
ctrl_shortcut: "Ctrl"
|
|
3313
3313
|
}
|
|
3314
|
-
},
|
|
3314
|
+
}, Co = {
|
|
3315
|
+
slash_menu: {
|
|
3316
|
+
heading: {
|
|
3317
|
+
title: "Заголовок 1 уровня",
|
|
3318
|
+
subtext: "Используется для заголовка верхнего уровня",
|
|
3319
|
+
aliases: ["h", "heading1", "h1", "заголовок1"],
|
|
3320
|
+
group: "Заголовки"
|
|
3321
|
+
},
|
|
3322
|
+
heading_2: {
|
|
3323
|
+
title: "Заголовок 2 уровня",
|
|
3324
|
+
subtext: "Используется для ключевых разделов",
|
|
3325
|
+
aliases: ["h2", "heading2", "subheading", "заголовок2", "подзаголовок"],
|
|
3326
|
+
group: "Заголовки"
|
|
3327
|
+
},
|
|
3328
|
+
heading_3: {
|
|
3329
|
+
title: "Заголовок 3 уровня",
|
|
3330
|
+
subtext: "Используется для подразделов и групп",
|
|
3331
|
+
aliases: ["h3", "heading3", "subheading", "заголовок3", "подзаголовок"],
|
|
3332
|
+
group: "Заголовки"
|
|
3333
|
+
},
|
|
3334
|
+
numbered_list: {
|
|
3335
|
+
title: "Нумерованный список",
|
|
3336
|
+
subtext: "Используется для отображения нумерованного списка",
|
|
3337
|
+
aliases: [
|
|
3338
|
+
"ol",
|
|
3339
|
+
"li",
|
|
3340
|
+
"list",
|
|
3341
|
+
"numberedlist",
|
|
3342
|
+
"numbered list",
|
|
3343
|
+
"список",
|
|
3344
|
+
"нумерованный список"
|
|
3345
|
+
],
|
|
3346
|
+
group: "Базовые блоки"
|
|
3347
|
+
},
|
|
3348
|
+
bullet_list: {
|
|
3349
|
+
title: "Маркированный список",
|
|
3350
|
+
subtext: "Для отображения неупорядоченного списка.",
|
|
3351
|
+
aliases: ["ul", "li", "list", "bulletlist", "bullet list", "список", "маркированный список"],
|
|
3352
|
+
group: "Базовые блоки"
|
|
3353
|
+
},
|
|
3354
|
+
check_list: {
|
|
3355
|
+
title: "Контрольный список",
|
|
3356
|
+
subtext: "Для отображения списка с флажками",
|
|
3357
|
+
aliases: [
|
|
3358
|
+
"ul",
|
|
3359
|
+
"li",
|
|
3360
|
+
"list",
|
|
3361
|
+
"checklist",
|
|
3362
|
+
"check list",
|
|
3363
|
+
"checked list",
|
|
3364
|
+
"checkbox",
|
|
3365
|
+
"список"
|
|
3366
|
+
],
|
|
3367
|
+
group: "Базовые блоки"
|
|
3368
|
+
},
|
|
3369
|
+
paragraph: {
|
|
3370
|
+
title: "Параграф",
|
|
3371
|
+
subtext: "Основной текст",
|
|
3372
|
+
aliases: ["p", "paragraph", "параграф"],
|
|
3373
|
+
group: "Базовые блоки"
|
|
3374
|
+
},
|
|
3375
|
+
table: {
|
|
3376
|
+
title: "Таблица",
|
|
3377
|
+
subtext: "Используется для таблиц",
|
|
3378
|
+
aliases: ["table", "таблица"],
|
|
3379
|
+
group: "Продвинутый"
|
|
3380
|
+
},
|
|
3381
|
+
image: {
|
|
3382
|
+
title: "Картинка",
|
|
3383
|
+
subtext: "Вставить изображение",
|
|
3384
|
+
aliases: [
|
|
3385
|
+
"image",
|
|
3386
|
+
"imageUpload",
|
|
3387
|
+
"upload",
|
|
3388
|
+
"img",
|
|
3389
|
+
"picture",
|
|
3390
|
+
"media",
|
|
3391
|
+
"url",
|
|
3392
|
+
"загрузка",
|
|
3393
|
+
"картинка",
|
|
3394
|
+
"рисунок"
|
|
3395
|
+
],
|
|
3396
|
+
group: "Медиа"
|
|
3397
|
+
},
|
|
3398
|
+
video: {
|
|
3399
|
+
title: "Видео",
|
|
3400
|
+
subtext: "Вставить видео",
|
|
3401
|
+
aliases: [
|
|
3402
|
+
"video",
|
|
3403
|
+
"videoUpload",
|
|
3404
|
+
"upload",
|
|
3405
|
+
"mp4",
|
|
3406
|
+
"film",
|
|
3407
|
+
"media",
|
|
3408
|
+
"url",
|
|
3409
|
+
"загрузка",
|
|
3410
|
+
"видео"
|
|
3411
|
+
],
|
|
3412
|
+
group: "Медиа"
|
|
3413
|
+
},
|
|
3414
|
+
audio: {
|
|
3415
|
+
title: "Аудио",
|
|
3416
|
+
subtext: "Вставить аудио",
|
|
3417
|
+
aliases: [
|
|
3418
|
+
"audio",
|
|
3419
|
+
"audioUpload",
|
|
3420
|
+
"upload",
|
|
3421
|
+
"mp3",
|
|
3422
|
+
"sound",
|
|
3423
|
+
"media",
|
|
3424
|
+
"url",
|
|
3425
|
+
"загрузка",
|
|
3426
|
+
"аудио",
|
|
3427
|
+
"звук",
|
|
3428
|
+
"музыка"
|
|
3429
|
+
],
|
|
3430
|
+
group: "Медиа"
|
|
3431
|
+
},
|
|
3432
|
+
file: {
|
|
3433
|
+
title: "Файл",
|
|
3434
|
+
subtext: "Вставить файл",
|
|
3435
|
+
aliases: ["file", "upload", "embed", "media", "url", "загрузка", "файл"],
|
|
3436
|
+
group: "Медиа"
|
|
3437
|
+
}
|
|
3438
|
+
},
|
|
3439
|
+
placeholders: {
|
|
3440
|
+
default: "Ведите текст или введите «/» для команд",
|
|
3441
|
+
heading: "Заголовок",
|
|
3442
|
+
bulletListItem: "Список",
|
|
3443
|
+
numberedListItem: "Список",
|
|
3444
|
+
checkListItem: "Список"
|
|
3445
|
+
},
|
|
3446
|
+
file_blocks: {
|
|
3447
|
+
image: {
|
|
3448
|
+
add_button_text: "Добавить изображение"
|
|
3449
|
+
},
|
|
3450
|
+
video: {
|
|
3451
|
+
add_button_text: "Добавить видео"
|
|
3452
|
+
},
|
|
3453
|
+
audio: {
|
|
3454
|
+
add_button_text: "Добавить аудио"
|
|
3455
|
+
},
|
|
3456
|
+
file: {
|
|
3457
|
+
add_button_text: "Добавить файл"
|
|
3458
|
+
}
|
|
3459
|
+
},
|
|
3460
|
+
// from react package:
|
|
3461
|
+
side_menu: {
|
|
3462
|
+
add_block_label: "Добавить блок",
|
|
3463
|
+
drag_handle_label: "Открыть меню блока"
|
|
3464
|
+
},
|
|
3465
|
+
drag_handle: {
|
|
3466
|
+
delete_menuitem: "Удалить",
|
|
3467
|
+
colors_menuitem: "Цвета"
|
|
3468
|
+
},
|
|
3469
|
+
table_handle: {
|
|
3470
|
+
delete_column_menuitem: "Удалить столбец",
|
|
3471
|
+
delete_row_menuitem: "Удалить строку",
|
|
3472
|
+
add_left_menuitem: "Добавить столбец слева",
|
|
3473
|
+
add_right_menuitem: "Добавить столбец справа",
|
|
3474
|
+
add_above_menuitem: "Добавить строку выше",
|
|
3475
|
+
add_below_menuitem: "Добавить строку ниже"
|
|
3476
|
+
},
|
|
3477
|
+
suggestion_menu: {
|
|
3478
|
+
no_items_title: "ничего не найдено",
|
|
3479
|
+
loading: "Загрузка…"
|
|
3480
|
+
},
|
|
3481
|
+
color_picker: {
|
|
3482
|
+
text_title: "Текст",
|
|
3483
|
+
background_title: "Задний фон",
|
|
3484
|
+
colors: {
|
|
3485
|
+
default: "По умолчинию",
|
|
3486
|
+
gray: "Серый",
|
|
3487
|
+
brown: "Коричневый",
|
|
3488
|
+
red: "Красный",
|
|
3489
|
+
orange: "Оранжевый",
|
|
3490
|
+
yellow: "Жёлтый",
|
|
3491
|
+
green: "Зелёный",
|
|
3492
|
+
blue: "Голубой",
|
|
3493
|
+
purple: "Фиолетовый",
|
|
3494
|
+
pink: "Розовый"
|
|
3495
|
+
}
|
|
3496
|
+
},
|
|
3497
|
+
formatting_toolbar: {
|
|
3498
|
+
bold: {
|
|
3499
|
+
tooltip: "Жирный",
|
|
3500
|
+
secondary_tooltip: "Mod+B"
|
|
3501
|
+
},
|
|
3502
|
+
italic: {
|
|
3503
|
+
tooltip: "Курсив",
|
|
3504
|
+
secondary_tooltip: "Mod+I"
|
|
3505
|
+
},
|
|
3506
|
+
underline: {
|
|
3507
|
+
tooltip: "Подчёркнутый",
|
|
3508
|
+
secondary_tooltip: "Mod+U"
|
|
3509
|
+
},
|
|
3510
|
+
strike: {
|
|
3511
|
+
tooltip: "Зачёркнутый",
|
|
3512
|
+
secondary_tooltip: "Mod+Shift+X"
|
|
3513
|
+
},
|
|
3514
|
+
code: {
|
|
3515
|
+
tooltip: "Код",
|
|
3516
|
+
secondary_tooltip: ""
|
|
3517
|
+
},
|
|
3518
|
+
colors: {
|
|
3519
|
+
tooltip: "Цвета"
|
|
3520
|
+
},
|
|
3521
|
+
link: {
|
|
3522
|
+
tooltip: "Создать ссылку",
|
|
3523
|
+
secondary_tooltip: "Mod+K"
|
|
3524
|
+
},
|
|
3525
|
+
file_caption: {
|
|
3526
|
+
tooltip: "Изменить подпись",
|
|
3527
|
+
input_placeholder: "Изменить подпись"
|
|
3528
|
+
},
|
|
3529
|
+
file_replace: {
|
|
3530
|
+
tooltip: {
|
|
3531
|
+
image: "Заменить изображение",
|
|
3532
|
+
video: "Заменить видео",
|
|
3533
|
+
audio: "Заменить аудио",
|
|
3534
|
+
file: "Заменить файл"
|
|
3535
|
+
}
|
|
3536
|
+
},
|
|
3537
|
+
file_rename: {
|
|
3538
|
+
tooltip: {
|
|
3539
|
+
image: "Переименовать изображение",
|
|
3540
|
+
video: "Переименовать видео",
|
|
3541
|
+
audio: "Переименовать аудио",
|
|
3542
|
+
file: "Переименовать файл"
|
|
3543
|
+
},
|
|
3544
|
+
input_placeholder: {
|
|
3545
|
+
image: "Переименовать изображение",
|
|
3546
|
+
video: "Переименовать видео",
|
|
3547
|
+
audio: "Переименовать аудио",
|
|
3548
|
+
file: "Переименовать файл"
|
|
3549
|
+
}
|
|
3550
|
+
},
|
|
3551
|
+
file_download: {
|
|
3552
|
+
tooltip: {
|
|
3553
|
+
image: "Скачать картинку",
|
|
3554
|
+
video: "Скачать видео",
|
|
3555
|
+
audio: "Скачать аудио",
|
|
3556
|
+
file: "Скачать файл"
|
|
3557
|
+
}
|
|
3558
|
+
},
|
|
3559
|
+
file_delete: {
|
|
3560
|
+
tooltip: {
|
|
3561
|
+
image: "Удалить картинку",
|
|
3562
|
+
video: "Удалить видео",
|
|
3563
|
+
audio: "Удалить аудио",
|
|
3564
|
+
file: "Скачать файл"
|
|
3565
|
+
}
|
|
3566
|
+
},
|
|
3567
|
+
file_preview_toggle: {
|
|
3568
|
+
tooltip: "Переключить предварительный просмотр"
|
|
3569
|
+
},
|
|
3570
|
+
nest: {
|
|
3571
|
+
tooltip: "Сдвинуть вправо",
|
|
3572
|
+
secondary_tooltip: "Tab"
|
|
3573
|
+
},
|
|
3574
|
+
unnest: {
|
|
3575
|
+
tooltip: "Сдвинуть влево",
|
|
3576
|
+
secondary_tooltip: "Shift+Tab"
|
|
3577
|
+
},
|
|
3578
|
+
align_left: {
|
|
3579
|
+
tooltip: "Текст по левому краю"
|
|
3580
|
+
},
|
|
3581
|
+
align_center: {
|
|
3582
|
+
tooltip: "Текст по середине"
|
|
3583
|
+
},
|
|
3584
|
+
align_right: {
|
|
3585
|
+
tooltip: "Текст по правому краю"
|
|
3586
|
+
},
|
|
3587
|
+
align_justify: {
|
|
3588
|
+
tooltip: "По середине текст"
|
|
3589
|
+
}
|
|
3590
|
+
},
|
|
3591
|
+
file_panel: {
|
|
3592
|
+
upload: {
|
|
3593
|
+
title: "Загрузить",
|
|
3594
|
+
file_placeholder: {
|
|
3595
|
+
image: "Загрузить картинки",
|
|
3596
|
+
video: "Загрузить видео",
|
|
3597
|
+
audio: "Загрузить аудио",
|
|
3598
|
+
file: "Загрузить файл"
|
|
3599
|
+
},
|
|
3600
|
+
upload_error: "Ошибка: не удалось загрузить"
|
|
3601
|
+
},
|
|
3602
|
+
embed: {
|
|
3603
|
+
title: "Вставить",
|
|
3604
|
+
embed_button: {
|
|
3605
|
+
image: "Вставить картинку",
|
|
3606
|
+
video: "Вставить видео",
|
|
3607
|
+
audio: "Вставить аудио",
|
|
3608
|
+
file: "Вставить файл"
|
|
3609
|
+
},
|
|
3610
|
+
url_placeholder: "Введите URL"
|
|
3611
|
+
}
|
|
3612
|
+
},
|
|
3613
|
+
link_toolbar: {
|
|
3614
|
+
delete: {
|
|
3615
|
+
tooltip: "Удалить ссылку"
|
|
3616
|
+
},
|
|
3617
|
+
edit: {
|
|
3618
|
+
text: "Изменить ссылку",
|
|
3619
|
+
tooltip: "Редактировать"
|
|
3620
|
+
},
|
|
3621
|
+
open: {
|
|
3622
|
+
tooltip: "Открыть в новой вкладке"
|
|
3623
|
+
},
|
|
3624
|
+
form: {
|
|
3625
|
+
title_placeholder: "Изменить заголовок",
|
|
3626
|
+
url_placeholder: "Изменить URL"
|
|
3627
|
+
}
|
|
3628
|
+
},
|
|
3629
|
+
generic: {
|
|
3630
|
+
ctrl_shortcut: "Ctrl"
|
|
3631
|
+
}
|
|
3632
|
+
}, Ar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3315
3633
|
__proto__: null,
|
|
3316
3634
|
ar: fo,
|
|
3317
3635
|
en: Je,
|
|
@@ -3322,21 +3640,22 @@ const fo = {
|
|
|
3322
3640
|
nl: yo,
|
|
3323
3641
|
pl: wo,
|
|
3324
3642
|
pt: vo,
|
|
3643
|
+
ru: Co,
|
|
3325
3644
|
vi: xo,
|
|
3326
3645
|
zh: Eo
|
|
3327
3646
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3328
|
-
function
|
|
3647
|
+
function So(e, t = JSON.stringify) {
|
|
3329
3648
|
const o = {};
|
|
3330
3649
|
return e.filter((i) => {
|
|
3331
3650
|
const n = t(i);
|
|
3332
3651
|
return Object.prototype.hasOwnProperty.call(o, n) ? !1 : o[n] = !0;
|
|
3333
3652
|
});
|
|
3334
3653
|
}
|
|
3335
|
-
function
|
|
3654
|
+
function Mo(e) {
|
|
3336
3655
|
const t = e.filter(
|
|
3337
3656
|
(i, n) => e.indexOf(i) !== n
|
|
3338
3657
|
);
|
|
3339
|
-
return
|
|
3658
|
+
return So(t);
|
|
3340
3659
|
}
|
|
3341
3660
|
const oe = M.create({
|
|
3342
3661
|
name: "uniqueID",
|
|
@@ -3409,9 +3728,9 @@ const oe = M.create({
|
|
|
3409
3728
|
new y({
|
|
3410
3729
|
key: new S("uniqueID"),
|
|
3411
3730
|
appendTransaction: (o, i, n) => {
|
|
3412
|
-
const r = o.some((
|
|
3413
|
-
let g,
|
|
3414
|
-
return !(!((
|
|
3731
|
+
const r = o.some((m) => m.docChanged) && !i.doc.eq(n.doc), a = this.options.filterTransaction && o.some((m) => {
|
|
3732
|
+
let g, b;
|
|
3733
|
+
return !(!((b = (g = this.options).filterTransaction) === null || b === void 0) && b.call(g, m));
|
|
3415
3734
|
});
|
|
3416
3735
|
if (!r || a)
|
|
3417
3736
|
return;
|
|
@@ -3419,12 +3738,12 @@ const oe = M.create({
|
|
|
3419
3738
|
i.doc,
|
|
3420
3739
|
o
|
|
3421
3740
|
), { mapping: h } = p;
|
|
3422
|
-
if (It(p).forEach(({ newRange:
|
|
3741
|
+
if (It(p).forEach(({ newRange: m }) => {
|
|
3423
3742
|
const g = At(
|
|
3424
3743
|
n.doc,
|
|
3425
|
-
|
|
3744
|
+
m,
|
|
3426
3745
|
(T) => l.includes(T.type.name)
|
|
3427
|
-
),
|
|
3746
|
+
), b = g.map(({ node: T }) => T.attrs[d]).filter((T) => T !== null), A = Mo(b);
|
|
3428
3747
|
g.forEach(({ node: T, pos: N }) => {
|
|
3429
3748
|
let Z;
|
|
3430
3749
|
const Ie = (Z = s.doc.nodeAt(N)) === null || Z === void 0 ? void 0 : Z.attrs[d];
|
|
@@ -3530,7 +3849,7 @@ function Ye(e) {
|
|
|
3530
3849
|
numChildBlocks: n
|
|
3531
3850
|
};
|
|
3532
3851
|
}
|
|
3533
|
-
function
|
|
3852
|
+
function k(e, t) {
|
|
3534
3853
|
const i = e.nodeSize - 2;
|
|
3535
3854
|
if (t <= 1)
|
|
3536
3855
|
for (t = 1 + 1; e.resolve(t).parent.type.name !== "blockContainer" && t < i; )
|
|
@@ -3550,7 +3869,7 @@ function b(e, t) {
|
|
|
3550
3869
|
break;
|
|
3551
3870
|
s -= 1, a = n.node(s);
|
|
3552
3871
|
}
|
|
3553
|
-
const { id: l, contentNode: d, contentType: u, numChildBlocks: p } = Ye(a), h = n.start(s),
|
|
3872
|
+
const { id: l, contentNode: d, contentType: u, numChildBlocks: p } = Ye(a), h = n.start(s), f = n.end(s);
|
|
3554
3873
|
return {
|
|
3555
3874
|
id: l,
|
|
3556
3875
|
node: a,
|
|
@@ -3558,7 +3877,7 @@ function b(e, t) {
|
|
|
3558
3877
|
contentType: u,
|
|
3559
3878
|
numChildBlocks: p,
|
|
3560
3879
|
startPos: h,
|
|
3561
|
-
endPos:
|
|
3880
|
+
endPos: f,
|
|
3562
3881
|
depth: s
|
|
3563
3882
|
};
|
|
3564
3883
|
}
|
|
@@ -3576,7 +3895,7 @@ class I extends Error {
|
|
|
3576
3895
|
super(`Unreachable case: ${t}`);
|
|
3577
3896
|
}
|
|
3578
3897
|
}
|
|
3579
|
-
function
|
|
3898
|
+
function Nr(e, t = !0) {
|
|
3580
3899
|
const { "data-test": o, ...i } = e;
|
|
3581
3900
|
if (Object.keys(i).length > 0 && t)
|
|
3582
3901
|
throw new Error("Object must be empty " + JSON.stringify(e));
|
|
@@ -3597,7 +3916,7 @@ function De(e, t, o) {
|
|
|
3597
3916
|
return e.text.split(/(\n)/g).filter((n) => n.length > 0).map((n) => n === `
|
|
3598
3917
|
` ? t.nodes.hardBreak.create() : t.text(n, i));
|
|
3599
3918
|
}
|
|
3600
|
-
function
|
|
3919
|
+
function To(e, t, o) {
|
|
3601
3920
|
const i = t.marks.link.create({
|
|
3602
3921
|
href: e.href
|
|
3603
3922
|
});
|
|
@@ -3625,10 +3944,10 @@ function ye(e, t, o) {
|
|
|
3625
3944
|
i.push(...De(n, t, o));
|
|
3626
3945
|
return i;
|
|
3627
3946
|
}
|
|
3628
|
-
function
|
|
3947
|
+
function K(e, t, o) {
|
|
3629
3948
|
const i = [];
|
|
3630
3949
|
for (const n of e)
|
|
3631
|
-
typeof n == "string" ? i.push(...ye(n, t, o)) : Qe(n) ? i.push(...
|
|
3950
|
+
typeof n == "string" ? i.push(...ye(n, t, o)) : Qe(n) ? i.push(...To(n, t, o)) : te(n) ? i.push(...ye([n], t, o)) : i.push(
|
|
3632
3951
|
tt(n, t, o)
|
|
3633
3952
|
);
|
|
3634
3953
|
return i;
|
|
@@ -3644,7 +3963,7 @@ function et(e, t, o) {
|
|
|
3644
3963
|
else if (typeof s == "string")
|
|
3645
3964
|
l = t.nodes.tableParagraph.create({}, t.text(s));
|
|
3646
3965
|
else {
|
|
3647
|
-
const u =
|
|
3966
|
+
const u = K(s, t, o);
|
|
3648
3967
|
l = t.nodes.tableParagraph.create({}, u);
|
|
3649
3968
|
}
|
|
3650
3969
|
const d = t.nodes.tableCell.create({}, l);
|
|
@@ -3662,10 +3981,10 @@ function tt(e, t, o) {
|
|
|
3662
3981
|
if (!e.content)
|
|
3663
3982
|
i = t.nodes[n].create(e.props);
|
|
3664
3983
|
else if (typeof e.content == "string") {
|
|
3665
|
-
const r =
|
|
3984
|
+
const r = K([e.content], t, o);
|
|
3666
3985
|
i = t.nodes[n].create(e.props, r);
|
|
3667
3986
|
} else if (Array.isArray(e.content)) {
|
|
3668
|
-
const r =
|
|
3987
|
+
const r = K(e.content, t, o);
|
|
3669
3988
|
i = t.nodes[n].create(e.props, r);
|
|
3670
3989
|
} else if (e.content.type === "tableContent") {
|
|
3671
3990
|
const r = et(e.content, t, o);
|
|
@@ -3694,7 +4013,7 @@ function P(e, t, o) {
|
|
|
3694
4013
|
r.length > 0 ? [n, a] : n
|
|
3695
4014
|
);
|
|
3696
4015
|
}
|
|
3697
|
-
function
|
|
4016
|
+
function Bo(e, t, o) {
|
|
3698
4017
|
const i = {
|
|
3699
4018
|
type: "tableContent",
|
|
3700
4019
|
rows: []
|
|
@@ -3843,7 +4162,7 @@ function v(e, t, o, i, n) {
|
|
|
3843
4162
|
let s = a.id;
|
|
3844
4163
|
s === null && (s = oe.options.generateID());
|
|
3845
4164
|
const l = {};
|
|
3846
|
-
for (const [
|
|
4165
|
+
for (const [f, m] of Object.entries({
|
|
3847
4166
|
...e.attrs,
|
|
3848
4167
|
...a.contentNode.attrs
|
|
3849
4168
|
})) {
|
|
@@ -3852,14 +4171,14 @@ function v(e, t, o, i, n) {
|
|
|
3852
4171
|
throw Error(
|
|
3853
4172
|
"Block is of an unrecognized type: " + a.contentType.name
|
|
3854
4173
|
);
|
|
3855
|
-
const
|
|
3856
|
-
|
|
4174
|
+
const b = g.propSchema;
|
|
4175
|
+
f in b && (l[f] = m);
|
|
3857
4176
|
}
|
|
3858
4177
|
const d = t[a.contentType.name], u = [];
|
|
3859
|
-
for (let
|
|
4178
|
+
for (let f = 0; f < a.numChildBlocks; f++)
|
|
3860
4179
|
u.push(
|
|
3861
4180
|
v(
|
|
3862
|
-
e.lastChild.child(
|
|
4181
|
+
e.lastChild.child(f),
|
|
3863
4182
|
t,
|
|
3864
4183
|
o,
|
|
3865
4184
|
i,
|
|
@@ -3874,7 +4193,7 @@ function v(e, t, o, i, n) {
|
|
|
3874
4193
|
i
|
|
3875
4194
|
);
|
|
3876
4195
|
else if (d.content === "table")
|
|
3877
|
-
p =
|
|
4196
|
+
p = Bo(
|
|
3878
4197
|
a.contentNode,
|
|
3879
4198
|
o,
|
|
3880
4199
|
i
|
|
@@ -3892,14 +4211,14 @@ function v(e, t, o, i, n) {
|
|
|
3892
4211
|
};
|
|
3893
4212
|
return n == null || n.set(e, h), h;
|
|
3894
4213
|
}
|
|
3895
|
-
function
|
|
4214
|
+
function Lo(e) {
|
|
3896
4215
|
return e.document || window.document;
|
|
3897
4216
|
}
|
|
3898
4217
|
const it = (e, t, o, i, n) => {
|
|
3899
4218
|
if (!o.nodes[e.type.name])
|
|
3900
4219
|
throw new Error("Serializer is missing a node type: " + e.type.name);
|
|
3901
4220
|
const { dom: r, contentDOM: a } = we.renderSpec(
|
|
3902
|
-
|
|
4221
|
+
Lo(t),
|
|
3903
4222
|
o.nodes[e.type.name](e)
|
|
3904
4223
|
);
|
|
3905
4224
|
if (a) {
|
|
@@ -3942,7 +4261,7 @@ const it = (e, t, o, i, n) => {
|
|
|
3942
4261
|
const o = t.serializeFragment(e), i = document.createElement("div");
|
|
3943
4262
|
return i.appendChild(o), i.innerHTML;
|
|
3944
4263
|
};
|
|
3945
|
-
function
|
|
4264
|
+
function Io(e) {
|
|
3946
4265
|
const t = /* @__PURE__ */ new Set([
|
|
3947
4266
|
...e.orderedListItemBlockTypes,
|
|
3948
4267
|
...e.unorderedListItemBlockTypes
|
|
@@ -3954,32 +4273,43 @@ function Lo(e) {
|
|
|
3954
4273
|
}
|
|
3955
4274
|
let n = i.children.length, r;
|
|
3956
4275
|
for (let s = 0; s < n; s++) {
|
|
3957
|
-
const d = i.children[s].children[0], u = d.children
|
|
4276
|
+
const d = i.children[s].children[0], u = d.children.find((m) => {
|
|
4277
|
+
const g = m.properties, b = g == null ? void 0 : g.className;
|
|
4278
|
+
return b == null ? void 0 : b.includes("bn-block-content");
|
|
4279
|
+
}), p = d.children.find((m) => {
|
|
4280
|
+
const g = m.properties, b = g == null ? void 0 : g.className;
|
|
4281
|
+
return b == null ? void 0 : b.includes("bn-block-group");
|
|
4282
|
+
});
|
|
4283
|
+
if (!u) {
|
|
4284
|
+
i.children.splice(s, 1, ...p.children), o(i);
|
|
4285
|
+
return;
|
|
4286
|
+
}
|
|
4287
|
+
const h = t.has(
|
|
3958
4288
|
u.properties.dataContentType
|
|
3959
|
-
),
|
|
4289
|
+
), f = h ? e.orderedListItemBlockTypes.has(
|
|
3960
4290
|
u.properties.dataContentType
|
|
3961
4291
|
) ? "ol" : "ul" : null;
|
|
3962
|
-
if (p
|
|
4292
|
+
if (p && o(p), r && r.tagName !== f) {
|
|
3963
4293
|
i.children.splice(
|
|
3964
4294
|
s - r.children.length,
|
|
3965
4295
|
r.children.length,
|
|
3966
4296
|
r
|
|
3967
4297
|
);
|
|
3968
|
-
const
|
|
3969
|
-
s -=
|
|
4298
|
+
const m = r.children.length - 1;
|
|
4299
|
+
s -= m, n -= m, r = void 0;
|
|
3970
4300
|
}
|
|
3971
4301
|
if (h) {
|
|
3972
4302
|
r || (r = _e(
|
|
3973
|
-
document.createElement(
|
|
4303
|
+
document.createElement(f)
|
|
3974
4304
|
));
|
|
3975
|
-
const
|
|
4305
|
+
const m = _e(
|
|
3976
4306
|
document.createElement("li")
|
|
3977
4307
|
);
|
|
3978
|
-
|
|
3979
|
-
} else if (p
|
|
4308
|
+
m.children.push(...u.children), p && m.children.push(...p.children), r.children.push(m);
|
|
4309
|
+
} else if (p) {
|
|
3980
4310
|
i.children.splice(s + 1, 0, ...p.children), i.children[s] = u.children[0];
|
|
3981
|
-
const
|
|
3982
|
-
s +=
|
|
4311
|
+
const m = p.children.length;
|
|
4312
|
+
s += m, n += m;
|
|
3983
4313
|
} else
|
|
3984
4314
|
i.children[s] = u.children[0];
|
|
3985
4315
|
}
|
|
@@ -3993,7 +4323,7 @@ function Lo(e) {
|
|
|
3993
4323
|
}
|
|
3994
4324
|
const ae = (e, t) => {
|
|
3995
4325
|
const o = we.fromSchema(e);
|
|
3996
|
-
return o.serializeNodeInner = (i, n) => it(i, n, o, t, !0), o.exportProseMirrorFragment = (i) => ve().use(qe, { fragment: !0 }).use(
|
|
4326
|
+
return o.serializeNodeInner = (i, n) => it(i, n, o, t, !0), o.exportProseMirrorFragment = (i) => ve().use(qe, { fragment: !0 }).use(Io, {
|
|
3997
4327
|
orderedListItemBlockTypes: /* @__PURE__ */ new Set(["numberedListItem"]),
|
|
3998
4328
|
unorderedListItemBlockTypes: /* @__PURE__ */ new Set([
|
|
3999
4329
|
"bulletListItem",
|
|
@@ -4013,14 +4343,14 @@ const ae = (e, t) => {
|
|
|
4013
4343
|
), r = e.nodes.blockGroup.create(null, n);
|
|
4014
4344
|
return o.serializeProseMirrorFragment(L.from(r));
|
|
4015
4345
|
}, o;
|
|
4016
|
-
},
|
|
4346
|
+
}, Ao = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
|
|
4017
4347
|
function H(e, t = "Ctrl") {
|
|
4018
|
-
return
|
|
4348
|
+
return Ao() ? e.replace("Mod", "⌘") : e.replace("Mod", t);
|
|
4019
4349
|
}
|
|
4020
4350
|
function R(...e) {
|
|
4021
4351
|
return e.filter((t) => t).join(" ");
|
|
4022
4352
|
}
|
|
4023
|
-
const
|
|
4353
|
+
const Pr = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
4024
4354
|
function O(e, t, o, i) {
|
|
4025
4355
|
const n = document.createElement("div");
|
|
4026
4356
|
n.className = R(
|
|
@@ -4059,7 +4389,7 @@ const Ve = (e, t) => {
|
|
|
4059
4389
|
"Cannot use this block's default HTML serialization as its corresponding TipTap node's `renderHTML` function does not return an object with the `dom` property."
|
|
4060
4390
|
);
|
|
4061
4391
|
return n;
|
|
4062
|
-
},
|
|
4392
|
+
}, _ = {
|
|
4063
4393
|
backgroundColor: {
|
|
4064
4394
|
default: "default"
|
|
4065
4395
|
},
|
|
@@ -4074,7 +4404,7 @@ const Ve = (e, t) => {
|
|
|
4074
4404
|
function re(e) {
|
|
4075
4405
|
return "data-" + e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
4076
4406
|
}
|
|
4077
|
-
function
|
|
4407
|
+
function Hr(e) {
|
|
4078
4408
|
const t = e.split("/");
|
|
4079
4409
|
return !t.length || // invalid?
|
|
4080
4410
|
t[t.length - 1] === "" ? e : t[t.length - 1];
|
|
@@ -4106,7 +4436,7 @@ function st(e) {
|
|
|
4106
4436
|
};
|
|
4107
4437
|
}), t;
|
|
4108
4438
|
}
|
|
4109
|
-
function
|
|
4439
|
+
function No(e, t, o, i) {
|
|
4110
4440
|
if (typeof e == "boolean")
|
|
4111
4441
|
throw new Error(
|
|
4112
4442
|
"Cannot find node position as getPos is a boolean, not a function."
|
|
@@ -4139,7 +4469,7 @@ function me(e, t, o, i, n = !1, r) {
|
|
|
4139
4469
|
};
|
|
4140
4470
|
}
|
|
4141
4471
|
function z(e) {
|
|
4142
|
-
return
|
|
4472
|
+
return $.create(e);
|
|
4143
4473
|
}
|
|
4144
4474
|
function lt(e, t) {
|
|
4145
4475
|
return {
|
|
@@ -4168,7 +4498,7 @@ function dt(e) {
|
|
|
4168
4498
|
Object.entries(e).map(([t, o]) => [t, o.config])
|
|
4169
4499
|
);
|
|
4170
4500
|
}
|
|
4171
|
-
function
|
|
4501
|
+
function Po(e, t) {
|
|
4172
4502
|
const o = [
|
|
4173
4503
|
{
|
|
4174
4504
|
tag: "[data-content-type=" + e.type + "]",
|
|
@@ -4195,7 +4525,7 @@ function se(e, t) {
|
|
|
4195
4525
|
return st(e.propSchema);
|
|
4196
4526
|
},
|
|
4197
4527
|
parseHTML() {
|
|
4198
|
-
return
|
|
4528
|
+
return Po(e, t.parse);
|
|
4199
4529
|
},
|
|
4200
4530
|
renderHTML() {
|
|
4201
4531
|
const i = document.createElement("div");
|
|
@@ -4206,7 +4536,7 @@ function se(e, t) {
|
|
|
4206
4536
|
addNodeView() {
|
|
4207
4537
|
return ({ getPos: i }) => {
|
|
4208
4538
|
var l;
|
|
4209
|
-
const n = this.options.editor, r =
|
|
4539
|
+
const n = this.options.editor, r = No(
|
|
4210
4540
|
i,
|
|
4211
4541
|
n,
|
|
4212
4542
|
this.editor,
|
|
@@ -4258,10 +4588,10 @@ function se(e, t) {
|
|
|
4258
4588
|
}
|
|
4259
4589
|
});
|
|
4260
4590
|
}
|
|
4261
|
-
function
|
|
4591
|
+
function Ho(e, t, o, i) {
|
|
4262
4592
|
return e.dom.setAttribute("data-inline-content-type", t), Object.entries(o).filter(([n, r]) => r !== i[n].default).map(([n, r]) => [re(n), r]).forEach(([n, r]) => e.dom.setAttribute(n, r)), e.contentDOM !== void 0 && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
4263
4593
|
}
|
|
4264
|
-
function
|
|
4594
|
+
function Uo(e) {
|
|
4265
4595
|
return {
|
|
4266
4596
|
Backspace: ({ editor: t }) => {
|
|
4267
4597
|
const o = t.state.selection.$from;
|
|
@@ -4269,14 +4599,14 @@ function Ho(e) {
|
|
|
4269
4599
|
}
|
|
4270
4600
|
};
|
|
4271
4601
|
}
|
|
4272
|
-
function
|
|
4602
|
+
function Do(e, t) {
|
|
4273
4603
|
return {
|
|
4274
4604
|
config: e,
|
|
4275
4605
|
implementation: t
|
|
4276
4606
|
};
|
|
4277
4607
|
}
|
|
4278
|
-
function
|
|
4279
|
-
return
|
|
4608
|
+
function Vo(e, t) {
|
|
4609
|
+
return Do(
|
|
4280
4610
|
{
|
|
4281
4611
|
type: e.name,
|
|
4282
4612
|
propSchema: t,
|
|
@@ -4292,7 +4622,7 @@ function ct(e) {
|
|
|
4292
4622
|
Object.entries(e).map(([t, o]) => [t, o.config])
|
|
4293
4623
|
);
|
|
4294
4624
|
}
|
|
4295
|
-
function
|
|
4625
|
+
function Ro(e) {
|
|
4296
4626
|
return [
|
|
4297
4627
|
{
|
|
4298
4628
|
tag: `[data-inline-content-type="${e.type}"]`,
|
|
@@ -4303,8 +4633,8 @@ function Vo(e) {
|
|
|
4303
4633
|
}
|
|
4304
4634
|
];
|
|
4305
4635
|
}
|
|
4306
|
-
function
|
|
4307
|
-
const o =
|
|
4636
|
+
function Ur(e, t) {
|
|
4637
|
+
const o = $.create({
|
|
4308
4638
|
name: e.type,
|
|
4309
4639
|
inline: !0,
|
|
4310
4640
|
group: "inline",
|
|
@@ -4315,10 +4645,10 @@ function Hr(e, t) {
|
|
|
4315
4645
|
return st(e.propSchema);
|
|
4316
4646
|
},
|
|
4317
4647
|
addKeyboardShortcuts() {
|
|
4318
|
-
return
|
|
4648
|
+
return Uo(e);
|
|
4319
4649
|
},
|
|
4320
4650
|
parseHTML() {
|
|
4321
|
-
return
|
|
4651
|
+
return Ro(e);
|
|
4322
4652
|
},
|
|
4323
4653
|
renderHTML({ node: i }) {
|
|
4324
4654
|
const n = this.options.editor, r = t.render(
|
|
@@ -4329,7 +4659,7 @@ function Hr(e, t) {
|
|
|
4329
4659
|
)
|
|
4330
4660
|
// TODO: fix cast
|
|
4331
4661
|
);
|
|
4332
|
-
return
|
|
4662
|
+
return Ho(
|
|
4333
4663
|
r,
|
|
4334
4664
|
e.type,
|
|
4335
4665
|
i.attrs,
|
|
@@ -4337,12 +4667,12 @@ function Hr(e, t) {
|
|
|
4337
4667
|
);
|
|
4338
4668
|
}
|
|
4339
4669
|
});
|
|
4340
|
-
return
|
|
4670
|
+
return Vo(
|
|
4341
4671
|
o,
|
|
4342
4672
|
e.propSchema
|
|
4343
4673
|
);
|
|
4344
4674
|
}
|
|
4345
|
-
function
|
|
4675
|
+
function Oo(e) {
|
|
4346
4676
|
return e === "boolean" ? {} : {
|
|
4347
4677
|
stringValue: {
|
|
4348
4678
|
default: void 0,
|
|
@@ -4354,7 +4684,7 @@ function Ro(e) {
|
|
|
4354
4684
|
}
|
|
4355
4685
|
};
|
|
4356
4686
|
}
|
|
4357
|
-
function
|
|
4687
|
+
function jo(e, t, o, i) {
|
|
4358
4688
|
return e.dom.setAttribute("data-style-type", t), i === "string" && e.dom.setAttribute("data-value", o), e.contentDOM !== void 0 && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
4359
4689
|
}
|
|
4360
4690
|
function ut(e, t) {
|
|
@@ -4379,7 +4709,7 @@ function pt(e) {
|
|
|
4379
4709
|
Object.entries(e).map(([t, o]) => [t, o.config])
|
|
4380
4710
|
);
|
|
4381
4711
|
}
|
|
4382
|
-
function
|
|
4712
|
+
function zo(e) {
|
|
4383
4713
|
return [
|
|
4384
4714
|
{
|
|
4385
4715
|
tag: `[data-style-type="${e.type}"]`,
|
|
@@ -4390,14 +4720,14 @@ function jo(e) {
|
|
|
4390
4720
|
}
|
|
4391
4721
|
];
|
|
4392
4722
|
}
|
|
4393
|
-
function
|
|
4723
|
+
function Dr(e, t) {
|
|
4394
4724
|
const o = xe.create({
|
|
4395
4725
|
name: e.type,
|
|
4396
4726
|
addAttributes() {
|
|
4397
|
-
return
|
|
4727
|
+
return Oo(e.propSchema);
|
|
4398
4728
|
},
|
|
4399
4729
|
parseHTML() {
|
|
4400
|
-
return
|
|
4730
|
+
return zo(e);
|
|
4401
4731
|
},
|
|
4402
4732
|
renderHTML({ mark: i }) {
|
|
4403
4733
|
let n;
|
|
@@ -4407,7 +4737,7 @@ function Ur(e, t) {
|
|
|
4407
4737
|
n = t.render(i.attrs.stringValue);
|
|
4408
4738
|
else
|
|
4409
4739
|
throw new I(e.propSchema);
|
|
4410
|
-
return
|
|
4740
|
+
return jo(
|
|
4411
4741
|
n,
|
|
4412
4742
|
e.type,
|
|
4413
4743
|
i.attrs.stringValue,
|
|
@@ -4500,10 +4830,10 @@ const le = (e) => {
|
|
|
4500
4830
|
!t.isEditable && r.contains(a) && r.contains(s) && (r.removeChild(a), r.removeChild(s));
|
|
4501
4831
|
return;
|
|
4502
4832
|
}
|
|
4503
|
-
let
|
|
4504
|
-
e.props.textAlignment === "center" ? l.handleUsed === "left" ?
|
|
4833
|
+
let b;
|
|
4834
|
+
e.props.textAlignment === "center" ? l.handleUsed === "left" ? b = l.initialWidth + (l.initialClientX - g.clientX) * 2 : b = l.initialWidth + (g.clientX - l.initialClientX) * 2 : l.handleUsed === "left" ? b = l.initialWidth + l.initialClientX - g.clientX : b = l.initialWidth + g.clientX - l.initialClientX;
|
|
4505
4835
|
const A = 64;
|
|
4506
|
-
|
|
4836
|
+
b < A ? n(A) : b > t.domElement.firstElementChild.clientWidth ? n(t.domElement.firstElementChild.clientWidth) : n(b);
|
|
4507
4837
|
}, u = (g) => {
|
|
4508
4838
|
(!g.target || !r.contains(g.target) || !t.isEditable) && r.contains(a) && r.contains(s) && (r.removeChild(a), r.removeChild(s)), l && (l = void 0, t.updateBlock(e, {
|
|
4509
4839
|
props: {
|
|
@@ -4514,13 +4844,13 @@ const le = (e) => {
|
|
|
4514
4844
|
t.isEditable && (r.appendChild(a), r.appendChild(s));
|
|
4515
4845
|
}, h = (g) => {
|
|
4516
4846
|
g.relatedTarget === a || g.relatedTarget === s || l || t.isEditable && r.contains(a) && r.contains(s) && (r.removeChild(a), r.removeChild(s));
|
|
4517
|
-
},
|
|
4847
|
+
}, f = (g) => {
|
|
4518
4848
|
g.preventDefault(), r.appendChild(a), r.appendChild(s), l = {
|
|
4519
4849
|
handleUsed: "left",
|
|
4520
4850
|
initialWidth: e.props.previewWidth,
|
|
4521
4851
|
initialClientX: g.clientX
|
|
4522
4852
|
};
|
|
4523
|
-
},
|
|
4853
|
+
}, m = (g) => {
|
|
4524
4854
|
g.preventDefault(), r.appendChild(a), r.appendChild(s), l = {
|
|
4525
4855
|
handleUsed: "right",
|
|
4526
4856
|
initialWidth: e.props.previewWidth,
|
|
@@ -4529,24 +4859,24 @@ const le = (e) => {
|
|
|
4529
4859
|
};
|
|
4530
4860
|
return r.appendChild(o), window.addEventListener("mousemove", d), window.addEventListener("mouseup", u), o.addEventListener("mouseenter", p), o.addEventListener("mouseleave", h), a.addEventListener(
|
|
4531
4861
|
"mousedown",
|
|
4532
|
-
|
|
4862
|
+
f
|
|
4533
4863
|
), s.addEventListener(
|
|
4534
4864
|
"mousedown",
|
|
4535
|
-
|
|
4865
|
+
m
|
|
4536
4866
|
), {
|
|
4537
4867
|
dom: r,
|
|
4538
4868
|
destroy: () => {
|
|
4539
4869
|
window.removeEventListener("mousemove", d), window.removeEventListener("mouseup", u), o.removeEventListener("mouseenter", p), o.removeEventListener("mouseleave", h), a.removeEventListener(
|
|
4540
4870
|
"mousedown",
|
|
4541
|
-
|
|
4871
|
+
f
|
|
4542
4872
|
), s.removeEventListener(
|
|
4543
4873
|
"mousedown",
|
|
4544
|
-
|
|
4874
|
+
m
|
|
4545
4875
|
);
|
|
4546
4876
|
}
|
|
4547
4877
|
};
|
|
4548
|
-
},
|
|
4549
|
-
backgroundColor:
|
|
4878
|
+
}, Fo = {
|
|
4879
|
+
backgroundColor: _.backgroundColor,
|
|
4550
4880
|
// File name.
|
|
4551
4881
|
name: {
|
|
4552
4882
|
default: ""
|
|
@@ -4559,12 +4889,12 @@ const le = (e) => {
|
|
|
4559
4889
|
caption: {
|
|
4560
4890
|
default: ""
|
|
4561
4891
|
}
|
|
4562
|
-
},
|
|
4892
|
+
}, Go = {
|
|
4563
4893
|
type: "file",
|
|
4564
|
-
propSchema:
|
|
4894
|
+
propSchema: Fo,
|
|
4565
4895
|
content: "none",
|
|
4566
4896
|
isFileBlock: !0
|
|
4567
|
-
},
|
|
4897
|
+
}, Wo = (e, t) => {
|
|
4568
4898
|
const o = document.createElement("div");
|
|
4569
4899
|
if (o.className = "bn-file-block-content-wrapper", e.props.url === "") {
|
|
4570
4900
|
const i = de(e, t);
|
|
@@ -4578,7 +4908,7 @@ const le = (e) => {
|
|
|
4578
4908
|
dom: o
|
|
4579
4909
|
};
|
|
4580
4910
|
}
|
|
4581
|
-
},
|
|
4911
|
+
}, Ko = (e) => {
|
|
4582
4912
|
if (e.tagName === "EMBED")
|
|
4583
4913
|
return Re(e);
|
|
4584
4914
|
if (e.tagName === "FIGURE") {
|
|
@@ -4602,16 +4932,16 @@ const le = (e) => {
|
|
|
4602
4932
|
return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ? ue(t, e.props.caption) : {
|
|
4603
4933
|
dom: t
|
|
4604
4934
|
};
|
|
4605
|
-
},
|
|
4606
|
-
render:
|
|
4607
|
-
parse:
|
|
4935
|
+
}, qo = se(Go, {
|
|
4936
|
+
render: Wo,
|
|
4937
|
+
parse: Ko,
|
|
4608
4938
|
toExternalHTML: $o
|
|
4609
4939
|
}), Oe = (e) => {
|
|
4610
4940
|
const t = e.src || void 0, o = e.width || void 0;
|
|
4611
4941
|
return { url: t, previewWidth: o };
|
|
4612
|
-
},
|
|
4613
|
-
textAlignment:
|
|
4614
|
-
backgroundColor:
|
|
4942
|
+
}, Xo = {
|
|
4943
|
+
textAlignment: _.textAlignment,
|
|
4944
|
+
backgroundColor: _.backgroundColor,
|
|
4615
4945
|
// File name.
|
|
4616
4946
|
name: {
|
|
4617
4947
|
default: ""
|
|
@@ -4631,13 +4961,13 @@ const le = (e) => {
|
|
|
4631
4961
|
previewWidth: {
|
|
4632
4962
|
default: 512
|
|
4633
4963
|
}
|
|
4634
|
-
},
|
|
4964
|
+
}, Zo = {
|
|
4635
4965
|
type: "image",
|
|
4636
|
-
propSchema:
|
|
4966
|
+
propSchema: Xo,
|
|
4637
4967
|
content: "none",
|
|
4638
4968
|
isFileBlock: !0,
|
|
4639
4969
|
fileBlockAcceptMimeTypes: ["image/*"]
|
|
4640
|
-
},
|
|
4970
|
+
}, Jo = (e, t) => {
|
|
4641
4971
|
const o = document.createElement("div");
|
|
4642
4972
|
if (o.className = "bn-file-block-content-wrapper", e.props.url === "") {
|
|
4643
4973
|
const i = document.createElement("div");
|
|
@@ -4680,7 +5010,7 @@ const le = (e) => {
|
|
|
4680
5010
|
dom: j(e, i).dom
|
|
4681
5011
|
};
|
|
4682
5012
|
}
|
|
4683
|
-
},
|
|
5013
|
+
}, Yo = (e) => {
|
|
4684
5014
|
if (e.tagName === "IMG")
|
|
4685
5015
|
return Oe(e);
|
|
4686
5016
|
if (e.tagName === "FIGURE") {
|
|
@@ -4693,7 +5023,7 @@ const le = (e) => {
|
|
|
4693
5023
|
caption: i
|
|
4694
5024
|
};
|
|
4695
5025
|
}
|
|
4696
|
-
},
|
|
5026
|
+
}, Qo = (e) => {
|
|
4697
5027
|
if (!e.props.url) {
|
|
4698
5028
|
const o = document.createElement("p");
|
|
4699
5029
|
return o.textContent = "Add image", {
|
|
@@ -4704,16 +5034,16 @@ const le = (e) => {
|
|
|
4704
5034
|
return e.props.showPreview ? (t = document.createElement("img"), t.src = e.props.url, t.alt = e.props.name || e.props.caption || "BlockNote image", t.width = e.props.previewWidth) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? Ce(t, e.props.caption) : ue(t, e.props.caption) : {
|
|
4705
5035
|
dom: t
|
|
4706
5036
|
};
|
|
4707
|
-
},
|
|
4708
|
-
render:
|
|
4709
|
-
parse:
|
|
4710
|
-
toExternalHTML:
|
|
5037
|
+
}, ei = se(Zo, {
|
|
5038
|
+
render: Jo,
|
|
5039
|
+
parse: Yo,
|
|
5040
|
+
toExternalHTML: Qo
|
|
4711
5041
|
}), je = (e) => {
|
|
4712
5042
|
const t = e.src || void 0, o = e.width || void 0;
|
|
4713
5043
|
return { url: t, previewWidth: o };
|
|
4714
|
-
},
|
|
4715
|
-
textAlignment:
|
|
4716
|
-
backgroundColor:
|
|
5044
|
+
}, ti = {
|
|
5045
|
+
textAlignment: _.textAlignment,
|
|
5046
|
+
backgroundColor: _.backgroundColor,
|
|
4717
5047
|
// File name.
|
|
4718
5048
|
name: {
|
|
4719
5049
|
default: ""
|
|
@@ -4733,13 +5063,13 @@ const le = (e) => {
|
|
|
4733
5063
|
previewWidth: {
|
|
4734
5064
|
default: 512
|
|
4735
5065
|
}
|
|
4736
|
-
},
|
|
5066
|
+
}, oi = {
|
|
4737
5067
|
type: "video",
|
|
4738
|
-
propSchema:
|
|
5068
|
+
propSchema: ti,
|
|
4739
5069
|
content: "none",
|
|
4740
5070
|
isFileBlock: !0,
|
|
4741
5071
|
fileBlockAcceptMimeTypes: ["video/*"]
|
|
4742
|
-
},
|
|
5072
|
+
}, ii = (e, t) => {
|
|
4743
5073
|
const o = document.createElement("div");
|
|
4744
5074
|
if (o.className = "bn-file-block-content-wrapper", e.props.url === "") {
|
|
4745
5075
|
const i = document.createElement("div");
|
|
@@ -4780,7 +5110,7 @@ const le = (e) => {
|
|
|
4780
5110
|
dom: j(e, i).dom
|
|
4781
5111
|
};
|
|
4782
5112
|
}
|
|
4783
|
-
},
|
|
5113
|
+
}, ni = (e) => {
|
|
4784
5114
|
if (e.tagName === "VIDEO")
|
|
4785
5115
|
return je(e);
|
|
4786
5116
|
if (e.tagName === "FIGURE") {
|
|
@@ -4793,7 +5123,7 @@ const le = (e) => {
|
|
|
4793
5123
|
caption: i
|
|
4794
5124
|
};
|
|
4795
5125
|
}
|
|
4796
|
-
},
|
|
5126
|
+
}, ri = (e) => {
|
|
4797
5127
|
if (!e.props.url) {
|
|
4798
5128
|
const o = document.createElement("p");
|
|
4799
5129
|
return o.textContent = "Add video", {
|
|
@@ -4804,12 +5134,12 @@ const le = (e) => {
|
|
|
4804
5134
|
return e.props.showPreview ? (t = document.createElement("video"), t.src = e.props.url, t.width = e.props.previewWidth) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? Ce(t, e.props.caption) : ue(t, e.props.caption) : {
|
|
4805
5135
|
dom: t
|
|
4806
5136
|
};
|
|
4807
|
-
},
|
|
4808
|
-
render:
|
|
4809
|
-
parse:
|
|
4810
|
-
toExternalHTML:
|
|
4811
|
-
}), ze = (e) => ({ url: e.src || void 0 }),
|
|
4812
|
-
backgroundColor:
|
|
5137
|
+
}, ai = se(oi, {
|
|
5138
|
+
render: ii,
|
|
5139
|
+
parse: ni,
|
|
5140
|
+
toExternalHTML: ri
|
|
5141
|
+
}), ze = (e) => ({ url: e.src || void 0 }), si = {
|
|
5142
|
+
backgroundColor: _.backgroundColor,
|
|
4813
5143
|
// File name.
|
|
4814
5144
|
name: {
|
|
4815
5145
|
default: ""
|
|
@@ -4825,13 +5155,13 @@ const le = (e) => {
|
|
|
4825
5155
|
showPreview: {
|
|
4826
5156
|
default: !0
|
|
4827
5157
|
}
|
|
4828
|
-
},
|
|
5158
|
+
}, li = {
|
|
4829
5159
|
type: "audio",
|
|
4830
|
-
propSchema:
|
|
5160
|
+
propSchema: si,
|
|
4831
5161
|
content: "none",
|
|
4832
5162
|
isFileBlock: !0,
|
|
4833
5163
|
fileBlockAcceptMimeTypes: ["audio/*"]
|
|
4834
|
-
},
|
|
5164
|
+
}, di = (e, t) => {
|
|
4835
5165
|
const o = document.createElement("div");
|
|
4836
5166
|
if (o.className = "bn-file-block-content-wrapper", e.props.url === "") {
|
|
4837
5167
|
const i = document.createElement("div");
|
|
@@ -4864,7 +5194,7 @@ const le = (e) => {
|
|
|
4864
5194
|
dom: j(e, i).dom
|
|
4865
5195
|
};
|
|
4866
5196
|
}
|
|
4867
|
-
},
|
|
5197
|
+
}, ci = (e) => {
|
|
4868
5198
|
if (e.tagName === "AUDIO")
|
|
4869
5199
|
return ze(e);
|
|
4870
5200
|
if (e.tagName === "FIGURE") {
|
|
@@ -4877,7 +5207,7 @@ const le = (e) => {
|
|
|
4877
5207
|
caption: i
|
|
4878
5208
|
};
|
|
4879
5209
|
}
|
|
4880
|
-
},
|
|
5210
|
+
}, ui = (e) => {
|
|
4881
5211
|
if (!e.props.url) {
|
|
4882
5212
|
const o = document.createElement("p");
|
|
4883
5213
|
return o.textContent = "Add audio", {
|
|
@@ -4888,11 +5218,11 @@ const le = (e) => {
|
|
|
4888
5218
|
return e.props.showPreview ? (t = document.createElement("audio"), t.src = e.props.url) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? Ce(t, e.props.caption) : ue(t, e.props.caption) : {
|
|
4889
5219
|
dom: t
|
|
4890
5220
|
};
|
|
4891
|
-
},
|
|
4892
|
-
render:
|
|
4893
|
-
parse:
|
|
4894
|
-
toExternalHTML:
|
|
4895
|
-
}),
|
|
5221
|
+
}, pi = se(li, {
|
|
5222
|
+
render: di,
|
|
5223
|
+
parse: ci,
|
|
5224
|
+
toExternalHTML: ui
|
|
5225
|
+
}), Vr = async (e) => {
|
|
4896
5226
|
const t = new FormData();
|
|
4897
5227
|
return t.append("file", e), (await (await fetch("https://tmpfiles.org/api/v1/upload", {
|
|
4898
5228
|
method: "POST",
|
|
@@ -4901,7 +5231,7 @@ const le = (e) => {
|
|
|
4901
5231
|
"tmpfiles.org/",
|
|
4902
5232
|
"tmpfiles.org/dl/"
|
|
4903
5233
|
);
|
|
4904
|
-
},
|
|
5234
|
+
}, hi = xe.create({
|
|
4905
5235
|
name: "backgroundColor",
|
|
4906
5236
|
addAttributes() {
|
|
4907
5237
|
return {
|
|
@@ -4927,10 +5257,10 @@ const le = (e) => {
|
|
|
4927
5257
|
renderHTML({ HTMLAttributes: e }) {
|
|
4928
5258
|
return ["span", e, 0];
|
|
4929
5259
|
}
|
|
4930
|
-
}),
|
|
4931
|
-
|
|
5260
|
+
}), mi = U(
|
|
5261
|
+
hi,
|
|
4932
5262
|
"string"
|
|
4933
|
-
),
|
|
5263
|
+
), fi = xe.create({
|
|
4934
5264
|
name: "textColor",
|
|
4935
5265
|
addAttributes() {
|
|
4936
5266
|
return {
|
|
@@ -4954,16 +5284,16 @@ const le = (e) => {
|
|
|
4954
5284
|
renderHTML({ HTMLAttributes: e }) {
|
|
4955
5285
|
return ["span", e, 0];
|
|
4956
5286
|
}
|
|
4957
|
-
}),
|
|
4958
|
-
const { contentType: t } =
|
|
5287
|
+
}), gi = U(fi, "string"), C = (e) => {
|
|
5288
|
+
const { contentType: t } = k(
|
|
4959
5289
|
e.state.doc,
|
|
4960
5290
|
e.state.selection.from
|
|
4961
5291
|
);
|
|
4962
5292
|
return t.spec.content;
|
|
4963
|
-
},
|
|
4964
|
-
...
|
|
5293
|
+
}, bi = {
|
|
5294
|
+
..._,
|
|
4965
5295
|
level: { default: 1, values: [1, 2, 3] }
|
|
4966
|
-
},
|
|
5296
|
+
}, ki = z({
|
|
4967
5297
|
name: "heading",
|
|
4968
5298
|
content: "inline*",
|
|
4969
5299
|
group: "blockContent",
|
|
@@ -5066,11 +5396,11 @@ const le = (e) => {
|
|
|
5066
5396
|
((i = this.options.domAttributes) == null ? void 0 : i.inlineContent) || {}
|
|
5067
5397
|
);
|
|
5068
5398
|
}
|
|
5069
|
-
}),
|
|
5070
|
-
|
|
5071
|
-
|
|
5399
|
+
}), _i = q(
|
|
5400
|
+
ki,
|
|
5401
|
+
bi
|
|
5072
5402
|
), Se = (e) => {
|
|
5073
|
-
const { contentNode: t, contentType: o } =
|
|
5403
|
+
const { contentNode: t, contentType: o } = k(
|
|
5074
5404
|
e.state.doc,
|
|
5075
5405
|
e.state.selection.from
|
|
5076
5406
|
), i = e.state.selection.anchor === e.state.selection.head;
|
|
@@ -5088,9 +5418,9 @@ const le = (e) => {
|
|
|
5088
5418
|
a.command(() => t.childCount > 0 ? (r().deleteSelection().BNSplitBlock(n.selection.from, !0).run(), !0) : !1)
|
|
5089
5419
|
)
|
|
5090
5420
|
]);
|
|
5091
|
-
},
|
|
5092
|
-
...
|
|
5093
|
-
},
|
|
5421
|
+
}, yi = {
|
|
5422
|
+
..._
|
|
5423
|
+
}, wi = z({
|
|
5094
5424
|
name: "bulletListItem",
|
|
5095
5425
|
content: "inline*",
|
|
5096
5426
|
group: "blockContent",
|
|
@@ -5169,11 +5499,11 @@ const le = (e) => {
|
|
|
5169
5499
|
((o = this.options.domAttributes) == null ? void 0 : o.inlineContent) || {}
|
|
5170
5500
|
);
|
|
5171
5501
|
}
|
|
5172
|
-
}),
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
),
|
|
5176
|
-
key:
|
|
5502
|
+
}), vi = q(
|
|
5503
|
+
wi,
|
|
5504
|
+
yi
|
|
5505
|
+
), xi = new S("numbered-list-indexing"), Ei = () => new y({
|
|
5506
|
+
key: xi,
|
|
5177
5507
|
appendTransaction: (e, t, o) => {
|
|
5178
5508
|
const i = o.tr;
|
|
5179
5509
|
i.setMeta("numberedListIndexing", !0);
|
|
@@ -5181,17 +5511,17 @@ const le = (e) => {
|
|
|
5181
5511
|
return o.doc.descendants((r, a) => {
|
|
5182
5512
|
if (r.type.name === "blockContainer" && r.firstChild.type.name === "numberedListItem") {
|
|
5183
5513
|
let s = "1";
|
|
5184
|
-
const l = a === 1, d =
|
|
5514
|
+
const l = a === 1, d = k(i.doc, a + 1);
|
|
5185
5515
|
if (d === void 0)
|
|
5186
5516
|
return;
|
|
5187
5517
|
if (!l) {
|
|
5188
|
-
const h =
|
|
5518
|
+
const h = k(i.doc, a - 2);
|
|
5189
5519
|
if (h === void 0)
|
|
5190
5520
|
return;
|
|
5191
5521
|
if (!(d.depth !== h.depth)) {
|
|
5192
|
-
const
|
|
5522
|
+
const m = h.contentNode;
|
|
5193
5523
|
if (h.contentType.name === "numberedListItem") {
|
|
5194
|
-
const A =
|
|
5524
|
+
const A = m.attrs.index;
|
|
5195
5525
|
s = (parseInt(A) + 1).toString();
|
|
5196
5526
|
}
|
|
5197
5527
|
}
|
|
@@ -5202,9 +5532,9 @@ const le = (e) => {
|
|
|
5202
5532
|
}
|
|
5203
5533
|
}), n ? i : null;
|
|
5204
5534
|
}
|
|
5205
|
-
}),
|
|
5206
|
-
...
|
|
5207
|
-
},
|
|
5535
|
+
}), Ci = {
|
|
5536
|
+
..._
|
|
5537
|
+
}, Si = z({
|
|
5208
5538
|
name: "numberedListItem",
|
|
5209
5539
|
content: "inline*",
|
|
5210
5540
|
group: "blockContent",
|
|
@@ -5247,7 +5577,7 @@ const le = (e) => {
|
|
|
5247
5577
|
};
|
|
5248
5578
|
},
|
|
5249
5579
|
addProseMirrorPlugins() {
|
|
5250
|
-
return [
|
|
5580
|
+
return [Ei()];
|
|
5251
5581
|
},
|
|
5252
5582
|
parseHTML() {
|
|
5253
5583
|
return [
|
|
@@ -5297,15 +5627,15 @@ const le = (e) => {
|
|
|
5297
5627
|
((o = this.options.domAttributes) == null ? void 0 : o.inlineContent) || {}
|
|
5298
5628
|
);
|
|
5299
5629
|
}
|
|
5300
|
-
}),
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
),
|
|
5304
|
-
...
|
|
5630
|
+
}), Mi = q(
|
|
5631
|
+
Si,
|
|
5632
|
+
Ci
|
|
5633
|
+
), Ti = {
|
|
5634
|
+
..._,
|
|
5305
5635
|
checked: {
|
|
5306
5636
|
default: !1
|
|
5307
5637
|
}
|
|
5308
|
-
},
|
|
5638
|
+
}, Bi = z({
|
|
5309
5639
|
name: "checkListItem",
|
|
5310
5640
|
content: "inline*",
|
|
5311
5641
|
group: "blockContent",
|
|
@@ -5445,8 +5775,8 @@ const le = (e) => {
|
|
|
5445
5775
|
((p = this.options.domAttributes) == null ? void 0 : p.inlineContent) || {}
|
|
5446
5776
|
);
|
|
5447
5777
|
if (typeof t != "boolean") {
|
|
5448
|
-
const
|
|
5449
|
-
a.setAttribute("aria-labelledby",
|
|
5778
|
+
const f = "label-" + this.editor.state.doc.resolve(t()).node().attrs.id;
|
|
5779
|
+
a.setAttribute("aria-labelledby", f), d.id = f;
|
|
5450
5780
|
}
|
|
5451
5781
|
return l.removeChild(d), l.appendChild(n), n.appendChild(r), n.appendChild(d), r.appendChild(a), {
|
|
5452
5782
|
dom: l,
|
|
@@ -5457,12 +5787,12 @@ const le = (e) => {
|
|
|
5457
5787
|
};
|
|
5458
5788
|
};
|
|
5459
5789
|
}
|
|
5460
|
-
}),
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
),
|
|
5464
|
-
...
|
|
5465
|
-
},
|
|
5790
|
+
}), Li = q(
|
|
5791
|
+
Bi,
|
|
5792
|
+
Ti
|
|
5793
|
+
), Ii = {
|
|
5794
|
+
..._
|
|
5795
|
+
}, Ai = z({
|
|
5466
5796
|
name: "paragraph",
|
|
5467
5797
|
content: "inline*",
|
|
5468
5798
|
group: "blockContent",
|
|
@@ -5503,10 +5833,10 @@ const le = (e) => {
|
|
|
5503
5833
|
((o = this.options.domAttributes) == null ? void 0 : o.inlineContent) || {}
|
|
5504
5834
|
);
|
|
5505
5835
|
}
|
|
5506
|
-
}),
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
),
|
|
5836
|
+
}), Ni = q(
|
|
5837
|
+
Ai,
|
|
5838
|
+
Ii
|
|
5839
|
+
), Pi = M.create({
|
|
5510
5840
|
name: "BlockNoteTableExtension",
|
|
5511
5841
|
addProseMirrorPlugins: () => [
|
|
5512
5842
|
Yt({
|
|
@@ -5538,9 +5868,9 @@ const le = (e) => {
|
|
|
5538
5868
|
)
|
|
5539
5869
|
};
|
|
5540
5870
|
}
|
|
5541
|
-
}),
|
|
5542
|
-
...
|
|
5543
|
-
},
|
|
5871
|
+
}), Hi = {
|
|
5872
|
+
..._
|
|
5873
|
+
}, Ui = z({
|
|
5544
5874
|
name: "table",
|
|
5545
5875
|
content: "tableRow+",
|
|
5546
5876
|
group: "blockContent",
|
|
@@ -5561,7 +5891,7 @@ const le = (e) => {
|
|
|
5561
5891
|
((o = this.options.domAttributes) == null ? void 0 : o.inlineContent) || {}
|
|
5562
5892
|
);
|
|
5563
5893
|
}
|
|
5564
|
-
}),
|
|
5894
|
+
}), Di = $.create({
|
|
5565
5895
|
name: "tableParagraph",
|
|
5566
5896
|
group: "tableContent",
|
|
5567
5897
|
content: "inline*",
|
|
@@ -5586,12 +5916,12 @@ const le = (e) => {
|
|
|
5586
5916
|
0
|
|
5587
5917
|
];
|
|
5588
5918
|
}
|
|
5589
|
-
}),
|
|
5919
|
+
}), Vi = q(
|
|
5920
|
+
Ui,
|
|
5590
5921
|
Hi,
|
|
5591
|
-
Pi,
|
|
5592
5922
|
[
|
|
5593
|
-
|
|
5594
|
-
|
|
5923
|
+
Pi,
|
|
5924
|
+
Di,
|
|
5595
5925
|
Zt.extend({
|
|
5596
5926
|
content: "tableContent"
|
|
5597
5927
|
}),
|
|
@@ -5601,50 +5931,50 @@ const le = (e) => {
|
|
|
5601
5931
|
Jt
|
|
5602
5932
|
]
|
|
5603
5933
|
), mt = {
|
|
5604
|
-
paragraph:
|
|
5605
|
-
heading:
|
|
5606
|
-
bulletListItem:
|
|
5607
|
-
numberedListItem:
|
|
5608
|
-
checkListItem:
|
|
5609
|
-
table:
|
|
5610
|
-
file:
|
|
5611
|
-
image:
|
|
5612
|
-
video:
|
|
5613
|
-
audio:
|
|
5614
|
-
},
|
|
5934
|
+
paragraph: Ni,
|
|
5935
|
+
heading: _i,
|
|
5936
|
+
bulletListItem: vi,
|
|
5937
|
+
numberedListItem: Mi,
|
|
5938
|
+
checkListItem: Li,
|
|
5939
|
+
table: Vi,
|
|
5940
|
+
file: qo,
|
|
5941
|
+
image: ei,
|
|
5942
|
+
video: ai,
|
|
5943
|
+
audio: pi
|
|
5944
|
+
}, Ri = dt(mt), ft = {
|
|
5615
5945
|
bold: U(Gt, "boolean"),
|
|
5616
|
-
italic: U(
|
|
5946
|
+
italic: U(Kt, "boolean"),
|
|
5617
5947
|
underline: U(qt, "boolean"),
|
|
5618
|
-
strike: U(
|
|
5948
|
+
strike: U($t, "boolean"),
|
|
5619
5949
|
code: U(Wt, "boolean"),
|
|
5620
|
-
textColor:
|
|
5621
|
-
backgroundColor:
|
|
5622
|
-
},
|
|
5950
|
+
textColor: gi,
|
|
5951
|
+
backgroundColor: mi
|
|
5952
|
+
}, Rr = pt(ft), gt = {
|
|
5623
5953
|
text: { config: "text", implementation: {} },
|
|
5624
5954
|
link: { config: "link", implementation: {} }
|
|
5625
|
-
},
|
|
5955
|
+
}, Or = ct(
|
|
5626
5956
|
gt
|
|
5627
5957
|
);
|
|
5628
5958
|
function E(e, t) {
|
|
5629
|
-
return e in t.schema.blockSchema && t.schema.blockSchema[e] ===
|
|
5959
|
+
return e in t.schema.blockSchema && t.schema.blockSchema[e] === Ri[e];
|
|
5630
5960
|
}
|
|
5631
|
-
function
|
|
5961
|
+
function Oi(e, t, o) {
|
|
5632
5962
|
return t.type === e && t.type in o.schema.blockSchema && E(t.type, o);
|
|
5633
5963
|
}
|
|
5634
|
-
function
|
|
5964
|
+
function jr(e, t) {
|
|
5635
5965
|
return e.type in t.schema.blockSchema && t.schema.blockSchema[e.type].isFileBlock || !1;
|
|
5636
5966
|
}
|
|
5637
|
-
function
|
|
5967
|
+
function zr(e, t) {
|
|
5638
5968
|
return e.type in t.schema.blockSchema && t.schema.blockSchema[e.type].isFileBlock && "showPreview" in t.schema.blockSchema[e.type].propSchema || !1;
|
|
5639
5969
|
}
|
|
5640
|
-
function
|
|
5970
|
+
function Fr(e, t) {
|
|
5641
5971
|
return t.schema.blockSchema[e.type].isFileBlock && !e.props.url;
|
|
5642
5972
|
}
|
|
5643
|
-
function
|
|
5644
|
-
return t in o.schema.blockSchema && e in o.schema.blockSchema[t].propSchema && o.schema.blockSchema[t].propSchema[e] ===
|
|
5973
|
+
function ji(e, t, o) {
|
|
5974
|
+
return t in o.schema.blockSchema && e in o.schema.blockSchema[t].propSchema && o.schema.blockSchema[t].propSchema[e] === _[e];
|
|
5645
5975
|
}
|
|
5646
|
-
function
|
|
5647
|
-
return
|
|
5976
|
+
function Gr(e, t, o) {
|
|
5977
|
+
return ji(e, t.type, o);
|
|
5648
5978
|
}
|
|
5649
5979
|
function Me(e, t) {
|
|
5650
5980
|
let o, i;
|
|
@@ -5655,7 +5985,7 @@ function Me(e, t) {
|
|
|
5655
5985
|
posBeforeNode: i
|
|
5656
5986
|
};
|
|
5657
5987
|
}
|
|
5658
|
-
function
|
|
5988
|
+
function zi(e, t, o = "before", i) {
|
|
5659
5989
|
const n = i._tiptapEditor, r = typeof t == "string" ? t : t.id, a = [];
|
|
5660
5990
|
for (const u of e)
|
|
5661
5991
|
a.push(
|
|
@@ -5691,7 +6021,7 @@ function ji(e, t, o = "before", i) {
|
|
|
5691
6021
|
);
|
|
5692
6022
|
return d;
|
|
5693
6023
|
}
|
|
5694
|
-
function
|
|
6024
|
+
function Fi(e, t, o) {
|
|
5695
6025
|
const i = o._tiptapEditor, n = typeof e == "string" ? e : e.id, { posBeforeNode: r } = Me(n, i.state.doc);
|
|
5696
6026
|
i.commands.BNUpdateBlock(r + 1, t);
|
|
5697
6027
|
const a = i.state.doc.resolve(r + 1).node();
|
|
@@ -5737,10 +6067,10 @@ function bt(e, t, o) {
|
|
|
5737
6067
|
}
|
|
5738
6068
|
return i.view.dispatch(n), a;
|
|
5739
6069
|
}
|
|
5740
|
-
function
|
|
6070
|
+
function Gi(e, t) {
|
|
5741
6071
|
return bt(e, t);
|
|
5742
6072
|
}
|
|
5743
|
-
function
|
|
6073
|
+
function Wi(e, t, o) {
|
|
5744
6074
|
const i = o._tiptapEditor, n = [];
|
|
5745
6075
|
for (const l of t)
|
|
5746
6076
|
n.push(
|
|
@@ -5753,8 +6083,8 @@ function Gi(e, t, o) {
|
|
|
5753
6083
|
if (l.attrs.id === r) {
|
|
5754
6084
|
const h = u.doc.nodeSize;
|
|
5755
6085
|
u.insert(d, n);
|
|
5756
|
-
const
|
|
5757
|
-
return p + h -
|
|
6086
|
+
const f = u.doc.nodeSize;
|
|
6087
|
+
return p + h - f;
|
|
5758
6088
|
}
|
|
5759
6089
|
return p;
|
|
5760
6090
|
}
|
|
@@ -5771,7 +6101,7 @@ function Gi(e, t, o) {
|
|
|
5771
6101
|
);
|
|
5772
6102
|
return { insertedBlocks: s, removedBlocks: a };
|
|
5773
6103
|
}
|
|
5774
|
-
function
|
|
6104
|
+
function Ki(e, t, o, i = { updateSelection: !0 }) {
|
|
5775
6105
|
const n = o._tiptapEditor, r = n.state.tr;
|
|
5776
6106
|
let { from: a, to: s } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, l = !0, d = !0, u = "";
|
|
5777
6107
|
if (t.forEach((p) => {
|
|
@@ -5798,7 +6128,7 @@ function $i() {
|
|
|
5798
6128
|
};
|
|
5799
6129
|
return e;
|
|
5800
6130
|
}
|
|
5801
|
-
function
|
|
6131
|
+
function qi() {
|
|
5802
6132
|
const e = (t) => {
|
|
5803
6133
|
var o;
|
|
5804
6134
|
if (t.children && "length" in t.children && t.children.length)
|
|
@@ -5814,34 +6144,34 @@ function Ki() {
|
|
|
5814
6144
|
return e;
|
|
5815
6145
|
}
|
|
5816
6146
|
function Te(e) {
|
|
5817
|
-
return ve().use(qe, { fragment: !0 }).use($i).use(
|
|
6147
|
+
return ve().use(qe, { fragment: !0 }).use($i).use(qi).use(eo).use(Ze).use(to, { handlers: { text: (o) => o.value } }).processSync(e).value;
|
|
5818
6148
|
}
|
|
5819
|
-
function
|
|
6149
|
+
function Xi(e, t, o) {
|
|
5820
6150
|
const n = ae(t, o).exportBlocks(e);
|
|
5821
6151
|
return Te(n);
|
|
5822
6152
|
}
|
|
5823
|
-
function
|
|
6153
|
+
function Zi(e) {
|
|
5824
6154
|
return Array.prototype.indexOf.call(e.parentElement.childNodes, e);
|
|
5825
6155
|
}
|
|
5826
|
-
function
|
|
6156
|
+
function Ji(e) {
|
|
5827
6157
|
return e.nodeType === 3 && !/\S/.test(e.nodeValue || "");
|
|
5828
6158
|
}
|
|
5829
|
-
function
|
|
6159
|
+
function Yi(e) {
|
|
5830
6160
|
e.querySelectorAll("li > ul, li > ol").forEach((t) => {
|
|
5831
|
-
const o =
|
|
6161
|
+
const o = Zi(t), i = t.parentElement, n = Array.from(i.childNodes).slice(
|
|
5832
6162
|
o + 1
|
|
5833
6163
|
);
|
|
5834
6164
|
t.remove(), n.forEach((r) => {
|
|
5835
6165
|
r.remove();
|
|
5836
6166
|
}), i.insertAdjacentElement("afterend", t), n.reverse().forEach((r) => {
|
|
5837
|
-
if (
|
|
6167
|
+
if (Ji(r))
|
|
5838
6168
|
return;
|
|
5839
6169
|
const a = document.createElement("li");
|
|
5840
6170
|
a.append(r), t.insertAdjacentElement("afterend", a);
|
|
5841
6171
|
}), i.childNodes.length === 0 && i.remove();
|
|
5842
6172
|
});
|
|
5843
6173
|
}
|
|
5844
|
-
function
|
|
6174
|
+
function Qi(e) {
|
|
5845
6175
|
e.querySelectorAll("li + ul, li + ol").forEach((t) => {
|
|
5846
6176
|
var r, a;
|
|
5847
6177
|
const o = t.previousElementSibling, i = document.createElement("div");
|
|
@@ -5852,15 +6182,15 @@ function Yi(e) {
|
|
|
5852
6182
|
});
|
|
5853
6183
|
}
|
|
5854
6184
|
let Fe = null;
|
|
5855
|
-
function
|
|
6185
|
+
function en() {
|
|
5856
6186
|
return Fe || (Fe = document.implementation.createHTMLDocument("title"));
|
|
5857
6187
|
}
|
|
5858
6188
|
function kt(e) {
|
|
5859
6189
|
if (typeof e == "string") {
|
|
5860
|
-
const t =
|
|
6190
|
+
const t = en().createElement("div");
|
|
5861
6191
|
t.innerHTML = e, e = t;
|
|
5862
6192
|
}
|
|
5863
|
-
return
|
|
6193
|
+
return Yi(e), Qi(e), e;
|
|
5864
6194
|
}
|
|
5865
6195
|
async function _t(e, t, o, i, n) {
|
|
5866
6196
|
const r = kt(e), s = Tt.fromSchema(n).parse(r, {
|
|
@@ -5872,7 +6202,7 @@ async function _t(e, t, o, i, n) {
|
|
|
5872
6202
|
);
|
|
5873
6203
|
return l;
|
|
5874
6204
|
}
|
|
5875
|
-
function
|
|
6205
|
+
function tn(e, t) {
|
|
5876
6206
|
const o = t.value ? t.value + `
|
|
5877
6207
|
` : "", i = {};
|
|
5878
6208
|
t.lang && (i["data-language"] = t.lang);
|
|
@@ -5889,11 +6219,11 @@ function en(e, t) {
|
|
|
5889
6219
|
children: [n]
|
|
5890
6220
|
}, e.patch(t, n), n;
|
|
5891
6221
|
}
|
|
5892
|
-
function
|
|
6222
|
+
function on(e, t, o, i, n) {
|
|
5893
6223
|
const r = ve().use(oo).use(Ze).use(io, {
|
|
5894
6224
|
handlers: {
|
|
5895
6225
|
...no,
|
|
5896
|
-
code:
|
|
6226
|
+
code: tn
|
|
5897
6227
|
}
|
|
5898
6228
|
}).use(Xe).processSync(e);
|
|
5899
6229
|
return _t(
|
|
@@ -5924,7 +6254,7 @@ class X {
|
|
|
5924
6254
|
this.callbacks = {};
|
|
5925
6255
|
}
|
|
5926
6256
|
}
|
|
5927
|
-
class
|
|
6257
|
+
class nn {
|
|
5928
6258
|
constructor(t, o, i, n) {
|
|
5929
6259
|
c(this, "state");
|
|
5930
6260
|
c(this, "emitUpdate");
|
|
@@ -5977,7 +6307,7 @@ class on {
|
|
|
5977
6307
|
}
|
|
5978
6308
|
}
|
|
5979
6309
|
const fe = new S("FilePanelPlugin");
|
|
5980
|
-
class
|
|
6310
|
+
class rn extends X {
|
|
5981
6311
|
constructor(o) {
|
|
5982
6312
|
super();
|
|
5983
6313
|
c(this, "view");
|
|
@@ -5985,7 +6315,7 @@ class nn extends X {
|
|
|
5985
6315
|
c(this, "closeMenu", () => this.view.closeMenu());
|
|
5986
6316
|
this.plugin = new y({
|
|
5987
6317
|
key: fe,
|
|
5988
|
-
view: (i) => (this.view = new
|
|
6318
|
+
view: (i) => (this.view = new nn(
|
|
5989
6319
|
o,
|
|
5990
6320
|
fe,
|
|
5991
6321
|
i,
|
|
@@ -6017,7 +6347,7 @@ class nn extends X {
|
|
|
6017
6347
|
return this.on("update", o);
|
|
6018
6348
|
}
|
|
6019
6349
|
}
|
|
6020
|
-
class
|
|
6350
|
+
class an {
|
|
6021
6351
|
constructor(t, o, i) {
|
|
6022
6352
|
c(this, "state");
|
|
6023
6353
|
c(this, "emitUpdate");
|
|
@@ -6055,11 +6385,11 @@ class rn {
|
|
|
6055
6385
|
}, o.dom.addEventListener("mousedown", this.viewMousedownHandler), o.dom.addEventListener("mouseup", this.viewMouseupHandler), o.dom.addEventListener("dragstart", this.dragHandler), o.dom.addEventListener("dragover", this.dragHandler), o.root.addEventListener("scroll", this.scrollHandler, !0);
|
|
6056
6386
|
}
|
|
6057
6387
|
update(t, o) {
|
|
6058
|
-
var h,
|
|
6388
|
+
var h, f;
|
|
6059
6389
|
const { state: i, composing: n } = t, { doc: r, selection: a } = i, s = o && o.doc.eq(r) && o.selection.eq(a);
|
|
6060
6390
|
if (n || s)
|
|
6061
6391
|
return;
|
|
6062
|
-
const { ranges: l } = a, d = Math.min(...l.map((
|
|
6392
|
+
const { ranges: l } = a, d = Math.min(...l.map((m) => m.$from.pos)), u = Math.max(...l.map((m) => m.$to.pos)), p = (h = this.shouldShow) == null ? void 0 : h.call(this, {
|
|
6063
6393
|
view: t,
|
|
6064
6394
|
state: i,
|
|
6065
6395
|
from: d,
|
|
@@ -6072,7 +6402,7 @@ class rn {
|
|
|
6072
6402
|
}, this.emitUpdate();
|
|
6073
6403
|
return;
|
|
6074
6404
|
}
|
|
6075
|
-
if ((
|
|
6405
|
+
if ((f = this.state) != null && f.show && !this.preventHide && (!p || this.preventShow || !this.editor.isEditable)) {
|
|
6076
6406
|
this.state.show = !1, this.emitUpdate();
|
|
6077
6407
|
return;
|
|
6078
6408
|
}
|
|
@@ -6090,18 +6420,18 @@ class rn {
|
|
|
6090
6420
|
return ke(this.pmView, n, r);
|
|
6091
6421
|
}
|
|
6092
6422
|
}
|
|
6093
|
-
const
|
|
6423
|
+
const sn = new S(
|
|
6094
6424
|
"FormattingToolbarPlugin"
|
|
6095
6425
|
);
|
|
6096
|
-
class
|
|
6426
|
+
class ln extends X {
|
|
6097
6427
|
constructor(o) {
|
|
6098
6428
|
super();
|
|
6099
6429
|
c(this, "view");
|
|
6100
6430
|
c(this, "plugin");
|
|
6101
6431
|
c(this, "closeMenu", () => this.view.closeMenu());
|
|
6102
6432
|
this.plugin = new y({
|
|
6103
|
-
key:
|
|
6104
|
-
view: (i) => (this.view = new
|
|
6433
|
+
key: sn,
|
|
6434
|
+
view: (i) => (this.view = new an(o, i, (n) => {
|
|
6105
6435
|
this.emit("update", n);
|
|
6106
6436
|
}), this.view),
|
|
6107
6437
|
props: {
|
|
@@ -6117,7 +6447,7 @@ class sn extends X {
|
|
|
6117
6447
|
return this.on("update", o);
|
|
6118
6448
|
}
|
|
6119
6449
|
}
|
|
6120
|
-
class
|
|
6450
|
+
class dn {
|
|
6121
6451
|
constructor(t, o, i) {
|
|
6122
6452
|
c(this, "state");
|
|
6123
6453
|
c(this, "emitUpdate");
|
|
@@ -6244,8 +6574,8 @@ class ln {
|
|
|
6244
6574
|
);
|
|
6245
6575
|
}
|
|
6246
6576
|
}
|
|
6247
|
-
const
|
|
6248
|
-
class
|
|
6577
|
+
const cn = new S("LinkToolbarPlugin");
|
|
6578
|
+
class un extends X {
|
|
6249
6579
|
constructor(o) {
|
|
6250
6580
|
super();
|
|
6251
6581
|
c(this, "view");
|
|
@@ -6284,8 +6614,8 @@ class cn extends X {
|
|
|
6284
6614
|
});
|
|
6285
6615
|
c(this, "closeMenu", () => this.view.closeMenu());
|
|
6286
6616
|
this.plugin = new y({
|
|
6287
|
-
key:
|
|
6288
|
-
view: (i) => (this.view = new
|
|
6617
|
+
key: cn,
|
|
6618
|
+
view: (i) => (this.view = new dn(o, i, (n) => {
|
|
6289
6619
|
this.emit("update", n);
|
|
6290
6620
|
}), this.view),
|
|
6291
6621
|
props: {
|
|
@@ -6301,8 +6631,8 @@ class cn extends X {
|
|
|
6301
6631
|
return ((i = (o = this.view) == null ? void 0 : o.state) == null ? void 0 : i.show) || !1;
|
|
6302
6632
|
}
|
|
6303
6633
|
}
|
|
6304
|
-
const
|
|
6305
|
-
class
|
|
6634
|
+
const pn = Rt((e) => e.type.name === "blockContainer");
|
|
6635
|
+
class hn {
|
|
6306
6636
|
constructor(t, o) {
|
|
6307
6637
|
c(this, "state");
|
|
6308
6638
|
c(this, "emitUpdate");
|
|
@@ -6363,7 +6693,7 @@ class pn {
|
|
|
6363
6693
|
}
|
|
6364
6694
|
}
|
|
6365
6695
|
const V = new S("SuggestionMenuPlugin");
|
|
6366
|
-
class
|
|
6696
|
+
class mn extends X {
|
|
6367
6697
|
constructor(o) {
|
|
6368
6698
|
super();
|
|
6369
6699
|
c(this, "view");
|
|
@@ -6383,7 +6713,7 @@ class hn extends X {
|
|
|
6383
6713
|
const i = this.triggerCharacters;
|
|
6384
6714
|
this.plugin = new y({
|
|
6385
6715
|
key: V,
|
|
6386
|
-
view: () => (this.view = new
|
|
6716
|
+
view: () => (this.view = new hn(
|
|
6387
6717
|
o,
|
|
6388
6718
|
(n, r) => {
|
|
6389
6719
|
this.emit(`update ${n}`, r);
|
|
@@ -6439,7 +6769,7 @@ class hn extends X {
|
|
|
6439
6769
|
if (r === void 0)
|
|
6440
6770
|
return null;
|
|
6441
6771
|
if (!r.fromUserInput) {
|
|
6442
|
-
const a =
|
|
6772
|
+
const a = pn(n.selection);
|
|
6443
6773
|
if (a)
|
|
6444
6774
|
return G.create(n.doc, [
|
|
6445
6775
|
W.node(
|
|
@@ -6476,7 +6806,7 @@ class hn extends X {
|
|
|
6476
6806
|
return ((i = (o = this.view) == null ? void 0 : o.state) == null ? void 0 : i.show) || !1;
|
|
6477
6807
|
}
|
|
6478
6808
|
}
|
|
6479
|
-
function
|
|
6809
|
+
function Wr(e, t) {
|
|
6480
6810
|
e.suggestionMenus.addTriggerCharacter(t);
|
|
6481
6811
|
}
|
|
6482
6812
|
class F extends he {
|
|
@@ -6522,7 +6852,7 @@ function pe(e, t) {
|
|
|
6522
6852
|
if (e.hasAttribute("data-id"))
|
|
6523
6853
|
return { node: e, id: e.getAttribute("data-id") };
|
|
6524
6854
|
}
|
|
6525
|
-
function
|
|
6855
|
+
function fn(e, t) {
|
|
6526
6856
|
const o = pe(e, t);
|
|
6527
6857
|
if (o && o.node.nodeType === 1) {
|
|
6528
6858
|
const i = t.docView, n = i.nearestDesc(o.node, !0);
|
|
@@ -6530,7 +6860,7 @@ function mn(e, t) {
|
|
|
6530
6860
|
}
|
|
6531
6861
|
return null;
|
|
6532
6862
|
}
|
|
6533
|
-
function
|
|
6863
|
+
function gn(e, t) {
|
|
6534
6864
|
let o, i;
|
|
6535
6865
|
const n = t.resolve(e.from).node().type.spec.group === "blockContent", r = t.resolve(e.to).node().type.spec.group === "blockContent", a = Math.min(e.$anchor.depth, e.$head.depth);
|
|
6536
6866
|
if (n && r) {
|
|
@@ -6560,9 +6890,9 @@ function Ge(e, t, o = t) {
|
|
|
6560
6890
|
B.className = B.className + " bn-drag-preview " + d, e.root instanceof ShadowRoot ? e.root.appendChild(B) : e.root.body.appendChild(B);
|
|
6561
6891
|
}
|
|
6562
6892
|
function yt(e) {
|
|
6563
|
-
B !== void 0 && (e instanceof ShadowRoot ? e.removeChild(B) : e.body.
|
|
6893
|
+
B !== void 0 && (e instanceof ShadowRoot ? e.removeChild(B) : e.body.removeChild(B), B = void 0);
|
|
6564
6894
|
}
|
|
6565
|
-
function
|
|
6895
|
+
function bn(e, t) {
|
|
6566
6896
|
if (!e.dataTransfer)
|
|
6567
6897
|
return;
|
|
6568
6898
|
const o = t.prosemirrorView, i = o.dom.getBoundingClientRect(), n = {
|
|
@@ -6578,23 +6908,23 @@ function gn(e, t) {
|
|
|
6578
6908
|
}
|
|
6579
6909
|
if (!a)
|
|
6580
6910
|
return;
|
|
6581
|
-
const s =
|
|
6911
|
+
const s = fn(a.node, o);
|
|
6582
6912
|
if (s != null) {
|
|
6583
|
-
const l = o.state.selection, d = o.state.doc, { from: u, to: p } =
|
|
6584
|
-
h &&
|
|
6913
|
+
const l = o.state.selection, d = o.state.doc, { from: u, to: p } = gn(l, d), h = u <= s && s < p, f = l.$anchor.node() !== l.$head.node() || l instanceof F;
|
|
6914
|
+
h && f ? (o.dispatch(
|
|
6585
6915
|
o.state.tr.setSelection(F.create(d, u, p))
|
|
6586
6916
|
), Ge(o, u, p)) : (o.dispatch(
|
|
6587
6917
|
o.state.tr.setSelection(ne.create(o.state.doc, s))
|
|
6588
6918
|
), Ge(o, s));
|
|
6589
|
-
const
|
|
6590
|
-
|
|
6919
|
+
const m = o.state.selection.content(), g = t._tiptapEditor.schema, A = rt(g, t).serializeProseMirrorFragment(
|
|
6920
|
+
m.content
|
|
6591
6921
|
), N = ae(g, t).exportProseMirrorFragment(
|
|
6592
|
-
|
|
6922
|
+
m.content
|
|
6593
6923
|
), Z = Te(N);
|
|
6594
|
-
e.dataTransfer.clearData(), e.dataTransfer.setData("blocknote/html", A), e.dataTransfer.setData("text/html", N), e.dataTransfer.setData("text/plain", Z), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setDragImage(B, 0, 0), o.dragging = { slice:
|
|
6924
|
+
e.dataTransfer.clearData(), e.dataTransfer.setData("blocknote/html", A), e.dataTransfer.setData("text/html", N), e.dataTransfer.setData("text/plain", Z), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setDragImage(B, 0, 0), o.dragging = { slice: m, move: !0 };
|
|
6595
6925
|
}
|
|
6596
6926
|
}
|
|
6597
|
-
class
|
|
6927
|
+
class kn {
|
|
6598
6928
|
constructor(t, o, i) {
|
|
6599
6929
|
c(this, "state");
|
|
6600
6930
|
c(this, "emitUpdate");
|
|
@@ -6788,7 +7118,7 @@ class bn {
|
|
|
6788
7118
|
});
|
|
6789
7119
|
if (!i)
|
|
6790
7120
|
return;
|
|
6791
|
-
const n =
|
|
7121
|
+
const n = k(
|
|
6792
7122
|
this.editor._tiptapEditor.state.doc,
|
|
6793
7123
|
i.pos
|
|
6794
7124
|
);
|
|
@@ -6808,8 +7138,8 @@ class bn {
|
|
|
6808
7138
|
);
|
|
6809
7139
|
}
|
|
6810
7140
|
}
|
|
6811
|
-
const
|
|
6812
|
-
class
|
|
7141
|
+
const _n = new S("SideMenuPlugin");
|
|
7142
|
+
class yn extends X {
|
|
6813
7143
|
constructor(o) {
|
|
6814
7144
|
super();
|
|
6815
7145
|
c(this, "view");
|
|
@@ -6823,7 +7153,7 @@ class _n extends X {
|
|
|
6823
7153
|
* Handles drag & drop events for blocks.
|
|
6824
7154
|
*/
|
|
6825
7155
|
c(this, "blockDragStart", (o) => {
|
|
6826
|
-
this.view.isDragging = !0,
|
|
7156
|
+
this.view.isDragging = !0, bn(o, this.editor);
|
|
6827
7157
|
});
|
|
6828
7158
|
/**
|
|
6829
7159
|
* Handles drag & drop events for blocks.
|
|
@@ -6844,8 +7174,8 @@ class _n extends X {
|
|
|
6844
7174
|
this.view.menuFrozen = !1, this.view.state.show = !1, this.view.emitUpdate(this.view.state);
|
|
6845
7175
|
});
|
|
6846
7176
|
this.editor = o, this.plugin = new y({
|
|
6847
|
-
key:
|
|
6848
|
-
view: (i) => (this.view = new
|
|
7177
|
+
key: _n,
|
|
7178
|
+
view: (i) => (this.view = new kn(o, i, (n) => {
|
|
6849
7179
|
this.emit("update", n);
|
|
6850
7180
|
}), this.view)
|
|
6851
7181
|
});
|
|
@@ -6858,25 +7188,25 @@ let w;
|
|
|
6858
7188
|
function We(e) {
|
|
6859
7189
|
w || (w = document.createElement("div"), w.innerHTML = "_", w.style.opacity = "0", w.style.height = "1px", w.style.width = "1px", e instanceof Document ? e.body.appendChild(w) : e.appendChild(w));
|
|
6860
7190
|
}
|
|
6861
|
-
function
|
|
7191
|
+
function wn(e) {
|
|
6862
7192
|
w && (e instanceof Document ? e.body.removeChild(w) : e.removeChild(w), w = void 0);
|
|
6863
7193
|
}
|
|
6864
7194
|
function ie(e) {
|
|
6865
7195
|
return Array.prototype.indexOf.call(e.parentElement.childNodes, e);
|
|
6866
7196
|
}
|
|
6867
|
-
function
|
|
7197
|
+
function vn(e) {
|
|
6868
7198
|
for (; e && e.nodeName !== "TD" && e.nodeName !== "TH"; )
|
|
6869
7199
|
e = e.classList && e.classList.contains("ProseMirror") ? null : e.parentNode;
|
|
6870
7200
|
return e;
|
|
6871
7201
|
}
|
|
6872
|
-
function
|
|
7202
|
+
function xn(e, t) {
|
|
6873
7203
|
e.forEach((o) => {
|
|
6874
7204
|
const i = t.querySelectorAll(o);
|
|
6875
7205
|
for (let n = 0; n < i.length; n++)
|
|
6876
7206
|
i[n].style.visibility = "hidden";
|
|
6877
7207
|
});
|
|
6878
7208
|
}
|
|
6879
|
-
class
|
|
7209
|
+
class En {
|
|
6880
7210
|
constructor(t, o, i) {
|
|
6881
7211
|
c(this, "state");
|
|
6882
7212
|
c(this, "emitUpdate");
|
|
@@ -6888,7 +7218,7 @@ class xn {
|
|
|
6888
7218
|
var d;
|
|
6889
7219
|
if (this.menuFrozen)
|
|
6890
7220
|
return;
|
|
6891
|
-
const o =
|
|
7221
|
+
const o = vn(t.target);
|
|
6892
7222
|
if (!o || !this.editor.isEditable) {
|
|
6893
7223
|
(d = this.state) != null && d.show && (this.state.show = !1, this.emitUpdate());
|
|
6894
7224
|
return;
|
|
@@ -6909,7 +7239,7 @@ class xn {
|
|
|
6909
7239
|
this.editor.schema.styleSchema,
|
|
6910
7240
|
this.editor.blockCache
|
|
6911
7241
|
);
|
|
6912
|
-
return
|
|
7242
|
+
return Oi("table", h, this.editor) && (this.tablePos = p + 1, l = h), !1;
|
|
6913
7243
|
}), !!l && (this.tableId = s.id, !(this.state !== void 0 && this.state.show && this.tableId === s.id && this.state.rowIndex === n && this.state.colIndex === i)))
|
|
6914
7244
|
return this.state = {
|
|
6915
7245
|
show: !0,
|
|
@@ -6925,7 +7255,7 @@ class xn {
|
|
|
6925
7255
|
var h;
|
|
6926
7256
|
if (((h = this.state) == null ? void 0 : h.draggingState) === void 0)
|
|
6927
7257
|
return;
|
|
6928
|
-
t.preventDefault(), t.dataTransfer.dropEffect = "move",
|
|
7258
|
+
t.preventDefault(), t.dataTransfer.dropEffect = "move", xn(
|
|
6929
7259
|
[
|
|
6930
7260
|
"column-resize-handle",
|
|
6931
7261
|
"prosemirror-dropcursor-block",
|
|
@@ -6943,7 +7273,7 @@ class xn {
|
|
|
6943
7273
|
this.state.referencePosTable.bottom - 1
|
|
6944
7274
|
)
|
|
6945
7275
|
}, i = this.pmView.root.elementsFromPoint(o.left, o.top).filter(
|
|
6946
|
-
(
|
|
7276
|
+
(f) => f.tagName === "TD" || f.tagName === "TH"
|
|
6947
7277
|
);
|
|
6948
7278
|
if (i.length === 0)
|
|
6949
7279
|
throw new Error(
|
|
@@ -7013,7 +7343,7 @@ class xn {
|
|
|
7013
7343
|
}
|
|
7014
7344
|
}
|
|
7015
7345
|
const Q = new S("TableHandlesPlugin");
|
|
7016
|
-
class
|
|
7346
|
+
class Cn extends X {
|
|
7017
7347
|
constructor(o) {
|
|
7018
7348
|
super();
|
|
7019
7349
|
c(this, "view");
|
|
@@ -7073,7 +7403,7 @@ class En extends X {
|
|
|
7073
7403
|
);
|
|
7074
7404
|
this.view.state.draggingState = void 0, this.view.emitUpdate(), this.editor._tiptapEditor.view.dispatch(
|
|
7075
7405
|
this.editor._tiptapEditor.state.tr.setMeta(Q, null)
|
|
7076
|
-
),
|
|
7406
|
+
), wn(this.editor._tiptapEditor.view.root);
|
|
7077
7407
|
});
|
|
7078
7408
|
/**
|
|
7079
7409
|
* Freezes the drag handles. When frozen, they will stay attached to the same
|
|
@@ -7091,7 +7421,7 @@ class En extends X {
|
|
|
7091
7421
|
});
|
|
7092
7422
|
this.editor = o, this.plugin = new y({
|
|
7093
7423
|
key: Q,
|
|
7094
|
-
view: (i) => (this.view = new
|
|
7424
|
+
view: (i) => (this.view = new En(o, i, (n) => {
|
|
7095
7425
|
this.emit("update", n);
|
|
7096
7426
|
}), this.view),
|
|
7097
7427
|
// We use decorations to render the drop cursor when dragging a table row
|
|
@@ -7111,12 +7441,12 @@ class En extends X {
|
|
|
7111
7441
|
for (let u = 0; u < d.childCount; u++) {
|
|
7112
7442
|
const p = i.doc.resolve(
|
|
7113
7443
|
l.posAtIndex(u) + 1
|
|
7114
|
-
), h = p.node(),
|
|
7444
|
+
), h = p.node(), f = p.pos + (n > this.view.state.draggingState.originalIndex ? h.nodeSize - 2 : 0);
|
|
7115
7445
|
r.push(
|
|
7116
7446
|
// The widget is a small bar which spans the width of the cell.
|
|
7117
|
-
W.widget(
|
|
7118
|
-
const
|
|
7119
|
-
return
|
|
7447
|
+
W.widget(f, () => {
|
|
7448
|
+
const m = document.createElement("div");
|
|
7449
|
+
return m.className = "bn-table-drop-cursor", m.style.left = "0", m.style.right = "0", n > this.view.state.draggingState.originalIndex ? m.style.bottom = "-2px" : m.style.top = "-3px", m.style.height = "4px", m;
|
|
7120
7450
|
})
|
|
7121
7451
|
);
|
|
7122
7452
|
}
|
|
@@ -7130,8 +7460,8 @@ class En extends X {
|
|
|
7130
7460
|
r.push(
|
|
7131
7461
|
// The widget is a small bar which spans the height of the cell.
|
|
7132
7462
|
W.widget(h, () => {
|
|
7133
|
-
const
|
|
7134
|
-
return
|
|
7463
|
+
const f = document.createElement("div");
|
|
7464
|
+
return f.className = "bn-table-drop-cursor", f.style.top = "0", f.style.bottom = "0", n > this.view.state.draggingState.originalIndex ? f.style.right = "-2px" : f.style.left = "-3px", f.style.width = "4px", f;
|
|
7135
7465
|
})
|
|
7136
7466
|
);
|
|
7137
7467
|
}
|
|
@@ -7144,7 +7474,7 @@ class En extends X {
|
|
|
7144
7474
|
return this.on("update", o);
|
|
7145
7475
|
}
|
|
7146
7476
|
}
|
|
7147
|
-
function
|
|
7477
|
+
function Ke(e, t) {
|
|
7148
7478
|
const o = e.state.selection.content().content, n = rt(
|
|
7149
7479
|
e.state.schema,
|
|
7150
7480
|
t
|
|
@@ -7154,7 +7484,7 @@ function $e(e, t) {
|
|
|
7154
7484
|
).exportProseMirrorFragment(o), s = Te(a);
|
|
7155
7485
|
return { internalHTML: n, externalHTML: a, plainText: s };
|
|
7156
7486
|
}
|
|
7157
|
-
const
|
|
7487
|
+
const Sn = (e) => M.create({
|
|
7158
7488
|
name: "copyToClipboard",
|
|
7159
7489
|
addProseMirrorPlugins() {
|
|
7160
7490
|
return [
|
|
@@ -7169,7 +7499,7 @@ const Cn = (e) => M.create({
|
|
|
7169
7499
|
)
|
|
7170
7500
|
)
|
|
7171
7501
|
);
|
|
7172
|
-
const { internalHTML: i, externalHTML: n, plainText: r } =
|
|
7502
|
+
const { internalHTML: i, externalHTML: n, plainText: r } = Ke(t, e);
|
|
7173
7503
|
return o.clipboardData.setData("blocknote/html", i), o.clipboardData.setData("text/html", n), o.clipboardData.setData("text/plain", r), !0;
|
|
7174
7504
|
},
|
|
7175
7505
|
// This is for the use-case in which only a block without content
|
|
@@ -7185,7 +7515,7 @@ const Cn = (e) => M.create({
|
|
|
7185
7515
|
)
|
|
7186
7516
|
)
|
|
7187
7517
|
), o.preventDefault(), o.dataTransfer.clearData();
|
|
7188
|
-
const { internalHTML: i, externalHTML: n, plainText: r } =
|
|
7518
|
+
const { internalHTML: i, externalHTML: n, plainText: r } = Ke(t, e);
|
|
7189
7519
|
return o.dataTransfer.setData("blocknote/html", i), o.dataTransfer.setData("text/html", n), o.dataTransfer.setData("text/plain", r), !0;
|
|
7190
7520
|
}
|
|
7191
7521
|
}
|
|
@@ -7194,7 +7524,7 @@ const Cn = (e) => M.create({
|
|
|
7194
7524
|
];
|
|
7195
7525
|
}
|
|
7196
7526
|
});
|
|
7197
|
-
function
|
|
7527
|
+
function Mn(e) {
|
|
7198
7528
|
let t = e.getTextCursorPosition().block, o = e.schema.blockSchema[t.type].content;
|
|
7199
7529
|
for (; o === "none"; )
|
|
7200
7530
|
t = e.getTextCursorPosition().nextBlock, o = e.schema.blockSchema[t.type].content, e.setTextCursorPosition(t, "end");
|
|
@@ -7208,9 +7538,9 @@ function x(e, t) {
|
|
|
7208
7538
|
"end"
|
|
7209
7539
|
));
|
|
7210
7540
|
const i = e.getTextCursorPosition().block;
|
|
7211
|
-
return
|
|
7541
|
+
return Mn(e), i;
|
|
7212
7542
|
}
|
|
7213
|
-
function
|
|
7543
|
+
function Kr(e) {
|
|
7214
7544
|
const t = [];
|
|
7215
7545
|
return E("heading", e) && t.push(
|
|
7216
7546
|
{
|
|
@@ -7369,7 +7699,7 @@ const Be = [
|
|
|
7369
7699
|
"text/html",
|
|
7370
7700
|
"text/plain"
|
|
7371
7701
|
];
|
|
7372
|
-
function
|
|
7702
|
+
function Tn(e, t) {
|
|
7373
7703
|
const o = e.split("/"), i = t.split("/");
|
|
7374
7704
|
if (o.length !== 2)
|
|
7375
7705
|
throw new Error(`The string ${e} is not a valid MIME type.`);
|
|
@@ -7402,7 +7732,7 @@ async function wt(e, t) {
|
|
|
7402
7732
|
let s = "file";
|
|
7403
7733
|
for (const d of r)
|
|
7404
7734
|
for (const u of d.fileBlockAcceptMimeTypes || [])
|
|
7405
|
-
if (
|
|
7735
|
+
if (Tn(n[a].type, u)) {
|
|
7406
7736
|
s = d.type;
|
|
7407
7737
|
break;
|
|
7408
7738
|
}
|
|
@@ -7422,7 +7752,7 @@ async function wt(e, t) {
|
|
|
7422
7752
|
}
|
|
7423
7753
|
}
|
|
7424
7754
|
}
|
|
7425
|
-
const
|
|
7755
|
+
const Bn = (e) => M.create({
|
|
7426
7756
|
name: "pasteFromClipboard",
|
|
7427
7757
|
addProseMirrorPlugins() {
|
|
7428
7758
|
return [
|
|
@@ -7450,7 +7780,7 @@ const Tn = (e) => M.create({
|
|
|
7450
7780
|
})
|
|
7451
7781
|
];
|
|
7452
7782
|
}
|
|
7453
|
-
}),
|
|
7783
|
+
}), Ln = (e) => M.create({
|
|
7454
7784
|
name: "dropFile",
|
|
7455
7785
|
addProseMirrorPlugins() {
|
|
7456
7786
|
return [
|
|
@@ -7473,7 +7803,7 @@ const Tn = (e) => M.create({
|
|
|
7473
7803
|
})
|
|
7474
7804
|
];
|
|
7475
7805
|
}
|
|
7476
|
-
}),
|
|
7806
|
+
}), In = M.create({
|
|
7477
7807
|
name: "blockBackgroundColor",
|
|
7478
7808
|
addGlobalAttributes() {
|
|
7479
7809
|
return [
|
|
@@ -7481,9 +7811,9 @@ const Tn = (e) => M.create({
|
|
|
7481
7811
|
types: ["blockContainer"],
|
|
7482
7812
|
attributes: {
|
|
7483
7813
|
backgroundColor: {
|
|
7484
|
-
default:
|
|
7485
|
-
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") :
|
|
7486
|
-
renderHTML: (e) => e.backgroundColor !==
|
|
7814
|
+
default: _.backgroundColor.default,
|
|
7815
|
+
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") : _.backgroundColor.default,
|
|
7816
|
+
renderHTML: (e) => e.backgroundColor !== _.backgroundColor.default && {
|
|
7487
7817
|
"data-background-color": e.backgroundColor
|
|
7488
7818
|
}
|
|
7489
7819
|
}
|
|
@@ -7491,7 +7821,7 @@ const Tn = (e) => M.create({
|
|
|
7491
7821
|
}
|
|
7492
7822
|
];
|
|
7493
7823
|
}
|
|
7494
|
-
}),
|
|
7824
|
+
}), An = M.create({
|
|
7495
7825
|
name: "textAlignment",
|
|
7496
7826
|
addGlobalAttributes() {
|
|
7497
7827
|
return [
|
|
@@ -7517,7 +7847,7 @@ const Tn = (e) => M.create({
|
|
|
7517
7847
|
}
|
|
7518
7848
|
];
|
|
7519
7849
|
}
|
|
7520
|
-
}),
|
|
7850
|
+
}), Nn = M.create({
|
|
7521
7851
|
name: "blockTextColor",
|
|
7522
7852
|
addGlobalAttributes() {
|
|
7523
7853
|
return [
|
|
@@ -7525,9 +7855,9 @@ const Tn = (e) => M.create({
|
|
|
7525
7855
|
types: ["blockContainer"],
|
|
7526
7856
|
attributes: {
|
|
7527
7857
|
textColor: {
|
|
7528
|
-
default:
|
|
7529
|
-
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") :
|
|
7530
|
-
renderHTML: (e) => e.textColor !==
|
|
7858
|
+
default: _.textColor.default,
|
|
7859
|
+
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") : _.textColor.default,
|
|
7860
|
+
renderHTML: (e) => e.textColor !== _.textColor.default && {
|
|
7531
7861
|
"data-text-color": e.textColor
|
|
7532
7862
|
}
|
|
7533
7863
|
}
|
|
@@ -7535,7 +7865,7 @@ const Tn = (e) => M.create({
|
|
|
7535
7865
|
}
|
|
7536
7866
|
];
|
|
7537
7867
|
}
|
|
7538
|
-
}),
|
|
7868
|
+
}), Pn = M.create({
|
|
7539
7869
|
name: "trailingNode",
|
|
7540
7870
|
addProseMirrorPlugins() {
|
|
7541
7871
|
const e = new S(this.name);
|
|
@@ -7570,8 +7900,8 @@ const Tn = (e) => M.create({
|
|
|
7570
7900
|
})
|
|
7571
7901
|
];
|
|
7572
7902
|
}
|
|
7573
|
-
}),
|
|
7574
|
-
key:
|
|
7903
|
+
}), Hn = new S("non-editable-block"), Un = () => new y({
|
|
7904
|
+
key: Hn,
|
|
7575
7905
|
props: {
|
|
7576
7906
|
handleKeyDown: (e, t) => {
|
|
7577
7907
|
if ("node" in e.state.selection) {
|
|
@@ -7596,7 +7926,7 @@ const Tn = (e) => M.create({
|
|
|
7596
7926
|
return !1;
|
|
7597
7927
|
}
|
|
7598
7928
|
}
|
|
7599
|
-
}),
|
|
7929
|
+
}), $e = new S("previous-blocks"), Dn = {
|
|
7600
7930
|
// Numbered List Items
|
|
7601
7931
|
index: "index",
|
|
7602
7932
|
// Headings
|
|
@@ -7605,17 +7935,17 @@ const Tn = (e) => M.create({
|
|
|
7605
7935
|
type: "type",
|
|
7606
7936
|
depth: "depth",
|
|
7607
7937
|
"depth-change": "depth-change"
|
|
7608
|
-
},
|
|
7938
|
+
}, Vn = () => {
|
|
7609
7939
|
let e;
|
|
7610
7940
|
return new y({
|
|
7611
|
-
key:
|
|
7941
|
+
key: $e,
|
|
7612
7942
|
view(t) {
|
|
7613
7943
|
return {
|
|
7614
7944
|
update: async (o, i) => {
|
|
7615
7945
|
var n;
|
|
7616
7946
|
((n = this.key) == null ? void 0 : n.getState(o.state).updatedBlocks.size) > 0 && (e = setTimeout(() => {
|
|
7617
7947
|
o.dispatch(
|
|
7618
|
-
o.state.tr.setMeta(
|
|
7948
|
+
o.state.tr.setMeta($e, { clearUpdate: !0 })
|
|
7619
7949
|
);
|
|
7620
7950
|
}, 0));
|
|
7621
7951
|
},
|
|
@@ -7644,19 +7974,19 @@ const Tn = (e) => M.create({
|
|
|
7644
7974
|
for (const d of l) {
|
|
7645
7975
|
const u = s.get(d.node.attrs.id), p = u == null ? void 0 : u.node.firstChild, h = d.node.firstChild;
|
|
7646
7976
|
if (u && p && h) {
|
|
7647
|
-
const
|
|
7977
|
+
const f = {
|
|
7648
7978
|
index: h.attrs.index,
|
|
7649
7979
|
level: h.attrs.level,
|
|
7650
7980
|
type: h.type.name,
|
|
7651
7981
|
depth: n.doc.resolve(d.pos).depth
|
|
7652
7982
|
};
|
|
7653
|
-
let
|
|
7983
|
+
let m = {
|
|
7654
7984
|
index: p.attrs.index,
|
|
7655
7985
|
level: p.attrs.level,
|
|
7656
7986
|
type: p.type.name,
|
|
7657
7987
|
depth: i.doc.resolve(u.pos).depth
|
|
7658
7988
|
};
|
|
7659
|
-
r[d.node.attrs.id] =
|
|
7989
|
+
r[d.node.attrs.id] = m, t.getMeta("numberedListIndexing") && (d.node.attrs.id in o.prevTransactionOldBlockAttrs && (m = o.prevTransactionOldBlockAttrs[d.node.attrs.id]), f.type === "numberedListItem" && (m.index = f.index)), o.currentTransactionOldBlockAttrs[d.node.attrs.id] = m, JSON.stringify(m) !== JSON.stringify(f) && (m["depth-change"] = m.depth - f.depth, o.updatedBlocks.add(d.node.attrs.id));
|
|
7660
7990
|
}
|
|
7661
7991
|
}
|
|
7662
7992
|
return o.prevTransactionOldBlockAttrs = r, o;
|
|
@@ -7673,7 +8003,7 @@ const Tn = (e) => M.create({
|
|
|
7673
8003
|
return;
|
|
7674
8004
|
const a = o.currentTransactionOldBlockAttrs[n.attrs.id], s = {};
|
|
7675
8005
|
for (const [d, u] of Object.entries(a))
|
|
7676
|
-
s["data-prev-" +
|
|
8006
|
+
s["data-prev-" + Dn[d]] = u || "none";
|
|
7677
8007
|
const l = W.node(r, r + n.nodeSize, {
|
|
7678
8008
|
...s
|
|
7679
8009
|
});
|
|
@@ -7682,13 +8012,13 @@ const Tn = (e) => M.create({
|
|
|
7682
8012
|
}
|
|
7683
8013
|
}
|
|
7684
8014
|
});
|
|
7685
|
-
},
|
|
8015
|
+
}, Rn = {
|
|
7686
8016
|
blockColor: "data-block-color",
|
|
7687
8017
|
blockStyle: "data-block-style",
|
|
7688
8018
|
id: "data-id",
|
|
7689
8019
|
depth: "data-depth",
|
|
7690
8020
|
depthChange: "data-depth-change"
|
|
7691
|
-
},
|
|
8021
|
+
}, On = $.create({
|
|
7692
8022
|
name: "blockContainer",
|
|
7693
8023
|
group: "blockContainer",
|
|
7694
8024
|
// A block always contains content, and optionally a blockGroup which contains nested blocks
|
|
@@ -7704,7 +8034,7 @@ const Tn = (e) => M.create({
|
|
|
7704
8034
|
if (typeof e == "string")
|
|
7705
8035
|
return !1;
|
|
7706
8036
|
const t = {};
|
|
7707
|
-
for (const [o, i] of Object.entries(
|
|
8037
|
+
for (const [o, i] of Object.entries(Rn))
|
|
7708
8038
|
e.getAttribute(i) && (t[o] = e.getAttribute(i));
|
|
7709
8039
|
return e.getAttribute("data-node-type") === "blockContainer" ? t : !1;
|
|
7710
8040
|
}
|
|
@@ -7738,7 +8068,7 @@ const Tn = (e) => M.create({
|
|
|
7738
8068
|
},
|
|
7739
8069
|
// Deletes a block at a given position.
|
|
7740
8070
|
BNDeleteBlock: (e) => ({ state: t, dispatch: o }) => {
|
|
7741
|
-
const i =
|
|
8071
|
+
const i = k(t.doc, e);
|
|
7742
8072
|
if (i === void 0)
|
|
7743
8073
|
return !1;
|
|
7744
8074
|
const { startPos: n, endPos: r } = i;
|
|
@@ -7746,17 +8076,17 @@ const Tn = (e) => M.create({
|
|
|
7746
8076
|
},
|
|
7747
8077
|
// Updates a block at a given position.
|
|
7748
8078
|
BNUpdateBlock: (e, t) => ({ state: o, dispatch: i }) => {
|
|
7749
|
-
const n =
|
|
8079
|
+
const n = k(o.doc, e);
|
|
7750
8080
|
if (n === void 0)
|
|
7751
8081
|
return !1;
|
|
7752
8082
|
const { startPos: r, endPos: a, node: s, contentNode: l } = n;
|
|
7753
8083
|
if (i) {
|
|
7754
8084
|
if (t.children !== void 0) {
|
|
7755
8085
|
const h = [];
|
|
7756
|
-
for (const
|
|
8086
|
+
for (const f of t.children)
|
|
7757
8087
|
h.push(
|
|
7758
8088
|
P(
|
|
7759
|
-
|
|
8089
|
+
f,
|
|
7760
8090
|
o.schema,
|
|
7761
8091
|
this.options.editor.schema.styleSchema
|
|
7762
8092
|
)
|
|
@@ -7774,13 +8104,13 @@ const Tn = (e) => M.create({
|
|
|
7774
8104
|
let p = "keep";
|
|
7775
8105
|
if (t.content)
|
|
7776
8106
|
if (typeof t.content == "string")
|
|
7777
|
-
p =
|
|
8107
|
+
p = K(
|
|
7778
8108
|
[t.content],
|
|
7779
8109
|
o.schema,
|
|
7780
8110
|
this.options.editor.schema.styleSchema
|
|
7781
8111
|
);
|
|
7782
8112
|
else if (Array.isArray(t.content))
|
|
7783
|
-
p =
|
|
8113
|
+
p = K(
|
|
7784
8114
|
t.content,
|
|
7785
8115
|
o.schema,
|
|
7786
8116
|
this.options.editor.schema.styleSchema
|
|
@@ -7794,8 +8124,8 @@ const Tn = (e) => M.create({
|
|
|
7794
8124
|
else
|
|
7795
8125
|
throw new I(t.content.type);
|
|
7796
8126
|
else {
|
|
7797
|
-
const h = o.schema.nodes[d].spec.content,
|
|
7798
|
-
h === "" ||
|
|
8127
|
+
const h = o.schema.nodes[d].spec.content, f = o.schema.nodes[u].spec.content;
|
|
8128
|
+
h === "" || f !== h && (p = []);
|
|
7799
8129
|
}
|
|
7800
8130
|
p === "keep" ? o.tr.setNodeMarkup(
|
|
7801
8131
|
r,
|
|
@@ -7849,19 +8179,19 @@ const Tn = (e) => M.create({
|
|
|
7849
8179
|
const i = t.doc.resolve(e + 1).node().type.name === "blockContainer", n = t.doc.resolve(e - 1).node().type.name === "blockContainer";
|
|
7850
8180
|
if (!i || !n)
|
|
7851
8181
|
return !1;
|
|
7852
|
-
const r =
|
|
8182
|
+
const r = k(
|
|
7853
8183
|
t.doc,
|
|
7854
8184
|
e + 1
|
|
7855
8185
|
), { node: a, contentNode: s, startPos: l, endPos: d, depth: u } = r;
|
|
7856
8186
|
if (a.childCount === 2) {
|
|
7857
|
-
const
|
|
8187
|
+
const f = t.doc.resolve(
|
|
7858
8188
|
l + s.nodeSize + 1
|
|
7859
|
-
),
|
|
8189
|
+
), m = t.doc.resolve(d - 1), g = f.blockRange(m);
|
|
7860
8190
|
o && t.tr.lift(g, u - 1);
|
|
7861
8191
|
}
|
|
7862
|
-
let p = e - 1, h =
|
|
8192
|
+
let p = e - 1, h = k(t.doc, p);
|
|
7863
8193
|
for (; h.numChildBlocks > 0; )
|
|
7864
|
-
if (p--, h =
|
|
8194
|
+
if (p--, h = k(t.doc, p), h === void 0)
|
|
7865
8195
|
return !1;
|
|
7866
8196
|
return o && (o(
|
|
7867
8197
|
t.tr.deleteRange(l, l + s.nodeSize).replace(
|
|
@@ -7880,11 +8210,11 @@ const Tn = (e) => M.create({
|
|
|
7880
8210
|
// - `keepProps` is usually true when `keepType` is true, except for when
|
|
7881
8211
|
// creating new list item blocks with Enter.
|
|
7882
8212
|
BNSplitBlock: (e, t, o) => ({ state: i, dispatch: n }) => {
|
|
7883
|
-
const r =
|
|
8213
|
+
const r = k(i.doc, e);
|
|
7884
8214
|
if (r === void 0)
|
|
7885
8215
|
return !1;
|
|
7886
|
-
const { contentNode: a, contentType: s, startPos: l, endPos: d, depth: u } = r, p = i.doc.cut(l + 1, e), h = i.doc.cut(e, d - 1),
|
|
7887
|
-
return n && (i.tr.insert(
|
|
8216
|
+
const { contentNode: a, contentType: s, startPos: l, endPos: d, depth: u } = r, p = i.doc.cut(l + 1, e), h = i.doc.cut(e, d - 1), f = i.schema.nodes.blockContainer.createAndFill(), m = d + 1, g = m + 2;
|
|
8217
|
+
return n && (i.tr.insert(m, f), i.tr.replace(
|
|
7888
8218
|
g,
|
|
7889
8219
|
g + 1,
|
|
7890
8220
|
h.content.size > 0 ? new D(
|
|
@@ -7912,7 +8242,7 @@ const Tn = (e) => M.create({
|
|
|
7912
8242
|
};
|
|
7913
8243
|
},
|
|
7914
8244
|
addProseMirrorPlugins() {
|
|
7915
|
-
return [
|
|
8245
|
+
return [Vn(), Un()];
|
|
7916
8246
|
},
|
|
7917
8247
|
addKeyboardShortcuts() {
|
|
7918
8248
|
return {
|
|
@@ -7923,7 +8253,7 @@ const Tn = (e) => M.create({
|
|
|
7923
8253
|
() => i.undoInputRule(),
|
|
7924
8254
|
// Reverts block content type to a paragraph if the selection is at the start of the block.
|
|
7925
8255
|
() => i.command(({ state: n }) => {
|
|
7926
|
-
const { contentType: r, startPos: a } =
|
|
8256
|
+
const { contentType: r, startPos: a } = k(
|
|
7927
8257
|
n.doc,
|
|
7928
8258
|
n.selection.from
|
|
7929
8259
|
), s = n.selection.from === a + 1, l = r.name === "paragraph";
|
|
@@ -7934,7 +8264,7 @@ const Tn = (e) => M.create({
|
|
|
7934
8264
|
}),
|
|
7935
8265
|
// Removes a level of nesting if the block is indented if the selection is at the start of the block.
|
|
7936
8266
|
() => i.command(({ state: n }) => {
|
|
7937
|
-
const { startPos: r } =
|
|
8267
|
+
const { startPos: r } = k(
|
|
7938
8268
|
n.doc,
|
|
7939
8269
|
n.selection.from
|
|
7940
8270
|
);
|
|
@@ -7943,7 +8273,7 @@ const Tn = (e) => M.create({
|
|
|
7943
8273
|
// Merges block with the previous one if it isn't indented, isn't the first block in the doc, and the selection
|
|
7944
8274
|
// is at the start of the block.
|
|
7945
8275
|
() => i.command(({ state: n }) => {
|
|
7946
|
-
const { depth: r, startPos: a } =
|
|
8276
|
+
const { depth: r, startPos: a } = k(
|
|
7947
8277
|
n.doc,
|
|
7948
8278
|
n.selection.from
|
|
7949
8279
|
), s = n.selection.from === a + 1, l = n.selection.empty, d = a === 2, u = a - 1;
|
|
@@ -7957,15 +8287,15 @@ const Tn = (e) => M.create({
|
|
|
7957
8287
|
// if one exists, the block has no children, and the selection is at the
|
|
7958
8288
|
// end of the block.
|
|
7959
8289
|
() => i.command(({ state: n }) => {
|
|
7960
|
-
const { node: r, depth: a, endPos: s } =
|
|
8290
|
+
const { node: r, depth: a, endPos: s } = k(
|
|
7961
8291
|
n.doc,
|
|
7962
8292
|
n.selection.from
|
|
7963
8293
|
), l = s === n.doc.nodeSize - 4, d = n.selection.from === s - 1, u = n.selection.empty, p = r.childCount === 2;
|
|
7964
8294
|
if (!l && d && u && !p) {
|
|
7965
|
-
let h = a,
|
|
7966
|
-
for (;
|
|
7967
|
-
h =
|
|
7968
|
-
return i.BNMergeBlocks(
|
|
8295
|
+
let h = a, f = s + 2, m = n.doc.resolve(f).depth;
|
|
8296
|
+
for (; m < h; )
|
|
8297
|
+
h = m, f += 2, m = n.doc.resolve(f).depth;
|
|
8298
|
+
return i.BNMergeBlocks(f - 1);
|
|
7969
8299
|
}
|
|
7970
8300
|
return !1;
|
|
7971
8301
|
})
|
|
@@ -7974,7 +8304,7 @@ const Tn = (e) => M.create({
|
|
|
7974
8304
|
// Removes a level of nesting if the block is empty & indented, while the selection is also empty & at the start
|
|
7975
8305
|
// of the block.
|
|
7976
8306
|
() => i.command(({ state: n }) => {
|
|
7977
|
-
const { contentNode: r, depth: a } =
|
|
8307
|
+
const { contentNode: r, depth: a } = k(
|
|
7978
8308
|
n.doc,
|
|
7979
8309
|
n.selection.from
|
|
7980
8310
|
), s = n.selection.$anchor.parentOffset === 0, l = n.selection.anchor === n.selection.head, d = r.childCount === 0, u = a > 2;
|
|
@@ -7983,7 +8313,7 @@ const Tn = (e) => M.create({
|
|
|
7983
8313
|
// Creates a new block and moves the selection to it if the current one is empty, while the selection is also
|
|
7984
8314
|
// empty & at the start of the block.
|
|
7985
8315
|
() => i.command(({ state: n, chain: r }) => {
|
|
7986
|
-
const { contentNode: a, endPos: s } =
|
|
8316
|
+
const { contentNode: a, endPos: s } = k(
|
|
7987
8317
|
n.doc,
|
|
7988
8318
|
n.selection.from
|
|
7989
8319
|
), l = n.selection.$anchor.parentOffset === 0, d = n.selection.anchor === n.selection.head, u = a.childCount === 0;
|
|
@@ -7996,7 +8326,7 @@ const Tn = (e) => M.create({
|
|
|
7996
8326
|
// Splits the current block, moving content inside that's after the cursor to a new text block below. Also
|
|
7997
8327
|
// deletes the selection beforehand, if it's not empty.
|
|
7998
8328
|
() => i.command(({ state: n, chain: r }) => {
|
|
7999
|
-
const { contentNode: a } =
|
|
8329
|
+
const { contentNode: a } = k(
|
|
8000
8330
|
n.doc,
|
|
8001
8331
|
n.selection.from
|
|
8002
8332
|
), s = n.selection.$anchor.parentOffset === 0;
|
|
@@ -8019,7 +8349,7 @@ const Tn = (e) => M.create({
|
|
|
8019
8349
|
}
|
|
8020
8350
|
};
|
|
8021
8351
|
}
|
|
8022
|
-
}),
|
|
8352
|
+
}), jn = $.create({
|
|
8023
8353
|
name: "blockGroup",
|
|
8024
8354
|
group: "blockGroup",
|
|
8025
8355
|
content: "blockContainer+",
|
|
@@ -8048,11 +8378,11 @@ const Tn = (e) => M.create({
|
|
|
8048
8378
|
contentDOM: o
|
|
8049
8379
|
};
|
|
8050
8380
|
}
|
|
8051
|
-
}),
|
|
8381
|
+
}), zn = $.create({
|
|
8052
8382
|
name: "doc",
|
|
8053
8383
|
topNode: !0,
|
|
8054
8384
|
content: "blockGroup"
|
|
8055
|
-
}),
|
|
8385
|
+
}), Fn = (e) => {
|
|
8056
8386
|
var i;
|
|
8057
8387
|
const t = [
|
|
8058
8388
|
J.ClipboardTextSerializer,
|
|
@@ -8079,9 +8409,9 @@ const Tn = (e) => M.create({
|
|
|
8079
8409
|
}
|
|
8080
8410
|
}),
|
|
8081
8411
|
...Object.values(e.styleSpecs).map((n) => n.implementation.mark),
|
|
8082
|
-
|
|
8083
|
-
Ln,
|
|
8412
|
+
Nn,
|
|
8084
8413
|
In,
|
|
8414
|
+
An,
|
|
8085
8415
|
// make sure escape blurs editor, so that we can tab to other elements in the host page (accessibility)
|
|
8086
8416
|
M.create({
|
|
8087
8417
|
name: "OverrideEscape",
|
|
@@ -8092,12 +8422,12 @@ const Tn = (e) => M.create({
|
|
|
8092
8422
|
}
|
|
8093
8423
|
}),
|
|
8094
8424
|
// nodes
|
|
8095
|
-
|
|
8096
|
-
|
|
8425
|
+
zn,
|
|
8426
|
+
On.configure({
|
|
8097
8427
|
editor: e.editor,
|
|
8098
8428
|
domAttributes: e.domAttributes
|
|
8099
8429
|
}),
|
|
8100
|
-
|
|
8430
|
+
jn.configure({
|
|
8101
8431
|
domAttributes: e.domAttributes
|
|
8102
8432
|
}),
|
|
8103
8433
|
...Object.values(e.inlineContentSpecs).filter((n) => n.config !== "link" && n.config !== "text").map((n) => n.implementation.node.configure({
|
|
@@ -8117,13 +8447,13 @@ const Tn = (e) => M.create({
|
|
|
8117
8447
|
domAttributes: e.domAttributes
|
|
8118
8448
|
})
|
|
8119
8449
|
]),
|
|
8120
|
-
|
|
8121
|
-
Tn(e.editor),
|
|
8450
|
+
Sn(e.editor),
|
|
8122
8451
|
Bn(e.editor),
|
|
8452
|
+
Ln(e.editor),
|
|
8123
8453
|
lo.configure({ width: 5, color: "#ddeeff" }),
|
|
8124
8454
|
// This needs to be at the bottom of this list, because Key events (such as enter, when selecting a /command),
|
|
8125
8455
|
// should be handled before Enter handlers in other components like splitListItem
|
|
8126
|
-
...e.trailingBlock === void 0 || e.trailingBlock ? [
|
|
8456
|
+
...e.trailingBlock === void 0 || e.trailingBlock ? [Pn] : []
|
|
8127
8457
|
];
|
|
8128
8458
|
if (e.collaboration) {
|
|
8129
8459
|
if (t.push(
|
|
@@ -8152,20 +8482,20 @@ const Tn = (e) => M.create({
|
|
|
8152
8482
|
const o = e.disableExtensions || [];
|
|
8153
8483
|
return t.filter((n) => !o.includes(n.name));
|
|
8154
8484
|
};
|
|
8155
|
-
function
|
|
8485
|
+
function Gn(e, t) {
|
|
8156
8486
|
const o = [];
|
|
8157
8487
|
return e.forEach((i, n, r) => {
|
|
8158
8488
|
r !== t && o.push(i);
|
|
8159
8489
|
}), L.from(o);
|
|
8160
8490
|
}
|
|
8161
|
-
function
|
|
8491
|
+
function Wn(e, t) {
|
|
8162
8492
|
let o = L.from(e.content);
|
|
8163
8493
|
for (let i = 0; i < o.childCount; i++)
|
|
8164
8494
|
if (o.child(i).type.spec.group === "blockContent") {
|
|
8165
8495
|
const n = [o.child(i)];
|
|
8166
8496
|
if (i + 1 < o.childCount && o.child(i + 1).type.spec.group === "blockGroup") {
|
|
8167
8497
|
const a = o.child(i + 1).child(0).child(0);
|
|
8168
|
-
(a.type.name === "bulletListItem" || a.type.name === "numberedListItem" || a.type.name === "checkListItem") && (n.push(o.child(i + 1)), o =
|
|
8498
|
+
(a.type.name === "bulletListItem" || a.type.name === "numberedListItem" || a.type.name === "checkListItem") && (n.push(o.child(i + 1)), o = Gn(o, i + 1));
|
|
8169
8499
|
}
|
|
8170
8500
|
const r = t.state.schema.nodes.blockContainer.create(
|
|
8171
8501
|
void 0,
|
|
@@ -8200,7 +8530,7 @@ class Le {
|
|
|
8200
8530
|
return new Le(t);
|
|
8201
8531
|
}
|
|
8202
8532
|
}
|
|
8203
|
-
class
|
|
8533
|
+
class Kn extends Ot {
|
|
8204
8534
|
constructor(o, i) {
|
|
8205
8535
|
super({ ...o, content: void 0 });
|
|
8206
8536
|
c(this, "_state");
|
|
@@ -8280,7 +8610,7 @@ class Wn extends Ot {
|
|
|
8280
8610
|
});
|
|
8281
8611
|
}
|
|
8282
8612
|
}
|
|
8283
|
-
const $n = new S("blocknote-placeholder"),
|
|
8613
|
+
const $n = new S("blocknote-placeholder"), qn = (e, t) => new y({
|
|
8284
8614
|
key: $n,
|
|
8285
8615
|
view: () => {
|
|
8286
8616
|
const o = document.createElement("style"), i = e._tiptapEditor.options.injectNonce;
|
|
@@ -8326,7 +8656,7 @@ const $n = new S("blocknote-placeholder"), Kn = (e, t) => new y({
|
|
|
8326
8656
|
}
|
|
8327
8657
|
}
|
|
8328
8658
|
});
|
|
8329
|
-
const
|
|
8659
|
+
const Xn = {
|
|
8330
8660
|
enableInputRules: !0,
|
|
8331
8661
|
enablePasteRules: !0,
|
|
8332
8662
|
enableCoreExtensions: !1
|
|
@@ -8348,7 +8678,7 @@ class vt {
|
|
|
8348
8678
|
c(this, "tableHandles");
|
|
8349
8679
|
c(this, "uploadFile");
|
|
8350
8680
|
c(this, "resolveFileUrl");
|
|
8351
|
-
var l, d, u, p, h,
|
|
8681
|
+
var l, d, u, p, h, f, m;
|
|
8352
8682
|
this.options = t;
|
|
8353
8683
|
const o = t;
|
|
8354
8684
|
if (o.onEditorContentChange)
|
|
@@ -8377,8 +8707,8 @@ class vt {
|
|
|
8377
8707
|
...t.placeholders
|
|
8378
8708
|
}
|
|
8379
8709
|
};
|
|
8380
|
-
this.schema = i.schema, this.blockImplementations = i.schema.blockSpecs, this.inlineContentImplementations = i.schema.inlineContentSpecs, this.styleImplementations = i.schema.styleSpecs, this.formattingToolbar = new
|
|
8381
|
-
const n =
|
|
8710
|
+
this.schema = i.schema, this.blockImplementations = i.schema.blockSpecs, this.inlineContentImplementations = i.schema.inlineContentSpecs, this.styleImplementations = i.schema.styleSpecs, this.formattingToolbar = new ln(this), this.linkToolbar = new un(this), this.sideMenu = new yn(this), this.suggestionMenus = new mn(this), this.filePanel = new rn(this), E("table", this) && (this.tableHandles = new Cn(this));
|
|
8711
|
+
const n = Fn({
|
|
8382
8712
|
editor: this,
|
|
8383
8713
|
domAttributes: i.domAttributes || {},
|
|
8384
8714
|
blockSchema: this.schema.blockSchema,
|
|
@@ -8397,7 +8727,7 @@ class vt {
|
|
|
8397
8727
|
this.suggestionMenus.plugin,
|
|
8398
8728
|
...this.filePanel ? [this.filePanel.plugin] : [],
|
|
8399
8729
|
...this.tableHandles ? [this.tableHandles.plugin] : [],
|
|
8400
|
-
|
|
8730
|
+
qn(this, i.placeholders)
|
|
8401
8731
|
]
|
|
8402
8732
|
});
|
|
8403
8733
|
n.push(r), this.uploadFile = i.uploadFile, this.resolveFileUrl = i.resolveFileUrl || (async (g) => g), i.collaboration && i.initialContent && console.warn(
|
|
@@ -8419,7 +8749,7 @@ class vt {
|
|
|
8419
8749
|
"initialContent must be a non-empty array of blocks, received: " + a
|
|
8420
8750
|
);
|
|
8421
8751
|
const s = {
|
|
8422
|
-
...
|
|
8752
|
+
...Xn,
|
|
8423
8753
|
...i._tiptapOptions,
|
|
8424
8754
|
content: a,
|
|
8425
8755
|
extensions: [
|
|
@@ -8434,13 +8764,13 @@ class vt {
|
|
|
8434
8764
|
class: R(
|
|
8435
8765
|
"bn-editor",
|
|
8436
8766
|
i.defaultStyles ? "bn-default-styles" : "",
|
|
8437
|
-
((
|
|
8767
|
+
((m = (f = i.domAttributes) == null ? void 0 : f.editor) == null ? void 0 : m.class) || ""
|
|
8438
8768
|
)
|
|
8439
8769
|
},
|
|
8440
|
-
transformPasted:
|
|
8770
|
+
transformPasted: Wn
|
|
8441
8771
|
}
|
|
8442
8772
|
};
|
|
8443
|
-
this._tiptapEditor = new
|
|
8773
|
+
this._tiptapEditor = new Kn(
|
|
8444
8774
|
s,
|
|
8445
8775
|
this.schema.styleSchema
|
|
8446
8776
|
);
|
|
@@ -8545,7 +8875,7 @@ class vt {
|
|
|
8545
8875
|
* @returns A snapshot of the current text cursor position.
|
|
8546
8876
|
*/
|
|
8547
8877
|
getTextCursorPosition() {
|
|
8548
|
-
const { node: t, depth: o, startPos: i, endPos: n } =
|
|
8878
|
+
const { node: t, depth: o, startPos: i, endPos: n } = k(
|
|
8549
8879
|
this._tiptapEditor.state.doc,
|
|
8550
8880
|
this._tiptapEditor.state.selection.from
|
|
8551
8881
|
), r = this._tiptapEditor.state.doc.resolve(n).index(o - 1), a = this._tiptapEditor.state.doc.resolve(n + 1).node().childCount;
|
|
@@ -8583,7 +8913,7 @@ class vt {
|
|
|
8583
8913
|
* @param placement Whether the text cursor should be placed at the start or end of the block.
|
|
8584
8914
|
*/
|
|
8585
8915
|
setTextCursorPosition(t, o = "start") {
|
|
8586
|
-
const i = typeof t == "string" ? t : t.id, { posBeforeNode: n } = Me(i, this._tiptapEditor.state.doc), { startPos: r, contentNode: a } =
|
|
8916
|
+
const i = typeof t == "string" ? t : t.id, { posBeforeNode: n } = Me(i, this._tiptapEditor.state.doc), { startPos: r, contentNode: a } = k(
|
|
8587
8917
|
this._tiptapEditor.state.doc,
|
|
8588
8918
|
n + 2
|
|
8589
8919
|
), s = this.schema.blockSchema[a.type.name].content;
|
|
@@ -8642,7 +8972,7 @@ class vt {
|
|
|
8642
8972
|
* `referenceBlock`. Inserts the blocks at the start of the existing block's children if "nested" is used.
|
|
8643
8973
|
*/
|
|
8644
8974
|
insertBlocks(t, o, i = "before") {
|
|
8645
|
-
return
|
|
8975
|
+
return zi(t, o, i, this);
|
|
8646
8976
|
}
|
|
8647
8977
|
/**
|
|
8648
8978
|
* Updates an existing block in the editor. Since updatedBlock is a PartialBlock object, some fields might not be
|
|
@@ -8652,14 +8982,14 @@ class vt {
|
|
|
8652
8982
|
* @param update A partial block which defines how the existing block should be changed.
|
|
8653
8983
|
*/
|
|
8654
8984
|
updateBlock(t, o) {
|
|
8655
|
-
return
|
|
8985
|
+
return Fi(t, o, this);
|
|
8656
8986
|
}
|
|
8657
8987
|
/**
|
|
8658
8988
|
* Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
|
|
8659
8989
|
* @param blocksToRemove An array of identifiers for existing blocks that should be removed.
|
|
8660
8990
|
*/
|
|
8661
8991
|
removeBlocks(t) {
|
|
8662
|
-
return
|
|
8992
|
+
return Gi(t, this);
|
|
8663
8993
|
}
|
|
8664
8994
|
/**
|
|
8665
8995
|
* Replaces existing blocks in the editor with new blocks. If the blocks that should be removed are not adjacent or
|
|
@@ -8669,7 +8999,7 @@ class vt {
|
|
|
8669
8999
|
* @param blocksToInsert An array of partial blocks to replace the old ones with.
|
|
8670
9000
|
*/
|
|
8671
9001
|
replaceBlocks(t, o) {
|
|
8672
|
-
return
|
|
9002
|
+
return Wi(t, o, this);
|
|
8673
9003
|
}
|
|
8674
9004
|
/**
|
|
8675
9005
|
* Insert a piece of content at the current cursor position.
|
|
@@ -8677,12 +9007,12 @@ class vt {
|
|
|
8677
9007
|
* @param content can be a string, or array of partial inline content elements
|
|
8678
9008
|
*/
|
|
8679
9009
|
insertInlineContent(t) {
|
|
8680
|
-
const o =
|
|
9010
|
+
const o = K(
|
|
8681
9011
|
t,
|
|
8682
9012
|
this._tiptapEditor.schema,
|
|
8683
9013
|
this.schema.styleSchema
|
|
8684
9014
|
);
|
|
8685
|
-
|
|
9015
|
+
Ki(
|
|
8686
9016
|
{
|
|
8687
9017
|
from: this._tiptapEditor.state.selection.from,
|
|
8688
9018
|
to: this._tiptapEditor.state.selection.to
|
|
@@ -8782,7 +9112,7 @@ class vt {
|
|
|
8782
9112
|
* Checks if the block containing the text cursor can be nested.
|
|
8783
9113
|
*/
|
|
8784
9114
|
canNestBlock() {
|
|
8785
|
-
const { startPos: t, depth: o } =
|
|
9115
|
+
const { startPos: t, depth: o } = k(
|
|
8786
9116
|
this._tiptapEditor.state.doc,
|
|
8787
9117
|
this._tiptapEditor.state.selection.from
|
|
8788
9118
|
);
|
|
@@ -8798,7 +9128,7 @@ class vt {
|
|
|
8798
9128
|
* Checks if the block containing the text cursor is nested.
|
|
8799
9129
|
*/
|
|
8800
9130
|
canUnnestBlock() {
|
|
8801
|
-
const { depth: t } =
|
|
9131
|
+
const { depth: t } = k(
|
|
8802
9132
|
this._tiptapEditor.state.doc,
|
|
8803
9133
|
this._tiptapEditor.state.selection.from
|
|
8804
9134
|
);
|
|
@@ -8846,7 +9176,7 @@ class vt {
|
|
|
8846
9176
|
* @returns The blocks, serialized as a Markdown string.
|
|
8847
9177
|
*/
|
|
8848
9178
|
async blocksToMarkdownLossy(t = this.document) {
|
|
8849
|
-
return
|
|
9179
|
+
return Xi(t, this._tiptapEditor.schema, this);
|
|
8850
9180
|
}
|
|
8851
9181
|
/**
|
|
8852
9182
|
* Creates a list of blocks from a Markdown string. Tries to create `Block` and `InlineNode` objects based on
|
|
@@ -8856,7 +9186,7 @@ class vt {
|
|
|
8856
9186
|
* @returns The blocks parsed from the Markdown string.
|
|
8857
9187
|
*/
|
|
8858
9188
|
async tryParseMarkdownToBlocks(t) {
|
|
8859
|
-
return
|
|
9189
|
+
return on(
|
|
8860
9190
|
t,
|
|
8861
9191
|
this.schema.blockSchema,
|
|
8862
9192
|
this.schema.inlineContentSchema,
|
|
@@ -8922,7 +9252,7 @@ function xt(e) {
|
|
|
8922
9252
|
content: xt(t.content)
|
|
8923
9253
|
}) : e;
|
|
8924
9254
|
}
|
|
8925
|
-
function
|
|
9255
|
+
function qr(e, t) {
|
|
8926
9256
|
return t.map(
|
|
8927
9257
|
(o) => Et(e, o)
|
|
8928
9258
|
);
|
|
@@ -8946,51 +9276,51 @@ function Et(e, t) {
|
|
|
8946
9276
|
children: o.children.map((i) => Et(e, i))
|
|
8947
9277
|
};
|
|
8948
9278
|
}
|
|
8949
|
-
function Xn(e) {
|
|
8950
|
-
e.id || (e.id = oe.options.generateID()), e.children && Zn(e.children);
|
|
8951
|
-
}
|
|
8952
9279
|
function Zn(e) {
|
|
9280
|
+
e.id || (e.id = oe.options.generateID()), e.children && Jn(e.children);
|
|
9281
|
+
}
|
|
9282
|
+
function Jn(e) {
|
|
8953
9283
|
for (const t of e)
|
|
8954
|
-
|
|
9284
|
+
Zn(t);
|
|
8955
9285
|
}
|
|
8956
9286
|
export {
|
|
8957
|
-
|
|
9287
|
+
pi as AudioBlock,
|
|
8958
9288
|
vt as BlockNoteEditor,
|
|
8959
9289
|
Le as BlockNoteSchema,
|
|
8960
|
-
|
|
8961
|
-
|
|
8962
|
-
|
|
8963
|
-
|
|
8964
|
-
|
|
8965
|
-
|
|
8966
|
-
|
|
8967
|
-
|
|
8968
|
-
|
|
8969
|
-
|
|
8970
|
-
|
|
8971
|
-
|
|
9290
|
+
qo as FileBlock,
|
|
9291
|
+
rn as FilePanelProsemirrorPlugin,
|
|
9292
|
+
nn as FilePanelView,
|
|
9293
|
+
ln as FormattingToolbarProsemirrorPlugin,
|
|
9294
|
+
an as FormattingToolbarView,
|
|
9295
|
+
ei as ImageBlock,
|
|
9296
|
+
un as LinkToolbarProsemirrorPlugin,
|
|
9297
|
+
yn as SideMenuProsemirrorPlugin,
|
|
9298
|
+
kn as SideMenuView,
|
|
9299
|
+
mn as SuggestionMenuProseMirrorPlugin,
|
|
9300
|
+
Cn as TableHandlesProsemirrorPlugin,
|
|
9301
|
+
En as TableHandlesView,
|
|
8972
9302
|
oe as UniqueID,
|
|
8973
9303
|
I as UnreachableCaseError,
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
9304
|
+
ai as VideoBlock,
|
|
9305
|
+
Zn as addIdsToBlock,
|
|
9306
|
+
Jn as addIdsToBlocks,
|
|
9307
|
+
Ho as addInlineContentAttributes,
|
|
9308
|
+
Uo as addInlineContentKeyboardShortcuts,
|
|
9309
|
+
jo as addStyleAttributes,
|
|
9310
|
+
Nr as assertEmpty,
|
|
9311
|
+
li as audioBlockConfig,
|
|
9312
|
+
ci as audioParse,
|
|
9313
|
+
si as audioPropSchema,
|
|
9314
|
+
di as audioRender,
|
|
9315
|
+
ui as audioToExternalHTML,
|
|
8986
9316
|
P as blockToNode,
|
|
8987
9317
|
re as camelToDataKebab,
|
|
8988
|
-
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
|
|
8992
|
-
|
|
8993
|
-
|
|
9318
|
+
Gr as checkBlockHasDefaultProp,
|
|
9319
|
+
Oi as checkBlockIsDefaultType,
|
|
9320
|
+
jr as checkBlockIsFileBlock,
|
|
9321
|
+
Fr as checkBlockIsFileBlockWithPlaceholder,
|
|
9322
|
+
zr as checkBlockIsFileBlockWithPreview,
|
|
9323
|
+
ji as checkBlockTypeHasDefaultProp,
|
|
8994
9324
|
E as checkDefaultBlockTypeInSchema,
|
|
8995
9325
|
Ee as contentNodeToInlineContent,
|
|
8996
9326
|
de as createAddFileButton,
|
|
@@ -9000,59 +9330,59 @@ export {
|
|
|
9000
9330
|
ae as createExternalHTMLExporter,
|
|
9001
9331
|
Ce as createFigureWithCaption,
|
|
9002
9332
|
j as createFileAndCaptionWrapper,
|
|
9003
|
-
|
|
9004
|
-
|
|
9333
|
+
Ur as createInlineContentSpec,
|
|
9334
|
+
Vo as createInlineContentSpecFromTipTapNode,
|
|
9005
9335
|
lt as createInternalBlockSpec,
|
|
9006
9336
|
rt as createInternalHTMLSerializer,
|
|
9007
|
-
|
|
9337
|
+
Do as createInternalInlineContentSpec,
|
|
9008
9338
|
ut as createInternalStyleSpec,
|
|
9009
9339
|
ue as createLinkWithCaption,
|
|
9010
9340
|
ht as createResizeHandlesWrapper,
|
|
9011
9341
|
z as createStronglyTypedTiptapNode,
|
|
9012
|
-
|
|
9342
|
+
Dr as createStyleSpec,
|
|
9013
9343
|
U as createStyleSpecFromTipTapMark,
|
|
9014
|
-
|
|
9015
|
-
|
|
9344
|
+
Wr as createSuggestionMenu,
|
|
9345
|
+
Ri as defaultBlockSchema,
|
|
9016
9346
|
mt as defaultBlockSpecs,
|
|
9017
|
-
|
|
9347
|
+
Or as defaultInlineContentSchema,
|
|
9018
9348
|
gt as defaultInlineContentSpecs,
|
|
9019
|
-
|
|
9020
|
-
|
|
9349
|
+
_ as defaultProps,
|
|
9350
|
+
Rr as defaultStyleSchema,
|
|
9021
9351
|
ft as defaultStyleSpecs,
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
|
|
9025
|
-
|
|
9352
|
+
Go as fileBlockConfig,
|
|
9353
|
+
Ko as fileParse,
|
|
9354
|
+
Fo as filePropSchema,
|
|
9355
|
+
Wo as fileRender,
|
|
9026
9356
|
$o as fileToExternalHTML,
|
|
9027
|
-
|
|
9357
|
+
Hr as filenameFromURL,
|
|
9028
9358
|
$r as filterSuggestionItems,
|
|
9029
9359
|
H as formatKeyboardShortcut,
|
|
9030
|
-
|
|
9031
|
-
|
|
9032
|
-
|
|
9360
|
+
sn as formattingToolbarPluginKey,
|
|
9361
|
+
No as getBlockFromPos,
|
|
9362
|
+
Fn as getBlockNoteExtensions,
|
|
9033
9363
|
dt as getBlockSchemaFromSpecs,
|
|
9034
|
-
|
|
9364
|
+
Kr as getDefaultSlashMenuItems,
|
|
9035
9365
|
pe as getDraggableBlockFromElement,
|
|
9036
|
-
|
|
9366
|
+
Ro as getInlineContentParseRules,
|
|
9037
9367
|
ct as getInlineContentSchemaFromSpecs,
|
|
9038
|
-
|
|
9039
|
-
|
|
9368
|
+
Po as getParseRules,
|
|
9369
|
+
zo as getStyleParseRules,
|
|
9040
9370
|
pt as getStyleSchemaFromSpecs,
|
|
9041
|
-
|
|
9042
|
-
|
|
9043
|
-
|
|
9044
|
-
|
|
9045
|
-
|
|
9371
|
+
Zo as imageBlockConfig,
|
|
9372
|
+
Yo as imageParse,
|
|
9373
|
+
Xo as imagePropSchema,
|
|
9374
|
+
Jo as imageRender,
|
|
9375
|
+
Qo as imageToExternalHTML,
|
|
9046
9376
|
at as inheritedProps,
|
|
9047
|
-
|
|
9377
|
+
K as inlineContentToNodes,
|
|
9048
9378
|
x as insertOrUpdateBlock,
|
|
9049
|
-
|
|
9379
|
+
Ao as isAppleOS,
|
|
9050
9380
|
Ue as isLinkInlineContent,
|
|
9051
9381
|
Qe as isPartialLinkInlineContent,
|
|
9052
|
-
|
|
9382
|
+
Pr as isSafari,
|
|
9053
9383
|
te as isStyledTextInlineContent,
|
|
9054
|
-
|
|
9055
|
-
|
|
9384
|
+
cn as linkToolbarPluginKey,
|
|
9385
|
+
Ar as locales,
|
|
9056
9386
|
R as mergeCSSClasses,
|
|
9057
9387
|
v as nodeToBlock,
|
|
9058
9388
|
ot as nodeToCustomInlineContent,
|
|
@@ -9060,19 +9390,19 @@ export {
|
|
|
9060
9390
|
ce as parseFigureElement,
|
|
9061
9391
|
Oe as parseImageElement,
|
|
9062
9392
|
Et as partialBlockToBlockForTesting,
|
|
9063
|
-
|
|
9393
|
+
qr as partialBlocksToBlocksForTesting,
|
|
9064
9394
|
st as propsToAttributes,
|
|
9065
|
-
|
|
9066
|
-
|
|
9395
|
+
_n as sideMenuPluginKey,
|
|
9396
|
+
Oo as stylePropsToAttributes,
|
|
9067
9397
|
V as suggestionMenuPluginKey,
|
|
9068
9398
|
et as tableContentToNodes,
|
|
9069
9399
|
Q as tableHandlesPluginKey,
|
|
9070
|
-
|
|
9071
|
-
|
|
9072
|
-
|
|
9073
|
-
|
|
9074
|
-
|
|
9075
|
-
|
|
9400
|
+
Vr as uploadToTmpFilesDotOrg_DEV_ONLY,
|
|
9401
|
+
oi as videoBlockConfig,
|
|
9402
|
+
ni as videoParse,
|
|
9403
|
+
ti as videoPropSchema,
|
|
9404
|
+
ii as videoRender,
|
|
9405
|
+
ri as videoToExternalHTML,
|
|
9076
9406
|
me as wrapInBlockStructure
|
|
9077
9407
|
};
|
|
9078
9408
|
//# sourceMappingURL=blocknote.js.map
|