quasar-ui-danx 0.4.71 → 0.4.72

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quasar-ui-danx",
3
- "version": "0.4.71",
3
+ "version": "0.4.72",
4
4
  "author": "Dan <dan@flytedesk.com>",
5
5
  "description": "DanX Vue / Quasar component library",
6
6
  "license": "MIT",
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <div class="inline-block relative">
3
3
  <div
4
+ ref="textDiv"
4
5
  :contenteditable="readonly ? 'false' : 'true'"
5
6
  class="relative inline-block transition duration-300 outline-none outline-offset-0 border-none rounded-sm z-10 min-w-10 min-h-10"
6
7
  :style="{minWidth, minHeight}"
@@ -8,9 +9,7 @@
8
9
  @input="onInput"
9
10
  @focusin="hasFocus = true"
10
11
  @focusout="hasFocus = false"
11
- >
12
- {{ text }}
13
- </div>
12
+ />
14
13
  <div
15
14
  v-if="!text && placeholder && !hasFocus && !readonly"
16
15
  ref="placeholderDiv"
@@ -44,6 +43,7 @@ const props = withDefaults(defineProps<{
44
43
  });
45
44
 
46
45
  const text = ref(props.modelValue);
46
+ const textDiv = ref();
47
47
  const placeholderDiv = ref<Element | null>(null);
48
48
  const minWidth = ref<string>("0");
49
49
  const minHeight = ref<string>("0");
@@ -57,9 +57,17 @@ onMounted(() => {
57
57
  }
58
58
  });
59
59
 
60
+ // Watch external modelValue and update the contenteditable div directly
60
61
  watch(() => props.modelValue, (value) => {
61
- if (!hasFocus.value)
62
+ if (!hasFocus.value && textDiv.value) {
63
+ textDiv.value.innerText = value;
62
64
  text.value = value;
65
+ }
66
+ });
67
+
68
+ onMounted(() => {
69
+ // Set the initial value of the contenteditable div
70
+ textDiv.value.innerText = text.value;
63
71
  });
64
72
 
65
73
  const debouncedChange = useDebounceFn(() => {