renusify 2.0.0 → 2.0.2

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.
Files changed (67) hide show
  1. package/components/app/style.scss +2 -2
  2. package/components/bar/bottomNavigationCircle.vue +4 -4
  3. package/components/bar/scss/bottomNav.scss +3 -4
  4. package/components/bar/scss/toolbar.scss +5 -3
  5. package/components/bar/toolbar/menuChilds.vue +3 -3
  6. package/components/bar/toolbar/menuLaptop.vue +16 -16
  7. package/components/bar/toolbar/menuMob.vue +11 -11
  8. package/components/bar/toolbar/mixin.js +0 -2
  9. package/components/bar/toolbar/mobile.vue +2 -2
  10. package/components/breadcrumb/index.vue +5 -6
  11. package/components/breadcrumb/style.scss +4 -0
  12. package/components/button/style.scss +3 -4
  13. package/components/calendar/index.vue +24 -22
  14. package/components/calendar/month.vue +1 -1
  15. package/components/calendar/year.vue +1 -1
  16. package/components/card/index.vue +15 -15
  17. package/components/card/style.scss +15 -18
  18. package/components/chart/worldMap.vue +3 -1
  19. package/components/chat/chatInput.vue +1 -0
  20. package/components/chat/chatMsg.vue +2 -2
  21. package/components/chat/index.vue +2 -2
  22. package/components/chip/style.scss +6 -2
  23. package/components/codeEditor/index.vue +2 -2
  24. package/components/confirm/index.vue +0 -2
  25. package/components/container/style.scss +1 -1
  26. package/components/cropper/index.vue +1 -1
  27. package/components/form/camInput.vue +2 -2
  28. package/components/form/checkbox.vue +3 -2
  29. package/components/form/colorPicker/index.vue +9 -4
  30. package/components/form/colorPicker/picker.vue +0 -5
  31. package/components/form/datePicker/index.vue +9 -9
  32. package/components/form/datePicker/month.vue +1 -1
  33. package/components/form/datePicker/year.vue +1 -1
  34. package/components/form/fileUploader/single.vue +0 -2
  35. package/components/form/input.vue +18 -8
  36. package/components/form/inputTel/index.vue +3 -3
  37. package/components/form/json/JsonView.vue +3 -3
  38. package/components/form/json/index.vue +4 -4
  39. package/components/form/radioInput.vue +3 -3
  40. package/components/form/range.vue +2 -2
  41. package/components/form/rating.vue +2 -2
  42. package/components/form/switch.vue +3 -3
  43. package/components/form/text-editor/index.vue +555 -549
  44. package/components/form/text-editor/style.scss +12 -2
  45. package/components/form/timepicker/index.vue +6 -4
  46. package/components/form/timepicker/range.vue +4 -4
  47. package/components/form/timepicker/timepicker.vue +3 -3
  48. package/components/form/unit-input.vue +1 -1
  49. package/components/formCreator/index.vue +2 -2
  50. package/components/infinite/index.vue +5 -5
  51. package/components/list/style.scss +5 -15
  52. package/components/map/index.vue +0 -1
  53. package/components/map/route.vue +4 -2
  54. package/components/menu/index.vue +1 -1
  55. package/components/modal/style.scss +3 -1
  56. package/components/notify/index.vue +3 -2
  57. package/components/progress/line.vue +26 -27
  58. package/components/progress/style.scss +3 -3
  59. package/components/searchBox/index.vue +3 -7
  60. package/components/slider/index.vue +2 -2
  61. package/components/table/crud/header.vue +15 -15
  62. package/components/table/crud/index.vue +8 -5
  63. package/components/table/index.vue +0 -2
  64. package/components/table/style.scss +2 -2
  65. package/components/tabs/index.vue +1 -1
  66. package/package.json +1 -1
  67. package/tools/helper.js +4 -3
@@ -1,587 +1,593 @@
1
1
  <template>
2
- <r-container :class="`${$r.prefix}text-editor container-fluid`">
3
- <r-row class="editor-header h-center">
4
- <r-col class="col-auto">
5
- <r-btn-group @update:modelValue="handle_dir" :items="items_dir"></r-btn-group>
2
+ <r-container :class="[`${$r.prefix}text-editor container-fluid`,{'input-tile':c_tile}]">
3
+ <r-row class="editor-header h-center">
4
+ <r-col class="col-auto">
5
+ <r-btn-group :items="items_dir" @update:modelValue="handle_dir"></r-btn-group>
6
+ </r-col>
7
+ <r-col class="col-auto">
8
+ <r-btn-group :items="menu" exact is-select @open="handleOpen" @update:modelValue="addCss">
9
+ <template v-slot:list="{item}">
10
+ <div :class="'color-white-text'===item['value']?'color-black '+item['value']:item['value']"
11
+ class="list-title pa-2"
12
+ >{{ item['text'] }}
13
+ </div>
14
+ </template>
15
+ </r-btn-group>
16
+ </r-col>
17
+ <r-col class="col-auto">
18
+ <r-btn-group :items="items_format" exact
19
+ @update:modelValue="format($event)"></r-btn-group>
20
+ </r-col>
21
+
22
+ <r-col class="col-auto">
23
+ <r-btn-group :items="items_handle"
24
+ @update:modelValue="handle($event)"></r-btn-group>
25
+ </r-col>
26
+ <r-col class="col-auto">
27
+ <r-btn-group :items="items_undo" @update:modelValue="format($event)"></r-btn-group>
28
+ </r-col>
29
+ <r-col class="col-auto">
30
+ <r-btn icon text @click.prevent="$helper.copy(content(),$t('editor_content_copy','renusify'))">
31
+ <r-icon v-html="$r.icons.copy"></r-icon>
32
+ </r-btn>
33
+ </r-col>
34
+ </r-row>
35
+ <r-row>
36
+ <r-col v-if="selectElm&&!selectElm.classList.contains('editor-content')" class="col-12">
37
+ <r-select-input :label="$t('class','renusify')" :model-value="[...selectElm.classList]"
38
+ justValue
39
+ multiple
40
+ tags
41
+ @update:model-value="addClass"></r-select-input>
42
+ </r-col>
43
+ <r-col class="col-12 ltr">
44
+ <span v-for="(item,i) in currentPath" :key="i" class="cursor-pointer" @click.prevent="borderd(item)">
45
+ <span :class="{'color-one-text':selectElm===item}">{{ item.nodeName }} > </span>
46
+ </span>
47
+ </r-col>
48
+ <r-col class="col-12">
49
+ <r-input
50
+ :model-value="is_object?modelValue.text:modelValue"
51
+ hide
52
+ v-bind="$attrs">
53
+ <template v-slot="{uid}">
54
+ <div :id="uid"
55
+ :ref="'editorContent'+id"
56
+ class="editor-content" contenteditable="true"
57
+ @input="updateText()"
58
+ @keyup="bordered"
59
+ v-html="text" @click.prevent="bordered">
60
+ </div>
61
+ </template>
62
+ </r-input>
63
+ </r-col>
64
+ <r-col v-if="files.length>0" class="col-12">
65
+ <div v-for="(img,i) in files" :key="i"
66
+ class="ma-1 img-holder">
67
+ <r-btn class="color-error-text" icon @click.prevent="deleteImage(img,i)">
68
+ <r-icon v-html="$r.icons.delete"></r-icon>
69
+ </r-btn>
70
+ <r-img
71
+ :src="'/'+img"
72
+ alt="img"
73
+ height="100"></r-img>
74
+ </div>
75
+ </r-col>
76
+ </r-row>
77
+ <r-modal v-model="show"
78
+ :closable="false"
79
+ :closebtn="false">
80
+ <r-form v-model="valid1">
81
+ <r-container>
82
+ <r-row>
83
+ <r-col class="col-12 ltr">
84
+ <r-text-input v-model="link"
85
+ :label="$t('link','renusify')"
86
+ :rules="['required']"></r-text-input>
6
87
  </r-col>
