efront 4.11.5 → 4.11.6
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/apps/pivot/cert/main.xht +12 -0
- package/apps/pivot/task/list.js +24 -17
- package/coms/compile/Javascript_test.js +3 -1
- package/coms/compile/Program.js +8 -3
- package/coms/compile/powermap.js +1 -1
- package/coms/zimoli/field.js +82 -17
- package/coms/zimoli/field.less +43 -26
- package/coms/zimoli/getTypedChildren.js +26 -0
- package/coms/zimoli/model.js +12 -2
- package/coms/zimoli/render.js +5 -0
- package/coms/zimoli/view.js +2 -12
- package/coms//350/214/250/350/217/260//344/270/212/350/211/262.xht +1 -1
- package/coms//350/214/250/350/217/260//347/274/226/350/276/221/346/241/206.xht +28 -6
- package/coms//350/214/250/350/217/260//350/277/275/345/212/240/345/205/211/346/240/207.js +1 -1
- package/docs//345/267/245/345/205/267//345/255/227/347/254/246/351/233/206/346/243/200/346/237/245.xht +0 -9
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/apps/pivot/cert/main.xht
CHANGED
|
@@ -46,6 +46,11 @@
|
|
|
46
46
|
border: none;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
[foot]>a.button {
|
|
50
|
+
float: left;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
49
54
|
loading {
|
|
50
55
|
z-index: 3;
|
|
51
56
|
}
|
|
@@ -64,6 +69,7 @@
|
|
|
64
69
|
</div>
|
|
65
70
|
<scrollbar y #bar></scrollbar>
|
|
66
71
|
<div foot>
|
|
72
|
+
<a -repeat="(f,k) in actived.options" -click="f(actived)" -bind="k"></a>
|
|
67
73
|
<span -bind="actived.message"></span>
|
|
68
74
|
<button -repeat="(f,k) in actived.actions" -click="f(actived)"><span -bind="k"></span></button>
|
|
69
75
|
</div>
|
|
@@ -166,6 +172,12 @@
|
|
|
166
172
|
$账户/kid input
|
|
167
173
|
*当前服务器的域名/domain/每行一个,不支持泛域名 text
|
|
168
174
|
`,
|
|
175
|
+
options: {
|
|
176
|
+
async 从证书列表同步() {
|
|
177
|
+
var a = await plist.load('cert', 'hostname');
|
|
178
|
+
formdata.domain = a.map(a => a.hostname).join('\r\n');
|
|
179
|
+
}
|
|
180
|
+
},
|
|
169
181
|
actions: {
|
|
170
182
|
async 创建订单(actived) {
|
|
171
183
|
var params = submit(actived.fields, formdata);
|
package/apps/pivot/task/list.js
CHANGED
|
@@ -1,23 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
model.setEditor('jscode', function (element) {
|
|
2
|
+
element = 茨菰$编辑框(null);
|
|
3
|
+
element.contentEditable = !element.readonly;
|
|
4
|
+
element.type = 'js';
|
|
5
|
+
return element;
|
|
6
|
+
});
|
|
7
|
+
model.setReader('jscode', "text");
|
|
8
|
+
return plist.bind(null, '任务管理', "task", refilm`
|
|
2
9
|
*任务ID/key 100
|
|
3
10
|
*任务名/name 100
|
|
4
11
|
*是否启用/status radio 不启用,启用
|
|
5
|
-
任务代码/code
|
|
12
|
+
任务代码/code jscode
|
|
6
13
|
/ $ ${[
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
14
|
+
{
|
|
15
|
+
when(o) {
|
|
16
|
+
return o.status === 1;
|
|
17
|
+
},
|
|
18
|
+
name: "执行", do(o) {
|
|
19
|
+
popup("/task/invoke", o);
|
|
20
|
+
}
|
|
10
21
|
},
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
{
|
|
23
|
+
when(o) {
|
|
24
|
+
return o.status === 1;
|
|
25
|
+
},
|
|
26
|
+
name: "同步", do(o) {
|
|
27
|
+
popup("/task/rsync", o);
|
|
28
|
+
}
|
|
18
29
|
},
|
|
19
|
-
|
|
20
|
-
popup("/task/rsync", o);
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
]}`, '/task/edit');
|
|
30
|
+
]}`, '/task/edit');
|
package/coms/compile/Program.js
CHANGED
|
@@ -94,6 +94,7 @@ class Program {
|
|
|
94
94
|
scriptTags = [];
|
|
95
95
|
ignoreTags = ["STYLE", "SCRIPT"];
|
|
96
96
|
comments = [
|
|
97
|
+
["#!", /(?=[\r\n\u2028\u2029])/],
|
|
97
98
|
["//", /(?=[\r\n\u2028\u2029])/],
|
|
98
99
|
["/*", "*/"],
|
|
99
100
|
[/<!--/, /--!?>/],
|
|
@@ -808,7 +809,7 @@ class Program {
|
|
|
808
809
|
save(VALUE);
|
|
809
810
|
continue;
|
|
810
811
|
}
|
|
811
|
-
if (express_reg.test(m)) {
|
|
812
|
+
if (!stamp_reg.test(m) && express_reg.test(m)) {
|
|
812
813
|
if (last && last.type === STRAP && funcstrap_reg.test(last.text));
|
|
813
814
|
else queue.inExpress = true;
|
|
814
815
|
save(EXPRESS);
|
|
@@ -942,7 +943,7 @@ class Program {
|
|
|
942
943
|
this.comment_entry = this.createRegExp(this.comments.map(m => m[0]));
|
|
943
944
|
var stamps = this.stamps.join("");
|
|
944
945
|
stamps = this.compile(stamps);
|
|
945
|
-
|
|
946
|
+
var stamp_reg = new RegExp(`^[${stamps}]+$`);
|
|
946
947
|
var tokens = {};
|
|
947
948
|
var quote_map = {};
|
|
948
949
|
this.quote_map = quote_map;
|
|
@@ -1013,7 +1014,7 @@ class Program {
|
|
|
1013
1014
|
this.space_reg = new RegExp(`^[${spaces}]+$`, flagUnicode);
|
|
1014
1015
|
this.space_exp = new RegExp(`[${spaces}]+`, flagUnicode);
|
|
1015
1016
|
var quotes_entries = this.createRegExp(this.comments.concat(this.quotes).map(q => q[0]), true).source;
|
|
1016
|
-
var powers = Object.keys(this.powermap).filter(k => k.length > 1 &&
|
|
1017
|
+
var powers = Object.keys(this.powermap).filter(k => k.length > 1 && stamp_reg.test(k));
|
|
1017
1018
|
var powers_entries = this.createRegExp(this.tags.map(t => t[0]).concat(powers), true).source;
|
|
1018
1019
|
var entries_reg = new RegExp(`^(${powers_entries}|${quotes_entries}|${scopes})$`, this.nocase ? 'iu' : '');
|
|
1019
1020
|
stamps = this.compile(this.stamps.filter(s => !entries_reg.test(s)).join(''));
|
|
@@ -1021,6 +1022,10 @@ class Program {
|
|
|
1021
1022
|
var numbers = number_reg.source.replace(/^\^|\$$/g, "");
|
|
1022
1023
|
this.digit_reg = new RegExp(/^[+\-]?/.source + numbers, number_reg.flags);
|
|
1023
1024
|
this.entry_reg = new RegExp([`[${spaces}]+|${quotes_entries}|[${scopes}]|${numbers}[^${tokens}]*|${express}|${powers_entries}|[${stamps}]`], "gi" + flagUnicode);
|
|
1025
|
+
var stamps = this.stamps.slice();
|
|
1026
|
+
for (var k in this.powermap) if (k.length === 1 && stamps.indexOf(k) < 0) stamps.push(k);
|
|
1027
|
+
stamps.push.apply(stamps, powers);
|
|
1028
|
+
this.stamp_reg = new RegExp(`^(${stamps.map(this.compile).join('|')})$`);
|
|
1024
1029
|
}
|
|
1025
1030
|
}
|
|
1026
1031
|
module.exports = Program;
|
package/coms/compile/powermap.js
CHANGED
|
@@ -8,7 +8,7 @@ var powermap = {
|
|
|
8
8
|
'>>,>>>,<<'/* 7 */, '+,-'/* 8 */, '*,/,%'/* 9 */, '**'/* 10 */,
|
|
9
9
|
'++,--'/* 11 */,
|
|
10
10
|
"typeof,await,yield,new,delete,void,..."/*12*/,
|
|
11
|
-
'
|
|
11
|
+
'!,~,#'/* 13 */,
|
|
12
12
|
"::,?.,->,."/*14*/,
|
|
13
13
|
].forEach((pp, i) => {
|
|
14
14
|
pp.split(",").forEach(p => {
|
package/coms/zimoli/field.js
CHANGED
|
@@ -1,21 +1,63 @@
|
|
|
1
|
-
function
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
if (
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
var reshape = function () {
|
|
2
|
+
var [head, body, foot] = getTypedChildren(this, ['head', 'body', 'foot']);
|
|
3
|
+
var isInlineBlock = body && /^inline/i.test(getComputedStyle(body).display);
|
|
4
|
+
if (head && body) {
|
|
5
|
+
var left = head.offsetWidth + 1;
|
|
6
|
+
if (isInlineBlock && left < body.offsetWidth >> 2) {
|
|
7
|
+
css(head, {
|
|
8
|
+
marginRight: fromOffset(-left),
|
|
9
|
+
marginBottom: ''
|
|
10
|
+
});
|
|
11
|
+
css(body, {
|
|
12
|
+
paddingLeft: left,
|
|
13
|
+
paddingTop: ""
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
var top = head.offsetHeight + 1;
|
|
18
|
+
css(head, {
|
|
19
|
+
marginRight: '',
|
|
20
|
+
marginBottom: fromOffset(-top),
|
|
21
|
+
});
|
|
22
|
+
css(body, {
|
|
23
|
+
paddingLeft: '',
|
|
24
|
+
paddingTop: top
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (!body) body = head;
|
|
29
|
+
if (foot && body) {
|
|
30
|
+
var right = foot.offsetWidth + 1;
|
|
31
|
+
if (isInlineBlock && right < body.offsetWidth >> 2) {
|
|
32
|
+
css(foot, {
|
|
33
|
+
marginTop: '',
|
|
34
|
+
marginLeft: fromOffset(-right)
|
|
35
|
+
});
|
|
36
|
+
css(body, {
|
|
37
|
+
paddingBottom: '',
|
|
38
|
+
paddingRight: fromOffset(right),
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
var bottom = foot.offsetHeight + 1;
|
|
43
|
+
css(foot, {
|
|
44
|
+
marginTop: fromOffset(-bottom),
|
|
45
|
+
marginLeft: '',
|
|
46
|
+
});
|
|
47
|
+
css(body, {
|
|
48
|
+
paddingRight: '',
|
|
49
|
+
paddingBottom: fromOffset(bottom)
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
function main(elem) {
|
|
56
|
+
if (!isElement(elem)) elem = document.createElement('field');
|
|
57
|
+
elem.reshape = reshape;
|
|
58
|
+
resizingList.set(elem, () => elem.reshape());
|
|
18
59
|
elem.setAttribute("field", '');
|
|
60
|
+
var scope = {};
|
|
19
61
|
elem.$renders = [function () {
|
|
20
62
|
if (!(this.src instanceof Array)) return;
|
|
21
63
|
var [f, data] = this.src;
|
|
@@ -48,5 +90,28 @@ function main() {
|
|
|
48
90
|
this.oldValue = data[f.key];
|
|
49
91
|
}]
|
|
50
92
|
elem.removeAttribute("tabindex");
|
|
93
|
+
|
|
94
|
+
if (!elem.childNodes.length) care(elem, function (p) {
|
|
95
|
+
var [f, data] = p;
|
|
96
|
+
elem.innerHTML = field;
|
|
97
|
+
render(elem, scope = {
|
|
98
|
+
model,
|
|
99
|
+
data,
|
|
100
|
+
error: null,
|
|
101
|
+
field: f,
|
|
102
|
+
container,
|
|
103
|
+
readonly: !!this.readonly
|
|
104
|
+
});
|
|
105
|
+
elem.oldValue = data[f.key];
|
|
106
|
+
elem.setAttribute("field", f.key);
|
|
107
|
+
elem.reshape();
|
|
108
|
+
}, false);
|
|
109
|
+
else {
|
|
110
|
+
var [head, body, foot] = getTypedChildren(elem, ["head", 'body', 'foot']);
|
|
111
|
+
if (head) addClass(head, "head");
|
|
112
|
+
if (body) addClass(body, "body");
|
|
113
|
+
if (foot) addClass(foot, "foot");
|
|
114
|
+
elem.$renders.push(reshape);
|
|
115
|
+
}
|
|
51
116
|
return elem;
|
|
52
117
|
}
|
package/coms/zimoli/field.less
CHANGED
|
@@ -1,44 +1,61 @@
|
|
|
1
1
|
& {
|
|
2
2
|
height: auto;
|
|
3
3
|
box-shadow: none !important;
|
|
4
|
+
display: block;
|
|
5
|
+
line-height: 22px;
|
|
6
|
+
border-bottom: 1px;
|
|
7
|
+
}
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
9
|
+
>.head,
|
|
10
|
+
>.foot {
|
|
11
|
+
padding: 10px 16px;
|
|
12
|
+
vertical-align: top;
|
|
13
|
+
display: inline-block;
|
|
14
|
+
position: absolute;
|
|
15
|
+
}
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
>model:first-child {
|
|
18
|
+
padding: 6px 10px;
|
|
19
|
+
display: block;
|
|
20
|
+
}
|
|
16
21
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
22
|
+
model {
|
|
23
|
+
display: inline;
|
|
24
|
+
}
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
.image {
|
|
24
|
-
margin: 10px 0;
|
|
25
|
-
}
|
|
26
|
+
>.head {
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
.image {
|
|
29
|
+
margin: 10px 0;
|
|
28
30
|
}
|
|
31
|
+
}
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
>.body {
|
|
34
|
+
.image {
|
|
35
|
+
margin: 10px 0;
|
|
33
36
|
}
|
|
34
37
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
vertical-align: top;
|
|
39
|
+
padding: 10px 20px;
|
|
40
|
+
height: 100%;
|
|
41
|
+
border-bottom: 1px solid #0001;
|
|
42
|
+
display: inline-block;
|
|
43
|
+
width: 100%;
|
|
44
|
+
text-align: left;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
>.track {
|
|
48
|
+
display: none;
|
|
49
|
+
box-shadow: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
>.foot {
|
|
53
|
+
span {
|
|
54
|
+
vertical-align: middle;
|
|
39
55
|
}
|
|
40
56
|
}
|
|
41
57
|
|
|
58
|
+
|
|
42
59
|
.input {
|
|
43
60
|
width: 100%;
|
|
44
61
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function hasType(target, type) {
|
|
2
|
+
// 记得小时候,不论是苍蝇还是蚊子,飞起来都是有声音的。最近看到的一种像蚊子一样小的飞虫,喜欢像苍蝇一样趴在食物上,飞起来却听不到声音。
|
|
3
|
+
// 是我的听力下降了?还是外界太过嘈杂?还是飞虫拍打翅膀的频率超出了我的听觉范围?还是飞行可以不产生声音?
|
|
4
|
+
return target.hasAttribute(type) || hasClass(target, type);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
return function (element, types) {
|
|
8
|
+
var marked = 0;
|
|
9
|
+
for (var k in types) {
|
|
10
|
+
for (var c of element.children) {
|
|
11
|
+
if (hasType(c, types[k])) {
|
|
12
|
+
types[k] = c;
|
|
13
|
+
marked++;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if (!marked && isArray(types)) {
|
|
18
|
+
var children = element.children;
|
|
19
|
+
if (children.length) {
|
|
20
|
+
for (var cx = 0, dx = types.length; cx < dx; cx++) {
|
|
21
|
+
types[cx] = children[cx];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return types;
|
|
26
|
+
}
|
package/coms/zimoli/model.js
CHANGED
|
@@ -409,6 +409,14 @@ function main(elem) {
|
|
|
409
409
|
}
|
|
410
410
|
markEditer(constructors);
|
|
411
411
|
markReader(readonly_types);
|
|
412
|
+
var pick = function (constructors, f) {
|
|
413
|
+
var path = [];
|
|
414
|
+
while (typeof f === 'string' && path.indexOf(f) < 0) {
|
|
415
|
+
path.push(f);
|
|
416
|
+
f = constructors[f];
|
|
417
|
+
}
|
|
418
|
+
return f;
|
|
419
|
+
};
|
|
412
420
|
extend(main, {
|
|
413
421
|
setEditors(map) {
|
|
414
422
|
extend(constructors, map);
|
|
@@ -423,12 +431,14 @@ extend(main, {
|
|
|
423
431
|
this.setReadors(map);
|
|
424
432
|
},
|
|
425
433
|
setEditor(key, func) {
|
|
434
|
+
if (typeof func === 'function') func.isediter = true;
|
|
435
|
+
else func = pick(constructors, func);
|
|
426
436
|
constructors[key] = func;
|
|
427
|
-
func.isediter = true;
|
|
428
437
|
},
|
|
429
438
|
setReador(key, func) {
|
|
439
|
+
if (typeof func === 'function') func.isreader = true;
|
|
440
|
+
else func = pick(readonly_types, func);
|
|
430
441
|
readonly_types[key] = func;
|
|
431
|
-
func.isreader = true;
|
|
432
442
|
},
|
|
433
443
|
setModel(key, func) {
|
|
434
444
|
this.setEditor(key, func);
|
package/coms/zimoli/render.js
CHANGED
|
@@ -711,6 +711,11 @@ function getFromScopes(key, scope, parentScopes) {
|
|
|
711
711
|
|
|
712
712
|
function renderRest(element, struct, replacer = element) {
|
|
713
713
|
var renders = element.$renders;
|
|
714
|
+
if (element.renders) {
|
|
715
|
+
if (!renders) renders = [];
|
|
716
|
+
renders.push.apply(renders, element.renders);
|
|
717
|
+
delete element.renders;
|
|
718
|
+
}
|
|
714
719
|
element.$renders = [];
|
|
715
720
|
var { binds, attrs, props } = struct;
|
|
716
721
|
for (var k in binds) {
|
package/coms/zimoli/view.js
CHANGED
|
@@ -90,18 +90,8 @@ var init = function () {
|
|
|
90
90
|
marginRight: -getScrollbarWidth() + "px"
|
|
91
91
|
});
|
|
92
92
|
};
|
|
93
|
-
var isType = function (target, type) {
|
|
94
|
-
// 记得小时候,不论是苍蝇还是蚊子,飞起来都是有声音的。最近看到的一种像蚊子一样小的飞虫,喜欢像苍蝇一样趴在食物上,飞起来却听不到声音。
|
|
95
|
-
// 是我的听力下降了?还是外界太过嘈杂?还是飞虫拍打翅膀的频率超出了我的听觉范围?还是飞行可以不产生声音?
|
|
96
|
-
return target.hasAttribute(type) || hasClass(target, type);
|
|
97
|
-
}
|
|
98
93
|
var resize2 = function () {
|
|
99
|
-
var head, body, foot;
|
|
100
|
-
for (var c of this.children) {
|
|
101
|
-
if (isType(c, "head")) head = c;
|
|
102
|
-
else if (isType(c, "body")) body = c;
|
|
103
|
-
else if (isType(c, "foot")) foot = c;
|
|
104
|
-
}
|
|
94
|
+
var [head, body, foot] = getTypedChildren(this, ["head", "body", "foot"]);
|
|
105
95
|
if (head && body) {
|
|
106
96
|
var height = head.offsetHeight + head.offsetTop;
|
|
107
97
|
css(head, {
|
|
@@ -121,7 +111,7 @@ var resize2 = function () {
|
|
|
121
111
|
})
|
|
122
112
|
}
|
|
123
113
|
if (body) {
|
|
124
|
-
if (body.scrollHeight + body.offsetTop > this.clientHeight) {
|
|
114
|
+
if (body.scrollHeight + body.offsetTop > this.clientHeight + 1) {
|
|
125
115
|
css(body, { height: fromOffset(this.clientHeight) });
|
|
126
116
|
}
|
|
127
117
|
else {
|
|
@@ -1,17 +1,36 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
& {
|
|
3
|
+
overflow: auto;
|
|
4
|
+
border: 6px solid transparent;
|
|
5
|
+
border-top: 0;
|
|
6
|
+
border-bottom: 0;
|
|
7
|
+
display: block;
|
|
8
|
+
padding: 6px 0;
|
|
9
|
+
}
|
|
10
|
+
</style>
|
|
1
11
|
<编辑框 e-class="上色.className" e-style="{whiteSpace:'pre'}" onkeyup="!event.isComposing&&updatecode(event)"
|
|
2
12
|
onkeydown.tab="keytab(event)" onkeyup.enter="tab(false)">
|
|
3
13
|
</编辑框>
|
|
4
14
|
<script>
|
|
5
15
|
var coder = this;
|
|
6
|
-
|
|
16
|
+
var coderid = 0;
|
|
17
|
+
care(coder, async function ([text, type]) {
|
|
7
18
|
try {
|
|
8
|
-
var colored = 上色.text(type, text);
|
|
9
|
-
coder.innerHTML = colored;
|
|
10
19
|
coder.type = type;
|
|
20
|
+
await coder.setValue(text);
|
|
11
21
|
} catch {
|
|
12
22
|
if (typeof text === 'string') coder.innerHTML = 渲染.encode(text);
|
|
13
23
|
}
|
|
14
|
-
})
|
|
24
|
+
});
|
|
25
|
+
coder.setValue = async function (text) {
|
|
26
|
+
var id = ++coderid;
|
|
27
|
+
var colored = await 上色.text(this.type, text);
|
|
28
|
+
if (id !== coderid) return;
|
|
29
|
+
coder.innerHTML = colored;
|
|
30
|
+
};
|
|
31
|
+
coder.getValue = function () {
|
|
32
|
+
return coder.innerText;
|
|
33
|
+
};
|
|
15
34
|
var markAnchorOffset = function () {
|
|
16
35
|
var { anchorNode, anchorOffset } = document.getSelection();
|
|
17
36
|
if (!anchorNode || !coder) return;
|
|
@@ -111,7 +130,8 @@
|
|
|
111
130
|
coder.scrollTop = scrollTop;
|
|
112
131
|
coder.scrollLeft = scrollLeft;
|
|
113
132
|
};
|
|
114
|
-
var updatecode = lazy(function (event) {
|
|
133
|
+
var updatecode = lazy(async function (event) {
|
|
134
|
+
var id = ++coderid;
|
|
115
135
|
var trimreg = /[\s\u00a0\u2002\u0080]+([\}\{\;\[\]\(\)\,\>\<\+\-\*\&\^\/%!~:?])*/g;
|
|
116
136
|
var innerText = coder.innerText;
|
|
117
137
|
if (jstext.replace(trimreg, trimspace).trim() === innerText.replace(trimreg, trimspace).trim()) return;
|
|
@@ -119,9 +139,11 @@
|
|
|
119
139
|
markAnchorOffset();
|
|
120
140
|
var innerText = coder.innerText;
|
|
121
141
|
unmarkAnchorOffset();
|
|
122
|
-
var text = 上色.text(coder.type, innerText);
|
|
142
|
+
var text = await 上色.text(coder.type, innerText);
|
|
143
|
+
if (coderid !== id) return;
|
|
123
144
|
更新(text);
|
|
124
145
|
unmarkAnchorOffset();
|
|
146
|
+
dispatch(coder, 'change');
|
|
125
147
|
return;
|
|
126
148
|
});
|
|
127
149
|
var keytab = function (event) {
|
|
@@ -13,7 +13,7 @@ var patchBlink = function (code, index, blink) {
|
|
|
13
13
|
}
|
|
14
14
|
return true;
|
|
15
15
|
}
|
|
16
|
-
else if (c.start < index && c.end > index) {
|
|
16
|
+
else if (c.start < index && (c.end > index || c.end === undefined)) {
|
|
17
17
|
if (haschildren(c)) {
|
|
18
18
|
return patchBlink(c, index, blink);
|
|
19
19
|
}
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
display: inline-block;
|
|
11
11
|
position: relative;
|
|
12
12
|
vertical-align: top;
|
|
13
|
-
padding-bottom: 44px;
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
field:nth-child(n+2) [textarea] {
|
|
@@ -18,16 +17,8 @@
|
|
|
18
17
|
outline: none;
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
label {
|
|
22
|
-
margin-top: -44px;
|
|
23
|
-
padding: 0 20px;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
20
|
.padding {
|
|
27
21
|
border: none;
|
|
28
|
-
padding: 0 20px;
|
|
29
|
-
width: 100%;
|
|
30
|
-
display: block;
|
|
31
22
|
}
|
|
32
23
|
|
|
33
24
|
[textarea] {
|