mirror of
https://github.com/zadam/trilium.git
synced 2025-11-12 08:15:52 +01:00
feat(client): add a copy button to read-only text
This commit is contained in:
@@ -12,7 +12,7 @@ import { createChatSession, checkSessionExists, setupStreamingResponse, getDirec
|
||||
import { extractInChatToolSteps } from "./message_processor.js";
|
||||
import { validateEmbeddingProviders } from "./validation.js";
|
||||
import type { MessageData, ToolExecutionStep, ChatData } from "./types.js";
|
||||
import { applySyntaxHighlight } from "../../services/syntax_highlight.js";
|
||||
import { formatCodeBlocks } from "../../services/syntax_highlight.js";
|
||||
|
||||
import "../../stylesheets/llm_chat.css";
|
||||
|
||||
@@ -925,7 +925,7 @@ export default class LlmChatPanel extends BasicWidget {
|
||||
|
||||
// Apply syntax highlighting if this is the final update
|
||||
if (isDone) {
|
||||
applySyntaxHighlight($(assistantMessageEl as HTMLElement));
|
||||
formatCodeBlocks($(assistantMessageEl as HTMLElement));
|
||||
|
||||
// Update message in the data model for storage
|
||||
// Find the last assistant message to update, or add a new one if none exists
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Utility functions for LLM Chat
|
||||
*/
|
||||
import { marked } from "marked";
|
||||
import { applySyntaxHighlight } from "../../services/syntax_highlight.js";
|
||||
import { formatCodeBlocks } from "../../services/syntax_highlight.js";
|
||||
|
||||
/**
|
||||
* Format markdown content for display
|
||||
@@ -62,7 +62,7 @@ export function escapeHtml(text: string): string {
|
||||
* Apply syntax highlighting to content
|
||||
*/
|
||||
export function applyHighlighting(element: HTMLElement): void {
|
||||
applySyntaxHighlight($(element));
|
||||
formatCodeBlocks($(element));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import AbstractTextTypeWidget from "./abstract_text_type_widget.js";
|
||||
import { applySyntaxHighlight } from "../../services/syntax_highlight.js";
|
||||
import { formatCodeBlocks } from "../../services/syntax_highlight.js";
|
||||
import type FNote from "../../entities/fnote.js";
|
||||
import type { CommandListenerData, EventData } from "../../components/app_context.js";
|
||||
import { getLocaleById } from "../../services/i18n.js";
|
||||
@@ -125,7 +125,7 @@ export default class ReadOnlyTextTypeWidget extends AbstractTextTypeWidget {
|
||||
}
|
||||
|
||||
await this.#applyInlineMermaid();
|
||||
await applySyntaxHighlight(this.$content);
|
||||
await formatCodeBlocks(this.$content);
|
||||
}
|
||||
|
||||
async #applyInlineMermaid() {
|
||||
|
||||
Reference in New Issue
Block a user