Skip to content

Commit

Permalink
fix cm
Browse files Browse the repository at this point in the history
  • Loading branch information
Keywos committed Mar 19, 2024
1 parent 6f184ea commit 61feb65
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 158 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sub-store-front-end",
"version": "2.14.187",
"version": "2.14.189",
"private": true,
"scripts": {
"dev": "vite --host",
Expand Down
20 changes: 10 additions & 10 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import NotFound from '@/views/NotFound.vue';

import File from '@/views/File.vue';
import FileEditor from '@/views/FileEditor.vue';
import editScript from '@/views/editCode/editScript.vue';
// import editScript from '@/views/editCode/editScript.vue';

import Sub from '@/views/Sub.vue';
import SubEditor from '@/views/SubEditor.vue';
Expand Down Expand Up @@ -112,15 +112,15 @@ const router = createRouter({
needNavBack: false,
},
},
{
path: '/edit/Script/:id',
component: editScript,
meta: {
title: 'editScript',
needTabBar: false,
needNavBack: true,
},
},
// {
// path: '/edit/Script/:id',
// component: editScript,
// meta: {
// title: 'editScript',
// needTabBar: false,
// needNavBack: true,
// },
// },
{
path: '/edit/:editType(files)/:id',
component: FileEditor,
Expand Down
10 changes: 5 additions & 5 deletions src/store/codeStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import { defineStore } from "pinia";
export const useCodeStore = defineStore("cmCodeStore", {
state: (): cmCodeStore => {
return {
CmCode: "",
EditCode: {},
CodeClear: {},
};
},
getters: {},
actions: {
setCmCode(i: { toString: () => any }) {
this.CmCode = i ? i.toString() : "";
},
setEditCode( id: string , i: { toString: () => any }) {
setEditCode(id: string, i: { toString: () => any }) {
this.EditCode[id] = i ? i.toString() : "";
},
CodeClear(id: string, i: boolean = false) {
this.CodeClear[id] = i;
},
},
});
2 changes: 1 addition & 1 deletion src/types/store/codeStore.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
interface cmCodeStore {
CmCode?: string;
EditCode?: { [key: string]: string };
CodeClear?: { [key: string]: boolean };
}
4 changes: 2 additions & 2 deletions src/views/FilePreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
{{ displayName }}
</span>
</h1>
<button class="copy" @click.stop="copyContent">
<!-- <button class="copy" @click.stop="copyContent">
<svg-icon
name="copy"
class="action-icon"
color="var(--comment-text-color)"
/>
</button>
</button> -->
<button @click="clickClose">
<font-awesome-icon icon="fa-solid fa-circle-xmark" />
</button>
Expand Down
2 changes: 1 addition & 1 deletion src/views/SubEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
type="text"
/> -->

<div style="margin-left: -10px; margin-right: -20px">
<div style="margin-left: -10px; margin-right: -16px">
<cmView :isReadOnly="false" id="SubEditer"/>
</div>
</nut-form-item>
Expand Down
46 changes: 40 additions & 6 deletions src/views/editCode/cmView.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
<template>
<div class="cmviewRef">
<div class="cm-img-button">
<!--mouseenter mouseover @mouseleave="openPanel = false" -->
<div
class="cm-img-button"
:class="{ 'nodark-imgbutton': !isDarkModeEnabled }"
>
<div v-if="openPanel">
<button @click="hiCode"><img :src="jsimg" /></button>
<button @click="undoCode"><img :src="undoimg" /></button>
<button @click="hiCode"><img :src="jsimg" /></button>
<button @click="redoCode"><img :src="redoimg" /></button>
<button @click="formatCode"><img :src="format" /></button>
<button @click="searchs"><img :src="searchimg" /></button>
<button @click="copyText"><img :src="copyimg" /></button>
<button @click="delAllCode"><img :src="del" /></button>
<button @click="pasteNav"><img :src="paste" /></button>
</div>
<span v-else style="opacity: 0.4; font-size: 12px; padding-left: 10px">
<span
v-else
style="
opacity: 0.4;
font-size: 12px;
padding-left: 10px;
line-height: 14px;
height: 22px;
color: var(--comment-text-color);
"
>
{{ Length }} &nbsp;
</span>

<button @click="setPanel"><img :src="more" /></button>
</div>

Expand Down Expand Up @@ -81,7 +92,7 @@ const isDarkModeEnabled = ref(true);
const Length = ref("");
const props = defineProps(["isReadOnly", "id"]);
console.log(props.id);
// console.log(props.id);
const cmStore = useCodeStore();
const viewRef = ref(null);
Expand Down Expand Up @@ -315,6 +326,7 @@ const copyText = async () => {
const delAllCode = () => {
cmStore.setEditCode([props.id], "");
cmStore.CodeClear([props.id], true);
showNotify({
type: "success",
title: "已清空",
Expand Down Expand Up @@ -405,6 +417,8 @@ const pasteNav = async () => {
background-color: transparent !important;
min-width: 160px;
padding: 0.2em 0.5em;
border-color: none !important;
outline: none;
}
.cm-panel.cm-search input[type="checkbox"] {
Expand Down Expand Up @@ -435,4 +449,24 @@ input[type="checkbox"]:checked {
.cm-panel.cm-search label {
font-size: 90% !important;
}
.nodark-imgbutton {
filter: invert(1);
}
1.cm-focused {
outline: none;
}
1u .cm-panels.cm-panels-bottom {
border-top: none;
}
.cm-panels.cm-panels-bottom {
background: transparent;
box-shadow: 0 0 6px #919db687;
}
.cm-button:active {
background-color: #b6d9eba6 !important;
}
</style>
106 changes: 0 additions & 106 deletions src/views/editCode/editScript.vue

This file was deleted.

Loading

0 comments on commit 61feb65

Please sign in to comment.