Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15658 from ckeditor/ck/15580-font-color-and-font-…
…background-color-throw-error Fix (font): Font color and font background should work in both the main toolbar and the balloon toolbar. Closes #15580. MINOR BREAKING CHANGE (font): The `colorSelectorView` property will no longer be accessible from the `ColorUI` plugin in the `@ckeditor/ckeditor5-font/src/ui/colorui.ts`.
- Loading branch information
Showing
5 changed files
with
161 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<div id="editor"> | ||
<p><span>01. no-color; no-color</span></p> | ||
<p><span style="color:hsl(0, 0%, 100%);background-color:hsl(0, 0%, 0%);">02. color:hsl(0, 0%, 100%);background-color:hsl(0, 0%, 0%);</span></p> | ||
<p><span style="color:hsl(0, 75%, 60%);">03. color:hsl(0, 75%, 60%); no-color;</span></p> | ||
<p><span style="background-color:hsl(90, 75%, 60%);">04. no-color; background-color:hsl(90, 75%, 60%);</span></p> | ||
<p><span style="color:hsl(30, 75%, 60%);background-color:hsl(0, 0%, 30%);">05. color:hsl(30, 75%, 60%); background-color:hsl(0, 0%, 30%);</span></p> | ||
<p><span style="color:#00FFFF;background-color:rgb(255, 0, 0);">06. color:#00FFFF;background-color:rgb(255, 0, 0);</span></p> | ||
<p><span style="color:hsla( 0, 0%, 0%, .7);background-color:gold;">07. color:hsla( 0, 0%, 0%, .7); background-color:gold;</span></p> | ||
<p><span style="color:rgba( 0, 120, 250, 0.8);background-color:hsla(270, 100%, 50%, 0.3);">08. color:;background-color:hsla(270, 100%, 50%, 0.3);</span></p> | ||
<p><span style="color:#ddd;background-color:hsl(150, 75%, 60%);">09. color:#ddd;background-color:hsl(150, 75%, 60%);</span></p> | ||
<p><span style="color:hsl(270, 75%, 60%);background-color:#d82;">10. color:hsl(270, 75%, 60%);background-color:#d82;</span></p> | ||
</div> | ||
|
||
<div id="color-box" style="margin-top: 10px; border: 1px solid black; padding: 5px"> | ||
<p>You can use this helper to generate text with a particular color / background applied. Change inputs and accept it with enter key.</p> | ||
<label> | ||
Color: | ||
<input type="text" name="color" id="color" placeholder="#3d3d3d"> | ||
</label> | ||
<label> | ||
Background Color: | ||
<input type="text" name="bgcolor" id="bgcolor" placeholder="pink"> | ||
</label> | ||
<p contenteditable="true"><span>Text for copying.</span></p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
*/ | ||
|
||
/* globals console, window, document */ | ||
|
||
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor.js'; | ||
import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset.js'; | ||
import FontColor from '../../../../src/fontcolor.js'; | ||
import FontBackgroundColor from '../../../../src/fontbackgroundcolor.js'; | ||
import { BalloonToolbar } from '@ckeditor/ckeditor5-ui'; | ||
|
||
ClassicEditor | ||
.create( document.querySelector( '#editor' ), { | ||
image: { toolbar: [ 'toggleImageCaption', 'imageTextAlternative' ] }, | ||
plugins: [ | ||
ArticlePluginSet, | ||
FontColor, | ||
FontBackgroundColor, | ||
BalloonToolbar | ||
], | ||
toolbar: [ | ||
'heading', | ||
'|', | ||
'fontColor', | ||
'fontBackgroundColor', | ||
'bold', | ||
'italic', | ||
'link', | ||
'bulletedList', | ||
'numberedList', | ||
'blockQuote', | ||
'undo', | ||
'redo' | ||
], | ||
fontColor: { | ||
columns: 3 | ||
}, | ||
balloonToolbar: [ 'bold', 'italic', 'fontColor' ] | ||
} ) | ||
.then( editor => { | ||
window.editor = editor; | ||
} ) | ||
.catch( err => { | ||
console.error( err.stack ); | ||
} ); | ||
|
||
function updateText( styleName ) { | ||
return evt => { | ||
const el = document.querySelector( '#color-box > p > span' ); | ||
if ( el ) { | ||
el.style[ styleName ] = evt.target.value; | ||
} | ||
}; | ||
} | ||
|
||
document.getElementById( 'color' ).addEventListener( 'change', updateText( 'color' ) ); | ||
document.getElementById( 'bgcolor' ).addEventListener( 'change', updateText( 'backgroundColor' ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## Font color and font background color throw error while having buttons in the main toolbar and the balloon toolbar [#8233](https://github.com/ckeditor/ckeditor5/pull/15658) | ||
|
||
1. Select text, should appear balloon with font color button. | ||
2. Click in the font color button and change color. | ||
3. There should be no errors in the console. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters