Replies: 20 comments 1 reply
-
Looking to add EditorJS to an app with existing HTML content. |
Beta Was this translation helpful? Give feedback.
-
@tkrevh - I dont think so. I ended up using another wysiwyg (https://summernote.org/) - which can load any HTML with a command e.g. |
Beta Was this translation helpful? Give feedback.
-
@lubosdz I found the way!
|
Beta Was this translation helpful? Give feedback.
-
not working for me ( |
Beta Was this translation helpful? Give feedback.
-
@entonee we're using that solution in production, so it's working for all our customers. |
Beta Was this translation helpful? Give feedback.
-
Thank you. but i added it to onReady and everything works like a charm onReady: () => { but have an issue with images - i get an error ( Image Tool: uploading failed because of incorrect response: {"url":"http://myimageurl"} ) cant figure out what is correct responce - trying send just http://myimageurl - same thing. |
Beta Was this translation helpful? Give feedback.
-
@tkrevh - for us, the The project is running the latest version (2.22.2) and we are using EditorJs inside React. Attempting this solution within the |
Beta Was this translation helpful? Give feedback.
-
@sethmichaelbrown are you making sure the isReady promise is resolved? Before trying to access editor.blocks? |
Beta Was this translation helpful? Give feedback.
-
@entonee you need to implement your own upload function. I've implemented it so that I get a signed AWS S3 upload link from our backend API and then upload to S3 directly from the browser. |
Beta Was this translation helpful? Give feedback.
-
@tkrevh - I am logging the editor instance within the onReady function. editor.isReady appeals to be fulfilled. I tried adding await editor.isReady within the onReady but got the same result. Any additional insight would be awesome. Thanks for your reply! |
Beta Was this translation helpful? Give feedback.
-
@sethmichaelbrown can you post your code from initialization to where the blocks is undefined? |
Beta Was this translation helpful? Give feedback.
-
Sure -
And the output of the
|
Beta Was this translation helpful? Give feedback.
-
@sethmichaelbrown see what happens, if you create the editor instance first and before the end of the initEditor method call await editor.isReady before accessing editor.blocks... |
Beta Was this translation helpful? Give feedback.
-
Do you mean something like this? Not sure if I follow totally. Thank you for helping me understand!
|
Beta Was this translation helpful? Give feedback.
-
Close. I meant something like this:
Then just call initEditor with a valid html as parameter. |
Beta Was this translation helpful? Give feedback.
-
Here's an example if you're struggling: https://codepen.io/tkrevh/pen/GRmPwYe |
Beta Was this translation helpful? Give feedback.
-
@tkrevh - this worked perfectly! Thank you very much for all your help! |
Beta Was this translation helpful? Give feedback.
-
@tkrevh While your solution works, it seems to be very limited in what it can do. For example, pasting To see what I mean, try using the following as the input for your <html>
<body>
<h1>This is a heading</h1>
<p>This is a normal paragraph. <strong>This text should be in bold</strong>, and <em>this should be italic</em>.</p>
<table>
<thead>
<th>This should be a table heading</th>
</thead>
<tbody>
<tr>
<td>
<span>This should be a table cell.</span>
</td>
</tr>
</tbody>
</table>
<br>
<br>
<p>This paragraph should be padded.</p>
</body>
</html> |
Beta Was this translation helpful? Give feedback.
-
Thanks @sethmichaelbrown @tkrevh I had the same issue as Seth. Tried debugging the value of editor right after |
Beta Was this translation helpful? Give feedback.
-
I have this here and it works!
|
Beta Was this translation helpful? Give feedback.
-
Hi,
is it possible to import custom HTML into EditorJS on initialization?
For example - I have already existing HTML page, for which I need some WYSIWYG functionality.
Currently when I do:
then existing content of element "page-content" is ignored, and editor is just appended at the end (e.g. page bottom).
Creates new empty space rather than importing two existing
<p>
nodes -Hello
andWorld
.So it seems that EditosJS can only load supplied
data
of JSON blocks on initialization and cannot load any custom HTML contents. Is that correct or did I miss something .. ?I also looked over plugins - could not find any plugin for importing/parsing/loading supplied HTML.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions