Skip to content

Commit a060799

Browse files
committed
RTL: Use a postcss plugin to generate RTL styling
1 parent 8d3862f commit a060799

File tree

7 files changed

+104
-78
lines changed

7 files changed

+104
-78
lines changed

components/panel/style.scss

+2-9
Original file line numberDiff line numberDiff line change
@@ -73,29 +73,22 @@
7373
font-weight: 600;
7474
text-align: left;
7575

76-
body.rtl & {
77-
text-align: right;
78-
}
79-
8076
.dashicon {
8177
position: absolute;
8278
right: $item-spacing;
8379
top: 50%;
8480
transform: translateY( -50% );
85-
86-
body.rtl & {
87-
right: auto;
88-
left: $item-spacing;
89-
}
9081
}
9182

9283
// mirror the arrow horizontally in RTL languages
84+
/* rtl:begin:ignore */
9385
body.rtl & .dashicons-arrow-right {
9486
transform: scaleX(-1);
9587
-ms-filter: fliph;
9688
filter: FlipH;
9789
margin-top: -10px;
9890
}
91+
/* rtl:end:ignore */
9992
}
10093

10194
.components-panel__body-toggle-icon {

editor/assets/stylesheets/main.scss

-6
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ body.gutenberg-editor-page {
3030
ul#adminmenu>li.current>a.current:after {
3131
border-right-color: $white;
3232
}
33-
34-
&.rtl ul#adminmenu a.wp-has-current-submenu:after,
35-
&.rtl ul#adminmenu>li.current>a.current:after {
36-
border-right-color: transparent;
37-
border-left-color: $white;
38-
}
3933
}
4034

4135
.gutenberg {

editor/edit-post/header/style.scss

-36
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@
2020

2121
@include break-large() {
2222
left: $admin-sidebar-width;
23-
24-
body.rtl & {
25-
left: 0;
26-
right: $admin-sidebar-width;
27-
}
2823
}
2924
}
3025

@@ -34,60 +29,29 @@
3429
}
3530
}
3631

37-
body.rtl.sticky-menu .editor-header {
38-
@include break-medium() {
39-
left: 0;
40-
right: $admin-sidebar-width;
41-
}
42-
}
43-
4432
.auto-fold .editor-header { /* Auto fold is when on smaller breakpoints, nav menu auto colllapses */
4533
@include break-medium() {
4634
left: $admin-sidebar-width-collapsed;
47-
48-
body.rtl & {
49-
left: 0;
50-
right: $admin-sidebar-width-collapsed;
51-
}
5235
}
5336

5437
@include break-large() {
5538
left: $admin-sidebar-width;
56-
57-
body.rtl & {
58-
left: 0;
59-
right: $admin-sidebar-width;
60-
}
6139
}
6240
}
6341

6442
/* Sidebar manually collapsed */
6543
.folded .editor-header {
6644
left: 0;
6745

68-
body.rtl & {
69-
right: 0;
70-
}
71-
7246
@include break-medium() {
7347
left: $admin-sidebar-width-collapsed;
74-
75-
body.rtl & {
76-
left: 0;
77-
right: $admin-sidebar-width-collapsed;
78-
}
7948
}
8049
}
8150

8251
/* Mobile menu opened */
8352
.auto-fold .wp-responsive-open .editor-header {
8453
left: $admin-sidebar-width-big;
8554
right: -$admin-sidebar-width-big;
86-
87-
body.rtl & {
88-
left: -$admin-sidebar-width-big;
89-
right: $admin-sidebar-width-big;
90-
}
9155
}
9256

9357
.editor-header__settings {

editor/edit-post/sidebar/style.scss

-27
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@
1111
height: 100vh;
1212
overflow: hidden;
1313

14-
body.rtl & {
15-
right: auto;
16-
left: 0;
17-
border-left: none;
18-
border-right: 1px solid $light-gray-500;
19-
}
20-
2114
@include break-small() {
2215
top: $admin-bar-height-big + $header-height;
2316
z-index: auto;
@@ -93,11 +86,6 @@
9386
.editor-layout.is-sidebar-opened .editor-layout__content {
9487
@include break-medium() {
9588
margin-right: $sidebar-width;
96-
97-
body.rtl & {
98-
margin-right: 0;
99-
margin-left: $sidebar-width;
100-
}
10189
}
10290
}
10391

@@ -114,11 +102,6 @@
114102
/* Text Editor specific */
115103
.editor-layout.is-sidebar-opened .editor-text-editor__formatting {
116104
margin-right: $sidebar-width;
117-
118-
body.rtl & {
119-
margin-right: 0;
120-
margin-left: $sidebar-width;
121-
}
122105
}
123106

124107
.components-panel__header.editor-sidebar__panel-tabs {
@@ -127,18 +110,8 @@
127110
padding-left: 0;
128111
padding-right: $panel-padding / 2;
129112

130-
body.rtl & {
131-
padding-right: 0;
132-
padding-left: $panel-padding / 2;
133-
}
134-
135113
.components-icon-button {
136114
margin-left: auto;
137-
138-
body.rtl & {
139-
margin-left: 0;
140-
margin-right: auto;
141-
}
142115
}
143116
}
144117

package-lock.json

+100
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
"pegjs-loader": "0.5.4",
8484
"phpegjs": "1.0.0-beta7",
8585
"postcss-loader": "2.0.6",
86+
"postcss-rtl": "1.1.3",
8687
"prismjs": "1.6.0",
8788
"raw-loader": "0.5.1",
8889
"react-markdown": "2.5.0",

webpack.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const extractConfig = {
2828
options: {
2929
plugins: [
3030
require( 'autoprefixer' ),
31+
require( 'postcss-rtl' )(),
3132
],
3233
},
3334
},

0 commit comments

Comments
 (0)