Просмотр исходного кода

Merge branch 'iteration-20240801' into online

lex 10 месяцев назад
Родитель
Сommit
2eb8b1d8ed
1 измененных файлов с 3 добавлено и 8 удалено
  1. 3 8
      src/views/content-information/useSpeak.ts

+ 3 - 8
src/views/content-information/useSpeak.ts

@@ -85,8 +85,7 @@ export const useSpeak = (musicContent?: string, selectionCouser?: string) => {
       return 'up';
     }
   };
-  const getSelectText = (event: any) => {
-    event.preventDefault(); // 阻止默认行为
+  const getSelectText = () => {
     const selection: any = window.getSelection();
     const range = selection.rangeCount > 0 ? selection.getRangeAt(0) : null;
 
@@ -100,7 +99,7 @@ export const useSpeak = (musicContent?: string, selectionCouser?: string) => {
         anchorOffset = 0,
         endIndex = 0,
         focusOffset = 0;
-      console.log(selection, 'selection');
+      // console.log(selection, 'selection');
 
       // 都为0的情况下判断为选中某一个段
       if (selection.focusOffset === 0 && selection.anchorOffset === 0) {
@@ -175,7 +174,7 @@ export const useSpeak = (musicContent?: string, selectionCouser?: string) => {
       const rects = range.getClientRects();
 
       if (rects.length > 0) {
-        console.log(rects, 'rects');
+        // console.log(rects, 'rects');
         const firstRect = rects[rects.length - 1];
         const x = firstRect.right;
         const y = firstRect.top;
@@ -494,16 +493,12 @@ export const useSpeak = (musicContent?: string, selectionCouser?: string) => {
   const onDestory = () => {
     document.removeEventListener('mouseup', getSelectText);
     document.removeEventListener('touchend', getSelectText);
-    document.removeEventListener('touchmove', getSelectText);
     onCloseSpeak();
   };
 
   onMounted(async () => {
     document.addEventListener('mouseup', getSelectText);
     document.addEventListener('touchend', getSelectText);
-    document.addEventListener('touchmove', () => {
-      console.log(11111);
-    });
   });
 
   onUnmounted(() => {