Editor: webkit columns bug workaround; better alignment; rem units

This commit is contained in:
tophf 2015-03-24 05:55:16 +03:00
parent c8ce70f964
commit 9c99495d65
2 changed files with 108 additions and 98 deletions

204
edit.html
View File

@ -35,57 +35,93 @@
body { body {
margin: 0; margin: 0;
font: 12px arial,sans-serif; font: 9pt arial,sans-serif;
} }
/************ header ************/
#header { #header {
height: 100%; height: 100%;
width: 250px; width: 15rem;
position: fixed; position: fixed;
top: 0; top: 0;
padding: 15px; padding: 0.95rem;
border-right: 1px dashed #AAA; border-right: 1px dashed #AAA;
-webkit-box-shadow: 0 0 50px -18px black; -webkit-box-shadow: 0 0 3rem -1.2rem black;
} }
#header h1 { #header h1 {
margin-top: 0; margin-top: 0;
} }
#sections { #sections {
padding-left: 290px; padding-left: 18rem;
} }
#sections h2 { #sections h2 {
margin-top: 8px; margin-top: 0.5rem;
} }
.aligned {
display: table-row;
}
.aligned > * {
display: table-cell;
margin-top: 0.1rem;
min-height: 1.4rem;
}
input[type="checkbox"] {
margin-left: 0.1rem;
}
/* basic info */
#basic-info { #basic-info {
margin-bottom: 12px; margin-bottom: 1rem;
} }
#name { #name {
width: 185px; width: 100%;
} }
#enabled {
margin-left: 0;
vertical-align: middle;
}
#enabled-label {
vertical-align: middle;
}
/* actions */
#actions > * {
margin-right: 0.5rem;
margin-bottom: 0.5rem;
display: block;
}
#actions img {
margin-left: 0.2rem;
position: relative;
top: 0.2rem;
}
/* options */
#options [type="number"] {
max-width: 2.5rem;
text-align: right;
}
#options .option > * {
padding-right: 0.25rem;
}
/************ content ***********/
#sections > div { #sections > div {
margin: 10px; margin: 0.7rem;
padding: 0 15px; padding: 1rem;
} }
#sections > div:not(:first-of-type) { #sections > div:not(:first-of-type) {
border-top: 2px solid black; border-top: 2px solid black;
} }
#sections > div:only-of-type .remove-section {
display: none;
}
#sections > div .add-section {
margin-left: 0.4rem;
}
.dirty > label::before { .dirty > label::before {
content: "*"; content: "*";
font-weight: bold; font-weight: bold;
} }
#basic-info label { /* code */
display: inline-block;
width: 10em;
vertical-align: top;
}
#header label {
width: 60px;
}
#options .aligned {
display: table-row;
}
.code { .code {
height: 10em; height: 10rem;
width: 40em; width: 40rem;
} }
.CodeMirror { .CodeMirror {
border: solid #CCC 1px; border: solid #CCC 1px;
@ -93,12 +129,16 @@
.CodeMirror-focused { .CodeMirror-focused {
border-color: black; border-color: black;
} }
.CodeMirror-lint-mark-warning {
background: none;
}
/* applies-to */
.applies-to { .applies-to {
display: flex; display: flex;
} }
.applies-to label { .applies-to label {
flex: auto; flex: auto;
margin-top: 0.25em; margin-top: 0.2rem;
} }
.applies-to ul { .applies-to ul {
flex: auto; flex: auto;
@ -110,12 +150,12 @@
display: flex; display: flex;
list-style-type: none; list-style-type: none;
align-items: center; align-items: center;
margin-bottom: 0.4em; margin-bottom: 0.35rem;
} }
.applies-to li > *:not(button) { .applies-to li > *:not(button) {
flex: auto; flex: auto;
min-height: 1.7em; min-height: 1.4rem;
margin-left: 0.4em; margin-left: 0.35rem;
} }
.applies-to li .add-applies-to { .applies-to li .add-applies-to {
visibility: hidden; visibility: hidden;
@ -125,53 +165,27 @@
visibility: visible visibility: visible
} }
.applies-to li .add-applies-to:first-child { .applies-to li .add-applies-to:first-child {
margin-left: 1em; margin-left: 1rem;
} }
.applies-to li .applies-value { .applies-to li .applies-value {
flex-grow: 99; flex-grow: 99;
padding-left: 0.5ex; padding-left: 0.2rem;
}
body > section > *:not(h2) {
padding-left: 15px;
}
#sections > div {
padding-top: 1em;
padding-bottom: 1em;
}
#sections > div:only-of-type .remove-section {
display: none;
}
#sections > div .add-section {
margin-left: 0.4em;
} }
.applies-to img { .applies-to img {
vertical-align: bottom; vertical-align: bottom;
} }
.CodeMirror-lint-mark-warning {
background: none;
}
@media(min-width: 738px) {
#options .aligned > * {
display: table-cell;
margin: 0.5ex 0 0 0;
}
}
/************ reponsive layouts ************/
@media(max-width:737px) { @media(max-width:737px) {
#header { #header {
width: auto;
height: auto; height: auto;
position: inherit; position: inherit;
width: auto;
border-right: none; border-right: none;
border-bottom: 1px dashed #AAA;
} }
#header section { #header section:not(:last-child) {
margin-bottom: 0.5em; margin-bottom: 0.4rem;
}
#header label {
width: auto;
vertical-align: baseline;
margin-right: .5em;
} }
#header input[type="checkbox"] { #header input[type="checkbox"] {
vertical-align: middle; vertical-align: middle;
@ -181,9 +195,7 @@
} }
#basic-info { #basic-info {
display: flex; display: flex;
} align-items: baseline;
#basic-info > div:not(:last-child) {
margin-right: 1em;
} }
#basic-info > * { #basic-info > * {
flex: auto; flex: auto;
@ -192,60 +204,53 @@
flex-grow: 99; flex-grow: 99;
display: flex; display: flex;
} }
#basic-info > *:not(:last-child) {
margin-right: 0.8rem;
}
#basic-info #name { #basic-info #name {
width: auto; width: auto;
flex-grow: 99; flex-grow: 99;
} }
#basic-info #name-label {
line-height: 20px;
}
#actions { #actions {
padding: 1em 0; margin-top: 1rem;
} }
#actions br { #actions > * {
display: none; display: inline-block;
}
#actions img {
position: relative;
top: .2em;
margin-left: .2em;
}
#actions > * + button, #actions a {
margin-left: 1em;
} }
#options { #options {
-webkit-column-count: 2; -webkit-column-count: 2;
} }
#options .aligned > * {
margin: 1px 0 0 0; /* workaround the flowing-padding column bug in webkit */
padding-right: 0.4rem;
vertical-align: baseline;
min-height: 1.4rem;
}
.option { .option {
-webkit-column-break-inside: avoid; -webkit-column-break-inside: avoid;
} }
.option label { .option label {
line-height: 20px; line-height: 1.25rem;
margin: 0; margin: 0;
} }
#options [type="number"] {
text-align: left; /* workaround the column flow bug in webkit */
padding-left: 0.2rem;
}
#options #tabSize-label {
position: relative;
top: 0.2rem;
}
#sections { #sections {
padding-left: 0; padding-left: 0;
} }
#sections > div { #sections > div {
padding: 0; padding: 0;
} }
#sections-heading { #sections > *:not(h2) {
padding-left: 8px; padding-left: 0.4rem;
}
body > section > *:not(h2) {
padding-left: 8px;
} }
} }
/* editor options */
[type="number"] {
max-width: 2.8em;
text-align: right;
}
table, input, select {
font-size: inherit;
}
table td:first-child {min-width: 60px}
</style> </style>
<script src="storage.js"></script> <script src="storage.js"></script>
<script src="messaging.js"></script> <script src="messaging.js"></script>
@ -256,13 +261,18 @@
<div id="header"> <div id="header">
<h1 id="heading"></h1> <h1 id="heading"></h1>
<section id="basic-info"> <section id="basic-info">
<div><label for="name" id="name-label"></label><input id="name" class="style-contributor"></div> <div id="basic-info-name">
<div><label for="enabled" id="enabled-label"></label><input type="checkbox" id="enabled" class="style-contributor"></div> <input id="name" class="style-contributor">
</div>
<div id="basic-info-enabled">
<input type="checkbox" id="enabled" class="style-contributor">
<label for="enabled" id="enabled-label"></label>
</div>
</section> </section>
<section id="actions"> <section id="actions">
<button id="to-mozilla"></button><img id="to-mozilla-help" src="help.png"><br><br> <div><button id="to-mozilla"></button><img id="to-mozilla-help" src="help.png"></div>
<button id="save-button" title="Ctrl-S"></button>
<a href="manage.html"><button id="cancel-button"></button></a> <a href="manage.html"><button id="cancel-button"></button></a>
<button id="save-button" title="Ctrl-S"></button>
</section> </section>
<section id="options"> <section id="options">
<h2 id="options-heading"></h2> <h2 id="options-heading"></h2>

View File

@ -671,7 +671,7 @@ chrome.extension.onMessage.addListener(function(request, sender, sendResponse) {
} }
}); });
tE("name-label", "styleNameLabel"); tE("name", "styleMissingName", "placeholder");
tE("enabled-label", "styleEnabledLabel"); tE("enabled-label", "styleEnabledLabel");
tE("to-mozilla", "styleToMozillaFormat"); tE("to-mozilla", "styleToMozillaFormat");
tE("save-button", "styleSaveLabel"); tE("save-button", "styleSaveLabel");