mirror of
https://github.com/logancyang/obsidian-copilot.git
synced 2026-07-22 07:50:24 +00:00
Enable chat UI in the note area for a bigger view (#111)
This commit is contained in:
parent
37c578548f
commit
9f27dd3634
5 changed files with 30 additions and 5 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "copilot",
|
||||
"name": "Copilot",
|
||||
"version": "2.3.4",
|
||||
"version": "2.3.5",
|
||||
"minAppVersion": "0.15.0",
|
||||
"description": "A ChatGPT Copilot in Obsidian.",
|
||||
"author": "Logan Yang",
|
||||
|
|
|
|||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "obsidian-copilot",
|
||||
"version": "2.3.4",
|
||||
"version": "2.3.5",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "obsidian-copilot",
|
||||
"version": "2.3.4",
|
||||
"version": "2.3.5",
|
||||
"license": "AGPL-3.0",
|
||||
"dependencies": {
|
||||
"@huggingface/inference": "^1.8.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "obsidian-copilot",
|
||||
"version": "2.3.4",
|
||||
"version": "2.3.5",
|
||||
"description": "ChatGPT integration for Obsidian",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
|
|
|||
24
src/main.ts
24
src/main.ts
|
|
@ -77,6 +77,14 @@ export default class CopilotPlugin extends Plugin {
|
|||
}
|
||||
});
|
||||
|
||||
this.addCommand({
|
||||
id: 'chat-toggle-window-note-area',
|
||||
name: 'Toggle Copilot Chat Window in Note Area',
|
||||
callback: () => {
|
||||
this.toggleViewNoteArea();
|
||||
}
|
||||
});
|
||||
|
||||
this.addRibbonIcon('message-square', 'Copilot Chat', (evt: MouseEvent) => {
|
||||
this.toggleView();
|
||||
});
|
||||
|
|
@ -397,6 +405,22 @@ export default class CopilotPlugin extends Plugin {
|
|||
this.chatIsVisible = false;
|
||||
}
|
||||
|
||||
async toggleViewNoteArea() {
|
||||
const leaves = this.app.workspace.getLeavesOfType(CHAT_VIEWTYPE);
|
||||
leaves.length > 0 ? this.deactivateView() : this.activateViewNoteArea();
|
||||
}
|
||||
|
||||
async activateViewNoteArea() {
|
||||
this.app.workspace.detachLeavesOfType(CHAT_VIEWTYPE);
|
||||
this.activateViewPromise = this.app.workspace.getLeaf(true).setViewState({
|
||||
type: CHAT_VIEWTYPE,
|
||||
active: true,
|
||||
});
|
||||
await this.activateViewPromise;
|
||||
this.app.workspace.revealLeaf(this.app.workspace.getLeavesOfType(CHAT_VIEWTYPE)[0]);
|
||||
this.chatIsVisible = true;
|
||||
}
|
||||
|
||||
async loadSettings() {
|
||||
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,5 +18,6 @@
|
|||
"2.3.1": "0.15.0",
|
||||
"2.3.2": "0.15.0",
|
||||
"2.3.3": "0.15.0",
|
||||
"2.3.4": "0.15.0"
|
||||
"2.3.4": "0.15.0",
|
||||
"2.3.5": "0.15.0"
|
||||
}
|
||||
Loading…
Reference in a new issue