inertia-bootstrap-forms 1.0.68 → 1.0.70

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": "inertia-bootstrap-forms",
3
- "version": "1.0.68",
3
+ "version": "1.0.70",
4
4
  "description": "Create bootstrap forms with inertia and twitter bootstrap",
5
5
  "main": "dist/inertia-bootstrap-forms.cjs.js",
6
6
  "module": "dist/inertia-bootstrap-forms.es.js",
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import Editor from '@tinymce/tinymce-vue';
3
- import {computed, defineComponent, inject} from "vue";
3
+ import {computed, defineComponent, inject, ref} from "vue";
4
4
 
5
5
  export default defineComponent({
6
6
  components: {Editor},
@@ -24,7 +24,18 @@ export default defineComponent({
24
24
  required: false,
25
25
  },
26
26
  },
27
- setup(props) {
27
+ setup(props, {expose, emit}) {
28
+ const editorRef = ref(null)
29
+ const tinyInstance = ref(null)
30
+
31
+ const handleInit = (evt, editor) => {
32
+ tinyInstance.value = editor
33
+ }
34
+
35
+ expose({
36
+ editor: () => tinyInstance.value
37
+ })
38
+
28
39
  let form = inject('form', {
29
40
  errors: {},
30
41
  getID(name) {
@@ -46,21 +57,24 @@ export default defineComponent({
46
57
  }
47
58
  });
48
59
 
49
- return {modelValue, form, group};
60
+ return {modelValue, form, group, editorRef, handleInit};
50
61
  },
51
- emits: ['update:modelValue'],
52
- methods: {
53
- editor(){
54
- return this.refs.editor.editor;
62
+ emits: ['update:modelValue', 'setContent'],
63
+ methods:{
64
+ setContentInModelValue(content, format, paste, selection){
65
+ this.modelValue = content;
66
+ this.$emit('setContent', content, format, paste, selection);
67
+ this.$emit('update:modelValue', content);
55
68
  }
56
- },
57
- expose: ['editor'],
69
+ }
58
70
  })
59
71
  </script>
60
72
 
61
73
  <template>
62
74
  <Editor
63
- ref="editor"
75
+ ref="editorRef"
76
+ @init="handleInit"
77
+ @setContent="setContentInModelValue"
64
78
  v-model="modelValue"
65
79
  class="tiny-editor-input-el"
66
80
  :init="{
@@ -82,7 +96,7 @@ textarea.tiny-editor-input-el {
82
96
  background-position: center center;
83
97
  }
84
98
 
85
- .tox .tox-edit-area::before{
99
+ .tox .tox-edit-area::before {
86
100
  display: none;
87
101
  }
88
102
  </style>