mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-09 13:25:11 +00:00
Rename copy-button to more general chat-action-button in Obsidian client
- Use 4 space indent of activateView function in pane_view component
This commit is contained in:
@@ -461,7 +461,7 @@ export class KhojChatView extends KhojPaneView {
|
|||||||
|
|
||||||
renderActionButtons(message: string, chat_message_body_text_el: HTMLElement) {
|
renderActionButtons(message: string, chat_message_body_text_el: HTMLElement) {
|
||||||
let copyButton = this.contentEl.createEl('button');
|
let copyButton = this.contentEl.createEl('button');
|
||||||
copyButton.classList.add("copy-button");
|
copyButton.classList.add("chat-action-button");
|
||||||
copyButton.title = "Copy Message to Clipboard";
|
copyButton.title = "Copy Message to Clipboard";
|
||||||
setIcon(copyButton, "copy-plus");
|
setIcon(copyButton, "copy-plus");
|
||||||
copyButton.addEventListener('click', createCopyParentText(message));
|
copyButton.addEventListener('click', createCopyParentText(message));
|
||||||
@@ -469,7 +469,7 @@ export class KhojChatView extends KhojPaneView {
|
|||||||
|
|
||||||
// Add button to paste into current buffer
|
// Add button to paste into current buffer
|
||||||
let pasteToFile = this.contentEl.createEl('button');
|
let pasteToFile = this.contentEl.createEl('button');
|
||||||
pasteToFile.classList.add("copy-button");
|
pasteToFile.classList.add("chat-action-button");
|
||||||
pasteToFile.title = "Paste Message to File";
|
pasteToFile.title = "Paste Message to File";
|
||||||
setIcon(pasteToFile, "clipboard-paste");
|
setIcon(pasteToFile, "clipboard-paste");
|
||||||
pasteToFile.addEventListener('click', (event) => { pasteTextAtCursor(createCopyParentText(message, 'clipboard-paste')(event)); });
|
pasteToFile.addEventListener('click', (event) => { pasteTextAtCursor(createCopyParentText(message, 'clipboard-paste')(event)); });
|
||||||
|
|||||||
@@ -79,16 +79,16 @@ export default class Khoj extends Plugin {
|
|||||||
const leaves = workspace.getLeavesOfType(viewType);
|
const leaves = workspace.getLeavesOfType(viewType);
|
||||||
|
|
||||||
if (leaves.length > 0) {
|
if (leaves.length > 0) {
|
||||||
// A leaf with our view already exists, use that
|
// A leaf with our view already exists, use that
|
||||||
leaf = leaves[0];
|
leaf = leaves[0];
|
||||||
} else {
|
} else {
|
||||||
// Our view could not be found in the workspace, create a new leaf
|
// Our view could not be found in the workspace, create a new leaf
|
||||||
// in the right sidebar for it
|
// in the right sidebar for it
|
||||||
leaf = workspace.getRightLeaf(false);
|
leaf = workspace.getRightLeaf(false);
|
||||||
await leaf?.setViewState({ type: viewType, active: true });
|
await leaf?.setViewState({ type: viewType, active: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
// "Reveal" the leaf in case it is in a collapsed sidebar
|
// "Reveal" the leaf in case it is in a collapsed sidebar
|
||||||
if (leaf) workspace.revealLeaf(leaf);
|
if (leaf) workspace.revealLeaf(leaf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,16 +38,16 @@ export abstract class KhojPaneView extends ItemView {
|
|||||||
const leaves = workspace.getLeavesOfType(viewType);
|
const leaves = workspace.getLeavesOfType(viewType);
|
||||||
|
|
||||||
if (leaves.length > 0) {
|
if (leaves.length > 0) {
|
||||||
// A leaf with our view already exists, use that
|
// A leaf with our view already exists, use that
|
||||||
leaf = leaves[0];
|
leaf = leaves[0];
|
||||||
} else {
|
} else {
|
||||||
// Our view could not be found in the workspace, create a new leaf
|
// Our view could not be found in the workspace, create a new leaf
|
||||||
// in the right sidebar for it
|
// in the right sidebar for it
|
||||||
leaf = workspace.getRightLeaf(false);
|
leaf = workspace.getRightLeaf(false);
|
||||||
await leaf?.setViewState({ type: viewType, active: true });
|
await leaf?.setViewState({ type: viewType, active: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
// "Reveal" the leaf in case it is in a collapsed sidebar
|
// "Reveal" the leaf in case it is in a collapsed sidebar
|
||||||
if (leaf) workspace.revealLeaf(leaf);
|
if (leaf) workspace.revealLeaf(leaf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -477,7 +477,7 @@ span.khoj-nav-item-text {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Copy button */
|
/* Copy button */
|
||||||
button.copy-button {
|
button.chat-action-button {
|
||||||
display: block;
|
display: block;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
@@ -491,22 +491,22 @@ button.copy-button {
|
|||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
button.copy-button span {
|
button.chat-action-button span {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
position: relative;
|
position: relative;
|
||||||
transition: 0.5s;
|
transition: 0.5s;
|
||||||
}
|
}
|
||||||
|
button.chat-action-button:hover {
|
||||||
|
background-color: var(--background-modifier-active-hover);
|
||||||
|
color: var(--text-normal);
|
||||||
|
}
|
||||||
|
|
||||||
img.copy-icon {
|
img.copy-icon {
|
||||||
width: 16px;
|
width: 16px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
button.copy-button:hover {
|
|
||||||
background-color: var(--background-modifier-active-hover);
|
|
||||||
color: var(--text-normal);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Loading Spinner */
|
/* Loading Spinner */
|
||||||
.lds-ellipsis {
|
.lds-ellipsis {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|||||||
Reference in New Issue
Block a user