@novaprose/core 0.5.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +51 -17
  2. package/THIRD_PARTY_NOTICES.md +50 -0
  3. package/dist/{advlist-FH3K3AAQ.js → advlist-K2U3VPH2.js} +3 -3
  4. package/dist/{autolink-IDJWAL2V.js → autolink-XWDTLY37.js} +2 -2
  5. package/dist/{autoresize-4ZEPQCHP.js → autoresize-UB3GOA6D.js} +2 -2
  6. package/dist/{autosave-WODRZ7L6.js → autosave-MWNRUNU3.js} +6 -3
  7. package/dist/autosave-MWNRUNU3.js.map +1 -0
  8. package/dist/{charmap-LWA7TL3K.js → charmap-ADLYOIB3.js} +6 -3
  9. package/dist/charmap-ADLYOIB3.js.map +1 -0
  10. package/dist/{chunk-PHRON5PL.js → chunk-435CRWKA.js} +70 -155
  11. package/dist/chunk-435CRWKA.js.map +1 -0
  12. package/dist/{chunk-2A3IYKPE.js → chunk-46RIM5KP.js} +934 -32
  13. package/dist/chunk-46RIM5KP.js.map +1 -0
  14. package/dist/{chunk-YZPJQB3I.js → chunk-7ON7PR5R.js} +106 -25
  15. package/dist/chunk-7ON7PR5R.js.map +1 -0
  16. package/dist/{chunk-6GWG2BLC.js → chunk-HPLT3XRZ.js} +1 -1
  17. package/dist/chunk-HPLT3XRZ.js.map +1 -0
  18. package/dist/chunk-NPKAIW34.js +239 -0
  19. package/dist/chunk-NPKAIW34.js.map +1 -0
  20. package/dist/{directionality-N62ZB7CF.js → directionality-XOHJFSL6.js} +7 -4
  21. package/dist/directionality-XOHJFSL6.js.map +1 -0
  22. package/dist/{emoticons-WQ3K4J6G.js → emoticons-TP4N4ZGY.js} +6 -3
  23. package/dist/emoticons-TP4N4ZGY.js.map +1 -0
  24. package/dist/index.cjs +1660 -308
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +334 -81
  27. package/dist/index.d.ts +334 -81
  28. package/dist/index.js +223 -34
  29. package/dist/index.js.map +1 -1
  30. package/dist/{insertdatetime-2RZ3UUQE.js → insertdatetime-T4SEMQWP.js} +6 -3
  31. package/dist/insertdatetime-T4SEMQWP.js.map +1 -0
  32. package/dist/{nonbreaking-L6GNDHVO.js → nonbreaking-HG5HV6AL.js} +6 -3
  33. package/dist/nonbreaking-HG5HV6AL.js.map +1 -0
  34. package/dist/{quickbars-TIRY3RH4.js → quickbars-4NU4SIPL.js} +7 -5
  35. package/dist/{quickbars-TIRY3RH4.js.map → quickbars-4NU4SIPL.js.map} +1 -1
  36. package/dist/{revisionhistory-GDTOULKS.js → revisionhistory-3YQPLPLM.js} +9 -6
  37. package/dist/revisionhistory-3YQPLPLM.js.map +1 -0
  38. package/dist/{visualblocks-V4CQ4XMF.js → visualblocks-RTAYJOGR.js} +6 -3
  39. package/dist/visualblocks-RTAYJOGR.js.map +1 -0
  40. package/package.json +3 -2
  41. package/src/style.css +106 -0
  42. package/dist/autosave-WODRZ7L6.js.map +0 -1
  43. package/dist/charmap-LWA7TL3K.js.map +0 -1
  44. package/dist/chunk-2A3IYKPE.js.map +0 -1
  45. package/dist/chunk-6GWG2BLC.js.map +0 -1
  46. package/dist/chunk-PHRON5PL.js.map +0 -1
  47. package/dist/chunk-YZPJQB3I.js.map +0 -1
  48. package/dist/directionality-N62ZB7CF.js.map +0 -1
  49. package/dist/emoticons-WQ3K4J6G.js.map +0 -1
  50. package/dist/insertdatetime-2RZ3UUQE.js.map +0 -1
  51. package/dist/nonbreaking-L6GNDHVO.js.map +0 -1
  52. package/dist/revisionhistory-GDTOULKS.js.map +0 -1
  53. package/dist/visualblocks-V4CQ4XMF.js.map +0 -1
  54. /package/dist/{advlist-FH3K3AAQ.js.map → advlist-K2U3VPH2.js.map} +0 -0
  55. /package/dist/{autolink-IDJWAL2V.js.map → autolink-XWDTLY37.js.map} +0 -0
  56. /package/dist/{autoresize-4ZEPQCHP.js.map → autoresize-UB3GOA6D.js.map} +0 -0
package/dist/index.d.cts CHANGED
@@ -21,6 +21,78 @@ interface AutosaveOptions {
21
21
  retention?: number;
22
22
  }
