Commit 1891c0bc by pangchong

feat: 对比优化

parent 069fecb9
......@@ -2,7 +2,6 @@ import { h, VNode } from 'snabbdom'
import { IDomEditor, IModuleConf, SlateElement } from '@wangeditor/editor'
import { nodeSet } from '@/configs/node.config'
import { handleMouseEnter, handleMouseLeave } from '@/views/editor/functions/compare'
import { debounce } from 'lodash'
const renderElem = (type: string, style = { display: 'block' }) => {
return (elem: SlateElement, children: VNode[] | null, editor: IDomEditor): VNode => {
......
import { NewTreeModification, OldTreeModification, TreeRenderResult } from '@/lib/XMLProcessor/src/typing'
import { compareContainerRef, compareLeftRef, compareRightRef } from '../constants/compare'
import { compareContainerRef, compareLeftRef, compareRightRef, showCompare } from '../constants/compare'
import { debounce } from 'lodash'
export const handleMouseEnter = debounce((event: any) => {
if (!showCompare.value) return
const width = compareContainerRef.value?.clientWidth
const x = event.clientX
const y = event.clientY
......@@ -10,8 +11,9 @@ export const handleMouseEnter = debounce((event: any) => {
const element2 = document.elementFromPoint(width - x, y)
element1?.classList.add('bg-progressRailColor')
element2?.classList.add('bg-progressRailColor')
}, 200)
}, 250)
export const handleMouseLeave = () => {
if (!showCompare.value) return
const elements = document.querySelectorAll('.bg-progressRailColor')
elements.forEach((element) => {
element.classList.remove('bg-progressRailColor')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment