fix: prevent accidental appearance of floating selectionTools on certain websites

This commit is contained in:
josc146
2023-03-28 15:15:24 +08:00
parent ac47f6f7b6
commit df0bf5e222
+10 -2
View File
@@ -126,7 +126,11 @@ async function prepareForSelectionTools() {
deleteToolbar()
setTimeout(() => {
const selection = window.getSelection()?.toString().trim()
const selection = window
.getSelection()
?.toString()
.trim()
.replace(/^-+|-+$/g, '')
if (selection) {
const inputElement = selectionElement.querySelector('input, textarea')
let position
@@ -183,7 +187,11 @@ async function prepareForSelectionToolsTouch() {
deleteToolbar()
setTimeout(() => {
const selection = window.getSelection()?.toString().trim()
const selection = window
.getSelection()
?.toString()
.trim()
.replace(/^-+|-+$/g, '')
if (selection) {
toolbarContainer = createElementAtPosition(
e.changedTouches[0].pageX + 20,