23
23
 
24
+ type BlockTag = 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'blockquote' | 'pre';
25
+ type InlineTag = 'span' | 'strong' | 'b' | 'em' | 'i' | 'u' | 's' | 'strike' | 'del' | 'code' | 'sub' | 'sup';
26
+ interface FormatSpec {
27
+ /** Сменить тип блока. */
28
+ block?: BlockTag;
29
+ /** Отметить выделенный текст. */
30
+ inline?: InlineTag;
31
+ /** Применить к существующим элементам: 'p,h1', 'img', 'blockquote'. */
32
+ selector?: string;
33
+ /** Классы: 'note' или ['note', 'warning']. */
34
+ classes?: string | string[];
35
+ /**
36
+ * Стили. Для текста — color, background-color, font-family, font-size;
37
+ * для блоков — text-align, line-height. Остальные не поддерживаются (предупреждение в консоли).
38
+ */
39
+ styles?: Record<string, string>;
40
+ }
41
+ /** Пункт меню «Стили»: свой формат, ссылка на именованный (format) или группа (items). */
42
+ interface StyleFormat extends FormatSpec {
43
+ title: string;
44
+ format?: string;
45
+ items?: StyleFormat[];
46
+ }
47
+ /**
48
+ * Реестр форматов редактора и их применение к выделению (`editor.formatter`).
49
+ * Классы из зарегистрированных форматов сохраняются при разборе HTML.
50
+ */
51
+ declare class Formatter {
52
+ private readonly editor;
53
+ /** Пополняется классами новых форматов — схема сверяется с ним при разборе HTML. */
54
+ private readonly allowedClasses;
55
+ private readonly registry;
56
+ constructor(editor: Editor,
57
+ /** Пополняется классами новых форматов — схема сверяется с ним при разборе HTML. */
58
+ allowedClasses: Set<string>);
59
+ /** Зарегистрировать именованный формат (одно описание или несколько вариантов). */
60
+ register(name: string, spec: FormatSpec | FormatSpec[]): void;
61
+ unregister(name: string): void;
62
+ has(name: string): boolean;
63
+ get(name: string): FormatSpec[] | undefined;
64
+ private resolve;
65
+ /** Можно ли применить формат к выделению (для selector — есть ли подходящие элементы). */
66
+ canApply(format: string | FormatSpec): boolean;
67
+ /** Подходит ли выделение под формат. */
68
+ match(format: string | FormatSpec): boolean;
69
+ apply(format: string | FormatSpec): boolean;
70
+ remove(format: string | FormatSpec): boolean;
71
+ toggle(format: string | FormatSpec): boolean;
72
+ private run;
73
+ }
74
+
75
+ /** Что выбрал пользователь в вашем файловом менеджере. */
76
+ interface FilePickResult {
77
+ url: string;
78
+ /** Текст ссылки (диалог ссылки, если текст ещё пуст). */
79
+ text?: string;
80
+ /** Подсказка (title) ссылки или название видео. */
81
+ title?: string;
82
+ /** Альтернативный текст картинки. */
83
+ alt?: string;
84
+ }
85
+ /** Какое поле просит файл: ссылка на любой файл, картинка или видео. */
86
+ type FilePickType = 'file' | 'image' | 'media';
87
+ /**
88
+ * Ваш выбор файла (как file_picker_callback в TinyMCE): открыть свой менеджер файлов и вернуть адрес.
89
+ * null/undefined — пользователь передумал.
90
+ */
91
+ type FilePicker = (request: {
92
+ type: FilePickType;
93
+ value: string;
94
+ }) => Promise<FilePickResult | null | undefined> | FilePickResult | null | undefined;
95
+
24
96
  /**
25
97
  * Комментарии к тексту: модель данных и хранилище.
26
98
  *
@@ -236,6 +308,31 @@ interface CommentsController {
236
308
  /** Контроллер комментариев редактора (если подключён плагин comments). */
237
309
  declare function getComments(editor: Editor): CommentsController | undefined;
238
310
 
