efront 4.21.4 → 4.22.1
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/#/345/233/275/351/231/205/345/214/226.yml +24 -0
- package/apps/blank/index.html +1 -1
- package/apps/index.jsp +76 -27
- package/apps/pay/alipay-query.jsp +1 -1
- package/apps/pay/alipay.jsp +1 -1
- package/apps/pivot/auth/login.js +2 -2
- package/apps/pivot/cert/main.xht +18 -5
- package/apps/pivot/db/act.xht +53 -0
- package/apps/pivot/db/config.xht +56 -16
- package/apps/pivot/home/welcome.html +12 -13
- package/apps/pivot/home/welcome.js +6 -6
- package/apps/pivot/home/welcome.less +12 -3
- package/apps/pivot/link/room.js +1 -1
- package/apps/pivot/main.js +3 -2
- package/apps/pivot/task/invoke.js +3 -3
- package/apps/pivot/task/rsync.js +2 -2
- package/apps/pivot/wow/root.js +8 -8
- package/coms/basic/#loader.js +9 -8
- package/coms/basic/Item.js +2 -2
- package/coms/basic/Tree.js +14 -2
- package/coms/basic/crc.js +5 -1
- package/coms/basic/cross_.js +2 -2
- package/coms/basic/decode62S.js +44 -0
- package/coms/basic/encode62S.js +40 -0
- package/coms/basic/encode62S_test.js +18 -0
- package/coms/basic/enrich.js +6 -1
- package/coms/basic/refilm_decode.js +40 -20
- package/coms/basic/refilm_decode_test.js +4 -0
- package/coms/basic/valid.js +4 -0
- package/coms/basic_/&Array.js +64 -49
- package/coms/basic_/&extends.js +9 -2
- package/coms/compile/Javascript.js +1 -1
- package/coms/compile/audit.js +23 -1
- package/coms/compile/cloneNode.js +3 -1
- package/coms/compile/downLevel.js +21 -11
- package/coms/compile/downLevel_test.js +52 -14
- package/coms/compile/rescan.js +8 -2
- package/coms/compile/unstruct.js +9 -9
- package/coms/crypt/encode62.js +36 -6
- package/coms/crypt/encode62_test.js +8 -48
- package/coms/explorer/main.less +1 -5
- package/coms/frame/chat.js +2 -2
- package/coms/frame/left.html +5 -4
- package/coms/frame/left.js +1 -0
- package/coms/frame/left.less +5 -3
- package/coms/frame/payment.js +2 -2
- package/coms/pivot/acme2.js +7 -4
- package/coms/pivot/left-footer.xht +25 -0
- package/coms/pivot/pedit.js +3 -3
- package/coms/pivot/plist.js +2 -2
- package/coms/pivot/qrcode.xht +3 -0
- package/coms/zimoli/XMLHttpRequest.js +2 -2
- package/coms/zimoli/container.js +34 -34
- package/coms/zimoli/design.html +6 -13
- package/coms/zimoli/design.js +49 -13
- package/coms/zimoli/design.less +62 -25
- package/coms/zimoli/drag.js +8 -3
- package/coms/zimoli/encode62.js +40 -12
- package/coms/zimoli/lattice.js +0 -1
- package/coms/zimoli/list.js +0 -8
- package/coms/zimoli/menu.js +29 -5
- package/coms/zimoli/menuList.js +1 -0
- package/coms/zimoli/menuList_test.js +1 -0
- package/coms/zimoli/model.js +150 -195
- package/coms/zimoli/model.less +4 -8
- package/coms/zimoli/on.js +14 -12
- package/coms/zimoli/padding.less +1 -0
- package/coms/zimoli/progbar.xht +9 -8
- package/coms/zimoli/prompt.less +0 -3
- package/coms/zimoli/render.js +210 -125
- package/coms/zimoli/select.js +9 -4
- package/coms/zimoli/select.less +3 -14
- package/coms/zimoli/selectList.js +5 -1
- package/coms/zimoli/selectList.less +3 -0
- package/coms/zimoli/table.html +7 -7
- package/coms/zimoli/table.js +12 -9
- package/coms/zimoli/table.less +5 -0
- package/coms/zimoli/tree.js +1 -2
- package/coms/zimoli/tree.less +3 -1
- package/coms/zimoli/tree_test.js +8 -6
- package/coms/zimoli/user.js +2 -2
- package/coms/zimoli/view.js +3 -4
- package/coms/zimoli/watch.js +3 -1
- package/coms/zimoli/zimoli.js +7 -3
- package/coms//350/214/250/350/217/260/tab.js +26 -2
- package/coms//350/214/250/350/217/260//346/240/207/347/255/276/345/214/226.js +1 -1
- package/coms//350/214/250/350/217/260//347/274/226/350/276/221/346/241/206.xht +183 -20
- package/docs//345/267/245/345/205/267//345/233/275/351/231/205/345/214/226.xht +1 -0
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/coms/zimoli/table.less
CHANGED
package/coms/zimoli/tree.js
CHANGED
|
@@ -42,6 +42,7 @@ function tree() {
|
|
|
42
42
|
generator = arg;
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
|
+
if (!element) element = document.createElement('tree');
|
|
45
46
|
if (!generator && element && "$src" in element && element.childNodes.length) {
|
|
46
47
|
generator = getGenerator(element, 'node');
|
|
47
48
|
}
|
|
@@ -212,7 +213,6 @@ function tree() {
|
|
|
212
213
|
} else {
|
|
213
214
|
marginTop = top.offsetTop - bottom.offsetTop - bottom.offsetHeight;
|
|
214
215
|
}
|
|
215
|
-
css(banner, { paddingBottom: -marginTop });
|
|
216
216
|
var res = transition(top, {
|
|
217
217
|
transition: `margin-top ${time(marginTop)}s ease-out`,
|
|
218
218
|
marginTop: fromOffset(marginTop)
|
|
@@ -232,7 +232,6 @@ function tree() {
|
|
|
232
232
|
setState(false);
|
|
233
233
|
z0();
|
|
234
234
|
var paddingBottom = -margin_top;
|
|
235
|
-
css(banner, { paddingBottom });
|
|
236
235
|
var res = transition(change_elem, { transition: `margin-top ${time(margin_top)}s ease-out`, marginTop: fromOffset(margin_top) }, false);
|
|
237
236
|
timeout(z1, res + 60);
|
|
238
237
|
}
|
package/coms/zimoli/tree.less
CHANGED
package/coms/zimoli/tree_test.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
|
|
1
2
|
var data1 = random([
|
|
2
3
|
{
|
|
3
4
|
name: "一级目录${inc}"
|
|
4
5
|
}
|
|
5
|
-
],
|
|
6
|
+
], 2);
|
|
6
7
|
var data2 = random([{
|
|
7
8
|
name: "一级目录${inc}",
|
|
8
9
|
children: [
|
|
@@ -16,14 +17,15 @@ var data2 = random([{
|
|
|
16
17
|
},
|
|
17
18
|
]
|
|
18
19
|
}
|
|
19
|
-
],
|
|
20
|
+
], 2)
|
|
20
21
|
|
|
21
22
|
function tree_test() {
|
|
22
23
|
var banner = tree();
|
|
23
24
|
banner.setData(data2);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
css(banner, {
|
|
26
|
+
overflow: 'hidden',
|
|
27
|
+
padding: 0,
|
|
28
|
+
height: 260
|
|
29
|
+
});
|
|
28
30
|
return banner;
|
|
29
31
|
}
|
package/coms/zimoli/user.js
CHANGED
|
@@ -51,9 +51,9 @@ var proto = {
|
|
|
51
51
|
},
|
|
52
52
|
getPassport() {
|
|
53
53
|
if (!passport) {
|
|
54
|
-
passport = encode62.
|
|
54
|
+
passport = encode62.packencode(encode62.decode62(user._passport, user.session));
|
|
55
55
|
}
|
|
56
|
-
return passport = encode62.
|
|
56
|
+
return passport = encode62.packupdate(passport);
|
|
57
57
|
},
|
|
58
58
|
Login(userinfo) {
|
|
59
59
|
this.login(userinfo);
|
package/coms/zimoli/view.js
CHANGED
|
@@ -117,7 +117,7 @@ var resize2 = function () {
|
|
|
117
117
|
changed = true;
|
|
118
118
|
css(foot, {
|
|
119
119
|
marginTop: fromOffset(-height)
|
|
120
|
-
})
|
|
120
|
+
});
|
|
121
121
|
css(body, {
|
|
122
122
|
paddingBottom: fromOffset(body.clientTop + body.clientHeight + body.offsetTop - foot.offsetTop)
|
|
123
123
|
});
|
|
@@ -129,7 +129,7 @@ function view(element) {
|
|
|
129
129
|
extend(w, prototype);
|
|
130
130
|
if (w !== element) {
|
|
131
131
|
extend(w, element);
|
|
132
|
-
|
|
132
|
+
oncemount(w, function () {
|
|
133
133
|
if (w.draggable !== true && w.draggable !== false) {
|
|
134
134
|
w.draggable = /^(fixed|absolute)$/i.test(getComputedStyle(w).position);
|
|
135
135
|
}
|
|
@@ -138,8 +138,7 @@ function view(element) {
|
|
|
138
138
|
if (w.resizable) resize.on(w);
|
|
139
139
|
}
|
|
140
140
|
resizingList.set(w, resize2);
|
|
141
|
-
w.renders = [resize2];
|
|
142
141
|
w.reshape = lazy(resize2);
|
|
143
|
-
|
|
142
|
+
w.$digest = resize2;
|
|
144
143
|
return w;
|
|
145
144
|
}
|
package/coms/zimoli/watch.js
CHANGED
|
@@ -2,8 +2,10 @@ function watcher({ changes }) {
|
|
|
2
2
|
var watches = this.$watches;
|
|
3
3
|
for (var k in changes) {
|
|
4
4
|
if (k in watches) {
|
|
5
|
+
var h = watches[k];
|
|
5
6
|
var { current, previous } = changes[k];
|
|
6
|
-
|
|
7
|
+
if (h instanceof Function) h.call(this, current, previous);
|
|
8
|
+
else if (h instanceof Array) h.forEach(h => h.call(this, current, previous));
|
|
7
9
|
}
|
|
8
10
|
}
|
|
9
11
|
}
|
package/coms/zimoli/zimoli.js
CHANGED
|
@@ -431,7 +431,7 @@ function create(pagepath, args, from, needroles) {
|
|
|
431
431
|
var zimoliid = 0, zimoliad = 0;
|
|
432
432
|
function zimoli(pagepath, args, history_name, oldpagepath) {
|
|
433
433
|
if (arguments.length === 0) {
|
|
434
|
-
if (zimoliid !== zimoliad
|
|
434
|
+
if (zimoliid !== zimoliad) return;
|
|
435
435
|
history_name = current_history;
|
|
436
436
|
var _history = history[history_name] || [];
|
|
437
437
|
root_path = _history[0] || "/main";
|
|
@@ -447,7 +447,7 @@ function zimoli(pagepath, args, history_name, oldpagepath) {
|
|
|
447
447
|
}
|
|
448
448
|
if (isNode(history_name))
|
|
449
449
|
var zid = history_name.zimoliid = (history_name.zimoliid | 0) + 1;
|
|
450
|
-
else var zid = ++zimoliid;
|
|
450
|
+
else var zid = arguments.length ? ++zimoliid : zimoliid;
|
|
451
451
|
|
|
452
452
|
if (page_generators[pagepath]) return go(pagepath, args, history_name, oldpagepath);
|
|
453
453
|
return prepare(pagepath, function () {
|
|
@@ -592,9 +592,13 @@ function addGlobal(element, name = null, isBack) {
|
|
|
592
592
|
if (isFunction(body.layer)) {
|
|
593
593
|
body.layer(element, oldElement, history);
|
|
594
594
|
} else if (body !== element) {
|
|
595
|
+
if (oldElement) {
|
|
596
|
+
var oldPrev = oldElement.previousSibling, oldPare = oldElement.parentNode;
|
|
597
|
+
remove(oldElement);
|
|
598
|
+
oldElement = oldPrev || oldPare.firstChild;
|
|
599
|
+
}
|
|
595
600
|
if (isBack || !oldElement) appendChild.insert(body, element);
|
|
596
601
|
else appendChild.after(oldElement, element);
|
|
597
|
-
remove(oldElement);
|
|
598
602
|
}
|
|
599
603
|
global[name] = element;
|
|
600
604
|
} else if (isNode(name)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var ensp = s => Array(s + 1).join("
|
|
1
|
+
var ensp = s => Array(s + 1).join(" "/*&ensp*/);
|
|
2
2
|
var getEnspBefore = function (node) {
|
|
3
3
|
if (!node) return 0;
|
|
4
4
|
while (node && (node.nodeType !== 1 || !/^br$/i.test(node.tagName))) {
|
|
@@ -14,7 +14,31 @@ var getEnspBefore = function (node) {
|
|
|
14
14
|
};
|
|
15
15
|
return function (forcetab) {
|
|
16
16
|
var selection = document.getSelection();
|
|
17
|
-
var { anchorNode, anchorOffset } = selection;
|
|
17
|
+
var { anchorNode, anchorOffset, focusNode, focusOffset } = selection;
|
|
18
|
+
if (anchorNode !== focusNode || anchorOffset !== focusOffset) return;
|
|
19
|
+
if (forcetab < 0) {
|
|
20
|
+
var tempNode = anchorNode;
|
|
21
|
+
var space = ensp(4);
|
|
22
|
+
while (tempNode) {
|
|
23
|
+
if (tempNode.nodeType === 1) {
|
|
24
|
+
if (/^br$/i.test(tempNode.tagName)) return;
|
|
25
|
+
tempNode = tempNode.lastChild || tempNode.previousSibling;
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (tempNode.nodeValue.indexOf(space) >= 0) {
|
|
29
|
+
tempNode.nodeValue = tempNode.nodeValue.replace(space, '');
|
|
30
|
+
if (tempNode === anchorNode) {
|
|
31
|
+
anchorOffset -= 4;
|
|
32
|
+
if (anchorOffset < 0) anchorOffset = 0;
|
|
33
|
+
selection.setBaseAndExtent(tempNode, anchorOffset, tempNode, anchorOffset);
|
|
34
|
+
}
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (/[\r\n\u2028\u2029]/.test(tempNode.nodeValue)) return;
|
|
38
|
+
tempNode = tempNode.previousSibling || tempNode.parentNode?.previousSibling;
|
|
39
|
+
}
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
18
42
|
if (anchorNode.nodeType === 1) {
|
|
19
43
|
var child = anchorNode.childNodes[anchorOffset];
|
|
20
44
|
var spaceSize = 4;
|
|
@@ -63,7 +63,7 @@ var codecolor = function (c, encode) {
|
|
|
63
63
|
used[k].forEach(k in predefs ? setPredef : setOutside);
|
|
64
64
|
}
|
|
65
65
|
if (c.program) var { space_exp: spaceReg, control_reg } = c.program;
|
|
66
|
-
if (spaceReg) var unspaceReg = new RegExp(`(
|
|
66
|
+
if (spaceReg) var unspaceReg = new RegExp(`(?:[^${光标}])+`, 'g');
|
|
67
67
|
var wraptext = function (t, l) {
|
|
68
68
|
if (unspaceReg) t = t.replace(unspaceReg, a => {
|
|
69
69
|
a = encode(a);
|
|
@@ -7,12 +7,37 @@
|
|
|
7
7
|
display: block;
|
|
8
8
|
padding: 6px 0;
|
|
9
9
|
}
|
|
10
|
+
|
|
11
|
+
&.noinput {
|
|
12
|
+
&:before {
|
|
13
|
+
position: absolute;
|
|
14
|
+
background: #c24;
|
|
15
|
+
color: #fff;
|
|
16
|
+
left: 0;
|
|
17
|
+
right: 0;
|
|
18
|
+
top: 0;
|
|
19
|
+
height: 20px;
|
|
20
|
+
line-height: 20px;
|
|
21
|
+
font-size: 16px;
|
|
22
|
+
display: block;
|
|
23
|
+
content: "当前浏览器编辑会造成异常";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
10
26
|
</style>
|
|
11
|
-
<编辑框 e-class="上色.className" e-style="{whiteSpace:'pre'}"
|
|
12
|
-
onkeydown.tab="keytab(
|
|
27
|
+
<编辑框 spellcheck=false e-class="上色.className" e-style="{whiteSpace:'pre'}" onkeydown="updatechar"
|
|
28
|
+
onkeydown.tab.prevent.only="keytab(1)" onkeydown.tab.shift.prevent.only="keytab(-1)" onkeyup.enter.only="tab(false)"
|
|
29
|
+
oninput='!event.isComposing&&updatecode(event)' onkeydown.space.only='fixpace'>
|
|
13
30
|
</编辑框>
|
|
14
31
|
<script>
|
|
15
32
|
var coder = this;
|
|
33
|
+
if (!('oninput' in document)) {
|
|
34
|
+
on('focus')(this, function () {
|
|
35
|
+
if (this.contentEditable) addClass(this, "noinput");
|
|
36
|
+
});
|
|
37
|
+
on('blur')(this, function () {
|
|
38
|
+
removeClass(this, 'noinput');
|
|
39
|
+
})
|
|
40
|
+
}
|
|
16
41
|
var coderid = 0;
|
|
17
42
|
care(coder, async function ([text, type]) {
|
|
18
43
|
try {
|
|
@@ -29,9 +54,9 @@
|
|
|
29
54
|
coder.innerHTML = colored;
|
|
30
55
|
};
|
|
31
56
|
coder.getValue = function () {
|
|
32
|
-
return coder.innerText
|
|
57
|
+
return coder.innerText;
|
|
33
58
|
};
|
|
34
|
-
var markAnchorOffset = function () {
|
|
59
|
+
var markAnchorOffset = function (光标) {
|
|
35
60
|
var { anchorNode, anchorOffset } = document.getSelection();
|
|
36
61
|
if (!anchorNode || !coder) return;
|
|
37
62
|
var [c] = coder.children;
|
|
@@ -123,32 +148,170 @@
|
|
|
123
148
|
return document.getSelection().setBaseAndExtent(child, offset, child, offset);
|
|
124
149
|
}
|
|
125
150
|
var trimspace = (_, a) => a ? "" : " ";
|
|
126
|
-
var jstext = "";
|
|
127
151
|
var 更新 = function (colored) {
|
|
128
152
|
var { scrollTop, scrollLeft } = coder;
|
|
129
153
|
coder.innerHTML = colored;
|
|
130
154
|
coder.scrollTop = scrollTop;
|
|
131
155
|
coder.scrollLeft = scrollLeft;
|
|
156
|
+
unmarkAnchorOffset();
|
|
132
157
|
};
|
|
133
|
-
var
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
158
|
+
var anchorChar = null, inText = false;
|
|
159
|
+
var followChar = null, beforeText = false;
|
|
160
|
+
var fixpace = function (event) {
|
|
161
|
+
event.preventDefault();
|
|
162
|
+
document.execCommand('insertText', false, ' ');
|
|
163
|
+
};
|
|
164
|
+
var updatechar = function (event) {
|
|
165
|
+
coderid++;
|
|
166
|
+
var { anchorNode, anchorOffset } = document.getSelection();
|
|
167
|
+
if (!coder || !anchorNode) return;
|
|
168
|
+
while (anchorNode.nodeType === 1 || anchorOffset === 0) {
|
|
169
|
+
if (anchorNode.nodeType === 1) {
|
|
170
|
+
var { childNodes } = anchorNode;
|
|
171
|
+
if (childNodes.length > 0) {
|
|
172
|
+
if (anchorOffset >= childNodes.length) {
|
|
173
|
+
anchorNode = anchorNode.lastChild;
|
|
174
|
+
if (anchorNode.nodeType === 1) anchorOffset = anchorNode.childNodes.length;
|
|
175
|
+
else anchorOffset = anchorNode.nodeValue.length;
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
anchorNode = childNodes[anchorOffset];
|
|
179
|
+
anchorOffset = 0;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
anchorNode = anchorNode.previousSibling;
|
|
184
|
+
if (anchorNode.nodeType === 1) anchorOffset = anchorNode.childNodes.length;
|
|
185
|
+
else anchorOffset = anchorNode.nodeValue.length;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (anchorOffset === 0) {
|
|
189
|
+
anchorNode = anchorNode.previousSibling || anchorNode.parentNode.previousSibling;
|
|
190
|
+
if (!anchorNode) return;
|
|
191
|
+
do {
|
|
192
|
+
if (anchorNode.nodeType === 1) {
|
|
193
|
+
if (anchorNode.lastChild) {
|
|
194
|
+
anchorOffset = anchorNode.childNodes.length;
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
anchorNode = anchorNode.previousSibling;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
if (anchorNode.nodeValue) {
|
|
202
|
+
anchorOffset = anchorNode.nodeValue.length;
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
anchorNode = anchorNode.previousSibling || anchorNode.parentNode.previousSibling;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
} while (anchorChar?.nodeType === 3 || anchorOffset === 0);
|
|
210
|
+
}
|
|
211
|
+
if (!anchorNode) return;
|
|
212
|
+
}
|
|
213
|
+
if (anchorNode.nodeType === 3) {
|
|
214
|
+
inText = /^text$/i.test(anchorNode.parentNode.tagName);
|
|
215
|
+
beforeText = inText;
|
|
216
|
+
if (anchorOffset > 0) {
|
|
217
|
+
anchorChar = anchorNode.nodeValue.charAt(anchorOffset - 1);
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
anchorChar = '';
|
|
221
|
+
}
|
|
222
|
+
if (anchorOffset >= anchorNode.nodeValue.length) {
|
|
223
|
+
followChar = anchorNode.nextSibling || anchorNode.parentNode.nextSibling;
|
|
224
|
+
if (followChar.nodeType === 1) {
|
|
225
|
+
beforeText = /^text$/i.test(followChar.tagName);
|
|
226
|
+
followChar = followChar.innerText.charAt(0);
|
|
227
|
+
}
|
|
228
|
+
else if (followChar.nodeType === 3) {
|
|
229
|
+
beforeText = /^text$/i.test(followChar.parentNode.tagName);
|
|
230
|
+
followChar = followChar.nodeValue.charAt(0);
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
followChar = '';
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
followChar = anchorNode.nodeValue.charAt(anchorOffset);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
inText = false;
|
|
243
|
+
beforeText = false;
|
|
244
|
+
followChar = '';
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
};
|
|
248
|
+
var pairsmap = Object.create(null);
|
|
249
|
+
[
|
|
250
|
+
`""`,
|
|
251
|
+
"''",
|
|
252
|
+
'``',
|
|
253
|
+
"()",
|
|
254
|
+
"[]",
|
|
255
|
+
"{}",
|
|
256
|
+
].forEach(a => {
|
|
257
|
+
var [k, p] = a.split('');
|
|
258
|
+
pairsmap[k] = p;
|
|
259
|
+
});
|
|
260
|
+
var codeHistory = [];
|
|
261
|
+
var historyIndex = 0;
|
|
262
|
+
var updatecode = function (event) {
|
|
263
|
+
var { data, inputType } = event;
|
|
264
|
+
coderid++;
|
|
265
|
+
var patchAfter = '';
|
|
266
|
+
console.log("follow-char", followChar, 'data', data, 'anchor-char', anchorChar);
|
|
267
|
+
switch (inputType) {
|
|
268
|
+
case "insertText":
|
|
269
|
+
if (data === ' ') return;
|
|
270
|
+
if (anchorChar in pairsmap) {
|
|
271
|
+
if (followChar === pairsmap[anchorChar] && data === followChar) {
|
|
272
|
+
document.execCommand('forwardDelete');
|
|
273
|
+
}
|
|
274
|
+
else if (data in pairsmap) {
|
|
275
|
+
if (inText || beforeText) return;
|
|
276
|
+
patchAfter = pairsmap[data];
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
if (data in pairsmap) {
|
|
281
|
+
if (inText || beforeText) return;
|
|
282
|
+
patchAfter = pairsmap[data];
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
break;
|
|
286
|
+
case "insertParagraph": return;
|
|
287
|
+
case "deleteContentForward": return;
|
|
288
|
+
case "deleteContentBackward":
|
|
289
|
+
if (anchorChar in pairsmap && followChar === pairsmap[anchorChar]) {
|
|
290
|
+
document.execCommand('forwardDelete');
|
|
291
|
+
}
|
|
292
|
+
if (inText) return;
|
|
293
|
+
updatechar();
|
|
294
|
+
if (inText) return;
|
|
295
|
+
break;
|
|
296
|
+
|
|
297
|
+
}
|
|
298
|
+
markAnchorOffset(光标 + patchAfter);
|
|
299
|
+
var markedText = coder.innerText;
|
|
300
|
+
historyIndex = codeHistory.length;
|
|
301
|
+
codeHistory.push(coder.innerHTML);
|
|
141
302
|
unmarkAnchorOffset();
|
|
142
|
-
|
|
303
|
+
updateonly(coderid, markedText);
|
|
304
|
+
};
|
|
305
|
+
var updateonly = lazy(async function (id, markedText) {
|
|
143
306
|
if (coderid !== id) return;
|
|
144
|
-
|
|
145
|
-
|
|
307
|
+
markedText = await 上色.text(coder.type, markedText);
|
|
308
|
+
if (coderid !== id) return;
|
|
309
|
+
更新(markedText);
|
|
146
310
|
dispatch(coder, 'change');
|
|
147
311
|
return;
|
|
148
|
-
});
|
|
149
|
-
var keytab = function (
|
|
150
|
-
|
|
151
|
-
tab();
|
|
312
|
+
}, -60);
|
|
313
|
+
var keytab = function (direction) {
|
|
314
|
+
tab(direction);
|
|
152
315
|
};
|
|
153
316
|
|
|
154
317
|
</script>
|