lucid-extension-sdk 0.0.225 → 0.0.226
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
|
@@ -1223,6 +1223,8 @@ export type HookSelectionResult = undefined;
|
|
|
1223
1223
|
export type HookTextEditQuery = {
|
|
1224
1224
|
/** Name of the action for receiving these events */
|
|
1225
1225
|
'n': string;
|
|
1226
|
+
/** Whether to trigger the text hook callback eagerly during text edit */
|
|
1227
|
+
'e'?: boolean | undefined;
|
|
1226
1228
|
};
|
|
1227
1229
|
export type HookTextEditResult = undefined;
|
|
1228
1230
|
/** Name of the card integration registered by this extension to show the import dialog for */
|
|
@@ -84,6 +84,11 @@ export declare class TableBlockProxy extends BlockProxy {
|
|
|
84
84
|
* @param row The index of the row to delete.
|
|
85
85
|
*/
|
|
86
86
|
deleteRow(row: number): void;
|
|
87
|
+
/**
|
|
88
|
+
* @param textAreaKey The text area key of a cell in the table
|
|
89
|
+
* @returns The TableCellProxy represented by the text area key, or undefined if the text area key does not exist in the table.
|
|
90
|
+
*/
|
|
91
|
+
getCellByTextAreaKey(textAreaKey: string): TableCellProxy | undefined;
|
|
87
92
|
getRowCount(): number;
|
|
88
93
|
getColumnCount(): number;
|
|
89
94
|
getRows(): TableRowProxy[];
|
|
@@ -152,6 +152,19 @@ class TableBlockProxy extends blockproxy_1.BlockProxy {
|
|
|
152
152
|
deleteRow(row) {
|
|
153
153
|
return this.client.sendCommand("dtr" /* CommandName.DeleteTableRow */, { 'id': this.id, 'i': row });
|
|
154
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* @param textAreaKey The text area key of a cell in the table
|
|
157
|
+
* @returns The TableCellProxy represented by the text area key, or undefined if the text area key does not exist in the table.
|
|
158
|
+
*/
|
|
159
|
+
getCellByTextAreaKey(textAreaKey) {
|
|
160
|
+
const value = textAreaKey.match(/(\d+)/g);
|
|
161
|
+
if (value && value.length === 2) {
|
|
162
|
+
const row = +value[0];
|
|
163
|
+
const column = +value[1];
|
|
164
|
+
return new TableCellProxy(this, row, column);
|
|
165
|
+
}
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
155
168
|
getRowCount() {
|
|
156
169
|
return this.getRowHeights().length;
|
|
157
170
|
}
|
package/package.json
CHANGED
package/ui/viewport.d.ts
CHANGED
|
@@ -60,21 +60,23 @@ export declare class Viewport {
|
|
|
60
60
|
*/
|
|
61
61
|
focusCameraOnItems(items: ItemProxy[]): void;
|
|
62
62
|
/**
|
|
63
|
-
* If
|
|
64
|
-
* If
|
|
63
|
+
* If {@link callback} returns false, text editing is prevented.
|
|
64
|
+
* If {@link callback} returns true, text editing continues as normal.
|
|
65
|
+
*
|
|
66
|
+
* If {@link callback} returns a {@link TextEditCompletionCallback}(/extension-sdk/#modules_ui_viewport_texteditcompletioncallback),
|
|
67
|
+
* then text editing is allowed, but that completion callback is called.
|
|
65
68
|
*
|
|
66
|
-
* If `callback` returns a [TextEditCompletionCallback](/extension-sdk/#modules_ui_viewport_texteditcompletioncallback), then text editing
|
|
67
|
-
* is allowed, but that completion callback is called
|
|
68
69
|
* when the user finishes editing that text. That completion callback may return true or false to allow or deny the edit, or
|
|
69
70
|
* also may return a replacement string to use instead of the text the user actually typed. If replacement text is provided,
|
|
70
71
|
* it will be styled as close to the original as possible, but styles that apply to only parts of the original text will be
|
|
71
72
|
* discarded.
|
|
72
73
|
*
|
|
73
74
|
* @param callback Called just before the user starts editing text.
|
|
75
|
+
* @param eager Whether to trigger the callback eagerly during text edit
|
|
74
76
|
*
|
|
75
77
|
* @returns A handle representing this hook, which can be passed to unhookTextEdit to remove this hook.
|
|
76
78
|
*/
|
|
77
|
-
hookTextEdit(callback: (item: ItemProxy, textAreaKey: string) => boolean | TextEditCompletionCallback | Promise<boolean | TextEditCompletionCallback
|
|
79
|
+
hookTextEdit(callback: (item: ItemProxy, textAreaKey: string, text?: string) => boolean | TextEditCompletionCallback | Promise<boolean | TextEditCompletionCallback>, eager?: boolean): string;
|
|
78
80
|
/**
|
|
79
81
|
* Remove a hook set by hookTextEdit.
|
|
80
82
|
*
|
package/ui/viewport.js
CHANGED
|
@@ -83,26 +83,28 @@ class Viewport {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
|
-
* If
|
|
87
|
-
* If
|
|
86
|
+
* If {@link callback} returns false, text editing is prevented.
|
|
87
|
+
* If {@link callback} returns true, text editing continues as normal.
|
|
88
|
+
*
|
|
89
|
+
* If {@link callback} returns a {@link TextEditCompletionCallback}(/extension-sdk/#modules_ui_viewport_texteditcompletioncallback),
|
|
90
|
+
* then text editing is allowed, but that completion callback is called.
|
|
88
91
|
*
|
|
89
|
-
* If `callback` returns a [TextEditCompletionCallback](/extension-sdk/#modules_ui_viewport_texteditcompletioncallback), then text editing
|
|
90
|
-
* is allowed, but that completion callback is called
|
|
91
92
|
* when the user finishes editing that text. That completion callback may return true or false to allow or deny the edit, or
|
|
92
93
|
* also may return a replacement string to use instead of the text the user actually typed. If replacement text is provided,
|
|
93
94
|
* it will be styled as close to the original as possible, but styles that apply to only parts of the original text will be
|
|
94
95
|
* discarded.
|
|
95
96
|
*
|
|
96
97
|
* @param callback Called just before the user starts editing text.
|
|
98
|
+
* @param eager Whether to trigger the callback eagerly during text edit
|
|
97
99
|
*
|
|
98
100
|
* @returns A handle representing this hook, which can be passed to unhookTextEdit to remove this hook.
|
|
99
101
|
*/
|
|
100
|
-
hookTextEdit(callback) {
|
|
102
|
+
hookTextEdit(callback, eager) {
|
|
101
103
|
const actionName = Viewport.nextHookName();
|
|
102
104
|
this.client.registerAction(actionName, async (textHookParam) => {
|
|
103
105
|
const element = this.client.getElementProxy(textHookParam['i']);
|
|
104
106
|
if (element instanceof itemproxy_1.ItemProxy) {
|
|
105
|
-
const result = await callback(element, textHookParam['t']);
|
|
107
|
+
const result = await callback(element, textHookParam['t'], textHookParam['v']);
|
|
106
108
|
if ((0, checks_1.isBoolean)(result)) {
|
|
107
109
|
return result;
|
|
108
110
|
}
|
|
@@ -120,7 +122,7 @@ class Viewport {
|
|
|
120
122
|
return true;
|
|
121
123
|
}
|
|
122
124
|
});
|
|
123
|
-
this.client.sendCommand("hte" /* CommandName.HookTextEdit */, { 'n': actionName });
|
|
125
|
+
this.client.sendCommand("hte" /* CommandName.HookTextEdit */, { 'n': actionName, 'e': !!eager });
|
|
124
126
|
return actionName;
|
|
125
127
|
}
|
|
126
128
|
/**
|