7
- <r-col class="col-auto">
8
- <r-btn-group @update:modelValue="addCss" @open="handleOpen" is-select exact :items="menu">
9
- <template v-slot:list="{item}">
10
- <div class="list-title pa-2"
11
- :class="'color-white-text'===item['value']?'color-black '+item['value']:item['value']"
12
- >{{item['text']}}
13
- </div>
14
- </template>
15
- </r-btn-group>
88
+ <r-col class="col-12">
89
+ <r-switch-input v-model="target"
90
+ :label="$t('open_new_tab','renusify')"></r-switch-input>
16
91
  </r-col>
92
+ </r-row>
93
+ <r-row class="h-end">
17
94
  <r-col class="col-auto">
18
- <r-btn-group exact @update:modelValue="format($event)"
19
- :items="items_format"></r-btn-group>
95
+ <r-btn class="color-error-text"
96
+ outlined
97
+ @click.prevent="show=false">{{ $t('cancel', 'renusify') }}
98
+ </r-btn>
20
99
  </r-col>
21
-
22
100
  <r-col class="col-auto">
23
- <r-btn-group @update:modelValue="handle($event)"
24
- :items="items_handle"></r-btn-group>
101
+ <r-btn :disabled="!valid1"
102
+ class="color-success-text"
103
+ outlined
104
+ @click.prevent="handleForm()">{{ $t('send', 'renusify') }}
105
+ </r-btn>
25
106
  </r-col>
107
+ </r-row>
108
+ </r-container>
109
+ </r-form>
110
+ </r-modal>
111
+ <r-modal v-model="showImg"
112
+ :closable="false"
113
+ :closebtn="false">
114
+ <r-form v-model="valid2">
115
+ <r-container>
116
+ <r-file-input v-model="image"
117
+ :headers="headers"
118
+ :label="$t('image','renusify')"
119
+ :size="1"
120
+ :upload-link="uploadLink"
121
+ accept="image/*"></r-file-input>
122
+ <r-text-input v-model="img_alt"
123
+ :label="$t('img_alt','renusify')"
124
+ :rules="['required']"></r-text-input>
125
+ <r-number-input v-model="img_width" :label="$t('width','renusify')"
126
+ :rules="['required']"></r-number-input>
127
+ <r-number-input v-model="img_height" :label="$t('height','renusify')"
128
+ :rules="['required']"></r-number-input>
129
+ <r-row class="h-end">
26
130
  <r-col class="col-auto">
27
- <r-btn-group @update:modelValue="format($event)" :items="items_undo"></r-btn-group>
131
+ <r-btn class="color-error-text"
132
+ outlined
133
+ @click.prevent="showImg=false">{{ $t('cancel', 'renusify') }}
134
+ </r-btn>
28
135
  </r-col>
29
136
  <r-col class="col-auto">
30
- <r-btn icon text @click="$helper.copy(content(),$t('editor_content_copy','renusify'))">
31
- <r-icon v-html="$r.icons.copy"></r-icon>
32
- </r-btn>
33
- </r-col>
34
- </r-row>
35
- <r-row>
36
- <r-col class="col-12" v-if="selectElm&&!selectElm.classList.contains('editor-content')">
37
- <r-select-input :label="$t('class','renusify')" :model-value="[...selectElm.classList]"
38
- multiple
39
- tags
40
- justValue
41
- @update:model-value="addClass"></r-select-input>
137
+ <r-btn :disabled="!valid2"
138
+ class="color-success-text"
139
+ outlined
140
+ @click.prevent="handleImageForm()">{{ $t('send', 'renusify') }}
141
+ </r-btn>
42
142
  </r-col>
43
- <r-col class="col-12 ltr">
44
- <span v-for="(item,i) in currentPath" :key="i" class="cursor-pointer" @click.prevent="borderd(item)">
45
- <span :class="{'color-one-text':selectElm===item}">{{ item.nodeName }} > </span>
46
- </span>
47
- </r-col>
48
- <r-col class="col-12">
49
- <r-input
50
- v-bind="$attrs"
51
- :model-value="is_object?modelValue.text:modelValue"
52
- hide>
53
- <template v-slot="{uid}">
54
- <div :ref="'editorContent'+id"
55
- :id="uid"
56
- class="editor-content" contenteditable="true"
57
- @click="bordered"
58
- @keyup="bordered"
59
- @input="updateText()" v-html="text">
60
- </div>
61
- </template>
62
- </r-input>
143
+ </r-row>
144
+ </r-container>
145
+ </r-form>
146
+ </r-modal>
147
+ <r-modal v-model="showVideo"
148
+ :closable="false"
149
+ :closebtn="false">
150
+ <r-form v-model="valid2">
151
+ <r-container>
152
+ <r-file-input v-model="video"
153
+ :headers="headers"
154
+ :label="$t('video','renusify')"
155
+ :size="1"
156
+ :upload-link="uploadLink"
157
+ accept="video/mp4,video/webm"></r-file-input>
158
+ <r-number-input v-model="img_width" :label="$t('width','renusify')"
159
+ :rules="['required']"></r-number-input>
160
+ <r-number-input v-model="img_height" :label="$t('height','renusify')"
161
+ :rules="['required']"></r-number-input>
162
+ <r-row class="h-end">
163
+ <r-col class="col-auto">
164
+ <r-btn class="color-error-text"
165
+ outlined
166
+ @click.prevent="showVideo=false">{{ $t('cancel', 'renusify') }}
167
+ </r-btn>
63
168
  </r-col>
64
- <r-col class="col-12">
65
- <div class="ma-1 img-holder" v-for="(img,i) in files"
66
- :key="i">
67
- <r-btn icon class="color-error-text" @click="deleteImage(img,i)">
68
- <r-icon v-html="$r.icons.delete"></r-icon>
69
- </r-btn>
70
- <r-img
71
- :src="'/'+img"
72
- width="120"
73
- alt="img"
74
- height="100"></r-img>
75
- </div>
169
+ <r-col class="col-auto">
170
+ <r-btn :disabled="!valid2"
171
+ class="color-success-text"
172
+ outlined
173
+ @click.prevent="handleVideoForm()">{{ $t('send', 'renusify') }}
174
+ </r-btn>
76
175
  </r-col>
