Skip to content

Commit

Permalink
Merge branch 'master' into fix-code-pasting-macos
Browse files Browse the repository at this point in the history
  • Loading branch information
Ironicbay authored Jul 19, 2024
2 parents 5a77fda + ed6d288 commit 84dc164
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
17 changes: 13 additions & 4 deletions lib/components/ms-textarea/MsTextarea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
}"
ref="textareaRef"
:placeholder="$msTranslate(placeholder)"
:value="modelValue"
v-model="textValue"
v-bind="$attrs"
@ion-input="onChange($event.detail.value || '')"
Expand All @@ -41,8 +40,7 @@
<script setup lang="ts">
import { Translatable } from '@lib/services/translation';
import { IonTextarea } from '@ionic/vue';
import { ref } from 'vue';
import { useAttrs } from 'vue';
import { ref, watch, onUnmounted, useAttrs } from 'vue';
// Rows defines the height of the area in number of rows
// Autogrow is disabled by default, enable stretching the area horizontally and
Expand Down Expand Up @@ -77,6 +75,13 @@ const props = withDefaults(defineProps<Props>(), {
const textareaRef = ref();
const textValue = ref(props.modelValue ?? '');
const cancelWatch = watch(
() => props.modelValue,
(newValue) => {
textValue.value = newValue ?? '';
},
);
const emits = defineEmits<{
(e: 'update:modelValue', value: string): void;
(e: 'change', value: string): void;
Expand All @@ -87,6 +92,10 @@ defineExpose({
selectText,
});
onUnmounted(() => {
cancelWatch();
});
function setFocus(): void {
setTimeout(() => {
if (textareaRef.value && textareaRef.value.$el) {
Expand Down Expand Up @@ -150,7 +159,7 @@ async function onChange(value: string): Promise<void> {
margin-left: auto;
&-default {
color: var(--parsec-color-secondary-grey);
color: var(--parsec-color-light-secondary-grey);
}
&-warn {
Expand Down
8 changes: 4 additions & 4 deletions lib/components/ms-toggle/MsBooleanToogle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
<ion-text
type="button"
class="button-view button-medium"
:class="{ 'button-disabled': modelValue === Answer.No }"
:class="{ 'button-disabled': modelValue === Answer.Yes }"
:disabled="modelValue === Answer.Yes"
@click="$emit('update:modelValue', Answer.No)"
@click="$emit('update:modelValue', Answer.Yes)"
>
{{ yesLabel ? $msTranslate(yesLabel) : $msTranslate('lib.components.msBooleanToogle.yes') }}
</ion-text>
<ion-text
type="button"
class="button-view button-medium"
:class="{ 'button-disabled': modelValue === Answer.No }"
:disabled="modelValue === Answer.No"
:class="{ 'button-disabled': modelValue === Answer.Yes }"
@click="$emit('update:modelValue', Answer.Yes)"
@click="$emit('update:modelValue', Answer.No)"
>
{{ noLabel ? $msTranslate(noLabel) : $msTranslate('lib.components.msBooleanToogle.no') }}
</ion-text>
Expand Down

0 comments on commit 84dc164

Please sign in to comment.