Skip to content

Commit

Permalink
link to Writing-UserCSS in editor
Browse files Browse the repository at this point in the history
  • Loading branch information
tophf committed Jul 29, 2024
1 parent 6e18fbe commit ba6e588
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@
<div id="header">
<h1 id="heading" i18n="data-edit:editStyleHeading, data-add:addStyleTitle">
<a class="usercss-only icon"
href="https://github.com/openstyles/stylus/wiki/Usercss"
href="https://github.com/openstyles/stylus/wiki/Writing-UserCSS"
i18n="title:externalUsercssDocument" target="_blank">
<i class=i-info></i>
</a>
Expand Down
16 changes: 13 additions & 3 deletions edit/edit.css
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ html:not(.is-new-style) #heading::before {
flex-direction: column;
& h1 {
margin-top: 0;
.usercss & {
margin-bottom: 0;
+ a {
margin-bottom: 1em;
}
}
}
}
.sectioned {
Expand Down Expand Up @@ -125,7 +131,7 @@ html:not(.is-new-style) #heading::before {
#basic-info-enabled {
margin-top: .25rem;
> :nth-last-child(n + 2) {
margin-right: 1em;
margin-right: var(--pad05);
}
}
#livePreview-settings {
Expand Down Expand Up @@ -966,7 +972,7 @@ i,
font-size: 14px;
}
.settings h2 {
max-width: 7vw;
max-width: 10vw;
}
}
#header.sticky .hide-if-sticky,
Expand All @@ -992,7 +998,11 @@ i,
flex-grow: 1;
}
> *:not(:last-child) {
margin-right: 0.8rem;
margin-right: var(--pad05);
}
> a {
order: 1;
align-self: center;
}
}
#actions {
Expand Down
3 changes: 3 additions & 0 deletions edit/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ editor.styleReady.then(async () => {
const scroller = isUsercss ? $('.CodeMirror-scroll') : document.body;
const xoRoot = isUsercss ? scroller : undefined;
const xo = new IntersectionObserver(onScrolled, {root: xoRoot});
const elInfo = $('h1 a');
scroller.appendChild(el);
onCompactToggled(editor.mqCompact);
editor.mqCompact.on('change', onCompactToggled);
Expand All @@ -85,8 +86,10 @@ editor.styleReady.then(async () => {
}
if (mq.matches) {
xo.observe(el);
$('#basic-info-name').after(elInfo);
} else {
xo.disconnect();
$('h1').append(elInfo);
}
}
/** @param {IntersectionObserverEntry[]} entries */
Expand Down

0 comments on commit ba6e588

Please sign in to comment.