Skip to content

Commit 7686b0e

Browse files
authored
Merge pull request #209 from WordPress/update/single-prototype
Normalize some of the single instance interface
2 parents c08115c + 4ea9de7 commit 7686b0e

2 files changed

Lines changed: 79 additions & 19 deletions

File tree

shared/index.css

Lines changed: 71 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,33 @@
1+
/**
2+
* Basic
3+
*/
4+
5+
html,
16
body {
2-
background: #f3f6f8;
3-
color: #2f4452;
4-
font-family: "Noto Serif", Georgia, "Times New Roman", Times, serif;
5-
font-size: 1.25em;
6-
line-height: 1.5;
7-
margin: 1em;
7+
margin: 0;
8+
padding: 0;
9+
height: 100%;
10+
}
11+
12+
* {
13+
box-sizing: border-box;
814
}
915

16+
body {
17+
font: 13px/1.8 -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif;
18+
max-width: 820px;
19+
margin: 60px auto;
20+
color: #12181e;
21+
}
22+
23+
/**
24+
* Editor Basics
25+
*/
26+
1027
#editor {
11-
background: #fff;
12-
margin: 5em auto;
28+
font-family: "Noto Serif", serif;
1329
outline: none;
14-
padding: 5em;
15-
width: 37.5em;
30+
padding: 50px;
1631
}
1732

1833
#editor .text-align-left {
@@ -41,6 +56,50 @@ body {
4156
height: auto;
4257
}
4358

59+
#editor svg {
60+
fill: currentColor;
61+
}
62+
63+
64+
/**
65+
* Editor Basic Blocks
66+
*/
67+
68+
#editor p,
69+
#editor blockquote,
70+
#editor h1,
71+
#editor h2,
72+
#editor h3,
73+
#editor h4,
74+
#editor h5,
75+
#editor h6,
76+
#editor img {
77+
margin: 1em 0;
78+
box-shadow: inset 0px 0px 0px 0px #e0e5e9;
79+
transition: all .2s ease;
80+
}
81+
82+
#editor h2 {
83+
font-weight: 900;
84+
font-size: 28px;
85+
}
86+
87+
#editor p {
88+
font-size: 16px;
89+
min-height: 3.4em;
90+
}
91+
92+
#editor blockquote {
93+
font-size: 20px;
94+
border-left: 4px solid black;
95+
padding-left: 1em;
96+
font-style: italic;
97+
}
98+
99+
#editor section:focus {
100+
outline: none;
101+
}
102+
44103
#editor figure {
45104
clear: both;
46105
float: none;
@@ -88,13 +147,13 @@ body {
88147
}
89148

90149
#editor figcaption {
91-
font-size: 0.8em;
92150
margin-top: 0.5em;
93151
}
94152

95153
#editor figure img,
96154
#editor figure iframe {
97155
display: block;
156+
margin: 0;
98157
}
99158

100159
#editor pre {
@@ -108,7 +167,7 @@ body {
108167
}
109168

110169
#editor hr:before {
111-
content: '\2767';
170+
content: '· · ·';
112171
display: block;
113172
text-align: center;
114173
}

tinymce-single/tinymce/block.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
tinymce.PluginManager.add( 'block', function( editor ) {
33
var getSelectedBlock = wp.blocks.getSelectedBlock;
44
var getSelectedBlocks = wp.blocks.getSelectedBlocks;
5+
var editorPadding = 50;
56

67
// Global controls
78

@@ -234,12 +235,12 @@
234235
if ( settings.isEmpty ) {
235236
DOM.setStyles( toolbar, {
236237
position: 'absolute',
237-
left: contentRect.left + 50 + 'px',
238+
left: contentRect.left + 'px',
238239
top: blockRect.top + 3 + window.pageYOffset + 'px'
239240
} );
240241
} else {
241242
if ( isFullBleed ) {
242-
var left = contentRect.left + 50;
243+
var left = contentRect.left;
243244
} else {
244245
var left = blockRect.left - 6;
245246
}
@@ -288,7 +289,7 @@
288289

289290
DOM.setStyles( toolbar, {
290291
position: 'absolute',
291-
left: contentRect.left + 100 + 'px',
292+
left: contentRect.left + editorPadding + 'px',
292293
top: elementRect.top + window.pageYOffset + 'px'
293294
} );
294295

@@ -309,7 +310,7 @@
309310

310311
DOM.setStyles( toolbar, {
311312
position: 'absolute',
312-
left: Math.max( contentRect.left + 100, elementRect.left ) + 8 + blockToolbarWidth + 'px',
313+
left: Math.max( contentRect.left + editorPadding, elementRect.left ) + 8 + blockToolbarWidth + 'px',
313314
top: elementRect.top + window.pageYOffset - toolbarRect.height - 8 + 'px'
314315
} );
315316

@@ -334,9 +335,9 @@
334335
var contentRect = editor.getBody().getBoundingClientRect();
335336

336337
if ( isRightAligned ) {
337-
var left = contentRect.right - toolbarRect.width - 50;
338+
var left = contentRect.right - toolbarRect.width;
338339
} else {
339-
var left = contentRect.left + 50
340+
var left = contentRect.left;
340341
}
341342

342343
if ( isFullBleed ) {
@@ -372,7 +373,7 @@
372373

373374
DOM.setStyles( toolbar, {
374375
position: 'absolute',
375-
left: Math.max( contentRect.left + 100, elementRect.left ) + 'px',
376+
left: Math.max( contentRect.left + editorPadding, elementRect.left ) + 'px',
376377
top: elementRect.top + window.pageYOffset - toolbarRect.height - 8 + 'px'
377378
} );
378379

0 commit comments

Comments
 (0)