@pixerate/editor-svelte 0.8.0 → 0.9.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.ts +70 -7
- package/dist/index.js +327 -206
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/EditableTextNodeEditor.svelte +4 -1
- package/src/createNavigationGuard.svelte.ts +97 -0
- package/src/index.d.ts +70 -7
- package/src/index.ts +23 -4
- package/src/navigationGuard.ts +82 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { Component } from "svelte";
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
Editor,
|
|
4
|
+
Content,
|
|
5
|
+
Extensions,
|
|
6
|
+
EditorOptions,
|
|
7
|
+
FocusPosition,
|
|
8
|
+
} from "@tiptap/core";
|
|
3
9
|
import type {
|
|
4
10
|
Template,
|
|
5
11
|
TemplateVersion,
|
|
@@ -53,6 +59,9 @@ export interface EditableTextNodeEditorProps {
|
|
|
53
59
|
markdown?: boolean | MarkdownOptions;
|
|
54
60
|
richTextOptions?: RichTextPresetOptions;
|
|
55
61
|
autofocus?: FocusPosition | boolean;
|
|
62
|
+
image?: ImageOptions | boolean;
|
|
63
|
+
uploadImage?: (file: File) => Promise<string> | string;
|
|
64
|
+
onUploadError?: (error: Error, file: File) => void;
|
|
56
65
|
}
|
|
57
66
|
|
|
58
67
|
export interface BubbleMenuProps {
|
|
@@ -93,8 +102,8 @@ import type {
|
|
|
93
102
|
CellCoordinate,
|
|
94
103
|
CellRange,
|
|
95
104
|
CellData,
|
|
96
|
-
SpreadsheetDataSource
|
|
97
|
-
} from
|
|
105
|
+
SpreadsheetDataSource,
|
|
106
|
+
} from "@pixerate/editor";
|
|
98
107
|
|
|
99
108
|
export interface SpreadsheetEditorProps {
|
|
100
109
|
sheetState: ReturnType<typeof createReactiveSpreadsheet>;
|
|
@@ -104,8 +113,16 @@ export interface SpreadsheetEditorProps {
|
|
|
104
113
|
class?: string;
|
|
105
114
|
customCellRenderer?:
|
|
106
115
|
| ((cell: CellData, col: SpreadsheetColumn, row: SpreadsheetRow) => any)
|
|
107
|
-
| ((args: {
|
|
108
|
-
|
|
116
|
+
| ((args: {
|
|
117
|
+
cell: CellData;
|
|
118
|
+
col: SpreadsheetColumn;
|
|
119
|
+
row: SpreadsheetRow;
|
|
120
|
+
}) => any)
|
|
121
|
+
| ((args: {
|
|
122
|
+
row: SpreadsheetRow;
|
|
123
|
+
col: SpreadsheetColumn;
|
|
124
|
+
cell: CellData;
|
|
125
|
+
}) => any);
|
|
109
126
|
onAddColumnClick?: () => void;
|
|
110
127
|
onColumnHeaderClick?: (col: SpreadsheetColumn) => void;
|
|
111
128
|
onColumnResize?: (colId: string, width: number) => void;
|
|
@@ -119,7 +136,9 @@ export interface FormulaBarProps {
|
|
|
119
136
|
export declare const SpreadsheetEditor: Component<SpreadsheetEditorProps>;
|
|
120
137
|
export declare const FormulaBar: Component<FormulaBarProps>;
|
|
121
138
|
|
|
122
|
-
export declare function createReactiveSpreadsheet(
|
|
139
|
+
export declare function createReactiveSpreadsheet(
|
|
140
|
+
options?: SpreadsheetControllerOptions,
|
|
141
|
+
): {
|
|
123
142
|
readonly document: SpreadsheetDocument;
|
|
124
143
|
readonly activeCell: CellCoordinate | null;
|
|
125
144
|
readonly selectedRange: CellRange | null;
|
|
@@ -133,7 +152,7 @@ export declare function createReactiveSpreadsheet(options?: SpreadsheetControlle
|
|
|
133
152
|
startEditing(row?: number, col?: number, initialVal?: string): void;
|
|
134
153
|
commitEditing(val?: string): void;
|
|
135
154
|
cancelEditing(): void;
|
|
136
|
-
moveCursor(dir:
|
|
155
|
+
moveCursor(dir: "up" | "down" | "left" | "right", extend?: boolean): void;
|
|
137
156
|
insertColumn(index: number, config?: Partial<SpreadsheetColumn>): void;
|
|
138
157
|
deleteColumn(colId: string): void;
|
|
139
158
|
insertRow(index: number, config?: Partial<SpreadsheetRow>): void;
|
|
@@ -149,3 +168,47 @@ export declare function createReactiveSpreadsheet(options?: SpreadsheetControlle
|
|
|
149
168
|
undo(): void;
|
|
150
169
|
redo(): void;
|
|
151
170
|
};
|
|
171
|
+
|
|
172
|
+
export interface NavigationGuardOptions {
|
|
173
|
+
isDirty: boolean;
|
|
174
|
+
enabled?: boolean;
|
|
175
|
+
onBlocked?: (url: string) => void;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export interface NavigationGuardActionReturn {
|
|
179
|
+
update(newOptions: NavigationGuardOptions): void;
|
|
180
|
+
destroy(): void;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export declare function navigationGuard(
|
|
184
|
+
node: HTMLElement,
|
|
185
|
+
options: NavigationGuardOptions,
|
|
186
|
+
): NavigationGuardActionReturn;
|
|
187
|
+
|
|
188
|
+
export interface CreateNavigationGuardOptions {
|
|
189
|
+
isDirty: boolean | (() => boolean);
|
|
190
|
+
enabled?: boolean | (() => boolean);
|
|
191
|
+
onNavigate?: (url: string) => void;
|
|
192
|
+
onBlocked?: (url: string) => void;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export interface NavigationGuardManager {
|
|
196
|
+
readonly showConfirm: boolean;
|
|
197
|
+
setShowConfirm(show: boolean): void;
|
|
198
|
+
readonly pendingUrl: string | null;
|
|
199
|
+
intercept(url: string): boolean;
|
|
200
|
+
confirmLeave(): void;
|
|
201
|
+
cancelLeave(): void;
|
|
202
|
+
destroy(): void;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export declare function createNavigationGuard(
|
|
206
|
+
options: CreateNavigationGuardOptions,
|
|
207
|
+
): NavigationGuardManager;
|
|
208
|
+
|
|
209
|
+
export {
|
|
210
|
+
DirtyTracker,
|
|
211
|
+
createDirtyTracker,
|
|
212
|
+
defaultIsEqual,
|
|
213
|
+
} from "@pixerate/editor";
|
|
214
|
+
export type { DirtyTrackerOptions } from "@pixerate/editor";
|