|
@@ -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(() => {
|