Skip to content

Commit 3b8d02e

Browse files
Merge pull request #93 from JSON-ms/dev
Fix bug with live content update
2 parents 0f2e0fd + 002cbc9 commit 3b8d02e

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@json.ms/www",
33
"private": true,
44
"type": "module",
5-
"version": "1.2.19",
5+
"version": "1.2.20",
66
"scripts": {
77
"dev": "vite --host",
88
"build": "run-p type-check \"build-only {@}\" --",

src/components/StructureEditor.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {useGlobalStore} from '@/stores/global';
1212
import {useTypings} from "@/composables/typings";
1313
import {useModelStore} from "@/stores/model";
1414
import {useSyncing} from "@/composables/syncing";
15+
import {useUserData} from "@/composables/user-data";
1516
// import yaml from 'js-yaml';
1617
1718
const emit = defineEmits(['save', 'create', 'change', 'focus', 'blur']);
@@ -23,8 +24,8 @@ const { columns = false, userData } = defineProps<{
2324
}>();
2425
const { canSaveStructure, yamlException, structureStates } = useStructure();
2526
const modelStore = useModelStore();
26-
const { getTypescriptTypings, getTypescriptDefaultObj, lastStateTimestamp } = useTypings();
27-
const { isFolderSynced, askToSyncFolder, unSyncFolder } = useSyncing();
27+
const { getTypescriptTypings, getTypescriptDefaultObj } = useTypings();
28+
const { isFolderSynced, askToSyncFolder, unSyncFolder, lastStateTimestamp } = useSyncing();
2829
const showParsingDelay = ref(false);
2930
const progressBarValue = ref(0);
3031
const progressBarCompleted = ref(false);
@@ -108,11 +109,10 @@ const value = computed({
108109
return structure.value.content;
109110
},
110111
set(value: string) {
112+
modelStore.setTemporaryContent(value);
111113
if (globalStore.userSettings.data.editorLiveUpdate) {
112114
emit('change', value);
113115
} else {
114-
modelStore.setTemporaryContent(value);
115-
116116
clearInterval(parseInterval);
117117
clearInterval(showParseInterval);
118118
clearInterval(parseValueInterval);
@@ -582,7 +582,7 @@ watch(() => globalStore.userSettings.data, () => {
582582
size="small"
583583
/>
584584
<v-tooltip
585-
v-if="isFolderSynced(modelStore.structure)"
585+
v-if="modelStore.structure.server_url || isFolderSynced(modelStore.structure)"
586586
text="Save (CTRL+S)"
587587
location="bottom"
588588
>
@@ -591,7 +591,7 @@ watch(() => globalStore.userSettings.data, () => {
591591
v-if="structure"
592592
v-bind="props"
593593
:loading="structureStates.saving"
594-
:disabled="!canSaveStructure || structureStates.saving || structureStates.saved"
594+
:disabled="!canSaveStructure || (!modelStore.structure.server_url && !isFolderSynced(modelStore.structure)) || structureStates.saving || structureStates.saved"
595595
:prepend-icon="!structureStates.saved ? 'mdi-content-save' : 'mdi-check'"
596596
variant="outlined"
597597
color="primary"

src/components/Toolbar.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,18 +365,21 @@ watch(() => currentRoute.params.locale, () => {
365365
<v-divider class="my-1" />
366366
<v-list-item
367367
:disabled="userDataLoading || !canFetchUserData"
368+
:subtitle="!canFetchUserData ? 'Requires an endpoint' : ''"
368369
prepend-icon="mdi-monitor-arrow-down"
369370
title="Fetch data"
370371
@click="onFetchUserData"
371372
/>
372373
<v-list-item
373374
:disabled="downloading || !canInteractWithServer"
375+
:subtitle="!canInteractWithServer ? 'Requires an endpoint' : ''"
374376
title="Download data"
375377
prepend-icon="mdi-tray-arrow-down"
376378
@click="downloadUserData"
377379
/>
378380
<v-list-item
379381
:disabled="migrating || !canInteractWithServer"
382+
:subtitle="!canInteractWithServer ? 'Requires an endpoint' : ''"
380383
title="Migrate data"
381384
prepend-icon="mdi-folder-arrow-left-right-outline"
382385
@click="onMigrateData"

0 commit comments

Comments
 (0)