kindy-editor 3.2.5 → 3.2.7

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.
@@ -26,6 +26,12 @@ export interface Participant {
26
26
  user?: UserInfo;
27
27
  }
28
28
 
29
+ /** Search and replace state. */
30
+ export interface SearchState {
31
+ index: number;
32
+ total: number;
33
+ }
34
+
29
35
  /** A WeSign signing box with laid-out geometry. `page` is 1-based for WeSign
30
36
  * `PositionInfoRequest.page`; `pageIndex` is the 0-based layout index. */
31
37
  export interface SignatureBox {
@@ -196,6 +202,7 @@ export interface EditorPermissions {
196
202
  copy: boolean;
197
203
  createComment: boolean;
198
204
  viewComment: boolean;
205
+ hostTableMutation?: boolean;
199
206
  }
200
207
 
201
208
  /** A selection/caret in the document (offsets are UTF-16 code units into a
@@ -227,6 +234,73 @@ export type TableAction =
227
234
  | "deleteRow" | "deleteColumn" | "deleteTable"
228
235
  | "mergeCells" | "unmergeCell";
229
236
 
237
+ export type TableCellValue =
238
+ | string
239
+ | number
240
+ | boolean
241
+ | null
242
+ | undefined
243
+ | { text?: string; value?: unknown };
244
+
245
+ export type HostTableSelection =
246
+ | TableSelection
247
+ | {
248
+ kind?: "cell";
249
+ table?: string | TablePath;
250
+ tableId?: string;
251
+ anchor: TableGridPoint;
252
+ focus?: TableGridPoint;
253
+ }
254
+ | {
255
+ kind: "row";
256
+ table?: string | TablePath;
257
+ tableId?: string;
258
+ from: number;
259
+ to?: number;
260
+ }
261
+ | {
262
+ kind: "column";
263
+ table?: string | TablePath;
264
+ tableId?: string;
265
+ from: number;
266
+ to?: number;
267
+ }
268
+ | {
269
+ kind: "table";
270
+ table?: string | TablePath;
271
+ tableId?: string;
272
+ }
273
+ | {
274
+ tableId: string;
275
+ row?: number;
276
+ col?: number;
277
+ fromRow?: number;
278
+ toRow?: number;
279
+ fromCol?: number;
280
+ toCol?: number;
281
+ }
282
+ | string;
283
+
284
+ export interface TableSummary {
285
+ tableId: string;
286
+ tablePath: TablePath;
287
+ path: TablePath;
288
+ rows: number;
289
+ cols: number;
290
+ header: string[];
291
+ headers?: string[][];
292
+ hasMergedCells: boolean;
293
+ }
294
+
295
+ export interface ReplaceTableRowsOptions {
296
+ /** Number of leading rows to preserve as header (defaults to leading repeatHeader rows, or 1 if table has >= 2 rows). */
297
+ headerRows?: number;
298
+ /** Number of trailing rows to preserve as footer (defaults to 0). */
299
+ footerRows?: number;
300
+ /** Index of the row to use as formatting template (defaults to first data row after header, or row 0). */
301
+ sampleRowIndex?: number;
302
+ }
303
+
230
304
  // ===== Review layer (track changes + comments) =============================
231
305
  // An attributed, anchored overlay on top of the core document. `getReview()`
232
306
  // returns a snapshot; the `reviewChanged` event carries the full layer.
