Skip to content

Commit

Permalink
fix: read the document on the server side
Browse files Browse the repository at this point in the history
  • Loading branch information
imzbf committed Jan 9, 2025
1 parent cd7f305 commit bdf6a5a
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions packages/MdEditor/layouts/Content/composition/useResize.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Ref, onBeforeUnmount, reactive, ref, toRef, watch } from 'vue';
import { Ref, onBeforeUnmount, onMounted, reactive, ref, toRef, watch } from 'vue';
import { MinInputBoxWidth } from '~/config';

import { ContentProps } from '../props';
Expand Down Expand Up @@ -61,19 +61,18 @@ const useResize = (
document.removeEventListener('mousemove', resizeMousemove);
};

watch(
[resizeRef],
() => {
document.removeEventListener('mousedown', resizeMousedown);
document.removeEventListener('mouseup', resizeMouseup);
watch([resizeRef], () => {
document.removeEventListener('mousedown', resizeMousedown);
document.removeEventListener('mouseup', resizeMouseup);

document.addEventListener('mousedown', resizeMousedown);
document.addEventListener('mouseup', resizeMouseup);
},
{
immediate: true
}
);
document.addEventListener('mousedown', resizeMousedown);
document.addEventListener('mouseup', resizeMouseup);
});

onMounted(() => {
document.addEventListener('mousedown', resizeMousedown);
document.addEventListener('mouseup', resizeMouseup);
});

onBeforeUnmount(() => {
document.removeEventListener('mousedown', resizeMousedown);
Expand Down

0 comments on commit bdf6a5a

Please sign in to comment.