mirror of
https://github.com/discourse/discourse.git
synced 2025-02-24 07:32:11 +08:00
DEV: Improve checking for selected text (#30967)
After you've selected and deselected text, `selection.rangeCount` will return `true` on future events. Checking for `selection.toString` is more robust. Followup to f1bdd86a8c9bec03b962167c37963b1d11d0e5ea
This commit is contained in:
parent
6595b11e25
commit
54a52e5691
@ -14,8 +14,7 @@ export function setupComposerPosition(editor) {
|
||||
applyBehaviorTransformer("composer-position:editor-touch-move", () => {
|
||||
const notScrollable = editor.scrollHeight <= editor.clientHeight;
|
||||
const selection = window.getSelection();
|
||||
|
||||
if (notScrollable && selection.rangeCount === 0) {
|
||||
if (notScrollable && selection.toString() === "") {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user