inertia-bootstrap-forms 1.0.50 → 1.0.52

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/index.d.ts CHANGED
@@ -123,7 +123,34 @@ export const CheckboxButtonInput: DefineComponent<{
123
123
  export const CheckboxInput: DefineComponent<{}, {}, any>;
124
124
  export const CheckboxToggle: DefineComponent<{}, {}, any>;
125
125
  export const countryCodes: any;
126
- export const EditorInput: DefineComponent<{}, {}, any>;
126
+ export const EditorInput: DefineComponent<{
127
+ name: {
128
+ type: String,
129
+ required: true,
130
+ },
131
+ modelValue: String,
132
+ placeholder: {
133
+ type: String,
134
+ default: 'اینجا بنویسید...',
135
+ },
136
+ invalid: Boolean,
137
+ allowLink: Boolean,
138
+ height: Number,
139
+ minHeight: Number,
140
+ useStyle: {
141
+ type: Boolean,
142
+ default: false,
143
+ },
144
+ modules: {
145
+ default: [],
146
+ required: false,
147
+ },
148
+ options: {
149
+ type: Object,
150
+ default: {},
151
+ required: false,
152
+ },
153
+ }, {}, any>;
127
154
  export const EmailInput: DefineComponent<{}, {}, any>;
128
155
  export const DropzoneInput: DefineComponent<{}, {}, any>;
129
156
  export const FileInput: DefineComponent<{}, {}, any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inertia-bootstrap-forms",
3
- "version": "1.0.50",
3
+ "version": "1.0.52",
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",
@@ -3,142 +3,71 @@ import Editor from '@tinymce/tinymce-vue';
3
3
  import {computed, defineComponent, inject} from "vue";
4
4
 
5
5
  export default defineComponent({
6
- components: {Editor},
7
- props: {
8
- name: {
9
- type: String,
10
- required: true,
11
- },
12
- modelValue: String,
13
- placeholder: {
14
- type: String,
15
- default: 'اینجا بنویسید...',
16
- },
17
- invalid: Boolean,
18
- allowLink: Boolean,
19
- height: Number,
20
- minHeight: Number,
21
- useStyle: {
22
- type: Boolean,
23
- default: false,
24
- },
25
- modules: {
26
- default: [],
27
- required: false,
28
- },
6
+ components: {Editor},
7
+ props: {
8
+ name: {
9
+ type: String,
10
+ required: true,
29
11
  },
30
- setup(props) {
31
- let form = inject('form', {
32
- errors: {},
33
- getID(name) {
34
- return name;
35
- }
36
- });
37
- let group = inject('group', {});
12
+ placeholder: {
13
+ type: String,
14
+ default: '',
15
+ required: false,
16
+ },
17
+ modelValue: String,
18
+ options: {
19
+ type: Object,
20
+ default: {},
21
+ required: false,
22
+ },
23
+ },
24
+ setup(props) {
25
+ let form = inject('form', {
26
+ errors: {},
27
+ getID(name) {
28
+ return name;
29
+ }
30
+ });
31
+ let group = inject('group', {});
38
32
 
39
- const modelValue = computed({
40
- get() {
41
- return (group.value && form.value[group.value.name]) ? group.value?.getData(props.name) : form.value[props.name];
42
- },
43
- set(value) {
44
- if (group?.value?.name) {
45
- group.value.setData(props.name, value);
46
- } else {
47
- form.value[props.name] = value;
48
- }
33
+ const modelValue = computed({
34
+ get() {
35
+ return (group.value && form.value[group.value.name]) ? group.value?.getData(props.name) : form.value[props.name];
36
+ },
37
+ set(value) {
38
+ if (group?.value?.name) {
39
+ group.value.setData(props.name, value);
40
+ } else {
41
+ form.value[props.name] = value;
49
42
  }
50
- });
43
+ }
44
+ });
51
45
 
52
- return {modelValue, form, group};
53
- },
54
- emits: ['update:modelValue'],
46
+ return {modelValue, form, group};
47
+ },
48
+ emits: ['update:modelValue'],
55
49
  })
56
50
  </script>
57
51
 
58
52
  <template>
59
- <Editor
60
- api-key="tbws10u99swxhai03qolxykukvqw99jd4nw9q8z34aocvc4r"
61
- tinymce-script-src="/js/tinymce/tinymce.min.js"
62
- v-model="modelValue"
63
- :init="{
64
- base_url: '/js/tinymce/',
65
- disabled: false,
66
- inline: false,
67
- toolbar_sticky: true,
68
- menubar: false,
69
- contextmenu: false,
70
- branding: false,
71
- font_formats: true,
72
- directionality: 'rtl',
73
- placeholder: placeholder,
74
- plugins: [
75
- ...modules,
76
- 'link',
77
- 'lists',
78
- 'directionality',
79
- 'fullscreen',
80
- 'wordcount',
81
- 'table',
82
- 'autosave',
83
- 'autoresize',
84
- ],
85
- style_formats : [
86
- {title : 'وسط چین', classes : 'text-center', block: 'div'},
87
- {title : 'فاصله از بالا و پایین', classes : 'my-3', block: 'div'},
88
- {title : 'باکس اطلاعات', classes : 'code-box', block: 'span'},
89
- ],
90
- setup: function(editor) {
91
- // editor.on('init', function(e) {
92
- // editor.setContent(modelValue || '');
93
- // });
94
- //
95
- // editor.on('paste cut reset keyup input focusout', function(e) {
96
- // // console.log('form', form);
97
- // // $emit('update:modelValue', editor.getContent());
98
- // });
99
- },
100
- language: 'fa',
101
- toolbar: (useStyle ? 'styles |' : '') + 'fontsize | bold italic h1 h2 h3 h4 | link | numlist bullist | alignjustify aligncenter | table image link unlink | rtl ltr | pagebreak codesample | fullscreen code',
102
- fullscreen: true,
103
- auto_save: true,
104
- auto_link: true,
105
- // images_upload_url: 'files/upload',
106
- // images_upload_handler: this.uploader,
107
- images_file_types: 'jpeg,jpg,png',
108
- autoresize_bottom_margin: 50,
109
- allow_link: !!this.allowLink,
110
- allow_style: true,
111
- allow_link_style: false,
112
- height: this.height || 400,
113
- min_height: (this.minHeight || this.height) || 400,
114
- allow_code: false,
115
- autoresize_on_init: true,
116
- autosave_ask_before_unload: false,
117
- autosave_interval: '5s',
118
- autosave_restore_when_empty: true,
119
- paste_data_images: false,
120
- paste_block_drop: false,
121
- relative_urls: false,
122
- remove_script_host: false,
123
- paste_as_text: true,
124
- valid_elements: 'p,a,b,strong,i,em,h1,h2,h3,h4,h5,ul,ol,li,img,br',
125
- paste_word_valid_elements: 'p,a,b,strong,i,em,h1,h2,h3,h4,h5,ul,ol,li,img,br',
126
- paste_tab_spaces: 0,
127
- default_link_target: '_blank',
128
- link_assume_external_targets: true,
129
- link_quicklink: true,
130
- powerpaste_word_import: 'clean',
131
- powerpaste_html_import: 'clean',
132
- auto_refresh_interval: 500,
133
- convert_urls: false,
134
- verify_html: false,
135
- valid_children: '+a[div|h1|h2|h3|h4|h5|h6|p|#text]',
136
- }"
137
- />
53
+ <Editor
54
+ v-model="modelValue"
55
+ class="tiny-editor-input-el"
56
+ :init="{
57
+ placeholder: this.placeholder,
58
+ ...options
59
+ }"
60
+ />
138
61
  </template>
139
- <style scoped>
140
- textarea {
141
- width: 100%;
142
- min-height: 200px;
62
+ <style>
63
+ textarea.tiny-editor-input-el {
64
+ width: 100%;
65
+ min-height: 200px;
66
+ background-color: transparent;
67
+ border: 0;
68
+ outline: none;
69
+ background-image: url("css/loader.gif");
70
+ background-repeat: no-repeat;
71
+ background-position: center center;
143
72
  }
144
- </style>
73
+ </style>
Binary file