feat: highlight active line in codemirror when focused

This commit is contained in:
liyasthomas
2021-09-11 09:19:16 +05:30
parent 108f228edf
commit b2f93aa549
5 changed files with 13 additions and 9 deletions

View File

@@ -348,6 +348,7 @@ input[type="checkbox"] {
@apply justify-start; @apply justify-start;
@apply shadow; @apply shadow;
@apply font-medium; @apply font-medium;
@apply transition;
font-size: var(--body-font-size); font-size: var(--body-font-size);
line-height: var(--body-line-height); line-height: var(--body-line-height);
@@ -359,7 +360,6 @@ input[type="checkbox"] {
@apply ml-auto; @apply ml-auto;
@apply last:ml-4; @apply last:ml-4;
@apply sm:ml-8; @apply sm:ml-8;
@apply transition;
@apply rounded; @apply rounded;
@apply text-current; @apply text-current;
@apply normal-case; @apply normal-case;
@@ -466,10 +466,14 @@ input[type="checkbox"] {
@apply block; @apply block;
@apply w-full; @apply w-full;
@apply !h-full; @apply !h-full;
}
.CodeMirror * { &:not(.CodeMirror-focused) .CodeMirror-activeline-background {
font-family: "Roboto Mono", monospace; background: transparent !important;
}
* {
font-family: "Roboto Mono", monospace;
}
} }
.CodeMirror-scroll { .CodeMirror-scroll {

View File

@@ -47,7 +47,7 @@
group-hover:text-secondaryDark group-hover:text-secondaryDark
" "
> >
<span class="rounded select-all truncate"> <span class="rounded-sm select-all truncate">
{{ header.key }} {{ header.key }}
</span> </span>
</span> </span>
@@ -61,7 +61,7 @@
group-hover:text-secondaryDark group-hover:text-secondaryDark
" "
> >
<span class="rounded select-all truncate"> <span class="rounded-sm select-all truncate">
{{ header.value }} {{ header.value }}
</span> </span>
</span> </span>

View File

@@ -53,7 +53,6 @@
import { ref, useContext, computed, reactive } from "@nuxtjs/composition-api" import { ref, useContext, computed, reactive } from "@nuxtjs/composition-api"
import { useCodemirror } from "~/helpers/editor/codemirror" import { useCodemirror } from "~/helpers/editor/codemirror"
import { copyToClipboard } from "~/helpers/utils/clipboard" import { copyToClipboard } from "~/helpers/utils/clipboard"
import "codemirror/mode/yaml/yaml"
import { HoppRESTResponse } from "~/helpers/types/HoppRESTResponse" import { HoppRESTResponse } from "~/helpers/types/HoppRESTResponse"
const props = defineProps<{ const props = defineProps<{
@@ -100,7 +99,7 @@ useCodemirror(
responseBodyText, responseBodyText,
reactive({ reactive({
extendedEditorConfig: { extendedEditorConfig: {
mode: "text/x-yaml", mode: "text/plain",
readOnly: true, readOnly: true,
lineWrapping: linewrapEnabled, lineWrapping: linewrapEnabled,
}, },

View File

@@ -501,7 +501,6 @@ export default defineComponent({
@apply overflow-y-hidden; @apply overflow-y-hidden;
@apply resize-none; @apply resize-none;
@apply focus:outline-none; @apply focus:outline-none;
@apply transition;
} }
.env-input::-webkit-scrollbar { .env-input::-webkit-scrollbar {

View File

@@ -23,6 +23,7 @@ import "codemirror/addon/search/search"
import "codemirror/addon/search/searchcursor" import "codemirror/addon/search/searchcursor"
import "codemirror/addon/search/jump-to-line" import "codemirror/addon/search/jump-to-line"
import "codemirror/addon/dialog/dialog" import "codemirror/addon/dialog/dialog"
import "codemirror/addon/selection/active-line"
import { watch, onMounted, ref, Ref, useContext } from "@nuxtjs/composition-api" import { watch, onMounted, ref, Ref, useContext } from "@nuxtjs/composition-api"
import { LinterDefinition } from "./linting/linter" import { LinterDefinition } from "./linting/linter"
@@ -45,6 +46,7 @@ const DEFAULT_EDITOR_CONFIG: CodeMirror.EditorConfiguration = {
"Ctrl-Space": "autocomplete", "Ctrl-Space": "autocomplete",
}, },
viewportMargin: Infinity, viewportMargin: Infinity,
styleActiveLine: true,
} }
/** /**