Issue Bug Closed

#99673CKEditor5 Style Plugin

Benjamin Kott 01/23/23, 12:45 updated 07/09/24, 12:46

Description

Style definition, this should add btn and a btn-primary to a link.

{
    name: 'a',
    classes: [ 'btn', 'btn-primary' ]
},

The following examples show the result of selecting the style and | represents the current cursor positon:

Text <a href="#">Example Text</a> Text
<a class="btn btn-primary"></a>Text <a href="#">Example Text</a> Text
Text <a href="#">Example| Text</a> Text
Text <a href="#">Example</a><a class="btn btn-primary"></a><a href="#"> Text</a> Text
Text |<a href="#">Example Text</a>| Text
Text |<a href="#" class="btn btn-primary">Example Text</a>| Text
Text <a href="#">Exam|ple| Text</a> Text
Text <a href="#">Exam</a><a class="btn btn-primary" href="#">ple</a><a href="#"> Text</a> Text
Text <a href="#">Example |Text|</a> Text
Text <a href="#">Example </a><a class="btn btn-primary" href="#">Text</a> Text
Text <a href="#">Example |Text</a> Text|
Text <a href="#">Example </a><a class="btn btn-primary" href="#">Text</a><a class="btn btn-primary"> Text</a>

As a user I expect that when the text selection is inside the link, that the class will be added to the existing element.
As a user I expect that when no text selection exists, only styles are available that can be inserted standalone.
As a user I expect to only see available styles for a selection

This seems not to be possible with CKEditor5 Styles plugin.

Possible Solution:
Write custom plugin for styles and replace existing styles plugin

https://github.com/ckeditor/ckeditor5/tree/master/packages/ckeditor5-style

Reviews 2

Subtasks 3