77
- </r-row>
78
- <r-modal :closable="false"
79
- :closebtn="false"
80
- v-model="show">
81
- <r-form v-model="valid1">
82
- <r-container class="sheet">
83
- <r-row>
84
- <r-col class="col-12 ltr">
85
- <r-text-input v-model="link"
86
- :label="$t('link','renusify')"
87
- :rules="['required']"></r-text-input>
88
- </r-col>
89
- <r-col class="col-12">
90
- <r-switch-input :label="$t('open_new_tab','renusify')"
91
- v-model="target"></r-switch-input>
92
- </r-col>
93
- </r-row>
94
- <r-row class="h-end">
95
- <r-col class="col-auto">
96
- <r-btn class="color-error-text"
97
- outlined
98
- @click.prevent="show=false">{{$t('cancel','renusify')}}
99
- </r-btn>
100
- </r-col>
101
- <r-col class="col-auto">
102
- <r-btn class="color-success-text"
103
- :disabled="!valid1"
104
- outlined
105
- @click.prevent="handleForm()">{{$t('send','renusify')}}
106
- </r-btn>
107
- </r-col>
108
- </r-row>
109
- </r-container>
110
- </r-form>
111
- </r-modal>
112
- <r-modal :closable="false"
113
- :closebtn="false"
114
- v-model="showImg">
115
- <r-form v-model="valid2">
116
- <r-container class="sheet">
117
- <r-file-input v-model="image"
118
- :label="$t('image','renusify')"
119
- :size="1"
120
- :headers="headers"
121
- :upload-link="uploadLink"
122
- accept="image/*"></r-file-input>
123
- <r-text-input v-model="img_alt"
124
- :label="$t('img_alt','renusify')"
125
- :rules="['required']"></r-text-input>
126
- <r-number-input v-model="img_width" :label="$t('width','renusify')"
127
- :rules="['required']"></r-number-input>
128
- <r-number-input v-model="img_height" :label="$t('height','renusify')"
129
- :rules="['required']"></r-number-input>
130
- <r-row class="h-end">
131
- <r-col class="col-auto">
132
- <r-btn class="color-error-text"
133
- outlined
134
- @click.prevent="showImg=false">{{ $t('cancel', 'renusify') }}
135
- </r-btn>
136
- </r-col>
137
- <r-col class="col-auto">
138
- <r-btn class="color-success-text"
139
- :disabled="!valid2"
140
- outlined
141
- @click.prevent="handleImageForm()">{{ $t('send', 'renusify') }}
142
- </r-btn>
143
- </r-col>
144
- </r-row>
145
- </r-container>
146
- </r-form>
147
- </r-modal>
148
- <r-modal :closable="false"
149
- :closebtn="false"
150
- v-model="showVideo">
151
- <r-form v-model="valid2">
152
- <r-container class="sheet">
153
- <r-file-input v-model="video"
154
- :label="$t('video','renusify')"
155
- :size="1"
156
- :headers="headers"
157
- :upload-link="uploadLink"
158
- accept="video/mp4,video/webm"></r-file-input>
159
- <r-number-input v-model="img_width" :label="$t('width','renusify')"
160
- :rules="['required']"></r-number-input>
161
- <r-number-input v-model="img_height" :label="$t('height','renusify')"
162
- :rules="['required']"></r-number-input>
163
- <r-row class="h-end">
164
- <r-col class="col-auto">
165
- <r-btn class="color-error-text"
166
- outlined
167
- @click.prevent="showVideo=false">{{ $t('cancel', 'renusify') }}
168
- </r-btn>
169
- </r-col>
170
- <r-col class="col-auto">
171
- <r-btn class="color-success-text"
172
- :disabled="!valid2"
173
- outlined
174
- @click.prevent="handleVideoForm()">{{ $t('send', 'renusify') }}
175
- </r-btn>
176
- </r-col>
177
- </r-row>
178
- </r-container>
179
- </r-form>
180
- </r-modal>
176
+ </r-row>
177
+ </r-container>
178
+ </r-form>
179
+ </r-modal>
181
180
 
182
- </r-container>
181
+ </r-container>
183
182
  </template>
184
183
 
185
184
  <script>
186
185
  import './style.scss'
187
186
 
