This plugin adds support for page breaks and allows the user to insert page breaks into an editor. This is useful when the CMS uses a custom separator to separate the content into pages.
If you are using a fat build of the editor, then the plugin is already included in it. If you are using the slim build, then you need to enable it manually:
CopyJodit.make('#editor', { extraPlugins: ['pageBreak'] });
string
'<div style="page-break-before: always"></div>'
The HTML separator that will be used in the final output when a page break is inserted. This can be customized to match your CMS's page break format.
CopyJodit.make('#editor', { pageBreak: { separator: '<!-- pagebreak -->' } });
You can also insert a page break programmatically:
Copyconst editor = Jodit.make('#editor'); // Insert a page break at the current cursor position editor.execCommand('insertPageBreak');
Copyconst editor = Jodit.make('#editor', { buttons: ['pageBreak'], extraPlugins: ['pageBreak'] });
Copyconst editor = Jodit.make('#editor', { buttons: ['pageBreak'], extraPlugins: ['pageBreak'], pageBreak: { separator: '<!--nextpage-->' } });
Copyconst editor = Jodit.make('#editor', { buttons: ['pageBreak'], extraPlugins: ['pageBreak'], pageBreak: { separator: '<!-- PAGE BREAK -->' } });
This approach allows for a user-friendly way to insert and visualize page breaks while maintaining compatibility with various CMS systems that use different page break formats.