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

getSemanticHTML returns <p></p> when editor is blank/empty #4590

Open
trymeouteh opened this issue Jan 31, 2025 · 0 comments
Open

getSemanticHTML returns <p></p> when editor is blank/empty #4590

trymeouteh opened this issue Jan 31, 2025 · 0 comments

Comments

@trymeouteh
Copy link

getSemanticHTML() returns <p></p> when editor is blank/empty. It should return a blank/empty string instead.

Demo to reproduce issue

<link rel="stylesheet" href="node_modules/quill/dist/quill.snow.css" />

<style>
	textarea,
	#my-editor-container {
		height: 50%;
		width: 50%;
	}
</style>

<textarea></textarea>
<div id="my-editor-container">
	<div id="my-editor"></div>
</div>

<script src="node_modules/quill/dist/quill.js"></script>

<script>
	const myEditor = new Quill('#my-editor', {
		theme: 'snow',
	});

	myEditor.on('text-change', myFunction);

	myFunction();

	function myFunction() {
		let myEditorText = myEditor.getSemanticHTML();

		document.querySelector('textarea').value = myEditorText;
	}
</script>
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