Skip to content

Commit

Permalink
Fix content twitching when resizing webview
Browse files Browse the repository at this point in the history
If we spam really hard new lines on the last line of the editor for a long time, sometimes it still occurs but does not trigger any scroll listener anymore. The same behavior got observed in gmail and is deemed rare enough
  • Loading branch information
LunarX committed Jul 10, 2024
1 parent ee32dec commit 2dff67b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 0 additions & 2 deletions rich-html-editor/src/main/assets/editor_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,5 @@
<body style="height: fit-content;">
<!-- The id of this HTML tag is shared across multiple files and needs to remain the same -->
<section contenteditable="true" id="editor" style="outline: none"></section>
<!-- Used to prevent new lines on the very last line from making the webview twitch -->
<div style="height: 1rem"></div>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ class RichHtmlEditorWebView @JvmOverloads constructor(
}
}

// Prevent scrolling bug that makes the editor twitch
override fun onOverScrolled(scrollX: Int, scrollY: Int, clampedX: Boolean, clampedY: Boolean) = Unit

@Deprecated(
"Use setHtml() instead to initialize the editor with the desired HTML content.",
ReplaceWith("setHtml()", "com.infomaniak.lib.richhtmleditor")
Expand Down

0 comments on commit 2dff67b

Please sign in to comment.