Add disable quote formating option
This commit is contained in:
@@ -685,4 +685,5 @@ export const languageEnglish = {
|
||||
claudeCachingExperimental: "Claude Caching",
|
||||
openClose: "Open/Close",
|
||||
hideApiKeys: "Hide API Keys",
|
||||
unformatQuotes: "Disable Quote Formatting",
|
||||
}
|
||||
@@ -152,11 +152,11 @@
|
||||
<span class="ml-2">Italic Bold Text</span>
|
||||
</div>
|
||||
<div class="flex items-center mt-2">
|
||||
<ColorInput bind:value={$DataBase.customTextTheme.FontColorQuote1} on:input={updateTextTheme} />
|
||||
<ColorInput nullable bind:value={$DataBase.customTextTheme.FontColorQuote1} on:input={updateTextTheme} />
|
||||
<span class="ml-2">Single Quote Text</span>
|
||||
</div>
|
||||
<div class="flex items-center mt-2">
|
||||
<ColorInput bind:value={$DataBase.customTextTheme.FontColorQuote2} on:input={updateTextTheme} />
|
||||
<ColorInput nullable bind:value={$DataBase.customTextTheme.FontColorQuote2} on:input={updateTextTheme} />
|
||||
<span class="ml-2">Double Quote Text</span>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -314,6 +314,10 @@
|
||||
<Check bind:check={$DataBase.hideApiKey} name={language.hideApiKeys}/>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center mt-2">
|
||||
<Check bind:check={$DataBase.unformatQuotes} name={language.unformatQuotes}/>
|
||||
</div>
|
||||
|
||||
{#if $DataBase.useExperimental}
|
||||
<div class="flex items-center mt-2">
|
||||
<Check bind:check={$DataBase.useChatSticker} name={language.useChatSticker}/>
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<script lang="ts">
|
||||
import ColorPicker from 'svelte-awesome-color-picker';
|
||||
export let value = '#000000';
|
||||
export let nullable = false;
|
||||
</script>
|
||||
|
||||
<div class="cl rounded-full bg-white">
|
||||
<ColorPicker
|
||||
label="" bind:hex={value} on:input
|
||||
nullable={nullable}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -230,8 +230,8 @@ export function updateTextTheme(){
|
||||
root.style.setProperty('--FontColorItalic', db.customTextTheme.FontColorItalic);
|
||||
root.style.setProperty('--FontColorBold', db.customTextTheme.FontColorBold);
|
||||
root.style.setProperty('--FontColorItalicBold', db.customTextTheme.FontColorItalicBold);
|
||||
root.style.setProperty('--FontColorQuote1', db.customTextTheme.FontColorQuote1);
|
||||
root.style.setProperty('--FontColorQuote2', db.customTextTheme.FontColorQuote2);
|
||||
root.style.setProperty('--FontColorQuote1', db.customTextTheme.FontColorQuote1 ?? '#8BE9FD');
|
||||
root.style.setProperty('--FontColorQuote2', db.customTextTheme.FontColorQuote2 ?? '#FFB86C');
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,11 +79,19 @@ DOMPurify.addHook("uponSanitizeAttribute", (node, data) => {
|
||||
|
||||
|
||||
function renderMarkdown(md:markdownit, data:string){
|
||||
return md.render(data.replace(/“|”/g, '"').replace(/‘|’/g, "'"))
|
||||
.replace(/\uE9b0/gu, '<mark risu-mark="quote2">“')
|
||||
.replace(/\uE9b1/gu, '”</mark>')
|
||||
.replace(/\uE9b2/gu, '<mark risu-mark="quote1">‘')
|
||||
.replace(/\uE9b3/gu, '’</mark>')
|
||||
const db = get(DataBase)
|
||||
let text = md.render(data.replace(/“|”/g, '"').replace(/‘|’/g, "'"))
|
||||
|
||||
if(db?.unformatQuotes){
|
||||
text = text.replace(/\uE9b0/gu, '“').replace(/\uE9b1/gu, '”')
|
||||
text = text.replace(/\uE9b2/gu, '‘').replace(/\uE9b3/gu, '’')
|
||||
}
|
||||
else{
|
||||
text = text.replace(/\uE9b0/gu, '<mark risu-mark="quote2">“').replace(/\uE9b1/gu, '”</mark>')
|
||||
text = text.replace(/\uE9b2/gu, '<mark risu-mark="quote1">‘').replace(/\uE9b3/gu, '’</mark>')
|
||||
}
|
||||
|
||||
return text
|
||||
}
|
||||
|
||||
async function renderHighlightableMarkdown(data:string) {
|
||||
|
||||
@@ -429,6 +429,7 @@ export function setDatabase(data:Database){
|
||||
timeout: 30
|
||||
}
|
||||
data.hideApiKey ??= true
|
||||
data.unformatQuotes ??= false
|
||||
|
||||
changeLanguage(data.language)
|
||||
DataBase.set(data)
|
||||
@@ -712,6 +713,7 @@ export interface Database{
|
||||
useLegacyGUI: boolean
|
||||
claudeCachingExperimental: boolean
|
||||
hideApiKey: boolean
|
||||
unformatQuotes: boolean
|
||||
}
|
||||
|
||||
export interface customscript{
|
||||
|
||||
Reference in New Issue
Block a user