From 9a488b50b76013d174eca5c9763f53fcf07ba94d Mon Sep 17 00:00:00 2001 From: Eduard Kuzmenko Date: Sat, 19 Jun 2021 02:45:34 +0300 Subject: [PATCH] Fix artifacts (bg, ...) when pasting content --- src/components/inputField.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/inputField.ts b/src/components/inputField.ts index 5e44102a..3f0ff73f 100644 --- a/src/components/inputField.ts +++ b/src/components/inputField.ts @@ -4,6 +4,7 @@ * https://github.com/morethanwords/tweb/blob/master/LICENSE */ +import findUpAttribute from "../helpers/dom/findUpAttribute"; import getRichValue from "../helpers/dom/getRichValue"; import isInputEmpty from "../helpers/dom/isInputEmpty"; import { debounce } from "../helpers/schedulers"; @@ -12,7 +13,7 @@ import RichTextProcessor from "../lib/richtextprocessor"; let init = () => { document.addEventListener('paste', (e) => { - if(!(e.target as HTMLElement).hasAttribute('contenteditable') && !(e.target as HTMLElement).parentElement.hasAttribute('contenteditable')) { + if(!findUpAttribute(e.target, 'contenteditable="true"')) { return; } //console.log('document paste');