This commit is contained in:
Timothy J. Baek 2024-10-05 12:07:45 -07:00
parent 81440460f2
commit f5b6785e53
5 changed files with 14 additions and 3 deletions

View File

@ -17,6 +17,7 @@
const dispatch = createEventDispatcher();
export let id = '';
export let save = false;
export let token;
export let lang = '';
@ -316,9 +317,11 @@ __builtins__.input = input`);
{/if}
{/if}
<button class="copy-code-button bg-none border-none p-1" on:click={saveCode}>
{saved ? $i18n.t('Saved') : $i18n.t('Save')}
</button>
{#if save}
<button class="copy-code-button bg-none border-none p-1" on:click={saveCode}>
{saved ? $i18n.t('Saved') : $i18n.t('Save')}
</button>
{/if}
<button class="copy-code-button bg-none border-none p-1" on:click={copyCode}
>{copied ? $i18n.t('Copied') : $i18n.t('Copy')}</button

View File

@ -9,6 +9,7 @@
export let content;
export let model = null;
export let save = false;
export let floatingButtons = true;
let contentContainerElement;
@ -60,6 +61,7 @@
{id}
{content}
{model}
{save}
on:update={(e) => {
dispatch('update', e.detail);
}}

View File

@ -14,6 +14,7 @@
export let id;
export let content;
export let model = null;
export let save = false;
let tokens = [];
@ -37,6 +38,7 @@
<MarkdownTokens
{tokens}
{id}
{save}
on:update={(e) => {
dispatch('update', e.detail);
}}

View File

@ -17,6 +17,8 @@
export let tokens: Token[];
export let top = true;
export let save = false;
const headerComponent = (depth: number) => {
return 'h' + depth;
};
@ -36,6 +38,7 @@
{token}
lang={token?.lang ?? ''}
code={revertSanitizedResponseContent(token?.text ?? '')}
{save}
on:save={(e) => {
dispatch('update', {
oldContent: token.text,

View File

@ -478,6 +478,7 @@
<ContentRenderer
id={message.id}
content={message.content}
save={true}
{model}
on:update={(e) => {
const { oldContent, newContent } = e.detail;