@cloudcannon/configuration-types 0.0.28 → 0.0.32

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.
@@ -1,6 +1,6 @@
1
1
  import type { Cascade } from './cascade';
2
2
  import type { SnippetConfig } from './snippets';
3
- import type { FileInput, ImageInput, RichTextInput } from './inputs';
3
+ import type { FileInput, UrlInput, RichTextInput } from './inputs';
4
4
 
5
5
  export interface CloseCustomDataPanelOptions {
6
6
  parentId: string;
@@ -17,12 +17,17 @@ export interface OpenCustomDataPanelOptions extends CloseCustomDataPanelOptions
17
17
 
18
18
  /**
19
19
  * Interface defining the public JavaScript API for interacting with CloudCannon's Visual Editor.
20
- * This API provides methods for managing content, handling file operations, and controlling the editor's state.
20
+ * This API provides methods for managing content, handling file operations, and controlling the
21
+ * editor's state.
21
22
  */
22
23
  export interface CloudCannonJavaScriptAPI {
23
- /** Whether event handling is currently enabled */
24
+ /**
25
+ * Whether event handling is currently enabled
26
+ */
24
27
  eventsEnabled: boolean;
25
- /** Whether the API should be installed globally */
28
+ /**
29
+ * Whether the API should be installed globally
30
+ */
26
31
  installGlobally: boolean;
27
32
 
28
33
  /**
@@ -31,8 +36,7 @@ export interface CloudCannonJavaScriptAPI {
31
36
  disableGlobalInstall(): void;
32
37
 
33
38
  /**
34
- * Enables event handling for the API
35
- * This will also ensure the commit model is created
39
+ * Enables event handling for the API This will also ensure the commit model is created
36
40
  */
37
41
  enableEvents(): void;
38
42
 
@@ -42,19 +46,21 @@ export interface CloudCannonJavaScriptAPI {
42
46
  disableEvents(): void;
43
47
 
44
48
  /**
45
- * Refreshes the editor interface
46
- * Note: This has been replaced with a MutationObserver in editor-overlays-view
49
+ * Refreshes the editor interface Note: This has been replaced with a MutationObserver in
50
+ * editor-overlays-view
47
51
  */
48
52
  refreshInterface(): void;
49
53
 
50
54
  /**
51
55
  * Triggers an update event for a specific file
56
+ *
52
57
  * @param sourcePath - The path of the file to update
53
58
  */
54
59
  triggerUpdateEvent(sourcePath: string): void;
55
60
 
56
61
  /**
57
62
  * Sets the loading state of the editor
63
+ *
58
64
  * @param loadingData - Optional loading state message
59
65
  * @returns Promise that resolves when loading state is updated
60
66
  */
@@ -62,6 +68,7 @@ export interface CloudCannonJavaScriptAPI {
62
68
 
63
69
  /**
64
70
  * Sets data for a specific field
71
+ *
65
72
  * @param slug - The identifier of the field to set
66
73
  * @param value - The value to set
67
74
  * @returns Promise that resolves when the data is set
@@ -70,6 +77,7 @@ export interface CloudCannonJavaScriptAPI {
70
77
 
71
78
  /**
72
79
  * Initiates editing of a specific field
80
+ *
73
81
  * @param slug - The identifier of the field to edit
74
82
  * @param style - Optional style information
75
83
  * @param e - The mouse event that triggered the edit
@@ -78,6 +86,7 @@ export interface CloudCannonJavaScriptAPI {
78
86
 
79
87
  /**
80
88
  * Opens a custom data panel for editing
89
+ *
81
90
  * @param options - Configuration options for the panel
82
91
  * @returns Promise that resolves when the panel is opened
83
92
  */
@@ -85,6 +94,7 @@ export interface CloudCannonJavaScriptAPI {
85
94
 
86
95
  /**
87
96
  * Closes a custom data panel
97
+ *
88
98
  * @param options - Configuration options for the panel to close
89
99
  * @returns Promise that resolves when the panel is closed
90
100
  */
@@ -92,14 +102,19 @@ export interface CloudCannonJavaScriptAPI {
92
102
 
93
103
  /**
94
104
  * Uploads a file to the editor
105
+ *
95
106
  * @param file - The file to upload
96
107
  * @param inputConfig - Optional configuration for the input
97
108
  * @returns Promise that resolves with the path of the uploaded file
98
109
  */
99
- uploadFile(file: File, inputConfig: RichTextInput | ImageInput | FileInput | undefined): Promise<string | undefined>;
110
+ uploadFile(
111
+ file: File,
112
+ inputConfig: RichTextInput | UrlInput | FileInput | undefined,
113
+ ): Promise<string | undefined>;
100
114
 
101
115
  /**
102
116
  * Adds an item to an array field
117
+ *
103
118
  * @param slug - The identifier of the array field
104
119
  * @param index - The position to insert at (null for end)
105
120
  * @param value - The value to insert
@@ -110,6 +125,7 @@ export interface CloudCannonJavaScriptAPI {
110
125
 
111
126
  /**
112
127
  * Adds an item before a specific index in an array field
128
+ *
113
129
  * @param slug - The identifier of the array field
114
130
  * @param index - The index to insert before
115
131
  * @param value - The value to insert
@@ -120,6 +136,7 @@ export interface CloudCannonJavaScriptAPI {
120
136
 
121
137
  /**
122
138
  * Adds an item after a specific index in an array field
139
+ *
123
140
  * @param slug - The identifier of the array field
124
141
  * @param index - The index to insert after
125
142
  * @param value - The value to insert
@@ -130,6 +147,7 @@ export interface CloudCannonJavaScriptAPI {
130
147
 
131
148
  /**
132
149
  * Removes an item from an array field
150
+ *
133
151
  * @param slug - The identifier of the array field
134
152
  * @param index - The index of the item to remove
135
153
  * @returns Promise that resolves when the item is removed
@@ -138,6 +156,7 @@ export interface CloudCannonJavaScriptAPI {
138
156
 
139
157
  /**
140
158
  * Moves an item within an array field
159
+ *
141
160
  * @param slug - The identifier of the array field
142
161
  * @param index - The current index of the item
143
162
  * @param toIndex - The target index for the item
@@ -147,6 +166,7 @@ export interface CloudCannonJavaScriptAPI {
147
166
 
148
167
  /**
149
168
  * Gets the current value of the editor
169
+ *
150
170
  * @param options - Optional configuration for the value retrieval
151
171
  * @returns Promise that resolves with the current value
152
172
  */
@@ -154,6 +174,7 @@ export interface CloudCannonJavaScriptAPI {
154
174
 
155
175
  /**
156
176
  * Claims a lock on a file
177
+ *
157
178
  * @param sourcePath - Optional path of the file to lock
158
179
  * @returns Promise that resolves with the lock status
159
180
  */
@@ -161,6 +182,7 @@ export interface CloudCannonJavaScriptAPI {
161
182
 
162
183
  /**
163
184
  * Releases a lock on a file
185
+ *
164
186
  * @param sourcePath - Optional path of the file to unlock
165
187
  * @returns Promise that resolves with the lock status
166
188
  */
@@ -168,13 +190,15 @@ export interface CloudCannonJavaScriptAPI {
168
190
 
169
191
  /**
170
192
  * Gets prefetched files
193
+ *
171
194
  * @returns Promise that resolves with a record of file blobs
172
195
  */
173
196
  prefetchedFiles(): Promise<Record<string, Blob>>;
174
197
 
175
198
  /**
176
199
  * Loads legacy Bookshop information
200
+ *
177
201
  * @returns Promise that resolves with the Bookshop data
178
202
  */
179
203
  loadLegacyBookshopInfo(): Promise<any>;
180
- }
204
+ }