renusify 2.4.1 → 2.4.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.
- package/components/form/text-editor/index.vue +92 -32
- package/components/form/text-editor/preview.vue +1 -0
- package/components/form/text-editor/style.scss +63 -0
- package/components/highlight/index.vue +10 -10
- package/components/highlight/mixin.js +24 -24
- package/components/highlight/style.scss +1 -0
- package/components/nestable/NestableItem.vue +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<r-btn-group :items="menu" exact is-select @open="handleOpen" @update:modelValue="addCss">
|
|
9
9
|
<template v-slot:list="{item}">
|
|
10
10
|
<div :class="'color-white-text'===item['value']?'color-black '+item['value']:item['value']"
|
|
11
|
-
class="list-title
|
|
11
|
+
class="list-title"
|
|
12
12
|
>{{ item['text'] }}
|
|
13
13
|
</div>
|
|
14
14
|
</template>
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
:closebtn="false">
|
|
183
183
|
<r-form v-model="valid2">
|
|
184
184
|
<r-container>
|
|
185
|
-
<r-text-input :label="$t('name','renusify')"
|
|
185
|
+
<r-text-input v-model="code_name" :label="$t('name','renusify')"></r-text-input>
|
|
186
186
|
<r-select-input v-model="lang" :items="langs"
|
|
187
187
|
:label="$t('lang','renusify')"
|
|
188
188
|
:rules="['required']"
|
|
@@ -205,6 +205,30 @@
|
|
|
205
205
|
</r-container>
|
|
206
206
|
</r-form>
|
|
207
207
|
</r-modal>
|
|
208
|
+
<r-modal v-model="showTable"
|
|
209
|
+
:closable="false"
|
|
210
|
+
:closebtn="false">
|
|
211
|
+
<r-form v-model="valid2">
|
|
212
|
+
<r-container>
|
|
213
|
+
<r-select-input v-model="table_form.headers"
|
|
214
|
+
:label="$t('headers','renusify')"
|
|
215
|
+
:rules="['required']" just-value multiple tags></r-select-input>
|
|
216
|
+
<r-number-input v-model="table_form.row" :label="$t('row','renusify')" :rules="['required']"></r-number-input>
|
|
217
|
+
|
|
218
|
+
<div class="text-end my-3">
|
|
219
|
+
<r-btn class="color-error-text"
|
|
220
|
+
outlined
|
|
221
|
+
@click.prevent="showTable=false">{{ $t('cancel', 'renusify') }}
|
|
222
|
+
</r-btn>
|
|
223
|
+
<r-btn :disabled="!valid2"
|
|
224
|
+
class="color-success-text ms-2"
|
|
225
|
+
outlined
|
|
226
|
+
@click.prevent="handleTableForm()">{{ $t('send', 'renusify') }}
|
|
227
|
+
</r-btn>
|
|
228
|
+
</div>
|
|
229
|
+
</r-container>
|
|
230
|
+
</r-form>
|
|
231
|
+
</r-modal>
|
|
208
232
|
|
|
209
233
|
</r-container>
|
|
210
234
|
</template>
|
|
@@ -219,7 +243,7 @@ export default {
|
|
|
219
243
|
inheritAttrs: false,
|
|
220
244
|
mixins: [mixin],
|
|
221
245
|
props: {
|
|
222
|
-
uploadLink:
|
|
246
|
+
uploadLink: String,
|
|
223
247
|
modelValue: {
|
|
224
248
|
type: [Object, String], default: () => {
|
|
225
249
|
return {
|
|
@@ -256,6 +280,8 @@ export default {
|
|
|
256
280
|
code: '',
|
|
257
281
|
lang: null,
|
|
258
282
|
showPre: false,
|
|
283
|
+
showTable: false,
|
|
284
|
+
table_form: {},
|
|
259
285
|
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'],
|
|
260
286
|
items_undo: {
|
|
261
287
|
'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>',
|
|
@@ -266,8 +292,7 @@ export default {
|
|
|
266
292
|
'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>',
|
|
267
293
|
'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>',
|
|
268
294
|
'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>',
|
|
269
|
-
'
|
|
270
|
-
'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>',
|
|
295
|
+
'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>',
|
|
271
296
|
'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>',
|
|
272
297
|
},
|
|
273
298
|
items_format: {
|
|
@@ -290,21 +315,21 @@ export default {
|
|
|
290
315
|
menu: {
|
|
291
316
|
'font': {
|
|
292
317
|
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>',
|
|
293
|
-
items: [{text: '
|
|
294
|
-
{text: '
|
|
295
|
-
{text: '
|
|
296
|
-
{text: '
|
|
297
|
-
{text: '
|
|
298
|
-
{text: '
|
|
299
|
-
{text: '
|
|
300
|
-
{text: '
|
|
301
|
-
{text: '
|
|
302
|
-
{text: '
|
|
303
|
-
{text: '
|
|
304
|
-
{text: '
|
|
305
|
-
{text: '
|
|
306
|
-
{text: '
|
|
307
|
-
{text: '
|
|
318
|
+
items: [{text: 'd1', value: 'display-1'},
|
|
319
|
+
{text: 'd2', value: 'display-2'},
|
|
320
|
+
{text: 'd3', value: 'display-3'},
|
|
321
|
+
{text: 'head1', value: 'headline-1'},
|
|
322
|
+
{text: 'head2', value: 'headline-2'},
|
|
323
|
+
{text: 'head3', value: 'headline-3'},
|
|
324
|
+
{text: 'title-1', value: 'title-1'},
|
|
325
|
+
{text: 'title-2', value: 'title-2'},
|
|
326
|
+
{text: 'title-3', value: 'title-3'},
|
|
327
|
+
{text: 'body-1', value: 'body-1'},
|
|
328
|
+
{text: 'body-2', value: 'body-2'},
|
|
329
|
+
{text: 'body-3', value: 'body-3'},
|
|
330
|
+
{text: 'label-1', value: 'label-1'},
|
|
331
|
+
{text: 'label-2', value: 'label-2'},
|
|
332
|
+
{text: 'label-3', value: 'label-3'},
|
|
308
333
|
]
|
|
309
334
|
},
|
|
310
335
|
'header': {
|
|
@@ -350,12 +375,15 @@ export default {
|
|
|
350
375
|
}
|
|
351
376
|
}
|
|
352
377
|
},
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
378
|
+
created() {
|
|
379
|
+
if (this.uploadLink) {
|
|
380
|
+
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>'
|
|
381
|
+
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>'
|
|
357
382
|
|
|
358
|
-
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
mounted() {
|
|
386
|
+
this.format('defaultParagraphSeparator', 'br')
|
|
359
387
|
this.element.addEventListener('paste', function (e) {
|
|
360
388
|
e.preventDefault()
|
|
361
389
|
const text = (e.originalEvent || e).clipboardData.getData('text/plain')
|
|
@@ -474,6 +502,30 @@ export default {
|
|
|
474
502
|
document.execCommand('insertHTML', true, url)
|
|
475
503
|
this.showVideo = false
|
|
476
504
|
},
|
|
505
|
+
handleTableForm() {
|
|
506
|
+
if (!this.getSelection() || !this.table_form.row || !this.table_form.headers) {
|
|
507
|
+
this.$toast(this.$t('invalid_data', 'renusify'), {type: 'error'})
|
|
508
|
+
return
|
|
509
|
+
}
|
|
510
|
+
let sel = this.getSelection()
|
|
511
|
+
sel.removeAllRanges()
|
|
512
|
+
sel.addRange(this.preSelected)
|
|
513
|
+
let t = '<table><thead><tr>'
|
|
514
|
+
for (let i = 0; i < this.table_form.headers.length; i++) {
|
|
515
|
+
t += `<th>${this.table_form.headers[i]}</th>`
|
|
516
|
+
}
|
|
517
|
+
t += '</tr></thead><tbody>'
|
|
518
|
+
for (let i = 0; i < this.table_form.row; i++) {
|
|
519
|
+
t += '<tr>'
|
|
520
|
+
for (let i = 0; i < this.table_form.headers.length; i++) {
|
|
521
|
+
t += `<td></td>`
|
|
522
|
+
}
|
|
523
|
+
t += '</tr>'
|
|
524
|
+
}
|
|
525
|
+
t += '</tbody></table>'
|
|
526
|
+
document.execCommand('insertHTML', true, t)
|
|
527
|
+
this.showTable = false
|
|
528
|
+
},
|
|
477
529
|
async handlePreForm() {
|
|
478
530
|
if (!this.getSelection() || !this.code || !this.lang) {
|
|
479
531
|
this.$toast(this.$t('invalid_data', 'renusify'), {type: 'error'})
|
|
@@ -570,20 +622,28 @@ export default {
|
|
|
570
622
|
this.target = false
|
|
571
623
|
this.handleOpen(true)
|
|
572
624
|
this.show = true
|
|
625
|
+
} else if (e === 'createTable') {
|
|
626
|
+
this.table_form = {}
|
|
627
|
+
this.handleOpen(true)
|
|
628
|
+
this.showTable = true
|
|
573
629
|
} else if (e === 'PRE') {
|
|
574
630
|
this.code = ''
|
|
575
631
|
this.lang = null
|
|
576
632
|
this.handleOpen(true)
|
|
577
633
|
this.showPre = true
|
|
578
634
|
} else if (e === 'insertImage') {
|
|
579
|
-
this.
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
635
|
+
if (this.uploadLink) {
|
|
636
|
+
this.image = []
|
|
637
|
+
this.img_alt = null
|
|
638
|
+
this.handleOpen(true)
|
|
639
|
+
this.showImg = true
|
|
640
|
+
}
|
|
583
641
|
} else if (e === 'insertVideo') {
|
|
584
|
-
this.
|
|
585
|
-
|
|
586
|
-
|
|
642
|
+
if (this.uploadLink) {
|
|
643
|
+
this.video = []
|
|
644
|
+
this.handleOpen(true)
|
|
645
|
+
this.showVideo = true
|
|
646
|
+
}
|
|
587
647
|
} else if (e === 'insertDIV') {
|
|
588
648
|
const d = document.createElement('div')
|
|
589
649
|
d.innerText = 'div'
|
|
@@ -74,4 +74,67 @@
|
|
|
74
74
|
img:hover {
|
|
75
75
|
cursor: pointer;
|
|
76
76
|
}
|
|
77
|
+
|
|
78
|
+
table {
|
|
79
|
+
width: 100%;
|
|
80
|
+
border: 1px solid var(--color-border);
|
|
81
|
+
border-collapse: collapse;
|
|
82
|
+
|
|
83
|
+
thead {
|
|
84
|
+
tr {
|
|
85
|
+
&:last-child th {
|
|
86
|
+
border-bottom: 1px solid var(--color-border)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
th {
|
|
90
|
+
background-color: var(--color-sheet);
|
|
91
|
+
color: var(--color-on-sheet)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
tbody {
|
|
97
|
+
tr:nth-child(2n):not(:hover) {
|
|
98
|
+
td {
|
|
99
|
+
background: var(--color-sheet-container-low)
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
tbody {
|
|
105
|
+
tr {
|
|
106
|
+
&:active {
|
|
107
|
+
background: var(--color-sheet-container)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&:hover {
|
|
111
|
+
background: var(--color-sheet-container)
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
tr:not(:last-child) {
|
|
116
|
+
td {
|
|
117
|
+
border-bottom: 1px solid var(--color-border)
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
td, th {
|
|
123
|
+
padding: 0 16px;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
th {
|
|
127
|
+
user-select: none;
|
|
128
|
+
font-size: 14px;
|
|
129
|
+
font-weight: bold;
|
|
130
|
+
height: 38px;
|
|
131
|
+
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
td {
|
|
135
|
+
font-size: 14px;
|
|
136
|
+
font-weight: normal;
|
|
137
|
+
height: 38px;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
77
140
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="`${$r.prefix}highlight`"
|
|
3
|
-
<div class="title-3 font-weight-bold mb-3"
|
|
4
|
-
<div class="d-flex v-top">{{name}}
|
|
5
|
-
|
|
2
|
+
<div :class="`${$r.prefix}highlight`">
|
|
3
|
+
<div :class="{'highlight-name':name}" class="title-3 font-weight-bold mb-3">
|
|
4
|
+
<div class="d-flex v-top">{{ name }}
|
|
5
|
+
<r-spacer></r-spacer>
|
|
6
6
|
<r-btn
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
icon
|
|
8
|
+
text
|
|
9
|
+
@click.prevent="$helper.copy(src)"
|
|
10
|
+
>
|
|
11
|
+
<r-icon v-html="$r.icons.copy"></r-icon>
|
|
12
|
+
</r-btn>
|
|
13
13
|
</div>
|
|
14
14
|
</div>
|
|
15
15
|
<div :class="`highlight-code highlight-lang-${lang}`" v-html='txt'></div>
|
|
@@ -1036,32 +1036,32 @@ export default {
|
|
|
1036
1036
|
}
|
|
1037
1037
|
]
|
|
1038
1038
|
}
|
|
1039
|
-
|
|
1039
|
+
this.languages.http = {
|
|
1040
1040
|
default: [
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1041
|
+
{
|
|
1042
|
+
type: 'kwd',
|
|
1043
|
+
match: /^(GET|HEAD|POST|PUT|DELETE|CONNECT|OPTIONS|TRACE|PATCH|PRI|SEARCH)\b/gm
|
|
1044
|
+
},
|
|
1045
|
+
{
|
|
1046
|
+
expand: 'str'
|
|
1047
|
+
},
|
|
1048
|
+
{
|
|
1049
|
+
type: 'section',
|
|
1050
|
+
match: /\bHTTP\/[\d.]+\b/g
|
|
1051
|
+
},
|
|
1052
|
+
{
|
|
1053
|
+
expand: 'num'
|
|
1054
|
+
},
|
|
1055
|
+
{
|
|
1056
|
+
type: 'oper',
|
|
1057
|
+
match: /[,;:=]/g
|
|
1058
|
+
},
|
|
1059
|
+
{
|
|
1060
|
+
type: 'var',
|
|
1061
|
+
match: /[a-zA-Z][\w-]*(?=:)/g
|
|
1062
|
+
}
|
|
1063
1063
|
]
|
|
1064
|
-
|
|
1064
|
+
}
|
|
1065
1065
|
},
|
|
1066
1066
|
methods: {
|
|
1067
1067
|
async highlight(code, lang, hideLineNumbers) {
|