镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Paste wont work some times. #283

Open

Description

@jack-fdrv

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...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions