renusify 2.3.1 → 2.4.0
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/bar/toolbar/index.vue +26 -20
- package/components/bar/toolbar/laptop.vue +27 -25
- package/components/bar/toolbar/mobile.vue +28 -27
- package/components/calendar/index.vue +25 -33
- package/components/calendar/month.vue +35 -10
- package/components/calendar/year.vue +19 -8
- package/components/card/index.vue +49 -49
- package/components/codeEditor/highlightCss.vue +12 -24
- package/components/codeEditor/highlightHtml.vue +14 -29
- package/components/codeEditor/highlightJs.vue +14 -25
- package/components/codeEditor/index.vue +214 -205
- package/components/codeEditor/mixin.js +1 -42
- package/components/form/dateInput/index.vue +407 -413
- package/components/form/dateInput/month.vue +35 -11
- package/components/form/dateInput/year.vue +14 -8
- package/components/form/groupInput/index.js +2 -1
- package/components/form/groupInput/index.vue +13 -32
- package/components/form/jsonInput/index.vue +29 -19
- package/components/form/text-editor/index.vue +58 -8
- package/components/form/text-editor/style.scss +6 -0
- package/components/highlight/index.js +1 -0
- package/components/highlight/index.vue +31 -0
- package/components/highlight/mixin.js +1106 -0
- package/components/highlight/style.scss +103 -0
- package/components/index.js +1 -0
- package/components/table/crud/index.vue +82 -66
- package/components/table/index.vue +5 -8
- package/directive/sortable/index.js +1 -3
- package/index.js +0 -2
- package/package.json +1 -1
- package/style/app.scss +13 -13
- package/tools/icons.js +3 -1
|
@@ -8,55 +8,44 @@
|
|
|
8
8
|
spellcheck="false"
|
|
9
9
|
@keydown="setTab"
|
|
10
10
|
></textarea>
|
|
11
|
-
<div class="text-preview" v-html="
|
|
11
|
+
<div class="text-preview" v-html="code"></div>
|
|
12
12
|
</div>
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
15
|
<script>
|
|
16
16
|
import mixin from './mixin.js'
|
|
17
|
+
import mixin_h from '../highlight/mixin.js'
|
|
17
18
|
|
|
18
19
|
export default {
|
|
19
20
|
name: "highlight-script",
|
|
20
21
|
props: {
|
|
21
22
|
modelValue: String,
|
|
22
23
|
},
|
|
23
|
-
mixins: [mixin],
|
|
24
|
+
mixins: [mixin, mixin_h],
|
|
24
25
|
data() {
|
|
25
26
|
return {
|
|
26
27
|
d: this.modelValue,
|
|
27
|
-
runnable: false,
|
|
28
28
|
code: "",
|
|
29
29
|
};
|
|
30
30
|
},
|
|
31
|
+
async created() {
|
|
32
|
+
if (this.modelValue) {
|
|
33
|
+
await this.build_code()
|
|
34
|
+
}
|
|
35
|
+
},
|
|
31
36
|
watch: {
|
|
32
37
|
modelValue: function () {
|
|
33
38
|
this.d = this.modelValue;
|
|
34
39
|
},
|
|
35
|
-
d: function () {
|
|
40
|
+
d: async function () {
|
|
41
|
+
await this.build_code()
|
|
36
42
|
this.$emit("update:modelValue", this.d);
|
|
37
43
|
},
|
|
38
44
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
let res = this.d;
|
|
46
|
-
res = this.$helper.replacer(res, "<", "<");
|
|
47
|
-
res = this.$helper.replacer(res, ">", ">");
|
|
48
|
-
res = this.re_quote(res);
|
|
49
|
-
res = this.re_special(res, /([{}\[\]])/g);
|
|
50
|
-
res = this.re_words(res, ['import', 'from', 'delete', 'window', 'new', 'var', 'let', 'const', 'return', 'true', 'false', 'this', 'null', 'String', 'Boolean', 'Object']);
|
|
51
|
-
res = this.re_comment(res);
|
|
52
|
-
res = this.re_func(res);
|
|
53
|
-
res = this.re_number(res);
|
|
54
|
-
res = this.re_special(res, /([(),])/g, 'color-func2');
|
|
55
|
-
res = res.replace(/(<)/g, '<span class="color-orange code-editor-span">$1</span>')
|
|
56
|
-
res = res.replace(/(>)/g, '<span class="color-orange code-editor-span">$1</span>')
|
|
57
|
-
|
|
58
|
-
return res;
|
|
59
|
-
},
|
|
45
|
+
methods: {
|
|
46
|
+
async build_code() {
|
|
47
|
+
this.code = await this.highlight(this.d, "js", true)
|
|
48
|
+
}
|
|
60
49
|
}
|
|
61
50
|
};
|
|
62
51
|
</script>
|
|
@@ -1,136 +1,137 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
2
|
+
<div :class="`${$r.prefix}code-editor`">
|
|
3
|
+
<div class="code-action text-right">
|
|
4
|
+
<r-btn
|
|
5
|
+
class="color-white-text"
|
|
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
|
|
13
|
+
v-if="runnable"
|
|
14
|
+
class="color-white-text"
|
|
15
|
+
icon
|
|
16
|
+
text
|
|
17
|
+
@click.prevent="pretty"
|
|
18
|
+
>
|
|
19
|
+
P
|
|
20
|
+
</r-btn>
|
|
21
|
+
<r-btn v-if="show === 'code' && runnable" class="color-white-text" text @click.prevent="show = 'run'">
|
|
22
|
+
run
|
|
23
|
+
<r-icon exact v-html="$r.icons.play"></r-icon>
|
|
24
|
+
</r-btn>
|
|
25
|
+
<r-btn v-if="show === 'run'" class="color-white-text" text @click.prevent="show = 'code'">
|
|
26
|
+
<r-icon exact v-html="$r.icons.code_tags"></r-icon>
|
|
27
|
+
</r-btn>
|
|
28
|
+
</div>
|
|
29
|
+
<div v-if="show === 'run' && runnable" class="code-compile">
|
|
30
|
+
<r-code-editor-run
|
|
31
|
+
:id="id"
|
|
32
|
+
:css="sty"
|
|
33
|
+
:script="scr"
|
|
34
|
+
:template="temp"
|
|
35
|
+
></r-code-editor-run>
|
|
36
|
+
</div>
|
|
37
|
+
<div v-show="show !== 'run'" ref="codeView" class="code-wrapper">
|
|
38
|
+
<div>
|
|
39
|
+
<span v-show="templateShow" class="highlight-syn-func"><template></span>
|
|
40
|
+
<highlight-html ref="h-html" v-model="temp"></highlight-html>
|
|
41
|
+
<span v-show="templateShow" class="highlight-syn-func"></template></span>
|
|
42
|
+
</div>
|
|
43
|
+
<div>
|
|
44
|
+
<span v-show="scriptShow" class="highlight-syn-var"
|
|
44
45
|
><script><br/>export default {</span
|
|
45
46
|
>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<span v-show="cssShow" class="
|
|
47
|
+
<highlight-script ref="h-js" v-model="scr"></highlight-script>
|
|
48
|
+
<span v-show="scriptShow" class="highlight-syn-var">}<br/></script></span>
|
|
49
|
+
</div>
|
|
50
|
+
<div>
|
|
51
|
+
<span v-show="cssShow" class="highlight-syn-var"
|
|
51
52
|
><style lang<span class="color-green">="css"</span>></span
|
|
52
53
|
>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
</div>
|
|
54
|
+
<highlight-css ref="h-css" v-model="sty"></highlight-css>
|
|
55
|
+
<span v-show="cssShow" class="highlight-syn-var"></style></span>
|
|
56
|
+
</div>
|
|
57
57
|
</div>
|
|
58
|
+
</div>
|
|
58
59
|
</template>
|
|
59
60
|
|
|
60
61
|
<script>
|
|
61
62
|
import {defineAsyncComponent} from 'vue'
|
|
62
63
|
|
|
63
64
|
export default {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
65
|
+
name: "r-code-editor",
|
|
66
|
+
components: {
|
|
67
|
+
HighlightCss: defineAsyncComponent(() =>
|
|
68
|
+
import("./highlightCss.vue")
|
|
69
|
+
), HighlightScript: defineAsyncComponent(() =>
|
|
70
|
+
import("./highlightJs.vue")
|
|
71
|
+
), highlightHtml: defineAsyncComponent(() =>
|
|
72
|
+
import("./highlightHtml.vue")
|
|
73
|
+
), RCodeEditorRun: defineAsyncComponent(() =>
|
|
74
|
+
import("./run.vue")
|
|
75
|
+
)
|
|
76
|
+
},
|
|
77
|
+
props: {
|
|
78
|
+
runnable: Boolean,
|
|
79
|
+
templateShow: {type: Boolean, default: true},
|
|
80
|
+
scriptShow: {type: Boolean, default: true},
|
|
81
|
+
cssShow: {type: Boolean, default: true},
|
|
82
|
+
template: String,
|
|
83
|
+
script: String,
|
|
84
|
+
css: String,
|
|
85
|
+
},
|
|
86
|
+
emits: ["update:template", "update:script", "update:css"],
|
|
87
|
+
data() {
|
|
88
|
+
return {
|
|
89
|
+
show: "code",
|
|
90
|
+
code: "",
|
|
91
|
+
edited: false,
|
|
92
|
+
temp: this.template,
|
|
93
|
+
scr: this.script,
|
|
94
|
+
sty: this.css,
|
|
95
|
+
id: this.$helper.uniqueId(),
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
created() {
|
|
99
|
+
if (!this.$r.icons.play) {
|
|
100
|
+
this.$r.icons.play =
|
|
101
|
+
'<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>';
|
|
102
|
+
}
|
|
103
|
+
if (!this.$r.icons.code_tags) {
|
|
104
|
+
this.$r.icons.code_tags =
|
|
105
|
+
'<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>';
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
watch: {
|
|
109
|
+
template: function (n) {
|
|
110
|
+
this.temp = n
|
|
75
111
|
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
templateShow: {type: Boolean, default: true},
|
|
79
|
-
scriptShow: {type: Boolean, default: true},
|
|
80
|
-
cssShow: {type: Boolean, default: true},
|
|
81
|
-
template: String,
|
|
82
|
-
script: String,
|
|
83
|
-
css: String,
|
|
112
|
+
script: function (n) {
|
|
113
|
+
this.scr = n
|
|
84
114
|
},
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return {
|
|
88
|
-
show: "code",
|
|
89
|
-
code: "",
|
|
90
|
-
edited: false,
|
|
91
|
-
temp: this.template,
|
|
92
|
-
scr: this.script,
|
|
93
|
-
sty: this.css,
|
|
94
|
-
id: this.$helper.uniqueId(),
|
|
95
|
-
};
|
|
115
|
+
css: function (n) {
|
|
116
|
+
this.sty = n
|
|
96
117
|
},
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
this.$r.icons.play =
|
|
100
|
-
'<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>';
|
|
101
|
-
}
|
|
102
|
-
if (!this.$r.icons.code_tags) {
|
|
103
|
-
this.$r.icons.code_tags =
|
|
104
|
-
'<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>';
|
|
105
|
-
}
|
|
118
|
+
temp: function () {
|
|
119
|
+
this.$emit("update:template", this.temp);
|
|
106
120
|
},
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
this.temp = n
|
|
110
|
-
},
|
|
111
|
-
script: function (n) {
|
|
112
|
-
this.scr = n
|
|
113
|
-
},
|
|
114
|
-
css: function (n) {
|
|
115
|
-
this.sty = n
|
|
116
|
-
},
|
|
117
|
-
temp: function () {
|
|
118
|
-
this.$emit("update:template", this.temp);
|
|
119
|
-
},
|
|
120
|
-
scr: function () {
|
|
121
|
-
this.$emit("update:script", this.scr);
|
|
122
|
-
},
|
|
123
|
-
sty: function () {
|
|
124
|
-
this.$emit("update:css", this.sty);
|
|
125
|
-
},
|
|
121
|
+
scr: function () {
|
|
122
|
+
this.$emit("update:script", this.scr);
|
|
126
123
|
},
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
this.temp = this.$refs["h-html"].pretty_html(this.temp)
|
|
130
|
-
this.scr = this.$refs["h-js"].pretty_js(this.scr)
|
|
131
|
-
this.sty = this.$refs["h-css"].pretty_js(this.sty)
|
|
132
|
-
}
|
|
124
|
+
sty: function () {
|
|
125
|
+
this.$emit("update:css", this.sty);
|
|
133
126
|
},
|
|
127
|
+
},
|
|
128
|
+
methods: {
|
|
129
|
+
pretty() {
|
|
130
|
+
this.temp = this.$refs["h-html"].pretty_html(this.temp)
|
|
131
|
+
this.scr = this.$refs["h-js"].pretty_js(this.scr)
|
|
132
|
+
this.sty = this.$refs["h-css"].pretty_js(this.sty)
|
|
133
|
+
}
|
|
134
|
+
},
|
|
134
135
|
};
|
|
135
136
|
</script>
|
|
136
137
|
|
|
@@ -138,110 +139,118 @@ export default {
|
|
|
138
139
|
@use "../../style/variables/base";
|
|
139
140
|
|
|
140
141
|
.#{base.$prefix}code-editor {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
142
|
+
position: relative;
|
|
143
|
+
white-space: break-spaces;
|
|
144
|
+
caret-color: white;
|
|
145
|
+
background-color: #15212e;
|
|
146
|
+
color: #fff;
|
|
147
|
+
padding: 10px;
|
|
148
|
+
font-size: 14px;
|
|
149
|
+
|
|
150
|
+
.code-script,
|
|
151
|
+
.code-template {
|
|
152
|
+
padding: 0 20px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.code-wrapper {
|
|
156
|
+
direction: ltr;
|
|
157
|
+
text-align: left;
|
|
146
158
|
padding: 10px;
|
|
147
|
-
|
|
159
|
+
}
|
|
148
160
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
161
|
+
.code-compile {
|
|
162
|
+
background-color: #fafafa;
|
|
163
|
+
min-height: 300px;
|
|
164
|
+
padding: 10px;
|
|
165
|
+
margin: 0 -10px -10px -10px;
|
|
166
|
+
color: black;
|
|
167
|
+
}
|
|
153
168
|
|
|
154
|
-
.code-wrapper {
|
|
155
|
-
direction: ltr;
|
|
156
|
-
text-align: left;
|
|
157
|
-
padding: 10px;
|
|
158
|
-
}
|
|
159
169
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
color: black;
|
|
166
|
-
}
|
|
170
|
+
.highlight-syn-deleted,
|
|
171
|
+
.highlight-syn-err,
|
|
172
|
+
.highlight-syn-var {
|
|
173
|
+
color: #ff5261
|
|
174
|
+
}
|
|
167
175
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
176
|
+
.highlight-syn-section,
|
|
177
|
+
.highlight-syn-kwd {
|
|
178
|
+
color: #ff7cc6
|
|
179
|
+
}
|
|
171
180
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
181
|
+
.highlight-syn-class {
|
|
182
|
+
color: #eab07c
|
|
183
|
+
}
|
|
175
184
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
185
|
+
.highlight-numbers,
|
|
186
|
+
.highlight-syn-cmnt {
|
|
187
|
+
color: #7d828b
|
|
188
|
+
}
|
|
179
189
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
190
|
+
.highlight-syn-insert,
|
|
191
|
+
.highlight-syn-type,
|
|
192
|
+
.highlight-syn-func,
|
|
193
|
+
.highlight-syn-bool {
|
|
194
|
+
color: #71d58a
|
|
195
|
+
}
|
|
183
196
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
197
|
+
.highlight-syn-num {
|
|
198
|
+
color: #b581fd
|
|
199
|
+
}
|
|
187
200
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
201
|
+
.highlight-syn-oper {
|
|
202
|
+
color: #80c6ff
|
|
203
|
+
}
|
|
191
204
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
205
|
+
.highlight-syn-str {
|
|
206
|
+
color: #4dacfa
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.code-editor-highlight {
|
|
210
|
+
position: relative;
|
|
211
|
+
margin: -12px 0;
|
|
195
212
|
|
|
196
|
-
.
|
|
197
|
-
|
|
213
|
+
.text-preview {
|
|
214
|
+
white-space: pre-wrap;
|
|
215
|
+
word-break: keep-all;
|
|
216
|
+
overflow-wrap: break-word;
|
|
217
|
+
min-height: 40px;
|
|
218
|
+
font-size: 14px;
|
|
219
|
+
letter-spacing: 2px;
|
|
220
|
+
line-height: 20px;
|
|
221
|
+
margin: 0;
|
|
222
|
+
border: 0;
|
|
223
|
+
padding: 12px;
|
|
198
224
|
}
|
|
199
225
|
|
|
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
|
-
font-size: 14px;
|
|
228
|
-
letter-spacing: 2px;
|
|
229
|
-
line-height: 20px;
|
|
230
|
-
-webkit-font-smoothing: antialiased;
|
|
231
|
-
-webkit-text-fill-color: transparent;
|
|
232
|
-
outline: none;
|
|
233
|
-
width: 100%;
|
|
234
|
-
height: 100%;
|
|
235
|
-
min-height: 40px;
|
|
236
|
-
white-space: pre-wrap;
|
|
237
|
-
word-break: keep-all;
|
|
238
|
-
overflow-wrap: break-word;
|
|
239
|
-
position: absolute;
|
|
240
|
-
top: 0;
|
|
241
|
-
left: 0;
|
|
242
|
-
resize: none;
|
|
243
|
-
overflow: hidden;
|
|
244
|
-
}
|
|
226
|
+
textarea {
|
|
227
|
+
&::selection {
|
|
228
|
+
background-color: #fafafa;
|
|
229
|
+
-webkit-text-fill-color: #000;
|
|
230
|
+
color: #000;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
padding: 12px;
|
|
234
|
+
margin: 0;
|
|
235
|
+
border: 0;
|
|
236
|
+
font-size: 14px;
|
|
237
|
+
letter-spacing: 2px;
|
|
238
|
+
line-height: 20px;
|
|
239
|
+
-webkit-font-smoothing: antialiased;
|
|
240
|
+
-webkit-text-fill-color: transparent;
|
|
241
|
+
outline: none;
|
|
242
|
+
width: 100%;
|
|
243
|
+
height: 100%;
|
|
244
|
+
min-height: 40px;
|
|
245
|
+
white-space: pre-wrap;
|
|
246
|
+
word-break: keep-all;
|
|
247
|
+
overflow-wrap: break-word;
|
|
248
|
+
position: absolute;
|
|
249
|
+
top: 0;
|
|
250
|
+
left: 0;
|
|
251
|
+
resize: none;
|
|
252
|
+
overflow: hidden;
|
|
245
253
|
}
|
|
254
|
+
}
|
|
246
255
|
}
|
|
247
256
|
</style>
|
|
@@ -140,47 +140,6 @@ export default {
|
|
|
140
140
|
return false;
|
|
141
141
|
}
|
|
142
142
|
return true
|
|
143
|
-
}
|
|
144
|
-
re_quote(res) {
|
|
145
|
-
let regex = /"([^"]*)"/g;
|
|
146
|
-
res = res.replace(regex, '<span class="color-green code-editor-span">"$1"</span>');
|
|
147
|
-
regex = /'([^']*)'/g;
|
|
148
|
-
return res.replace(regex, "<span class=\"color-green code-editor-span\">'$1'</span>");
|
|
149
|
-
},
|
|
150
|
-
re_special(res, regex = /([{}\[\]])/g, color = "color-orange") {
|
|
151
|
-
return res.replace(regex, '<span class="' + color + ' code-editor-span">$1</span>')
|
|
152
|
-
},
|
|
153
|
-
re_number(res) {
|
|
154
|
-
return res.replace(/\b([0-9.]+)\b/g, '<span class="color-blue code-editor-span">$1</span>')
|
|
155
|
-
},
|
|
156
|
-
re_words(res, words) {
|
|
157
|
-
words.forEach((word) => {
|
|
158
|
-
res = res.replace(new RegExp("\\b(" + word + ")\\b", 'g'), '<span class="color-orange code-editor-span">$1</span>')
|
|
159
|
-
})
|
|
160
|
-
|
|
161
|
-
return res;
|
|
162
|
-
},
|
|
163
|
-
re_comment(res) {
|
|
164
|
-
//eslint-disable-next-line
|
|
165
|
-
let regex = /(\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*)$/gm;
|
|
166
|
-
return res.replace(regex, '<span class="color-comment code-editor-span">$1</span>')
|
|
167
|
-
},
|
|
168
|
-
re_func(res) {
|
|
169
|
-
//function like Date()
|
|
170
|
-
let regex = /([$a-zA-Z-0-9_\s]+)(?=\()/g;
|
|
171
|
-
res = res.replace(regex, '<span class="color-func2 code-editor-span">$1</span>')
|
|
172
|
-
|
|
173
|
-
// Object keys
|
|
174
|
-
regex = /([a-zA-Z-0-9_]+)(?=:)/g;
|
|
175
|
-
res = res.replace(regex, '<span class="color-purple code-editor-span">$1</span>')
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
//function like $r $d()
|
|
179
|
-
regex = /(\$([a-zA-z0-9]*)[.(])/g;
|
|
180
|
-
res = res.replace(regex, '<span class="color-func code-editor-span">$1</span>')
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
return res;
|
|
184
|
-
},
|
|
143
|
+
}
|
|
185
144
|
}
|
|
186
145
|
}
|