mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-02-20 05:30:57 +01:00
Fix editor scrolling issues
This commit is contained in:
parent
47c6f48e94
commit
a327eed2c3
@ -1476,7 +1476,7 @@ def update_story_chunk(idx: Union[int, str]):
|
|||||||
item = vars.acregex_ui.sub('<action>\\1</action>', item) # Add special formatting to adventure actions
|
item = vars.acregex_ui.sub('<action>\\1</action>', item) # Add special formatting to adventure actions
|
||||||
|
|
||||||
chunk_text = f'<chunk n="{idx}" id="n{idx}" tabindex="-1">{formatforhtml(item)}</chunk>'
|
chunk_text = f'<chunk n="{idx}" id="n{idx}" tabindex="-1">{formatforhtml(item)}</chunk>'
|
||||||
emit('from_server', {'cmd': 'updatechunk', 'data': {'index': idx, 'html': chunk_text, 'last': (idx == (vars.actions.get_last_key() if len(vars.actions) else 0))}}, broadcast=True)
|
emit('from_server', {'cmd': 'updatechunk', 'data': {'index': idx, 'html': chunk_text}}, broadcast=True)
|
||||||
|
|
||||||
|
|
||||||
#==================================================================#
|
#==================================================================#
|
||||||
|
@ -947,6 +947,12 @@ function chunkOnSelectionChange(event) {
|
|||||||
syncAllModifiedChunks();
|
syncAllModifiedChunks();
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
highlightEditingChunks();
|
highlightEditingChunks();
|
||||||
|
// Attempt to prevent Chromium-based browsers on Android from
|
||||||
|
// scrolling away from the current selection
|
||||||
|
setTimeout(function() {
|
||||||
|
game_text.blur();
|
||||||
|
game_text.focus();
|
||||||
|
}, 144);
|
||||||
}, 2);
|
}, 2);
|
||||||
}, 2);
|
}, 2);
|
||||||
}
|
}
|
||||||
@ -1096,7 +1102,7 @@ $(document).ready(function(){
|
|||||||
scrollToBottom();
|
scrollToBottom();
|
||||||
} else if(msg.cmd == "updatechunk") {
|
} else if(msg.cmd == "updatechunk") {
|
||||||
hideMessage();
|
hideMessage();
|
||||||
const {index, html, last} = msg.data;
|
const {index, html} = msg.data;
|
||||||
const existingChunk = game_text.children(`#n${index}`)
|
const existingChunk = game_text.children(`#n${index}`)
|
||||||
const newChunk = $(html);
|
const newChunk = $(html);
|
||||||
unbindGametext();
|
unbindGametext();
|
||||||
@ -1110,10 +1116,6 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
bindGametext();
|
bindGametext();
|
||||||
hide([$('#curtain')]);
|
hide([$('#curtain')]);
|
||||||
if(last) {
|
|
||||||
// Scroll to bottom of text if it's the last element
|
|
||||||
scrollToBottom();
|
|
||||||
}
|
|
||||||
} else if(msg.cmd == "removechunk") {
|
} else if(msg.cmd == "removechunk") {
|
||||||
hideMessage();
|
hideMessage();
|
||||||
let index = msg.data;
|
let index = msg.data;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user