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

Commit

Permalink
Merge pull request #238 from ckeditor/t/ckeditor5/1151
Browse files Browse the repository at this point in the history
Feature: Brought support for right–to–left (RTL) UI to various components' styles. See ckeditor/ckeditor5#1151.
  • Loading branch information
Reinmar authored Aug 12, 2019
2 parents cb92793 + 091c55e commit 70aa1a5
Show file tree
Hide file tree
Showing 15 changed files with 311 additions and 51 deletions.
19 changes: 19 additions & 0 deletions tests/manual/theme.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
<head>
<style>
.test-settings {
background: #eee;
border: 2px solid #ccc;
padding: 1em;
}

.test-settings h2 {
margin-top: .3em;
}

.wrappable {
white-space: initial;
line-height: 3em;
Expand All @@ -26,6 +36,15 @@
</style>
</head>

<section class="test-settings">
<h2>Test settings</h2>
<label for="direcion-selector">Language direction:</label>
<select id="direcion-selector">
<option value="ltr">Left–to–right (LTR)</option>
<option value="rtl">Right-to-left (RTL)</option>
</select>
</section>

<h2>Icon</h2>

<h3>Icon: In–text</h3>
Expand Down
11 changes: 11 additions & 0 deletions tests/manual/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -575,3 +575,14 @@ function input( {

return labeledInput;
}

function setManualTestDirection( direction ) {
document.querySelector( '.manual-test-container' ).classList.add( 'ck' );
document.querySelector( '.manual-test-container' ).setAttribute( 'dir', direction );
}

document.querySelector( '#direcion-selector' ).addEventListener( 'change', evt => {
setManualTestDirection( evt.target.value );
} );

setManualTestDirection( 'ltr' );
12 changes: 11 additions & 1 deletion theme/ckeditor5-font/fontcolor.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,22 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

@import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";

.ck .ck-button.ck-color-table__remove-color {
border-bottom: 1px solid var(--ck-color-base-border);
padding: calc(var(--ck-spacing-standard) / 2 ) var(--ck-spacing-standard);
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;

& .ck.ck-icon {
margin-right: var(--ck-spacing-standard);
@mixin ck-dir ltr {
margin-right: var(--ck-spacing-standard);
}

@mixin ck-dir rtl {
margin-left: var(--ck-spacing-standard);
}
}
}

30 changes: 25 additions & 5 deletions theme/ckeditor5-image/textalternativeform.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

@import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";
@import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";

.ck.ck-text-alternative-form {
padding: var(--ck-spacing-standard);
Expand All @@ -13,8 +14,16 @@
outline: none;
}

& > :not(:first-child) {
margin-left: var(--ck-spacing-standard);
@mixin ck-dir ltr {
& > :not(:first-child) {
margin-left: var(--ck-spacing-standard);
}
}

@mixin ck-dir rtl {
& > :not(:last-child) {
margin-left: var(--ck-spacing-standard);
}
}

@mixin ck-media-phone {
Expand All @@ -33,14 +42,25 @@
& .ck-button {
padding: var(--ck-spacing-standard);
margin-top: var(--ck-spacing-standard);
margin-left: 0;

border-radius: 0;
border: 0;
border-top: 1px solid var(--ck-color-base-border);

&:first-of-type {
border-right: 1px solid var(--ck-color-base-border);
@mixin ck-dir ltr {
margin-left: 0;

&:first-of-type {
border-right: 1px solid var(--ck-color-base-border);
}
}

@mixin ck-dir rtl {
margin-left: 0;

&:last-of-type {
border-right: 1px solid var(--ck-color-base-border);
}
}
}
}
Expand Down
30 changes: 25 additions & 5 deletions theme/ckeditor5-link/linkactions.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

@import "@ckeditor/ckeditor5-ui/theme/components/tooltip/mixins/_tooltip.css";
@import "@ckeditor/ckeditor5-ui/theme/mixins/_unselectable.css";
@import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";
@import "../mixins/_focus.css";
@import "../mixins/_shadow.css";
@import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";
Expand Down Expand Up @@ -56,8 +57,16 @@
outline: none;
}

& .ck-button:not(.ck-link-actions__preview) {
margin-left: var(--ck-spacing-standard);
@mixin ck-dir ltr {
& .ck-button:not(:first-child) {
margin-left: var(--ck-spacing-standard);
}
}

@mixin ck-dir rtl {
& .ck-button:not(:last-child) {
margin-left: var(--ck-spacing-standard);
}
}

@mixin ck-media-phone {
Expand All @@ -76,14 +85,25 @@
& .ck-button:not(.ck-link-actions__preview) {
padding: var(--ck-spacing-standard);
margin-top: var(--ck-spacing-standard);
margin-left: 0;

border-radius: 0;
border: 0;
border-top: 1px solid var(--ck-color-base-border);

&:first-of-type {
border-right: 1px solid var(--ck-color-base-border);
@mixin ck-dir ltr {
margin-left: 0;

&:first-of-type {
border-right: 1px solid var(--ck-color-base-border);
}
}

@mixin ck-dir rtl {
margin-left: 0;

&:last-of-type {
border-right: 1px solid var(--ck-color-base-border);
}
}
}
}
Expand Down
46 changes: 39 additions & 7 deletions theme/ckeditor5-link/linkform.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

@import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";
@import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";

.ck.ck-link-form {
padding: var(--ck-spacing-standard);
Expand All @@ -13,8 +14,16 @@
outline: none;
}

& > :not(:first-child) {
margin-left: var(--ck-spacing-standard);
@mixin ck-dir ltr {
& > :not(:first-child) {
margin-left: var(--ck-spacing-standard);
}
}

@mixin ck-dir rtl {
& > :not(:last-child) {
margin-left: var(--ck-spacing-standard);
}
}

@mixin ck-media-phone {
Expand All @@ -33,14 +42,25 @@
& .ck-button {
padding: var(--ck-spacing-standard);
margin-top: var(--ck-spacing-standard);
margin-left: 0;

border-radius: 0;
border: 0;
border-top: 1px solid var(--ck-color-base-border);

&:first-of-type {
border-right: 1px solid var(--ck-color-base-border);
@mixin ck-dir ltr {
margin-left: 0;

&:first-of-type {
border-right: 1px solid var(--ck-color-base-border);
}
}

@mixin ck-dir rtl {
margin-left: 0;

&:last-of-type {
border-right: 1px solid var(--ck-color-base-border);
}
}
}
}
Expand Down Expand Up @@ -71,8 +91,20 @@
border-top: 1px solid var(--ck-color-base-border);
width: 50%;

&:first-of-type {
border-right: 1px solid var(--ck-color-base-border);
@mixin ck-dir ltr {
margin-left: 0;

&:first-of-type {
border-right: 1px solid var(--ck-color-base-border);
}
}

@mixin ck-dir rtl {
margin-left: 0;

&:last-of-type {
border-right: 1px solid var(--ck-color-base-border);
}
}
}

Expand Down
30 changes: 25 additions & 5 deletions theme/ckeditor5-media-embed/mediaform.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

@import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";
@import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";

.ck.ck-media-form {
padding: var(--ck-spacing-standard);
Expand All @@ -12,8 +13,16 @@
outline: none;
}

& > :not(:first-child) {
margin-left: var(--ck-spacing-standard);
@mixin ck-dir ltr {
& > :not(:first-child) {
margin-left: var(--ck-spacing-standard);
}
}

@mixin ck-dir rtl {
& > :not(:last-child) {
margin-left: var(--ck-spacing-standard);
}
}

@mixin ck-media-phone {
Expand All @@ -37,14 +46,25 @@
& .ck-button {
padding: var(--ck-spacing-standard);
margin-top: var(--ck-spacing-standard);
margin-left: 0;

border-radius: 0;
border: 0;
border-top: 1px solid var(--ck-color-base-border);

&:first-of-type {
border-right: 1px solid var(--ck-color-base-border);
@mixin ck-dir ltr {
margin-left: 0;

&:first-of-type {
border-right: 1px solid var(--ck-color-base-border);
}
}

@mixin ck-dir rtl {
margin-left: 0;

&:last-of-type {
border-right: 1px solid var(--ck-color-base-border);
}
}
}
}
Expand Down
20 changes: 18 additions & 2 deletions theme/ckeditor5-ui/components/button/button.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
@import "../../../mixins/_disabled.css";
@import "../../../mixins/_rounded.css";
@import "../../mixins/_button.css";
@import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";

.ck.ck-button,
a.ck.ck-button {
Expand Down Expand Up @@ -71,8 +72,15 @@ a.ck.ck-button {
padding: var(--ck-spacing-tiny) var(--ck-spacing-standard);

& .ck-button__icon {
margin-left: calc(-1 * var(--ck-spacing-small));
margin-right: var(--ck-spacing-small);
@mixin ck-dir ltr {
margin-left: calc(-1 * var(--ck-spacing-small));
margin-right: var(--ck-spacing-small);
}

@mixin ck-dir rtl {
margin-right: calc(-1 * var(--ck-spacing-small));
margin-left: var(--ck-spacing-small);
}
}
}

Expand Down Expand Up @@ -107,6 +115,14 @@ a.ck.ck-button {
/* Must be consistent with .ck-icon's vertical align. Otherwise, buttons with and
without labels (but with icons) have different sizes in Chrome */
vertical-align: middle;

@mixin ck-dir ltr {
text-align: left;
}

@mixin ck-dir rtl {
text-align: right;
}
}
}

Expand Down
Loading

0 comments on commit 70aa1a5

Please sign in to comment.