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:
Debanjum Singh Solanky 2024-06-26 15:25:27 +05:30
parent 8c12a69570
commit afbeee9e82
4 changed files with 23 additions and 23 deletions

View file

@ -461,7 +461,7 @@ export class KhojChatView extends KhojPaneView {
renderActionButtons(message: string, chat_message_body_text_el: HTMLElement) {
let copyButton = this.contentEl.createEl('button');
copyButton.classList.add("copy-button");
copyButton.classList.add("chat-action-button");
copyButton.title = "Copy Message to Clipboard";
setIcon(copyButton, "copy-plus");
copyButton.addEventListener('click', createCopyParentText(message));
@ -469,7 +469,7 @@ export class KhojChatView extends KhojPaneView {
// Add button to paste into current buffer
let pasteToFile = this.contentEl.createEl('button');
pasteToFile.classList.add("copy-button");
pasteToFile.classList.add("chat-action-button");
pasteToFile.title = "Paste Message to File";
setIcon(pasteToFile, "clipboard-paste");
pasteToFile.addEventListener('click', (event) => { pasteTextAtCursor(createCopyParentText(message, 'clipboard-paste')(event)); });

View file

@ -79,16 +79,16 @@ export default class Khoj extends Plugin {
const leaves = workspace.getLeavesOfType(viewType);
if (leaves.length > 0) {
// A leaf with our view already exists, use that
leaf = leaves[0];
// A leaf with our view already exists, use that
leaf = leaves[0];
} else {
// Our view could not be found in the workspace, create a new leaf
// in the right sidebar for it
leaf = workspace.getRightLeaf(false);
await leaf?.setViewState({ type: viewType, active: true });
// Our view could not be found in the workspace, create a new leaf
// in the right sidebar for it
leaf = workspace.getRightLeaf(false);
await leaf?.setViewState({ type: viewType, active: true });
}
// "Reveal" the leaf in case it is in a collapsed sidebar
if (leaf) workspace.revealLeaf(leaf);
}
}
}

View file

@ -38,16 +38,16 @@ export abstract class KhojPaneView extends ItemView {
const leaves = workspace.getLeavesOfType(viewType);
if (leaves.length > 0) {
// A leaf with our view already exists, use that
leaf = leaves[0];
// A leaf with our view already exists, use that
leaf = leaves[0];
} else {
// Our view could not be found in the workspace, create a new leaf
// in the right sidebar for it
leaf = workspace.getRightLeaf(false);
await leaf?.setViewState({ type: viewType, active: true });
// Our view could not be found in the workspace, create a new leaf
// in the right sidebar for it
leaf = workspace.getRightLeaf(false);
await leaf?.setViewState({ type: viewType, active: true });
}
// "Reveal" the leaf in case it is in a collapsed sidebar
if (leaf) workspace.revealLeaf(leaf);
}
}
}

View file

@ -477,7 +477,7 @@ span.khoj-nav-item-text {
}
/* Copy button */
button.copy-button {
button.chat-action-button {
display: block;
border-radius: 4px;
color: var(--text-muted);
@ -491,22 +491,22 @@ button.copy-button {
margin-top: 8px;
float: right;
}
button.copy-button span {
button.chat-action-button span {
cursor: pointer;
display: inline-block;
position: relative;
transition: 0.5s;
}
button.chat-action-button:hover {
background-color: var(--background-modifier-active-hover);
color: var(--text-normal);
}
img.copy-icon {
width: 16px;
height: 16px;
}
button.copy-button:hover {
background-color: var(--background-modifier-active-hover);
color: var(--text-normal);
}
/* Loading Spinner */
.lds-ellipsis {
display: inline-block;