Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix yaml editor styling #11823

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 82 additions & 67 deletions shell/components/CodeMirror.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default {
theme: `base16-${ theme }`,
lineNumbers: true,
line: true,
styleActiveLine: true,
styleActiveLine: false,
lineWrapping: true,
foldGutter: true,
styleSelectedText: true,
Expand All @@ -66,6 +66,7 @@ export default {
if (this.asTextArea) {
out.lineNumbers = false;
out.foldGutter = false;
out.tabSize = 0;
out.extraKeys = { Tab: false };
}
Expand Down Expand Up @@ -178,6 +179,7 @@ export default {
:value="value"
:options="combinedOptions"
:disabled="isDisabled"
:original-style="true"
@ready="onReady"
@input="onInput"
@changes="onChanges"
Expand All @@ -194,72 +196,8 @@ export default {
<style lang="scss">
$code-mirror-animation-time: 0.1s;
.codemirror-container {
z-index: 0;
// Keyboard mapping overlap
.keymap.overlay {
position: absolute;
display: flex;
top: 7px;
right: 7px;
z-index: 1;
cursor: pointer;
.keymap-indicator {
width: 48px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid transparent;
color: var(--darker);
background-color: var(--overlay-bg);
font-size: 12px;
.close-indicator {
width: 0;
.icon-close {
color: var(--primary);
opacity: 0;
}
}
.keymap-icon {
font-size: 24px;
opacity: 0.8;
transition: margin-right $code-mirror-animation-time ease-in-out;
}
&:hover {
border: 1px solid var(--primary);
border-radius: var(--border-radius);;
.close-indicator {
margin-left: -6px;
width: auto;
.icon-close {
opacity: 1;
transition: opacity $code-mirror-animation-time ease-in-out $code-mirror-animation-time; // Only animate when being shown
}
}
.keymap-icon {
opacity: 0.6;
margin-right: 10px;
}
}
}
}
.vue-codemirror .CodeMirror {
height: initial;
background: none
}
&.as-text-area {
.code-mirror {
&.as-text-area .codemirror-container{
min-height: 40px;
position: relative;
display: block;
Expand Down Expand Up @@ -345,6 +283,83 @@ export default {
color: var(--primary-text);
background-color: var(--primary);
}
.CodeMirror-gutters .CodeMirror-foldgutter:empty {
display: none;
}
}
}
.code-mirror .codemirror-container {
z-index: 0;
font-size: inherit !important;
// Keyboard mapping overlap
.keymap.overlay {
position: absolute;
display: flex;
top: 7px;
right: 7px;
z-index: 1;
cursor: pointer;
.keymap-indicator {
width: 48px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid transparent;
color: var(--darker);
background-color: var(--overlay-bg);
font-size: 12px;
.close-indicator {
width: 0;
.icon-close {
color: var(--primary);
opacity: 0;
}
}
.keymap-icon {
font-size: 24px;
opacity: 0.8;
transition: margin-right $code-mirror-animation-time ease-in-out;
}
&:hover {
border: 1px solid var(--primary);
border-radius: var(--border-radius);;
.close-indicator {
margin-left: -6px;
width: auto;
.icon-close {
opacity: 1;
transition: opacity $code-mirror-animation-time ease-in-out $code-mirror-animation-time; // Only animate when being shown
}
}
.keymap-icon {
opacity: 0.6;
margin-right: 10px;
}
}
}
}
//rm no longer extant selector
.CodeMirror {
height: initial;
background: none
}
.CodeMirror-gutters {
background: inherit;
}
}
</style>
2 changes: 1 addition & 1 deletion shell/components/YamlEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default {
mode: 'yaml',
lint: !readOnly,
lineNumbers: !readOnly,
styleActiveLine: true,
cnotv marked this conversation as resolved.
Show resolved Hide resolved
styleActiveLine: false,
tabSize: 2,
indentWithTabs: false,
cursorBlinkRate: ( readOnly ? -1 : 530 ),
Expand Down
Loading