Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Commit ef4d421

Browse files
authoredDec 14, 2017
Merge pull request #118 from ckeditor/t/ckeditor5-ui/333
Feature: Implemented styles for the ButtonDropdown (see: ckeditor/ckeditor5-ui#333). Fixed spacing issues with toolbar items wrapped to the new line. Closes ckeditor/ckeditor5#682. Also: * Various improvements to visual styles of the dropdowns. * Migrated toolbar to CSS `flex`. * Allowed vertical toolbars.
2 parents 8462c0c + 08efe62 commit ef4d421

File tree

6 files changed

+47
-27
lines changed

6 files changed

+47
-27
lines changed
 

‎theme/ckeditor5-ui/components/button/button.css

+1-9
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ a.ck-button {
2020
cursor: default;
2121
vertical-align: middle;
2222
padding: var(--ck-spacing-small);
23+
text-align: center;
2324

2425
/* Enable font size inheritance, which allows fluid UI scaling. */
2526
font-size: inherit;
@@ -29,10 +30,6 @@ a.ck-button {
2930
@mixin ck-box-shadow var(--ck-focus-outer-shadow);
3031
}
3132

32-
@mixin ck-button-icon {
33-
float: left;
34-
}
35-
3633
/* https://github.com/ckeditor/ckeditor5-theme-lark/issues/70 */
3734
&.ck-disabled {
3835
@mixin ck-button-icon {
@@ -52,10 +49,6 @@ a.ck-button {
5249
margin-left: calc(-1 * var(--ck-spacing-small));
5350
margin-right: var(--ck-spacing-small);
5451
}
55-
56-
& .ck-button__label {
57-
display: block;
58-
}
5952
}
6053

6154
/* A style of the button which is currently on, e.g. its feature is active. */
@@ -74,7 +67,6 @@ a.ck-button {
7467
/* Enable font size inheritance, which allows fluid UI scaling. */
7568
font-size: inherit;
7669

77-
float: left;
7870
height: var(--ck-line-height-base)em;
7971
line-height: inherit;
8072
font-weight: inherit;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
3+
* For licensing, see LICENSE.md.
4+
*/
5+
6+
.ck-buttondropdown .ck-toolbar {
7+
border: 0;
8+
padding: 0;
9+
10+
& .ck-button {
11+
border-radius: 0;
12+
border: 0;
13+
margin: 0;
14+
}
15+
}

‎theme/ckeditor5-ui/components/dropdown/dropdown.css

+9-2
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,18 @@
1414
/* A triangle displayed to indicate this is actually a dropdown. */
1515
&::after {
1616
border-style: solid;
17-
border-width: .4em .4em 0 .4em;
17+
border-width: .4em .35em 0 .35em;
1818
border-color: var(--ck-color-dropdown-symbol) transparent;
1919
right: var(--ck-spacing-standard);
2020
}
2121

22+
&.ck-disabled::after {
23+
border-color: var(--ck-color-dropdown-symbol-disabled) transparent;
24+
}
25+
2226
& .ck-button.ck-dropdown__button {
2327
/* A space to accommodate the triangle. */
24-
padding-right: calc(2 * var(--ck-spacing-standard));
28+
padding-right: calc(2.5 * var(--ck-spacing-standard));
2529

2630
/* https://github.com/ckeditor/ckeditor5-theme-lark/issues/70 */
2731
&.ck-disabled .ck-button__label {
@@ -46,4 +50,7 @@
4650

4751
/* Compensate double border from button and from box when positioned below the button. */
4852
bottom: 1px;
53+
54+
/* Make sure the panel is at least as wide as the dropdown's button. */
55+
min-width: 100%;
4956
}

‎theme/ckeditor5-ui/components/editorui/editorui.css

+4-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
border-width: 0;
3131
}
3232

33-
& .ck-button {
33+
& > .ck-button,
34+
& .ck-buttondropdown .ck-dropdown__button {
3435
&:not(:hover):not(:focus):not(.ck-on),
3536
&.ck-disabled {
3637
background: var(--ck-color-editor-toolbar-background);
@@ -41,7 +42,8 @@
4142
}
4243
}
4344

44-
& .ck-button.ck-dropdown__button {
45+
/* Exclude main button dropdown button */
46+
& .ck-dropdown:not(.ck-buttondropdown) .ck-dropdown__button {
4547
border-width: 1px;
4648

4749
&:not(:hover):not(:focus):not(.ck-on) {

‎theme/ckeditor5-ui/components/toolbar/toolbar.css

+16-13
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,25 @@
88
.ck-toolbar {
99
@mixin ck-rounded-corners;
1010

11-
padding: var(--ck-spacing-small);
11+
padding: 0 var(--ck-spacing-small) var(--ck-spacing-small);
1212
border: 1px solid var(--ck-color-toolbar-border);
1313

14-
/* Allow wrapping toolbar items to the new line. */
15-
white-space: initial;
16-
17-
/* (#11) Separate toolbar items. */
1814
& > * {
15+
/* (#11) Separate toolbar items. */
1916
margin-right: var(--ck-spacing-small);
17+
18+
/* Make sure items wrapped to the next line have v-spacing */
19+
margin-top: var(--ck-spacing-small);
20+
}
21+
22+
&.ck-toolbar_vertical {
23+
& > * {
24+
/* Items in a vertical toolbar should have no horizontal margin */
25+
margin-right: 0;
26+
27+
/* Items in a vertical toolbar should span the horizontal space */
28+
width: 100%;
29+
}
2030
}
2131

2232
& > *:last-child {
@@ -28,13 +38,6 @@
2838
}
2939
}
3040

31-
.ck-toolbar_floating {
32-
/* Disallow wrapping toolbar items to the new line when the toolbar is floating,
33-
resulting in an toolbar shapes when the horizontal space is limited.
34-
https://github.com/ckeditor/ckeditor5-theme-lark/issues/93 */
35-
white-space: nowrap;
36-
}
37-
3841
.ck-toolbar__separator {
3942
width: 1px;
4043
height: calc(1em + 2 * var(--ck-spacing-medium));
@@ -43,5 +46,5 @@
4346
}
4447

4548
.ck-toolbar__newline {
46-
height: var(--ck-spacing-small);
49+
margin: 0;
4750
}

‎theme/ckeditor5-ui/globals/_colors.css

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858

5959
--ck-color-dropdown-panel-background: var(--ck-color-base-background);
6060
--ck-color-dropdown-panel-border: var(--ck-color-base-border);
61-
--ck-color-dropdown-symbol: hsl(0, 0%, 44%);
61+
--ck-color-dropdown-symbol: hsl(0, 0%, 30%);
62+
--ck-color-dropdown-symbol-disabled: hsl(0, 0%, 50%);
6263

6364
/* -- Input --------------------------------------------------------------------------------- */
6465

0 commit comments

Comments
 (0)
This repository has been archived.