Explanation of the fixed issue
If you used a <wbr> element within a link or other inline elements such as <strong>, these enclosing inline elements were split by CKEditor 5 at this position:
<a href="https://docs.typo3.org/Home/GettingStarted.html">https://docs.typo3.org/Home/</a>
<wbr>
<a href="https://docs.typo3.org/Home/GettingStarted.html">GettingStarted.html</a>
Solution
The same issue occurs in CKEditor 5 for line breaks with <br>. There is an open issue on GitHub, where I also found the solution for the <wbr> element.
model.schema.register('wbrTag', {
allowWhere: '$text',
allowAttributesOf: '$text',
isInline: true
});
const wbrTag = writer.createElement('wbrTag', model.document.selection.getAttributes());
- With allowAttributesOf: ‘$text’, you can now add a link or inline styles to text which already contains <wbr> elements.
- By adding model.document.selection.getAttributes(), you can insert <wbr> elements into text that is wrapped by inline elements (without splitting them at this position).
Breaking Change: Module import
Just after the release of the extension, Benjamin Franzke adapted the JavaScript entry point to naming conventions (@sebkln/ckeditor-wordbreak), but kept the one I had initially picked (@sebkln/ckeditor/wordbreak.js) to avoid an immediate breaking change. This was published as version 1.0.2.
I have used the opportunity of this bugfix to remove the old entry point and release the extension with a new major version.
If not already done, you need to adjust the import of the plugin in your CKEditor configuration:
editor:
config:
importModules:
- '@sebkln/ckeditor-wordbreak'