mktcms 0.1.41 → 0.1.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mktcms",
3
3
  "configKey": "mktcms",
4
- "version": "0.1.41",
4
+ "version": "0.1.42",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -24,7 +24,7 @@ async function saveMarkdown() {
24
24
  isSaving.value = false;
25
25
  savingSuccessful.value = true;
26
26
  }
27
- const mode = ref("edit");
27
+ const mode = ref("preview");
28
28
  </script>
29
29
 
30
30
  <template>
@@ -34,18 +34,18 @@ const mode = ref("edit");
34
34
  <button
35
35
  type="button"
36
36
  class="button secondary flex-1"
37
- :disabled="mode === 'edit'"
38
- @click="mode = 'edit'"
37
+ :disabled="mode === 'preview'"
38
+ @click="mode = 'preview'"
39
39
  >
40
- Bearbeiten
40
+ Vorschau
41
41
  </button>
42
42
  <button
43
43
  type="button"
44
44
  class="button secondary flex-1"
45
- :disabled="mode === 'preview'"
46
- @click="mode = 'preview'"
45
+ :disabled="mode === 'edit'"
46
+ @click="mode = 'edit'"
47
47
  >
48
- Vorschau
48
+ Bearbeiten
49
49
  </button>
50
50
  </div>
51
51
 
@@ -7,5 +7,6 @@ export declare function useForm(endpoint: string, successMessageText: string, er
7
7
  fieldsTouched: import("vue").Ref<Record<string, boolean>, Record<string, boolean>>;
8
8
  validationErrorsFor: (field: string) => string[];
9
9
  validate: (body: Record<string, any>) => boolean;
10
+ touchField: (field: string) => void;
10
11
  send: (body: Record<string, any>) => Promise<void>;
11
12
  };
@@ -20,6 +20,12 @@ export function useForm(endpoint, successMessageText, errorMessageText, validati
20
20
  if (!fieldsTouched.value[field]) return [];
21
21
  return validationErrors.value[field] || [];
22
22
  }
23
+ function touchField(field) {
24
+ fieldsTouched.value = {
25
+ ...fieldsTouched.value,
26
+ [field]: true
27
+ };
28
+ }
23
29
  async function send(body) {
24
30
  if (isSending.value) return;
25
31
  successMessage.value = "";
@@ -48,6 +54,7 @@ export function useForm(endpoint, successMessageText, errorMessageText, validati
48
54
  fieldsTouched,
49
55
  validationErrorsFor,
50
56
  validate,
57
+ touchField,
51
58
  send
52
59
  };
53
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mktcms",
3
- "version": "0.1.41",
3
+ "version": "0.1.42",
4
4
  "description": "Simple CMS module for Nuxt",
5
5
  "repository": "mktcode/mktcms",
6
6
  "license": "MIT",