311
+ /**
312
+ * Плагин mergetags: переменные шаблона («Имя клиента», «Номер заказа»), которые ваш сервер
313
+ * заменит значениями при печати или отправке. В тексте — нередактируемая «фишка», в HTML —
314
+ * `<span data-mergetag="client">Имя клиента</span>` (имя атрибута настраивается).
315
+ *
316
+ * `plugins: ['mergetags']`, список — `pluginOptions.mergetags.list`. Вставка — кнопка `mergetags`
317
+ * или ввод `{{` в тексте. Переменные, которых нет в списке, не теряются: показываются по ключу.
318
+ */
319
+ interface MergeTag {
320
+ /** Ключ, который увидит ваш сервер: 'client', 'order.number'. */
321
+ key: string;
322
+ /** Подпись в редакторе: 'Имя клиента'. */
323
+ label: string;
324
+ }
325
+ interface MergeTagGroup {
326
+ title: string;
327
+ items: MergeTag[];
328
+ }
329
+ interface MergeTagsOptions {
330
+ /** Переменные — списком или по группам. */
331
+ list?: (MergeTag | MergeTagGroup)[];
332
+ /** Атрибут с ключом в HTML. По умолчанию 'data-mergetag'. */
333
+ attribute?: string;
334
+ }
335
+
239
336
  /**
240
337
  * Quickbars: панели «по месту», как одноимённый плагин TinyMCE.
241
338
  * - над выделенным текстом — быстрое форматирование;
@@ -289,14 +386,11 @@ declare const cssValue: {
289
386
  fontFamily: (v: unknown) => string | null;
290
387
  };
291
388
  type TextDirection = 'ltr' | 'rtl';
292
- interface BlockStyle {
293
- align: TextAlign | null;
294
- lineHeight: string | null;
295
- dir: TextDirection | null;
296
- }
297
389
  type ImageAlign = 'left' | 'center' | 'right';
298
390
  /** Размер картинки в px: целое 1…10000, иначе null ('300', '300px', 300). */
299
391
  declare function imageSize(value: unknown): number | null;