188
187
  export default {
189
- name: 'r-text-editor',
190
- inheritAttrs: false,
191
- props: {
192
- uploadLink: {type: String, default: '/storage'},
193
- modelValue: {
194
- type: [Object, String], default: () => {
195
- return {
196
- text: '',
197
- files: []
198
- }
199
- }
200
- },
201
- headers: Object
202
- },
203
- emits:['update:modelValue'],
204
- data() {
205
- return {
206
- id: 'text_editor_' + this.$helper.uniqueId(12),
207
- text: this.modelValue && typeof this.modelValue === 'object' && 'text' in this.modelValue ? this.modelValue.text : this.modelValue,
208
- files: this.modelValue && typeof this.modelValue === 'object' && 'text' in this.modelValue ? this.modelValue.files : [],
209
- valid1: false,
210
- valid2: false,
211
- show: false,
212
- showImg: false,
213
- showVideo: false,
214
- img_width: 200,
215
- img_height: 200,
216
- video: [],
217
- image: [],
218
- img_alt: null,
219
- target: false,
220
- link: null,
221
- preSelected: null,
222
- currentPath: [],
223
- selectElm: null,
224
- items_undo: {
225
- 'undo': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88c3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8Z"/></svg>',
226
- 'redo': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 0 1 7.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6Z"/></svg>',
227
- },
228
- items_handle: {
229
- 'DIV': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M13 4a4 4 0 0 1 4 4a4 4 0 0 1-4 4h-2v6H9V4h4m0 6a2 2 0 0 0 2-2a2 2 0 0 0-2-2h-2v4h2Z"/></svg>',
230
- 'insertDIV': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M4 6v13h16V6H4m14 11H6V8h12v9Z"/></svg>',
231
- 'insertLINE': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M9 7h2v8h4v2H9V7m3-5a10 10 0 0 1 10 10a10 10 0 0 1-10 10A10 10 0 0 1 2 12A10 10 0 0 1 12 2m0 2a8 8 0 0 0-8 8a8 8 0 0 0 8 8a8 8 0 0 0 8-8a8 8 0 0 0-8-8Z"/></svg>',
232
- 'BLOCKQUOTE': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M14 17h3l2-4V7h-6v6h3M6 17h3l2-4V7H5v6h3l-2 4Z"/></svg>',
233
- 'PRE': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="m12.89 3l1.96.4L11.11 21l-1.96-.4L12.89 3m6.7 9L16 8.41V5.58L22.42 12L16 18.41v-2.83L19.59 12M1.58 12L8 5.58v2.83L4.41 12L8 15.58v2.83L1.58 12Z"/></svg>',
234
- 'insertImage': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M5 3a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h9.09c-.06-.33-.09-.66-.09-1c0-.68.12-1.36.35-2H5l3.5-4.5l2.5 3l3.5-4.5l2.23 2.97c.97-.63 2.11-.97 3.27-.97c.34 0 .67.03 1 .09V5a2 2 0 0 0-2-2H5m14 13v3h-3v2h3v3h2v-3h3v-2h-3v-3h-2Z"/></svg>',
235
- 'insertVideo': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M17 10.5V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3.5l4 4v-11l-4 4Z"/></svg>',
236
- 'createLink': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7a5 5 0 0 0-5 5a5 5 0 0 0 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1M8 13h8v-2H8v2m9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1c0 1.71-1.39 3.1-3.1 3.1h-4V17h4a5 5 0 0 0 5-5a5 5 0 0 0-5-5Z"/></svg>',
237
- },
238
- items_format: {
239
- 'insertOrderedList': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M7 13v-2h14v2H7m0 6v-2h14v2H7M7 7V5h14v2H7M3 8V5H2V4h2v4H3m-1 9v-1h3v4H2v-1h2v-.5H3v-1h1V17H2m2.25-7a.75.75 0 0 1 .75.75c0 .2-.08.39-.21.52L3.12 13H5v1H2v-.92L4 11H2v-1h2.25Z"/></svg>',
240
- 'insertUnorderedList': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M3 4h4v4H3V4m6 1v2h12V5H9m-6 5h4v4H3v-4m6 1v2h12v-2H9m-6 5h4v4H3v-4m6 1v2h12v-2H9"/></svg>',
241
- 'subscript': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M16 7.41L11.41 12L16 16.59L14.59 18L10 13.41L5.41 18L4 16.59L8.59 12L4 7.41L5.41 6L10 10.59L14.59 6L16 7.41m5.85 13.62h-4.88v-1l.89-.8c.76-.65 1.32-1.19 1.7-1.63c.37-.44.56-.85.57-1.24a.898.898 0 0 0-.27-.7c-.18-.16-.47-.28-.86-.28c-.31 0-.58.06-.84.18l-.66.38l-.45-1.17c.27-.21.59-.39.98-.53s.82-.24 1.29-.24c.78.04 1.38.25 1.78.66c.4.41.62.93.62 1.57c-.01.56-.19 1.08-.54 1.55c-.34.47-.76.92-1.27 1.36l-.64.52v.02h2.58v1.35Z"/></svg>',
242
- 'superscript': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M16 7.41L11.41 12L16 16.59L14.59 18L10 13.41L5.41 18L4 16.59L8.59 12L4 7.41L5.41 6L10 10.59L14.59 6L16 7.41M21.85 9h-4.88V8l.89-.82c.76-.64 1.32-1.18 1.7-1.63c.37-.44.56-.85.57-1.23a.884.884 0 0 0-.27-.7c-.18-.19-.47-.28-.86-.29c-.31.01-.58.07-.84.17l-.66.39l-.45-1.17c.27-.22.59-.39.98-.53S18.85 2 19.32 2c.78 0 1.38.2 1.78.61c.4.39.62.93.62 1.57c-.01.56-.19 1.08-.54 1.55c-.34.48-.76.93-1.27 1.36l-.64.52v.02h2.58V9Z"/></svg>',
243
- 'bold': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M13.5 15.5H10v-3h3.5A1.5 1.5 0 0 1 15 14a1.5 1.5 0 0 1-1.5 1.5m-3.5-9h3A1.5 1.5 0 0 1 14.5 8A1.5 1.5 0 0 1 13 9.5h-3m5.6 1.29c.97-.68 1.65-1.79 1.65-2.79c0-2.26-1.75-4-4-4H7v14h7.04c2.1 0 3.71-1.7 3.71-3.79c0-1.52-.86-2.82-2.15-3.42Z"/></svg>',
244
- 'italic': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4h-8Z"/></svg>',
245
- 'strikeThrough': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M3 14h18v-2H3m2-8v3h5v3h4V7h5V4m-9 15h4v-3h-4v3Z"/></svg>',
246
- 'underline': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M5 21h14v-2H5v2m7-4a6 6 0 0 0 6-6V3h-2.5v8a3.5 3.5 0 0 1-3.5 3.5A3.5 3.5 0 0 1 8.5 11V3H6v8a6 6 0 0 0 6 6Z"/></svg>',
247
- 'insertHorizontalRule': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M0 24h24v-4H0v4Z"/></svg>',
248
- 'removeFormat': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M6 5v.18L8.82 8h2.4l-.72 1.68l2.1 2.1L14.21 8H20V5H6M3.27 5L2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21L18 19.73L3.55 5.27L3.27 5Z"/></svg>'
249
- },
188
+ name: 'r-text-editor',
189
+ inheritAttrs: false,
190
+ props: {
191
+ uploadLink: {type: String, default: '/storage'},
192
+ modelValue: {
193
+ type: [Object, String], default: () => {
194
+ return {
195
+ text: '',
196
+ files: []
197
+ }
198
+ }
199
+ },
200
+ tile: Boolean,
201
+ headers: Object
202
+ },
203
+ emits: ['update:modelValue'],
204
+ data() {
205
+ return {
206
+ id: 'text_editor_' + this.$helper.uniqueId(12),
207
+ text: this.modelValue && typeof this.modelValue === 'object' && 'text' in this.modelValue ? this.modelValue.text : this.modelValue,
208
+ files: this.modelValue && typeof this.modelValue === 'object' && 'text' in this.modelValue ? this.modelValue.files : [],
209
+ valid1: false,
210
+ valid2: false,
211
+ show: false,
212
+ showImg: false,
213
+ showVideo: false,
214
+ img_width: 200,
215
+ img_height: 200,
216
+ video: [],
217
+ image: [],
218
+ img_alt: null,
219
+ target: false,
220
+ link: null,
221
+ preSelected: null,
222
+ currentPath: [],
223
+ selectElm: null,
224
+ items_undo: {
225
+ 'undo': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88c3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8Z"/></svg>',
226
+ 'redo': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 0 1 7.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6Z"/></svg>',
227
+ },
228
+ items_handle: {
229
+ 'DIV': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M13 4a4 4 0 0 1 4 4a4 4 0 0 1-4 4h-2v6H9V4h4m0 6a2 2 0 0 0 2-2a2 2 0 0 0-2-2h-2v4h2Z"/></svg>',
230
+ 'insertDIV': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M4 6v13h16V6H4m14 11H6V8h12v9Z"/></svg>',
231
+ 'insertLINE': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M9 7h2v8h4v2H9V7m3-5a10 10 0 0 1 10 10a10 10 0 0 1-10 10A10 10 0 0 1 2 12A10 10 0 0 1 12 2m0 2a8 8 0 0 0-8 8a8 8 0 0 0 8 8a8 8 0 0 0 8-8a8 8 0 0 0-8-8Z"/></svg>',
232
+ 'BLOCKQUOTE': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M14 17h3l2-4V7h-6v6h3M6 17h3l2-4V7H5v6h3l-2 4Z"/></svg>',
233
+ 'PRE': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="m12.89 3l1.96.4L11.11 21l-1.96-.4L12.89 3m6.7 9L16 8.41V5.58L22.42 12L16 18.41v-2.83L19.59 12M1.58 12L8 5.58v2.83L4.41 12L8 15.58v2.83L1.58 12Z"/></svg>',
234
+ 'insertImage': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M5 3a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h9.09c-.06-.33-.09-.66-.09-1c0-.68.12-1.36.35-2H5l3.5-4.5l2.5 3l3.5-4.5l2.23 2.97c.97-.63 2.11-.97 3.27-.97c.34 0 .67.03 1 .09V5a2 2 0 0 0-2-2H5m14 13v3h-3v2h3v3h2v-3h3v-2h-3v-3h-2Z"/></svg>',
235
+ 'insertVideo': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M17 10.5V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3.5l4 4v-11l-4 4Z"/></svg>',
236
+ 'createLink': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7a5 5 0 0 0-5 5a5 5 0 0 0 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1M8 13h8v-2H8v2m9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1c0 1.71-1.39 3.1-3.1 3.1h-4V17h4a5 5 0 0 0 5-5a5 5 0 0 0-5-5Z"/></svg>',
237
+ },
238
+ items_format: {
239
+ 'insertOrderedList': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M7 13v-2h14v2H7m0 6v-2h14v2H7M7 7V5h14v2H7M3 8V5H2V4h2v4H3m-1 9v-1h3v4H2v-1h2v-.5H3v-1h1V17H2m2.25-7a.75.75 0 0 1 .75.75c0 .2-.08.39-.21.52L3.12 13H5v1H2v-.92L4 11H2v-1h2.25Z"/></svg>',
240
+ 'insertUnorderedList': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M3 4h4v4H3V4m6 1v2h12V5H9m-6 5h4v4H3v-4m6 1v2h12v-2H9m-6 5h4v4H3v-4m6 1v2h12v-2H9"/></svg>',
241
+ 'subscript': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M16 7.41L11.41 12L16 16.59L14.59 18L10 13.41L5.41 18L4 16.59L8.59 12L4 7.41L5.41 6L10 10.59L14.59 6L16 7.41m5.85 13.62h-4.88v-1l.89-.8c.76-.65 1.32-1.19 1.7-1.63c.37-.44.56-.85.57-1.24a.898.898 0 0 0-.27-.7c-.18-.16-.47-.28-.86-.28c-.31 0-.58.06-.84.18l-.66.38l-.45-1.17c.27-.21.59-.39.98-.53s.82-.24 1.29-.24c.78.04 1.38.25 1.78.66c.4.41.62.93.62 1.57c-.01.56-.19 1.08-.54 1.55c-.34.47-.76.92-1.27 1.36l-.64.52v.02h2.58v1.35Z"/></svg>',
242
+ 'superscript': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M16 7.41L11.41 12L16 16.59L14.59 18L10 13.41L5.41 18L4 16.59L8.59 12L4 7.41L5.41 6L10 10.59L14.59 6L16 7.41M21.85 9h-4.88V8l.89-.82c.76-.64 1.32-1.18 1.7-1.63c.37-.44.56-.85.57-1.23a.884.884 0 0 0-.27-.7c-.18-.19-.47-.28-.86-.29c-.31.01-.58.07-.84.17l-.66.39l-.45-1.17c.27-.22.59-.39.98-.53S18.85 2 19.32 2c.78 0 1.38.2 1.78.61c.4.39.62.93.62 1.57c-.01.56-.19 1.08-.54 1.55c-.34.48-.76.93-1.27 1.36l-.64.52v.02h2.58V9Z"/></svg>',
243
+ 'bold': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M13.5 15.5H10v-3h3.5A1.5 1.5 0 0 1 15 14a1.5 1.5 0 0 1-1.5 1.5m-3.5-9h3A1.5 1.5 0 0 1 14.5 8A1.5 1.5 0 0 1 13 9.5h-3m5.6 1.29c.97-.68 1.65-1.79 1.65-2.79c0-2.26-1.75-4-4-4H7v14h7.04c2.1 0 3.71-1.7 3.71-3.79c0-1.52-.86-2.82-2.15-3.42Z"/></svg>',
244
+ 'italic': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4h-8Z"/></svg>',
245
+ 'strikeThrough': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M3 14h18v-2H3m2-8v3h5v3h4V7h5V4m-9 15h4v-3h-4v3Z"/></svg>',
246
+ 'underline': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M5 21h14v-2H5v2m7-4a6 6 0 0 0 6-6V3h-2.5v8a3.5 3.5 0 0 1-3.5 3.5A3.5 3.5 0 0 1 8.5 11V3H6v8a6 6 0 0 0 6 6Z"/></svg>',
247
+ 'insertHorizontalRule': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M0 24h24v-4H0v4Z"/></svg>',
248
+ 'removeFormat': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M6 5v.18L8.82 8h2.4l-.72 1.68l2.1 2.1L14.21 8H20V5H6M3.27 5L2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21L18 19.73L3.55 5.27L3.27 5Z"/></svg>'
249
+ },
250
250
 
251
- items_dir: ['<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M3 3h18v2H3V3m0 4h12v2H3V7m0 4h18v2H3v-2m0 4h12v2H3v-2m0 4h18v2H3v-2Z"/></svg>',
252
- '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M3 3h18v2H3V3m4 4h10v2H7V7m-4 4h18v2H3v-2m4 4h10v2H7v-2m-4 4h18v2H3v-2Z"/></svg>',
253
- '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M3 3h18v2H3V3m6 4h12v2H9V7m-6 4h18v2H3v-2m6 4h12v2H9v-2m-6 4h18v2H3v-2Z"/></svg>'
254
- ],
255
- menu: {
256
- 'font': {
257
- icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M8.5 7h2L16 21h-2.4l-1.1-3H6.3l-1.1 3H3L8.5 7m-1.4 9h4.8L9.5 9.7L7.1 16M22 5v2h-3v3h-2V7h-3V5h3V2h2v3h3Z"/></svg>',
258
- items: [{text: 'HI', value: 'display-1'},
259
- {text: 'HI', value: 'display-2'},
260
- {text: 'HI', value: 'display-3'},
261
- {text: 'HI', value: 'headline-1'},
262
- {text: 'HI', value: 'headline-2'},
263
- {text: 'HI', value: 'headline-3'},
264
- {text: 'HI', value: 'title-1'},
265
- {text: 'HI', value: 'title-2'},
266
- {text: 'HI', value: 'title-3'},
267
- {text: 'HI', value: 'body-1'},
268
- {text: 'HI', value: 'body-2'},
269
- {text: 'HI', value: 'body-3'},
270
- {text: 'HI', value: 'label-1'},
271
- {text: 'HI', value: 'label-2'},
272
- {text: 'HI', value: 'label-3'},
273
- ]
274
- },
275
- 'header': {
276
- icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M3 4h2v6h4V4h2v14H9v-6H5v6H3V4m10 4h2.31l.32-3h2l-.32 3h2l.32-3h2l-.32 3H23v2h-1.9l-.2 2H23v2h-2.31l-.32 3h-2l.32-3h-2l-.32 3h-2l.32-3H13v-2h1.9l.2-2H13V8m4.1 2l-.2 2h2l.2-2h-2Z"/></svg>',
277
- items: [
278
- {text: 'H1', value: 'H1'},
279
- {text: 'H2', value: 'H2'},
280
- {text: 'H3', value: 'H3'},
281
- {text: 'H4', value: 'H4'},
282
- {text: 'H5', value: 'H5'},
283
- {text: 'H6', value: 'H6'}
284
- ]
285
- },
286
- 'color': {
287
- icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M19 11.5s-2 2.17-2 3.5a2 2 0 0 0 2 2a2 2 0 0 0 2-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21L14.79 10m1.77-1.06L7.62 0L6.21 1.41l2.38 2.38l-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12Z"/></svg>',
288
- items: [
289
- {text: 'color', value: 'color-disabled-text'},
290
- {text: 'color', value: 'color-one-text'},
291
- {text: 'color', value: 'color-two-text'},
292
- {text: 'color', value: 'color-three-text'},
293
- {text: 'color', value: 'color-error-text'},
294
- {text: 'color', value: 'color-info-text'},
295
- {text: 'color', value: 'color-warning-text'},
296
- {text: 'color', value: 'color-success-text'},
297
- {text: 'color', value: 'color-white-text'},
298
- {text: 'color', value: 'color-black-text'}
299
- ]
300
- },
301
- 'background': {
302
- icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M18 4V3a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V6h1v4H9v11a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-9h8V4h-3Z"/></svg>',
303
- items: [
304
- {text: 'color', value: 'color-one'},
305
- {text: 'color', value: 'color-two'},
306
- {text: 'color', value: 'color-three'},
307
- {text: 'color', value: 'color-error'},
308
- {text: 'color', value: 'color-info'},
309
- {text: 'color', value: 'color-warning'},
310
- {text: 'color', value: 'color-success'},
311
- {text: 'color', value: 'color-black'},
312
- {text: 'color', value: 'color-white'},
313
- ]
314
- }
315
- }
316
- }
251
+ items_dir: ['<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M3 3h18v2H3V3m0 4h12v2H3V7m0 4h18v2H3v-2m0 4h12v2H3v-2m0 4h18v2H3v-2Z"/></svg>',
252
+ '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M3 3h18v2H3V3m4 4h10v2H7V7m-4 4h18v2H3v-2m4 4h10v2H7v-2m-4 4h18v2H3v-2Z"/></svg>',
253
+ '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M3 3h18v2H3V3m6 4h12v2H9V7m-6 4h18v2H3v-2m6 4h12v2H9v-2m-6 4h18v2H3v-2Z"/></svg>'
254
+ ],
255
+ menu: {
256
+ 'font': {
257
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M8.5 7h2L16 21h-2.4l-1.1-3H6.3l-1.1 3H3L8.5 7m-1.4 9h4.8L9.5 9.7L7.1 16M22 5v2h-3v3h-2V7h-3V5h3V2h2v3h3Z"/></svg>',
258
+ items: [{text: 'HI', value: 'display-1'},
259
+ {text: 'HI', value: 'display-2'},
260
+ {text: 'HI', value: 'display-3'},
261
+ {text: 'HI', value: 'headline-1'},
262
+ {text: 'HI', value: 'headline-2'},
263
+ {text: 'HI', value: 'headline-3'},
264
+ {text: 'HI', value: 'title-1'},
265
+ {text: 'HI', value: 'title-2'},
266
+ {text: 'HI', value: 'title-3'},
267
+ {text: 'HI', value: 'body-1'},
268
+ {text: 'HI', value: 'body-2'},
269
+ {text: 'HI', value: 'body-3'},
270
+ {text: 'HI', value: 'label-1'},
271
+ {text: 'HI', value: 'label-2'},
272
+ {text: 'HI', value: 'label-3'},
273
+ ]
317
274
  },
318
- mounted() {
319
- /* document.execCommand('enableObjectResizing', false, true);
320
- document.execCommand('enableInlineTableEditing', false, true);
321
- document.execCommand('enableAbsolutePositionEditor', false, true) */
322
-
323
- this.format('defaultParagraphSeparator', 'div')
324
- this.element.addEventListener('paste', function (e) {
325
- e.preventDefault()
326
- const text = (e.originalEvent || e).clipboardData.getData('text/plain')
327
-
328
- document.execCommand('insertHTML', false, text)
329
- })
275
+ 'header': {
276
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M3 4h2v6h4V4h2v14H9v-6H5v6H3V4m10 4h2.31l.32-3h2l-.32 3h2l.32-3h2l-.32 3H23v2h-1.9l-.2 2H23v2h-2.31l-.32 3h-2l.32-3h-2l-.32 3h-2l.32-3H13v-2h1.9l.2-2H13V8m4.1 2l-.2 2h2l.2-2h-2Z"/></svg>',
277
+ items: [
278
+ {text: 'H1', value: 'H1'},
279
+ {text: 'H2', value: 'H2'},
280
+ {text: 'H3', value: 'H3'},
281
+ {text: 'H4', value: 'H4'},
282
+ {text: 'H5', value: 'H5'},
283
+ {text: 'H6', value: 'H6'}
284
+ ]
330
285
  },
331
- beforeUnmount() {
332
- this.element.removeEventListener('paste', () => {
333
- })
286
+ 'color': {
287
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M19 11.5s-2 2.17-2 3.5a2 2 0 0 0 2 2a2 2 0 0 0 2-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21L14.79 10m1.77-1.06L7.62 0L6.21 1.41l2.38 2.38l-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12Z"/></svg>',
288
+ items: [
289
+ {text: 'color', value: 'color-disabled-text'},
290
+ {text: 'color', value: 'color-one-text'},
291
+ {text: 'color', value: 'color-two-text'},
292
+ {text: 'color', value: 'color-three-text'},
293
+ {text: 'color', value: 'color-error-text'},
294
+ {text: 'color', value: 'color-info-text'},
295
+ {text: 'color', value: 'color-warning-text'},
296
+ {text: 'color', value: 'color-success-text'},
297
+ {text: 'color', value: 'color-white-text'},
298
+ {text: 'color', value: 'color-black-text'}
299
+ ]
334
300
  },
335
- computed: {
336
- element() {
337
- return this.$refs['editorContent' + this.id]
338
- },
339
- is_object() {
340
- return this.modelValue && typeof this.modelValue === 'object' && 'text' in this.modelValue;
341
-
342
- }
301
+ 'background': {
302
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="currentColor" d="M18 4V3a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V6h1v4H9v11a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-9h8V4h-3Z"/></svg>',
303
+ items: [
304
+ {text: 'color', value: 'color-one'},
305
+ {text: 'color', value: 'color-two'},
306
+ {text: 'color', value: 'color-three'},
307
+ {text: 'color', value: 'color-error'},
308
+ {text: 'color', value: 'color-info'},
309
+ {text: 'color', value: 'color-warning'},
310
+ {text: 'color', value: 'color-success'},
311
+ {text: 'color', value: 'color-black'},
312
+ {text: 'color', value: 'color-white'},
313
+ ]
314
+ }
315
+ }
316
+ }
317
+ },
318
+ mounted() {
319
+ /* document.execCommand('enableObjectResizing', false, true);
320
+ document.execCommand('enableInlineTableEditing', false, true);
321
+ document.execCommand('enableAbsolutePositionEditor', false, true) */
343
322
 
344
- },
345
- methods: {
346
- content() {
347
- return this.element.innerHTML
348
- },
349
- addClass(e) {
350
- if (this.selectElm) {
351
- this.selectElm.classList = e.join(' ')
352
- this.updateText()
353
- }
354
- },
355
- borderd(el) {
356
- if (this.selectElm) {
357
- this.selectElm.style.border = null
358
- }
359
- if (!el.style) {
360
- el = el.parentNode
361
- this.selectElm = el
362
- }
363
- if (!el.style) {
364
- this.selectElm = null
365
- return
366
- }
367
- if (el.style.border) {
368
- el.style.border = null
369
- this.selectElm = null
370
- return
371
- }
372
- this.selectElm = el
373
- el.style.border = '1px solid var(--color-one)'
374
- },
375
- bordered() {
376
- const a = this.getSelection()
377
- this.currentPath = []
378
- const that = this
323
+ this.format('defaultParagraphSeparator', 'div')
324
+ this.element.addEventListener('paste', function (e) {
325
+ e.preventDefault()
326
+ const text = (e.originalEvent || e).clipboardData.getData('text/plain')
379
327
 
380
- function f(node) {
381
- if (node.classList && node.classList.contains('editor-content')) {
382
- that.currentPath.reverse()
383
- return
384
- }
385
- that.currentPath.push(node.parentNode)
386
- f(node.parentNode)
387
- }
328
+ document.execCommand('insertHTML', false, text)
329
+ })
330
+ },
331
+ beforeUnmount() {
332
+ this.element.removeEventListener('paste', () => {
333
+ })
334
+ },
335
+ computed: {
336
+ c_tile() {
337
+ if (this.tile === undefined && this.$r.inputs.tile) {
338
+ return this.$r.inputs.tile
339
+ }
340
+ return this.tile
341
+ },
342
+ element() {
343
+ return this.$refs['editorContent' + this.id]
344
+ },
345
+ is_object() {
346
+ return this.modelValue && typeof this.modelValue === 'object' && 'text' in this.modelValue;
388
347
 
389
- if (a) {
390
- this.currentPath = [a?.anchorNode]
391
- f(a?.anchorNode)
392
- if (a?.anchorNode.classList && a?.anchorNode.classList.contains('editor-content')) {
393
- return
394
- }
395
- this.borderd(a?.anchorNode)
396
- }
397
- },
398
- deleteImage(img, i) {
399
- this.$axios.delete(this.uploadLink,
400
- {
401
- data: {link: img},
402
- headers: this.headers
403
- }
404
- ).then(() => {
405
- this.files.splice(i, 1)
406
- this.updateText()
407
- })
348
+ }
408
349
 
409
- },
410
- handleImageForm() {
411
- if (!this.getSelection() || !this.image || !this.img_alt) {
412
- this.$toast(this.$t('invalid_data', 'renusify'), {type: 'error'})
413
- return
414
- }
415
- let sel = this.getSelection()
416
- sel.removeAllRanges()
417
- sel.addRange(this.preSelected)
418
- let url = '<img src="/' + this.image[0] + '?w=' + this.img_width + '&h=' + this.img_height + '" alt="' + this.img_alt + '" width="' + this.img_width + '" height="' + this.img_height + '"/>'
419
- this.files.push(this.image[0])
420
- document.execCommand('insertHTML', true, url)
421
- this.showImg = false
422
- },
423
- handleVideoForm() {
424
- if (!this.getSelection() || !this.video) {
425
- this.$toast(this.$t('invalid_data', 'renusify'), {type: 'error'})
426
- return
427
- }
428
- let sel = this.getSelection()
429
- sel.removeAllRanges()
430
- sel.addRange(this.preSelected)
431
- let url = '<video controls="1" src="/' + this.video[0] + '" width="' + this.img_width + '" height="' + this.img_height + '"></video>'
432
- this.files.push(this.video[0])
433
- document.execCommand('insertHTML', true, url)
434
- this.showVideo = false
435
- },
436
- handleForm() {
437
- if (!this.getSelection() || !this.link) {
438
- this.$toast(this.$t('invalid_data', 'renusify'), {type: 'error'})
439
- return
440
- }
441
- let sel = this.getSelection()
442
- sel.removeAllRanges()
443
- sel.addRange(this.preSelected)
444
- let url = '<a href="' + this.link.trim() + '"'
445
- if (this.target) {
446
- url += 'target="_blank"'
447
- }
448
- if (this.link.startsWith('#')) {
449
- url += `id="${this.link.replace('#', '')}"`
450
- }
451
- url += '>' + sel + '</a>'
350
+ },
351
+ methods: {
352
+ content() {
353
+ return this.element.innerHTML
354
+ },
355
+ addClass(e) {
356
+ if (this.selectElm) {
357
+ this.selectElm.classList = e.join(' ')
358
+ this.updateText()
359
+ }
360
+ },
361
+ borderd(el) {
362
+ if (this.selectElm) {
363
+ this.selectElm.style.border = null
364
+ }
365
+ if (!el.style) {
366
+ el = el.parentNode
367
+ this.selectElm = el
368
+ }
369
+ if (!el.style) {
370
+ this.selectElm = null
371
+ return
372
+ }
373
+ if (el.style.border) {
374
+ el.style.border = null
375
+ this.selectElm = null
376
+ return
377
+ }
378
+ this.selectElm = el
379
+ el.style.border = '1px solid var(--color-one)'
380
+ },
381
+ bordered() {
382
+ const a = this.getSelection()
383
+ this.currentPath = []
384
+ const that = this
452
385
 
453
- document.execCommand('insertHTML', true, url)
454
- this.show = false
455
- },
456
- getSelection() {
457
- if (window.getSelection) {
458
- return window.getSelection()
459
- }
386
+ function f(node) {
387
+ if (node.classList && node.classList.contains('editor-content')) {
388
+ that.currentPath.reverse()
389
+ return
390
+ }
391
+ that.currentPath.push(node.parentNode)
392
+ f(node.parentNode)
393
+ }
460
394
 
461
- return false
462
- },
463
- handleOpen(e) {
464
- if (e === true) {
465
- let sel = window.getSelection()
466
- if (sel.rangeCount > 0) {
467
- this.preSelected = sel.getRangeAt(0)
468
- }
469
- }
470
- },
471
- addCss(e) {
472
- let btn = e['menu']
473
- e = e['item'].value
474
- if (!this.getSelection()) {
475
- return
476
- }
477
- let sel = this.getSelection()
478
- sel.removeAllRanges()
479
- sel.addRange(this.preSelected)
480
- if (btn === 'header') {
481
- document.execCommand('insertHTML', true, '<' + e.trim() + '>' + sel + '</' + e.trim() + '>')
482
- return null
483
- }
484
- let selectedElement = sel.focusNode.parentNode
485
- if (selectedElement.tagName === 'SPAN' && selectedElement.innerText === sel.toString()) {
486
- let cls = selectedElement.classList.value.split(' ')
487
- for (let c of cls) {
488
- if (this.menu[btn]['items'].includes(c.trim())) {
489
- selectedElement.classList.remove(c.trim())
490
- }
491
- }
395
+ if (a) {
396
+ this.currentPath = [a?.anchorNode]
397
+ f(a?.anchorNode)
398
+ if (a?.anchorNode.classList && a?.anchorNode.classList.contains('editor-content')) {
399
+ return
400
+ }
401
+ this.borderd(a?.anchorNode)
402
+ }
403
+ },
404
+ deleteImage(img, i) {
405
+ this.$axios.delete(this.uploadLink,
406
+ {
407
+ data: {link: img},
408
+ headers: this.headers
409
+ }
410
+ ).then(() => {
411
+ this.files.splice(i, 1)
412
+ this.updateText()
413
+ })
492
414
 
493
- selectedElement.classList.add(e)
494
- } else {
495
- let cls = ''
496
- if (selectedElement.tagName === 'SPAN') {
497
- cls = selectedElement.classList.value
498
- }
499
- e = cls + ' ' + e
415
+ },
416
+ handleImageForm() {
417
+ if (!this.getSelection() || !this.image || !this.img_alt) {
418
+ this.$toast(this.$t('invalid_data', 'renusify'), {type: 'error'})
419
+ return
420
+ }
421
+ let sel = this.getSelection()
422
+ sel.removeAllRanges()
423
+ sel.addRange(this.preSelected)
424
+ let url = '<img src="/' + this.image[0] + '?w=' + this.img_width + '&h=' + this.img_height + '" alt="' + this.img_alt + '" width="' + this.img_width + '" height="' + this.img_height + '"/>'
425
+ this.files.push(this.image[0])
426
+ document.execCommand('insertHTML', true, url)
427
+ this.showImg = false
428
+ },
429
+ handleVideoForm() {
430
+ if (!this.getSelection() || !this.video) {
431
+ this.$toast(this.$t('invalid_data', 'renusify'), {type: 'error'})
432
+ return
433
+ }
434
+ let sel = this.getSelection()
435
+ sel.removeAllRanges()
436
+ sel.addRange(this.preSelected)
437
+ let url = '<video controls="1" src="/' + this.video[0] + '" width="' + this.img_width + '" height="' + this.img_height + '"></video>'
438
+ this.files.push(this.video[0])
439
+ document.execCommand('insertHTML', true, url)
440
+ this.showVideo = false
441
+ },
442
+ handleForm() {
443
+ if (!this.getSelection() || !this.link) {
444
+ this.$toast(this.$t('invalid_data', 'renusify'), {type: 'error'})
445
+ return
446
+ }
447
+ let sel = this.getSelection()
448
+ sel.removeAllRanges()
449
+ sel.addRange(this.preSelected)
450
+ let url = '<a href="' + this.link.trim() + '"'
451
+ if (this.target) {
452
+ url += 'target="_blank"'
453
+ }
454
+ if (this.link.startsWith('#')) {
455
+ url += `id="${this.link.replace('#', '')}"`
456
+ }
457
+ url += '>' + sel + '</a>'
500
458
 
501
- document.execCommand('insertHTML', true, "<span class='" + e.trim() + "'>" + sel + '</span>')
502
- }
503
- },
504
- handle(e) {
505
- let selectedElement = window.getSelection().focusNode.parentNode
459
+ document.execCommand('insertHTML', true, url)
460
+ this.show = false
461
+ },
462
+ getSelection() {
463
+ if (window.getSelection) {
464
+ return window.getSelection()
465
+ }
506
466
 
507
- if (selectedElement.tagName === e) {
508
- this.format('formatBlock', '<div>')
509
- } else {
510
- if (e === 'createLink') {
511
- this.link = null
512
- this.target = false
513
- this.handleOpen(true)
514
- this.show = true
515
- } else if (e === 'insertImage') {
516
- this.image = []
517
- this.img_alt = null
518
- this.handleOpen(true)
519
- this.showImg = true
520
- } else if (e === 'insertVideo') {
521
- this.video = []
522
- this.handleOpen(true)
523
- this.showVideo = true
524
- } else if (e === 'insertDIV') {
525
- const d = document.createElement('div')
526
- d.innerText = 'div'
527
- if (this.selectElm) {
528
- this.selectElm.appendChild(d)
529
- } else {
530
- selectedElement.appendChild(d)
531
- }
532
- } else if (e === 'insertLINE') {
533
- const d = document.createElement('div')
534
- d.innerText = 'line'
535
- this.element.appendChild(d)
536
- } else {
537
- this.format('formatBlock', e)
538
- }
539
- }
540
- this.updateText()
541
- },
542
- handle_dir(e) {
543
- let name = ''
544
- switch (e) {
545
- case 0:
546
- name = 'text-start'
547
- break
548
- case 1:
549
- name = 'text-center'
550
- break
551
- case 2:
552
- name = 'text-end'
553
- break
554
- }
555
- let selectedElement = window.getSelection().focusNode
556
- if (selectedElement === null) {
557
- return null
558
- }
467
+ return false
468
+ },
469
+ handleOpen(e) {
470
+ if (e === true) {
471
+ let sel = window.getSelection()
472
+ if (sel.rangeCount > 0) {
473
+ this.preSelected = sel.getRangeAt(0)
474
+ }
475
+ }
476
+ },
477
+ addCss(e) {
478
+ let btn = e['menu']
479
+ e = e['item'].value
480
+ if (!this.getSelection()) {
481
+ return
482
+ }
483
+ let sel = this.getSelection()
484
+ sel.removeAllRanges()
485
+ sel.addRange(this.preSelected)
486
+ if (btn === 'header') {
487
+ document.execCommand('insertHTML', true, '<' + e.trim() + '>' + sel + '</' + e.trim() + '>')
488
+ return null
489
+ }
490
+ let selectedElement = sel.focusNode.parentNode
491
+ if (selectedElement.tagName === 'SPAN' && selectedElement.innerText === sel.toString()) {
492
+ let cls = selectedElement.classList.value.split(' ')
493
+ for (let c of cls) {
494
+ if (this.menu[btn]['items'].includes(c.trim())) {
495
+ selectedElement.classList.remove(c.trim())
496
+ }
497
+ }
559
498
 
560
- let parentNode = selectedElement.parentNode
499
+ selectedElement.classList.add(e)
500
+ } else {
501
+ let cls = ''
502
+ if (selectedElement.tagName === 'SPAN') {
503
+ cls = selectedElement.classList.value
504
+ }
505
+ e = cls + ' ' + e
561
506
 
562
- if (parentNode.classList.contains('editor-content')) {
563
- selectedElement.classList.remove('text-start', 'text-center', 'text-end')
564
- selectedElement.classList.add(name)
565
- } else {
566
- parentNode.classList.remove('text-start', 'text-center', 'text-end')
567
- parentNode.classList.add(name)
568
- }
507
+ document.execCommand('insertHTML', true, "<span class='" + e.trim() + "'>" + sel + '</span>')
508
+ }
509
+ },
510
+ handle(e) {
511
+ let selectedElement = window.getSelection().focusNode.parentNode
569
512
 
570
- this.updateText()
571
- },
572
- updateText() {
573
- this.$emit('update:modelValue', {
574
- text: this.element.innerHTML,
575
- files: this.files
576
- })
577
- },
578
- format(command, value) {
579
- if (command === 'removeFormat') {
580
- document.execCommand('insertHTML', true, '<div>' + this.getSelection().toString() + '</div>')
581
- } else {
582
- document.execCommand(command, false, value)
583
- }
584
- },
513
+ if (selectedElement.tagName === e) {
514
+ this.format('formatBlock', '<div>')
515
+ } else {
516
+ if (e === 'createLink') {
517
+ this.link = null
518
+ this.target = false
519
+ this.handleOpen(true)
520
+ this.show = true
521
+ } else if (e === 'insertImage') {
522
+ this.image = []
523
+ this.img_alt = null
524
+ this.handleOpen(true)
525
+ this.showImg = true
526
+ } else if (e === 'insertVideo') {
527
+ this.video = []
528
+ this.handleOpen(true)
529
+ this.showVideo = true
530
+ } else if (e === 'insertDIV') {
531
+ const d = document.createElement('div')
532
+ d.innerText = 'div'
533
+ if (this.selectElm) {
534
+ this.selectElm.appendChild(d)
535
+ } else {
536
+ selectedElement.appendChild(d)
537
+ }
538
+ } else if (e === 'insertLINE') {
539
+ const d = document.createElement('div')
540
+ d.innerText = 'line'
541
+ this.element.appendChild(d)
542
+ } else {
543
+ this.format('formatBlock', e)
585
544
  }
586
- }
545
+ }
546
+ this.updateText()
547
+ },
548
+ handle_dir(e) {
549
+ let name = ''
550
+ switch (e) {
551
+ case 0:
552
+ name = 'text-start'
553
+ break
554
+ case 1:
555
+ name = 'text-center'
556
+ break
557
+ case 2:
558
+ name = 'text-end'
559
+ break
560
+ }
561
+ let selectedElement = window.getSelection().focusNode
562
+ if (selectedElement === null) {
563
+ return null
564
+ }
565
+
566
+ let parentNode = selectedElement.parentNode
567
+
568
+ if (parentNode.classList.contains('editor-content')) {
569
+ selectedElement.classList.remove('text-start', 'text-center', 'text-end')
570
+ selectedElement.classList.add(name)
571
+ } else {
572
+ parentNode.classList.remove('text-start', 'text-center', 'text-end')
573
+ parentNode.classList.add(name)
574
+ }
575
+
576
+ this.updateText()
577
+ },
578
+ updateText() {
579
+ this.$emit('update:modelValue', {
580
+ text: this.element.innerHTML,
581
+ files: this.files
582
+ })
583
+ },
584
+ format(command, value) {
585
+ if (command === 'removeFormat') {
586
+ document.execCommand('insertHTML', true, '<div>' + this.getSelection().toString() + '</div>')
587
+ } else {
588
+ document.execCommand(command, false, value)
589
+ }
590
+ },
591
+ }
592
+ }
587
593
  </script>