Linebreak Spacing Option? #1580

Closed
opened 2026-02-05 01:19:19 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @jrneulight on GitHub (Mar 9, 2020).

Hi,

I've been having issues with the double spacing that occurs when pressing "Enter" while editing a book. These tinyMCE configuration options seem to have resolved the issue for me, but in order to use them I have to edit the wysiwyg-editor.js and recompile the app.js file with webpack.

Would it be possible to add an option in the interface in order to toggle linebreak spacing within the tinyMCE editor? I've included the relevant options below tinyMCE config options below.

force_br_newlines : true,
force_p_newlines : false,
forced_root_block : '' // Needed for 3.x

Originally created by @jrneulight on GitHub (Mar 9, 2020). Hi, I've been having issues with the double spacing that occurs when pressing "Enter" while editing a book. These tinyMCE configuration options seem to have resolved the issue for me, but in order to use them I have to edit the wysiwyg-editor.js and recompile the app.js file with webpack. Would it be possible to add an option in the interface in order to toggle linebreak spacing within the tinyMCE editor? I've included the relevant options below tinyMCE config options below. force_br_newlines : true, force_p_newlines : false, forced_root_block : '' // Needed for 3.x
OVERLORD added the 📝 WYSIWYG Editor🐕 Support💻 Front-End labels 2026-02-05 01:19:19 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Mar 9, 2020):

Hi @jrneulight,

Unfortunately I would not look to incorporate such a low-level, detailed setting in the interface. As an alternative option to achieving this, without webpack re-complication or editing any core files, it's possible to do this via the editor events we expose.

Therefore, Using the "Custom HTML Head Content" setting, you could achieve your customisations like so:

<script>
	window.addEventListener('editor-tinymce::pre-init', event => {
		const config = event.detail.config;
		config.force_br_newlines = true;
		config.force_p_newlines = false;
		config.forced_root_block = '';
	});
</script>

Note that such customisations are out-of-support and its possible the editor could change and be incompatible with such changes in the future.

Alternatively, You could achieve a similar result with CSS, again via the "Custom HTML Head Content" setting:

<style>
.page-content p {
    margin-bottom: 0;
    margin-top: 0;
}
</style>
@ssddanbrown commented on GitHub (Mar 9, 2020): Hi @jrneulight, Unfortunately I would not look to incorporate such a low-level, detailed setting in the interface. As an alternative option to achieving this, without webpack re-complication or editing any core files, it's possible to do this via the [editor events we expose](https://www.bookstackapp.com/docs/admin/hacking-bookstack/#bookstack-editor-events). Therefore, Using the "Custom HTML Head Content" setting, you could achieve your customisations like so: ```html <script> window.addEventListener('editor-tinymce::pre-init', event => { const config = event.detail.config; config.force_br_newlines = true; config.force_p_newlines = false; config.forced_root_block = ''; }); </script> ``` Note that such customisations are out-of-support and its possible the editor could change and be incompatible with such changes in the future. Alternatively, You could achieve a similar result with CSS, again via the "Custom HTML Head Content" setting: ```html <style> .page-content p { margin-bottom: 0; margin-top: 0; } </style> ```
Author
Owner

@jrneulight commented on GitHub (Mar 10, 2020):

This solves my problem perfectly! Thank you and good luck with development

@jrneulight commented on GitHub (Mar 10, 2020): This solves my problem perfectly! Thank you and good luck with development
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1580