lucid-extension-sdk 0.0.242 → 0.0.244

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/commandtypes.d.ts CHANGED
@@ -20,7 +20,9 @@ import { PanelLocation } from './ui/panel';
20
20
  *
21
21
  * To use these directly, use [EditorClient.sendCommand](#classes_editorclient-EditorClient_sendcommand).
22
22
  *
23
- * IMPORTANT - Before you add a new command bring it up in #api-committee to get feedback
23
+ * FOR DEVELOPERS AT LUCID:
24
+ * Follow this guide to add new commands: https://lucidatlassian.atlassian.net/wiki/x/3AA3Xww
25
+ * Before you add a new command bring it up in #api-committee to get feedback.
24
26
  */
25
27
  export declare const enum CommandName {
26
28
  AddCardIntegration = "aci",
@@ -697,6 +699,13 @@ export type AddCardIntegrationQuery = {
697
699
  /** OnSetup action */
698
700
  'os'?: string | undefined;
699
701
  } | undefined;
702
+ /** If specified, custom import modal via iframe url */
703
+ 'cim'?: {
704
+ 'su': string;
705
+ 'w': number;
706
+ 'h': number;
707
+ 'i': string;
708
+ };
700
709
  /** If specified, add-card settings */
701
710
  'ac'?: {
702
711
  /** Get input fields action */
@@ -4,6 +4,7 @@ import { DataSourceProxy } from '../../data/datasourceproxy';
4
4
  import { TextStyle } from '../../document/text/textstyle';
5
5
  import { EditorClient } from '../../editorclient';
6
6
  import { SerializedFieldType } from '../data/serializedfield/serializedfields';
7
+ import { JsonSerializable } from '../jsonserializable';
7
8
  import { CardIntegrationConfig } from './cardintegrationconfig';
8
9
  import { ExtensionCardFieldDefinition } from './cardintegrationdefinitions';
9
10
  /**
@@ -122,6 +123,31 @@ export declare abstract class LucidCardIntegration {
122
123
  import: (primaryKeys: string[], searchFields: Map<string, SerializedFieldType>) => Promise<ImportResult>;
123
124
  onSetup?: () => Promise<void>;
124
125
  };
126
+ /**
127
+ * If specified, allow the user to import cards using a custom card-import modal.
128
+ *
129
+ * srcUrl:
130
+ * The url to be displayed in an iframe. This can either be a public url, or a local
131
+ * file located in the public folder of your packages root directory.
132
+ *
133
+ * width:
134
+ * The width of the iframe. The maximum width is 1344px.
135
+ *
136
+ * height:
137
+ * The height of the iframe. The maximum height is 1000px.
138
+ *
139
+ * import:
140
+ * Imports the items selected from you custom iframe. You can pass in whatever data is needed to import the items
141
+ * through you data-connector. The data must be of type JsonSerializable. Return the collection created and the
142
+ * primary keys of the items that were imported.
143
+ *
144
+ */
145
+ customImportModal?: {
146
+ srcUrl: string;
147
+ width: number;
148
+ height: number;
149
+ import: (data: JsonSerializable) => Promise<ImportResult>;
150
+ };
125
151
  /**
126
152
  * If specified, allow the user to create new cards and convert other shapes to cards
127
153
  */
@@ -1,4 +1,5 @@
1
1
  import { SerializedFieldType } from '../data/serializedfield/serializedfields';
2
+ import { JsonSerializable } from '../jsonserializable';
2
3
  /** @ignore */
3
4
  export interface GetFieldsParam {
4
5
  'd': string;
@@ -26,6 +27,10 @@ export interface ImportParam {
26
27
  's': [string, SerializedFieldType][];
27
28
  }
28
29
  /** @ignore */
30
+ export interface CustomImportParam {
31
+ 'd': JsonSerializable;
32
+ }
33
+ /** @ignore */
29
34
  export interface GetInputFieldsParam {
30
35
  'i': [string, SerializedFieldType][];
31
36
  }
@@ -108,6 +108,22 @@ class LucidCardIntegrationRegistry {
108
108
  });
109
109
  }
110
110
  }
111
+ if (cardIntegration.customImportModal) {
112
+ const customImportModal = cardIntegration.customImportModal;
113
+ serialized['cim'] = {
114
+ 'su': customImportModal.srcUrl,
115
+ 'w': customImportModal.width,
116
+ 'h': customImportModal.height,
117
+ 'i': LucidCardIntegrationRegistry.nextHookName(),
118
+ };
119
+ client.registerAction(serialized['cim']['i'], async ({ 'd': data }) => {
120
+ const result = await customImportModal.import(data);
121
+ return {
122
+ 'c': result.collection.id,
123
+ 'pks': result.primaryKeys,
124
+ };
125
+ });
126
+ }
111
127
  if (cardIntegration.addCard) {
112
128
  const addCard = cardIntegration.addCard;
113
129
  serialized['ac'] = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.242",
3
+ "version": "0.0.244",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",