renusify 1.4.2 → 1.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.
- package/components/chart/worldMap.vue +293 -34
- package/components/codeEditor/highlightCss.vue +10 -112
- package/components/codeEditor/highlightHtml.vue +17 -162
- package/components/codeEditor/highlightJs.vue +14 -243
- package/components/codeEditor/index.vue +25 -3
- package/components/codeEditor/mixin.js +172 -0
- package/components/cropper/index.vue +2 -1
- package/components/form/json/index.vue +113 -65
- package/components/img/index.vue +18 -18
- package/components/index.js +1 -1
- package/components/modal/index.vue +57 -11
- package/components/modal/style.scss +13 -11
- package/components/searchBox/index.vue +1 -1
- package/components/slider/index.vue +15 -12
- package/components/table/index.vue +13 -13
- package/directive/drag/index.js +5 -5
- package/directive/sortable/index.js +3 -3
- package/directive/title/index.js +2 -3
- package/directive/touch/index.js +2 -4
- package/package.json +1 -1
- package/tools/helper.js +1 -42
|
@@ -6,18 +6,21 @@
|
|
|
6
6
|
autocomplete="off"
|
|
7
7
|
autocorrect="off"
|
|
8
8
|
spellcheck="false"
|
|
9
|
-
@keydown="
|
|
9
|
+
@keydown="setKey"
|
|
10
10
|
></textarea>
|
|
11
11
|
<div class="text-preview" v-html="build"></div>
|
|
12
12
|
</div>
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
15
|
<script>
|
|
16
|
+
import mixin from './mixin'
|
|
17
|
+
|
|
16
18
|
export default {
|
|
17
19
|
name: "highlight-html",
|
|
18
20
|
props: {
|
|
19
21
|
modelValue: String,
|
|
20
22
|
},
|
|
23
|
+
mixins: [mixin],
|
|
21
24
|
data() {
|
|
22
25
|
return {
|
|
23
26
|
d: this.modelValue,
|
|
@@ -42,56 +45,25 @@ export default {
|
|
|
42
45
|
let data = this.d;
|
|
43
46
|
data = this.$helper.replacer(data, "<", "<");
|
|
44
47
|
data = this.$helper.replacer(data, ">", ">");
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
let in_quta = false;
|
|
48
|
-
data.forEach((c) => {
|
|
49
|
-
if (c === "=") {
|
|
50
|
-
res += '<span class="color-blue">=</span>';
|
|
51
|
-
} else if ((c === '"' || c === "'") && !in_quta) {
|
|
52
|
-
in_quta = c;
|
|
53
|
-
res += '<span class="color-green">' + c;
|
|
54
|
-
} else if (c === in_quta) {
|
|
55
|
-
in_quta = false;
|
|
56
|
-
res += c + "</span>";
|
|
57
|
-
} else {
|
|
58
|
-
res += c;
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
res = this.$helper.replacer(
|
|
63
|
-
res,
|
|
64
|
-
"<",
|
|
65
|
-
'<span class="color-orange code-editor-span"><'
|
|
66
|
-
);
|
|
67
|
-
res = this.$helper.replacer(res, ">", "></span>");
|
|
68
|
-
res = this.$helper.replacer(
|
|
69
|
-
res,
|
|
70
|
-
"{{",
|
|
71
|
-
'<span class="color-blue code-editor-span">{{'
|
|
72
|
-
);
|
|
73
|
-
res = this.$helper.replacer(res, "}}", "}}</span>");
|
|
48
|
+
let res = data;
|
|
49
|
+
res = this.re_quote(res)
|
|
74
50
|
|
|
75
|
-
let regex = /\+(.*?)\+/g;
|
|
76
|
-
let matched = res.matchAll(regex);
|
|
77
|
-
for (const match of matched) {
|
|
78
|
-
res = this.$helper.replacer(
|
|
79
|
-
res,
|
|
80
|
-
match[0],
|
|
81
|
-
'<span class="color-blue code-editor-span">' + match[0] + "</span>"
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
res = this.re_words(res);
|
|
85
51
|
res = this.re_comment(res);
|
|
86
52
|
res = this.re_func(res);
|
|
53
|
+
|
|
54
|
+
res = res.replace(/(<+[\s\S]+>)/g, '<span class="color-orange code-editor-span">$1</span>')
|
|
55
|
+
res = res.replace(/(\{\{+[\s\S]+}})/g, '<span class="color-blue code-editor-span">$1</span>')
|
|
87
56
|
return res;
|
|
88
57
|
},
|
|
89
58
|
},
|
|
90
59
|
methods: {
|
|
91
|
-
|
|
60
|
+
setKey(event) {
|
|
92
61
|
if (event.key === "<") {
|
|
93
62
|
this.openTag = event.target.selectionEnd
|
|
94
63
|
return false
|
|
64
|
+
} else if (event.key === "/" && this.openTag !== null && this.openTag + 1 === event.target.selectionEnd) {
|
|
65
|
+
this.openTag = null
|
|
66
|
+
return false
|
|
95
67
|
} else if (event.key === ">" && this.openTag !== null) {
|
|
96
68
|
const end = event.target.selectionEnd;
|
|
97
69
|
const sel = event.target.value.substring(this.openTag + 1, end).trim().split(' ')[0];
|
|
@@ -103,129 +75,12 @@ export default {
|
|
|
103
75
|
return false
|
|
104
76
|
}
|
|
105
77
|
|
|
106
|
-
|
|
107
|
-
const end = event.target.selectionEnd;
|
|
108
|
-
event.preventDefault()
|
|
109
|
-
document.execCommand('insertText', false, event.key.repeat(2));
|
|
110
|
-
event.target.selectionEnd = end + 1;
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
113
|
-
if (event.key === "{") {
|
|
114
|
-
const end = event.target.selectionEnd;
|
|
115
|
-
event.preventDefault()
|
|
116
|
-
document.execCommand('insertText', false, '{}');
|
|
117
|
-
event.target.selectionEnd = end + 1;
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
if (event.key === "(") {
|
|
121
|
-
const end = event.target.selectionEnd;
|
|
122
|
-
event.preventDefault()
|
|
123
|
-
document.execCommand('insertText', false, '()');
|
|
124
|
-
event.target.selectionEnd = end + 1;
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
|
-
if (event.key === "[") {
|
|
128
|
-
const end = event.target.selectionEnd;
|
|
129
|
-
event.preventDefault()
|
|
130
|
-
document.execCommand('insertText', false, '[]');
|
|
131
|
-
event.target.selectionEnd = end + 1;
|
|
132
|
-
return false;
|
|
133
|
-
}
|
|
134
|
-
if (event.keyCode === 9) {
|
|
135
|
-
event.preventDefault()
|
|
136
|
-
document.execCommand('insertText', false, ' '.repeat(4));
|
|
137
|
-
return false;
|
|
138
|
-
}
|
|
139
|
-
if (event.keyCode === 13) {
|
|
140
|
-
event.preventDefault()
|
|
141
|
-
let n = event.target.value.substr(0, event.target.selectionStart).split('\n')
|
|
142
|
-
n = n[n.length - 1].split('')
|
|
143
|
-
let w = ''
|
|
144
|
-
for (let i = 0; i < n.length; i++) {
|
|
145
|
-
if (n[i] === ' ') {
|
|
146
|
-
w += ' '
|
|
147
|
-
} else {
|
|
148
|
-
break
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
document.execCommand('insertText', false, '\n' + w);
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
return true
|
|
156
|
-
},
|
|
157
|
-
re_words(res) {
|
|
158
|
-
res = this.$helper.replacer(
|
|
159
|
-
res,
|
|
160
|
-
" window.",
|
|
161
|
-
' <span class="color-orange code-editor-span">window</span>.'
|
|
162
|
-
);
|
|
163
|
-
res = this.$helper.replacer(
|
|
164
|
-
res,
|
|
165
|
-
" new ",
|
|
166
|
-
' <span class="color-orange code-editor-span">new</span> '
|
|
167
|
-
);
|
|
168
|
-
res = this.$helper.replacer(
|
|
169
|
-
res,
|
|
170
|
-
" true",
|
|
171
|
-
' <span class="color-orange code-editor-span">true</span>'
|
|
172
|
-
);
|
|
173
|
-
res = this.$helper.replacer(
|
|
174
|
-
res,
|
|
175
|
-
" false",
|
|
176
|
-
' <span class="color-orange code-editor-span">false</span>'
|
|
177
|
-
);
|
|
178
|
-
|
|
179
|
-
return res;
|
|
78
|
+
return this.setTab(event)
|
|
180
79
|
},
|
|
181
80
|
re_comment(res) {
|
|
182
|
-
let regex =
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
res = this.$helper.replacer(
|
|
186
|
-
res,
|
|
187
|
-
match[0],
|
|
188
|
-
'<span class="color-comment code-editor-span">' + match[0] + "</span>"
|
|
189
|
-
);
|
|
190
|
-
}
|
|
191
|
-
return res;
|
|
192
|
-
},
|
|
193
|
-
re_func(res) {
|
|
194
|
-
//function like Date()
|
|
195
|
-
let regex = /([a-zA-Z_{1}][a-zA-Z0-9_]+)[ ]{0,1}(?=\()/g;
|
|
196
|
-
let matched = res.matchAll(regex);
|
|
197
|
-
for (const match of matched) {
|
|
198
|
-
res = this.$helper.replacer(
|
|
199
|
-
res,
|
|
200
|
-
match[0],
|
|
201
|
-
'<span class="color-func2 code-editor-span">' + match[0] + "</span>"
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
//function like $r $d()
|
|
206
|
-
regex = /(\$([a-zA-z0-9]*)[.|(])/g;
|
|
207
|
-
matched = res.matchAll(regex);
|
|
208
|
-
for (const match of matched) {
|
|
209
|
-
res = this.$helper.replacer(
|
|
210
|
-
res,
|
|
211
|
-
match[0].substr(0, match[0].length - 1),
|
|
212
|
-
'<span class="color-func code-editor-span">' +
|
|
213
|
-
match[0].substr(0, match[0].length - 1) +
|
|
214
|
-
"</span>"
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
res = this.$helper.replacer(
|
|
218
|
-
res,
|
|
219
|
-
"(",
|
|
220
|
-
'<span class="color-func2 code-editor-span">(</span>'
|
|
221
|
-
);
|
|
222
|
-
res = this.$helper.replacer(
|
|
223
|
-
res,
|
|
224
|
-
")",
|
|
225
|
-
'<span class="color-func2 code-editor-span">)</span>'
|
|
226
|
-
);
|
|
227
|
-
return res;
|
|
228
|
-
},
|
|
81
|
+
let regex = /(<!--+[\s\S]+-->)/g;
|
|
82
|
+
return res.replace(regex, '<span class="color-comment code-editor-span">$1</span>')
|
|
83
|
+
}
|
|
229
84
|
},
|
|
230
85
|
};
|
|
231
86
|
</script>
|
|
@@ -13,11 +13,14 @@
|
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
15
|
<script>
|
|
16
|
+
import mixin from './mixin'
|
|
17
|
+
|
|
16
18
|
export default {
|
|
17
19
|
name: "highlight-script",
|
|
18
20
|
props: {
|
|
19
21
|
modelValue: String,
|
|
20
22
|
},
|
|
23
|
+
mixins: [mixin],
|
|
21
24
|
data() {
|
|
22
25
|
return {
|
|
23
26
|
d: this.modelValue,
|
|
@@ -38,255 +41,23 @@ export default {
|
|
|
38
41
|
if (!this.d) {
|
|
39
42
|
return "";
|
|
40
43
|
}
|
|
41
|
-
let data = this.d.split("");
|
|
42
|
-
let str = this.d.trim();
|
|
43
|
-
|
|
44
|
-
if (str.substr(0, 1) === "{") {
|
|
45
|
-
str = str.substr(1, str.length - 2);
|
|
46
|
-
}
|
|
47
|
-
let res = "";
|
|
48
|
-
|
|
49
|
-
let in_quta = false;
|
|
50
|
-
data.forEach((c) => {
|
|
51
|
-
if (["=", "&", "{", "}", "<", ">"].includes(c)) {
|
|
52
|
-
res += '<span class="color-blue code-editor-span">' + c + "</span>";
|
|
53
|
-
} else if ([",", ";", ":"].includes(c)) {
|
|
54
|
-
res += '<span class="color-orange code-editor-span">' + c + "</span>";
|
|
55
|
-
} else if (parseInt(c) > -1) {
|
|
56
|
-
res += '<span class="color-number code-editor-span">' + c + "</span>";
|
|
57
|
-
} else if ((c === '"' || c === "'" || c === "`") && !in_quta) {
|
|
58
|
-
in_quta = c;
|
|
59
|
-
res += '<span class="color-green code-editor-span">' + c;
|
|
60
|
-
} else if (c === in_quta) {
|
|
61
|
-
in_quta = false;
|
|
62
|
-
res += c + "</span>";
|
|
63
|
-
} else {
|
|
64
|
-
res += c;
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
44
|
|
|
68
|
-
res = this.
|
|
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']);
|
|
69
51
|
res = this.re_comment(res);
|
|
70
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>')
|
|
71
57
|
|
|
72
|
-
// main function vuejs methods created ,...
|
|
73
|
-
this.strToObj(str).forEach((item) => {
|
|
74
|
-
if (item) {
|
|
75
|
-
res = this.$helper.replacer(
|
|
76
|
-
res,
|
|
77
|
-
item,
|
|
78
|
-
'<span class="color-func code-editor-span">' + item + "</span>"
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
return res;
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
methods: {
|
|
87
|
-
setTab(event) {
|
|
88
|
-
if (event.key === "'" || event.key === '"' || event.key === '`') {
|
|
89
|
-
const end = event.target.selectionEnd;
|
|
90
|
-
event.preventDefault()
|
|
91
|
-
document.execCommand('insertText', false, event.key.repeat(2));
|
|
92
|
-
event.target.selectionEnd = end + 1;
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
if (event.key === "{") {
|
|
96
|
-
const end = event.target.selectionEnd;
|
|
97
|
-
event.preventDefault()
|
|
98
|
-
document.execCommand('insertText', false, '{}');
|
|
99
|
-
event.target.selectionEnd = end + 1;
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
if (event.key === "(") {
|
|
103
|
-
const end = event.target.selectionEnd;
|
|
104
|
-
event.preventDefault()
|
|
105
|
-
document.execCommand('insertText', false, '()');
|
|
106
|
-
event.target.selectionEnd = end + 1;
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
if (event.key === "[") {
|
|
110
|
-
const end = event.target.selectionEnd;
|
|
111
|
-
event.preventDefault()
|
|
112
|
-
document.execCommand('insertText', false, '[]');
|
|
113
|
-
event.target.selectionEnd = end + 1;
|
|
114
|
-
return false;
|
|
115
|
-
}
|
|
116
|
-
if (event.keyCode === 9) {
|
|
117
|
-
event.preventDefault()
|
|
118
|
-
document.execCommand('insertText', false, ' '.repeat(4));
|
|
119
|
-
return false;
|
|
120
|
-
}
|
|
121
|
-
if (event.keyCode === 13) {
|
|
122
|
-
event.preventDefault()
|
|
123
|
-
let n = event.target.value.substr(0, event.target.selectionStart).split('\n')
|
|
124
|
-
n = n[n.length - 1].split('')
|
|
125
|
-
let w = ''
|
|
126
|
-
for (let i = 0; i < n.length; i++) {
|
|
127
|
-
if (n[i] === ' ') {
|
|
128
|
-
w += ' '
|
|
129
|
-
} else {
|
|
130
|
-
break
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
document.execCommand('insertText', false, '\n' + w);
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
return true
|
|
138
|
-
},
|
|
139
|
-
strToObj(str) {
|
|
140
|
-
str = this.$helper.replacer(str, " ", "");
|
|
141
|
-
str = this.$helper.replacer(str, "\n", "");
|
|
142
|
-
str = this.$helper.replacer(str, "\r", "");
|
|
143
|
-
let open = 0;
|
|
144
|
-
let pre = 0;
|
|
145
|
-
let to = 0;
|
|
146
|
-
let items = [];
|
|
147
|
-
const s = str;
|
|
148
|
-
s.split("").forEach((c, i) => {
|
|
149
|
-
to++;
|
|
150
|
-
if (c === "{") {
|
|
151
|
-
open++;
|
|
152
|
-
}
|
|
153
|
-
if (c === "}") {
|
|
154
|
-
open--;
|
|
155
|
-
}
|
|
156
|
-
if (open === 0 && c === ",") {
|
|
157
|
-
let new_str = str.substr(pre, to - 1);
|
|
158
|
-
const o = new_str.indexOf(":");
|
|
159
|
-
const f = new_str.indexOf("(");
|
|
160
|
-
if ((f > 0 && f < o) || o < 0) {
|
|
161
|
-
new_str = new_str.substr(0, f);
|
|
162
|
-
} else {
|
|
163
|
-
new_str = new_str.substr(0, o);
|
|
164
|
-
}
|
|
165
|
-
items.push(new_str);
|
|
166
|
-
pre = i + 1;
|
|
167
|
-
to = 0;
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
let new_str = str.substr(pre, str.length);
|
|
171
|
-
const o = new_str.indexOf(":");
|
|
172
|
-
const f = new_str.indexOf("(");
|
|
173
|
-
if ((f > 0 && f < o) || o < 0) {
|
|
174
|
-
new_str = new_str.substr(0, f);
|
|
175
|
-
} else {
|
|
176
|
-
new_str = new_str.substr(0, o);
|
|
177
|
-
}
|
|
178
|
-
items.push(new_str);
|
|
179
|
-
return items;
|
|
180
|
-
},
|
|
181
|
-
re_words(res) {
|
|
182
|
-
res = this.$helper.replacer(
|
|
183
|
-
res,
|
|
184
|
-
"import ",
|
|
185
|
-
'<span class="color-orange code-editor-span">import</span> '
|
|
186
|
-
);
|
|
187
|
-
res = this.$helper.replacer(
|
|
188
|
-
res,
|
|
189
|
-
" from ",
|
|
190
|
-
' <span class="color-orange code-editor-span">from</span> '
|
|
191
|
-
);
|
|
192
|
-
res = this.$helper.replacer(
|
|
193
|
-
res,
|
|
194
|
-
" window.",
|
|
195
|
-
' <span class="color-orange code-editor-span">window</span>.'
|
|
196
|
-
);
|
|
197
|
-
res = this.$helper.replacer(
|
|
198
|
-
res,
|
|
199
|
-
" new ",
|
|
200
|
-
' <span class="color-orange code-editor-span">new</span> '
|
|
201
|
-
);
|
|
202
|
-
res = this.$helper.replacer(
|
|
203
|
-
res,
|
|
204
|
-
" var ",
|
|
205
|
-
' <span class="color-orange code-editor-span">var</span> '
|
|
206
|
-
);
|
|
207
|
-
res = this.$helper.replacer(
|
|
208
|
-
res,
|
|
209
|
-
" let ",
|
|
210
|
-
' <span class="color-orange code-editor-span">let</span> '
|
|
211
|
-
);
|
|
212
|
-
res = this.$helper.replacer(
|
|
213
|
-
res,
|
|
214
|
-
" const ",
|
|
215
|
-
' <span class="color-orange code-editor-span">const</span> '
|
|
216
|
-
);
|
|
217
|
-
res = this.$helper.replacer(
|
|
218
|
-
res,
|
|
219
|
-
" return ",
|
|
220
|
-
' <span class="color-orange code-editor-span">return</span> '
|
|
221
|
-
);
|
|
222
|
-
res = this.$helper.replacer(
|
|
223
|
-
res,
|
|
224
|
-
" true",
|
|
225
|
-
' <span class="color-orange code-editor-span">true</span>'
|
|
226
|
-
);
|
|
227
|
-
res = this.$helper.replacer(
|
|
228
|
-
res,
|
|
229
|
-
" false",
|
|
230
|
-
' <span class="color-orange code-editor-span">false</span>'
|
|
231
|
-
);
|
|
232
|
-
res = this.$helper.replacer(
|
|
233
|
-
res,
|
|
234
|
-
" this.",
|
|
235
|
-
' <span class="color-orange code-editor-span">this</span>.'
|
|
236
|
-
);
|
|
237
|
-
|
|
238
|
-
return res;
|
|
239
|
-
},
|
|
240
|
-
re_comment(res) {
|
|
241
|
-
//eslint-disable-next-line
|
|
242
|
-
let regex = /(\/\*[\w\'\s\r\n\*]*\*\/)|(\/\/[\w\s\']*)/g;
|
|
243
|
-
let matched = res.matchAll(regex);
|
|
244
|
-
for (const match of matched) {
|
|
245
|
-
res = this.$helper.replacer(
|
|
246
|
-
res,
|
|
247
|
-
match[0],
|
|
248
|
-
'<span class="color-comment code-editor-span">' + match[0] + "</span>"
|
|
249
|
-
);
|
|
250
|
-
}
|
|
251
58
|
return res;
|
|
252
59
|
},
|
|
253
|
-
|
|
254
|
-
//function like Date()
|
|
255
|
-
let regex = /([a-zA-Z_{1}][a-zA-Z0-9_]+)[ ]{0,1}(?=\()/g;
|
|
256
|
-
let matched = res.matchAll(regex);
|
|
257
|
-
for (const match of matched) {
|
|
258
|
-
res = this.$helper.replacer(
|
|
259
|
-
res,
|
|
260
|
-
match[0],
|
|
261
|
-
'<span class="color-func2 code-editor-span">' + match[0] + "</span>"
|
|
262
|
-
);
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
//function like $r $d()
|
|
266
|
-
regex = /(\$([a-zA-z0-9]*)[.|(])/g;
|
|
267
|
-
matched = res.matchAll(regex);
|
|
268
|
-
for (const match of matched) {
|
|
269
|
-
res = this.$helper.replacer(
|
|
270
|
-
res,
|
|
271
|
-
match[0].substr(0, match[0].length - 1),
|
|
272
|
-
'<span class="color-func code-editor-span">' +
|
|
273
|
-
match[0].substr(0, match[0].length - 1) +
|
|
274
|
-
"</span>"
|
|
275
|
-
);
|
|
276
|
-
}
|
|
277
|
-
res = this.$helper.replacer(
|
|
278
|
-
res,
|
|
279
|
-
"(",
|
|
280
|
-
'<span class="color-func2 code-editor-span">(</span>'
|
|
281
|
-
);
|
|
282
|
-
res = this.$helper.replacer(
|
|
283
|
-
res,
|
|
284
|
-
")",
|
|
285
|
-
'<span class="color-func2 code-editor-span">)</span>'
|
|
286
|
-
);
|
|
287
|
-
return res;
|
|
288
|
-
},
|
|
289
|
-
},
|
|
60
|
+
}
|
|
290
61
|
};
|
|
291
62
|
</script>
|
|
292
63
|
|
|
@@ -9,6 +9,14 @@
|
|
|
9
9
|
>
|
|
10
10
|
<r-icon v-html="$r.icons.copy"></r-icon>
|
|
11
11
|
</r-btn>
|
|
12
|
+
<r-btn
|
|
13
|
+
class="image-copy"
|
|
14
|
+
icon
|
|
15
|
+
text
|
|
16
|
+
@click.prevent="pretty"
|
|
17
|
+
>
|
|
18
|
+
P
|
|
19
|
+
</r-btn>
|
|
12
20
|
<r-btn v-if="show === 'code' && runnable" text @click="show = 'run'">
|
|
13
21
|
run
|
|
14
22
|
<r-icon v-html="$r.icons.play" exact></r-icon>
|
|
@@ -31,7 +39,7 @@
|
|
|
31
39
|
<div v-show="show !== 'run'" ref="codeView" class="code-wrapper">
|
|
32
40
|
<div v-show="templateShow">
|
|
33
41
|
<span class="color-green"><template></span>
|
|
34
|
-
<highlight-html v-model="temp"></highlight-html>
|
|
42
|
+
<highlight-html ref="h-html" v-model="temp"></highlight-html>
|
|
35
43
|
<span class="color-green"></template></span>
|
|
36
44
|
<br/>
|
|
37
45
|
</div>
|
|
@@ -39,14 +47,14 @@
|
|
|
39
47
|
<span class="color-orange"
|
|
40
48
|
><script><br/>export default {</span
|
|
41
49
|
>
|
|
42
|
-
<highlight-script v-model="scr"></highlight-script>
|
|
50
|
+
<highlight-script ref="h-js" v-model="scr"></highlight-script>
|
|
43
51
|
<span class="color-orange">}<br/><script></span>
|
|
44
52
|
</div>
|
|
45
53
|
<div v-show="styleShow">
|
|
46
54
|
<span class="color-orange"
|
|
47
55
|
><style lang<span class="color-green">="css"</span>></span
|
|
48
56
|
>
|
|
49
|
-
<highlight-css v-model="sty"></highlight-css>
|
|
57
|
+
<highlight-css ref="h-css" v-model="sty"></highlight-css>
|
|
50
58
|
<span class="color-orange"><style></span>
|
|
51
59
|
</div>
|
|
52
60
|
</div>
|
|
@@ -97,6 +105,15 @@ export default {
|
|
|
97
105
|
this.get_code("codeSlot");
|
|
98
106
|
},
|
|
99
107
|
watch: {
|
|
108
|
+
template: function (n) {
|
|
109
|
+
this.temp = n
|
|
110
|
+
},
|
|
111
|
+
script: function (n) {
|
|
112
|
+
this.scr = n
|
|
113
|
+
},
|
|
114
|
+
style: function (n) {
|
|
115
|
+
this.sty = n
|
|
116
|
+
},
|
|
100
117
|
temp: function () {
|
|
101
118
|
this.$emit("update:template", this.temp);
|
|
102
119
|
},
|
|
@@ -108,6 +125,11 @@ export default {
|
|
|
108
125
|
},
|
|
109
126
|
},
|
|
110
127
|
methods: {
|
|
128
|
+
pretty() {
|
|
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
|
+
},
|
|
111
133
|
toHTML(htmlString) {
|
|
112
134
|
let div = document.createElement("div");
|
|
113
135
|
div.innerHTML = htmlString;
|