Skip to content

Commit

Permalink
fix show/hide field
Browse files Browse the repository at this point in the history
  • Loading branch information
webard committed Aug 7, 2024
1 parent eca6cd2 commit 802f9ac
Show file tree
Hide file tree
Showing 3 changed files with 51,196 additions and 9 deletions.
8 changes: 6 additions & 2 deletions dist/css/field.css

Large diffs are not rendered by default.

51,157 changes: 51,155 additions & 2 deletions dist/js/field.js

Large diffs are not rendered by default.

40 changes: 35 additions & 5 deletions resources/js/components/FormField.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
<template>
<DefaultField :field="field" :errors="errors" :show-help-text="showHelpText" :full-width-content="fullWidthContent">
<DefaultField
:field="currentField"
:errors="errors"
:show-help-text="showHelpText"
:full-width-content="fullWidthContent">
<template #field>

<a ref="emojianchor"></a>
<textarea ref="editor" :id="field.attribute" :class="errorClasses" class="w-full" style="height:200px"
:value="value" />

<textarea
ref="editor"
:id="field.attribute"
:class="errorClasses"
class="w-full"
style="height:200px"
:value="value"
/>
</template>
</DefaultField>
</template>
Expand All @@ -30,6 +38,16 @@ export default {
}
},
watch: {
currentlyIsVisible(current, previous) {
if (current === true && previous === false) {
this.$nextTick(() => this.handleShowingComponent())
} else if (current === false && previous === true) {
this.handleHidingComponent()
}
},
},
created() {
this.setInitialValue()
},
Expand Down Expand Up @@ -62,6 +80,10 @@ export default {
},
destroyEditor() {
// this.editor.destroy();
},
/*
* Set the initial, internal value for the field.
Expand All @@ -87,6 +109,14 @@ export default {
this.handleChange(this.currentField.value ?? this.value)
this.index++
},
handleShowingComponent() {
this.initEditor();
},
handleHidingComponent() {
this.destroyEditor()
},
},
}
</script>

0 comments on commit 802f9ac

Please sign in to comment.