mirror of
https://github.com/Kong/insomnia
synced 2024-11-12 17:26:32 +00:00
a36e22c294
* Replace textarea with code editor * Add raw-editor class and props to make style consistent * Merge raw-editor style into general.less Co-authored-by: Li Hu <li.hu@onedegree.hk> Co-authored-by: Opender Singh <opender94@gmail.com>
176 lines
3.6 KiB
Plaintext
176 lines
3.6 KiB
Plaintext
@import '../constants/animations';
|
|
|
|
.editor {
|
|
box-sizing: border-box;
|
|
height: 100%;
|
|
width: 100%;
|
|
display: grid;
|
|
grid-template-rows: minmax(0, 1fr) auto;
|
|
grid-template-columns: 100%;
|
|
|
|
&[data-editor-type='password'] .CodeMirror-line {
|
|
-webkit-text-security: disc;
|
|
|
|
// NOTE: <span cm-text> appears with hidden character when editor is empty
|
|
[cm-text=''],
|
|
.CodeMirror-widget {
|
|
-webkit-text-security: none;
|
|
}
|
|
}
|
|
|
|
.editor__container {
|
|
height: 100%;
|
|
width: 100%;
|
|
position: relative;
|
|
}
|
|
|
|
.CodeMirror {
|
|
z-index: 0; // Because some children have z-index ~5
|
|
line-height: 1.4em;
|
|
position: absolute;
|
|
left: 0;
|
|
right: 0;
|
|
top: 0;
|
|
bottom: 0;
|
|
|
|
.cm-searching {
|
|
background: var(--hl-sm);
|
|
border-bottom: 1px solid var(--color-success);
|
|
}
|
|
}
|
|
|
|
.editor__toolbar {
|
|
display: flex;
|
|
flex-direction: row;
|
|
align-items: center;
|
|
border-top: 1px solid var(--hl-md);
|
|
height: var(--line-height-xs);
|
|
font-size: var(--font-size-sm);
|
|
|
|
input {
|
|
font-family: var(--font-monospace);
|
|
margin-right: 0;
|
|
width: 100%;
|
|
margin-left: var(--padding-md);
|
|
}
|
|
|
|
button {
|
|
color: var(--hl);
|
|
padding: var(--padding-xs) var(--padding-md);
|
|
height: 100%;
|
|
}
|
|
}
|
|
|
|
.CodeMirror {
|
|
height: 100% !important;
|
|
width: 100%;
|
|
box-sizing: border-box;
|
|
font-family: var(--font-monospace);
|
|
|
|
.CodeMirror-line * {
|
|
font-variant-ligatures: var(--font-ligatures);
|
|
}
|
|
}
|
|
|
|
.CodeMirror,
|
|
.cm-s-seti.CodeMirror, // Hack because seti theme is dumb
|
|
.CodeMirror-scrollbar-filler,
|
|
.CodeMirror-gutter-filler {
|
|
// Let the background behind show through
|
|
background-color: transparent !important;
|
|
border: 0;
|
|
}
|
|
|
|
.CodeMirror-linenumber {
|
|
color: var(--hl-xl) !important;
|
|
}
|
|
|
|
.CodeMirror-foldgutter-folded,
|
|
.CodeMirror-foldgutter-open {
|
|
font-size: 1.2em;
|
|
font-family: 'Times New Roman', serif;
|
|
margin-left: -2px;
|
|
}
|
|
|
|
.CodeMirror-guttermarker-subtle {
|
|
color: var(--hl-lg);
|
|
&:hover {
|
|
color: var(--hl);
|
|
}
|
|
}
|
|
|
|
.CodeMirror-gutters {
|
|
background-color: var(--color-bg);
|
|
}
|
|
|
|
.CodeMirror-lint-marker-multiple {
|
|
padding: 0px 6px 0px 5px;
|
|
margin-right: 3px;
|
|
}
|
|
|
|
.CodeMirror-scroll {
|
|
cursor: text; // Show text cursor everywhere (not just in .Codemirror-lines)
|
|
}
|
|
|
|
.CodeMirror-lines {
|
|
// Scroll past the end
|
|
padding-bottom: 30px;
|
|
|
|
// Has to be nested to have higher precedence than default style
|
|
.CodeMirror-placeholder {
|
|
color: var(--hl-lg);
|
|
}
|
|
}
|
|
|
|
.CodeMirror-lint-marker-error {
|
|
width: 100%;
|
|
height: 1em;
|
|
display: flex;
|
|
background: none;
|
|
text-align: center;
|
|
|
|
&::after {
|
|
color: var(--color-danger);
|
|
text-align: center;
|
|
width: 100%;
|
|
font-size: 0.7em; // because the circle is so large
|
|
content: '⬤';
|
|
}
|
|
}
|
|
|
|
.CodeMirror-activeline-gutter,
|
|
.CodeMirror-activeline-background {
|
|
background-color: transparent;
|
|
}
|
|
|
|
&:not(.editor--readonly) .CodeMirror-focused .CodeMirror-activeline-gutter,
|
|
&:not(.editor--readonly) .CodeMirror-focused .CodeMirror-activeline-background {
|
|
background-color: var(--hl-xs);
|
|
}
|
|
|
|
&.editor--readonly .CodeMirror-cursors {
|
|
visibility: hidden;
|
|
}
|
|
|
|
&.editor--dynamic-height {
|
|
.CodeMirror {
|
|
position: static;
|
|
}
|
|
|
|
.CodeMirror-lines {
|
|
padding-bottom: 0.5em;
|
|
}
|
|
}
|
|
}
|
|
|
|
/*
|
|
We need to restyle CodeMirrow for raw editor
|
|
*/
|
|
.raw-editor {
|
|
.CodeMirror-wrap pre.CodeMirror-line, .CodeMirror-wrap pre.CodeMirror-line-like {
|
|
word-break: break-all;
|
|
line-height: normal;
|
|
padding: var(--padding-md);
|
|
}
|
|
}
|