renusify 2.4.1 → 2.4.3

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.
@@ -41,18 +41,18 @@
41
41
  <span v-show="templateShow" class="highlight-syn-func">&lt;/template&gt;</span>
42
42
  </div>
43
43
  <div>
44
- <span v-show="scriptShow" class="highlight-syn-var"
44
+ <span v-show="scriptShow" class="highlight-syn-class"
45
45
  >&lt;script&gt;<br/>export default {</span
46
46
  >
47
47
  <highlight-script ref="h-js" v-model="scr"></highlight-script>
48
- <span v-show="scriptShow" class="highlight-syn-var">}<br/>&lt;/script&gt;</span>
48
+ <span v-show="scriptShow" class="highlight-syn-class">}<br/>&lt;/script&gt;</span>
49
49
  </div>
50
50
  <div>
51
- <span v-show="cssShow" class="highlight-syn-var"
51
+ <span v-show="cssShow" class="highlight-syn-class"
52
52
  >&lt;style lang<span class="color-green">="css"</span>&gt;</span
53
53
  >
54
54
  <highlight-css ref="h-css" v-model="sty"></highlight-css>
55
- <span v-show="cssShow" class="highlight-syn-var">&lt;/style&gt;</span>
55
+ <span v-show="cssShow" class="highlight-syn-class">&lt;/style&gt;</span>
56
56
  </div>
57
57
  </div>
58
58
  </div>
@@ -141,9 +141,9 @@ export default {
141
141
  .#{base.$prefix}code-editor {
142
142
  position: relative;
143
143
  white-space: break-spaces;
144
- caret-color: white;
145
- background-color: #15212e;
146
- color: #fff;
144
+ caret-color: #f8f8f2;
145
+ background-color: #1a1a1c;
146
+ color: #f8f8f2;
147
147
  padding: 10px;
148
148
  font-size: 14px;
149
149
 
@@ -13,7 +13,8 @@
13
13
  @focusin="active=true"
14
14
  @focusout="active=false"
15
15
  ref="input"
16
- type="text"
16
+ :step="step"
17
+ type="number"
17
18
  autocomplete="no"
18
19
  v-model="number"
19
20
  />
@@ -44,15 +45,13 @@ export default {
44
45
  emits: ['update:modelValue'],
45
46
  data() {
46
47
  return {
47
- number: this.setSplit(this.modelValue),
48
+ number: this.modelValue,
48
49
  active: false
49
50
  }
50
51
  },
51
52
  watch: {
52
53
  'modelValue': function (newVal) {
53
- setTimeout(() => {
54
- this.number = this.setSplit(newVal)
55
- })
54
+ this.number = newVal
56
55
  }
57
56
  },
58
57
  methods: {
@@ -66,8 +65,8 @@ export default {
66
65
  }
67
66
  return n
68
67
  },
69
- removeSplit(n) {
70
- return parseFloat(this.$helper.replacer(n.toString(), ',', ''))
68
+ set_step(number) {
69
+
71
70
  },
72
71
  emit() {
73
72
  if (this.number === '' || this.number === null) {
@@ -75,16 +74,16 @@ export default {
75
74
  this.$emit('update:modelValue', this.number)
76
75
  return
77
76
  }
78
- let d = this.removeSplit(this.number)
77
+ let d = this.number
79
78
  if (this.max !== undefined && d > this.max) {
80
79
  d = this.max
81
80
  }
82
81
  if (this.min !== undefined && d < this.min) {
83
82
  d = this.min
84
83
  }
85
- const n = ((1 / this.step) + '').length - 1
86
- this.number = this.setSplit(d.toFixed(n))
87
- this.$emit('update:modelValue', this.removeSplit(this.number))
84
+
85
+ this.number = d
86
+ this.$emit('update:modelValue', this.number)
88
87
  },
89
88
  plus() {
90
89
  let n = this.modelValue || 0
@@ -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 pa-2"
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')" v-model="code_name"></r-text-input>
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: {type: String, default: '/storage'},
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
- '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>',
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: 'HI', value: 'display-1'},
294
- {text: 'HI', value: 'display-2'},
295
- {text: 'HI', value: 'display-3'},
296
- {text: 'HI', value: 'headline-1'},
297
- {text: 'HI', value: 'headline-2'},
298
- {text: 'HI', value: 'headline-3'},
299
- {text: 'HI', value: 'title-1'},
300
- {text: 'HI', value: 'title-2'},
301
- {text: 'HI', value: 'title-3'},
302
- {text: 'HI', value: 'body-1'},
303
- {text: 'HI', value: 'body-2'},
304
- {text: 'HI', value: 'body-3'},
305
- {text: 'HI', value: 'label-1'},
306
- {text: 'HI', value: 'label-2'},
307
- {text: 'HI', value: 'label-3'},
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
- mounted() {
354
- /* document.execCommand('enableObjectResizing', false, true);
355
- document.execCommand('enableInlineTableEditing', false, true);
356
- document.execCommand('enableAbsolutePositionEditor', false, true) */
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
- this.format('defaultParagraphSeparator', '\n')
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.image = []
580
- this.img_alt = null
581
- this.handleOpen(true)
582
- this.showImg = true
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.video = []
585
- this.handleOpen(true)
586
- this.showVideo = true
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'
@@ -5,6 +5,7 @@
5
5
 
6
6
  <script>
7
7
  import './style.scss'
8
+ import '../../highlight/style.scss'
8
9
 
9
10
  export default {
10
11
  name: "law",
@@ -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
  }
@@ -51,9 +51,9 @@ export default {
51
51
  emits:['update:modelValue'],
52
52
  data() {
53
53
  return {
54
- lazyValue: this.modelValue.value,
54
+ lazyValue: this.modelValue ? this.modelValue.value : null,
55
55
  active: false,
56
- unit: this.modelValue.unit
56
+ unit: this.modelValue ? this.modelValue.unit : null
57
57
  }
58
58
  },
59
59
  watch: {
@@ -1,15 +1,15 @@
1
1
  <template>
2
- <div :class="`${$r.prefix}highlight`" >
3
- <div class="title-3 font-weight-bold mb-3" :class="{'highlight-name':name}">
4
- <div class="d-flex v-top">{{name}}
5
- <r-spacer></r-spacer>
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
- icon
8
- text
9
- @click.prevent="$helper.copy(src)"
10
- >
11
- <r-icon v-html="$r.icons.copy"></r-icon>
12
- </r-btn>
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
- this.languages.http= {
1039
+ this.languages.http = {
1040
1040
  default: [
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
- }
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) {
@@ -19,6 +19,7 @@
19
19
 
20
20
  .highlight-name {
21
21
  border-bottom: 1px solid !important;
22
+ padding: 4px;
22
23
  }
23
24
 
24
25
  .highlight-code > div {
@@ -93,7 +93,7 @@ export default {
93
93
  return {
94
94
  breakPoint: null,
95
95
  moveDown: false,
96
- closed:false
96
+ closed: false
97
97
  };
98
98
  },
99
99
  computed: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "renusify",
3
- "version": "2.4.1",
3
+ "version": "2.4.3",
4
4
  "description": "Vue3 Framework",
5
5
  "keywords": [
6
6
  "vuejs",