diff --git a/aiserver.py b/aiserver.py index d5f3fd86..dd7bd435 100644 --- a/aiserver.py +++ b/aiserver.py @@ -1476,7 +1476,7 @@ def update_story_chunk(idx: Union[int, str]): item = vars.acregex_ui.sub('\\1', item) # Add special formatting to adventure actions chunk_text = f'{formatforhtml(item)}' - 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) #==================================================================# diff --git a/static/application.js b/static/application.js index e9156158..8eb3bc5d 100644 --- a/static/application.js +++ b/static/application.js @@ -947,6 +947,12 @@ function chunkOnSelectionChange(event) { syncAllModifiedChunks(); setTimeout(function() { 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); } @@ -1096,7 +1102,7 @@ $(document).ready(function(){ scrollToBottom(); } else if(msg.cmd == "updatechunk") { hideMessage(); - const {index, html, last} = msg.data; + const {index, html} = msg.data; const existingChunk = game_text.children(`#n${index}`) const newChunk = $(html); unbindGametext(); @@ -1110,10 +1116,6 @@ $(document).ready(function(){ } bindGametext(); hide([$('#curtain')]); - if(last) { - // Scroll to bottom of text if it's the last element - scrollToBottom(); - } } else if(msg.cmd == "removechunk") { hideMessage(); let index = msg.data;