renusify 2.5.2 → 3.0.1
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/components/app/index.vue +74 -22
- package/components/app/toast/index.vue +76 -71
- package/components/app/toast/toast.vue +62 -44
- package/components/avatar/index.vue +207 -84
- package/components/button/buttonConfirm.vue +53 -26
- package/components/button/buttonGroup.js +0 -2
- package/components/button/buttonGroup.vue +310 -62
- package/components/button/index.vue +584 -100
- package/components/calendar/index.js +0 -2
- package/components/calendar/index.vue +326 -262
- package/components/calendar/month.vue +64 -55
- package/components/calendar/year.vue +30 -25
- package/components/card/index.vue +139 -59
- package/components/codeEditor/highlightCss.vue +38 -39
- package/components/codeEditor/highlightHtml.vue +64 -64
- package/components/codeEditor/highlightJs.vue +37 -38
- package/components/codeEditor/index.vue +129 -79
- package/components/codeEditor/run.vue +225 -39
- package/components/codeEditor/useCodeFormatter.js +150 -0
- package/components/confirm/index.vue +139 -80
- package/components/container/col.vue +5 -4
- package/components/container/divider.vue +28 -19
- package/components/container/index.vue +34 -15
- package/components/container/row.vue +26 -9
- package/components/container/spacer.vue +2 -4
- package/components/container/style.scss +3 -0
- package/components/content/index.vue +49 -32
- package/components/cropper/index.vue +401 -244
- package/components/float/index.vue +542 -415
- package/components/form/addressInput/index.vue +184 -109
- package/components/form/camInput/index.vue +370 -244
- package/components/form/checkInput/index.vue +138 -71
- package/components/form/checkboxInput/index.vue +93 -49
- package/components/form/colorInput/Alpha.vue +81 -83
- package/components/form/colorInput/Hue.vue +91 -68
- package/components/form/colorInput/Preview.vue +43 -47
- package/components/form/colorInput/Saturation.vue +101 -86
- package/components/form/colorInput/index.vue +71 -39
- package/components/form/colorInput/picker.vue +111 -106
- package/components/form/colorInput/useColor.js +153 -0
- package/components/form/dateInput/index.vue +691 -356
- package/components/form/dateInput/month.vue +63 -54
- package/components/form/dateInput/year.vue +35 -25
- package/components/form/fileInput/index.js +0 -1
- package/components/form/fileInput/index.vue +263 -106
- package/components/form/fileInput/single.vue +332 -168
- package/components/form/groupInput/index.vue +199 -101
- package/components/form/index.vue +189 -83
- package/components/form/input/index.vue +416 -377
- package/components/form/jsonInput/JsonView.vue +54 -56
- package/components/form/jsonInput/index.vue +247 -165
- package/components/form/maskInput/index.vue +252 -132
- package/components/form/numberInput/index.js +0 -1
- package/components/form/numberInput/index.vue +226 -117
- package/components/form/passwordInput/index.js +2 -1
- package/components/form/passwordInput/index.vue +269 -102
- package/components/form/radioInput/index.vue +143 -72
- package/components/form/rangeInput/index.vue +280 -167
- package/components/form/ratingInput/index.vue +57 -57
- package/components/form/selectInput/index.js +1 -3
- package/components/form/selectInput/index.vue +584 -296
- package/components/form/switchInput/index.vue +73 -59
- package/components/form/telInput/index.js +0 -1
- package/components/form/telInput/index.vue +238 -135
- package/components/form/textArea/index.vue +72 -35
- package/components/form/textEditor/index.vue +739 -0
- package/components/form/{text-editor → textEditor}/style.scss +8 -16
- package/components/form/textInput/index.vue +54 -32
- package/components/form/timeInput/index.vue +82 -55
- package/components/form/timeInput/range.vue +115 -94
- package/components/form/timeInput/timepicker.vue +382 -449
- package/components/form/uniqueInput/index.vue +105 -48
- package/components/form/unitInput/index.vue +139 -84
- package/components/formCreator/index.js +0 -1
- package/components/formCreator/index.vue +314 -148
- package/components/highlight/index.vue +41 -25
- package/components/highlight/style.scss +2 -2
- package/components/highlight/{mixin.js → useHighlight.js} +181 -160
- package/components/icon/index.vue +79 -33
- package/components/img/index.vue +250 -147
- package/components/img/preview.vue +180 -198
- package/components/img/svgImg.vue +42 -39
- package/components/index.js +5 -20
- package/components/infinite/index.js +3 -3
- package/components/infinite/index.vue +290 -66
- package/components/map/index.vue +428 -261
- package/components/map/route.vue +794 -487
- package/components/map/select.vue +118 -58
- package/components/menu/index.vue +206 -94
- package/components/meta/meta.js +26 -3
- package/components/modal/index.vue +382 -156
- package/components/notify/index.vue +204 -86
- package/components/notify/notification.vue +38 -55
- package/components/progress/circle.vue +189 -70
- package/components/progress/line.vue +266 -46
- package/components/searchBox/index.js +1 -3
- package/components/searchBox/index.vue +194 -101
- package/components/skeleton/index.vue +45 -20
- package/components/slider/index.vue +319 -156
- package/components/swiper/index.vue +237 -108
- package/components/table/crud/footer.vue +77 -53
- package/components/table/crud/header.vue +71 -72
- package/components/table/crud/index.vue +629 -399
- package/components/table/index.vue +721 -278
- package/components/timeAgo/index.vue +145 -96
- package/components/tour/index.vue +338 -235
- package/components/tree/index.vue +235 -89
- package/components/tree/tree-element.vue +106 -106
- package/directive/animate/index.js +77 -0
- package/directive/clickOutSide/index.js +98 -0
- package/directive/drag/index.js +153 -0
- package/directive/index.js +11 -13
- package/directive/intersect/index.js +263 -0
- package/directive/mask/index.js +67 -0
- package/directive/parallax/index.js +78 -0
- package/directive/ripple/index.js +14 -0
- package/directive/scroll/index.js +272 -24
- package/directive/sortable/index.js +274 -0
- package/directive/title/index.js +75 -0
- package/directive/touch/index.js +268 -0
- package/index.js +11 -19
- package/package.json +5 -2
- package/plugins/validation/Validate.js +88 -79
- package/scripts/generate-docs.mjs +226 -0
- package/scripts/menu.mjs +240 -0
- package/scripts/parser.mjs +1086 -0
- package/style/_index.scss +7 -0
- package/style/app.scss +13 -65
- package/style/colors.scss +5 -22
- package/style/functions/index.scss +8 -0
- package/style/mixins/index.scss +17 -5
- package/style/variables/base.scss +155 -178
- package/style/variables/color.scss +0 -12
- package/style/variables/utilities.scss +0 -180
- package/tools/helper.js +0 -8
- package/tools/icons.js +7 -2
- package/tools/root.js +71 -0
- package/components/app/style.scss +0 -41
- package/components/app/toast/style.scss +0 -20
- package/components/avatar/style.scss +0 -32
- package/components/bar/bottomNav.js +0 -1
- package/components/bar/bottomNav.vue +0 -28
- package/components/bar/bottomNavigationCircle.js +0 -2
- package/components/bar/bottomNavigationCircle.vue +0 -99
- package/components/bar/scss/bottomNav.scss +0 -67
- package/components/bar/scss/toolbar.scss +0 -174
- package/components/bar/toolbar/index.js +0 -8
- package/components/bar/toolbar/index.vue +0 -35
- package/components/bar/toolbar/laptop.vue +0 -33
- package/components/bar/toolbar/menuChilds.vue +0 -41
- package/components/bar/toolbar/menuLaptop.vue +0 -41
- package/components/bar/toolbar/menuMob.vue +0 -39
- package/components/bar/toolbar/mixin.js +0 -43
- package/components/bar/toolbar/mobile.vue +0 -34
- package/components/breadcrumb/bredcrumbItem.vue +0 -39
- package/components/breadcrumb/index.js +0 -3
- package/components/breadcrumb/index.vue +0 -71
- package/components/breadcrumb/style.scss +0 -51
- package/components/button/style.scss +0 -411
- package/components/card/style.scss +0 -86
- package/components/chart/chart.js +0 -1
- package/components/chart/chart.vue +0 -69
- package/components/chart/worldMap.js +0 -2
- package/components/chart/worldMap.vue +0 -1112
- package/components/chat/MessageList.vue +0 -163
- package/components/chat/chatInput.vue +0 -150
- package/components/chat/chatMsg.vue +0 -276
- package/components/chat/index.js +0 -11
- package/components/chat/index.vue +0 -113
- package/components/chip/index.js +0 -3
- package/components/chip/index.vue +0 -77
- package/components/chip/style.scss +0 -199
- package/components/codeEditor/mixin.js +0 -145
- package/components/countdown/index.js +0 -1
- package/components/countdown/index.vue +0 -105
- package/components/form/colorInput/mixin.js +0 -132
- package/components/form/fileInput/file.js +0 -148
- package/components/form/telInput/assets/flags.png +0 -0
- package/components/form/telInput/assets/flags@2x.png +0 -0
- package/components/form/text-editor/index.vue +0 -705
- package/components/icon/style.scss +0 -17
- package/components/infinite/div.js +0 -6
- package/components/infinite/div.vue +0 -193
- package/components/infinite/page.js +0 -3
- package/components/infinite/page.vue +0 -105
- package/components/list/index.js +0 -3
- package/components/list/index.vue +0 -122
- package/components/list/style.scss +0 -66
- package/components/message/index.js +0 -4
- package/components/message/index.vue +0 -40
- package/components/modal/style.scss +0 -146
- package/components/nestable/NestableItem.vue +0 -307
- package/components/nestable/editable.js +0 -44
- package/components/nestable/index.js +0 -1
- package/components/nestable/index.vue +0 -226
- package/components/nestable/methods.js +0 -416
- package/components/progress/style.scss +0 -229
- package/components/table/style.scss +0 -338
- package/components/tabs/index.js +0 -3
- package/components/tabs/index.vue +0 -151
- package/components/timeline/index.js +0 -6
- package/components/timeline/index.vue +0 -76
- package/directive/resize/index.js +0 -30
- package/directive/skeleton/index.js +0 -27
- package/directive/skeleton/style.scss +0 -37
- package/plugins/request/Request.js +0 -68
- package/style/animation.scss +0 -94
- package/style/style.scss +0 -8
- package/tools/rootable.js +0 -75
- /package/components/form/{text-editor → textEditor}/index.js +0 -0
- /package/components/form/{text-editor → textEditor}/preview.js +0 -0
- /package/components/form/{text-editor → textEditor}/preview.vue +0 -0
|
@@ -1,705 +0,0 @@
|
|
|
1
|
-
<template>
|
|
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"
|
|
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&&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
|
-
no-closable no-close-btn>
|
|
79
|
-
<r-form v-model="valid1">
|
|
80
|
-
<r-container>
|
|
81
|
-
<r-row>
|
|
82
|
-
<r-col class="col-12 ltr">
|
|
83
|
-
<r-text-input v-model="link"
|
|
84
|
-
:label="$t('link','renusify')"
|
|
85
|
-
:rules="['required']"></r-text-input>
|
|
86
|
-
</r-col>
|
|
87
|
-
<r-col class="col-12">
|
|
88
|
-
<r-switch-input v-model="target"
|
|
89
|
-
:label="$t('open_new_tab','renusify')"></r-switch-input>
|
|
90
|
-
</r-col>
|
|
91
|
-
</r-row>
|
|
92
|
-
<r-row class="h-end">
|
|
93
|
-
<r-col class="col-auto">
|
|
94
|
-
<r-btn class="color-error-text"
|
|
95
|
-
outlined
|
|
96
|
-
@click.prevent="show=false">{{ $t('cancel', 'renusify') }}
|
|
97
|
-
</r-btn>
|
|
98
|
-
</r-col>
|
|
99
|
-
<r-col class="col-auto">
|
|
100
|
-
<r-btn :disabled="!valid1"
|
|
101
|
-
class="color-success-text"
|
|
102
|
-
outlined
|
|
103
|
-
@click.prevent="handleForm()">{{ $t('send', 'renusify') }}
|
|
104
|
-
</r-btn>
|
|
105
|
-
</r-col>
|
|
106
|
-
</r-row>
|
|
107
|
-
</r-container>
|
|
108
|
-
</r-form>
|
|
109
|
-
</r-modal>
|
|
110
|
-
<r-modal v-model="showImg"
|
|
111
|
-
no-closable no-close-btn>
|
|
112
|
-
<r-form v-model="valid2">
|
|
113
|
-
<r-container>
|
|
114
|
-
<r-file-input v-model="image"
|
|
115
|
-
:headers="headers"
|
|
116
|
-
:label="$t('image','renusify')"
|
|
117
|
-
:size="1"
|
|
118
|
-
:rules="['required']"
|
|
119
|
-
:upload-link="uploadLink"
|
|
120
|
-
accept="image/*"></r-file-input>
|
|
121
|
-
<r-text-input v-model="img_alt"
|
|
122
|
-
:label="$t('img_alt','renusify')"
|
|
123
|
-
:rules="['required']"></r-text-input>
|
|
124
|
-
<r-number-input v-model="img_width" :label="$t('width','renusify')"
|
|
125
|
-
:rules="['required']"></r-number-input>
|
|
126
|
-
<r-row class="h-end">
|
|
127
|
-
<r-col class="col-auto">
|
|
128
|
-
<r-btn class="color-error-text"
|
|
129
|
-
outlined
|
|
130
|
-
@click.prevent="showImg=false">{{ $t('cancel', 'renusify') }}
|
|
131
|
-
</r-btn>
|
|
132
|
-
</r-col>
|
|
133
|
-
<r-col class="col-auto">
|
|
134
|
-
<r-btn :disabled="!valid2"
|
|
135
|
-
class="color-success-text"
|
|
136
|
-
outlined
|
|
137
|
-
@click.prevent="handleImageForm()">{{ $t('send', 'renusify') }}
|
|
138
|
-
</r-btn>
|
|
139
|
-
</r-col>
|
|
140
|
-
</r-row>
|
|
141
|
-
</r-container>
|
|
142
|
-
</r-form>
|
|
143
|
-
</r-modal>
|
|
144
|
-
<r-modal v-model="showVideo"
|
|
145
|
-
no-closable no-close-btn>
|
|
146
|
-
<r-form v-model="valid2">
|
|
147
|
-
<r-container>
|
|
148
|
-
<r-file-input v-model="video"
|
|
149
|
-
:headers="headers"
|
|
150
|
-
:label="$t('video','renusify')"
|
|
151
|
-
:size="1"
|
|
152
|
-
:rules="['required']"
|
|
153
|
-
:upload-link="uploadLink"
|
|
154
|
-
accept="video/mp4,video/webm"></r-file-input>
|
|
155
|
-
<r-number-input v-model="img_width" :label="$t('width','renusify')"
|
|
156
|
-
:rules="['required']"></r-number-input>
|
|
157
|
-
<r-number-input v-model="img_height" :label="$t('height','renusify')"
|
|
158
|
-
:rules="['required']"></r-number-input>
|
|
159
|
-
<r-row class="h-end">
|
|
160
|
-
<r-col class="col-auto">
|
|
161
|
-
<r-btn class="color-error-text"
|
|
162
|
-
outlined
|
|
163
|
-
@click.prevent="showVideo=false">{{ $t('cancel', 'renusify') }}
|
|
164
|
-
</r-btn>
|
|
165
|
-
</r-col>
|
|
166
|
-
<r-col class="col-auto">
|
|
167
|
-
<r-btn :disabled="!valid2"
|
|
168
|
-
class="color-success-text"
|
|
169
|
-
outlined
|
|
170
|
-
@click.prevent="handleVideoForm()">{{ $t('send', 'renusify') }}
|
|
171
|
-
</r-btn>
|
|
172
|
-
</r-col>
|
|
173
|
-
</r-row>
|
|
174
|
-
</r-container>
|
|
175
|
-
</r-form>
|
|
176
|
-
</r-modal>
|
|
177
|
-
<r-modal v-model="showPre"
|
|
178
|
-
no-closable no-close-btn>
|
|
179
|
-
<r-form v-model="valid2">
|
|
180
|
-
<r-container>
|
|
181
|
-
<r-text-input v-model="code_name" :label="$t('name','renusify')"></r-text-input>
|
|
182
|
-
<r-select-input v-model="lang" :items="langs"
|
|
183
|
-
:label="$t('lang','renusify')"
|
|
184
|
-
:rules="['required']"
|
|
185
|
-
just-value></r-select-input>
|
|
186
|
-
<r-text-area v-model="code"
|
|
187
|
-
:label="$t('code','renusify')"
|
|
188
|
-
:rules="['required']"
|
|
189
|
-
ltr></r-text-area>
|
|
190
|
-
<div class="text-end my-3">
|
|
191
|
-
<r-btn class="color-error-text"
|
|
192
|
-
outlined
|
|
193
|
-
@click.prevent="showPre=false">{{ $t('cancel', 'renusify') }}
|
|
194
|
-
</r-btn>
|
|
195
|
-
<r-btn :disabled="!valid2"
|
|
196
|
-
class="color-success-text ms-2"
|
|
197
|
-
outlined
|
|
198
|
-
@click.prevent="handlePreForm()">{{ $t('send', 'renusify') }}
|
|
199
|
-
</r-btn>
|
|
200
|
-
</div>
|
|
201
|
-
</r-container>
|
|
202
|
-
</r-form>
|
|
203
|
-
</r-modal>
|
|
204
|
-
<r-modal v-model="showTable"
|
|
205
|
-
no-closable no-close-btn>
|
|
206
|
-
<r-form v-model="valid2">
|
|
207
|
-
<r-container>
|
|
208
|
-
<r-select-input v-model="table_form.headers"
|
|
209
|
-
:label="$t('headers','renusify')"
|
|
210
|
-
:rules="['required']" just-value multiple tags></r-select-input>
|
|
211
|
-
<r-number-input v-model="table_form.row" :label="$t('row','renusify')" :rules="['required']"></r-number-input>
|
|
212
|
-
|
|
213
|
-
<div class="text-end my-3">
|
|
214
|
-
<r-btn class="color-error-text"
|
|
215
|
-
outlined
|
|
216
|
-
@click.prevent="showTable=false">{{ $t('cancel', 'renusify') }}
|
|
217
|
-
</r-btn>
|
|
218
|
-
<r-btn :disabled="!valid2"
|
|
219
|
-
class="color-success-text ms-2"
|
|
220
|
-
outlined
|
|
221
|
-
@click.prevent="handleTableForm()">{{ $t('send', 'renusify') }}
|
|
222
|
-
</r-btn>
|
|
223
|
-
</div>
|
|
224
|
-
</r-container>
|
|
225
|
-
</r-form>
|
|
226
|
-
</r-modal>
|
|
227
|
-
|
|
228
|
-
</r-container>
|
|
229
|
-
</template>
|
|
230
|
-
|
|
231
|
-
<script>
|
|
232
|
-
import './style.scss'
|
|
233
|
-
import '../../highlight/style.scss'
|
|
234
|
-
import mixin from "../../highlight/mixin";
|
|
235
|
-
|
|
236
|
-
export default {
|
|
237
|
-
name: 'r-text-editor',
|
|
238
|
-
inheritAttrs: false,
|
|
239
|
-
mixins: [mixin],
|
|
240
|
-
props: {
|
|
241
|
-
uploadLink: String,
|
|
242
|
-
modelValue: {
|
|
243
|
-
type: [Object, String], default: () => {
|
|
244
|
-
return {
|
|
245
|
-
text: '',
|
|
246
|
-
files: []
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
},
|
|
250
|
-
tile: {type: Boolean, default: undefined},
|
|
251
|
-
headers: Object
|
|
252
|
-
},
|
|
253
|
-
emits: ['update:modelValue'],
|
|
254
|
-
data() {
|
|
255
|
-
return {
|
|
256
|
-
id: 'text_editor_' + this.$helper.uniqueId(12),
|
|
257
|
-
text: this.modelValue && typeof this.modelValue === 'object' && 'text' in this.modelValue ? this.modelValue.text : this.modelValue,
|
|
258
|
-
files: this.modelValue && typeof this.modelValue === 'object' && 'text' in this.modelValue ? this.modelValue.files : [],
|
|
259
|
-
valid1: false,
|
|
260
|
-
valid2: false,
|
|
261
|
-
show: false,
|
|
262
|
-
showImg: false,
|
|
263
|
-
showVideo: false,
|
|
264
|
-
img_width: 200,
|
|
265
|
-
img_height: 200,
|
|
266
|
-
video: [],
|
|
267
|
-
image: [],
|
|
268
|
-
img_alt: null,
|
|
269
|
-
target: false,
|
|
270
|
-
link: null,
|
|
271
|
-
preSelected: null,
|
|
272
|
-
currentPath: [],
|
|
273
|
-
selectElm: null,
|
|
274
|
-
code_name: null,
|
|
275
|
-
code: '',
|
|
276
|
-
lang: null,
|
|
277
|
-
showPre: false,
|
|
278
|
-
showTable: false,
|
|
279
|
-
table_form: {},
|
|
280
|
-
langs: ['asm', 'bash', 'bf', 'c', 'css', 'csv', 'diff', 'docker', 'git', 'go', 'html', 'http', 'ini', 'java', 'js', 'jsdoc', 'json', 'log', 'lua', 'make', 'pl', 'plain', 'py', 'regex', 'rs', 'sql', 'todo', 'toml', 'ts', 'uri', 'xml', 'yaml'],
|
|
281
|
-
items_undo: {
|
|
282
|
-
'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>',
|
|
283
|
-
'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>',
|
|
284
|
-
},
|
|
285
|
-
items_handle: {
|
|
286
|
-
'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>',
|
|
287
|
-
'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>',
|
|
288
|
-
'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>',
|
|
289
|
-
'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>',
|
|
290
|
-
'createTable': '<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9 4L9 20M15 4L15 20M3 9H21M3 15H21M6.2 20H17.8C18.9201 20 19.4802 20 19.908 19.782C20.2843 19.5903 20.5903 19.2843 20.782 18.908C21 18.4802 21 17.9201 21 16.8V7.2C21 6.0799 21 5.51984 20.782 5.09202C20.5903 4.71569 20.2843 4.40973 19.908 4.21799C19.4802 4 18.9201 4 17.8 4H6.2C5.07989 4 4.51984 4 4.09202 4.21799C3.71569 4.40973 3.40973 4.71569 3.21799 5.09202C3 5.51984 3 6.07989 3 7.2V16.8C3 17.9201 3 18.4802 3.21799 18.908C3.40973 19.2843 3.71569 19.5903 4.09202 19.782C4.51984 20 5.07989 20 6.2 20Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',
|
|
291
|
-
'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>',
|
|
292
|
-
},
|
|
293
|
-
items_format: {
|
|
294
|
-
'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>',
|
|
295
|
-
'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>',
|
|
296
|
-
'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>',
|
|
297
|
-
'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>',
|
|
298
|
-
'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>',
|
|
299
|
-
'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>',
|
|
300
|
-
'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>',
|
|
301
|
-
'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>',
|
|
302
|
-
'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>',
|
|
303
|
-
'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>'
|
|
304
|
-
},
|
|
305
|
-
|
|
306
|
-
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>',
|
|
307
|
-
'<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>',
|
|
308
|
-
'<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>'
|
|
309
|
-
],
|
|
310
|
-
menu: {
|
|
311
|
-
'font': {
|
|
312
|
-
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>',
|
|
313
|
-
items: [{text: 'd1', value: 'display-1'},
|
|
314
|
-
{text: 'd2', value: 'display-2'},
|
|
315
|
-
{text: 'd3', value: 'display-3'},
|
|
316
|
-
{text: 'head1', value: 'headline-1'},
|
|
317
|
-
{text: 'head2', value: 'headline-2'},
|
|
318
|
-
{text: 'head3', value: 'headline-3'},
|
|
319
|
-
{text: 'title-1', value: 'title-1'},
|
|
320
|
-
{text: 'title-2', value: 'title-2'},
|
|
321
|
-
{text: 'title-3', value: 'title-3'},
|
|
322
|
-
{text: 'body-1', value: 'body-1'},
|
|
323
|
-
{text: 'body-2', value: 'body-2'},
|
|
324
|
-
{text: 'body-3', value: 'body-3'},
|
|
325
|
-
{text: 'label-1', value: 'label-1'},
|
|
326
|
-
{text: 'label-2', value: 'label-2'},
|
|
327
|
-
{text: 'label-3', value: 'label-3'},
|
|
328
|
-
]
|
|
329
|
-
},
|
|
330
|
-
'header': {
|
|
331
|
-
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>',
|
|
332
|
-
items: [
|
|
333
|
-
{text: 'H1', value: 'H1'},
|
|
334
|
-
{text: 'H2', value: 'H2'},
|
|
335
|
-
{text: 'H3', value: 'H3'},
|
|
336
|
-
{text: 'H4', value: 'H4'},
|
|
337
|
-
{text: 'H5', value: 'H5'},
|
|
338
|
-
{text: 'H6', value: 'H6'}
|
|
339
|
-
]
|
|
340
|
-
},
|
|
341
|
-
'color': {
|
|
342
|
-
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>',
|
|
343
|
-
items: [
|
|
344
|
-
{text: 'color', value: 'color-disabled-text'},
|
|
345
|
-
{text: 'color', value: 'color-one-text'},
|
|
346
|
-
{text: 'color', value: 'color-two-text'},
|
|
347
|
-
{text: 'color', value: 'color-three-text'},
|
|
348
|
-
{text: 'color', value: 'color-error-text'},
|
|
349
|
-
{text: 'color', value: 'color-info-text'},
|
|
350
|
-
{text: 'color', value: 'color-warning-text'},
|
|
351
|
-
{text: 'color', value: 'color-success-text'},
|
|
352
|
-
{text: 'color', value: 'color-white-text'},
|
|
353
|
-
{text: 'color', value: 'color-black-text'}
|
|
354
|
-
]
|
|
355
|
-
},
|
|
356
|
-
'background': {
|
|
357
|
-
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>',
|
|
358
|
-
items: [
|
|
359
|
-
{text: 'color', value: 'color-one'},
|
|
360
|
-
{text: 'color', value: 'color-two'},
|
|
361
|
-
{text: 'color', value: 'color-three'},
|
|
362
|
-
{text: 'color', value: 'color-error'},
|
|
363
|
-
{text: 'color', value: 'color-info'},
|
|
364
|
-
{text: 'color', value: 'color-warning'},
|
|
365
|
-
{text: 'color', value: 'color-success'},
|
|
366
|
-
{text: 'color', value: 'color-black'},
|
|
367
|
-
{text: 'color', value: 'color-white'},
|
|
368
|
-
]
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
},
|
|
373
|
-
created() {
|
|
374
|
-
if (this.uploadLink) {
|
|
375
|
-
this.items_handle['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>'
|
|
376
|
-
this.items_handle['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>'
|
|
377
|
-
|
|
378
|
-
}
|
|
379
|
-
},
|
|
380
|
-
mounted() {
|
|
381
|
-
this.format('defaultParagraphSeparator', 'br')
|
|
382
|
-
this.element.addEventListener('paste', function (e) {
|
|
383
|
-
e.preventDefault()
|
|
384
|
-
const text = (e.originalEvent || e).clipboardData.getData('text/plain')
|
|
385
|
-
|
|
386
|
-
document.execCommand('insertHTML', false, text)
|
|
387
|
-
})
|
|
388
|
-
},
|
|
389
|
-
beforeUnmount() {
|
|
390
|
-
this.element.removeEventListener('paste', () => {
|
|
391
|
-
})
|
|
392
|
-
},
|
|
393
|
-
computed: {
|
|
394
|
-
c_tile() {
|
|
395
|
-
if (this.tile === undefined && this.$r.inputs.tile) {
|
|
396
|
-
return this.$r.inputs.tile
|
|
397
|
-
}
|
|
398
|
-
return this.tile
|
|
399
|
-
},
|
|
400
|
-
element() {
|
|
401
|
-
return this.$refs['editorContent' + this.id]
|
|
402
|
-
},
|
|
403
|
-
is_object() {
|
|
404
|
-
return this.modelValue && typeof this.modelValue === 'object' && 'text' in this.modelValue;
|
|
405
|
-
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
},
|
|
409
|
-
methods: {
|
|
410
|
-
content() {
|
|
411
|
-
return this.element.innerHTML
|
|
412
|
-
},
|
|
413
|
-
addClass(e) {
|
|
414
|
-
if (this.selectElm) {
|
|
415
|
-
this.selectElm.classList = e.join(' ')
|
|
416
|
-
this.updateText()
|
|
417
|
-
}
|
|
418
|
-
},
|
|
419
|
-
borderd(el) {
|
|
420
|
-
if (this.selectElm) {
|
|
421
|
-
this.selectElm.style.border = null
|
|
422
|
-
}
|
|
423
|
-
if (!el.style) {
|
|
424
|
-
el = el.parentNode
|
|
425
|
-
this.selectElm = el
|
|
426
|
-
}
|
|
427
|
-
if (!el.style) {
|
|
428
|
-
this.selectElm = null
|
|
429
|
-
return
|
|
430
|
-
}
|
|
431
|
-
if (el.style.border) {
|
|
432
|
-
el.style.border = null
|
|
433
|
-
this.selectElm = null
|
|
434
|
-
return
|
|
435
|
-
}
|
|
436
|
-
this.selectElm = el
|
|
437
|
-
el.style.border = '1px solid var(--color-one)'
|
|
438
|
-
},
|
|
439
|
-
bordered() {
|
|
440
|
-
const a = this.getSelection()
|
|
441
|
-
this.currentPath = []
|
|
442
|
-
const that = this
|
|
443
|
-
|
|
444
|
-
function f(node) {
|
|
445
|
-
if (node.classList && node.classList.contains('editor-content')) {
|
|
446
|
-
that.currentPath.reverse()
|
|
447
|
-
return
|
|
448
|
-
}
|
|
449
|
-
that.currentPath.push(node.parentNode)
|
|
450
|
-
f(node.parentNode)
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
if (a) {
|
|
454
|
-
this.currentPath = [a?.anchorNode]
|
|
455
|
-
f(a?.anchorNode)
|
|
456
|
-
if (a?.anchorNode.classList && a?.anchorNode.classList.contains('editor-content')) {
|
|
457
|
-
return
|
|
458
|
-
}
|
|
459
|
-
this.borderd(a?.anchorNode)
|
|
460
|
-
}
|
|
461
|
-
},
|
|
462
|
-
deleteImage(img, i) {
|
|
463
|
-
this.$axios.delete(this.uploadLink,
|
|
464
|
-
{
|
|
465
|
-
data: {link: img},
|
|
466
|
-
headers: this.headers
|
|
467
|
-
}
|
|
468
|
-
).then(() => {
|
|
469
|
-
this.files.splice(i, 1)
|
|
470
|
-
this.updateText()
|
|
471
|
-
})
|
|
472
|
-
|
|
473
|
-
},
|
|
474
|
-
handleImageForm() {
|
|
475
|
-
if (!this.getSelection() || !this.image || !this.img_alt) {
|
|
476
|
-
this.$toast(this.$t('invalid_data', 'renusify'), {type: 'error'})
|
|
477
|
-
return
|
|
478
|
-
}
|
|
479
|
-
let sel = this.getSelection()
|
|
480
|
-
sel.removeAllRanges()
|
|
481
|
-
sel.addRange(this.preSelected)
|
|
482
|
-
let url = '<img src="' + this.image[0] + '?w=' + this.img_width + '" alt="' + this.img_alt + '" width="' + this.img_width + '" />'
|
|
483
|
-
this.files.push(this.image[0])
|
|
484
|
-
document.execCommand('insertHTML', true, url)
|
|
485
|
-
this.showImg = false
|
|
486
|
-
},
|
|
487
|
-
handleVideoForm() {
|
|
488
|
-
if (!this.getSelection() || !this.video) {
|
|
489
|
-
this.$toast(this.$t('invalid_data', 'renusify'), {type: 'error'})
|
|
490
|
-
return
|
|
491
|
-
}
|
|
492
|
-
let sel = this.getSelection()
|
|
493
|
-
sel.removeAllRanges()
|
|
494
|
-
sel.addRange(this.preSelected)
|
|
495
|
-
let url = '<video controls="1" src="' + this.video[0] + '" width="' + this.img_width + '" height="' + this.img_height + '"></video>'
|
|
496
|
-
this.files.push(this.video[0])
|
|
497
|
-
document.execCommand('insertHTML', true, url)
|
|
498
|
-
this.showVideo = false
|
|
499
|
-
},
|
|
500
|
-
handleTableForm() {
|
|
501
|
-
if (!this.getSelection() || !this.table_form.row || !this.table_form.headers) {
|
|
502
|
-
this.$toast(this.$t('invalid_data', 'renusify'), {type: 'error'})
|
|
503
|
-
return
|
|
504
|
-
}
|
|
505
|
-
let sel = this.getSelection()
|
|
506
|
-
sel.removeAllRanges()
|
|
507
|
-
sel.addRange(this.preSelected)
|
|
508
|
-
let t = '<table><thead><tr>'
|
|
509
|
-
for (let i = 0; i < this.table_form.headers.length; i++) {
|
|
510
|
-
t += `<th>${this.table_form.headers[i]}</th>`
|
|
511
|
-
}
|
|
512
|
-
t += '</tr></thead><tbody>'
|
|
513
|
-
for (let i = 0; i < this.table_form.row; i++) {
|
|
514
|
-
t += '<tr>'
|
|
515
|
-
for (let i = 0; i < this.table_form.headers.length; i++) {
|
|
516
|
-
t += `<td></td>`
|
|
517
|
-
}
|
|
518
|
-
t += '</tr>'
|
|
519
|
-
}
|
|
520
|
-
t += '</tbody></table>'
|
|
521
|
-
document.execCommand('insertHTML', true, t)
|
|
522
|
-
this.showTable = false
|
|
523
|
-
},
|
|
524
|
-
async handlePreForm() {
|
|
525
|
-
if (!this.getSelection() || !this.code || !this.lang) {
|
|
526
|
-
this.$toast(this.$t('invalid_data', 'renusify'), {type: 'error'})
|
|
527
|
-
return
|
|
528
|
-
}
|
|
529
|
-
let sel = this.getSelection()
|
|
530
|
-
sel.removeAllRanges()
|
|
531
|
-
sel.addRange(this.preSelected)
|
|
532
|
-
let url = `<div class="${this.$r.prefix}highlight" >`
|
|
533
|
-
if (this.code_name) {
|
|
534
|
-
url += `<div class="highlight-name title-3 font-weight-bold mb-3">${this.code_name}</div>`
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
url += `<div class="highlight-code highlight-lang-${this.lang}">${await this.highlight(this.code, this.lang)}</div></div>`
|
|
538
|
-
document.execCommand('insertHTML', true, url)
|
|
539
|
-
this.showPre = false
|
|
540
|
-
},
|
|
541
|
-
handleForm() {
|
|
542
|
-
if (!this.getSelection() || !this.link) {
|
|
543
|
-
this.$toast(this.$t('invalid_data', 'renusify'), {type: 'error'})
|
|
544
|
-
return
|
|
545
|
-
}
|
|
546
|
-
let sel = this.getSelection()
|
|
547
|
-
sel.removeAllRanges()
|
|
548
|
-
sel.addRange(this.preSelected)
|
|
549
|
-
let url = '<a href="' + this.link.trim() + '"'
|
|
550
|
-
if (this.target) {
|
|
551
|
-
url += 'target="_blank" rel="nofollow"'
|
|
552
|
-
}
|
|
553
|
-
if (this.link.startsWith('#')) {
|
|
554
|
-
url += `id="${this.link.replace('#', '')}"`
|
|
555
|
-
}
|
|
556
|
-
url += '>' + sel + '</a>'
|
|
557
|
-
|
|
558
|
-
document.execCommand('insertHTML', true, url)
|
|
559
|
-
this.show = false
|
|
560
|
-
},
|
|
561
|
-
getSelection() {
|
|
562
|
-
if (window.getSelection) {
|
|
563
|
-
return window.getSelection()
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
return false
|
|
567
|
-
},
|
|
568
|
-
handleOpen(e) {
|
|
569
|
-
if (e === true) {
|
|
570
|
-
let sel = window.getSelection()
|
|
571
|
-
if (sel.rangeCount > 0) {
|
|
572
|
-
this.preSelected = sel.getRangeAt(0)
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
},
|
|
576
|
-
addCss(e) {
|
|
577
|
-
let btn = e['menu']
|
|
578
|
-
e = e['item'].value
|
|
579
|
-
if (!this.getSelection()) {
|
|
580
|
-
return
|
|
581
|
-
}
|
|
582
|
-
let sel = this.getSelection()
|
|
583
|
-
sel.removeAllRanges()
|
|
584
|
-
sel.addRange(this.preSelected)
|
|
585
|
-
if (btn === 'header') {
|
|
586
|
-
document.execCommand('insertHTML', true, '<' + e.trim() + '>' + sel + '</' + e.trim() + '>')
|
|
587
|
-
return null
|
|
588
|
-
}
|
|
589
|
-
let selectedElement = sel.focusNode.parentNode
|
|
590
|
-
if (selectedElement.tagName === 'SPAN' && selectedElement.innerText === sel.toString()) {
|
|
591
|
-
let cls = selectedElement.classList.value.split(' ')
|
|
592
|
-
for (let c of cls) {
|
|
593
|
-
if (this.menu[btn]['items'].includes(c.trim())) {
|
|
594
|
-
selectedElement.classList.remove(c.trim())
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
selectedElement.classList.add(e)
|
|
599
|
-
} else {
|
|
600
|
-
let cls = ''
|
|
601
|
-
if (selectedElement.tagName === 'SPAN') {
|
|
602
|
-
cls = selectedElement.classList.value
|
|
603
|
-
}
|
|
604
|
-
e = cls + ' ' + e
|
|
605
|
-
|
|
606
|
-
document.execCommand('insertHTML', true, "<span class='" + e.trim() + "'>" + sel + '</span>')
|
|
607
|
-
}
|
|
608
|
-
},
|
|
609
|
-
handle(e) {
|
|
610
|
-
let selectedElement = window.getSelection().focusNode.parentNode
|
|
611
|
-
|
|
612
|
-
if (selectedElement.tagName === e) {
|
|
613
|
-
this.format('formatBlock', '<div>')
|
|
614
|
-
} else {
|
|
615
|
-
if (e === 'createLink') {
|
|
616
|
-
this.link = null
|
|
617
|
-
this.target = false
|
|
618
|
-
this.handleOpen(true)
|
|
619
|
-
this.show = true
|
|
620
|
-
} else if (e === 'createTable') {
|
|
621
|
-
this.table_form = {}
|
|
622
|
-
this.handleOpen(true)
|
|
623
|
-
this.showTable = true
|
|
624
|
-
} else if (e === 'PRE') {
|
|
625
|
-
this.code = ''
|
|
626
|
-
this.lang = null
|
|
627
|
-
this.handleOpen(true)
|
|
628
|
-
this.showPre = true
|
|
629
|
-
} else if (e === 'insertImage') {
|
|
630
|
-
if (this.uploadLink) {
|
|
631
|
-
this.image = []
|
|
632
|
-
this.img_alt = null
|
|
633
|
-
this.handleOpen(true)
|
|
634
|
-
this.showImg = true
|
|
635
|
-
}
|
|
636
|
-
} else if (e === 'insertVideo') {
|
|
637
|
-
if (this.uploadLink) {
|
|
638
|
-
this.video = []
|
|
639
|
-
this.handleOpen(true)
|
|
640
|
-
this.showVideo = true
|
|
641
|
-
}
|
|
642
|
-
} else if (e === 'insertDIV') {
|
|
643
|
-
const d = document.createElement('div')
|
|
644
|
-
d.innerText = 'div'
|
|
645
|
-
if (this.selectElm) {
|
|
646
|
-
this.selectElm.appendChild(d)
|
|
647
|
-
} else {
|
|
648
|
-
selectedElement.appendChild(d)
|
|
649
|
-
}
|
|
650
|
-
} else if (e === 'insertLINE') {
|
|
651
|
-
const d = document.createElement('div')
|
|
652
|
-
d.innerText = 'line'
|
|
653
|
-
this.element.appendChild(d)
|
|
654
|
-
} else {
|
|
655
|
-
this.format('formatBlock', e)
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
this.updateText()
|
|
659
|
-
},
|
|
660
|
-
handle_dir(e) {
|
|
661
|
-
let name = ''
|
|
662
|
-
switch (e) {
|
|
663
|
-
case 0:
|
|
664
|
-
name = 'text-start'
|
|
665
|
-
break
|
|
666
|
-
case 1:
|
|
667
|
-
name = 'text-center'
|
|
668
|
-
break
|
|
669
|
-
case 2:
|
|
670
|
-
name = 'text-end'
|
|
671
|
-
break
|
|
672
|
-
}
|
|
673
|
-
let selectedElement = window.getSelection().focusNode
|
|
674
|
-
if (selectedElement === null) {
|
|
675
|
-
return null
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
let parentNode = selectedElement.parentNode
|
|
679
|
-
|
|
680
|
-
if (parentNode.classList.contains('editor-content')) {
|
|
681
|
-
selectedElement.classList.remove('text-start', 'text-center', 'text-end')
|
|
682
|
-
selectedElement.classList.add(name)
|
|
683
|
-
} else {
|
|
684
|
-
parentNode.classList.remove('text-start', 'text-center', 'text-end')
|
|
685
|
-
parentNode.classList.add(name)
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
this.updateText()
|
|
689
|
-
},
|
|
690
|
-
updateText() {
|
|
691
|
-
this.$emit('update:modelValue', {
|
|
692
|
-
text: this.element.innerHTML,
|
|
693
|
-
files: this.files
|
|
694
|
-
})
|
|
695
|
-
},
|
|
696
|
-
format(command, value) {
|
|
697
|
-
if (command === 'removeFormat') {
|
|
698
|
-
document.execCommand('insertHTML', true, '<div>' + this.getSelection().toString() + '</div>')
|
|
699
|
-
} else {
|
|
700
|
-
document.execCommand(command, false, value)
|
|
701
|
-
}
|
|
702
|
-
},
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
</script>
|