Ghost/ghost/admin/app/styles/components/koenig.css
Kevin Ansfield b21e46aa39 Koenig - Keep MD card formatting toolbar visible when possible
refs https://github.com/TryGhost/Ghost/issues/9505
- use `{{gh-scroll-trigger}}` components at top and bottom of the markdown card when in edit mode so that styles can be applied to the `.editor-toolbar` element to keep the toolbar fixed at the bottom of the screen whilst scrolling
2018-04-24 13:10:20 +01:00

435 lines
8.6 KiB
CSS

/* Import basic typography styles for Koenig */
@import "./koenig-content.css";
/* TODO: move these back into the editor.css layout? */
/* scrollable container */
.gh-koenig-editor {
position: relative;
z-index: 0;
width: 100%;
height: 100vh;
overflow-x: hidden;
overflow-y: auto;
}
/* padded container housing title + editor canvas, scrollable content */
.gh-koenig-editor-pane {
display: flex;
flex-direction: column;
min-height: 100%;
padding: 10vw 4vw;
}
@media (max-width: 500px) {
.gh-koenig-editor-pane {
padding: 15vw 4vw;
}
}
/* use flex-grow to fill the available vertical space so clicks outside the
editor content can trigger focus */
.gh-koenig-editor-pane .koenig-editor {
width: 100%;
flex-grow: 1;
cursor: text;
}
/* NOTE: everything from this point should be Koenig addon specific */
/* Editor canvas layout ----------------------------------------------------- */
.koenig-editor {
position: relative; /* necessary to position toolbar etc */
max-width: 760px;
margin: 0 auto;
}
/* ⨁ menu ------------------------------------------------------------------ */
.koenig-plus-menu {
position: absolute;
}
.koenig-plus-menu-button {
display: flex;
justify-content: center;
align-items: center;
position: relative;
width: 30px;
height: 30px;
border: var(--midgrey) 1px solid;
background: #fff;
border-radius: 100%;
margin-left: -40px;
}
.koenig-plus-menu-button svg {
height: 15px;
width: 15px;
}
.koenig-plus-menu-button svg path {
stroke: var(--midgrey);
stroke-width: 2px;
}
@media (max-width: 1024px) {
.koenig-plus-menu-button {
right:10px;
}
}
/* Slash shortcut menu ------------------------------------------------------ */
.koenig-slash-menu {
position: absolute;
}
/* Menu items --------------------------------------------------------------- */
/* Chrome has a bug with its scrollbars on this element which has been reported here: https://bugs.chromium.org/p/chromium/issues/detail?id=697381 */
.koenig-cardmenu {
position: absolute;
top: 0;
display: flex;
flex-wrap: wrap;
margin: 0 0 20px 0;
padding: 12px 15px;
width: 350px;
max-height: 460px;
overflow-y: auto;
background-color: #fff;
background-clip: padding-box;
border-radius: 4px;
box-shadow: 0 0 0 1px rgba(99,114,130,0.16), 0 8px 16px rgba(27,39,51,0.08);
text-transform: none;
font-size: 1.4rem;
font-weight: normal;
position: absolute;
z-index: 9999999; /* have to compete with codemirror */
}
.koenig-cardmenu-button {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
width: 30px;
height: 30px;
border: var(--midgrey) 1px solid;
background: #fff;
border-radius: 100%;
margin-left: -40px;
}
.koenig-cardmenu-button svg {
height: 15px;
width: 15px;
}
.koenig-cardmenu-button svg path {
stroke: var(--midgrey);
stroke-width: 2px;
}
@media (max-width: 1024px) {
.koenig-cardmenu-button {
right:10px;
}
}
.koenig-cardmenu-search {
position: relative;
width: 350px;
height: 40px;
margin: -12px -15px;
}
.koenig-cardmenu-search svg {
position: absolute;
top: 11px;
left: 10px;
z-index: 100;
width: 20px;
height: 19px;
}
.koenig-cardmenu-search-input {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
height: 40px;
font-size: 1.4rem;
line-height: 40px;
padding: 10px 0 10px 40px;
border: none;
border-radius: 4px 4px 0 0;
}
.koenig-cardmenu-card {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 80px;
height: 80px;
border-radius: 4px;
}
.koenig-cardmenu-icon {
display: flex;
align-items: center;
}
.koenig-cardmenu-icon svg {
width: 27px;
height: 27px;
fill: var(--darkgrey);
}
.koenig-cardmenu-label {
margin: 7px 0 0 0;
font-size: 1.1rem;
color: var(--midgrey);
letter-spacing: 0.2px;
font-weight: 200;
}
.koenig-cardmenu-card:hover, .koenig-cardmenu-card.selected {
cursor: pointer;
background: color-mod(var(--lightgrey) l(+3%) s(-10%));
}
.koenig-cardmenu-card:hover .koenig-cardmenu-label, .koenig-cardmenu-card.selected .koenig-cardmenu-label {
color: var(--darkgrey);
font-weight: 300;
}
.koenig-cardmenu-divider {
top: -12px;
width: 350px;
padding: 5px 0;
margin: 12px -15px;
font-size: 1.2rem;
text-align: center;
background: color-mod(var(--lightgrey) l(+3%) s(-10%));
}
/* Cards -------------------------------------------------------------------- */
/* generic containers... */
.koenig-card {
position: relative;
display: flex;
width: calc(100% + 60px);
border: 2px solid color-mod(var(--blue) alpha(-85%));
flex-direction: row;
border-radius: 4px;
padding: 10px;
margin-left: -50px;
max-width: none;
cursor: default;
caret-color: auto; /* override hidden cursors around cards */
}
.koenig-card:hover {
border-color: color-mod(var(--blue) alpha(-25%));
}
.koenig-card--selected {
border-color: var(--blue);
}
.koenig-card-icon {
width: 30px;
margin-right: 10px;
}
.koenig-card-content {
flex-grow: 1;
max-width: calc(100% - 40px);
}
.koenig-card-click-overlay {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 400;
}
/* specific cards... */
/* HTML */
.koenig-card-html--editor .CodeMirror {
min-height: 170px;
padding: 0;
overflow: auto;
background-color: #ffffff;
}
.koenig-card-html--editor .CodeMirror:hover {
cursor: text;
}
.koenig-card-html--editor .CodeMirror-scroll {
min-height: 170px;
overflow: hidden !important;
margin-right: 0;
}
/* Markdown */
.koenig-editor .gh-markdown-editor {
position: static;
overflow: visible;
}
.koenig-editor .gh-markdown-editor .editor-toolbar {
position: absolute;
bottom: 0;
left: 0;
right: 0;
border-left: none;
border-right: none;
border-radius: 0 0 .4rem .4rem;
z-index: 9999;
background-color: #fff;
opacity: 1;
text-align: center;
}
.koenig-editor .gh-markdown-editor .CodeMirror {
min-height: 130px;
/* margin to account for absolutely positioned toolbar */
margin-bottom: 49px;
}
.koenig-editor .gh-markdown-editor .CodeMirror-scroll {
min-height: 130px;
}
/* mobiledoc-kit base styles ------------------------------------------------
* NOTE: adapted from https://github.com/bustle/mobiledoc-kit/blob/master/src/css/mobiledoc-kit.css
*/
/**
* Editor
*/
/* TODO: update to match Ghost styles */
.__mobiledoc-editor {
display: flex;
flex-direction: column;
align-items: center;
position: relative;
font-family: var(--font-family);
font-size: 1.7rem;
resize: none;
font-weight: 200;
letter-spacing: 0.1px;
min-height: 1em;
}
.__mobiledoc-editor:focus {
outline: none;
}
.__mobiledoc-editor > * {
position: relative;
}
.__mobiledoc-editor.__has-no-content:after {
font-family: georgia,serif;
font-weight: 300;
letter-spacing: .02rem;
line-height: 1.6em;
font-size: 2rem;
min-width: 100%;
content: attr(data-placeholder);
color: var(--midgrey-l2);
cursor: text;
position: absolute;
top: 16px;
}
/* override of global.css block display */
.__mobiledoc-editor i {
display: inline;
}
/**
* Cards
*/
.__mobiledoc-card {
display: inline-block;
width: 100%;
}
/**
* Tooltips
*/
@-webkit-keyframes fade-in {
0% { opacity: 0; }
100% { opacity: 1; }
}
@keyframes fade-in {
0% { opacity: 0; }
100% { opacity: 1; }
}
.__mobiledoc-tooltip {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 0.7em;
white-space: nowrap;
position: absolute;
background-color: rgba(43,43,43,0.9);
border-radius: 3px;
line-height: 1em;
padding: 0.7em 0.9em;
color: #FFF;
-webkit-animation: fade-in 0.2s;
animation: fade-in 0.2s;
}
.__mobiledoc-tooltip:before {
content: '';
position: absolute;
left: 50%;
width: 0;
height: 0;
border-left: 0.4em solid transparent;
border-right: 0.4em solid transparent;
border-bottom: 0.4em solid rgba(43,43,43,0.9);
top: -0.4em;
margin-left: -0.4em;
}
/* help keeps mouseover state when moving from link to tooltip */
.__mobiledoc-tooltip:after {
content: '';
position: absolute;
left: 0;
right: 0;
top: -0.4em;
height: 0.4em;
}
.__mobiledoc-tooltip a {
color: #FFF;
text-decoration: none;
}
.__mobiledoc-tooltip a:hover {
text-decoration: underline;
}