efront 4.33.3 → 4.34.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/#/345/233/275/351/231/205/345/214/226.yml +12 -0
- package/apps/_index.html +1 -4
- package/apps/pivot/link/chat.js +3 -3
- package/apps/pivot/link/list.html +1 -1
- package/coms/basic_/Symbol.js +12 -7
- package/coms/compile/autoenum.js +25 -4
- package/coms/compile/downLevel.js +14 -8
- package/coms/frame/chat-rtc.xht +1 -1
- package/coms/frame/chat.html +20 -11
- package/coms/frame/chat.js +159 -46
- package/coms/frame/chat.less +30 -0
- package/coms/zimoli/copyToClipboard.js +46 -0
- package/coms/zimoli/removeUnsafeTags.js +21 -0
- package/coms/zimoli/render.js +56 -10
- package/package.json +1 -1
- package/public/efront.js +1 -1
- package/public//346/226/207/344/273/266/347/263/273/347/273/237//344/270/273/351/241/265.jsp +2 -2
package/coms/frame/chat.less
CHANGED
|
@@ -25,6 +25,36 @@
|
|
|
25
25
|
max-height: 100%;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
.fade {
|
|
29
|
+
filter: grayscale(1);
|
|
30
|
+
opacity: .5;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.qrcode {
|
|
34
|
+
position: relative;
|
|
35
|
+
height: 0;
|
|
36
|
+
overflow: visible;
|
|
37
|
+
z-index: 2;
|
|
38
|
+
padding: 0;
|
|
39
|
+
width: 100%;
|
|
40
|
+
text-align: center;
|
|
41
|
+
margin-bottom: -52px;
|
|
42
|
+
|
|
43
|
+
>p {
|
|
44
|
+
background: #fff;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
>canvas {
|
|
48
|
+
background: #fff;
|
|
49
|
+
border: 10px solid #fff;
|
|
50
|
+
image-rendering: pixelated;
|
|
51
|
+
display: block;
|
|
52
|
+
margin: 52px auto 10px auto;
|
|
53
|
+
width: 256px;
|
|
54
|
+
height: 256px;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
28
58
|
>list {
|
|
29
59
|
width: @leftwidth;
|
|
30
60
|
position: absolute;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
var ClipboardItem = window.ClipboardItem;
|
|
2
|
+
|
|
3
|
+
async function copyToClipboard(text, mime = 'text/plain') {
|
|
4
|
+
mime = mime.toLowerCase();
|
|
5
|
+
if (ClipboardItem && ClipboardItem.supports(mime)) {
|
|
6
|
+
const clipboardItem = new ClipboardItem({ [mime]: text });
|
|
7
|
+
try {
|
|
8
|
+
await navigator.clipboard.write([clipboardItem]);
|
|
9
|
+
alert("已复制");
|
|
10
|
+
return;
|
|
11
|
+
} catch (e) { console.log(e) };
|
|
12
|
+
}
|
|
13
|
+
var span = document.createElement('span');
|
|
14
|
+
span.setAttribute('user-select', 'all');
|
|
15
|
+
setOpacity(span, 0);
|
|
16
|
+
css(span, "position:absolute;top:-1000000px;left:-1000000px;")
|
|
17
|
+
switch (mime) {
|
|
18
|
+
case "text/plain": span.innerText = text; break;
|
|
19
|
+
case "text/html": span.innerHTML = text; removeUnsafeTags(span); break;
|
|
20
|
+
default:
|
|
21
|
+
if (/^image\//i.test(mime)) {
|
|
22
|
+
span.innerHTML = `<img src=${strings.encode(text)}/>`;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
return alert(i18n`复制失败!`, 'error');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
document.body.appendChild(span);
|
|
30
|
+
var selection = document.getSelection();
|
|
31
|
+
var ranges = [];
|
|
32
|
+
for (var cx = 0, dx = selection.rangeCount; cx < dx; cx++) {
|
|
33
|
+
var range = selection.getRangeAt(cx);
|
|
34
|
+
ranges.push(range);
|
|
35
|
+
}
|
|
36
|
+
selection.removeAllRanges();
|
|
37
|
+
document.getSelection().setBaseAndExtent(span, 0, span, 1);
|
|
38
|
+
var res = document.execCommand('copy');
|
|
39
|
+
selection.removeAllRanges();
|
|
40
|
+
for (var range of ranges) {
|
|
41
|
+
selection.addRange(range);
|
|
42
|
+
}
|
|
43
|
+
remove(span);
|
|
44
|
+
if (res) alert("已复制");
|
|
45
|
+
|
|
46
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function removeJavascript(a, attr) {
|
|
2
|
+
if (!a.hasAttribute(attr)) return;
|
|
3
|
+
var value = a.getAttribute(attr);
|
|
4
|
+
if (/^javascript\:/i.test(value)) a.removeAttribute(attr);
|
|
5
|
+
}
|
|
6
|
+
function removeTags(a, tagName) {
|
|
7
|
+
var scripts = a.getElementsByTagName(tagName);
|
|
8
|
+
remove(scripts);
|
|
9
|
+
}
|
|
10
|
+
function removeUnsafeTags(a) {
|
|
11
|
+
removeTags(a, 'script');
|
|
12
|
+
removeTags(a, 'iframe');
|
|
13
|
+
removeTags(a, 'style');
|
|
14
|
+
removeTags(a, 'meta');
|
|
15
|
+
if (a.hasAttribute('onload')) a.removeAttribute('onload');
|
|
16
|
+
if (a.hasAttribute('onerror')) a.removeAttribute('onerror');
|
|
17
|
+
removeJavascript(a, 'src');
|
|
18
|
+
removeJavascript(a, 'href');
|
|
19
|
+
for (var c of a.children) removeUnsafeTags(c);
|
|
20
|
+
return a;
|
|
21
|
+
}
|
package/coms/zimoli/render.js
CHANGED
|
@@ -675,8 +675,17 @@ var gtValue = function () { return this.value };
|
|
|
675
675
|
var stValue = function (v) { this.value = v };
|
|
676
676
|
var gtChecked = function () { return this.checked };
|
|
677
677
|
var stChecked = function (v) { this.checked = v };
|
|
678
|
-
var gtHtml = function () {
|
|
679
|
-
|
|
678
|
+
var gtHtml = function () {
|
|
679
|
+
removeUnsafeTags(this);
|
|
680
|
+
return this.innerHTML;
|
|
681
|
+
};
|
|
682
|
+
var stHtml = function (v) {
|
|
683
|
+
var span = document.createElement('span');
|
|
684
|
+
span.innerHTML = v;
|
|
685
|
+
removeUnsafeTags(span);
|
|
686
|
+
this.innerHTML = '';
|
|
687
|
+
appendChild(this, span.childNodes);
|
|
688
|
+
};
|
|
680
689
|
class Model {
|
|
681
690
|
constructor(getScope, setScope, target) {
|
|
682
691
|
this.gs = getScope;
|
|
@@ -713,6 +722,7 @@ class Model {
|
|
|
713
722
|
return;
|
|
714
723
|
}
|
|
715
724
|
this.ss.call(this.target, value);
|
|
725
|
+
console.log(value, this.value, this.gs.call(this.target))
|
|
716
726
|
this.value = value;
|
|
717
727
|
this.bd.value = this.gs.call(this.target, value);
|
|
718
728
|
if (isFunction(this.emit?.call)) {
|
|
@@ -734,7 +744,7 @@ class Model {
|
|
|
734
744
|
}
|
|
735
745
|
}
|
|
736
746
|
var createSetter = function (elem, search) {
|
|
737
|
-
return $$eval.bind(elem, search + "=arguments[
|
|
747
|
+
return $$eval.bind(elem, search + "=arguments[1]", scopeList, elem);
|
|
738
748
|
};
|
|
739
749
|
var directives = {
|
|
740
750
|
text: createBinder2(function (value) {
|
|
@@ -812,6 +822,14 @@ var binders = {
|
|
|
812
822
|
""(attr, search) {
|
|
813
823
|
var getter = createGetter(this, search);
|
|
814
824
|
var oldValue;
|
|
825
|
+
if (/contenteditable/i.test(attr)) {
|
|
826
|
+
var v = this.value;
|
|
827
|
+
Object.defineProperty(this, 'value', {
|
|
828
|
+
get: gtHtml,
|
|
829
|
+
set: stHtml
|
|
830
|
+
});
|
|
831
|
+
if (isHandled(v)) this.value = v;
|
|
832
|
+
}
|
|
815
833
|
var hook = function () {
|
|
816
834
|
var value = getter(this);
|
|
817
835
|
if (deepEqual(value, oldValue)) return;
|
|
@@ -1138,21 +1156,49 @@ var getDeepContext = function (deep) {
|
|
|
1138
1156
|
var length = deep;
|
|
1139
1157
|
var deepL = deepcontexts.length;
|
|
1140
1158
|
while (deep-- > deepL) {
|
|
1141
|
-
deepcontexts[deep] = `with(
|
|
1159
|
+
deepcontexts[deep] = `with($$[${deep}])`;
|
|
1142
1160
|
}
|
|
1143
1161
|
return deepcontexts.slice(0, length).join('');
|
|
1144
1162
|
}
|
|
1145
|
-
var
|
|
1146
|
-
|
|
1163
|
+
var isRowCode = function (code) {
|
|
1164
|
+
var reg = /["';]/g;
|
|
1165
|
+
reg.lastIndex = 0;
|
|
1166
|
+
var reg1 = /\\[\s\S]|'/g;
|
|
1167
|
+
var reg2 = /\\[\s\S]|"/g;
|
|
1168
|
+
do {
|
|
1169
|
+
var r = reg.exec(code)
|
|
1170
|
+
if (!r) return true;
|
|
1171
|
+
var regtmp = null;
|
|
1172
|
+
if (r) switch (r[0]) {
|
|
1173
|
+
case "'": regtmp = reg1; break;
|
|
1174
|
+
case `"`: regtmp = reg2; break;
|
|
1175
|
+
case ";": return false;
|
|
1176
|
+
}
|
|
1177
|
+
if (regtmp) {
|
|
1178
|
+
regtmp.lastIndex = reg.lastIndex;
|
|
1179
|
+
do {
|
|
1180
|
+
var r = regtmp.exec(code);
|
|
1181
|
+
if (r) {
|
|
1182
|
+
r = r[0];
|
|
1183
|
+
if (r.length === 1) break;
|
|
1184
|
+
}
|
|
1185
|
+
} while (r);
|
|
1186
|
+
reg.lastIndex = regtmp.lastIndex;
|
|
1187
|
+
}
|
|
1188
|
+
} while (r);
|
|
1189
|
+
return true;
|
|
1190
|
+
}
|
|
1191
|
+
var createEval = function (deep, code) {
|
|
1192
|
+
if (isRowCode(code)) code = `return ${code}`;
|
|
1193
|
+
else code = `{${code}}`;
|
|
1194
|
+
return new Function("$$", 'event', `${getDeepContext(deep)}${code}`);
|
|
1147
1195
|
};
|
|
1148
1196
|
|
|
1149
|
-
var evalcontexts = [createEval(0)];
|
|
1150
1197
|
|
|
1151
1198
|
function $$eval(search, scopes, target = this, event) {
|
|
1152
1199
|
var length = scopes.length;
|
|
1153
|
-
var eval2 =
|
|
1154
|
-
|
|
1155
|
-
var res = eval2.call(target, scopes, search, event);
|
|
1200
|
+
var eval2 = createEval(length, search);
|
|
1201
|
+
var res = eval2.call(target, scopes, event);
|
|
1156
1202
|
return res;
|
|
1157
1203
|
}
|
|
1158
1204
|
|