jupyterlab-chat 0.16.0 → 0.17.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/lib/widget.d.ts +2 -2
- package/lib/widget.js +19 -2
- package/package.json +2 -2
- package/src/widget.tsx +20 -2
package/lib/widget.d.ts
CHANGED
|
@@ -59,9 +59,9 @@ export declare class ChatPanel extends SidePanel {
|
|
|
59
59
|
*/
|
|
60
60
|
openIfExists(path: string): boolean;
|
|
61
61
|
/**
|
|
62
|
-
* A message handler invoked on an `'after-
|
|
62
|
+
* A message handler invoked on an `'after-attach'` message.
|
|
63
63
|
*/
|
|
64
|
-
protected
|
|
64
|
+
protected onAfterAttach(msg: Message): void;
|
|
65
65
|
/**
|
|
66
66
|
* Return the index of the chat in the list (-1 if not opened).
|
|
67
67
|
*
|
package/lib/widget.js
CHANGED
|
@@ -123,6 +123,23 @@ export class ChatPanel extends SidePanel {
|
|
|
123
123
|
this.toolbar.addItem('openChat', this._openChat);
|
|
124
124
|
const content = this.content;
|
|
125
125
|
content.expansionToggled.connect(this._onExpansionToggled, this);
|
|
126
|
+
this._contentsManager.fileChanged.connect((_, args) => {
|
|
127
|
+
var _a, _b;
|
|
128
|
+
if (args.type === 'delete') {
|
|
129
|
+
this.widgets.forEach(widget => {
|
|
130
|
+
var _a;
|
|
131
|
+
if (widget.path === ((_a = args.oldValue) === null || _a === void 0 ? void 0 : _a.path)) {
|
|
132
|
+
widget.dispose();
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
this.updateChatList();
|
|
136
|
+
}
|
|
137
|
+
const updateActions = ['new', 'rename'];
|
|
138
|
+
if (updateActions.includes(args.type) &&
|
|
139
|
+
((_b = (_a = args.newValue) === null || _a === void 0 ? void 0 : _a.path) === null || _b === void 0 ? void 0 : _b.endsWith(chatFileType.extensions[0]))) {
|
|
140
|
+
this.updateChatList();
|
|
141
|
+
}
|
|
142
|
+
});
|
|
126
143
|
}
|
|
127
144
|
/**
|
|
128
145
|
* Getter and setter of the defaultDirectory.
|
|
@@ -192,9 +209,9 @@ export class ChatPanel extends SidePanel {
|
|
|
192
209
|
return index > -1;
|
|
193
210
|
}
|
|
194
211
|
/**
|
|
195
|
-
* A message handler invoked on an `'after-
|
|
212
|
+
* A message handler invoked on an `'after-attach'` message.
|
|
196
213
|
*/
|
|
197
|
-
|
|
214
|
+
onAfterAttach(msg) {
|
|
198
215
|
var _a;
|
|
199
216
|
// Wait for the component to be rendered.
|
|
200
217
|
(_a = this._openChat.renderPromise) === null || _a === void 0 ? void 0 : _a.then(() => this.updateChatList());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jupyterlab-chat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "The library to build a chat based on shared document",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jupyter",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"watch:src": "tsc -w --sourceMap"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@jupyter/chat": "^0.
|
|
45
|
+
"@jupyter/chat": "^0.17.0",
|
|
46
46
|
"@jupyter/collaborative-drive": "^4.0.2",
|
|
47
47
|
"@jupyter/ydoc": "^2.0.0 || ^3.0.0",
|
|
48
48
|
"@jupyterlab/application": "^4.2.0",
|
package/src/widget.tsx
CHANGED
|
@@ -137,6 +137,24 @@ export class ChatPanel extends SidePanel {
|
|
|
137
137
|
|
|
138
138
|
const content = this.content as AccordionPanel;
|
|
139
139
|
content.expansionToggled.connect(this._onExpansionToggled, this);
|
|
140
|
+
|
|
141
|
+
this._contentsManager.fileChanged.connect((_, args) => {
|
|
142
|
+
if (args.type === 'delete') {
|
|
143
|
+
this.widgets.forEach(widget => {
|
|
144
|
+
if ((widget as ChatSection).path === args.oldValue?.path) {
|
|
145
|
+
widget.dispose();
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
this.updateChatList();
|
|
149
|
+
}
|
|
150
|
+
const updateActions = ['new', 'rename'];
|
|
151
|
+
if (
|
|
152
|
+
updateActions.includes(args.type) &&
|
|
153
|
+
args.newValue?.path?.endsWith(chatFileType.extensions[0])
|
|
154
|
+
) {
|
|
155
|
+
this.updateChatList();
|
|
156
|
+
}
|
|
157
|
+
});
|
|
140
158
|
}
|
|
141
159
|
|
|
142
160
|
/**
|
|
@@ -236,9 +254,9 @@ export class ChatPanel extends SidePanel {
|
|
|
236
254
|
}
|
|
237
255
|
|
|
238
256
|
/**
|
|
239
|
-
* A message handler invoked on an `'after-
|
|
257
|
+
* A message handler invoked on an `'after-attach'` message.
|
|
240
258
|
*/
|
|
241
|
-
protected
|
|
259
|
+
protected onAfterAttach(msg: Message): void {
|
|
242
260
|
// Wait for the component to be rendered.
|
|
243
261
|
this._openChat.renderPromise?.then(() => this.updateChatList());
|
|
244
262
|
}
|