HomeDashboard/.venv/lib/python3.12/site-packages/nicegui/elements/editor.js
2026-01-03 14:54:18 +01:00

35 lines
722 B
JavaScript

export default {
template: `
<q-editor ref="qRef" v-model="inputValue">
<template v-for="(_, slot) in $slots" v-slot:[slot]="slotProps">
<slot :name="slot" v-bind="slotProps || {}" />
</template>
</q-editor>
`,
props: {
value: String,
},
data() {
return {
inputValue: this.value,
emitting: true,
};
},
watch: {
value(newValue) {
this.emitting = false;
this.inputValue = newValue;
this.$nextTick(() => (this.emitting = true));
},
inputValue(newValue) {
if (!this.emitting) return;
this.$emit("update:value", newValue);
},
},
methods: {
updateValue() {
this.inputValue = this.value;
},
},
};