@novaprose/core 0.1.0 → 0.2.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.
- package/dist/advlist-FRIJ6LO7.js +107 -0
- package/dist/advlist-FRIJ6LO7.js.map +1 -0
- package/dist/autolink-ZVHNOOS7.js +89 -0
- package/dist/autolink-ZVHNOOS7.js.map +1 -0
- package/dist/autoresize-WT4ONZKK.js +26 -0
- package/dist/autoresize-WT4ONZKK.js.map +1 -0
- package/dist/autosave-2KI5WGV5.js +99 -0
- package/dist/autosave-2KI5WGV5.js.map +1 -0
- package/dist/charmap-3LM5LZCC.js +197 -0
- package/dist/charmap-3LM5LZCC.js.map +1 -0
- package/dist/chunk-6RJENZXT.js +104 -0
- package/dist/chunk-6RJENZXT.js.map +1 -0
- package/dist/{chunk-TKR3C5IJ.js → chunk-AGBQEZ2U.js} +300 -681
- package/dist/chunk-AGBQEZ2U.js.map +1 -0
- package/dist/{chunk-ZF2JR3JH.js → chunk-F6TSOU5U.js} +1 -1
- package/dist/chunk-F6TSOU5U.js.map +1 -0
- package/dist/chunk-GHEFKKRC.js +268 -0
- package/dist/chunk-GHEFKKRC.js.map +1 -0
- package/dist/chunk-HZRIBOPW.js +52 -0
- package/dist/chunk-HZRIBOPW.js.map +1 -0
- package/dist/chunk-YZPJQB3I.js +490 -0
- package/dist/chunk-YZPJQB3I.js.map +1 -0
- package/dist/directionality-VSDWPWHX.js +70 -0
- package/dist/directionality-VSDWPWHX.js.map +1 -0
- package/dist/emoticons-YVGVA76P.js +216 -0
- package/dist/emoticons-YVGVA76P.js.map +1 -0
- package/dist/index.cjs +3762 -1175
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +177 -10
- package/dist/index.d.ts +177 -10
- package/dist/index.js +1316 -95
- package/dist/index.js.map +1 -1
- package/dist/{insertdatetime-C4MAC5L7.js → insertdatetime-QYWZUYO4.js} +2 -2
- package/dist/nonbreaking-SIACL5V6.js +46 -0
- package/dist/nonbreaking-SIACL5V6.js.map +1 -0
- package/dist/{quickbars-XK4QCQ6F.js → quickbars-WW3TGVCS.js} +7 -5
- package/dist/quickbars-WW3TGVCS.js.map +1 -0
- package/dist/visualblocks-WB6NAEGB.js +43 -0
- package/dist/visualblocks-WB6NAEGB.js.map +1 -0
- package/package.json +5 -2
- package/src/style.css +180 -0
- package/dist/chunk-TKR3C5IJ.js.map +0 -1
- package/dist/chunk-ZF2JR3JH.js.map +0 -1
- package/dist/quickbars-XK4QCQ6F.js.map +0 -1
- /package/dist/{insertdatetime-C4MAC5L7.js.map → insertdatetime-QYWZUYO4.js.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command, EditorState, Plugin } from 'prosemirror-state';
|
|
2
2
|
import { EditorView } from 'prosemirror-view';
|
|
3
3
|
import * as prosemirror_model from 'prosemirror-model';
|
|
4
|
-
import {
|
|
4
|
+
import { Schema, NodeSpec, DOMOutputSpec, MarkSpec, MarkType, NodeType, Node, Fragment, DOMParser } from 'prosemirror-model';
|
|
5
5
|
import { addRowBefore, addRowAfter, deleteRow, addColumnBefore, addColumnAfter, deleteColumn, mergeCells, splitCell, deleteTable } from 'prosemirror-tables';
|
|
6
6
|
export { isInTable } from 'prosemirror-tables';
|
|
7
7
|
|
|
@@ -18,9 +18,11 @@ declare const cssValue: {
|
|
|
18
18
|
lineHeight: (v: unknown) => string | null;
|
|
19
19
|
fontFamily: (v: unknown) => string | null;
|
|
20
20
|
};
|
|
21
|
+
type TextDirection = 'ltr' | 'rtl';
|
|
21
22
|
interface BlockStyle {
|
|
22
23
|
align: TextAlign | null;
|
|
23
24
|
lineHeight: string | null;
|
|
25
|
+
dir: TextDirection | null;
|
|
24
26
|
}
|
|
25
27
|
type ImageAlign = 'left' | 'center' | 'right';
|
|
26
28
|
/** Размер картинки в px: целое 1…10000, иначе null ('300', '300px', 300). */
|
|
@@ -43,6 +45,9 @@ declare const nodes: {
|
|
|
43
45
|
lineHeight: {
|
|
44
46
|
default: null;
|
|
45
47
|
};
|
|
48
|
+
dir: {
|
|
49
|
+
default: null;
|
|
50
|
+
};
|
|
46
51
|
};
|
|
47
52
|
parseDOM: {
|
|
48
53
|
tag: string;
|
|
@@ -61,6 +66,9 @@ declare const nodes: {
|
|
|
61
66
|
lineHeight: {
|
|
62
67
|
default: null;
|
|
63
68
|
};
|
|
69
|
+
dir: {
|
|
70
|
+
default: null;
|
|
71
|
+
};
|
|
64
72
|
level: {
|
|
65
73
|
default: number;
|
|
66
74
|
};
|
|
@@ -70,6 +78,7 @@ declare const nodes: {
|
|
|
70
78
|
getAttrs: (dom: HTMLElement) => {
|
|
71
79
|
align: TextAlign | null;
|
|
72
80
|
lineHeight: string | null;
|
|
81
|
+
dir: TextDirection | null;
|
|
73
82
|
level: number;
|
|
74
83
|
};
|
|
75
84
|
}[];
|
|
@@ -114,10 +123,18 @@ declare const nodes: {
|
|
|
114
123
|
bullet_list: {
|
|
115
124
|
group: string;
|
|
116
125
|
content: string;
|
|
126
|
+
attrs: {
|
|
127
|
+
listStyle: {
|
|
128
|
+
default: null;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
117
131
|
parseDOM: {
|
|
118
132
|
tag: string;
|
|
133
|
+
getAttrs: (dom: HTMLElement) => {
|
|
134
|
+
listStyle: string | null;
|
|
135
|
+
};
|
|
119
136
|
}[];
|
|
120
|
-
toDOM: () => DOMOutputSpec;
|
|
137
|
+
toDOM: (node: prosemirror_model.Node) => DOMOutputSpec;
|
|
121
138
|
};
|
|
122
139
|
ordered_list: {
|
|
123
140
|
group: string;
|
|
@@ -126,11 +143,15 @@ declare const nodes: {
|
|
|
126
143
|
start: {
|
|
127
144
|
default: number;
|
|
128
145
|
};
|
|
146
|
+
listStyle: {
|
|
147
|
+
default: null;
|
|
148
|
+
};
|
|
129
149
|
};
|
|
130
150
|
parseDOM: {
|
|
131
151
|
tag: string;
|
|
132
152
|
getAttrs: (dom: HTMLElement) => {
|
|
133
153
|
start: number;
|
|
154
|
+
listStyle: string | null;
|
|
134
155
|
};
|
|
135
156
|
}[];
|
|
136
157
|
toDOM: (node: prosemirror_model.Node) => DOMOutputSpec;
|
|
@@ -267,16 +288,24 @@ declare const marks: {
|
|
|
267
288
|
};
|
|
268
289
|
subscript: {
|
|
269
290
|
excludes: string;
|
|
270
|
-
parseDOM: {
|
|
291
|
+
parseDOM: ({
|
|
271
292
|
tag: string;
|
|
272
|
-
|
|
293
|
+
style?: undefined;
|
|
294
|
+
} | {
|
|
295
|
+
style: string;
|
|
296
|
+
tag?: undefined;
|
|
297
|
+
})[];
|
|
273
298
|
toDOM: () => DOMOutputSpec;
|
|
274
299
|
};
|
|
275
300
|
superscript: {
|
|
276
301
|
excludes: string;
|
|
277
|
-
parseDOM: {
|
|
302
|
+
parseDOM: ({
|
|
278
303
|
tag: string;
|
|
279
|
-
|
|
304
|
+
style?: undefined;
|
|
305
|
+
} | {
|
|
306
|
+
style: string;
|
|
307
|
+
tag?: undefined;
|
|
308
|
+
})[];
|
|
280
309
|
toDOM: () => DOMOutputSpec;
|
|
281
310
|
};
|
|
282
311
|
color: {
|
|
@@ -344,10 +373,66 @@ declare const marks: {
|
|
|
344
373
|
};
|
|
345
374
|
type NodeName = keyof typeof nodes;
|
|
346
375
|
type MarkName = keyof typeof marks;
|
|
347
|
-
|
|
376
|
+
/**
|
|
377
|
+
* Схема редактора: базовые узлы и марки + расширения плагинов. Тип оставляем «базовым»: встроенный
|
|
378
|
+
* код обращается только к своим узлам (`schema.nodes.paragraph`), а узлы плагинов доступны по имени.
|
|
379
|
+
*/
|
|
380
|
+
type NovaSchema = Schema<NodeName, MarkName>;
|
|
381
|
+
/** Базовая схема без расширений — у редакторов без плагинов-узлов она общая. */
|
|
382
|
+
declare const schema: NovaSchema;
|
|
383
|
+
interface SchemaExtensions {
|
|
384
|
+
nodes?: Record<string, NodeSpec>;
|
|
385
|
+
marks?: Record<string, MarkSpec>;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Схема с узлами и марками плагинов. Без расширений возвращает общую базовую схему.
|
|
389
|
+
* Новые узлы и марки добавляются в конец: базовые правила разбора HTML остаются в приоритете,
|
|
390
|
+
* если плагин не задал свой `priority` в parseDOM.
|
|
391
|
+
*/
|
|
392
|
+
declare function createSchema(extensions?: SchemaExtensions): NovaSchema;
|
|
348
393
|
|
|
349
394
|
/** Именованные команды редактора. Имена — часть публичного API (см. Editor.exec). */
|
|
350
395
|
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';
|
|
396
|
+
/**
|
|
397
|
+
* Типы узлов и марок берём из схемы конкретного редактора (state.schema): у редакторов с плагинами
|
|
398
|
+
* она своя, и сравнение с типами общей базовой схемы дало бы ложь.
|
|
399
|
+
*/
|
|
400
|
+
declare const nodesOf: (state: EditorState) => {
|
|
401
|
+
readonly table: NodeType;
|
|
402
|
+
readonly table_row: NodeType;
|
|
403
|
+
readonly table_cell: NodeType;
|
|
404
|
+
readonly table_header: NodeType;
|
|
405
|
+
readonly doc: NodeType;
|
|
406
|
+
readonly paragraph: NodeType;
|
|
407
|
+
readonly heading: NodeType;
|
|
408
|
+
readonly blockquote: NodeType;
|
|
409
|
+
readonly horizontal_rule: NodeType;
|
|
410
|
+
readonly code_block: NodeType;
|
|
411
|
+
readonly bullet_list: NodeType;
|
|
412
|
+
readonly ordered_list: NodeType;
|
|
413
|
+
readonly list_item: NodeType;
|
|
414
|
+
readonly text: NodeType;
|
|
415
|
+
readonly image: NodeType;
|
|
416
|
+
readonly hard_break: NodeType;
|
|
417
|
+
} & {
|
|
418
|
+
readonly [key: string]: NodeType;
|
|
419
|
+
};
|
|
420
|
+
declare const marksOf: (state: EditorState) => {
|
|
421
|
+
readonly background: MarkType;
|
|
422
|
+
readonly code: MarkType;
|
|
423
|
+
readonly link: MarkType;
|
|
424
|
+
readonly bold: MarkType;
|
|
425
|
+
readonly italic: MarkType;
|
|
426
|
+
readonly underline: MarkType;
|
|
427
|
+
readonly strike: MarkType;
|
|
428
|
+
readonly subscript: MarkType;
|
|
429
|
+
readonly superscript: MarkType;
|
|
430
|
+
readonly color: MarkType;
|
|
431
|
+
readonly font_family: MarkType;
|
|
432
|
+
readonly font_size: MarkType;
|
|
433
|
+
} & {
|
|
434
|
+
readonly [key: string]: MarkType;
|
|
435
|
+
};
|
|
351
436
|
declare const commands: Record<CommandName, Command>;
|
|
352
437
|
/** Вставить или обновить ссылку на выделении. */
|
|
353
438
|
declare function setLink(href: string, attrs?: {
|
|
@@ -373,6 +458,7 @@ declare function getLinkAt(state: EditorState): {
|
|
|
373
458
|
/** Английские строки UI — язык по умолчанию и эталон набора ключей для остальных языков. */
|
|
374
459
|
declare const en: {
|
|
375
460
|
readonly 'toolbar.label': "Formatting";
|
|
461
|
+
readonly 'toolbar.options': "options";
|
|
376
462
|
readonly 'editor.label': "Rich text editor";
|
|
377
463
|
readonly 'editor.required': "Please fill in this field.";
|
|
378
464
|
readonly undo: "Undo";
|
|
@@ -513,6 +599,28 @@ declare const en: {
|
|
|
513
599
|
readonly 'table.colHeader': "Header column";
|
|
514
600
|
readonly 'table.cellBackground': "Cell background";
|
|
515
601
|
readonly 'table.delete': "Delete table";
|
|
602
|
+
readonly 'table.sort': "Sort";
|
|
603
|
+
readonly 'table.sortAsc': "Sort A → Z, 1 → 9";
|
|
604
|
+
readonly 'table.sortDesc': "Sort Z → A, 9 → 1";
|
|
605
|
+
readonly 'table.props': "Table properties";
|
|
606
|
+
readonly 'table.width': "Width";
|
|
607
|
+
readonly 'table.widthHint': "For example 100% or 600px. Leave empty to fit the content.";
|
|
608
|
+
readonly 'table.invalidWidth': "Enter a width such as 100% or 600px";
|
|
609
|
+
readonly 'table.align': "Alignment on the page";
|
|
610
|
+
readonly 'table.alignDefault': "Default";
|
|
611
|
+
readonly 'table.alignCenter': "Center";
|
|
612
|
+
readonly 'table.alignRight': "Right";
|
|
613
|
+
readonly 'table.cellProps': "Cell properties";
|
|
614
|
+
readonly 'table.valign': "Vertical alignment";
|
|
615
|
+
readonly 'table.valignTop': "Top";
|
|
616
|
+
readonly 'table.valignMiddle': "Middle";
|
|
617
|
+
readonly 'table.valignBottom': "Bottom";
|
|
618
|
+
readonly 'table.cellType': "Cell type";
|
|
619
|
+
readonly 'table.cellData': "Data cell";
|
|
620
|
+
readonly 'table.cellHeader': "Header cell";
|
|
621
|
+
readonly 'table.colWidth': "Column width, px";
|
|
622
|
+
readonly 'table.colWidthHint': "Leave empty to fit the content.";
|
|
623
|
+
readonly 'table.invalidColWidth': "Enter a number from 24 to 4000";
|
|
516
624
|
readonly 'slash.label': "Commands";
|
|
517
625
|
readonly 'slash.empty': "No matching commands";
|
|
518
626
|
};
|
|
@@ -554,6 +662,9 @@ declare function setImageWidthFraction(editor: Editor, fraction: number | null):
|
|
|
554
662
|
/** Диалог альтернативного текста — главный пункт доступности картинки. */
|
|
555
663
|
declare function openImageAltDialog(editor: Editor): void;
|
|
556
664
|
|
|
665
|
+
/** 'clean' (по умолчанию) — без шрифтов, кегля, интервалов и цветов «по умолчанию»; 'keep' — как есть. */
|
|
666
|
+
type PasteStyles = 'clean' | 'keep';
|
|
667
|
+
|
|
557
668
|
/**
|
|
558
669
|
* Обработка вставки:
|
|
559
670
|
* - режим «Вставить как текст» (переключатель pastetext) — любое содержимое вставляется без форматирования;
|
|
@@ -568,6 +679,12 @@ interface PasteOptions {
|
|
|
568
679
|
pastePostprocess?: (fragment: HTMLElement, editor: Editor) => void;
|
|
569
680
|
/** Включить режим «вставить как текст» сразу. */
|
|
570
681
|
pasteAsText?: boolean;
|
|
682
|
+
/**
|
|
683
|
+
* Оформление при вставке из Word, Google Docs, Excel и веб-страниц.
|
|
684
|
+
* 'clean' (по умолчанию) — сохраняются жирный, курсив, цвета, списки, таблицы, ссылки, но не шрифт,
|
|
685
|
+
* кегль и интервалы документа-источника; 'keep' — переносить и их.
|
|
686
|
+
*/
|
|
687
|
+
pasteStyles?: PasteStyles;
|
|
571
688
|
}
|
|
572
689
|
/** Превращает HTML в простой текст с сохранением абзацев (для режима «как текст»). */
|
|
573
690
|
declare function htmlToPlainText(html: string): string;
|
|
@@ -645,6 +762,20 @@ interface NovaPlugin {
|
|
|
645
762
|
toolbar?: string;
|
|
646
763
|
/** ProseMirror-плагины (ввод, декорации, клавиши). */
|
|
647
764
|
prosemirrorPlugins?: (editor: Editor) => Plugin[];
|
|
765
|
+
/**
|
|
766
|
+
* Новые узлы документа (с parseDOM и toDOM). Расширяют схему конкретного редактора.
|
|
767
|
+
* Плагин с узлами или марками передаётся объектом, не ленивым загрузчиком: схема создаётся сразу.
|
|
768
|
+
*/
|
|
769
|
+
nodes?: Record<string, NodeSpec>;
|
|
770
|
+
/** Новые марки (инлайн-форматирование) с parseDOM и toDOM. */
|
|
771
|
+
marks?: Record<string, MarkSpec>;
|
|
772
|
+
/**
|
|
773
|
+
* Переопределение именованных команд (кнопки, меню, горячие клавиши и editor.exec берут их отсюда).
|
|
774
|
+
* Например, совместное редактирование заменяет undo/redo своими — «отменить только свои правки».
|
|
775
|
+
*/
|
|
776
|
+
commands?: Partial<Record<CommandName, Command>>;
|
|
777
|
+
/** Плагин ведёт свою историю изменений — встроенная (prosemirror-history) не подключается. */
|
|
778
|
+
replaceHistory?: boolean;
|
|
648
779
|
}
|
|
649
780
|
type Loader = () => Promise<NovaPlugin | {
|
|
650
781
|
default: NovaPlugin;
|
|
@@ -827,7 +958,17 @@ interface PanelButtonSpec extends ControlBase {
|
|
|
827
958
|
indicator?: (editor: Editor) => string | null;
|
|
828
959
|
isActive?: (editor: Editor) => boolean;
|
|
829
960
|
}
|
|
830
|
-
|
|
961
|
+
/**
|
|
962
|
+
* Составная кнопка: основная часть выполняет действие (переключить список), стрелка открывает
|
|
963
|
+
* меню вариантов (стиль маркеров). Как bullist/numlist с плагином advlist.
|
|
964
|
+
*/
|
|
965
|
+
interface SplitButtonSpec extends ControlBase {
|
|
966
|
+
type: 'split';
|
|
967
|
+
onAction: (editor: Editor) => void;
|
|
968
|
+
items: (editor: Editor) => MenuEntry[];
|
|
969
|
+
isActive?: (editor: Editor) => boolean;
|
|
970
|
+
}
|
|
971
|
+
type ControlSpec = ButtonSpec | MenuButtonSpec | PanelButtonSpec | SplitButtonSpec;
|
|
831
972
|
/** Пункт меню менюбара. */
|
|
832
973
|
interface MenuItemSpec {
|
|
833
974
|
text: string;
|
|
@@ -867,6 +1008,7 @@ declare class Registry {
|
|
|
867
1008
|
addToggleButton(name: string, spec: WithoutType<ButtonSpec>): void;
|
|
868
1009
|
addMenuButton(name: string, spec: WithoutType<MenuButtonSpec>): void;
|
|
869
1010
|
addPanelButton(name: string, spec: WithoutType<PanelButtonSpec>): void;
|
|
1011
|
+
addSplitButton(name: string, spec: WithoutType<SplitButtonSpec>): void;
|
|
870
1012
|
private readonly menuItems;
|
|
871
1013
|
/** Пункт меню менюбара (аналог addMenuItem). */
|
|
872
1014
|
addMenuItem(name: string, spec: MenuItemSpec): void;
|
|
@@ -931,6 +1073,12 @@ declare class UiManager {
|
|
|
931
1073
|
openPopover(options: Omit<PopoverOptions, 'host'>): Popover;
|
|
932
1074
|
closePopover(): void;
|
|
933
1075
|
get activePopover(): Popover | null;
|
|
1076
|
+
private readonly dialogListeners;
|
|
1077
|
+
/**
|
|
1078
|
+
* Подписаться на открытие диалога (вернёт отписку). Тулбар так закрывает панель «⋯»: иначе на узком
|
|
1079
|
+
* экране она оставалась открытой поверх текста после закрытия диалога, открытого из неё.
|
|
1080
|
+
*/
|
|
1081
|
+
onDialogOpen(listener: () => void): () => void;
|
|
934
1082
|
openDialog(options: Omit<DialogOptions, 'host' | 'cancelLabel' | 'closeLabel' | 'returnFocus'> & {
|
|
935
1083
|
cancelLabel?: string;
|
|
936
1084
|
}): DialogHandle;
|
|
@@ -1020,9 +1168,12 @@ declare class Editor {
|
|
|
1020
1168
|
private readonly menubar;
|
|
1021
1169
|
readonly mode: EditorMode;
|
|
1022
1170
|
private readonly pluginsByName;
|
|
1171
|
+
private readonly commandOverrides;
|
|
1023
1172
|
private readonly cleanups;
|
|
1024
1173
|
/** Ограничения контента (validElements/invalidElements/validStyles) или null — без ограничений. */
|
|
1025
1174
|
readonly contentRules: ContentRules | null;
|
|
1175
|
+
/** Схема документа этого редактора: базовая + узлы и марки синхронных плагинов. */
|
|
1176
|
+
readonly schema: NovaSchema;
|
|
1026
1177
|
private readonly statusbar;
|
|
1027
1178
|
private readonly searchBar;
|
|
1028
1179
|
private destroyed;
|
|
@@ -1032,10 +1183,20 @@ declare class Editor {
|
|
|
1032
1183
|
/** Разрешён ли контрол/команда/тег по ограничениям контента (без ограничений — всегда да). */
|
|
1033
1184
|
isAllowed(name: string): boolean;
|
|
1034
1185
|
hasPlugin(name: string): boolean;
|
|
1186
|
+
/**
|
|
1187
|
+
* Схема с узлами и марками плагинов. Конфликт имён — ошибка конфигурации: сообщаем и работаем
|
|
1188
|
+
* на базовой схеме, чтобы редактор всё равно открылся.
|
|
1189
|
+
*/
|
|
1190
|
+
private buildSchema;
|
|
1035
1191
|
private collectPmPlugins;
|
|
1036
1192
|
/** setup с изоляцией ошибок: упавший плагин не ломает редактор. */
|
|
1037
1193
|
private setupPlugin;
|
|
1038
1194
|
private loadLazyPlugins;
|
|
1195
|
+
/**
|
|
1196
|
+
* Обновить состояние кнопок (нажата / доступна) без изменения документа — например, после того как
|
|
1197
|
+
* плагин переключил режим отображения. Изменения документа обновляют UI сами.
|
|
1198
|
+
*/
|
|
1199
|
+
updateUI(): void;
|
|
1039
1200
|
/** Перестроить тулбар (после регистрации новых кнопок плагинами). */
|
|
1040
1201
|
rebuildToolbar(): void;
|
|
1041
1202
|
/** Конфиг тулбара: пользовательский как есть; по умолчанию — плюс кнопки подключённых плагинов. */
|
|
@@ -1052,6 +1213,9 @@ declare class Editor {
|
|
|
1052
1213
|
}): void;
|
|
1053
1214
|
isEmpty(): boolean;
|
|
1054
1215
|
/** Выполнить именованную команду или произвольную ProseMirror-команду. */
|
|
1216
|
+
/** Команда по имени: переопределение плагина или встроенная. */
|
|
1217
|
+
resolveCommand(name: CommandName): Command;
|
|
1218
|
+
private registerCommands;
|
|
1055
1219
|
exec(command: CommandName | Command): boolean;
|
|
1056
1220
|
/** Можно ли выполнить команду в текущем состоянии (для disabled-кнопок). */
|
|
1057
1221
|
can(command: CommandName | Command): boolean;
|
|
@@ -1076,6 +1240,9 @@ declare function createEditor(options: EditorOptions): Editor;
|
|
|
1076
1240
|
/** Печать содержимого через скрытый iframe (HTML уже очищен схемой). */
|
|
1077
1241
|
declare function printContent(editor: Editor): void;
|
|
1078
1242
|
|
|
1243
|
+
/** Парсер для схемы конкретного редактора (создаётся один раз на схему). */
|
|
1244
|
+
declare function parserFor(target: Schema): DOMParser;
|
|
1245
|
+
|
|
1079
1246
|
/** Марки-стили со значением: цвет, фон, шрифт, размер. */
|
|
1080
1247
|
type StyleMark = 'color' | 'background' | 'font_family' | 'font_size';
|
|
1081
1248
|
/**
|
|
@@ -1163,7 +1330,7 @@ declare function openSourceCode(editor: Editor): void;
|
|
|
1163
1330
|
declare function openHelp(editor: Editor): void;
|
|
1164
1331
|
|
|
1165
1332
|
/** Создать таблицу rows×cols; первая строка — заголовки, если withHeader. */
|
|
1166
|
-
declare function createTable(rows: number, cols: number, withHeader?: boolean): Node;
|
|
1333
|
+
declare function createTable(rows: number, cols: number, withHeader?: boolean, schema?: NovaSchema): Node;
|
|
1167
1334
|
/** Вставить таблицу на место выделения и поставить курсор в первую ячейку. */
|
|
1168
1335
|
declare function insertTable(rows: number, cols: number, withHeader?: boolean): Command;
|
|
1169
1336
|
declare const tableCommands: {
|
|
@@ -1187,4 +1354,4 @@ declare function hasHeaderRow(state: EditorState): boolean;
|
|
|
1187
1354
|
/** Есть ли столбец-заголовок (первая ячейка каждой строки — th). */
|
|
1188
1355
|
declare function hasHeaderColumn(state: EditorState): boolean;
|
|
1189
1356
|
|
|
1190
|
-
export { type AutocompleterItem, type AutocompleterSpec, type ButtonSpec, type CommandName, ContentRules, type ContentRulesOptions, type ContextToolbarSpec, type ControlSpec, DEFAULT_MENUBAR, DEFAULT_MENUS, Editor, type EditorEvent, type EditorMode, type EditorOptions, type FontOption, type ImageAlign, KNOWN_STYLES, KNOWN_TAGS, type LinkAttrs, type MarkName, type MenuButtonSpec, type MenuDefinition, type MenuEntry, type MenuItem, type MenuItemSpec, type MessageKey, type Messages, type NodeName, type NovaPlugin, type PanelButtonSpec, type PasteOptions, type PluginEntry, Registry, type SearchMatch, type SearchOptions, type SearchState, type SlashCommand, type StyleMark, type TextAlign, type ToolbarConfig, type ToolbarMode, type Translator, UiManager, type UploadImageHandler, applyLink, clearSearch, commands, countWords, createEditor, createTable, createTranslator, cssValue, defaultColors, defaultFontFamilies, defaultFontSizes, defaultLineHeights, defaultSlashCommands, defaultToolbar, definePlugin, en, findMatches, findNext, formatHTML, getActiveAlign, getLineHeight, getLinkAt, getSearchState, getSelectedImage, getStyle, hasHeaderColumn, hasHeaderRow, htmlToPlainText, imageSize, insertImage, insertTable, isCommandActive, isFullscreen, isMarkActive, isNodeActive, isPluginRegistered, isSafeImageUrl, isSafeLinkUrl, normalizeUrl, openHelp, openImageAltDialog, openImageDialog, openLinkDialog, openPreview, openSourceCode, parseToolbar, printContent, rankSlashCommands, registerLanguage, registerPlugin, removeLink, replaceAll, replaceCurrent, ru, schema, setCellBackground, setImageAttrs, setImageWidthFraction, setLineHeight, setLink, setSearch, setStyle, tableCommands, toggleFullscreen, uploadImages };
|
|
1357
|
+
export { type AutocompleterItem, type AutocompleterSpec, type ButtonSpec, type CommandName, ContentRules, type ContentRulesOptions, type ContextToolbarSpec, type ControlSpec, DEFAULT_MENUBAR, DEFAULT_MENUS, Editor, type EditorEvent, type EditorMode, type EditorOptions, type FontOption, type ImageAlign, KNOWN_STYLES, KNOWN_TAGS, type LinkAttrs, type MarkName, 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, Registry, type SchemaExtensions, type SearchMatch, type SearchOptions, type SearchState, type SlashCommand, type StyleMark, type TextAlign, type ToolbarConfig, type ToolbarMode, type Translator, UiManager, type UploadImageHandler, applyLink, clearSearch, commands, countWords, createEditor, createSchema, createTable, createTranslator, cssValue, defaultColors, defaultFontFamilies, defaultFontSizes, defaultLineHeights, defaultSlashCommands, defaultToolbar, definePlugin, en, findMatches, findNext, formatHTML, getActiveAlign, getLineHeight, getLinkAt, getSearchState, getSelectedImage, getStyle, hasHeaderColumn, hasHeaderRow, htmlToPlainText, imageSize, insertImage, insertTable, isCommandActive, isFullscreen, isMarkActive, isNodeActive, isPluginRegistered, isSafeImageUrl, isSafeLinkUrl, marksOf, nodesOf, normalizeUrl, openHelp, openImageAltDialog, openImageDialog, openLinkDialog, openPreview, openSourceCode, parseToolbar, parserFor, printContent, rankSlashCommands, registerLanguage, registerPlugin, removeLink, replaceAll, replaceCurrent, ru, schema, setCellBackground, setImageAttrs, setImageWidthFraction, setLineHeight, setLink, setSearch, setStyle, tableCommands, toggleFullscreen, uploadImages };
|