mirror of
https://github.com/wassname/chatGPTBox.git
synced 2026-07-06 05:14:42 +08:00
fix: prevent accidental appearance of floating selectionTools on certain websites
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user