refactor: convert editor to panel component and add perfect-scrollbar
Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
1 parent
1aeaf7d36f
commit
dd9c71a3bb
2 files changed
+24
-23
No files matched your search
@@ -1,6 +1,6 @@
|
||||
<style scoped>
|
||||
.editor-content-container {
|
||||
height: calc(100vh - 64px);
|
||||
height: calc(100vh - 48px);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -13,29 +13,24 @@
|
||||
@close="close"
|
||||
@keydown.esc="escClose"
|
||||
>
|
||||
<v-card>
|
||||
<v-toolbar dark color="primary">
|
||||
<v-btn icon dark @click="close">
|
||||
<v-icon>mdi-close</v-icon>
|
||||
</v-btn>
|
||||
<v-toolbar-title>{{ filepath ? filepath.slice(1)+"/" : "" }}{{ filename }} {{changed}}</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-toolbar-items>
|
||||
<v-btn dark text href="https://www.klipper3d.org/Config_Reference.html" v-if="restartServiceName === 'klipper'" target="_blank" class="d-none d-md-flex"><v-icon small class="mr-1">mdi-help</v-icon>{{ $t('Editor.ConfigReference') }}</v-btn>
|
||||
<template v-if="isWriteable">
|
||||
<v-divider white vertical class="d-none d-md-flex" v-if="restartServiceName === 'klipper'"></v-divider>
|
||||
<v-btn dark text @click="save(null)" ><v-icon small class="mr-1">mdi-content-save</v-icon><span class="d-none d-sm-inline">{{ $t('Editor.SaveClose') }}</span></v-btn>
|
||||
</template>
|
||||
<template v-if="restartServiceName != null">
|
||||
<v-divider white vertical class="d-none d-sm-flex"></v-divider>
|
||||
<v-btn dark text @click="save(restartServiceName)" class="d-none d-sm-flex"><v-icon small class="mr-1">mdi-restart</v-icon>{{ $t('Editor.SaveRestart') }}</v-btn>
|
||||
</template>
|
||||
</v-toolbar-items>
|
||||
</v-toolbar>
|
||||
<panel card-class="editor-dialog" icon="mdi-file-document-edit-outline" :title="(filepath ? filepath.slice(1)+'/': '')+filename+' '+changed">
|
||||
<template v-slot:buttons>
|
||||
<v-btn dark text href="https://www.klipper3d.org/Config_Reference.html" v-if="restartServiceName === 'klipper'" target="_blank" class="d-none d-md-flex"><v-icon small class="mr-1">mdi-help</v-icon>{{ $t('Editor.ConfigReference') }}</v-btn>
|
||||
<template v-if="isWriteable">
|
||||
<v-divider white vertical class="d-none d-md-flex" v-if="restartServiceName === 'klipper'"></v-divider>
|
||||
<v-btn text :color="restartServiceName === null ? 'primary' : ''" @click="save(null)" ><v-icon small class="mr-1">mdi-content-save</v-icon><span class="d-none d-sm-inline">{{ $t('Editor.SaveClose') }}</span></v-btn>
|
||||
</template>
|
||||
<template v-if="restartServiceName !== null">
|
||||
<v-divider white vertical class="d-none d-sm-flex"></v-divider>
|
||||
<v-btn color="primary" text @click="save(restartServiceName)" class="d-none d-sm-flex"><v-icon small class="mr-1">mdi-restart</v-icon>{{ $t('Editor.SaveRestart') }}</v-btn>
|
||||
</template>
|
||||
<v-divider white vertical class="d-none d-sm-flex"></v-divider>
|
||||
<v-btn icon @click="close"><v-icon>mdi-close-thick</v-icon></v-btn>
|
||||
</template>
|
||||
<v-card-text class="pa-0">
|
||||
<codemirror ref="editor" v-model="sourcecode" :name="filename" v-bind:file-extension="fileExtension"></codemirror>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
<v-snackbar v-model="loaderBool" :timeout="-1" :value="true" fixed right bottom dark>
|
||||
<div>
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
<style>
|
||||
.vue-codemirror .cm-editor {
|
||||
height: calc(100vh - 64px);
|
||||
|
||||
}
|
||||
|
||||
.editor-content-container {
|
||||
height: calc(100vh - 48px);
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div class="vue-codemirror">
|
||||
<div ref="codemirror" v-observe-visibility="visibilityChanged"></div>
|
||||
<perfect-scrollbar class="editor-content-container">
|
||||
<div ref="codemirror" v-observe-visibility="visibilityChanged"></div>
|
||||
</perfect-scrollbar>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in new issue
Block a user