@@ -10,17 +10,13 @@ import type {
1010 UrlInput ,
1111} from '@cloudcannon/configuration-types' ;
1212
13- export interface CloseCustomDataPanelOptions {
14- parentId : string ;
15- id : string ;
16- }
17-
18- export interface OpenCustomDataPanelOptions extends CloseCustomDataPanelOptions {
19- data : Record < string , any > | any [ ] | undefined ;
20- position ?: DOMRect ;
13+ export interface CreateCustomDataPanelOptions {
14+ id ?: string ;
2115 title : string ;
22- inputConfig : Cascade & SnippetConfig ;
23- allowFullDataCascade ?: boolean ;
16+ onChange : ( data ?: Record < string , unknown > | unknown [ ] ) => void ;
17+ data ?: Record < string , unknown > | unknown [ ] ;
18+ config ?: Cascade ;
19+ position ?: DOMRect ;
2420}
2521
2622type EventListenerParameters = Parameters < EventTarget [ 'addEventListener' ] > ;
@@ -89,20 +85,6 @@ export interface CloudCannonJavaScriptV0API {
8985 */
9086 edit ( slug : string , style : string | null , e : MouseEvent ) : void ;
9187
92- /**
93- * Opens a custom data panel for editing
94- * @param options - Configuration options for the panel
95- * @returns Promise that resolves when the panel is opened
96- */
97- openCustomDataPanel ( options : OpenCustomDataPanelOptions ) : Promise < void > ;
98-
99- /**
100- * Closes a custom data panel
101- * @param options - Configuration options for the panel to close
102- * @returns Promise that resolves when the panel is closed
103- */
104- closeCustomDataPanel ( options : CloseCustomDataPanelOptions ) : Promise < void > ;
105-
10688 /**
10789 * Uploads a file to the editor
10890 * @param file - The file to upload
@@ -166,7 +148,7 @@ export interface CloudCannonJavaScriptV0API {
166148 * @param options - Optional configuration for the value retrieval
167149 * @returns Promise that resolves with the current value
168150 */
169- value ( options ?: { keepMarkdownAsHTML ?: boolean } ) : Promise < string > ;
151+ value ( options ?: { rewriteURLs ?: boolean } ) : Promise < string > ;
170152
171153 /**
172154 * Claims a lock on a file
@@ -231,11 +213,6 @@ export interface ArrayOptions {
231213export interface AddArrayItemOptions extends ArrayOptions {
232214 /** The position to insert at (null for end) */
233215 index : number | null ;
234- /**
235- * The position to insert at (before or after)
236- * @default 'before'
237- */
238- position ?: 'before' | 'after' ;
239216 /** The value to insert */
240217 value : any ;
241218 /** The mouse event that triggered the addition */
@@ -264,17 +241,6 @@ export interface GetInputConfigOptions {
264241 slug : string ;
265242}
266243
267- /**
268- * Options for getting the current value in the v2 API
269- */
270- export interface ValueOptions {
271- /**
272- * CloudCannon works with HTML by default. Markdown is converted to HTML and back again while editing.
273- * If true, any markdown inputs will be returned as an HTML string instead of Markdown.
274- */
275- keepMarkdownAsHTML ?: boolean ;
276- }
277-
278244export interface FileNotFoundError extends Error {
279245 message : 'File not found' ;
280246}
@@ -291,12 +257,10 @@ export interface CloudCannonJavaScriptV1APIFileContent {
291257 * @throws {FileNotFoundError } If the file is not found
292258 * @example
293259 * ```javascript
294- * const value = await CloudCannon.content({
295- * keepMarkdownAsHTML: true,
296- * });
260+ * const value = await CloudCannon.content();
297261 * ```
298262 */
299- get ( options ?: ValueOptions ) : Promise < string > ;
263+ get ( ) : Promise < string > ;
300264
301265 /**
302266 * Sets the body content of a file
@@ -326,12 +290,12 @@ export interface CloudCannonJavaScriptV1APIFileData {
326290 * @returns Promise that resolves with the data of the file
327291 * @example
328292 * ```javascript
329- * const value = await CloudCannon.data({
330- * keepMarkdownAsHTML: true,
331- * });
293+ * const value = await CloudCannon.data();
332294 * ```
333295 */
334- get ( options ?: ValueOptions & { slug ?: string } ) : Promise < Record < string , any > | any [ ] | undefined > ;
296+ get ( options ?: { slug ?: string ; rewriteUrls ?: boolean } ) : Promise <
297+ Record < string , any > | any [ ] | undefined
298+ > ;
335299
336300 /**
337301 * Sets data for a specific field
@@ -591,20 +555,6 @@ export interface CloudCannonJavaScriptV1API {
591555 */
592556 setLoading ( loadingData : string | undefined ) : Promise < any > ;
593557
594- /**
595- * Opens a custom data panel for editing
596- * @param options - Configuration options for the panel
597- * @returns Promise that resolves when the panel is opened
598- */
599- openCustomDataPanel ( options : OpenCustomDataPanelOptions ) : Promise < void > ;
600-
601- /**
602- * Closes a custom data panel
603- * @param options - Configuration options for the panel to close
604- * @returns Promise that resolves when the panel is closed
605- */
606- closeCustomDataPanel ( options : CloseCustomDataPanelOptions ) : Promise < void > ;
607-
608558 /**
609559 * Uploads a file to the editor
610560 * @param file - The file to upload
@@ -649,6 +599,10 @@ export interface CloudCannonJavaScriptV1API {
649599 inputConfig ?: RichTextInput ;
650600 }
651601 ) : Promise < CloudCannonJavaScriptV1APITextEditableRegion > ;
602+
603+ createCustomDataPanel ( options : CreateCustomDataPanelOptions ) : Promise < void > ;
604+
605+ getPreviewUrl ( originalUrl : string , inputConfig ?: Input ) : Promise < string > ;
652606}
653607
654608export type CloudCannonJavaScriptAPIVersions = 'v0' | 'v1' ;
0 commit comments