@@ -908,6 +982,15 @@ export interface EditorHandle {
908
982
  setTableSelection(selection: TableSelection | null): void;
909
983
  canExecuteTableAction(action: TableAction): boolean;
910
984
  executeTableAction(action: TableAction): boolean;
985
+ canExecuteHostTableAction(action: TableAction, selection?: HostTableSelection | TableSelection): boolean;
986
+ executeHostTableAction(action: TableAction, selection?: HostTableSelection | TableSelection): boolean;
987
+ setTableCellValue(table: string | TablePath, row: number, column: number, value: TableCellValue): boolean;
988
+ replaceTableRows(
989
+ table: string | TablePath,
990
+ rows: Array<Array<TableCellValue> | Record<string, unknown>>,
991
+ options?: ReplaceTableRowsOptions,
992
+ ): boolean;
993
+ getTables(): TableSummary[];
911
994
  // ---- review layer (track changes + comments) ----------------------------
912
995
  /** The current editor mode. */
913
996
  getMode(): EditMode;
@@ -944,6 +1027,21 @@ export interface EditorHandle {
944
1027
  clearExternalAnnotations(): void;
945
1028
  /** Scroll the viewport to reveal a document range with smooth animation. */
946
1029
  revealRange(range: ExternalRange, options?: RevealRangeOptions): void;
1030
+ /** Scroll the viewport directly to the specified 1-based page number. */
1031
+ goToPage(
1032
+ pageNumber: number,
1033
+ options?: { behavior?: "auto" | "smooth" },
1034
+ ): Promise<boolean>;
1035
+ /** Find & replace. search() highlights all matches, focuses first match, and returns state. */
1036
+ search(query: string, opts?: { matchCase?: boolean; wholeWord?: boolean }): SearchState;
1037
+ /** Navigate between search matches (-1 for previous, 1 for next) and scroll focus to it. */
1038
+ searchNav(dir: 1 | -1): SearchState;
1039
+ /** Replace the currently focused match with text and scroll focus to the next match. */
1040
+ searchReplaceCurrent(replacement: string): SearchState;
1041
+ /** Replace all matches in one atomic transaction. */
1042
+ searchReplaceAll(replacement: string): number;
1043
+ /** Clear search highlights and reset search state. */
1044
+ searchClear(): void;
947
1045
  /** Live-update {{KEY}} template placeholders in the document without full reload,
948
1046
  * preserving zoom, scroll position, and selection. */
949
1047
  setTemplateVariables(values: TemplateVariableValues, options?: SetTemplateVariablesOptions): void;
@@ -1066,6 +1164,15 @@ export declare class KindyEditor {
1066
1164
  setTableSelection(selection: TableSelection | null): Promise<void>;
1067
1165
  canExecuteTableAction(action: TableAction): boolean;
1068
1166
  executeTableAction(action: TableAction): Promise<boolean>;
1167
+ canExecuteHostTableAction(action: TableAction, selection?: HostTableSelection | TableSelection): boolean;
1168
+ executeHostTableAction(action: TableAction, selection?: HostTableSelection | TableSelection): Promise<boolean>;
1169
+ setTableCellValue(table: string | TablePath, row: number, column: number, value: TableCellValue): Promise<boolean>;
1170
+ replaceTableRows(
1171
+ table: string | TablePath,
1172
+ rows: Array<Array<TableCellValue> | Record<string, unknown>>,
1173
+ options?: ReplaceTableRowsOptions,
1174
+ ): Promise<boolean>;
1175
+ getTables(): TableSummary[];
1069
1176
  getDocId(): string | null;
1070
1177
  getShareLink(): string | null;
1071
1178
  /** Render ephemeral highlight decorations for external comments/annotations.
@@ -1075,6 +1182,11 @@ export declare class KindyEditor {
1075
1182
  clearExternalAnnotations(): Promise<void>;
1076
1183
  /** Scroll the viewport to reveal a document range with smooth animation. */
1077
1184
  revealRange(range: ExternalRange, options?: RevealRangeOptions): Promise<void>;
1185
+ /** Scroll the viewport directly to the specified 1-based page number. */
1186
+ goToPage(
1187
+ pageNumber: number,
1188
+ options?: { behavior?: "auto" | "smooth" },
1189
+ ): Promise<boolean>;
1078
1190
  /** Live-update {{KEY}} template placeholders in the document without full reload,
1079
1191
  * preserving zoom, scroll position, and selection. */
1080
1192
  setTemplateVariables(values: TemplateVariableValues, options?: SetTemplateVariablesOptions): Promise<void>;
@@ -1122,5 +1234,15 @@ export declare class KindyEditor {
1122
1234
  setQRCode(config: QRCodeConfig | null): void;
1123
1235
  /** Get current header/footer QR code configuration. */
1124
1236
  getQRCode(): QRCodeConfig | undefined;
1237
+ /** Find & replace. search() highlights all matches, focuses first match, and returns state. */
1238
+ search(query: string, opts?: { matchCase?: boolean; wholeWord?: boolean }): Promise<SearchState>;
1239
+ /** Navigate between search matches (-1 for previous, 1 for next) and scroll focus to it. */
1240
+ searchNav(dir: 1 | -1): Promise<SearchState>;
1241
+ /** Replace the currently focused match with text and scroll focus to the next match. */
1242
+ searchReplaceCurrent(replacement: string): Promise<SearchState>;
1243
+ /** Replace all search matches in document in a single atomic undoable transaction. */
1244
+ searchReplaceAll(replacement: string): Promise<number>;
1245
+ /** Clear search highlights and reset search state. */
1246
+ searchClear(): Promise<void>;
1125
1247
  destroy(): void;
1126
1248
  }