Project

General

Profile

Bug #99673

Updated by Benjamin Kott over 1 year ago

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

 <pre><code class="json"> 
 { 
	 name: 'a', 
	 classes: [ 'btn', 'btn-primary' ] 
 }, 
 </code></pre> 

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


 <pre><code class="html"> 
 Text <a href="#">Example Text</a> Text 
 <a class="btn btn-primary"></a>Text <a href="#">Example Text</a> Text 
 </code></pre> 

 <pre><code class="html"> 
 Text <a href="#">Example| Text</a> Text 
 Text <a href="#">Example</a><a class="btn btn-primary"></a><a href="#"> Text</a> Text 
 </code></pre> 

 <pre><code class="html"> 
 Text |<a href="#">Example Text</a>| Text 
 Text |<a href="#" class="btn btn-primary">Example Text</a>| Text 
 </code></pre> 

 <pre><code class="html"> 
 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 
 </code></pre> 

 <pre><code class="html"> 
 Text <a href="#">Example |Text|</a> Text 
 Text <a href="#">Example </a><a class="btn btn-primary" href="#">Text</a> Text 
 </code></pre> 

 <pre><code class="html"> 
 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> 
 </code></pre> 

 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, that the style selection is not available. 

 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

Back