efront 4.11.5 → 4.11.8

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.
@@ -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
- care(coder, function ([text, type]) {
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] {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.11.5",
3
+ "version": "4.11.8",
4
4
  "description": "简化前端开发,优化web性能",
5
5
  "main": "public/efront.js",
6
6
  "directories": {