editor.js icon indicating copy to clipboard operation
editor.js copied to clipboard

[Bug] Pasting italic/bold text causes `DOMException: Failed to execute 'setStart' on 'Range'`

Open VictorPivnenko opened this issue 3 years ago • 2 comments

The editor causes an error when pasting all italic and/or bold text as html

Steps to reproduce:

  1. Open Notes.app, type any text and make it all italic/bold, copy it to the clipboard
  2. Go to https://editorjs.io/, open the browser's console
  3. Paste the text into the editor
  • this text is represented by the following html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="2113.4">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px 'Helvetica Neue'}
</style>
</head>
<body>
<p class="p1"><b><i>Lorem Ipsum</i></b></p>
</body>
</html>
  • if it was partially italic/bold then the error would not appear in the console
  1. Observe the error appeared in the console Uncaught (in promise) DOMException: Failed to execute 'setStart' on 'Range':. However, the actual text does get placed in a new Paragraph block (works as expected).

Expected behavior: The editor pastes all italic/bold text without throwing an error.

Screenshots: image

https://user-images.githubusercontent.com/17523218/179604962-9863873b-ff3e-43d3-b896-a9a2156f45c3.mov

Device, Browser, OS: Chrome v102.0.5005.115, macOS v12.3.1

Editor.js version: v2.25.0 v2.24.3

VictorPivnenko avatar Jul 18 '22 20:07 VictorPivnenko

+1, but in my case pasted bold or italic text inserts without formatting: https://cln.sh/NpLD01pQ

medzhidov avatar Feb 15 '23 10:02 medzhidov

I also have this problem when I paste content from a Word document

Editor.js version: v2.29.0

paraita avatar Aug 31 '24 02:08 paraita