mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
fix(web/sourceeditor): update el-checkbox usage; fix reactivity bugs;update isbooksource regex
This commit is contained in:
@@ -56,7 +56,7 @@ const startDebug = async () => {
|
||||
};
|
||||
|
||||
const isBookSource = computed(() => {
|
||||
return /bookSource/.test(window.location.href);
|
||||
return /bookSource/i.test(window.location.href);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<el-checkbox
|
||||
size="large"
|
||||
border
|
||||
:label="sourceUrl"
|
||||
:value="sourceUrl"
|
||||
:class="{
|
||||
error: isSaveError,
|
||||
edit: sourceUrl == currentSourceUrl,
|
||||
|
||||
@@ -127,7 +127,7 @@ const importSourceFile = () => {
|
||||
input.click();
|
||||
};
|
||||
|
||||
const isBookSource = /bookSource/.test(window.location.href);
|
||||
const isBookSource = /bookSource/i.test(window.location.href);
|
||||
const outExport = () => {
|
||||
const exportFile = document.createElement("a");
|
||||
let sources =
|
||||
|
||||
@@ -60,7 +60,12 @@
|
||||
<script setup>
|
||||
const store = useSourceStore();
|
||||
defineProps(["config"]);
|
||||
const currentSource = store.currentSource;
|
||||
|
||||
const currentSource = computed(() => store.currentSource);
|
||||
/*
|
||||
修改currentSource的属性 没有直接修改本身
|
||||
const { currentSource } = storeToRefs(store);
|
||||
*/
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -19,7 +19,10 @@ import { useSourceStore } from "@/store";
|
||||
|
||||
const store = useSourceStore();
|
||||
|
||||
const current_tab = store.currentTab;
|
||||
const current_tab = computed({
|
||||
get:() => store.currentTab,
|
||||
set:(val) => store.currentTab = val
|
||||
});
|
||||
|
||||
const tabData = ref([
|
||||
["editTab", "编辑源"],
|
||||
|
||||
@@ -166,7 +166,7 @@ const redo = () => {
|
||||
};
|
||||
|
||||
const saveSource = () => {
|
||||
let isBookSource = /bookSource/.test(location.href),
|
||||
let isBookSource = /bookSource/i.test(location.href),
|
||||
/** @type {import("@/source.js").Source} */
|
||||
source = store.currentSource;
|
||||
if (isInvaildSource(source)) {
|
||||
|
||||
@@ -19,7 +19,7 @@ export const useSourceStore = defineStore("source", {
|
||||
/** @type {import("@/source").Source[]} */
|
||||
savedSources: [], // 批量保存到阅读app成功的源
|
||||
/** @type {import("@/source").Source} */
|
||||
currentSource: emptySource, // 当前编辑的源
|
||||
currentSource: JSON.parse(JSON.stringify(emptySource)), // 当前编辑的源
|
||||
currentTab: localStorage.getItem("tabName") || "editTab",
|
||||
editTabSource: {}, // 生成序列化的json数据
|
||||
isDebuging: false,
|
||||
@@ -119,7 +119,7 @@ export const useSourceStore = defineStore("source", {
|
||||
},
|
||||
clearEdit() {
|
||||
this.editTabSource = {};
|
||||
this.currentSource = emptySource;
|
||||
this.currentSource = JSON.parse(JSON.stringify(emptySource)); //复制一份新对象
|
||||
},
|
||||
|
||||
// clear all source
|
||||
|
||||
Reference in New Issue
Block a user