renusify 1.2.3 → 1.2.4
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/notify/notification.vue +13 -11
- package/components/button/style.scss +2 -3
- package/components/chat/MessageList.vue +6 -6
- package/components/chat/chatMsg.vue +2 -2
- package/components/chip/style.scss +1 -1
- package/components/codeEditor/highlightCss.vue +116 -0
- package/components/codeEditor/highlightHtml.vue +167 -66
- package/components/codeEditor/highlightJs.vue +242 -0
- package/components/codeEditor/index.vue +259 -453
- package/components/codeEditor/run.vue +46 -29
- package/components/float/index.vue +14 -14
- package/components/form/checkbox.vue +1 -1
- package/components/form/colorPicker/picker.vue +1 -1
- package/components/form/input.vue +4 -4
- package/components/form/number.vue +1 -1
- package/components/form/radioInput.vue +1 -1
- package/components/html2pdf/index.vue +13 -13
- package/components/list/style.scss +5 -5
- package/components/menu/index.vue +1 -1
- package/components/skeleton/index.vue +1 -1
- package/directive/title/style.scss +1 -1
- package/package.json +1 -1
- package/style/app.scss +3 -3
- package/style/variables/base.scss +28 -8
- package/components/codeEditor/highlightScript.vue +0 -134
|
@@ -1,453 +1,259 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="`${$r.prefix}code-editor`">
|
|
3
|
-
<div class="code-action text-right">
|
|
4
|
-
<r-btn
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<span class="color-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
</
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
},
|
|
261
|
-
buildHtml(template) {
|
|
262
|
-
if (!template) {
|
|
263
|
-
return ''
|
|
264
|
-
}
|
|
265
|
-
let data = template.outerHTML
|
|
266
|
-
data = this.$helper.replacer(data, '<', '<')
|
|
267
|
-
data = this.$helper.replacer(data, '>', '>')
|
|
268
|
-
data = data.split('')
|
|
269
|
-
let res = ''
|
|
270
|
-
let in_quta = false
|
|
271
|
-
data.forEach((c, i) => {
|
|
272
|
-
if (c === '=') {
|
|
273
|
-
res += '<span class="color-blue code-editor-span">=</span>'
|
|
274
|
-
} else if ((c === '"' || c === "'") && !in_quta) {
|
|
275
|
-
in_quta = c
|
|
276
|
-
res += '<span class="color-green code-editor-span">' + c
|
|
277
|
-
} else if (c === in_quta) {
|
|
278
|
-
in_quta = false
|
|
279
|
-
res += c + '</span>'
|
|
280
|
-
} else {
|
|
281
|
-
res += c
|
|
282
|
-
}
|
|
283
|
-
})
|
|
284
|
-
|
|
285
|
-
res = this.$helper.replacer(res, '<', '<span class="color-orange code-editor-span"><')
|
|
286
|
-
res = this.$helper.replacer(res, '>', '></span>')
|
|
287
|
-
res = this.$helper.replacer(res, '{{', '<span class="color-blue code-editor-span">{{')
|
|
288
|
-
res = this.$helper.replacer(res, '}}', '}}</span>')
|
|
289
|
-
|
|
290
|
-
let regex = /\+(.*?)\+/g
|
|
291
|
-
let matched = res.matchAll(regex)
|
|
292
|
-
for (const match of matched) {
|
|
293
|
-
res = this.$helper.replacer(res, match[0], '<span class="color-blue code-editor-span">' + match[0] + '</span>')
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
res = this.re_words(res)
|
|
297
|
-
res = this.re_comment(res)
|
|
298
|
-
res = this.re_func(res)
|
|
299
|
-
|
|
300
|
-
return res
|
|
301
|
-
},
|
|
302
|
-
buildScript() {
|
|
303
|
-
if (!this.script) {
|
|
304
|
-
return ''
|
|
305
|
-
}
|
|
306
|
-
let data = this.script.split('')
|
|
307
|
-
let str = this.script.trim()
|
|
308
|
-
|
|
309
|
-
if (str.substr(0, 1) === '{') {
|
|
310
|
-
str = str.substr(1, str.length - 2)
|
|
311
|
-
}
|
|
312
|
-
let res = ''
|
|
313
|
-
|
|
314
|
-
let in_quta = false
|
|
315
|
-
data.forEach((c, i) => {
|
|
316
|
-
if (['=', '&', '{', '}', '<', '>'].includes(c)) {
|
|
317
|
-
res += '<span class="color-blue code-editor-span">' + c + '</span>'
|
|
318
|
-
} else if ([',', ';', ':'].includes(c)) {
|
|
319
|
-
res += '<span class="color-orange code-editor-span">' + c + '</span>'
|
|
320
|
-
} else if (parseInt(c) > -1) {
|
|
321
|
-
res += '<span class="color-number code-editor-span">' + c + '</span>'
|
|
322
|
-
} else if ((c === '"' || c === "'" || c === "`") && !in_quta) {
|
|
323
|
-
in_quta = c
|
|
324
|
-
res += '<span class="color-green code-editor-span">' + c
|
|
325
|
-
} else if (c === in_quta) {
|
|
326
|
-
in_quta = false
|
|
327
|
-
res += c + '</span>'
|
|
328
|
-
} else {
|
|
329
|
-
res += c
|
|
330
|
-
}
|
|
331
|
-
})
|
|
332
|
-
|
|
333
|
-
res = this.re_words(res)
|
|
334
|
-
res = this.re_comment(res)
|
|
335
|
-
res = this.re_func(res)
|
|
336
|
-
|
|
337
|
-
// main function vuejs methods created ,...
|
|
338
|
-
this.strToObj(str).forEach((item) => {
|
|
339
|
-
if (item) {
|
|
340
|
-
res = this.$helper.replacer(res, item, '<span class="color-func code-editor-span">' + item + '</span>')
|
|
341
|
-
}
|
|
342
|
-
})
|
|
343
|
-
|
|
344
|
-
return res
|
|
345
|
-
},
|
|
346
|
-
re_words(res) {
|
|
347
|
-
res = this.$helper.replacer(res, 'import ', '<span class="color-orange code-editor-span">import</span> ')
|
|
348
|
-
res = this.$helper.replacer(res, ' from ', ' <span class="color-orange code-editor-span">from</span> ')
|
|
349
|
-
res = this.$helper.replacer(res, ' window.', ' <span class="color-orange code-editor-span">window</span>.')
|
|
350
|
-
res = this.$helper.replacer(res, ' new ', ' <span class="color-orange code-editor-span">new</span> ')
|
|
351
|
-
res = this.$helper.replacer(res, ' var ', ' <span class="color-orange code-editor-span">var</span> ')
|
|
352
|
-
res = this.$helper.replacer(res, ' let ', ' <span class="color-orange code-editor-span">let</span> ')
|
|
353
|
-
res = this.$helper.replacer(res, ' const ', ' <span class="color-orange code-editor-span">const</span> ')
|
|
354
|
-
res = this.$helper.replacer(res, ' return ', ' <span class="color-orange code-editor-span">return</span> ')
|
|
355
|
-
res = this.$helper.replacer(res, ' true', ' <span class="color-orange code-editor-span">true</span>')
|
|
356
|
-
res = this.$helper.replacer(res, ' false', ' <span class="color-orange code-editor-span">false</span>')
|
|
357
|
-
res = this.$helper.replacer(res, ' this.', ' <span class="color-orange code-editor-span">this</span>.')
|
|
358
|
-
|
|
359
|
-
return res
|
|
360
|
-
},
|
|
361
|
-
re_comment(res) {
|
|
362
|
-
let regex = /(\/\*[\w\'\s\r\n\*]*\*\/)|(\/\/[\w\s\']*)|(\<![\-\-\s\w\>\/]*\>)/g
|
|
363
|
-
let matched = res.matchAll(regex)
|
|
364
|
-
for (const match of matched) {
|
|
365
|
-
res = this.$helper.replacer(res, match[0], '<span class="color-comment code-editor-span">' + match[0] + '</span>')
|
|
366
|
-
}
|
|
367
|
-
return res
|
|
368
|
-
},
|
|
369
|
-
re_func(res) {
|
|
370
|
-
//function like Date()
|
|
371
|
-
let regex = /([a-zA-Z_{1}][a-zA-Z0-9_]+)[ ]{0,1}(?=\()/g
|
|
372
|
-
let matched = res.matchAll(regex)
|
|
373
|
-
for (const match of matched) {
|
|
374
|
-
res = this.$helper.replacer(res, match[0], '<span class="color-func2 code-editor-span">' + match[0] + '</span>')
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
//function like $r $d()
|
|
378
|
-
regex = /(\$([a-zA-z0-9]*)[.|(])/g
|
|
379
|
-
matched = res.matchAll(regex)
|
|
380
|
-
for (const match of matched) {
|
|
381
|
-
res = this.$helper.replacer(res, match[0].substr(0, match[0].length - 1), '<span class="color-func code-editor-span">' + match[0].substr(0, match[0].length - 1) + '</span>')
|
|
382
|
-
}
|
|
383
|
-
res = this.$helper.replacer(res, '(', '<span class="color-func2 code-editor-span">(</span>')
|
|
384
|
-
res = this.$helper.replacer(res, ')', '<span class="color-func2 code-editor-span">)</span>')
|
|
385
|
-
return res
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
</script>
|
|
390
|
-
<style lang="scss">
|
|
391
|
-
@import "../../style/include";
|
|
392
|
-
|
|
393
|
-
.#{$prefix}code-editor {
|
|
394
|
-
position: relative;
|
|
395
|
-
white-space: break-spaces;
|
|
396
|
-
caret-color: white;
|
|
397
|
-
background-color: #15212e;
|
|
398
|
-
color: #fff;
|
|
399
|
-
padding: 10px;
|
|
400
|
-
|
|
401
|
-
.code-script, .code-template {
|
|
402
|
-
padding: 0 20px;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
.code-wrapper {
|
|
406
|
-
direction: ltr;
|
|
407
|
-
text-align: left;
|
|
408
|
-
padding: 10px;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
.code-compile {
|
|
412
|
-
background-color: #fafafa;
|
|
413
|
-
min-height: 300px;
|
|
414
|
-
padding: 10px;
|
|
415
|
-
margin: 0 -10px -10px -10px;
|
|
416
|
-
color: black;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
.color-func {
|
|
420
|
-
color: #db92e3;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
.color-func2 {
|
|
424
|
-
color: #deca10;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
.color-orange {
|
|
428
|
-
color: orange;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
.color-green {
|
|
433
|
-
color: #0cde27;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
.color-blue {
|
|
438
|
-
color: #3bb7ee;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
.color-number {
|
|
442
|
-
color: #7ad5ff;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
.color-purple {
|
|
446
|
-
color: #d2a8ee;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
.color-comment {
|
|
450
|
-
color: #898d8c;
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="`${$r.prefix}code-editor`">
|
|
3
|
+
<div class="code-action text-right">
|
|
4
|
+
<r-btn
|
|
5
|
+
class="image-copy"
|
|
6
|
+
icon
|
|
7
|
+
text
|
|
8
|
+
@click.prevent="$helper.copy($refs.codeView.innerText)"
|
|
9
|
+
>
|
|
10
|
+
<r-icon v-html="$r.icons.copy"></r-icon>
|
|
11
|
+
</r-btn>
|
|
12
|
+
<r-btn v-if="show === 'code' && runnable" text @click="show = 'run'">
|
|
13
|
+
run
|
|
14
|
+
<r-icon v-html="$r.icons.play" exact></r-icon>
|
|
15
|
+
</r-btn>
|
|
16
|
+
<r-btn v-if="show === 'run'" text @click="show = 'code'">
|
|
17
|
+
<r-icon v-html="$r.icons.code_tags" exact></r-icon>
|
|
18
|
+
</r-btn>
|
|
19
|
+
</div>
|
|
20
|
+
<div v-show="false" ref="codeSlot">
|
|
21
|
+
<slot></slot>
|
|
22
|
+
</div>
|
|
23
|
+
<div v-if="show === 'run' && runnable" class="code-compile">
|
|
24
|
+
<r-code-editor-run
|
|
25
|
+
:id="id"
|
|
26
|
+
:script="script"
|
|
27
|
+
:style="style"
|
|
28
|
+
:template="template"
|
|
29
|
+
></r-code-editor-run>
|
|
30
|
+
</div>
|
|
31
|
+
<div v-show="show !== 'run'" ref="codeView" class="code-wrapper">
|
|
32
|
+
<div v-show="templateShow">
|
|
33
|
+
<span class="color-green"><template></span>
|
|
34
|
+
<highlight-html v-model="template"></highlight-html>
|
|
35
|
+
<span class="color-green"></template></span>
|
|
36
|
+
<br/>
|
|
37
|
+
</div>
|
|
38
|
+
<div v-show="scriptShow">
|
|
39
|
+
<span class="color-orange"
|
|
40
|
+
><script>
|
|
41
|
+
<br/>
|
|
42
|
+
export default {</span
|
|
43
|
+
>
|
|
44
|
+
<highlight-script v-model="script"></highlight-script>
|
|
45
|
+
<span class="color-orange">}<br/><script></span>
|
|
46
|
+
</div>
|
|
47
|
+
<div v-show="styleShow">
|
|
48
|
+
<span class="color-orange"
|
|
49
|
+
><style lang<span class="color-green">="css"</span>></span
|
|
50
|
+
>
|
|
51
|
+
<highlight-css v-model="style"></highlight-css>
|
|
52
|
+
<span class="color-orange"><style></span>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<script>
|
|
59
|
+
import RCodeEditorRun from "./run";
|
|
60
|
+
import highlightHtml from "./highlightHtml";
|
|
61
|
+
import HighlightScript from "@/components/codeEditor/highlightJs";
|
|
62
|
+
import HighlightCss from "@/components/codeEditor/highlightCss";
|
|
63
|
+
|
|
64
|
+
export default {
|
|
65
|
+
name: "r-code-editor",
|
|
66
|
+
components: {HighlightCss, HighlightScript, highlightHtml, RCodeEditorRun},
|
|
67
|
+
props: {
|
|
68
|
+
runnable: Boolean,
|
|
69
|
+
templateShow: {type: Boolean, default: true},
|
|
70
|
+
scriptShow: {type: Boolean, default: true},
|
|
71
|
+
styleShow: {type: Boolean, default: true},
|
|
72
|
+
Template: String,
|
|
73
|
+
Script: String,
|
|
74
|
+
Style: String,
|
|
75
|
+
},
|
|
76
|
+
emits: ["update:template", "update:script", "update:style"],
|
|
77
|
+
data() {
|
|
78
|
+
return {
|
|
79
|
+
show: "code",
|
|
80
|
+
code: "",
|
|
81
|
+
edited: false,
|
|
82
|
+
template: this.Template,
|
|
83
|
+
script: this.Script,
|
|
84
|
+
style: this.Style,
|
|
85
|
+
id: this.$helper.uniqueId(),
|
|
86
|
+
};
|
|
87
|
+
},
|
|
88
|
+
created() {
|
|
89
|
+
if (!this.$r.icons.play) {
|
|
90
|
+
this.$r.icons.play =
|
|
91
|
+
'<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.14v14l11-7l-11-7Z"/></svg>';
|
|
92
|
+
}
|
|
93
|
+
if (!this.$r.icons.code_tags) {
|
|
94
|
+
this.$r.icons.code_tags =
|
|
95
|
+
'<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.6 16.6l4.6-4.6l-4.6-4.6L16 6l6 6l-6 6l-1.4-1.4m-5.2 0L4.8 12l4.6-4.6L8 6l-6 6l6 6l1.4-1.4Z"/></svg>';
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
mounted() {
|
|
99
|
+
this.get_code("codeSlot");
|
|
100
|
+
},
|
|
101
|
+
watch: {
|
|
102
|
+
template: function () {
|
|
103
|
+
this.$emit("update:template", this.template);
|
|
104
|
+
},
|
|
105
|
+
script: function () {
|
|
106
|
+
this.$emit("update:script", this.script);
|
|
107
|
+
},
|
|
108
|
+
style: function () {
|
|
109
|
+
this.$emit("update:style", this.style);
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
methods: {
|
|
113
|
+
toHTML(htmlString) {
|
|
114
|
+
let div = document.createElement("div");
|
|
115
|
+
div.innerHTML = htmlString;
|
|
116
|
+
return div;
|
|
117
|
+
},
|
|
118
|
+
get_code(slot = "codeSlot") {
|
|
119
|
+
if (!this.$refs[slot]) {
|
|
120
|
+
setTimeout(() => {
|
|
121
|
+
this.get_code(slot);
|
|
122
|
+
}, 100);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
this.code = this.toHTML(this.$refs[slot].innerHTML);
|
|
127
|
+
let temp = this.code.querySelector(".code-template");
|
|
128
|
+
|
|
129
|
+
if (temp && temp.childNodes.length > 0) {
|
|
130
|
+
for (let i = 0; i < temp.childNodes.length; i++) {
|
|
131
|
+
if (temp.childNodes[i].nodeName === "#comment") {
|
|
132
|
+
this.template = this.toHTML(temp.childNodes[i].nodeValue).innerHTML;
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
let script = this.code.querySelector(".code-script");
|
|
139
|
+
if (script && script.childNodes.length > 0) {
|
|
140
|
+
for (let i = 0; i < script.childNodes.length; i++) {
|
|
141
|
+
if (script.childNodes[i].nodeName === "#comment") {
|
|
142
|
+
this.script = script.childNodes[i].nodeValue;
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
</script>
|
|
151
|
+
|
|
152
|
+
<style lang="scss">
|
|
153
|
+
@import "~renusify/style/include";
|
|
154
|
+
.#{$prefix}code-editor {
|
|
155
|
+
position: relative;
|
|
156
|
+
white-space: break-spaces;
|
|
157
|
+
caret-color: white;
|
|
158
|
+
background-color: #15212e;
|
|
159
|
+
color: #fff;
|
|
160
|
+
padding: 10px;
|
|
161
|
+
|
|
162
|
+
.code-script,
|
|
163
|
+
.code-template {
|
|
164
|
+
padding: 0 20px;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.code-wrapper {
|
|
168
|
+
direction: ltr;
|
|
169
|
+
text-align: left;
|
|
170
|
+
padding: 10px;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.code-compile {
|
|
174
|
+
background-color: #fafafa;
|
|
175
|
+
min-height: 300px;
|
|
176
|
+
padding: 10px;
|
|
177
|
+
margin: 0 -10px -10px -10px;
|
|
178
|
+
color: black;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.color-func {
|
|
182
|
+
color: #db92e3;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.color-func2 {
|
|
186
|
+
color: #deca10;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.color-orange {
|
|
190
|
+
color: orange;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.color-green {
|
|
194
|
+
color: #0cde27;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.color-blue {
|
|
198
|
+
color: #3bb7ee;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.color-number {
|
|
202
|
+
color: #7ad5ff;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.color-purple {
|
|
206
|
+
color: #d2a8ee;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.color-comment {
|
|
210
|
+
color: #898d8c;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.code-editor-highlight {
|
|
214
|
+
position: relative;
|
|
215
|
+
|
|
216
|
+
.text-preview {
|
|
217
|
+
white-space: pre-wrap;
|
|
218
|
+
word-break: keep-all;
|
|
219
|
+
overflow-wrap: break-word;
|
|
220
|
+
min-height: 40px;
|
|
221
|
+
font-size: 14px;
|
|
222
|
+
letter-spacing: 2px;
|
|
223
|
+
line-height: 20px;
|
|
224
|
+
margin: 0;
|
|
225
|
+
border: 0;
|
|
226
|
+
|
|
227
|
+
padding: 12px;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
textarea {
|
|
231
|
+
&::selection {
|
|
232
|
+
background-color: #fafafa;
|
|
233
|
+
-webkit-text-fill-color: #000;
|
|
234
|
+
color: #000;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
padding: 12px;
|
|
238
|
+
margin: 0;
|
|
239
|
+
border: 0;
|
|
240
|
+
font-size: 14px;
|
|
241
|
+
letter-spacing: 2px;
|
|
242
|
+
line-height: 20px;
|
|
243
|
+
-webkit-font-smoothing: antialiased;
|
|
244
|
+
-webkit-text-fill-color: transparent;
|
|
245
|
+
outline: none;
|
|
246
|
+
width: 100%;
|
|
247
|
+
height: 100%;
|
|
248
|
+
min-height: 40px;
|
|
249
|
+
white-space: pre-wrap;
|
|
250
|
+
word-break: keep-all;
|
|
251
|
+
overflow-wrap: break-word;
|
|
252
|
+
position: absolute;
|
|
253
|
+
top: 0;
|
|
254
|
+
left: 0;
|
|
255
|
+
resize: none;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
</style>
|