@blockslides/ai-context 0.1.6 → 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/index.d.cts CHANGED
@@ -1,3 +1,8 @@
1
+ import { Transaction, EditorState, Plugin, PluginKey } from 'prosemirror-state';
2
+ import { Slice, Node as Node$1, Mark as Mark$1, Schema, NodeType as NodeType$1, NodeSpec, DOMOutputSpec, MarkType as MarkType$1, MarkSpec, ParseOptions, ResolvedPos, Fragment } from 'prosemirror-model';
3
+ import { NodeViewConstructor, NodeView, MarkViewConstructor, MarkView, EditorProps, EditorView } from 'prosemirror-view';
4
+ import { Transform } from 'prosemirror-transform';
5
+
1
6
  declare const core: string;
2
7
 
3
8
  declare const fullDocument: string;
@@ -8,7 +13,7 @@ declare const row: string;
8
13
 
9
14
  declare const column: string;
10
15
 
11
- declare const slide: string;
16
+ declare const slide$1: string;
12
17
 
13
18
  declare const style: string;
14
19
 
@@ -34,36 +39,35 @@ declare const paragraph: string;
34
39
 
35
40
  declare const youtube: string;
36
41
 
37
- declare const index$4_blockquote: typeof blockquote;
38
- declare const index$4_bulletList: typeof bulletList;
39
- declare const index$4_codeBlock: typeof codeBlock;
40
- declare const index$4_column: typeof column;
41
- declare const index$4_core: typeof core;
42
- declare const index$4_editingRules: typeof editingRules;
43
- declare const index$4_fullDocument: typeof fullDocument;
44
- declare const index$4_hardBreak: typeof hardBreak;
45
- declare const index$4_heading: typeof heading;
46
- declare const index$4_horizontalRule: typeof horizontalRule;
47
- declare const index$4_image: typeof image;
48
- declare const index$4_imageBlock: typeof imageBlock;
49
- declare const index$4_paragraph: typeof paragraph;
50
- declare const index$4_row: typeof row;
51
- declare const index$4_sizing: typeof sizing;
52
- declare const index$4_slide: typeof slide;
53
- declare const index$4_style: typeof style;
54
- declare const index$4_youtube: typeof youtube;
55
- declare namespace index$4 {
56
- export { index$4_blockquote as blockquote, index$4_bulletList as bulletList, index$4_codeBlock as codeBlock, index$4_column as column, index$4_core as core, index$4_editingRules as editingRules, index$4_fullDocument as fullDocument, index$4_hardBreak as hardBreak, index$4_heading as heading, index$4_horizontalRule as horizontalRule, index$4_image as image, index$4_imageBlock as imageBlock, index$4_paragraph as paragraph, index$4_row as row, index$4_sizing as sizing, index$4_slide as slide, index$4_style as style, index$4_youtube as youtube };
42
+ declare const index$5_blockquote: typeof blockquote;
43
+ declare const index$5_bulletList: typeof bulletList;
44
+ declare const index$5_codeBlock: typeof codeBlock;
45
+ declare const index$5_column: typeof column;
46
+ declare const index$5_core: typeof core;
47
+ declare const index$5_editingRules: typeof editingRules;
48
+ declare const index$5_fullDocument: typeof fullDocument;
49
+ declare const index$5_hardBreak: typeof hardBreak;
50
+ declare const index$5_heading: typeof heading;
51
+ declare const index$5_horizontalRule: typeof horizontalRule;
52
+ declare const index$5_image: typeof image;
53
+ declare const index$5_imageBlock: typeof imageBlock;
54
+ declare const index$5_paragraph: typeof paragraph;
55
+ declare const index$5_row: typeof row;
56
+ declare const index$5_sizing: typeof sizing;
57
+ declare const index$5_style: typeof style;
58
+ declare const index$5_youtube: typeof youtube;
59
+ declare namespace index$5 {
60
+ export { index$5_blockquote as blockquote, index$5_bulletList as bulletList, index$5_codeBlock as codeBlock, index$5_column as column, index$5_core as core, index$5_editingRules as editingRules, index$5_fullDocument as fullDocument, index$5_hardBreak as hardBreak, index$5_heading as heading, index$5_horizontalRule as horizontalRule, index$5_image as image, index$5_imageBlock as imageBlock, index$5_paragraph as paragraph, index$5_row as row, index$5_sizing as sizing, slide$1 as slide, index$5_style as style, index$5_youtube as youtube };
57
61
  }
58
62
 
59
63
  declare const slides: string;
60
64
 
61
65
  declare const flyers: string;
62
66
 
63
- declare const index$3_flyers: typeof flyers;
64
- declare const index$3_slides: typeof slides;
65
- declare namespace index$3 {
66
- export { index$3_flyers as flyers, index$3_slides as slides };
67
+ declare const index$4_flyers: typeof flyers;
68
+ declare const index$4_slides: typeof slides;
69
+ declare namespace index$4 {
70
+ export { index$4_flyers as flyers, index$4_slides as slides };
67
71
  }
68
72
 
69
73
  declare const minimalCreate: string;
@@ -86,13 +90,13 @@ declare const allSchemas: string;
86
90
  */
87
91
  declare const allContexts: string;
88
92
 
89
- declare const index$2_all: typeof all;
90
- declare const index$2_allContexts: typeof allContexts;
91
- declare const index$2_allSchemas: typeof allSchemas;
92
- declare const index$2_imageEditing: typeof imageEditing;
93
- declare const index$2_minimalCreate: typeof minimalCreate;
94
- declare namespace index$2 {
95
- export { index$2_all as all, index$2_allContexts as allContexts, index$2_allSchemas as allSchemas, index$2_imageEditing as imageEditing, index$2_minimalCreate as minimalCreate };
93
+ declare const index$3_all: typeof all;
94
+ declare const index$3_allContexts: typeof allContexts;
95
+ declare const index$3_allSchemas: typeof allSchemas;
96
+ declare const index$3_imageEditing: typeof imageEditing;
97
+ declare const index$3_minimalCreate: typeof minimalCreate;
98
+ declare namespace index$3 {
99
+ export { index$3_all as all, index$3_allContexts as allContexts, index$3_allSchemas as allSchemas, index$3_imageEditing as imageEditing, index$3_minimalCreate as minimalCreate };
96
100
  }
97
101
 
98
102
  declare const createSlide: string;
@@ -101,11 +105,11 @@ declare const addTwoColumns: string;
101
105
 
102
106
  declare const editImageToCover: string;
103
107
 
104
- declare const index$1_addTwoColumns: typeof addTwoColumns;
105
- declare const index$1_createSlide: typeof createSlide;
106
- declare const index$1_editImageToCover: typeof editImageToCover;
107
- declare namespace index$1 {
108
- export { index$1_addTwoColumns as addTwoColumns, index$1_createSlide as createSlide, index$1_editImageToCover as editImageToCover };
108
+ declare const index$2_addTwoColumns: typeof addTwoColumns;
109
+ declare const index$2_createSlide: typeof createSlide;
110
+ declare const index$2_editImageToCover: typeof editImageToCover;
111
+ declare namespace index$2 {
112
+ export { index$2_addTwoColumns as addTwoColumns, index$2_createSlide as createSlide, index$2_editImageToCover as editImageToCover };
109
113
  }
110
114
 
111
115
  var $schema$c = "https://json-schema.org/draft/2020-12/schema";
@@ -758,10 +762,2685 @@ var youtube_schema = {
758
762
  additionalProperties: additionalProperties
759
763
  };
760
764
 
761
- declare namespace index {
765
+ declare namespace index$1 {
762
766
  export { blockquote_schema as blockquote, bulletList_schema as bulletList, codeBlock_schema as codeBlock, column_schema as column, hardBreak_schema as hardBreak, heading_schema as heading, horizontalRule_schema as horizontalRule, image_schema as image, imageBlock_schema as imageBlock, paragraph_schema as paragraph, row_schema as row, slide_schema as slide, youtube_schema as youtube };
763
767
  }
764
768
 
769
+ type StringKeyOf<T> = Extract<keyof T, string>;
770
+ type CallbackType<T extends Record<string, any>, EventName extends StringKeyOf<T>> = T[EventName] extends any[] ? T[EventName] : [T[EventName]];
771
+ type CallbackFunction<T extends Record<string, any>, EventName extends StringKeyOf<T>> = (...props: CallbackType<T, EventName>) => any;
772
+ declare class EventEmitter<T extends Record<string, any>> {
773
+ private callbacks;
774
+ on<EventName extends StringKeyOf<T>>(event: EventName, fn: CallbackFunction<T, EventName>): this;
775
+ emit<EventName extends StringKeyOf<T>>(event: EventName, ...args: CallbackType<T, EventName>): this;
776
+ off<EventName extends StringKeyOf<T>>(event: EventName, fn?: CallbackFunction<T, EventName>): this;
777
+ once<EventName extends StringKeyOf<T>>(event: EventName, fn: CallbackFunction<T, EventName>): this;
778
+ removeAllListeners(): void;
779
+ }
780
+
781
+ /**
782
+ * Editor Theme System
783
+ *
784
+ * Defines the styling system for both editor and slides.
785
+ * Single unified theme that controls all visual aspects.
786
+ */
787
+ /**
788
+ * Complete theme definition
789
+ */
790
+ interface Theme {
791
+ name: string;
792
+ editor: {
793
+ background: string;
794
+ foreground: string;
795
+ border: string;
796
+ };
797
+ slide: {
798
+ background: string;
799
+ border: string;
800
+ borderRadius: string;
801
+ shadow: string;
802
+ marginBottom: string;
803
+ padding: string;
804
+ minHeight?: string;
805
+ };
806
+ selection: string;
807
+ selectionBg: string;
808
+ hover: string;
809
+ active: string;
810
+ focus: string;
811
+ }
812
+ /**
813
+ * Resolved theme type (can be null if no theme should be applied)
814
+ */
815
+ type ResolvedTheme = Theme | null;
816
+ /**
817
+ * Partial theme for extending/overriding built-in themes
818
+ */
819
+ type PartialTheme = {
820
+ name?: string;
821
+ editor?: Partial<Theme["editor"]>;
822
+ slide?: Partial<Theme["slide"]>;
823
+ selection?: string;
824
+ selectionBg?: string;
825
+ hover?: string;
826
+ active?: string;
827
+ focus?: string;
828
+ };
829
+ /**
830
+ * Theme configuration with optional extension
831
+ */
832
+ type ThemeConfig = PartialTheme & {
833
+ extends?: string;
834
+ };
835
+
836
+ type InputRuleMatch = {
837
+ index: number;
838
+ text: string;
839
+ replaceWith?: string;
840
+ match?: RegExpMatchArray;
841
+ data?: Record<string, any>;
842
+ };
843
+ type InputRuleFinder = RegExp | ((text: string) => InputRuleMatch | null);
844
+ declare class InputRule {
845
+ find: InputRuleFinder;
846
+ handler: (props: {
847
+ state: EditorState;
848
+ range: Range;
849
+ match: ExtendedRegExpMatchArray;
850
+ commands: SingleCommands;
851
+ chain: () => ChainedCommands;
852
+ can: () => CanCommands;
853
+ }) => void | null;
854
+ undoable: boolean;
855
+ constructor(config: {
856
+ find: InputRuleFinder;
857
+ handler: (props: {
858
+ state: EditorState;
859
+ range: Range;
860
+ match: ExtendedRegExpMatchArray;
861
+ commands: SingleCommands;
862
+ chain: () => ChainedCommands;
863
+ can: () => CanCommands;
864
+ }) => void | null;
865
+ undoable?: boolean;
866
+ });
867
+ }
868
+
869
+ interface MarkConfig<Options = any, Storage = any> extends ExtendableConfig<Options, Storage, MarkConfig<Options, Storage>, MarkType$1> {
870
+ /**
871
+ * Mark View
872
+ */
873
+ addMarkView?: ((this: {
874
+ name: string;
875
+ options: Options;
876
+ storage: Storage;
877
+ editor: SlideEditor;
878
+ type: MarkType$1;
879
+ parent: ParentConfig<MarkConfig<Options, Storage>>["addMarkView"];
880
+ }) => MarkViewRenderer) | null;
881
+ /**
882
+ * Keep mark after split node
883
+ */
884
+ keepOnSplit?: boolean | (() => boolean);
885
+ /**
886
+ * Inclusive
887
+ */
888
+ inclusive?: MarkSpec["inclusive"] | ((this: {
889
+ name: string;
890
+ options: Options;
891
+ storage: Storage;
892
+ parent: ParentConfig<MarkConfig<Options, Storage>>["inclusive"];
893
+ editor?: SlideEditor;
894
+ }) => MarkSpec["inclusive"]);
895
+ /**
896
+ * Excludes
897
+ */
898
+ excludes?: MarkSpec["excludes"] | ((this: {
899
+ name: string;
900
+ options: Options;
901
+ storage: Storage;
902
+ parent: ParentConfig<MarkConfig<Options, Storage>>["excludes"];
903
+ editor?: SlideEditor;
904
+ }) => MarkSpec["excludes"]);
905
+ /**
906
+ * Marks this Mark as exitable
907
+ */
908
+ exitable?: boolean | (() => boolean);
909
+ /**
910
+ * Group
911
+ */
912
+ group?: MarkSpec["group"] | ((this: {
913
+ name: string;
914
+ options: Options;
915
+ storage: Storage;
916
+ parent: ParentConfig<MarkConfig<Options, Storage>>["group"];
917
+ editor?: SlideEditor;
918
+ }) => MarkSpec["group"]);
919
+ /**
920
+ * Spanning
921
+ */
922
+ spanning?: MarkSpec["spanning"] | ((this: {
923
+ name: string;
924
+ options: Options;
925
+ storage: Storage;
926
+ parent: ParentConfig<MarkConfig<Options, Storage>>["spanning"];
927
+ editor?: SlideEditor;
928
+ }) => MarkSpec["spanning"]);
929
+ /**
930
+ * Code
931
+ */
932
+ code?: boolean | ((this: {
933
+ name: string;
934
+ options: Options;
935
+ storage: Storage;
936
+ parent: ParentConfig<MarkConfig<Options, Storage>>["code"];
937
+ editor?: SlideEditor;
938
+ }) => boolean);
939
+ /**
940
+ * Parse HTML
941
+ */
942
+ parseHTML?: (this: {
943
+ name: string;
944
+ options: Options;
945
+ storage: Storage;
946
+ parent: ParentConfig<MarkConfig<Options, Storage>>["parseHTML"];
947
+ editor?: SlideEditor;
948
+ }) => MarkSpec["parseDOM"];
949
+ /**
950
+ * Render HTML
951
+ */
952
+ renderHTML?: ((this: {
953
+ name: string;
954
+ options: Options;
955
+ storage: Storage;
956
+ parent: ParentConfig<MarkConfig<Options, Storage>>["renderHTML"];
957
+ editor?: SlideEditor;
958
+ }, props: {
959
+ mark: Mark$1;
960
+ HTMLAttributes: Record<string, any>;
961
+ }) => DOMOutputSpec) | null;
962
+ /**
963
+ * Attributes
964
+ */
965
+ addAttributes?: (this: {
966
+ name: string;
967
+ options: Options;
968
+ storage: Storage;
969
+ parent: ParentConfig<MarkConfig<Options, Storage>>["addAttributes"];
970
+ editor?: SlideEditor;
971
+ }) => Attributes$1 | {};
972
+ }
973
+ declare class Mark<Options = any, Storage = any> extends Extendable<Options, Storage, MarkConfig<Options, Storage>> {
974
+ type: string;
975
+ /**
976
+ * Create a new Mark instance
977
+ * @param config - Mark configuration object or a function that returns a configuration object
978
+ */
979
+ static create<O = any, S = any>(config?: Partial<MarkConfig<O, S>> | (() => Partial<MarkConfig<O, S>>)): Mark<O, S>;
980
+ static handleExit({ editor, mark }: {
981
+ editor: SlideEditor;
982
+ mark: Mark;
983
+ }): boolean;
984
+ configure(options?: Partial<Options>): Mark<Options, Storage>;
985
+ extend<ExtendedOptions = Options, ExtendedStorage = Storage, ExtendedConfig = MarkConfig<ExtendedOptions, ExtendedStorage>>(extendedConfig?: (() => Partial<ExtendedConfig>) | (Partial<ExtendedConfig> & ThisType<{
986
+ name: string;
987
+ options: ExtendedOptions;
988
+ storage: ExtendedStorage;
989
+ editor: SlideEditor;
990
+ type: MarkType$1;
991
+ }>)): Mark<ExtendedOptions, ExtendedStorage>;
992
+ }
993
+
994
+ interface NodeConfig<Options = any, Storage = any> extends ExtendableConfig<Options, Storage, NodeConfig<Options, Storage>, NodeType$1> {
995
+ /**
996
+ * Node View
997
+ */
998
+ addNodeView?: ((this: {
999
+ name: string;
1000
+ options: Options;
1001
+ storage: Storage;
1002
+ editor: SlideEditor;
1003
+ type: NodeType$1;
1004
+ parent: ParentConfig<NodeConfig<Options, Storage>>["addNodeView"];
1005
+ }) => NodeViewRenderer) | null;
1006
+ /**
1007
+ * Defines if this node should be a top level node (doc)
1008
+ * @default false
1009
+ * @example true
1010
+ */
1011
+ topNode?: boolean;
1012
+ /**
1013
+ * The content expression for this node, as described in the [schema
1014
+ * guide](/docs/guide/#schema.content_expressions). When not given,
1015
+ * the node does not allow any content.
1016
+ *
1017
+ * You can read more about it on the Prosemirror documentation here
1018
+ * @see https://prosemirror.net/docs/guide/#schema.content_expressions
1019
+ * @default undefined
1020
+ * @example content: 'block+'
1021
+ * @example content: 'headline paragraph block*'
1022
+ */
1023
+ content?: NodeSpec["content"] | ((this: {
1024
+ name: string;
1025
+ options: Options;
1026
+ storage: Storage;
1027
+ parent: ParentConfig<NodeConfig<Options, Storage>>["content"];
1028
+ editor?: SlideEditor;
1029
+ }) => NodeSpec["content"]);
1030
+ /**
1031
+ * The marks that are allowed inside of this node. May be a
1032
+ * space-separated string referring to mark names or groups, `"_"`
1033
+ * to explicitly allow all marks, or `""` to disallow marks. When
1034
+ * not given, nodes with inline content default to allowing all
1035
+ * marks, other nodes default to not allowing marks.
1036
+ *
1037
+ * @example marks: 'strong em'
1038
+ */
1039
+ marks?: NodeSpec["marks"] | ((this: {
1040
+ name: string;
1041
+ options: Options;
1042
+ storage: Storage;
1043
+ parent: ParentConfig<NodeConfig<Options, Storage>>["marks"];
1044
+ editor?: SlideEditor;
1045
+ }) => NodeSpec["marks"]);
1046
+ /**
1047
+ * The group or space-separated groups to which this node belongs,
1048
+ * which can be referred to in the content expressions for the
1049
+ * schema.
1050
+ *
1051
+ * By default BlockSlides uses the groups 'block' and 'inline' for nodes. You
1052
+ * can also use custom groups if you want to group specific nodes together
1053
+ * and handle them in your schema.
1054
+ * @example group: 'block'
1055
+ * @example group: 'inline'
1056
+ * @example group: 'customBlock' // this uses a custom group
1057
+ */
1058
+ group?: NodeSpec["group"] | ((this: {
1059
+ name: string;
1060
+ options: Options;
1061
+ storage: Storage;
1062
+ parent: ParentConfig<NodeConfig<Options, Storage>>["group"];
1063
+ editor?: SlideEditor;
1064
+ }) => NodeSpec["group"]);
1065
+ /**
1066
+ * Should be set to true for inline nodes. (Implied for text nodes.)
1067
+ */
1068
+ inline?: NodeSpec["inline"] | ((this: {
1069
+ name: string;
1070
+ options: Options;
1071
+ storage: Storage;
1072
+ parent: ParentConfig<NodeConfig<Options, Storage>>["inline"];
1073
+ editor?: SlideEditor;
1074
+ }) => NodeSpec["inline"]);
1075
+ /**
1076
+ * Can be set to true to indicate that, though this isn't a [leaf
1077
+ * node](https://prosemirror.net/docs/ref/#model.NodeType.isLeaf), it doesn't have directly editable
1078
+ * content and should be treated as a single unit in the view.
1079
+ *
1080
+ * @example atom: true
1081
+ */
1082
+ atom?: NodeSpec["atom"] | ((this: {
1083
+ name: string;
1084
+ options: Options;
1085
+ storage: Storage;
1086
+ parent: ParentConfig<NodeConfig<Options, Storage>>["atom"];
1087
+ editor?: SlideEditor;
1088
+ }) => NodeSpec["atom"]);
1089
+ /**
1090
+ * Controls whether nodes of this type can be selected as a [node
1091
+ * selection](https://prosemirror.net/docs/ref/#state.NodeSelection). Defaults to true for non-text
1092
+ * nodes.
1093
+ *
1094
+ * @default true
1095
+ * @example selectable: false
1096
+ */
1097
+ selectable?: NodeSpec["selectable"] | ((this: {
1098
+ name: string;
1099
+ options: Options;
1100
+ storage: Storage;
1101
+ parent: ParentConfig<NodeConfig<Options, Storage>>["selectable"];
1102
+ editor?: SlideEditor;
1103
+ }) => NodeSpec["selectable"]);
1104
+ /**
1105
+ * Determines whether nodes of this type can be dragged without
1106
+ * being selected. Defaults to false.
1107
+ *
1108
+ * @default: false
1109
+ * @example: draggable: true
1110
+ */
1111
+ draggable?: NodeSpec["draggable"] | ((this: {
1112
+ name: string;
1113
+ options: Options;
1114
+ storage: Storage;
1115
+ parent: ParentConfig<NodeConfig<Options, Storage>>["draggable"];
1116
+ editor?: SlideEditor;
1117
+ }) => NodeSpec["draggable"]);
1118
+ /**
1119
+ * Can be used to indicate that this node contains code, which
1120
+ * causes some commands to behave differently.
1121
+ */
1122
+ code?: NodeSpec["code"] | ((this: {
1123
+ name: string;
1124
+ options: Options;
1125
+ storage: Storage;
1126
+ parent: ParentConfig<NodeConfig<Options, Storage>>["code"];
1127
+ editor?: SlideEditor;
1128
+ }) => NodeSpec["code"]);
1129
+ /**
1130
+ * Controls way whitespace in this a node is parsed. The default is
1131
+ * `"normal"`, which causes the [DOM parser](https://prosemirror.net/docs/ref/#model.DOMParser) to
1132
+ * collapse whitespace in normal mode, and normalize it (replacing
1133
+ * newlines and such with spaces) otherwise. `"pre"` causes the
1134
+ * parser to preserve spaces inside the node. When this option isn't
1135
+ * given, but [`code`](https://prosemirror.net/docs/ref/#model.NodeSpec.code) is true, `whitespace`
1136
+ * will default to `"pre"`. Note that this option doesn't influence
1137
+ * the way the node is rendered—that should be handled by `toDOM`
1138
+ * and/or styling.
1139
+ */
1140
+ whitespace?: NodeSpec["whitespace"] | ((this: {
1141
+ name: string;
1142
+ options: Options;
1143
+ storage: Storage;
1144
+ parent: ParentConfig<NodeConfig<Options, Storage>>["whitespace"];
1145
+ editor?: SlideEditor;
1146
+ }) => NodeSpec["whitespace"]);
1147
+ /**
1148
+ * Allows a **single** node to be set as linebreak equivalent (e.g. hardBreak).
1149
+ * When converting between block types that have whitespace set to "pre"
1150
+ * and don't support the linebreak node (e.g. codeBlock) and other block types
1151
+ * that do support the linebreak node (e.g. paragraphs) - this node will be used
1152
+ * as the linebreak instead of stripping the newline.
1153
+ *
1154
+ * See [linebreakReplacement](https://prosemirror.net/docs/ref/#model.NodeSpec.linebreakReplacement).
1155
+ */
1156
+ linebreakReplacement?: NodeSpec["linebreakReplacement"] | ((this: {
1157
+ name: string;
1158
+ options: Options;
1159
+ storage: Storage;
1160
+ parent: ParentConfig<NodeConfig<Options, Storage>>["linebreakReplacement"];
1161
+ editor?: SlideEditor;
1162
+ }) => NodeSpec["linebreakReplacement"]);
1163
+ /**
1164
+ * When enabled, enables both
1165
+ * [`definingAsContext`](https://prosemirror.net/docs/ref/#model.NodeSpec.definingAsContext) and
1166
+ * [`definingForContent`](https://prosemirror.net/docs/ref/#model.NodeSpec.definingForContent).
1167
+ *
1168
+ * @default false
1169
+ * @example isolating: true
1170
+ */
1171
+ defining?: NodeSpec["defining"] | ((this: {
1172
+ name: string;
1173
+ options: Options;
1174
+ storage: Storage;
1175
+ parent: ParentConfig<NodeConfig<Options, Storage>>["defining"];
1176
+ editor?: SlideEditor;
1177
+ }) => NodeSpec["defining"]);
1178
+ /**
1179
+ * When enabled (default is false), the sides of nodes of this type
1180
+ * count as boundaries that regular editing operations, like
1181
+ * backspacing or lifting, won't cross. An example of a node that
1182
+ * should probably have this enabled is a table cell.
1183
+ */
1184
+ isolating?: NodeSpec["isolating"] | ((this: {
1185
+ name: string;
1186
+ options: Options;
1187
+ storage: Storage;
1188
+ parent: ParentConfig<NodeConfig<Options, Storage>>["isolating"];
1189
+ editor?: SlideEditor;
1190
+ }) => NodeSpec["isolating"]);
1191
+ /**
1192
+ * Associates DOM parser information with this node, which can be
1193
+ * used by [`DOMParser.fromSchema`](https://prosemirror.net/docs/ref/#model.DOMParser^fromSchema) to
1194
+ * automatically derive a parser. The `node` field in the rules is
1195
+ * implied (the name of this node will be filled in automatically).
1196
+ * If you supply your own parser, you do not need to also specify
1197
+ * parsing rules in your schema.
1198
+ *
1199
+ * @example parseHTML: [{ tag: 'div', attrs: { 'data-id': 'my-block' } }]
1200
+ */
1201
+ parseHTML?: (this: {
1202
+ name: string;
1203
+ options: Options;
1204
+ storage: Storage;
1205
+ parent: ParentConfig<NodeConfig<Options, Storage>>["parseHTML"];
1206
+ editor?: SlideEditor;
1207
+ }) => NodeSpec["parseDOM"];
1208
+ /**
1209
+ * A description of a DOM structure. Can be either a string, which is
1210
+ * interpreted as a text node, a DOM node, which is interpreted as
1211
+ * itself, a `{dom, contentDOM}` object, or an array.
1212
+ *
1213
+ * An array describes a DOM element. The first value in the array
1214
+ * should be a string—the name of the DOM element, optionally prefixed
1215
+ * by a namespace URL and a space. If the second element is plain
1216
+ * object, it is interpreted as a set of attributes for the element.
1217
+ * Any elements after that (including the 2nd if it's not an attribute
1218
+ * object) are interpreted as children of the DOM elements, and must
1219
+ * either be valid `DOMOutputSpec` values, or the number zero.
1220
+ *
1221
+ * The number zero (pronounced “hole”) is used to indicate the place
1222
+ * where a node's child nodes should be inserted. If it occurs in an
1223
+ * output spec, it should be the only child element in its parent
1224
+ * node.
1225
+ *
1226
+ * @example toDOM: ['div[data-id="my-block"]', { class: 'my-block' }, 0]
1227
+ */
1228
+ renderHTML?: ((this: {
1229
+ name: string;
1230
+ options: Options;
1231
+ storage: Storage;
1232
+ parent: ParentConfig<NodeConfig<Options, Storage>>["renderHTML"];
1233
+ editor?: SlideEditor;
1234
+ }, props: {
1235
+ node: Node$1;
1236
+ HTMLAttributes: Record<string, any>;
1237
+ }) => DOMOutputSpec) | null;
1238
+ /**
1239
+ * renders the node as text
1240
+ * @example renderText: () => 'foo
1241
+ */
1242
+ renderText?: ((this: {
1243
+ name: string;
1244
+ options: Options;
1245
+ storage: Storage;
1246
+ parent: ParentConfig<NodeConfig<Options, Storage>>["renderText"];
1247
+ editor?: SlideEditor;
1248
+ }, props: {
1249
+ node: Node$1;
1250
+ pos: number;
1251
+ parent: Node$1;
1252
+ index: number;
1253
+ }) => string) | null;
1254
+ /**
1255
+ * Add attributes to the node
1256
+ * @example addAttributes: () => ({ class: 'foo' })
1257
+ */
1258
+ addAttributes?: (this: {
1259
+ name: string;
1260
+ options: Options;
1261
+ storage: Storage;
1262
+ parent: ParentConfig<NodeConfig<Options, Storage>>["addAttributes"];
1263
+ editor?: SlideEditor;
1264
+ }) => Attributes$1 | {};
1265
+ }
1266
+ declare class Node<Options = any, Storage = any> extends Extendable<Options, Storage, NodeConfig<Options, Storage>> {
1267
+ type: string;
1268
+ /**
1269
+ * Create a new Node instance
1270
+ * @param config - Node configuration object or a function that returns a configuration object
1271
+ */
1272
+ static create<O = any, S = any>(config?: Partial<NodeConfig<O, S>> | (() => Partial<NodeConfig<O, S>>)): Node<O, S>;
1273
+ configure(options?: Partial<Options>): Node<Options, Storage>;
1274
+ extend<ExtendedOptions = Options, ExtendedStorage = Storage, ExtendedConfig = NodeConfig<ExtendedOptions, ExtendedStorage>>(extendedConfig?: (() => Partial<ExtendedConfig>) | (Partial<ExtendedConfig> & ThisType<{
1275
+ name: string;
1276
+ options: ExtendedOptions;
1277
+ storage: ExtendedStorage;
1278
+ editor: SlideEditor;
1279
+ type: NodeType$1;
1280
+ }>)): Node<ExtendedOptions, ExtendedStorage>;
1281
+ }
1282
+
1283
+ type PasteRuleMatch = {
1284
+ index: number;
1285
+ text: string;
1286
+ replaceWith?: string;
1287
+ match?: RegExpMatchArray;
1288
+ data?: Record<string, any>;
1289
+ };
1290
+ type PasteRuleFinder = RegExp | ((text: string, event?: ClipboardEvent | null) => PasteRuleMatch[] | null | undefined);
1291
+ declare class PasteRule {
1292
+ find: PasteRuleFinder;
1293
+ handler: (props: {
1294
+ state: EditorState;
1295
+ range: Range;
1296
+ match: ExtendedRegExpMatchArray;
1297
+ commands: SingleCommands;
1298
+ chain: () => ChainedCommands;
1299
+ can: () => CanCommands;
1300
+ pasteEvent: ClipboardEvent | null;
1301
+ dropEvent: DragEvent | null;
1302
+ }) => void | null;
1303
+ constructor(config: {
1304
+ find: PasteRuleFinder;
1305
+ handler: (props: {
1306
+ can: () => CanCommands;
1307
+ chain: () => ChainedCommands;
1308
+ commands: SingleCommands;
1309
+ dropEvent: DragEvent | null;
1310
+ match: ExtendedRegExpMatchArray;
1311
+ pasteEvent: ClipboardEvent | null;
1312
+ range: Range;
1313
+ state: EditorState;
1314
+ }) => void | null;
1315
+ });
1316
+ }
1317
+
1318
+ interface ExtendableConfig<Options = any, Storage = any, Config extends ExtensionConfig<Options, Storage> | NodeConfig<Options, Storage> | MarkConfig<Options, Storage> | ExtendableConfig<Options, Storage> = ExtendableConfig<Options, Storage, any, any>, PMType = any> {
1319
+ /**
1320
+ * The extension name - this must be unique.
1321
+ * It will be used to identify the extension.
1322
+ *
1323
+ * @example 'myExtension'
1324
+ */
1325
+ name: string;
1326
+ /**
1327
+ * The priority of your extension. The higher, the earlier it will be called
1328
+ * and will take precedence over other extensions with a lower priority.
1329
+ * @default 100
1330
+ * @example 101
1331
+ */
1332
+ priority?: number;
1333
+ addOptions?: (this: {
1334
+ name: string;
1335
+ parent: ParentConfig<Config>["addOptions"];
1336
+ }) => Options;
1337
+ addStorage?: (this: {
1338
+ name: string;
1339
+ options: Options;
1340
+ parent: ParentConfig<Config>["addStorage"];
1341
+ }) => Storage;
1342
+ addGlobalAttributes?: (this: {
1343
+ name: string;
1344
+ options: Options;
1345
+ storage: Storage;
1346
+ extensions: (Node | Mark)[];
1347
+ parent: ParentConfig<Config>["addGlobalAttributes"];
1348
+ }) => GlobalAttributes;
1349
+ addCommands?: (this: {
1350
+ name: string;
1351
+ options: Options;
1352
+ storage: Storage;
1353
+ editor: SlideEditor;
1354
+ type: PMType;
1355
+ parent: ParentConfig<Config>["addCommands"];
1356
+ }) => Partial<RawCommands>;
1357
+ addKeyboardShortcuts?: (this: {
1358
+ name: string;
1359
+ options: Options;
1360
+ storage: Storage;
1361
+ editor: SlideEditor;
1362
+ type: PMType;
1363
+ parent: ParentConfig<Config>["addKeyboardShortcuts"];
1364
+ }) => {
1365
+ [key: string]: KeyboardShortcutCommand;
1366
+ };
1367
+ addInputRules?: (this: {
1368
+ name: string;
1369
+ options: Options;
1370
+ storage: Storage;
1371
+ editor: SlideEditor;
1372
+ type: PMType;
1373
+ parent: ParentConfig<Config>["addInputRules"];
1374
+ }) => InputRule[];
1375
+ addPasteRules?: (this: {
1376
+ name: string;
1377
+ options: Options;
1378
+ storage: Storage;
1379
+ editor: SlideEditor;
1380
+ type: PMType;
1381
+ parent: ParentConfig<Config>["addPasteRules"];
1382
+ }) => PasteRule[];
1383
+ addProseMirrorPlugins?: (this: {
1384
+ name: string;
1385
+ options: Options;
1386
+ storage: Storage;
1387
+ editor: SlideEditor;
1388
+ type: PMType;
1389
+ parent: ParentConfig<Config>["addProseMirrorPlugins"];
1390
+ }) => Plugin[];
1391
+ addExtensions?: (this: {
1392
+ name: string;
1393
+ options: Options;
1394
+ storage: Storage;
1395
+ parent: ParentConfig<Config>["addExtensions"];
1396
+ }) => Extensions;
1397
+ markdownTokenName?: string;
1398
+ /**
1399
+ * The parse function used by the markdown parser to convert markdown tokens to ProseMirror nodes.
1400
+ */
1401
+ parseMarkdown?: (token: MarkdownToken, helpers: MarkdownParseHelpers) => MarkdownParseResult;
1402
+ /**
1403
+ * The serializer function used by the markdown serializer to convert ProseMirror nodes to markdown tokens.
1404
+ */
1405
+ renderMarkdown?: (node: JSONContent, helpers: MarkdownRendererHelpers, ctx: RenderContext) => string;
1406
+ /**
1407
+ * The markdown tokenizer responsible for turning a markdown string into tokens
1408
+ *
1409
+ * Custom tokenizers are only needed when you want to parse non-standard markdown token.
1410
+ */
1411
+ markdownTokenizer?: MarkdownTokenizer;
1412
+ /**
1413
+ * Optional markdown options for indentation
1414
+ */
1415
+ markdownOptions?: {
1416
+ /**
1417
+ * Defines if this markdown element should indent it's child elements
1418
+ */
1419
+ indentsContent?: boolean;
1420
+ };
1421
+ /**
1422
+ * This function extends the schema of the node.
1423
+ * @example
1424
+ * extendNodeSchema() {
1425
+ * return {
1426
+ * group: 'inline',
1427
+ * selectable: false,
1428
+ * }
1429
+ * }
1430
+ */
1431
+ extendNodeSchema?: ((this: {
1432
+ name: string;
1433
+ options: Options;
1434
+ storage: Storage;
1435
+ parent: ParentConfig<Config>["extendNodeSchema"];
1436
+ }, extension: Node) => Record<string, any>) | null;
1437
+ /**
1438
+ * This function extends the schema of the mark.
1439
+ * @example
1440
+ * extendMarkSchema() {
1441
+ * return {
1442
+ * group: 'inline',
1443
+ * selectable: false,
1444
+ * }
1445
+ * }
1446
+ */
1447
+ extendMarkSchema?: ((this: {
1448
+ name: string;
1449
+ options: Options;
1450
+ storage: Storage;
1451
+ parent: ParentConfig<Config>["extendMarkSchema"];
1452
+ }, extension: Mark) => Record<string, any>) | null;
1453
+ /**
1454
+ * The editor is not ready yet.
1455
+ */
1456
+ onBeforeCreate?: ((this: {
1457
+ name: string;
1458
+ options: Options;
1459
+ storage: Storage;
1460
+ editor: SlideEditor;
1461
+ type: PMType;
1462
+ parent: ParentConfig<Config>["onBeforeCreate"];
1463
+ }, event: EditorEvents["beforeCreate"]) => void) | null;
1464
+ /**
1465
+ * The editor is ready.
1466
+ */
1467
+ onCreate?: ((this: {
1468
+ name: string;
1469
+ options: Options;
1470
+ storage: Storage;
1471
+ editor: SlideEditor;
1472
+ type: PMType;
1473
+ parent: ParentConfig<Config>["onCreate"];
1474
+ }, event: EditorEvents["create"]) => void) | null;
1475
+ /**
1476
+ * The content has changed.
1477
+ */
1478
+ onUpdate?: ((this: {
1479
+ name: string;
1480
+ options: Options;
1481
+ storage: Storage;
1482
+ editor: SlideEditor;
1483
+ type: PMType;
1484
+ parent: ParentConfig<Config>["onUpdate"];
1485
+ }, event: EditorEvents["update"]) => void) | null;
1486
+ /**
1487
+ * The selection has changed.
1488
+ */
1489
+ onSelectionUpdate?: ((this: {
1490
+ name: string;
1491
+ options: Options;
1492
+ storage: Storage;
1493
+ editor: SlideEditor;
1494
+ type: PMType;
1495
+ parent: ParentConfig<Config>["onSelectionUpdate"];
1496
+ }, event: EditorEvents["selectionUpdate"]) => void) | null;
1497
+ /**
1498
+ * The editor state has changed.
1499
+ */
1500
+ onTransaction?: ((this: {
1501
+ name: string;
1502
+ options: Options;
1503
+ storage: Storage;
1504
+ editor: SlideEditor;
1505
+ type: PMType;
1506
+ parent: ParentConfig<Config>["onTransaction"];
1507
+ }, event: EditorEvents["transaction"]) => void) | null;
1508
+ /**
1509
+ * The editor is focused.
1510
+ */
1511
+ onFocus?: ((this: {
1512
+ name: string;
1513
+ options: Options;
1514
+ storage: Storage;
1515
+ editor: SlideEditor;
1516
+ type: PMType;
1517
+ parent: ParentConfig<Config>["onFocus"];
1518
+ }, event: EditorEvents["focus"]) => void) | null;
1519
+ /**
1520
+ * The editor isn’t focused anymore.
1521
+ */
1522
+ onBlur?: ((this: {
1523
+ name: string;
1524
+ options: Options;
1525
+ storage: Storage;
1526
+ editor: SlideEditor;
1527
+ type: PMType;
1528
+ parent: ParentConfig<Config>["onBlur"];
1529
+ }, event: EditorEvents["blur"]) => void) | null;
1530
+ /**
1531
+ * The editor is destroyed.
1532
+ */
1533
+ onDestroy?: ((this: {
1534
+ name: string;
1535
+ options: Options;
1536
+ storage: Storage;
1537
+ editor: SlideEditor;
1538
+ type: PMType;
1539
+ parent: ParentConfig<Config>["onDestroy"];
1540
+ }, event: EditorEvents["destroy"]) => void) | null;
1541
+ }
1542
+ declare class Extendable<Options = any, Storage = any, Config = ExtensionConfig<Options, Storage> | NodeConfig<Options, Storage> | MarkConfig<Options, Storage>> {
1543
+ type: string;
1544
+ parent: Extendable | null;
1545
+ child: Extendable | null;
1546
+ name: string;
1547
+ config: Config;
1548
+ constructor(config?: Partial<Config>);
1549
+ get options(): Options;
1550
+ get storage(): Readonly<Storage>;
1551
+ configure(options?: Partial<Options>): Extendable<Options, Storage, ExtensionConfig<Options, Storage> | NodeConfig<Options, Storage> | MarkConfig<Options, Storage>>;
1552
+ extend<ExtendedOptions = Options, ExtendedStorage = Storage, ExtendedConfig = ExtensionConfig<ExtendedOptions, ExtendedStorage> | NodeConfig<ExtendedOptions, ExtendedStorage> | MarkConfig<ExtendedOptions, ExtendedStorage>>(extendedConfig?: Partial<ExtendedConfig>): Extendable<ExtendedOptions, ExtendedStorage>;
1553
+ }
1554
+ type AnyExtension = Extendable;
1555
+ type Extensions = AnyExtension[];
1556
+ type ParentConfig<T> = Partial<{
1557
+ [P in keyof T]: Required<T>[P] extends (...args: any) => any ? (...args: Parameters<Required<T>[P]>) => ReturnType<Required<T>[P]> : T[P];
1558
+ }>;
1559
+ interface EditorEvents {
1560
+ mount: {
1561
+ /**
1562
+ * The editor instance
1563
+ */
1564
+ editor: SlideEditor;
1565
+ };
1566
+ unmount: {
1567
+ /**
1568
+ * The editor instance
1569
+ */
1570
+ editor: SlideEditor;
1571
+ };
1572
+ beforeCreate: {
1573
+ /**
1574
+ * The editor instance
1575
+ */
1576
+ editor: SlideEditor;
1577
+ };
1578
+ create: {
1579
+ /**
1580
+ * The editor instance
1581
+ */
1582
+ editor: SlideEditor;
1583
+ };
1584
+ contentError: {
1585
+ /**
1586
+ * The editor instance
1587
+ */
1588
+ editor: SlideEditor;
1589
+ /**
1590
+ * The error that occurred while parsing the content
1591
+ */
1592
+ error: Error;
1593
+ /**
1594
+ * If called, will re-initialize the editor with the collaboration extension removed.
1595
+ * This will prevent syncing back deletions of content not present in the current schema.
1596
+ */
1597
+ disableCollaboration: () => void;
1598
+ };
1599
+ update: {
1600
+ /**
1601
+ * The editor instance
1602
+ */
1603
+ editor: SlideEditor;
1604
+ /**
1605
+ * The transaction that caused the update
1606
+ */
1607
+ transaction: Transaction;
1608
+ /**
1609
+ * Appended transactions that were added to the initial transaction by plugins
1610
+ */
1611
+ appendedTransactions: Transaction[];
1612
+ };
1613
+ selectionUpdate: {
1614
+ /**
1615
+ * The editor instance
1616
+ */
1617
+ editor: SlideEditor;
1618
+ /**
1619
+ * The transaction that caused the selection update
1620
+ */
1621
+ transaction: Transaction;
1622
+ };
1623
+ beforeTransaction: {
1624
+ /**
1625
+ * The editor instance
1626
+ */
1627
+ editor: SlideEditor;
1628
+ /**
1629
+ * The transaction that will be applied
1630
+ */
1631
+ transaction: Transaction;
1632
+ /**
1633
+ * The next state of the editor after the transaction is applied
1634
+ */
1635
+ nextState: EditorState;
1636
+ };
1637
+ transaction: {
1638
+ /**
1639
+ * The editor instance
1640
+ */
1641
+ editor: SlideEditor;
1642
+ /**
1643
+ * The initial transaction
1644
+ */
1645
+ transaction: Transaction;
1646
+ /**
1647
+ * Appended transactions that were added to the initial transaction by plugins
1648
+ */
1649
+ appendedTransactions: Transaction[];
1650
+ };
1651
+ focus: {
1652
+ /**
1653
+ * The editor instance
1654
+ */
1655
+ editor: SlideEditor;
1656
+ /**
1657
+ * The focus event
1658
+ */
1659
+ event: FocusEvent;
1660
+ /**
1661
+ * The transaction that caused the focus
1662
+ */
1663
+ transaction: Transaction;
1664
+ };
1665
+ blur: {
1666
+ /**
1667
+ * The editor instance
1668
+ */
1669
+ editor: SlideEditor;
1670
+ /**
1671
+ * The focus event
1672
+ */
1673
+ event: FocusEvent;
1674
+ /**
1675
+ * The transaction that caused the blur
1676
+ */
1677
+ transaction: Transaction;
1678
+ };
1679
+ destroy: void;
1680
+ paste: {
1681
+ /**
1682
+ * The editor instance
1683
+ */
1684
+ editor: SlideEditor;
1685
+ /**
1686
+ * The clipboard event
1687
+ */
1688
+ event: ClipboardEvent;
1689
+ /**
1690
+ * The slice that was pasted
1691
+ */
1692
+ slice: Slice;
1693
+ };
1694
+ drop: {
1695
+ /**
1696
+ * The editor instance
1697
+ */
1698
+ editor: SlideEditor;
1699
+ /**
1700
+ * The drag event
1701
+ */
1702
+ event: DragEvent;
1703
+ /**
1704
+ * The slice that was dropped
1705
+ */
1706
+ slice: Slice;
1707
+ /**
1708
+ * Whether the content was moved (true) or copied (false)
1709
+ */
1710
+ moved: boolean;
1711
+ };
1712
+ delete: {
1713
+ /**
1714
+ * The editor instance
1715
+ */
1716
+ editor: SlideEditor;
1717
+ /**
1718
+ * The range of the deleted content (before the deletion)
1719
+ */
1720
+ deletedRange: Range;
1721
+ /**
1722
+ * The new range of positions of where the deleted content was in the new document (after the deletion)
1723
+ */
1724
+ newRange: Range;
1725
+ /**
1726
+ * The transaction that caused the deletion
1727
+ */
1728
+ transaction: Transaction;
1729
+ /**
1730
+ * The combined transform (including all appended transactions) that caused the deletion
1731
+ */
1732
+ combinedTransform: Transform;
1733
+ /**
1734
+ * Whether the deletion was partial (only a part of this content was deleted)
1735
+ */
1736
+ partial: boolean;
1737
+ /**
1738
+ * This is the start position of the mark in the document (before the deletion)
1739
+ */
1740
+ from: number;
1741
+ /**
1742
+ * This is the end position of the mark in the document (before the deletion)
1743
+ */
1744
+ to: number;
1745
+ } & ({
1746
+ /**
1747
+ * The content that was deleted
1748
+ */
1749
+ type: "node";
1750
+ /**
1751
+ * The node which the deletion occurred in
1752
+ * @note This can be a parent node of the deleted content
1753
+ */
1754
+ node: Node$1;
1755
+ /**
1756
+ * The new start position of the node in the document (after the deletion)
1757
+ */
1758
+ newFrom: number;
1759
+ /**
1760
+ * The new end position of the node in the document (after the deletion)
1761
+ */
1762
+ newTo: number;
1763
+ } | {
1764
+ /**
1765
+ * The content that was deleted
1766
+ */
1767
+ type: "mark";
1768
+ /**
1769
+ * The mark that was deleted
1770
+ */
1771
+ mark: Mark$1;
1772
+ });
1773
+ }
1774
+ type EnableRules = (AnyExtension | string)[] | boolean;
1775
+ interface EditorOptions {
1776
+ /**
1777
+ * The element to bind the editor to:
1778
+ * - If an `Element` is passed, the editor will be mounted appended to that element
1779
+ * - If `null` is passed, the editor will not be mounted automatically
1780
+ * - If an object with a `mount` property is passed, the editor will be mounted to that element
1781
+ * - If a function is passed, it will be called with the editor's element, which should place the editor within the document
1782
+ */
1783
+ element: Element | {
1784
+ mount: HTMLElement;
1785
+ } | ((editor: HTMLElement) => void) | null;
1786
+ /**
1787
+ * The content of the editor (HTML, JSON, or a JSON array)
1788
+ */
1789
+ content: Content;
1790
+ /**
1791
+ * The extensions to use
1792
+ */
1793
+ extensions: Extensions;
1794
+ /**
1795
+ * Editor theme for UI styling
1796
+ *
1797
+ * Can be:
1798
+ * - String: 'light' or 'dark' (built-in themes)
1799
+ * - Full theme object with all colors
1800
+ * - Partial theme with extends property to override built-in theme
1801
+ *
1802
+ * @default undefined (no theme applied)
1803
+ * @example 'light'
1804
+ * @example 'dark'
1805
+ * @example { name: 'custom', colors: { background: '#000', ... } }
1806
+ * @example { extends: 'dark', colors: { background: '#0a0a0a' } }
1807
+ */
1808
+ theme?: string | Theme | ThemeConfig;
1809
+ /**
1810
+ * Whether to inject base CSS styles
1811
+ */
1812
+ injectCSS: boolean;
1813
+ /**
1814
+ * A nonce to use for CSP while injecting styles
1815
+ */
1816
+ injectNonce: string | undefined;
1817
+ /**
1818
+ * The editor's initial focus position
1819
+ */
1820
+ autofocus: FocusPosition;
1821
+ /**
1822
+ * Whether the editor is editable
1823
+ */
1824
+ editable: boolean;
1825
+ /**
1826
+ * The editor's props
1827
+ */
1828
+ editorProps: EditorProps;
1829
+ /**
1830
+ * The editor's content parser options
1831
+ */
1832
+ parseOptions: ParseOptions;
1833
+ /**
1834
+ * The editor's core extension options
1835
+ */
1836
+ coreExtensionOptions?: {
1837
+ clipboardTextSerializer?: {
1838
+ blockSeparator?: string;
1839
+ };
1840
+ delete?: {
1841
+ /**
1842
+ * Whether the `delete` extension should be called asynchronously to avoid blocking the editor while processing deletions
1843
+ * @default true deletion events are called asynchronously
1844
+ */
1845
+ async?: boolean;
1846
+ /**
1847
+ * Allows filtering the transactions that are processed by the `delete` extension.
1848
+ * If the function returns `true`, the transaction will be ignored.
1849
+ */
1850
+ filterTransaction?: (transaction: Transaction) => boolean;
1851
+ };
1852
+ };
1853
+ /**
1854
+ * Whether to enable input rules behavior
1855
+ */
1856
+ enableInputRules: EnableRules;
1857
+ /**
1858
+ * Whether to enable paste rules behavior
1859
+ */
1860
+ enablePasteRules: EnableRules;
1861
+ /**
1862
+ * Determines whether core extensions are enabled.
1863
+ *
1864
+ * If set to `false`, all core extensions will be disabled.
1865
+ * To disable specific core extensions, provide an object where the keys are the extension names and the values are `false`.
1866
+ * Extensions not listed in the object will remain enabled.
1867
+ *
1868
+ * @example
1869
+ * // Disable all core extensions
1870
+ * enabledCoreExtensions: false
1871
+ *
1872
+ * @example
1873
+ * // Disable only the keymap core extension
1874
+ * enabledCoreExtensions: { keymap: false }
1875
+ *
1876
+ * @default true
1877
+ */
1878
+ enableCoreExtensions?: boolean | Partial<Record<"editable" | "clipboardTextSerializer" | "commands" | "focusEvents" | "keymap" | "tabindex" | "drop" | "paste" | "delete", false>>;
1879
+ /**
1880
+ * If `true`, the editor will check the content for errors on initialization.
1881
+ * Emitting the `contentError` event if the content is invalid.
1882
+ * Which can be used to show a warning or error message to the user.
1883
+ * @default false
1884
+ */
1885
+ enableContentCheck: boolean;
1886
+ /**
1887
+ * If `true`, the editor will emit the `contentError` event if invalid content is
1888
+ * encountered but `enableContentCheck` is `false`. This lets you preserve the
1889
+ * invalid editor content while still showing a warning or error message to
1890
+ * the user.
1891
+ *
1892
+ * @default false
1893
+ */
1894
+ emitContentError: boolean;
1895
+ /**
1896
+ * Called before the editor is constructed.
1897
+ */
1898
+ onBeforeCreate: (props: EditorEvents["beforeCreate"]) => void;
1899
+ /**
1900
+ * Called after the editor is constructed.
1901
+ */
1902
+ onCreate: (props: EditorEvents["create"]) => void;
1903
+ /**
1904
+ * Called when the editor is mounted.
1905
+ */
1906
+ onMount: (props: EditorEvents["mount"]) => void;
1907
+ /**
1908
+ * Called when the editor is unmounted.
1909
+ */
1910
+ onUnmount: (props: EditorEvents["unmount"]) => void;
1911
+ /**
1912
+ * Called when the editor encounters an error while parsing the content.
1913
+ * Only enabled if `enableContentCheck` is `true`.
1914
+ */
1915
+ onContentError: (props: EditorEvents["contentError"]) => void;
1916
+ /**
1917
+ * Called when the editor's content is updated.
1918
+ */
1919
+ onUpdate: (props: EditorEvents["update"]) => void;
1920
+ /**
1921
+ * Called when the editor's selection is updated.
1922
+ */
1923
+ onSelectionUpdate: (props: EditorEvents["selectionUpdate"]) => void;
1924
+ /**
1925
+ * Called after a transaction is applied to the editor.
1926
+ */
1927
+ onTransaction: (props: EditorEvents["transaction"]) => void;
1928
+ /**
1929
+ * Called on focus events.
1930
+ */
1931
+ onFocus: (props: EditorEvents["focus"]) => void;
1932
+ /**
1933
+ * Called on blur events.
1934
+ */
1935
+ onBlur: (props: EditorEvents["blur"]) => void;
1936
+ /**
1937
+ * Called when the editor is destroyed.
1938
+ */
1939
+ onDestroy: (props: EditorEvents["destroy"]) => void;
1940
+ /**
1941
+ * Called when content is pasted into the editor.
1942
+ */
1943
+ onPaste: (e: ClipboardEvent, slice: Slice) => void;
1944
+ /**
1945
+ * Called when content is dropped into the editor.
1946
+ */
1947
+ onDrop: (e: DragEvent, slice: Slice, moved: boolean) => void;
1948
+ /**
1949
+ * Called when content is deleted from the editor.
1950
+ */
1951
+ onDelete: (props: EditorEvents["delete"]) => void;
1952
+ }
1953
+ /**
1954
+ * The editor's content as HTML
1955
+ */
1956
+ type HTMLContent = string;
1957
+ /**
1958
+ * Loosely describes a JSON representation of a Prosemirror document or node
1959
+ */
1960
+ type JSONContent = {
1961
+ type?: string;
1962
+ attrs?: Record<string, any> | undefined;
1963
+ content?: JSONContent[];
1964
+ marks?: {
1965
+ type: string;
1966
+ attrs?: Record<string, any>;
1967
+ [key: string]: any;
1968
+ }[];
1969
+ text?: string;
1970
+ [key: string]: any;
1971
+ };
1972
+ /**
1973
+ * A mark type is either a JSON representation of a mark or a Prosemirror mark instance
1974
+ */
1975
+ type MarkType<Type extends string | {
1976
+ name: string;
1977
+ } = any, TAttributes extends undefined | Record<string, any> = any> = {
1978
+ type: Type;
1979
+ attrs: TAttributes;
1980
+ };
1981
+ /**
1982
+ * A node type is either a JSON representation of a node or a Prosemirror node instance
1983
+ */
1984
+ type NodeType<Type extends string | {
1985
+ name: string;
1986
+ } = any, TAttributes extends undefined | Record<string, any> = any, NodeMarkType extends MarkType = any, TContent extends (NodeType | TextType)[] = any> = {
1987
+ type: Type;
1988
+ attrs: TAttributes;
1989
+ content?: TContent;
1990
+ marks?: NodeMarkType[];
1991
+ };
1992
+ /**
1993
+ * A node type is either a JSON representation of a doc node or a Prosemirror doc node instance
1994
+ */
1995
+ type DocumentType<TDocAttributes extends Record<string, any> | undefined = Record<string, any>, TContentType extends NodeType[] = NodeType[]> = Omit<NodeType<"doc", TDocAttributes, never, TContentType>, "marks" | "content"> & {
1996
+ content: TContentType;
1997
+ };
1998
+ /**
1999
+ * A node type is either a JSON representation of a text node or a Prosemirror text node instance
2000
+ */
2001
+ type TextType<TMarkType extends MarkType = MarkType> = {
2002
+ type: "text";
2003
+ text: string;
2004
+ marks: TMarkType[];
2005
+ };
2006
+ type Content = HTMLContent | JSONContent | JSONContent[] | null;
2007
+ type CommandProps = {
2008
+ editor: SlideEditor;
2009
+ tr: Transaction;
2010
+ commands: SingleCommands;
2011
+ can: () => CanCommands;
2012
+ chain: () => ChainedCommands;
2013
+ state: EditorState;
2014
+ view: EditorView;
2015
+ dispatch: ((args?: any) => any) | undefined;
2016
+ };
2017
+ type Command = (props: CommandProps) => boolean;
2018
+ type KeyboardShortcutCommand = (props: {
2019
+ editor: SlideEditor;
2020
+ }) => boolean;
2021
+ type Attribute = {
2022
+ default?: any;
2023
+ validate?: string | ((value: any) => void);
2024
+ rendered?: boolean;
2025
+ renderHTML?: ((attributes: Record<string, any>) => Record<string, any> | null) | null;
2026
+ parseHTML?: ((element: HTMLElement) => any | null) | null;
2027
+ keepOnSplit?: boolean;
2028
+ isRequired?: boolean;
2029
+ };
2030
+ type Attributes$1 = {
2031
+ [key: string]: Attribute;
2032
+ };
2033
+ type ExtensionAttribute = {
2034
+ type: string;
2035
+ name: string;
2036
+ attribute: Required<Omit<Attribute, "validate">> & Pick<Attribute, "validate">;
2037
+ };
2038
+ type GlobalAttributes = {
2039
+ /**
2040
+ * The node & mark types this attribute should be applied to.
2041
+ */
2042
+ types: string[];
2043
+ /**
2044
+ * The attributes to add to the node or mark types.
2045
+ */
2046
+ attributes: Record<string, Attribute | undefined>;
2047
+ }[];
2048
+ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
2049
+ type ValuesOf<T> = T[keyof T];
2050
+ type KeysWithTypeOf<T, Type> = {
2051
+ [P in keyof T]: T[P] extends Type ? P : never;
2052
+ }[keyof T];
2053
+ interface NodeViewRendererProps {
2054
+ /**
2055
+ * The node that is being rendered.
2056
+ */
2057
+ node: Parameters<NodeViewConstructor>[0];
2058
+ /**
2059
+ * The editor's view.
2060
+ */
2061
+ view: Parameters<NodeViewConstructor>[1];
2062
+ /**
2063
+ * A function that can be called to get the node's current position in the document.
2064
+ */
2065
+ getPos: Parameters<NodeViewConstructor>[2];
2066
+ /**
2067
+ * is an array of node or inline decorations that are active around the node.
2068
+ * They are automatically drawn in the normal way, and you will usually just want to ignore this, but they can also be used as a way to provide context information to the node view without adding it to the document itself.
2069
+ */
2070
+ decorations: Parameters<NodeViewConstructor>[3];
2071
+ /**
2072
+ * holds the decorations for the node's content. You can safely ignore this if your view has no content or a contentDOM property, since the editor will draw the decorations on the content.
2073
+ * But if you, for example, want to create a nested editor with the content, it may make sense to provide it with the inner decorations.
2074
+ */
2075
+ innerDecorations: Parameters<NodeViewConstructor>[4];
2076
+ /**
2077
+ * The editor instance.
2078
+ */
2079
+ editor: SlideEditor;
2080
+ /**
2081
+ * The extension that is responsible for the node.
2082
+ */
2083
+ extension: Node;
2084
+ /**
2085
+ * The HTML attributes that should be added to the node's DOM element.
2086
+ */
2087
+ HTMLAttributes: Record<string, any>;
2088
+ }
2089
+ type NodeViewRenderer = (props: NodeViewRendererProps) => NodeView;
2090
+ interface MarkViewRendererProps {
2091
+ /**
2092
+ * The node that is being rendered.
2093
+ */
2094
+ mark: Parameters<MarkViewConstructor>[0];
2095
+ /**
2096
+ * The editor's view.
2097
+ */
2098
+ view: Parameters<MarkViewConstructor>[1];
2099
+ /**
2100
+ * indicates whether the mark's content is inline
2101
+ */
2102
+ inline: Parameters<MarkViewConstructor>[2];
2103
+ /**
2104
+ * The editor instance.
2105
+ */
2106
+ editor: SlideEditor;
2107
+ /**
2108
+ * The extension that is responsible for the mark.
2109
+ */
2110
+ extension: Mark;
2111
+ /**
2112
+ * The HTML attributes that should be added to the mark's DOM element.
2113
+ */
2114
+ HTMLAttributes: Record<string, any>;
2115
+ updateAttributes: (attrs: Record<string, any>) => void;
2116
+ }
2117
+ type MarkViewRenderer<Props = MarkViewRendererProps> = (props: Props) => MarkView;
2118
+ type UnionCommands<T = Command> = UnionToIntersection<ValuesOf<Pick<Commands<T>, KeysWithTypeOf<Commands<T>, object>>>>;
2119
+ type RawCommands = {
2120
+ [Item in keyof UnionCommands]: UnionCommands<Command>[Item];
2121
+ };
2122
+ type SingleCommands = {
2123
+ [Item in keyof UnionCommands]: UnionCommands<boolean>[Item];
2124
+ };
2125
+ type ChainedCommands = {
2126
+ [Item in keyof UnionCommands]: UnionCommands<ChainedCommands>[Item];
2127
+ } & {
2128
+ run: () => boolean;
2129
+ };
2130
+ type CanCommands = SingleCommands & {
2131
+ chain: () => ChainedCommands;
2132
+ };
2133
+ type FocusPosition = "start" | "end" | "all" | number | boolean | null;
2134
+ type Range = {
2135
+ from: number;
2136
+ to: number;
2137
+ };
2138
+ type TextSerializer = (props: {
2139
+ node: Node$1;
2140
+ pos: number;
2141
+ parent: Node$1;
2142
+ index: number;
2143
+ range: Range;
2144
+ }) => string;
2145
+ type ExtendedRegExpMatchArray = RegExpMatchArray & {
2146
+ data?: Record<string, any>;
2147
+ };
2148
+ /** Markdown related types */
2149
+ type MarkdownToken = {
2150
+ type?: string;
2151
+ raw?: string;
2152
+ text?: string;
2153
+ tokens?: MarkdownToken[];
2154
+ depth?: number;
2155
+ items?: MarkdownToken[];
2156
+ [key: string]: any;
2157
+ };
2158
+ /**
2159
+ * Helpers specifically for parsing markdown tokens into blockslides JSON.
2160
+ * These are provided to extension parse handlers.
2161
+ */
2162
+ type MarkdownParseHelpers = {
2163
+ /** Parse an array of inline tokens into text nodes with marks */
2164
+ parseInline: (tokens: MarkdownToken[]) => JSONContent[];
2165
+ /** Parse an array of block-level tokens */
2166
+ parseChildren: (tokens: MarkdownToken[]) => JSONContent[];
2167
+ /** Create a text node with optional marks */
2168
+ createTextNode: (text: string, marks?: Array<{
2169
+ type: string;
2170
+ attrs?: any;
2171
+ }>) => JSONContent;
2172
+ /** Create any node type with attributes and content */
2173
+ createNode: (type: string, attrs?: any, content?: JSONContent[]) => JSONContent;
2174
+ /** Apply a mark to content (used for inline marks like bold, italic) */
2175
+ applyMark: (markType: string, content: JSONContent[], attrs?: any) => {
2176
+ mark: string;
2177
+ content: JSONContent[];
2178
+ attrs?: any;
2179
+ };
2180
+ };
2181
+
2182
+ /**
2183
+ * Return shape for parser-level `parse` handlers.
2184
+ * - a single JSON-like node
2185
+ * - an array of JSON-like nodes
2186
+ * - or a `{ mark: string, content: JSONLike[] }` shape to apply a mark
2187
+ */
2188
+ type MarkdownParseResult = JSONContent | JSONContent[] | {
2189
+ mark: string;
2190
+ content: JSONContent[];
2191
+ attrs?: any;
2192
+ };
2193
+ type RenderContext = {
2194
+ index: number;
2195
+ level: number;
2196
+ meta?: Record<string, any>;
2197
+ parentType?: string | null;
2198
+ };
2199
+ /**
2200
+ * Configuration object passed to custom marked.js tokenizers
2201
+ */
2202
+ type MarkdownLexerConfiguration = {
2203
+ /**
2204
+ * Can be used to transform source text into inline tokens - useful while tokenizing child tokens.
2205
+ * @param src
2206
+ * @returns Array of inline tokens
2207
+ */
2208
+ inlineTokens: (src: string) => MarkdownToken[];
2209
+ /**
2210
+ * Can be used to transform source text into block-level tokens - useful while tokenizing child tokens.
2211
+ * @param src
2212
+ * @returns Array of block-level tokens
2213
+ */
2214
+ blockTokens: (src: string) => MarkdownToken[];
2215
+ };
2216
+ /** Custom tokenizer function for marked.js extensions */
2217
+ type MarkdownTokenizer = {
2218
+ /** Token name this tokenizer creates */
2219
+ name: string;
2220
+ /** Priority level for tokenizer ordering (higher = earlier) */
2221
+ level?: "block" | "inline";
2222
+ /** A string to look for or a function that returns the start index of the token in the source string */
2223
+ start?: string | ((src: string) => number);
2224
+ /** Function that attempts to parse custom syntax from start of text */
2225
+ tokenize: (src: string, tokens: MarkdownToken[], lexer: MarkdownLexerConfiguration) => MarkdownToken | undefined | void;
2226
+ };
2227
+ type MarkdownRendererHelpers = {
2228
+ /**
2229
+ * Render children nodes to a markdown string, optionally separated by a string.
2230
+ * @param nodes The node or array of nodes to render
2231
+ * @param separator An optional separator string (legacy) or RenderContext
2232
+ * @returns The rendered markdown string
2233
+ */
2234
+ renderChildren: (nodes: JSONContent | JSONContent[], separator?: string) => string;
2235
+ /**
2236
+ * Render a text token to a markdown string
2237
+ * @param prefix The prefix to add before the content
2238
+ * @param content The content to wrap
2239
+ * @returns The wrapped content
2240
+ */
2241
+ wrapInBlock: (prefix: string, content: string) => string;
2242
+ /**
2243
+ * Indent a markdown string according to the provided RenderContext
2244
+ * @param content The content to indent
2245
+ * @returns The indented content
2246
+ */
2247
+ indent: (content: string) => string;
2248
+ };
2249
+
2250
+ /**
2251
+ * Create a flattened array of extensions by traversing the `addExtensions` field.
2252
+ * @param extensions An array of Tiptap extensions
2253
+ * @returns A flattened array of Tiptap extensions
2254
+ */
2255
+ declare function flattenExtensions(extensions: Extensions): Extensions;
2256
+
2257
+ interface ExtensionConfig<Options = any, Storage = any> extends ExtendableConfig<Options, Storage, ExtensionConfig<Options, Storage>, null> {
2258
+ }
2259
+
2260
+ /**
2261
+ * Returns a flattened and sorted extension list while
2262
+ * also checking for duplicated extensions and warns the user.
2263
+ * @param extensions An array of BlockSlides extensions
2264
+ * @returns An flattened and sorted array of BlockSlides extensions
2265
+ */
2266
+ declare function resolveExtensions(extensions: Extensions): Extensions;
2267
+
2268
+ /**
2269
+ * Sort extensions by priority.
2270
+ * @param extensions An array of Tiptap extensions
2271
+ * @returns A sorted array of Tiptap extensions by priority
2272
+ */
2273
+ declare function sortExtensions(extensions: Extensions): Extensions;
2274
+
2275
+ declare class ExtensionManager {
2276
+ editor: SlideEditor;
2277
+ schema: Schema;
2278
+ /**
2279
+ * A flattened and sorted array of all extensions
2280
+ */
2281
+ extensions: Extensions;
2282
+ /**
2283
+ * A non-flattened array of base extensions (no sub-extensions)
2284
+ */
2285
+ baseExtensions: Extensions;
2286
+ splittableMarks: string[];
2287
+ constructor(extensions: Extensions, editor: SlideEditor);
2288
+ static resolve: typeof resolveExtensions;
2289
+ static sort: typeof sortExtensions;
2290
+ static flatten: typeof flattenExtensions;
2291
+ /**
2292
+ * Get all commands from the extensions.
2293
+ * @returns An object with all commands where the key is the command name and the value is the command function
2294
+ */
2295
+ get commands(): RawCommands;
2296
+ /**
2297
+ * Get all registered Prosemirror plugins from the extensions.
2298
+ * @returns An array of Prosemirror plugins
2299
+ */
2300
+ get plugins(): Plugin[];
2301
+ /**
2302
+ * Get all attributes from the extensions.
2303
+ * @returns An array of attributes
2304
+ */
2305
+ get attributes(): ExtensionAttribute[];
2306
+ /**
2307
+ * Get all node views from the extensions.
2308
+ * @returns An object with all node views where the key is the node name and the value is the node view function
2309
+ */
2310
+ get nodeViews(): Record<string, NodeViewConstructor>;
2311
+ get markViews(): Record<string, MarkViewConstructor>;
2312
+ /**
2313
+ * Go through all extensions, create extension storages & setup marks
2314
+ * & bind editor event listener.
2315
+ */
2316
+ private setupExtensions;
2317
+ }
2318
+
2319
+ declare class NodePos {
2320
+ private resolvedPos;
2321
+ private isBlock;
2322
+ private editor;
2323
+ private get name();
2324
+ constructor(pos: ResolvedPos, editor: SlideEditor, isBlock?: boolean, node?: Node$1 | null);
2325
+ private currentNode;
2326
+ get node(): Node$1;
2327
+ get element(): HTMLElement;
2328
+ actualDepth: number | null;
2329
+ get depth(): number;
2330
+ get pos(): number;
2331
+ get content(): Fragment;
2332
+ set content(content: Content);
2333
+ get attributes(): {
2334
+ [key: string]: any;
2335
+ };
2336
+ get textContent(): string;
2337
+ get size(): number;
2338
+ get from(): number;
2339
+ get range(): Range;
2340
+ get to(): number;
2341
+ get parent(): NodePos | null;
2342
+ get before(): NodePos | null;
2343
+ get after(): NodePos | null;
2344
+ get children(): NodePos[];
2345
+ get firstChild(): NodePos | null;
2346
+ get lastChild(): NodePos | null;
2347
+ closest(selector: string, attributes?: {
2348
+ [key: string]: any;
2349
+ }): NodePos | null;
2350
+ querySelector(selector: string, attributes?: {
2351
+ [key: string]: any;
2352
+ }): NodePos | null;
2353
+ querySelectorAll(selector: string, attributes?: {
2354
+ [key: string]: any;
2355
+ }, firstItemOnly?: boolean): NodePos[];
2356
+ setAttribute(attributes: {
2357
+ [key: string]: any;
2358
+ }): void;
2359
+ }
2360
+
2361
+ declare module "@blockslides/core" {
2362
+ interface Commands<ReturnType> {
2363
+ focus: {
2364
+ /**
2365
+ * Focus the editor at the given position.
2366
+ * @param position The position to focus at.
2367
+ * @param options.scrollIntoView Scroll the focused position into view after focusing
2368
+ * @example editor.commands.focus()
2369
+ * @example editor.commands.focus(32, { scrollIntoView: false })
2370
+ */
2371
+ focus: (
2372
+ /**
2373
+ * The position to focus at.
2374
+ */
2375
+ position?: FocusPosition,
2376
+ /**
2377
+ * Optional options
2378
+ * @default { scrollIntoView: true }
2379
+ */
2380
+ options?: {
2381
+ scrollIntoView?: boolean;
2382
+ }) => ReturnType;
2383
+ };
2384
+ }
2385
+ }
2386
+
2387
+ interface InsertContentOptions {
2388
+ /**
2389
+ * Options for parsing the content.
2390
+ */
2391
+ parseOptions?: ParseOptions;
2392
+ /**
2393
+ * Whether to update the selection after inserting the content.
2394
+ */
2395
+ updateSelection?: boolean;
2396
+ applyInputRules?: boolean;
2397
+ applyPasteRules?: boolean;
2398
+ }
2399
+
2400
+ interface InsertContentAtOptions {
2401
+ /**
2402
+ * Options for parsing the content.
2403
+ */
2404
+ parseOptions?: ParseOptions;
2405
+ /**
2406
+ * Whether to update the selection after inserting the content.
2407
+ */
2408
+ updateSelection?: boolean;
2409
+ /**
2410
+ * Whether to apply input rules after inserting the content.
2411
+ */
2412
+ applyInputRules?: boolean;
2413
+ /**
2414
+ * Whether to apply paste rules after inserting the content.
2415
+ */
2416
+ applyPasteRules?: boolean;
2417
+ /**
2418
+ * Whether to throw an error if the content is invalid.
2419
+ */
2420
+ errorOnInvalidContent?: boolean;
2421
+ }
2422
+
2423
+ interface SetContentOptions {
2424
+ /**
2425
+ * Options for parsing the content.
2426
+ * @default {}
2427
+ */
2428
+ parseOptions?: ParseOptions;
2429
+ /**
2430
+ * Whether to throw an error if the content is invalid.
2431
+ */
2432
+ errorOnInvalidContent?: boolean;
2433
+ /**
2434
+ * Whether to emit an update event.
2435
+ * @default true
2436
+ */
2437
+ emitUpdate?: boolean;
2438
+ }
2439
+
2440
+ declare module '@blockslides/core' {
2441
+ interface Commands<ReturnType> {
2442
+ blur: {
2443
+ /**
2444
+ * Removes focus from the editor.
2445
+ * @example editor.commands.blur()
2446
+ */
2447
+ blur: () => ReturnType;
2448
+ };
2449
+ }
2450
+ }
2451
+
2452
+ declare module '@blockslides/core' {
2453
+ interface Commands<ReturnType> {
2454
+ clearContent: {
2455
+ /**
2456
+ * Clear the whole document.
2457
+ * @example editor.commands.clearContent()
2458
+ */
2459
+ clearContent: (
2460
+ /**
2461
+ * Whether to emit an update event.
2462
+ * @default true
2463
+ */
2464
+ emitUpdate?: boolean) => ReturnType;
2465
+ };
2466
+ }
2467
+ }
2468
+
2469
+ declare module '@blockslides/core' {
2470
+ interface Commands<ReturnType> {
2471
+ clearNodes: {
2472
+ /**
2473
+ * Normalize nodes to a simple paragraph.
2474
+ * @example editor.commands.clearNodes()
2475
+ */
2476
+ clearNodes: () => ReturnType;
2477
+ };
2478
+ }
2479
+ }
2480
+
2481
+ declare module '@blockslides/core' {
2482
+ interface Commands<ReturnType> {
2483
+ command: {
2484
+ /**
2485
+ * Define a command inline.
2486
+ * @param fn The command function.
2487
+ * @example
2488
+ * editor.commands.command(({ tr, state }) => {
2489
+ * ...
2490
+ * return true
2491
+ * })
2492
+ */
2493
+ command: (fn: (props: Parameters<Command>[0]) => boolean) => ReturnType;
2494
+ };
2495
+ }
2496
+ }
2497
+
2498
+ declare module '@blockslides/core' {
2499
+ interface Commands<ReturnType> {
2500
+ createParagraphNear: {
2501
+ /**
2502
+ * Create a paragraph nearby.
2503
+ * @example editor.commands.createParagraphNear()
2504
+ */
2505
+ createParagraphNear: () => ReturnType;
2506
+ };
2507
+ }
2508
+ }
2509
+
2510
+ declare module '@blockslides/core' {
2511
+ interface Commands<ReturnType> {
2512
+ cut: {
2513
+ /**
2514
+ * Cuts content from a range and inserts it at a given position.
2515
+ * @param range The range to cut.
2516
+ * @param range.from The start position of the range.
2517
+ * @param range.to The end position of the range.
2518
+ * @param targetPos The position to insert the content at.
2519
+ * @example editor.commands.cut({ from: 1, to: 3 }, 5)
2520
+ */
2521
+ cut: ({ from, to }: {
2522
+ from: number;
2523
+ to: number;
2524
+ }, targetPos: number) => ReturnType;
2525
+ };
2526
+ }
2527
+ }
2528
+
2529
+ declare module '@blockslides/core' {
2530
+ interface Commands<ReturnType> {
2531
+ deleteCurrentNode: {
2532
+ /**
2533
+ * Delete the node that currently has the selection anchor.
2534
+ * @example editor.commands.deleteCurrentNode()
2535
+ */
2536
+ deleteCurrentNode: () => ReturnType;
2537
+ };
2538
+ }
2539
+ }
2540
+
2541
+ declare module '@blockslides/core' {
2542
+ interface Commands<ReturnType> {
2543
+ deleteNode: {
2544
+ /**
2545
+ * Delete a node with a given type or name.
2546
+ * @param typeOrName The type or name of the node.
2547
+ * @example editor.commands.deleteNode('paragraph')
2548
+ */
2549
+ deleteNode: (typeOrName: string | NodeType$1) => ReturnType;
2550
+ };
2551
+ }
2552
+ }
2553
+
2554
+ declare module '@blockslides/core' {
2555
+ interface Commands<ReturnType> {
2556
+ deleteRange: {
2557
+ /**
2558
+ * Delete a given range.
2559
+ * @param range The range to delete.
2560
+ * @example editor.commands.deleteRange({ from: 1, to: 3 })
2561
+ */
2562
+ deleteRange: (range: Range) => ReturnType;
2563
+ };
2564
+ }
2565
+ }
2566
+
2567
+ declare module '@blockslides/core' {
2568
+ interface Commands<ReturnType> {
2569
+ deleteSelection: {
2570
+ /**
2571
+ * Delete the selection, if there is one.
2572
+ * @example editor.commands.deleteSelection()
2573
+ */
2574
+ deleteSelection: () => ReturnType;
2575
+ };
2576
+ }
2577
+ }
2578
+
2579
+ declare module '@blockslides/core' {
2580
+ interface Commands<ReturnType> {
2581
+ enter: {
2582
+ /**
2583
+ * Trigger enter.
2584
+ * @example editor.commands.enter()
2585
+ */
2586
+ enter: () => ReturnType;
2587
+ };
2588
+ }
2589
+ }
2590
+
2591
+ declare module '@blockslides/core' {
2592
+ interface Commands<ReturnType> {
2593
+ exitCode: {
2594
+ /**
2595
+ * Exit from a code block.
2596
+ * @example editor.commands.exitCode()
2597
+ */
2598
+ exitCode: () => ReturnType;
2599
+ };
2600
+ }
2601
+ }
2602
+
2603
+ declare module '@blockslides/core' {
2604
+ interface Commands<ReturnType> {
2605
+ extendMarkRange: {
2606
+ /**
2607
+ * Extends the text selection to the current mark by type or name.
2608
+ * @param typeOrName The type or name of the mark.
2609
+ * @param attributes The attributes of the mark.
2610
+ * @example editor.commands.extendMarkRange('bold')
2611
+ * @example editor.commands.extendMarkRange('mention', { userId: "1" })
2612
+ */
2613
+ extendMarkRange: (
2614
+ /**
2615
+ * The type or name of the mark.
2616
+ */
2617
+ typeOrName: string | MarkType$1,
2618
+ /**
2619
+ * The attributes of the mark.
2620
+ */
2621
+ attributes?: Record<string, any>) => ReturnType;
2622
+ };
2623
+ }
2624
+ }
2625
+
2626
+ declare module '@blockslides/core' {
2627
+ interface Commands<ReturnType> {
2628
+ first: {
2629
+ /**
2630
+ * Runs one command after the other and stops at the first which returns true.
2631
+ * @param commands The commands to run.
2632
+ * @example editor.commands.first([command1, command2])
2633
+ */
2634
+ first: (commands: Command[] | ((props: CommandProps) => Command[])) => ReturnType;
2635
+ };
2636
+ }
2637
+ }
2638
+
2639
+ declare module '@blockslides/core' {
2640
+ interface Commands<ReturnType> {
2641
+ forEach: {
2642
+ /**
2643
+ * Loop through an array of items.
2644
+ */
2645
+ forEach: <T>(items: T[], fn: (item: T, props: CommandProps & {
2646
+ index: number;
2647
+ }) => boolean) => ReturnType;
2648
+ };
2649
+ }
2650
+ }
2651
+ declare module '@blockslides/core' {
2652
+ interface Commands<ReturnType> {
2653
+ insertContent: {
2654
+ /**
2655
+ * Insert a node or string of HTML at the current position.
2656
+ * @example editor.commands.insertContent('<h1>Example</h1>')
2657
+ * @example editor.commands.insertContent('<h1>Example</h1>', { updateSelection: false })
2658
+ */
2659
+ insertContent: (
2660
+ /**
2661
+ * The ProseMirror content to insert.
2662
+ */
2663
+ value: Content | Node$1 | Fragment,
2664
+ /**
2665
+ * Optional options
2666
+ */
2667
+ options?: InsertContentOptions) => ReturnType;
2668
+ };
2669
+ }
2670
+ }
2671
+ declare module '@blockslides/core' {
2672
+ interface Commands<ReturnType> {
2673
+ insertContentAt: {
2674
+ /**
2675
+ * Insert a node or string of HTML at a specific position.
2676
+ * @example editor.commands.insertContentAt(0, '<h1>Example</h1>')
2677
+ */
2678
+ insertContentAt: (
2679
+ /**
2680
+ * The position to insert the content at.
2681
+ */
2682
+ position: number | Range,
2683
+ /**
2684
+ * The ProseMirror content to insert.
2685
+ */
2686
+ value: Content | Node$1 | Fragment,
2687
+ /**
2688
+ * Optional options
2689
+ */
2690
+ options?: InsertContentAtOptions) => ReturnType;
2691
+ };
2692
+ }
2693
+ }
2694
+
2695
+ declare module '@blockslides/core' {
2696
+ interface Commands<ReturnType> {
2697
+ joinUp: {
2698
+ /**
2699
+ * Join the selected block or, if there is a text selection, the closest ancestor block of the selection that can be joined, with the sibling above it.
2700
+ * @example editor.commands.joinUp()
2701
+ */
2702
+ joinUp: () => ReturnType;
2703
+ };
2704
+ joinDown: {
2705
+ /**
2706
+ * Join the selected block, or the closest ancestor of the selection that can be joined, with the sibling after it.
2707
+ * @example editor.commands.joinDown()
2708
+ */
2709
+ joinDown: () => ReturnType;
2710
+ };
2711
+ joinBackward: {
2712
+ /**
2713
+ * If the selection is empty and at the start of a textblock, try to reduce the distance between that block and the one before it—if there's a block directly before it that can be joined, join them.
2714
+ * If not, try to move the selected block closer to the next one in the document structure by lifting it out of its
2715
+ * parent or moving it into a parent of the previous block. Will use the view for accurate (bidi-aware) start-of-textblock detection if given.
2716
+ * @example editor.commands.joinBackward()
2717
+ */
2718
+ joinBackward: () => ReturnType;
2719
+ };
2720
+ joinForward: {
2721
+ /**
2722
+ * If the selection is empty and the cursor is at the end of a textblock, try to reduce or remove the boundary between that block and the one after it,
2723
+ * either by joining them or by moving the other block closer to this one in the tree structure.
2724
+ * Will use the view for accurate start-of-textblock detection if given.
2725
+ * @example editor.commands.joinForward()
2726
+ */
2727
+ joinForward: () => ReturnType;
2728
+ };
2729
+ }
2730
+ }
2731
+
2732
+ declare module '@blockslides/core' {
2733
+ interface Commands<ReturnType> {
2734
+ joinItemBackward: {
2735
+ /**
2736
+ * Join two items backward.
2737
+ * @example editor.commands.joinItemBackward()
2738
+ */
2739
+ joinItemBackward: () => ReturnType;
2740
+ };
2741
+ }
2742
+ }
2743
+
2744
+ declare module '@blockslides/core' {
2745
+ interface Commands<ReturnType> {
2746
+ joinItemForward: {
2747
+ /**
2748
+ * Join two items Forwards.
2749
+ * @example editor.commands.joinItemForward()
2750
+ */
2751
+ joinItemForward: () => ReturnType;
2752
+ };
2753
+ }
2754
+ }
2755
+
2756
+ declare module '@blockslides/core' {
2757
+ interface Commands<ReturnType> {
2758
+ joinTextblockBackward: {
2759
+ /**
2760
+ * A more limited form of joinBackward that only tries to join the current textblock to the one before it, if the cursor is at the start of a textblock.
2761
+ */
2762
+ joinTextblockBackward: () => ReturnType;
2763
+ };
2764
+ }
2765
+ }
2766
+
2767
+ declare module '@blockslides/core' {
2768
+ interface Commands<ReturnType> {
2769
+ joinTextblockForward: {
2770
+ /**
2771
+ * A more limited form of joinForward that only tries to join the current textblock to the one after it, if the cursor is at the end of a textblock.
2772
+ */
2773
+ joinTextblockForward: () => ReturnType;
2774
+ };
2775
+ }
2776
+ }
2777
+
2778
+ declare module '@blockslides/core' {
2779
+ interface Commands<ReturnType> {
2780
+ keyboardShortcut: {
2781
+ /**
2782
+ * Trigger a keyboard shortcut.
2783
+ * @param name The name of the keyboard shortcut.
2784
+ * @example editor.commands.keyboardShortcut('Mod-b')
2785
+ */
2786
+ keyboardShortcut: (name: string) => ReturnType;
2787
+ };
2788
+ }
2789
+ }
2790
+
2791
+ declare module '@blockslides/core' {
2792
+ interface Commands<ReturnType> {
2793
+ lift: {
2794
+ /**
2795
+ * Removes an existing wrap if possible lifting the node out of it
2796
+ * @param typeOrName The type or name of the node.
2797
+ * @param attributes The attributes of the node.
2798
+ * @example editor.commands.lift('paragraph')
2799
+ * @example editor.commands.lift('heading', { level: 1 })
2800
+ */
2801
+ lift: (typeOrName: string | NodeType$1, attributes?: Record<string, any>) => ReturnType;
2802
+ };
2803
+ }
2804
+ }
2805
+
2806
+ declare module '@blockslides/core' {
2807
+ interface Commands<ReturnType> {
2808
+ liftEmptyBlock: {
2809
+ /**
2810
+ * If the cursor is in an empty textblock that can be lifted, lift the block.
2811
+ * @example editor.commands.liftEmptyBlock()
2812
+ */
2813
+ liftEmptyBlock: () => ReturnType;
2814
+ };
2815
+ }
2816
+ }
2817
+
2818
+ declare module '@blockslides/core' {
2819
+ interface Commands<ReturnType> {
2820
+ liftListItem: {
2821
+ /**
2822
+ * Create a command to lift the list item around the selection up into a wrapping list.
2823
+ * @param typeOrName The type or name of the node.
2824
+ * @example editor.commands.liftListItem('listItem')
2825
+ */
2826
+ liftListItem: (typeOrName: string | NodeType$1) => ReturnType;
2827
+ };
2828
+ }
2829
+ }
2830
+
2831
+ declare module '@blockslides/core' {
2832
+ interface Commands<ReturnType> {
2833
+ newlineInCode: {
2834
+ /**
2835
+ * Add a newline character in code.
2836
+ * @example editor.commands.newlineInCode()
2837
+ */
2838
+ newlineInCode: () => ReturnType;
2839
+ };
2840
+ }
2841
+ }
2842
+
2843
+ declare module '@blockslides/core' {
2844
+ interface Commands<ReturnType> {
2845
+ resetAttributes: {
2846
+ /**
2847
+ * Resets some node attributes to the default value.
2848
+ * @param typeOrName The type or name of the node.
2849
+ * @param attributes The attributes of the node to reset.
2850
+ * @example editor.commands.resetAttributes('heading', 'level')
2851
+ */
2852
+ resetAttributes: (typeOrName: string | NodeType$1 | MarkType$1, attributes: string | string[]) => ReturnType;
2853
+ };
2854
+ }
2855
+ }
2856
+
2857
+ declare module '@blockslides/core' {
2858
+ interface Commands<ReturnType> {
2859
+ scrollIntoView: {
2860
+ /**
2861
+ * Scroll the selection into view.
2862
+ * @example editor.commands.scrollIntoView()
2863
+ */
2864
+ scrollIntoView: () => ReturnType;
2865
+ };
2866
+ }
2867
+ }
2868
+
2869
+ declare module '@blockslides/core' {
2870
+ interface Commands<ReturnType> {
2871
+ selectAll: {
2872
+ /**
2873
+ * Select the whole document.
2874
+ * @example editor.commands.selectAll()
2875
+ */
2876
+ selectAll: () => ReturnType;
2877
+ };
2878
+ }
2879
+ }
2880
+
2881
+ declare module '@blockslides/core' {
2882
+ interface Commands<ReturnType> {
2883
+ selectNodeBackward: {
2884
+ /**
2885
+ * Select a node backward.
2886
+ * @example editor.commands.selectNodeBackward()
2887
+ */
2888
+ selectNodeBackward: () => ReturnType;
2889
+ };
2890
+ }
2891
+ }
2892
+
2893
+ declare module '@blockslides/core' {
2894
+ interface Commands<ReturnType> {
2895
+ selectNodeForward: {
2896
+ /**
2897
+ * Select a node forward.
2898
+ * @example editor.commands.selectNodeForward()
2899
+ */
2900
+ selectNodeForward: () => ReturnType;
2901
+ };
2902
+ }
2903
+ }
2904
+
2905
+ declare module '@blockslides/core' {
2906
+ interface Commands<ReturnType> {
2907
+ selectParentNode: {
2908
+ /**
2909
+ * Select the parent node.
2910
+ * @example editor.commands.selectParentNode()
2911
+ */
2912
+ selectParentNode: () => ReturnType;
2913
+ };
2914
+ }
2915
+ }
2916
+
2917
+ declare module '@blockslides/core' {
2918
+ interface Commands<ReturnType> {
2919
+ selectTextblockEnd: {
2920
+ /**
2921
+ * Moves the cursor to the end of current text block.
2922
+ * @example editor.commands.selectTextblockEnd()
2923
+ */
2924
+ selectTextblockEnd: () => ReturnType;
2925
+ };
2926
+ }
2927
+ }
2928
+
2929
+ declare module '@blockslides/core' {
2930
+ interface Commands<ReturnType> {
2931
+ selectTextblockStart: {
2932
+ /**
2933
+ * Moves the cursor to the start of current text block.
2934
+ * @example editor.commands.selectTextblockStart()
2935
+ */
2936
+ selectTextblockStart: () => ReturnType;
2937
+ };
2938
+ }
2939
+ }
2940
+ declare module '@blockslides/core' {
2941
+ interface Commands<ReturnType> {
2942
+ setContent: {
2943
+ /**
2944
+ * Replace the whole document with new content.
2945
+ * @param content The new content.
2946
+ * @param emitUpdate Whether to emit an update event.
2947
+ * @param parseOptions Options for parsing the content.
2948
+ * @example editor.commands.setContent('<p>Example text</p>')
2949
+ */
2950
+ setContent: (
2951
+ /**
2952
+ * The new content.
2953
+ */
2954
+ content: Content | Fragment | Node$1,
2955
+ /**
2956
+ * Options for `setContent`.
2957
+ */
2958
+ options?: SetContentOptions) => ReturnType;
2959
+ };
2960
+ }
2961
+ }
2962
+
2963
+ declare module '@blockslides/core' {
2964
+ interface Commands<ReturnType> {
2965
+ setMark: {
2966
+ /**
2967
+ * Add a mark with new attributes.
2968
+ * @param typeOrName The mark type or name.
2969
+ * @example editor.commands.setMark('bold', { level: 1 })
2970
+ */
2971
+ setMark: (typeOrName: string | MarkType$1, attributes?: Record<string, any>) => ReturnType;
2972
+ };
2973
+ }
2974
+ }
2975
+
2976
+ declare module '@blockslides/core' {
2977
+ interface Commands<ReturnType> {
2978
+ setMeta: {
2979
+ /**
2980
+ * Store a metadata property in the current transaction.
2981
+ * @param key The key of the metadata property.
2982
+ * @param value The value to store.
2983
+ * @example editor.commands.setMeta('foo', 'bar')
2984
+ */
2985
+ setMeta: (key: string | Plugin | PluginKey, value: any) => ReturnType;
2986
+ };
2987
+ }
2988
+ }
2989
+
2990
+ declare module '@blockslides/core' {
2991
+ interface Commands<ReturnType> {
2992
+ setNode: {
2993
+ /**
2994
+ * Replace a given range with a node.
2995
+ * @param typeOrName The type or name of the node
2996
+ * @param attributes The attributes of the node
2997
+ * @example editor.commands.setNode('paragraph')
2998
+ */
2999
+ setNode: (typeOrName: string | NodeType$1, attributes?: Record<string, any>) => ReturnType;
3000
+ };
3001
+ }
3002
+ }
3003
+
3004
+ declare module '@blockslides/core' {
3005
+ interface Commands<ReturnType> {
3006
+ setNodeSelection: {
3007
+ /**
3008
+ * Creates a NodeSelection.
3009
+ * @param position - Position of the node.
3010
+ * @example editor.commands.setNodeSelection(10)
3011
+ */
3012
+ setNodeSelection: (position: number) => ReturnType;
3013
+ };
3014
+ }
3015
+ }
3016
+
3017
+ declare module '@blockslides/core' {
3018
+ interface Commands<ReturnType> {
3019
+ setTextSelection: {
3020
+ /**
3021
+ * Creates a TextSelection.
3022
+ * @param position The position of the selection.
3023
+ * @example editor.commands.setTextSelection(10)
3024
+ */
3025
+ setTextSelection: (position: number | Range) => ReturnType;
3026
+ };
3027
+ }
3028
+ }
3029
+
3030
+ declare module '@blockslides/core' {
3031
+ interface Commands<ReturnType> {
3032
+ sinkListItem: {
3033
+ /**
3034
+ * Sink the list item down into an inner list.
3035
+ * @param typeOrName The type or name of the node.
3036
+ * @example editor.commands.sinkListItem('listItem')
3037
+ */
3038
+ sinkListItem: (typeOrName: string | NodeType$1) => ReturnType;
3039
+ };
3040
+ }
3041
+ }
3042
+
3043
+ declare module '@blockslides/core' {
3044
+ interface Commands<ReturnType> {
3045
+ splitBlock: {
3046
+ /**
3047
+ * Forks a new node from an existing node.
3048
+ * @param options.keepMarks Keep marks from the previous node.
3049
+ * @example editor.commands.splitBlock()
3050
+ * @example editor.commands.splitBlock({ keepMarks: true })
3051
+ */
3052
+ splitBlock: (options?: {
3053
+ keepMarks?: boolean;
3054
+ }) => ReturnType;
3055
+ };
3056
+ }
3057
+ }
3058
+
3059
+ declare module '@blockslides/core' {
3060
+ interface Commands<ReturnType> {
3061
+ splitListItem: {
3062
+ /**
3063
+ * Splits one list item into two list items.
3064
+ * @param typeOrName The type or name of the node.
3065
+ * @param overrideAttrs The attributes to ensure on the new node.
3066
+ * @example editor.commands.splitListItem('listItem')
3067
+ */
3068
+ splitListItem: (typeOrName: string | NodeType$1, overrideAttrs?: Record<string, any>) => ReturnType;
3069
+ };
3070
+ }
3071
+ }
3072
+
3073
+ declare module '@blockslides/core' {
3074
+ interface Commands<ReturnType> {
3075
+ toggleList: {
3076
+ /**
3077
+ * Toggle between different list types.
3078
+ * @param listTypeOrName The type or name of the list.
3079
+ * @param itemTypeOrName The type or name of the list item.
3080
+ * @param keepMarks Keep marks when toggling.
3081
+ * @param attributes Attributes for the new list.
3082
+ * @example editor.commands.toggleList('bulletList', 'listItem')
3083
+ */
3084
+ toggleList: (listTypeOrName: string | NodeType$1, itemTypeOrName: string | NodeType$1, keepMarks?: boolean, attributes?: Record<string, any>) => ReturnType;
3085
+ };
3086
+ }
3087
+ }
3088
+
3089
+ declare module '@blockslides/core' {
3090
+ interface Commands<ReturnType> {
3091
+ toggleMark: {
3092
+ /**
3093
+ * Toggle a mark on and off.
3094
+ * @param typeOrName The mark type or name.
3095
+ * @param attributes The attributes of the mark.
3096
+ * @param options.extendEmptyMarkRange Removes the mark even across the current selection. Defaults to `false`.
3097
+ * @example editor.commands.toggleMark('bold')
3098
+ */
3099
+ toggleMark: (
3100
+ /**
3101
+ * The mark type or name.
3102
+ */
3103
+ typeOrName: string | MarkType$1,
3104
+ /**
3105
+ * The attributes of the mark.
3106
+ */
3107
+ attributes?: Record<string, any>, options?: {
3108
+ /**
3109
+ * Removes the mark even across the current selection. Defaults to `false`.
3110
+ */
3111
+ extendEmptyMarkRange?: boolean;
3112
+ }) => ReturnType;
3113
+ };
3114
+ }
3115
+ }
3116
+
3117
+ declare module '@blockslides/core' {
3118
+ interface Commands<ReturnType> {
3119
+ toggleNode: {
3120
+ /**
3121
+ * Toggle a node with another node.
3122
+ * @param typeOrName The type or name of the node.
3123
+ * @param toggleTypeOrName The type or name of the node to toggle.
3124
+ * @param attributes The attributes of the node.
3125
+ * @example editor.commands.toggleNode('heading', 'paragraph')
3126
+ */
3127
+ toggleNode: (typeOrName: string | NodeType$1, toggleTypeOrName: string | NodeType$1, attributes?: Record<string, any>) => ReturnType;
3128
+ };
3129
+ }
3130
+ }
3131
+
3132
+ declare module '@blockslides/core' {
3133
+ interface Commands<ReturnType> {
3134
+ toggleWrap: {
3135
+ /**
3136
+ * Wraps nodes in another node, or removes an existing wrap.
3137
+ * @param typeOrName The type or name of the node.
3138
+ * @param attributes The attributes of the node.
3139
+ * @example editor.commands.toggleWrap('blockquote')
3140
+ */
3141
+ toggleWrap: (typeOrName: string | NodeType$1, attributes?: Record<string, any>) => ReturnType;
3142
+ };
3143
+ }
3144
+ }
3145
+
3146
+ declare module '@blockslides/core' {
3147
+ interface Commands<ReturnType> {
3148
+ undoInputRule: {
3149
+ /**
3150
+ * Undo an input rule.
3151
+ * @example editor.commands.undoInputRule()
3152
+ */
3153
+ undoInputRule: () => ReturnType;
3154
+ };
3155
+ }
3156
+ }
3157
+
3158
+ declare module '@blockslides/core' {
3159
+ interface Commands<ReturnType> {
3160
+ unsetAllMarks: {
3161
+ /**
3162
+ * Remove all marks in the current selection.
3163
+ * @example editor.commands.unsetAllMarks()
3164
+ */
3165
+ unsetAllMarks: () => ReturnType;
3166
+ };
3167
+ }
3168
+ }
3169
+
3170
+ declare module '@blockslides/core' {
3171
+ interface Commands<ReturnType> {
3172
+ unsetMark: {
3173
+ /**
3174
+ * Remove all marks in the current selection.
3175
+ * @param typeOrName The mark type or name.
3176
+ * @param options.extendEmptyMarkRange Removes the mark even across the current selection. Defaults to `false`.
3177
+ * @example editor.commands.unsetMark('bold')
3178
+ */
3179
+ unsetMark: (
3180
+ /**
3181
+ * The mark type or name.
3182
+ */
3183
+ typeOrName: string | MarkType$1, options?: {
3184
+ /**
3185
+ * Removes the mark even across the current selection. Defaults to `false`.
3186
+ */
3187
+ extendEmptyMarkRange?: boolean;
3188
+ }) => ReturnType;
3189
+ };
3190
+ }
3191
+ }
3192
+
3193
+ declare module '@blockslides/core' {
3194
+ interface Commands<ReturnType> {
3195
+ updateAttributes: {
3196
+ /**
3197
+ * Update attributes of a node or mark.
3198
+ * @param typeOrName The type or name of the node or mark.
3199
+ * @param attributes The attributes of the node or mark.
3200
+ * @example editor.commands.updateAttributes('mention', { userId: "2" })
3201
+ */
3202
+ updateAttributes: (
3203
+ /**
3204
+ * The type or name of the node or mark.
3205
+ */
3206
+ typeOrName: string | NodeType$1 | MarkType$1,
3207
+ /**
3208
+ * The attributes of the node or mark.
3209
+ */
3210
+ attributes: Record<string, any>) => ReturnType;
3211
+ };
3212
+ }
3213
+ }
3214
+
3215
+ declare module '@blockslides/core' {
3216
+ interface Commands<ReturnType> {
3217
+ wrapIn: {
3218
+ /**
3219
+ * Wraps nodes in another node.
3220
+ * @param typeOrName The type or name of the node.
3221
+ * @param attributes The attributes of the node.
3222
+ * @example editor.commands.wrapIn('blockquote')
3223
+ */
3224
+ wrapIn: (typeOrName: string | NodeType$1, attributes?: Record<string, any>) => ReturnType;
3225
+ };
3226
+ }
3227
+ }
3228
+
3229
+ declare module '@blockslides/core' {
3230
+ interface Commands<ReturnType> {
3231
+ wrapInList: {
3232
+ /**
3233
+ * Wrap a node in a list.
3234
+ * @param typeOrName The type or name of the node.
3235
+ * @param attributes The attributes of the node.
3236
+ * @example editor.commands.wrapInList('bulletList')
3237
+ */
3238
+ wrapInList: (typeOrName: string | NodeType$1, attributes?: Record<string, any>) => ReturnType;
3239
+ };
3240
+ }
3241
+ }
3242
+ declare class SlideEditor extends EventEmitter<EditorEvents> {
3243
+ private commandManager;
3244
+ extensionManager: ExtensionManager;
3245
+ private css;
3246
+ schema: Schema;
3247
+ private editorView;
3248
+ isFocused: boolean;
3249
+ private editorState;
3250
+ /**
3251
+ * The editor is considered initialized after the `create` event has been emitted.
3252
+ */
3253
+ isInitialized: boolean;
3254
+ extensionStorage: Storage;
3255
+ /**
3256
+ * Resolved editor theme (null if no theme applied)
3257
+ */
3258
+ private resolvedTheme;
3259
+ /**
3260
+ * A unique ID for this editor instance.
3261
+ */
3262
+ instanceId: string;
3263
+ options: EditorOptions;
3264
+ constructor(options?: Partial<EditorOptions>);
3265
+ /**
3266
+ * Attach the editor to the DOM, creating a new editor view.
3267
+ */
3268
+ mount(el: NonNullable<EditorOptions["element"]> & {}): void;
3269
+ /**
3270
+ * Remove the editor from the DOM, but still allow remounting at a different point in time
3271
+ */
3272
+ unmount(): void;
3273
+ /**
3274
+ * Returns the editor storage.
3275
+ */
3276
+ get storage(): Storage;
3277
+ /**
3278
+ * An object of all registered commands.
3279
+ */
3280
+ get commands(): SingleCommands;
3281
+ /**
3282
+ * Create a command chain to call multiple commands at once.
3283
+ */
3284
+ chain(): ChainedCommands;
3285
+ /**
3286
+ * Check if a command or a command chain can be executed. Without executing it.
3287
+ */
3288
+ can(): CanCommands;
3289
+ /**
3290
+ * Inject CSS styles.
3291
+ */
3292
+ private injectCSS;
3293
+ /**
3294
+ * Update editor options.
3295
+ *
3296
+ * @param options A list of options
3297
+ */
3298
+ setOptions(options?: Partial<EditorOptions>): void;
3299
+ /**
3300
+ * Update editable state of the editor.
3301
+ */
3302
+ setEditable(editable: boolean, emitUpdate?: boolean): void;
3303
+ /**
3304
+ * Returns whether the editor is editable.
3305
+ */
3306
+ get isEditable(): boolean;
3307
+ /**
3308
+ * Returns the editor state.
3309
+ */
3310
+ get view(): EditorView;
3311
+ /**
3312
+ * Returns the editor state.
3313
+ */
3314
+ get state(): EditorState;
3315
+ /**
3316
+ * Register a ProseMirror plugin.
3317
+ *
3318
+ * @param plugin A ProseMirror plugin
3319
+ * @param handlePlugins Control how to merge the plugin into the existing plugins.
3320
+ * @returns The new editor state
3321
+ */
3322
+ registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): EditorState;
3323
+ /**
3324
+ * Unregister a ProseMirror plugin.
3325
+ *
3326
+ * @param nameOrPluginKeyToRemove The plugins name
3327
+ * @returns The new editor state or undefined if the editor is destroyed
3328
+ */
3329
+ unregisterPlugin(nameOrPluginKeyToRemove: string | PluginKey | (string | PluginKey)[]): EditorState | undefined;
3330
+ /**
3331
+ * Creates an extension manager.
3332
+ */
3333
+ private createExtensionManager;
3334
+ /**
3335
+ * Creates an command manager.
3336
+ */
3337
+ private createCommandManager;
3338
+ /**
3339
+ * Creates a ProseMirror schema.
3340
+ */
3341
+ private createSchema;
3342
+ /**
3343
+ * Creates the initial document.
3344
+ */
3345
+ private createDoc;
3346
+ /**
3347
+ * Creates a ProseMirror view.
3348
+ */
3349
+ private createView;
3350
+ /**
3351
+ * Creates all node and mark views.
3352
+ */
3353
+ createNodeViews(): void;
3354
+ /**
3355
+ * Prepend class name to element.
3356
+ */
3357
+ prependClass(): void;
3358
+ isCapturingTransaction: boolean;
3359
+ private capturedTransaction;
3360
+ captureTransaction(fn: () => void): Transaction | null;
3361
+ /**
3362
+ * The callback over which to send transactions (state updates) produced by the view.
3363
+ *
3364
+ * @param transaction An editor state transaction
3365
+ */
3366
+ private dispatchTransaction;
3367
+ /**
3368
+ * Get attributes of the currently selected node or mark.
3369
+ */
3370
+ getAttributes(nameOrType: string | NodeType$1 | MarkType$1): Record<string, any>;
3371
+ /**
3372
+ * Returns if the currently selected node or mark is active.
3373
+ *
3374
+ * @param name Name of the node or mark
3375
+ * @param attributes Attributes of the node or mark
3376
+ */
3377
+ isActive(name: string, attributes?: {}): boolean;
3378
+ isActive(attributes: {}): boolean;
3379
+ /**
3380
+ * Get the document as JSON.
3381
+ */
3382
+ getJSON(): DocumentType<Record<string, any> | undefined, NodeType<string, undefined | Record<string, any>, any, (NodeType | TextType)[]>[]>;
3383
+ /**
3384
+ * Get the document as HTML.
3385
+ */
3386
+ getHTML(): string;
3387
+ /**
3388
+ * Get the document as text.
3389
+ */
3390
+ getText(options?: {
3391
+ blockSeparator?: string;
3392
+ textSerializers?: Record<string, TextSerializer>;
3393
+ }): string;
3394
+ /**
3395
+ * Check if there is no content.
3396
+ */
3397
+ get isEmpty(): boolean;
3398
+ /**
3399
+ * Set or change the editor theme
3400
+ *
3401
+ * @param theme - Theme to apply (string, full theme object, or partial theme)
3402
+ *
3403
+ * @example
3404
+ * // Switch to built-in dark theme
3405
+ * editor.setTheme('dark');
3406
+ *
3407
+ * @example
3408
+ * // Apply custom theme
3409
+ * editor.setTheme({
3410
+ * extends: 'dark',
3411
+ * colors: { background: '#0a0a0a' }
3412
+ * });
3413
+ */
3414
+ setTheme(theme: typeof this$1.options.theme): void;
3415
+ /**
3416
+ * Get the current theme
3417
+ *
3418
+ * @returns Current resolved theme (null if no theme applied)
3419
+ */
3420
+ getTheme(): ResolvedTheme;
3421
+ /**
3422
+ * Destroy the editor.
3423
+ */
3424
+ destroy(): void;
3425
+ /**
3426
+ * Check if the editor is already destroyed.
3427
+ */
3428
+ get isDestroyed(): boolean;
3429
+ $node(selector: string, attributes?: {
3430
+ [key: string]: any;
3431
+ }): NodePos | null;
3432
+ $nodes(selector: string, attributes?: {
3433
+ [key: string]: any;
3434
+ }): NodePos[] | null;
3435
+ $pos(pos: number): NodePos;
3436
+ get $doc(): NodePos;
3437
+ }
3438
+
3439
+ interface Commands<ReturnType = any> {
3440
+ }
3441
+ interface Storage {
3442
+ }
3443
+
765
3444
  type SizeKey = "16x9" | "4x3" | "a4-portrait" | "a4-landscape" | "letter-portrait" | "letter-landscape" | "linkedin-banner";
766
3445
  interface SlideAttrs {
767
3446
  id?: string | null;
@@ -794,4 +3473,166 @@ interface ImageBlockAttrs {
794
3473
  focalY?: number | null;
795
3474
  }
796
3475
 
797
- export { type ColumnAttrs, type ImageBlockAttrs, type RowAttrs, type SizeKey, type SlideAttrs, index$2 as bundlesV1, index$4 as contextsV1, index$3 as examplesV1, index$1 as recipesV1, index as schemasV1 };
3476
+ type Block = JSONContent;
3477
+ type SlideNode = JSONContent;
3478
+ type TextMark = {
3479
+ type: string;
3480
+ attrs?: Record<string, any>;
3481
+ };
3482
+ declare const blocks: {
3483
+ text: (text: string, marks?: TextMark[]) => Block;
3484
+ paragraph: (text?: string) => Block;
3485
+ heading: (text: string, level?: 1 | 2 | 3 | 4 | 5 | 6) => Block;
3486
+ bulletList: (items: (string | Block)[]) => Block;
3487
+ horizontalRule: () => Block;
3488
+ hardBreak: () => Block;
3489
+ codeBlock: (code: string, language?: string) => Block;
3490
+ imageBlock: (attrs: ImageBlockAttrs) => Block;
3491
+ blockquote: (content?: Block[]) => Block;
3492
+ listItem: (content?: Block[]) => Block;
3493
+ image: (attrs: {
3494
+ src: string;
3495
+ alt?: string | null;
3496
+ title?: string | null;
3497
+ width?: number | null;
3498
+ height?: number | null;
3499
+ }) => Block;
3500
+ youtube: (attrs: {
3501
+ src?: string | null;
3502
+ start?: number;
3503
+ width?: number;
3504
+ height?: number;
3505
+ }) => Block;
3506
+ };
3507
+ type SingleColOpts = {
3508
+ slideAttrs?: Partial<SlideAttrs>;
3509
+ rowAttrs?: Partial<RowAttrs>;
3510
+ columnAttrs?: Partial<ColumnAttrs>;
3511
+ content?: Block[];
3512
+ };
3513
+ type TwoColOpts = {
3514
+ slideAttrs?: Partial<SlideAttrs>;
3515
+ rowAttrs?: Partial<RowAttrs>;
3516
+ leftColumnAttrs?: Partial<ColumnAttrs>;
3517
+ rightColumnAttrs?: Partial<ColumnAttrs>;
3518
+ left?: Block[];
3519
+ right?: Block[];
3520
+ };
3521
+ declare const slide: ((opts?: {
3522
+ slideAttrs?: Partial<SlideAttrs>;
3523
+ rowAttrs?: Partial<RowAttrs>;
3524
+ columnAttrs?: Partial<ColumnAttrs>;
3525
+ }) => SlideNode) & {
3526
+ singleCol: (opts?: SingleColOpts) => SlideNode;
3527
+ twoCol: (opts?: TwoColOpts) => SlideNode;
3528
+ };
3529
+ type HeroOpts = {
3530
+ slideAttrs?: Partial<SlideAttrs>;
3531
+ rowAttrs?: Partial<RowAttrs>;
3532
+ columnAttrs?: Partial<ColumnAttrs>;
3533
+ content?: Block[];
3534
+ };
3535
+ type ImageCoverOpts = {
3536
+ slideAttrs?: Partial<SlideAttrs>;
3537
+ image?: ImageBlockAttrs;
3538
+ overlay?: Block[];
3539
+ columnAttrs?: Partial<ColumnAttrs>;
3540
+ rowAttrs?: Partial<RowAttrs>;
3541
+ };
3542
+ type QuoteOpts = {
3543
+ slideAttrs?: Partial<SlideAttrs>;
3544
+ rowAttrs?: Partial<RowAttrs>;
3545
+ columnAttrs?: Partial<ColumnAttrs>;
3546
+ quote?: Block[];
3547
+ };
3548
+ type AgendaOpts = {
3549
+ slideAttrs?: Partial<SlideAttrs>;
3550
+ rowAttrs?: Partial<RowAttrs>;
3551
+ columnAttrs?: Partial<ColumnAttrs>;
3552
+ items?: (string | Block)[];
3553
+ };
3554
+ type MultiColOpts = {
3555
+ slideAttrs?: Partial<SlideAttrs>;
3556
+ rowAttrs?: Partial<RowAttrs>;
3557
+ columns: {
3558
+ content?: Block[];
3559
+ attrs?: Partial<ColumnAttrs>;
3560
+ }[];
3561
+ };
3562
+ type MediaTextOpts = {
3563
+ slideAttrs?: Partial<SlideAttrs>;
3564
+ rowAttrs?: Partial<RowAttrs>;
3565
+ media?: Block[];
3566
+ text?: Block[];
3567
+ mediaColumnAttrs?: Partial<ColumnAttrs>;
3568
+ textColumnAttrs?: Partial<ColumnAttrs>;
3569
+ };
3570
+ type Stack2Opts = {
3571
+ slideAttrs?: Partial<SlideAttrs>;
3572
+ topRow?: {
3573
+ rowAttrs?: Partial<RowAttrs>;
3574
+ columns: {
3575
+ content?: Block[];
3576
+ attrs?: Partial<ColumnAttrs>;
3577
+ }[];
3578
+ };
3579
+ bottomRow?: {
3580
+ rowAttrs?: Partial<RowAttrs>;
3581
+ columns: {
3582
+ content?: Block[];
3583
+ attrs?: Partial<ColumnAttrs>;
3584
+ }[];
3585
+ };
3586
+ };
3587
+ type TemplatePreset = "slide.empty" | "slide.singleCol" | "slide.twoCol" | "slide.hero" | "slide.imageCover" | "slide.quote" | "slide.agenda" | "slide.grid3" | "slide.grid4" | "slide.oneTwo" | "slide.twoOne" | "slide.oneTwoOne" | "slide.textMedia" | "slide.mediaText" | "slide.stack2";
3588
+ type CreateTemplateInput = {
3589
+ preset: TemplatePreset;
3590
+ slideAttrs?: Partial<SlideAttrs>;
3591
+ rowAttrs?: Partial<RowAttrs>;
3592
+ columnAttrs?: Partial<ColumnAttrs>;
3593
+ leftColumnAttrs?: Partial<ColumnAttrs>;
3594
+ rightColumnAttrs?: Partial<ColumnAttrs>;
3595
+ content?: Block[];
3596
+ left?: Block[];
3597
+ right?: Block[];
3598
+ heroOpts?: HeroOpts;
3599
+ imageCoverOpts?: ImageCoverOpts;
3600
+ quoteOpts?: QuoteOpts;
3601
+ agendaOpts?: AgendaOpts;
3602
+ multiColOpts?: MultiColOpts;
3603
+ mediaTextOpts?: MediaTextOpts;
3604
+ stack2Opts?: Stack2Opts;
3605
+ };
3606
+ declare const createTemplate: (input: CreateTemplateInput) => SlideNode;
3607
+ declare const listTemplates: () => TemplatePreset[];
3608
+ declare const templatesV1Context: string;
3609
+
3610
+ type PresetKey = "tpl.titleAndSubheader" | "tpl.imageAndText" | "tpl.textAndImage" | "tpl.twoColumns" | "tpl.twoColumnsWithHeader" | "tpl.threeColumns" | "tpl.threeColumnsWithHeader" | "tpl.fourColumns" | "tpl.fourColumnsWithHeader" | "tpl.titleWithBullets" | "tpl.titleBulletsAndImage" | "tpl.twoImageColumns" | "tpl.accentLeft" | "tpl.accentRight" | "tpl.accentTop" | "tpl.accentRightFit" | "tpl.accentLeftFit" | "tpl.fullImage";
3611
+ type PresetTemplate = {
3612
+ key: PresetKey;
3613
+ label: string;
3614
+ description?: string;
3615
+ icon?: string;
3616
+ build: () => SlideNode;
3617
+ };
3618
+ declare const listPresetTemplates: () => PresetTemplate[];
3619
+ declare const buildPresetTemplate: (key: PresetKey) => SlideNode;
3620
+
3621
+ type index_Block = Block;
3622
+ type index_CreateTemplateInput = CreateTemplateInput;
3623
+ type index_PresetKey = PresetKey;
3624
+ type index_PresetTemplate = PresetTemplate;
3625
+ type index_SlideNode = SlideNode;
3626
+ type index_TemplatePreset = TemplatePreset;
3627
+ declare const index_blocks: typeof blocks;
3628
+ declare const index_buildPresetTemplate: typeof buildPresetTemplate;
3629
+ declare const index_createTemplate: typeof createTemplate;
3630
+ declare const index_listPresetTemplates: typeof listPresetTemplates;
3631
+ declare const index_listTemplates: typeof listTemplates;
3632
+ declare const index_slide: typeof slide;
3633
+ declare const index_templatesV1Context: typeof templatesV1Context;
3634
+ declare namespace index {
3635
+ export { type index_Block as Block, type index_CreateTemplateInput as CreateTemplateInput, type index_PresetKey as PresetKey, type index_PresetTemplate as PresetTemplate, type index_SlideNode as SlideNode, type index_TemplatePreset as TemplatePreset, index_blocks as blocks, index_buildPresetTemplate as buildPresetTemplate, index_createTemplate as createTemplate, index_listPresetTemplates as listPresetTemplates, index_listTemplates as listTemplates, index_slide as slide, index_templatesV1Context as templatesV1Context };
3636
+ }
3637
+
3638
+ export { type ColumnAttrs, type ImageBlockAttrs, type RowAttrs, type SizeKey, type SlideAttrs, index$3 as bundlesV1, index$5 as contextsV1, index$4 as examplesV1, index$2 as recipesV1, index$1 as schemasV1, index as templatesV1 };