Skip to content

tip: prefill an empty editor with <p><br></p> to avoid a small bug #174

@dvtan

Description

@dvtan

like this:

if (initBody) {
	editor.content.innerHTML = initBody;
} else {
	editor.content.innerHTML = '<p><br></p>'
}

Most of the time images get inserted inside <p></p> tags. But if the user starts uploading images before he writes even a single letter, the image will be inserted at the top level since there's nothing else there.

Oh and will also need this in case user writes something and deletes it all again (in which case Pell sets it back to completely blank):

onChange: (html) => {
	if (html === '') {
		editor.content.innerHTML = '<p><br></p>'
	}
}

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