Skip to content

Commit 1a43227

Browse files
authored
Merge pull request #10 from murdercode/wijaksanapanji/master
Wijaksanapanji/master
2 parents 4ef9b6b + b8f51b7 commit 1a43227

File tree

5 files changed

+15
-20
lines changed

5 files changed

+15
-20
lines changed

dist/js/field.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/mix-manifest.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"/js/field.js": "/js/field.js",
3-
"/css/field.css": "/css/field.css"
2+
"/js/field.js": "/js/field.js"
43
}

resources/js/components/FormField.vue

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
<template>
2-
<DefaultField :field="field" :errors="errors" :show-help-text="showHelpText" :full-width-content="fullWidthContent">
2+
<DefaultField :field="currentField" :errors="errors" :show-help-text="showHelpText" :full-width-content="fullWidthContent">
33
<template #field>
44
<editor
5-
:id="field.attribute"
5+
:id="currentField.attribute"
66
:cloud-channel="6"
77
v-model="value"
8-
:api-key="field.options.apiKey"
9-
:init="field.options.init"
10-
:plugins="field.options.plugins"
11-
:toolbar="field.options.toolbar"
12-
:placeholder="field.name"
8+
:api-key="currentField.options.apiKey"
9+
:init="currentField.options.init"
10+
:plugins="currentField.options.plugins"
11+
:toolbar="currentField.options.toolbar"
12+
:placeholder="currentField.name"
1313
/>
1414
</template>
1515
</DefaultField>
1616
</template>
1717

1818
<script>
19-
import { FormField, HandlesValidationErrors } from "laravel-nova";
19+
import { DependentFormField, HandlesValidationErrors } from "laravel-nova";
2020
import Editor from "@tinymce/tinymce-vue";
2121
2222
export default {
23-
mixins: [FormField, HandlesValidationErrors],
23+
mixins: [DependentFormField, HandlesValidationErrors],
2424
25-
props: ["resourceName", "resourceId", "field", "options"],
25+
props: ["resourceName", "resourceId", "options"],
2626
2727
components: {
2828
editor: Editor,
@@ -63,12 +63,6 @@ export default {
6363
? "dark"
6464
: "default";
6565
},
66-
/*
67-
* Set the initial, internal value for the field.
68-
*/
69-
setInitialValue() {
70-
this.value = this.field.value || "";
71-
},
7266
7367
/**
7468
* Fill the given FormData object with the field's internal value.

src/TinymceEditor.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
namespace Murdercode\TinymceEditor;
44

55
use Laravel\Nova\Fields\Field;
6+
use Laravel\Nova\Fields\SupportsDependentFields;
67

78
class TinymceEditor extends Field
89
{
10+
use SupportsDependentFields;
11+
912
/**
1013
* The field's component.
1114
*

webpack.mix.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ mix
77
.setPublicPath('dist')
88
.js('resources/js/field.js', 'js')
99
.vue({ version: 3 })
10-
.css('resources/css/field.css', 'css')
1110
.nova('murdercode/nova4-tinymce-editor')

0 commit comments

Comments
 (0)