Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add preserving custom colors feature #3784

Merged
merged 162 commits into from
Jul 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
dbe9c69
Add features described in issue.
Dumluregn Dec 30, 2019
5f39387
Add manual test for finding content colors.
Dumluregn Jan 9, 2020
ad0b6f2
Add manual test for preserving custom colors.
Dumluregn Jan 9, 2020
0cf9afa
Swap sections.
Dumluregn Jan 9, 2020
d8c124a
Remove excessive color tile before reassigning aria attributes.
Dumluregn Jan 9, 2020
de79c97
Refactor removing excessive color tile.
Dumluregn Jan 9, 2020
13129ed
Add consistency in style for adding table elements.
Dumluregn Jan 10, 2020
2bf722c
Small refactor 'onOpen' for panels.
Dumluregn Jan 10, 2020
fd5dfff
Use color label if it's available.
Dumluregn Jan 10, 2020
65cafa9
Update manual tests according to change in color labels.
Dumluregn Jan 13, 2020
2c4658d
Add unit tests for content colors.
Dumluregn Jan 14, 2020
dcfda14
Add first unit tests for preserving custom colors.
Dumluregn Jan 14, 2020
71305d4
Add async tests for custom colors.
Dumluregn Jan 15, 2020
830d8b5
Refactor unit tests.
Dumluregn Jan 15, 2020
2eb0707
More tests refactoring.
Dumluregn Jan 15, 2020
2b3f2b1
Add proper tags to unit tests.
Dumluregn Jan 15, 2020
7e83919
Make some small changes in manual tests.
Dumluregn Jan 15, 2020
c7085b2
Add comment.
Dumluregn Jan 15, 2020
1ce62b8
Fix typo.
Dumluregn Jan 15, 2020
de16fa6
Make colors chosen from default palette appear in custom colors too.
Dumluregn Jan 22, 2020
a77212c
Merge custom and content colors into one row.
Dumluregn Jan 22, 2020
71d87d8
Run content search only onBlock instead of onOpen.
Dumluregn Jan 22, 2020
8a2ce90
Unify naming from custom and content colors to just colorHistory.
Dumluregn Jan 22, 2020
b07ae99
Fix cssAttribute.
Dumluregn Jan 22, 2020
f8ed326
Rename cssAttribute->cssProperty.
Dumluregn Jan 22, 2020
2369ef4
Replace custom panel id logic with dedicated one.
Dumluregn Jan 22, 2020
0998b39
Replace row label with horizontal rule and extract html to generators.
Dumluregn Jan 22, 2020
1a2ac6d
Remove unnecessary variable.
Dumluregn Jan 22, 2020
fee0e7e
Don't hide separator - it's no longer necessary.
Dumluregn Jan 22, 2020
c36791d
Skip removing tiles - there will never be one right now.
Dumluregn Jan 22, 2020
3d10b73
Add color names handling for content colors.
Dumluregn Jan 22, 2020
dec1f0b
Extract aria setting to a helper.
Dumluregn Jan 23, 2020
f26a559
Squash two forEach loops.
Dumluregn Jan 23, 2020
b5b18b9
Extract sorting custom colors to a helper.
Dumluregn Jan 23, 2020
3e0bbce
Extract adding labels to a helper.
Dumluregn Jan 23, 2020
40d82b1
Replace array of arrays with array of objects for explanatory power.
Dumluregn Jan 23, 2020
35aeb52
Extract two more functions.
Dumluregn Jan 23, 2020
ca8ab9f
Extract trimArray() function.
Dumluregn Jan 24, 2020
f2f6239
Refactor.
Dumluregn Jan 24, 2020
9a4899d
Add config option for rows number in content colors.
Dumluregn Jan 29, 2020
b46058c
Add config option to set limit for color history rows.
Dumluregn Jan 30, 2020
55da36b
Rename config option to 'HistoryRowLimit'.
Dumluregn Jan 30, 2020
5b33a9a
Remove options destructuring.
Dumluregn Jan 30, 2020
6be3e97
Rename createColorHistoryRow() function.
Dumluregn Jan 30, 2020
92a70fc
Make a batch of small fixes.
Dumluregn Jan 30, 2020
d63500e
Change naming from
Dumluregn Jan 30, 2020
d96f37e
Wrap unit test helpers into a module.
Dumluregn Jan 31, 2020
b8c5479
Refactor.
Dumluregn Jan 31, 2020
46877d1
Rename addCustomColorToPanel() -> addColorToHistory().
Dumluregn Jan 31, 2020
8b98946
Refactor.
Dumluregn Jan 31, 2020
b253639
Remove unnecessary parameter.
Dumluregn Jan 31, 2020
1f18cfa
Add docs reference about 'config.colorButton_historyRowLimit'.
Dumluregn Jan 31, 2020
7566f18
Handle case with no history rows.
Dumluregn Jan 31, 2020
bf28a71
Expose getStyledSpans() as public API.
Dumluregn Jan 31, 2020
ed4c3b7
Fix that stupid mistake.
Dumluregn Feb 3, 2020
68bdc0a
Fix another stupid bug.
Dumluregn Feb 3, 2020
53445d3
Update manual tests to new spec and split them into a few smaller ones.
Dumluregn Feb 4, 2020
5744a20
Fix bug with aria-posinset for custom colors.
Dumluregn Feb 4, 2020
a786db3
Update unit tests.
Dumluregn Feb 4, 2020
0b23831
Extract code for creating color boxes.
Dumluregn Feb 4, 2020
d720625
Extract colorHistoryRow class.
Dumluregn Feb 10, 2020
d4eaeb0
Remove config for row limit from manuals where it's not necessary to …
Dumluregn Feb 10, 2020
1e8664b
Refactor into more object-oriented style.
Dumluregn Mar 3, 2020
b1413dd
Solve problem with automatic color button.
Dumluregn Mar 12, 2020
5784dfe
Reorder functions.
Dumluregn Mar 12, 2020
0e673c2
Replace function with class method.
Dumluregn Mar 12, 2020
dad7e7b
Add container customization.
Dumluregn Mar 12, 2020
07aaaff
Replace function calls with method.
Dumluregn Mar 12, 2020
80f2328
Fix indentation.
Dumluregn Mar 12, 2020
671cc27
Remove unnecessary config from manual tests.
Dumluregn Mar 12, 2020
783433d
Remove word 'Class' from class names.
Dumluregn Mar 12, 2020
696975a
Change property reference to class method call.
Dumluregn Mar 12, 2020
d5123f7
Add row length tracking.
Dumluregn Mar 12, 2020
bf179b0
Add aria attributes control.
Dumluregn Mar 12, 2020
b0d580f
Remove excessive abstraction.
Dumluregn Mar 12, 2020
e964baa
Fix issue with unexpected color order.
Dumluregn Mar 12, 2020
93c5235
Add docs for renderContentColors config option.
Dumluregn Mar 12, 2020
58d9bec
Adjust naming and refactor some small stuff.
Dumluregn Mar 12, 2020
6d494f1
Revamp manual tests.
Dumluregn Mar 13, 2020
ec19f85
Fix automatic color not changing color to automatic after previous ch…
Dumluregn Mar 13, 2020
8ad60b6
Refresh unit tests.
Dumluregn Mar 13, 2020
eb2d25f
Fix docs for 'CKEDITOR.tools.getStyledSpans()'.
Dumluregn Mar 13, 2020
0b06845
Add code lost during rebase.
Dumluregn Mar 19, 2020
e0561ce
Remove empty lines between manual tests steps.
Dumluregn Mar 25, 2020
a88baf5
Add more specific instructions.
Dumluregn Mar 25, 2020
748e7f4
Change 'extractColorBox()' method flow to always return something.
Dumluregn Mar 26, 2020
04939e5
Replace static method of 'ColorBox' class using constructor.
Dumluregn Mar 26, 2020
f51cd55
Change names for 'setAriaAttributes()' and 'gatherColorInfo()' methods.
Dumluregn Mar 26, 2020
774999e
Replace '==' with '==='.
Dumluregn Mar 26, 2020
d698797
Reuse private method 'moveToBeginning()'.
Dumluregn Mar 26, 2020
dd0b07c
Merge two conditionals into one.
Dumluregn Mar 26, 2020
caff987
Move 'colorHistory.addColor()' calls into 'setColor()' function.
Dumluregn Mar 26, 2020
b090b28
Change template functions to push output to target source and replace…
Dumluregn Mar 26, 2020
8f75992
Change 'extractColorBox()' method to something smarter.
Dumluregn Mar 26, 2020
c5a9849
Create 'clickFn' variable in outer scope and pass it to 'renderColors…
Dumluregn Mar 27, 2020
eec5067
Move 'clickFn' implementation to outer scope.
Dumluregn Mar 27, 2020
2fbeb3d
Fix issue with aria-selected attribute.
Dumluregn Mar 27, 2020
f76a29e
Change 'renderContainer()' method to push to target output.
Dumluregn Mar 27, 2020
dd07fdf
Replace '+' signs with ','.
Dumluregn Mar 27, 2020
a9197b9
Hide <tbody></tbody> selectors inside method.
Dumluregn Mar 27, 2020
7caa6c0
Add safety check for automatic color button.
Dumluregn Mar 27, 2020
f097e9b
Avoid counting in empty spans.
Dumluregn Mar 27, 2020
5a0d34b
Remove extra descriptions from manual test.
Dumluregn Mar 27, 2020
d03040c
Add missing word to unit test description.
Dumluregn Mar 27, 2020
2395deb
Add 'null' to return statement.
Dumluregn Mar 27, 2020
f82970e
Change docs wording.
Dumluregn Mar 30, 2020
e105cfe
Add 'null' to 'return' statement.
Dumluregn Mar 30, 2020
b04fd31
Remove numbering from manual tests.
Dumluregn Mar 30, 2020
fe97e7c
Change naming ('updateAriaAttributes()' -> 'refreshPositions()').
Dumluregn Mar 30, 2020
3b99a3e
Change naming ('colorHistoryRow.maxLength' -> 'colorHistoryRow.colors…
Dumluregn Mar 30, 2020
affc0fa
Extract 'createClickFunction()'.
Dumluregn Apr 1, 2020
84b0e01
Extract 'createColorStyleTemplate()'.
Dumluregn Apr 1, 2020
5f90733
Don't initialize color history or any of it's components if it's disa…
Dumluregn Apr 1, 2020
4088bb8
Add an empty row at history initialization (and update unit test).
Dumluregn Apr 1, 2020
756daf2
Move class definitions to the beginning of the file.
Dumluregn Apr 1, 2020
cbc4c23
Move 'colorStyleTemplate()' function call to appropriate place.
Dumluregn Apr 1, 2020
182a822
Check colors at editor initialization rather than on panel creation.
Dumluregn Apr 1, 2020
0022a56
Update unit tests.
Dumluregn Apr 1, 2020
2b45f56
Add docs about second parameter of 'getStyledSpans()' function.
Dumluregn Apr 2, 2020
54acd04
Don't exclude empty spans from 'getStyledSpans()' function.
Dumluregn Apr 2, 2020
e9a0d1b
Fix editor numbers in unit tests and add unit test for 'config.colorB…
Dumluregn Apr 2, 2020
76c6dcf
Add possibility to find collections in panel.
Dumluregn Apr 2, 2020
ca8fdaf
Fix malfunctioning unit test.
Dumluregn Apr 2, 2020
0fbbcde
Add unit test for 'getStyledSpans()' function.
Dumluregn Apr 2, 2020
43002bc
Change behaviour of box selection functions.
Dumluregn Apr 2, 2020
06cacfe
Update manual test after change in history rendering.
Dumluregn Apr 2, 2020
617a5cb
Fix code after rebase.
Dumluregn Jun 22, 2020
840e18e
Add comment about unobvious behaviour.
Dumluregn Jun 22, 2020
547154c
Force type coercion.
Dumluregn Jun 22, 2020
32910fc
Add manual test for auto reselection color box.
Dumluregn Jun 22, 2020
4eeb3ea
Pass arguments as primitives.
Dumluregn Jun 23, 2020
9dd211e
Remove 'setClickFn()' method and use var when creating history.
Dumluregn Jun 23, 2020
6a13f7a
Simplify check.
Dumluregn Jun 23, 2020
0668433
Encapsulate rendering content colors.
Dumluregn Jun 23, 2020
f344a90
Unify aria attributes for main colorpanel and colorhistory - WiP.
Dumluregn Jul 1, 2020
269f995
Add the rest of unit tests.
Dumluregn Jul 1, 2020
267fec4
Fix tests.
Dumluregn Jul 1, 2020
def0569
Fix setting aria attributes for basic color panel with history colors.
Dumluregn Jul 1, 2020
6a935c9
Add custom title for color history elements.
Dumluregn Jul 2, 2020
091b629
Add manual test for a11y.
Dumluregn Jul 2, 2020
bb5c9d7
Refactor unit test.
Dumluregn Jul 2, 2020
1fb4d44
Update tooltip descriptions in tests.
Dumluregn Jul 2, 2020
073bb5e
Explicitly set config values.
Dumluregn Jul 2, 2020
0b67736
Move ColorBox definition to the end of scope.
Dumluregn Jul 2, 2020
4221468
Change ColorBox class signature.
Dumluregn Jul 2, 2020
041cb88
Move ColorHistoryRow class definition to the end of scope.
Dumluregn Jul 2, 2020
f15c26a
Move ColorHistory class definition to the end of scope.
Dumluregn Jul 2, 2020
5615a40
Refactor renumbering panel elements.
Dumluregn Jul 2, 2020
2cefdd0
Add 'removePlugins' config to fix CI testing.
Dumluregn Jul 3, 2020
f25e5d0
Fix colorpanel with 0 rows.
Dumluregn Jul 3, 2020
ac9092b
Revert change with adding 'color history' annotation to color boxes.
Dumluregn Jul 3, 2020
4bedb79
Hide horizontal rule if there are no history colors.
Dumluregn Jul 3, 2020
2a70380
Adjust naming to the one in docs.
Dumluregn Jul 3, 2020
38faeaf
Explicitly define language in a11y test.
Dumluregn Jul 3, 2020
5604bb4
Change the manual a11y test to only use keyboard.
Dumluregn Jul 3, 2020
7d510a5
Improve ColorBox class signature.
Dumluregn Jul 3, 2020
4c7650e
Improve ColorHistory class signature.
Dumluregn Jul 3, 2020
ed4101d
Update tests/plugins/colorbutton/manual/colorhistory/tooltips.md
Dumluregn Jul 3, 2020
619e49e
Fix finding spans on IE8.
Dumluregn Jul 6, 2020
a911d18
Fix the rest of tests.
Dumluregn Jul 6, 2020
c35f39a
Small manual test correction.
jacekbogdanski Jul 6, 2020
0acc879
Added changelog entry.
jacekbogdanski Jul 9, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ New features:

* [#3940](https://github.com/ckeditor/ckeditor4/issues/3940): Introduced `colorName` property for customizing foreground and background styles in [color button](https://ckeditor.com/cke4/addon/colorbutton) plugin via [colorButton_foreStyle](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-colorButton_foreStyle) and [colorButton_backStyle](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-colorButton_backStyle) configuration options.
* [#3793](https://github.com/ckeditor/ckeditor4/issues/3793): Introduced [Editor Placeholder](https://ckeditor.com/cke4/addon/editorplaceholder) plugin.
* [#1795](https://github.com/ckeditor/ckeditor4/issues/1795): Colors picked from [Color Dialog](https://ckeditor.com/cke4/addon/colordialog) are now stored in [Color Button](https://ckeditor.com/cke4/addon/colorbutton) palette and can be easily reused.
* [#3783](https://github.com/ckeditor/ckeditor4/issues/3783): Colors used in the document are now displayed as a part of the [Color Button](https://ckeditor.com/cke4/addon/colorbutton) palette.

## CKEditor 4.14.1

Expand Down
18 changes: 18 additions & 0 deletions core/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -1182,6 +1182,24 @@
return obj;
},

/**
* Finds all span {@link CKEDITOR.dom.element elements} styled with the given property in the editor contents.
*
* @since 4.15.0
* @param {String} property CSS property which will be used in query.
* @param {CKEDITOR.dom.element} source The element to be searched.
* @returns {Array} Returns an array of {@link CKEDITOR.dom.element}s.
*/
getStyledSpans: function( property, source ) {
var testProperty = CKEDITOR.env.ie && CKEDITOR.env.version == 8 ? property.toUpperCase() : property,
spans = source.find( 'span[style*=' + testProperty + ']' ).toArray();

// This is to filter out spans e.g. with background color when we want text color.
return CKEDITOR.tools.array.filter( spans, function( span ) {
return !!( span.getStyle( property ) );
} );
},

/**
* Tries to fix the `document.domain` of the current document to match the
* parent window domain, avoiding "Same Origin" policy issues.
Expand Down
Loading