joeguang
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
6 additions and
7 deletions
-
src/hooks/web/useWatermark.ts
|
|
@ -93,16 +93,15 @@ const obFn = () => { |
|
|
target?.parentElement?.appendChild(node as HTMLElement); |
|
|
target?.parentElement?.appendChild(node as HTMLElement); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (mutation.attributeName === 'style' && mutation.target) { |
|
|
if (mutation.type === 'attributes' && mutation.target) { |
|
|
|
|
|
// 修复控制台可以”Hide element” 的问题
|
|
|
const _target = mutation.target as HTMLElement; |
|
|
const _target = mutation.target as HTMLElement; |
|
|
const target = findTargetNode(_target); |
|
|
const target = findTargetNode(_target); |
|
|
if (target) { |
|
|
if (target) { |
|
|
const { waterMarkOptions = {} } = target; |
|
|
// 禁止改属性 包括class 修改以后 mutation.type 也等于 'attributes'
|
|
|
resetWatermarkStyle( |
|
|
// 先解除监听 再加一下
|
|
|
_target as HTMLElement, |
|
|
clearAll(); |
|
|
_target?.['data-watermark-text'], |
|
|
target.setWatermark(target.targetElement?.['data-watermark-text']); |
|
|
waterMarkOptions, |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|