392
+ /** Какие классы из HTML сохранять. По умолчанию — никакие: вывод без классов, как раньше. */
393
+ type ClassFilter = (className: string) => boolean;
300
394
  declare const nodes: {
301
395
  table: NodeSpec;
302
396
  table_row: NodeSpec;
@@ -309,6 +403,9 @@ declare const nodes: {
309
403
  group: string;
310
404
  content: string;
311
405
  attrs: {
406
+ class: {
407
+ default: null;
408
+ };
312
409
  align: {
313
410
  default: null;
314
411
  };
@@ -321,7 +418,12 @@ declare const nodes: {
321
418
  };
322
419
  parseDOM: {
323
420
  tag: string;
324
- getAttrs: (dom: HTMLElement) => BlockStyle;
421
+ getAttrs: (dom: HTMLElement) => {
422
+ class: string | null;
423
+ align: TextAlign | null;
424
+ lineHeight: string | null;
425
+ dir: TextDirection | null;
426
+ };
325
427
  }[];
326
428
  toDOM: (node: prosemirror_model.Node) => DOMOutputSpec;
327
429
  };
@@ -330,6 +432,9 @@ declare const nodes: {
330
432
  content: string;
331
433
  defining: true;
332
434
  attrs: {
435
+ class: {
436
+ default: null;
437
+ };
333
438
  align: {
334
439
  default: null;
335
440
  };
@@ -346,6 +451,7 @@ declare const nodes: {
346
451
  parseDOM: {
347
452
  tag: string;
348
453
  getAttrs: (dom: HTMLElement) => {
454
+ class: string | null;
349
455
  align: TextAlign | null;
350
456
  lineHeight: string | null;
351
457
  dir: TextDirection | null;
@@ -358,10 +464,18 @@ declare const nodes: {
358
464
  group: string;
359
465
  content: string;
360
466
  defining: true;
467
+ attrs: {
468
+ class: {
469
+ default: null;
470
+ };
471
+ };
361
472
  parseDOM: {
362
473
  tag: string;
474
+ getAttrs: (dom: HTMLElement) => {
475
+ class: string | null;
476
+ };
363
477
  }[];
364
- toDOM: () => DOMOutputSpec;
478
+ toDOM: (node: prosemirror_model.Node) => DOMOutputSpec;
365
479
  };
366
480
  horizontal_rule: {
367
481
  group: string;
@@ -442,6 +556,9 @@ declare const nodes: {
442
556
  inline: true;
443
557
  draggable: true;
444
558
  attrs: {
559
+ class: {
560
+ default: null;
561
+ };
445
562
  src: {};
446
563
  alt: {
447
564
  default: null;
@@ -468,6 +585,7 @@ declare const nodes: {
468
585
  width: number | null;
469
586
  height: number | null;
470
587
  align: ImageAlign | null;
588
+ class: string | null;
471
589
  };
472
590
  }[];
473
591
  toDOM: (node: prosemirror_model.Node) => DOMOutputSpec;
@@ -640,6 +758,20 @@ declare const marks: {
640
758
  }[];
641
759
  toDOM: (mark: prosemirror_model.Mark) => DOMOutputSpec;
642
760
  };
761
+ /** <span class="…"> — инлайн-стиль из style_formats. Только разрешённые классы. */
762
+ span_class: {
763
+ attrs: {
764
+ class: {};
765
+ };
766
+ parseDOM: {
767
+ tag: string;
768
+ consuming: false;
769
+ getAttrs: (dom: HTMLElement) => false | {
770
+ class: string;
771
+ };
772
+ }[];
773
+ toDOM: (mark: prosemirror_model.Mark) => DOMOutputSpec;
774
+ };
643
775
  };
644
776
  type NodeName = keyof typeof nodes;
645
777
  type MarkName = keyof typeof marks;
@@ -659,7 +791,9 @@ interface SchemaExtensions {
659
791
  * Новые узлы и марки добавляются в конец: базовые правила разбора HTML остаются в приоритете,
660
792
  * если плагин не задал свой `priority` в parseDOM.
661
793
  */
662
- declare function createSchema(extensions?: SchemaExtensions): NovaSchema;
794
+ declare function createSchema(extensions?: SchemaExtensions,
795
+ /** Какие классы сохранять (style_formats, validClasses). Без фильтра — никакие. */
796
+ classFilter?: ClassFilter): NovaSchema;
663
797
 
664
798
  /** Именованные команды редактора. Имена — часть публичного API (см. Editor.exec). */
665
799
  type CommandName = 'bold' | 'italic' | 'underline' | 'strike' | 'code' | 'subscript' | 'superscript' | 'paragraph' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'blockquote' | 'codeBlock' | 'bulletList' | 'orderedList' | 'indent' | 'outdent' | 'alignLeft' | 'alignCenter' | 'alignRight' | 'alignJustify' | 'horizontalRule' | 'unlink' | 'clearFormatting' | 'undo' | 'redo';
@@ -700,6 +834,7 @@ declare const marksOf: (state: EditorState) => {
700
834
  readonly color: MarkType;
701
835
  readonly font_family: MarkType;
702
836
  readonly font_size: MarkType;
837
+ readonly span_class: MarkType;
703
838
  } & {
704
839
  readonly [key: string]: MarkType;
705
840
  };
@@ -759,6 +894,11 @@ declare const en: {
759
894
  readonly more: "More";
760
895
  readonly moreFormats: "More formatting";
761
896
  readonly blocks: "Text style";
897
+ readonly styles: "Formats";
898
+ readonly 'styles.headings': "Headings";
899
+ readonly 'styles.inline': "Inline";
900
+ readonly 'styles.blocks': "Blocks";
901
+ readonly 'styles.align': "Align";
762
902
  readonly paragraph: "Paragraph";
763
903
  readonly h1: "Heading 1";
764
904
  readonly h2: "Heading 2";
@@ -812,6 +952,8 @@ declare const en: {
812
952
  readonly 'image.sizeOriginal': "Original size";
813
953
  readonly 'image.delete': "Remove image";
814
954
  readonly 'status.words': "{count} words";
955
+ readonly 'status.resize': "Resize editor";
956
+ readonly 'dialog.browse': "Browse";
815
957
  readonly pasteAsText: "Paste as text";
816
958
  readonly 'menu.label': "Menu";
817
959
  readonly 'menu.file': "File";
@@ -873,6 +1015,8 @@ declare const en: {
873
1015
  readonly 'table.sortAsc': "Sort A → Z, 1 → 9";
874
1016
  readonly 'table.sortDesc': "Sort Z → A, 9 → 1";
875
1017
  readonly 'table.props': "Table properties";
1018
+ readonly 'table.style': "Style";
1019
+ readonly 'table.styleDefault': "Default";
876
1020
  readonly 'table.width': "Width";
877
1021
  readonly 'table.widthHint': "For example 100% or 600px. Leave empty to fit the content.";
878
1022
  readonly 'table.invalidWidth': "Enter a width such as 100% or 600px";
@@ -1036,7 +1180,7 @@ interface NovaPlugin {
1036
1180
  * Новые узлы документа (с parseDOM и toDOM). Расширяют схему конкретного редактора.
1037
1181
  * Плагин с узлами или марками передаётся объектом, не ленивым загрузчиком: схема создаётся сразу.
1038
1182
  */
1039
- nodes?: Record<string, NodeSpec>;
1183
+ nodes?: Record<string, NodeSpec> | ((editor: Editor) => Record<string, NodeSpec>);
1040
1184
  /** Новые марки (инлайн-форматирование) с parseDOM и toDOM. */
1041
1185
  marks?: Record<string, MarkSpec>;
1042
1186
  /**
@@ -1200,7 +1344,12 @@ interface MenuItem {
1200
1344
  interface MenuSeparator {
1201
1345
  type: 'separator';
1202
1346
  }
1203
- type MenuEntry = MenuItem | MenuSeparator;
1347
+ /** Заголовок группы пунктов (не нажимается). */
1348
+ interface MenuHeading {
1349
+ type: 'heading';
1350
+ label: string;
1351
+ }
1352
+ type MenuEntry = MenuItem | MenuSeparator | MenuHeading;
1204
1353
 
1205
1354
  interface ControlBase {
1206
1355
  /** Подпись для подсказки и aria-label. */
@@ -1388,6 +1537,7 @@ type EditorEvent = 'change' | 'selectionChange' | 'focus' | 'blur' | 'editableCh
1388
1537
  interface PluginOptions {
1389
1538
  comments?: CommentsOptions;
1390
1539
  mentions?: MentionsOptions;
1540
+ mergetags?: MergeTagsOptions;
1391
1541
  revisionhistory?: RevisionHistoryOptions;
1392
1542
  autosave?: AutosaveOptions;
1393
1543
  quickbars?: QuickbarsOptions;
@@ -1419,12 +1569,68 @@ interface EditorOptions extends PasteOptions, ContentRulesOptions {
1419
1569
  /** Плейсхолдер для пустого документа. */
1420
1570
  placeholder?: string;
1421
1571
  editable?: boolean;
1572
+ /**
1573
+ * Отключённый редактор — как disabled у поля формы: текст не редактируется и не получает фокус,
1574
+ * панели неактивны. В отличие от editable: false (только чтение) выглядит приглушённо.
1575
+ */
1576
+ disabled?: boolean;
1577
+ /**
1578
+ * Ручка изменения размера в статусбаре: true — по высоте, 'both' — по высоте и ширине.
1579
+ * Мышь, палец или клавиатура (стрелки на ручке). По умолчанию нет.
1580
+ */
1581
+ resize?: boolean | 'both';
1582
+ /**
1583
+ * Пункты списка блоков (кнопка `blocks`) и их порядок: [{ label: 'Подзаголовок', block: 'h3' }].
1584
+ * По умолчанию — абзац, H1–H6 и блок кода.
1585
+ */
1586
+ blockFormats?: BlockFormat[];
1587
+ /**
1588
+ * Стили содержимого (как content_style в TinyMCE): применяются только к тексту этого редактора.
1589
+ * `body`/`html` в селекторах — это сама область текста: 'body { font-family: Georgia }'.
1590
+ */
1591
+ contentStyle?: string;
1592
+ /**
1593
+ * Файлы стилей содержимого (как content_css): загружаются и применяются только к тексту
1594
+ * этого редактора; относительные url() и @import работают. `await editor.ready` ждёт загрузки.
1595
+ */
1596
+ contentCss?: string | string[];
1597
+ /**
1598
+ * Именованные форматы (как formats в TinyMCE): { note: { block: 'p', classes: 'note' } }.
1599
+ * Применяются через editor.formatter.apply('note'); их классы сохраняются при разборе HTML.
1600
+ */
1601
+ formats?: Record<string, FormatSpec | FormatSpec[]>;
1602
+ /**
1603
+ * Пункты меню «Стили» (кнопка `styles`): свои форматы, ссылки на именованные и группы.
1604
+ * По умолчанию — заголовки, текст, блоки и выравнивание.
1605
+ */
1606
+ styleFormats?: StyleFormat[];
1607
+ /** true — добавить styleFormats к стандартному набору, а не заменить его. */
1608
+ styleFormatsMerge?: boolean;
1609
+ /**
1610
+ * Какие классы сохранять в HTML кроме классов из форматов: список или true — все.
1611
+ * По умолчанию только классы форматов (вставленный мусор вроде MsoNormal не попадает в документ).
1612
+ */
1613
+ validClasses?: string[] | true;
1614
+ /**
1615
+ * Стили таблиц на выбор в свойствах таблицы (как table_class_list в TinyMCE):
1616
+ * [{ title: 'С рамками', value: 'grid' }]. Внешний вид задаёт ваш CSS (contentCss).
1617
+ */
1618
+ tableClassList?: ClassOption[];
1619
+ /** Стили ячеек на выбор в свойствах ячейки (как table_cell_class_list). */
1620
+ tableCellClassList?: ClassOption[];
1422
1621
  /** Язык UI (BCP-47): 'en', 'ru'… По умолчанию 'en'. */
1423
1622
  language?: string;
1424
1623
  /** Точечная замена строк UI. */
1425
1624
  translations?: Partial<Messages>;
1426
1625
  /** Загрузка изображений на ваш сервер. Без неё картинки встраиваются как data:URL. */
1427
1626
  uploadImage?: UploadImageHandler;
1627
+ /**
1628
+ * Свой выбор файла: кнопка «Обзор» у поля адреса в диалогах ссылки, картинки и видео.
1629
+ * Получает тип поля и текущий адрес, возвращает { url, text?, title?, alt? } или null.
1630
+ */
1631
+ filePicker?: FilePicker;
1632
+ /** Для каких полей показывать «Обзор»: 'file' (ссылка), 'image', 'media'. По умолчанию — для всех. */
1633
+ filePickerTypes?: FilePickType[];
1428
1634
  fontFamilies?: FontOption[];
1429
1635
  fontSizes?: string[];
1430
1636
  lineHeights?: string[];
@@ -1444,6 +1650,16 @@ interface EditorOptions extends PasteOptions, ContentRulesOptions {
1444
1650
  setup?: (editor: Editor) => void;
1445
1651
  onChange?: (editor: Editor) => void;
1446
1652
  }
1653
+ /** Пункт списка стилей таблицы или ячейки: подпись и класс. */
1654
+ interface ClassOption {
1655
+ title: string;
1656
+ value: string;
1657
+ }
1658
+ /** Пункт списка блоков: подпись и тег блока. */
1659
+ interface BlockFormat {
1660
+ label: string;
1661
+ block: 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'pre';
1662
+ }
1447
1663
  type Listener = (editor: Editor) => void;
1448
1664
  /**
1449
1665
  * Публичный API редактора NovaProse.
@@ -1469,12 +1685,17 @@ declare class Editor {
1469
1685
  readonly contentRules: ContentRules | null;
1470
1686
  /** Схема документа этого редактора: базовая + узлы и марки синхронных плагинов. */
1471
1687
  readonly schema: NovaSchema;
1688
+ /** Форматы: register / apply / remove / toggle / match. */
1689
+ readonly formatter: Formatter;
1472
1690
  private readonly statusbar;
1473
1691
  private readonly searchBar;
1474
1692
  private destroyed;
1475
1693
  private editable;
1694
+ private disabled;
1476
1695
  private pasteAsText;
1477
1696
  constructor(options: EditorOptions);
1697
+ /** contentStyle сразу, contentCss — по мере загрузки. Каждый редактор — своя область. */
1698
+ private applyContentStyles;
1478
1699
  /** Разрешён ли контрол/команда/тег по ограничениям контента (без ограничений — всегда да). */
1479
1700
  isAllowed(name: string): boolean;
1480
1701
  hasPlugin(name: string): boolean;
@@ -1506,6 +1727,13 @@ declare class Editor {
1506
1727
  setContent(content: string | Record<string, unknown>, { addToHistory }?: {
1507
1728
  addToHistory?: boolean | undefined;
1508
1729
  }): void;
1730
+ /**
1731
+ * Вставить HTML в позицию курсора (как insertContent в TinyMCE). HTML разбирается схемой
1732
+ * редактора — как вставка: без скриптов, опасных ссылок и лишних тегов.
1733
+ * Блоки (абзацы, таблицы) встают отдельными блоками. Таблица, вставляемая при курсоре
1734
+ * внутри таблицы, встаёт после неё (а не заменяет её ячейки).
1735
+ */
1736
+ insertContent(html: string): boolean;
1509
1737
  isEmpty(): boolean;
1510
1738
  /** Выполнить именованную команду или произвольную ProseMirror-команду. */
1511
1739
  /** Команда по имени: переопределение плагина или встроенная. */
@@ -1523,7 +1751,12 @@ declare class Editor {
1523
1751
  /** Открыть панель «Найти и заменить» (Ctrl/Cmd+F). */
1524
1752
  openSearch(): void;
1525
1753
  closeSearch(): void;
1754
+ /** Можно ли сейчас править текст: не «только чтение» и не отключён. */
1526
1755
  isEditable(): boolean;
1756
+ isDisabled(): boolean;
1757
+ /** Отключить или включить редактор (как disabled у поля формы). */
1758
+ setDisabled(value: boolean): void;
1759
+ private applyDisabled;
1527
1760
  setEditable(value: boolean): void;
1528
1761
  on(event: EditorEvent, listener: Listener): () => void;
1529
1762
  off(event: EditorEvent, listener: Listener): void;
@@ -1691,76 +1924,96 @@ declare function isSuggesting(state: EditorState): boolean;
1691
1924
  declare function setSuggesting(editor: Editor, enabled: boolean): void;
1692
1925
 
1693
1926
  declare const icons: {
1694
- readonly undo: string;
1695
- readonly redo: string;
1696
- readonly bold: string;
1697
- readonly italic: string;
1698
- readonly underline: string;
1699
- readonly strike: string;
1700
- readonly code: string;
1701
- readonly subscript: string;
1702
- readonly superscript: string;
1703
- readonly bulletList: string;
1704
- readonly orderedList: string;
1705
- readonly indent: string;
1706
- readonly outdent: string;
1707
- readonly blockquote: string;
1708
- readonly codeBlock: string;
1709
- readonly alignLeft: string;
1710
- readonly alignCenter: string;
1711
- readonly alignRight: string;
1712
- readonly alignJustify: string;
1713
- readonly horizontalRule: string;
1714
- readonly link: string;
1715
- readonly unlink: string;
1716
- readonly image: string;
1717
- readonly clearFormatting: string;
1718
- readonly formatMore: string;
1719
- readonly imageLeft: string;
1720
- readonly imageCenter: string;
1721
- readonly imageRight: string;
1722
- readonly resize: string;
1723
- readonly altText: string;
1724
- readonly trash: string;
1725
- readonly paragraph: string;
1726
- readonly h1: string;
1727
- readonly h2: string;
1728
- readonly h3: string;
1729
- readonly pasteText: string;
1730
- readonly table: string;
1731
- readonly rowBefore: string;
1732
- readonly rowAfter: string;
1733
- readonly rowDelete: string;
1734
- readonly colBefore: string;
1735
- readonly colAfter: string;
1736
- readonly colDelete: string;
1737
- readonly merge: string;
1738
- readonly split: string;
1739
- readonly rowHeader: string;
1740
- readonly colHeader: string;
1741
- readonly sort: string;
1742
- readonly tableProps: string;
1743
- readonly cellProps: string;
1744
- readonly tableDelete: string;
1745
- readonly chevronUp: string;
1746
- readonly search: string;
1747
- readonly fullscreen: string;
1748
- readonly fullscreenExit: string;
1749
- readonly preview: string;
1750
- readonly sourceCode: string;
1751
- readonly help: string;
1752
- readonly print: string;
1753
- readonly check: string;
1754
- readonly close: string;
1755
- readonly chevronDown: string;
1756
- readonly more: string;
1757
- readonly textColor: string;
1758
- readonly highlight: string;
1759
- readonly lineHeight: string;
1760
- readonly upload: string;
1761
- readonly externalLink: string;
1762
- readonly copy: string;
1763
- readonly edit: string;
1927
+ undo: string;
1928
+ redo: string;
1929
+ bold: string;
1930
+ italic: string;
1931
+ underline: string;
1932
+ strike: string;
1933
+ code: string;
1934
+ subscript: string;
1935
+ superscript: string;
1936
+ bulletList: string;
1937
+ orderedList: string;
1938
+ indent: string;
1939
+ outdent: string;
1940
+ blockquote: string;
1941
+ codeBlock: string;
1942
+ alignLeft: string;
1943
+ alignCenter: string;
1944
+ alignRight: string;
1945
+ alignJustify: string;
1946
+ horizontalRule: string;
1947
+ link: string;
1948
+ unlink: string;
1949
+ image: string;
1950
+ clearFormatting: string;
1951
+ formatMore: string;
1952
+ imageLeft: string;
1953
+ imageCenter: string;
1954
+ imageRight: string;
1955
+ resize: string;
1956
+ altText: string;
1957
+ trash: string;
1958
+ paragraph: string;
1959
+ h1: string;
1960
+ h2: string;
1961
+ h3: string;
1962
+ pasteText: string;
1963
+ table: string;
1964
+ rowBefore: string;
1965
+ rowAfter: string;
1966
+ rowDelete: string;
1967
+ colBefore: string;
1968
+ colAfter: string;
1969
+ colDelete: string;
1970
+ merge: string;
1971
+ split: string;
1972
+ rowHeader: string;
1973
+ colHeader: string;
1974
+ sort: string;
1975
+ tableProps: string;
1976
+ cellProps: string;
1977
+ tableDelete: string;
1978
+ chevronUp: string;
1979
+ search: string;
1980
+ fullscreen: string;
1981
+ fullscreenExit: string;
1982
+ preview: string;
1983
+ sourceCode: string;
1984
+ help: string;
1985
+ print: string;
1986
+ check: string;
1987
+ close: string;
1988
+ chevronDown: string;
1989
+ more: string;
1990
+ textColor: string;
1991
+ highlight: string;
1992
+ lineHeight: string;
1993
+ upload: string;
1994
+ externalLink: string;
1995
+ copy: string;
1996
+ edit: string;
1997
+ resizeHandle: string;
1998
+ browse: string;
1999
+ mergeTags: string;
2000
+ resizeHandleBoth: string;
2001
+ anchor: string;
2002
+ save: string;
2003
+ charmap: string;
2004
+ commentAdd: string;
2005
+ comments: string;
2006
+ emoji: string;
2007
+ dateTime: string;
2008
+ media: string;
2009
+ nonBreaking: string;
2010
+ pageBreak: string;
2011
+ history: string;
2012
+ suggest: string;
2013
+ review: string;
2014
+ visualBlocks: string;
2015
+ ltr: string;
2016
+ rtl: string;
1764
2017
  };
1765
2018
 
1766
2019
  declare class HTMLSerializer {
@@ -1770,4 +2023,4 @@ declare class HTMLSerializer {
1770
2023
  private renderMark;
1771
2024
  }
1772
2025
 
1773
- export { type AutocompleterItem, type AutocompleterSpec, type AutosaveOptions, type ButtonSpec, type CommandName, type Comment, type CommentAuthor, type CommentStore, type CommentThread, type CommentsController, type CommentsOptions, ContentRules, type ContentRulesOptions, type ContextToolbarSpec, type ControlSpec, DEFAULT_MENUBAR, DEFAULT_MENUS, Editor, type EditorEvent, type EditorMode, type EditorOptions, type FontOption, HTMLSerializer, type ImageAlign, KNOWN_STYLES, KNOWN_TAGS, type LinkAttrs, MENTION_ID_RE, type MarkName, type MentionUser, type MentionsOptions, type MenuButtonSpec, type MenuDefinition, type MenuEntry, type MenuItem, type MenuItemSpec, type MessageKey, type Messages, type NodeName, type NovaPlugin, type NovaSchema, type PanelButtonSpec, type PasteOptions, type PluginEntry, type PluginOptions, type QuickbarsOptions, Registry, type Revision, type RevisionHistoryOptions, type SchemaExtensions, type SearchMatch, type SearchOptions, type SearchState, type SlashCommand, type StyleMark, type Suggestion, type SuggestionAuthor, type SuggestionsOptions, type TextAlign, type ToolbarConfig, type ToolbarMode, type Translator, UiManager, type UploadImageHandler, applyLink, clearSearch, commands, countWords, createCommentStore, createEditor, createSchema, createTable, createTranslator, cssValue, defaultColors, defaultFontFamilies, defaultFontSizes, defaultLineHeights, defaultSlashCommands, defaultToolbar, definePlugin, en, findMatches, findNext, formatHTML, getActiveAlign, getComments, getLineHeight, getLinkAt, getMentions, getSearchState, getSelectedImage, getStyle, hasHeaderColumn, hasHeaderRow, htmlToPlainText, icons, imageSize, insertImage, insertTable, isCommandActive, isFullscreen, isMarkActive, isNodeActive, isPluginRegistered, isSafeImageUrl, isSafeLinkUrl, isSuggesting, listSuggestions, marksOf, newCommentId, nodesOf, normalizeUrl, openHelp, openImageAltDialog, openImageDialog, openLinkDialog, openPreview, openSourceCode, parseToolbar, parserFor, printContent, rankSlashCommands, registerLanguage, registerPlugin, removeLink, replaceAll, replaceCurrent, resolveSuggestions, ru, sanitizeThread, schema, setCellBackground, setImageAttrs, setImageWidthFraction, setLineHeight, setLink, setSearch, setStyle, setSuggesting, suggestionsResult, tableCommands, toggleFullscreen, uploadImages };
2026
+ export { type AutocompleterItem, type AutocompleterSpec, type AutosaveOptions, type BlockFormat, type BlockTag, type ButtonSpec, type ClassFilter, type ClassOption, type CommandName, type Comment, type CommentAuthor, type CommentStore, type CommentThread, type CommentsController, type CommentsOptions, ContentRules, type ContentRulesOptions, type ContextToolbarSpec, type ControlSpec, DEFAULT_MENUBAR, DEFAULT_MENUS, Editor, type EditorEvent, type EditorMode, type EditorOptions, type FilePickResult, type FilePickType, type FilePicker, type FontOption, type FormatSpec, Formatter, HTMLSerializer, type ImageAlign, type InlineTag, KNOWN_STYLES, KNOWN_TAGS, type LinkAttrs, MENTION_ID_RE, type MarkName, type MentionUser, type MentionsOptions, type MenuButtonSpec, type MenuDefinition, type MenuEntry, type MenuItem, type MenuItemSpec, type MergeTag, type MergeTagGroup, type MergeTagsOptions, type MessageKey, type Messages, type NodeName, type NovaPlugin, type NovaSchema, type PanelButtonSpec, type PasteOptions, type PluginEntry, type PluginOptions, type QuickbarsOptions, Registry, type Revision, type RevisionHistoryOptions, type SchemaExtensions, type SearchMatch, type SearchOptions, type SearchState, type SlashCommand, type StyleFormat, type StyleMark, type Suggestion, type SuggestionAuthor, type SuggestionsOptions, type TextAlign, type ToolbarConfig, type ToolbarMode, type Translator, UiManager, type UploadImageHandler, applyLink, clearSearch, commands, countWords, createCommentStore, createEditor, createSchema, createTable, createTranslator, cssValue, defaultColors, defaultFontFamilies, defaultFontSizes, defaultLineHeights, defaultSlashCommands, defaultToolbar, definePlugin, en, findMatches, findNext, formatHTML, getActiveAlign, getComments, getLineHeight, getLinkAt, getMentions, getSearchState, getSelectedImage, getStyle, hasHeaderColumn, hasHeaderRow, htmlToPlainText, icons, imageSize, insertImage, insertTable, isCommandActive, isFullscreen, isMarkActive, isNodeActive, isPluginRegistered, isSafeImageUrl, isSafeLinkUrl, isSuggesting, listSuggestions, marksOf, newCommentId, nodesOf, normalizeUrl, openHelp, openImageAltDialog, openImageDialog, openLinkDialog, openPreview, openSourceCode, parseToolbar, parserFor, printContent, rankSlashCommands, registerLanguage, registerPlugin, removeLink, replaceAll, replaceCurrent, resolveSuggestions, ru, sanitizeThread, schema, setCellBackground, setImageAttrs, setImageWidthFraction, setLineHeight, setLink, setSearch, setStyle, setSuggesting, suggestionsResult, tableCommands, toggleFullscreen, uploadImages };