Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paste wont work some times. #283

Open
jack-fdrv opened this issue Sep 22, 2023 · 0 comments
Open

Paste wont work some times. #283

jack-fdrv opened this issue Sep 22, 2023 · 0 comments

Comments

@jack-fdrv
Copy link

jack-fdrv commented Sep 22, 2023

Weired bug. Checked on Chrome wihtout extantions and safari.

<ContentEditable
  className='esup_editor_text'
  innerRef={editorRef}
  autoFocus
  onChange={(evt) => {
	  handles.updateContent(evt.currentTarget.innerHTML)
  }}
  onBlur={() => {
	  console.log('blur');
  }}
html={editorData.text || ''} />

Paste event works fine, if i copied text inside ContentEditable and some other html. But i copied it from url adress for example, i wont paste it in. I try to use

onPaste={(evt) => {
	evt.preventDefault();
	const text = evt.clipboardData.getData('text/plain');
	document.execCommand('insertHTML', false, text);
}}

And it start working! But the problem that now if i try to paste text which. have copied inside ContentEditable it paste it twice.
It also wont work when i right click, paste...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant