mirror of
https://github.com/DominikDoom/a1111-sd-webui-tagcomplete.git
synced 2026-02-07 08:40:12 +00:00
Add option for live preview
This commit is contained in:
@@ -202,6 +202,7 @@ async function syncOptions() {
|
||||
translationFile: opts["tac_translation.translationFile"],
|
||||
oldFormat: opts["tac_translation.oldFormat"],
|
||||
searchByTranslation: opts["tac_translation.searchByTranslation"],
|
||||
liveTranslation: opts["tac_translation.liveTranslation"],
|
||||
},
|
||||
// Extra file settings
|
||||
extra: {
|
||||
@@ -238,6 +239,13 @@ async function syncOptions() {
|
||||
});
|
||||
}
|
||||
|
||||
// Remove ruby div if live preview was disabled
|
||||
if (newCFG.translation.liveTranslation === false) {
|
||||
[...gradioApp().querySelectorAll('.acRuby')].forEach(r => {
|
||||
r.remove();
|
||||
});
|
||||
}
|
||||
|
||||
// Apply changes
|
||||
CFG = newCFG;
|
||||
|
||||
@@ -587,6 +595,8 @@ function updateSelectionStyle(textArea, newIndex, oldIndex) {
|
||||
}
|
||||
|
||||
function updateRuby(textArea, prompt) {
|
||||
if (!CFG.translation.liveTranslation) return;
|
||||
|
||||
let ruby = gradioApp().querySelector('.acRuby' + getTextAreaIdentifier(textArea));
|
||||
if (!ruby) {
|
||||
let textAreaId = getTextAreaIdentifier(textArea);
|
||||
|
||||
Reference in New Issue
Block a user