ts-glitter 13.8.827 → 13.8.828
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/lowcode/Entry.js
CHANGED
|
@@ -70,7 +70,7 @@ export class Entry {
|
|
|
70
70
|
}
|
|
71
71
|
window.renderClock = (_a = window.renderClock) !== null && _a !== void 0 ? _a : clockF();
|
|
72
72
|
console.log(`Entry-time:`, window.renderClock.stop());
|
|
73
|
-
glitter.share.editerVersion = 'V_13.8.
|
|
73
|
+
glitter.share.editerVersion = 'V_13.8.828';
|
|
74
74
|
glitter.share.start = new Date();
|
|
75
75
|
const vm = {
|
|
76
76
|
appConfig: [],
|
package/lowcode/Entry.ts
CHANGED
|
@@ -71,7 +71,7 @@ export class Entry {
|
|
|
71
71
|
}
|
|
72
72
|
(window as any).renderClock = (window as any).renderClock ?? clockF();
|
|
73
73
|
console.log(`Entry-time:`, (window as any).renderClock.stop());
|
|
74
|
-
glitter.share.editerVersion = 'V_13.8.
|
|
74
|
+
glitter.share.editerVersion = 'V_13.8.828';
|
|
75
75
|
glitter.share.start = new Date();
|
|
76
76
|
const vm: {
|
|
77
77
|
appConfig: any;
|
|
@@ -907,11 +907,12 @@ ${obj.structEnd ? obj.structEnd : '})()'}`,
|
|
|
907
907
|
style: `${obj.style || `overflow-y: auto;`}position:relative;`,
|
|
908
908
|
},
|
|
909
909
|
onCreate: () => {
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
910
|
+
function render() {
|
|
911
|
+
const interval = setInterval(() => {
|
|
912
|
+
if (glitter.window.FroalaEditor) {
|
|
913
|
+
setTimeout(() => {
|
|
914
|
+
var _a;
|
|
915
|
+
gvc.addStyle(`
|
|
915
916
|
#insertImage-1 {
|
|
916
917
|
display: none !important;
|
|
917
918
|
}
|
|
@@ -922,7 +923,7 @@ ${obj.structEnd ? obj.structEnd : '})()'}`,
|
|
|
922
923
|
display: none !important;
|
|
923
924
|
}
|
|
924
925
|
${obj.hiddenBorder
|
|
925
|
-
|
|
926
|
+
? css `
|
|
926
927
|
.fr-box {
|
|
927
928
|
border: none !important;
|
|
928
929
|
}
|
|
@@ -930,104 +931,113 @@ ${obj.structEnd ? obj.structEnd : '})()'}`,
|
|
|
930
931
|
border: none !important;
|
|
931
932
|
}
|
|
932
933
|
`
|
|
933
|
-
|
|
934
|
+
: ''}
|
|
934
935
|
`);
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
936
|
+
function generateFontSizeArray() {
|
|
937
|
+
let fontSizes = [];
|
|
938
|
+
for (let size = 8; size <= 30; size += 1) {
|
|
939
|
+
fontSizes.push(size.toString());
|
|
940
|
+
}
|
|
941
|
+
for (let size = 32; size <= 60; size += 2) {
|
|
942
|
+
fontSizes.push(size.toString());
|
|
943
|
+
}
|
|
944
|
+
for (let size = 64; size <= 96; size += 4) {
|
|
945
|
+
fontSizes.push(size.toString());
|
|
946
|
+
}
|
|
947
|
+
return fontSizes;
|
|
945
948
|
}
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
949
|
+
const editor = new glitter.window.FroalaEditor('#' + richID, {
|
|
950
|
+
language: 'zh_tw',
|
|
951
|
+
heightMin: (_a = obj.setHeight) !== null && _a !== void 0 ? _a : 350,
|
|
952
|
+
content: obj.def,
|
|
953
|
+
fontSize: generateFontSizeArray(),
|
|
954
|
+
quickInsertEnabled: false,
|
|
955
|
+
toolbarSticky: true,
|
|
956
|
+
events: {
|
|
957
|
+
imageMaxSize: 5 * 1024 * 1024,
|
|
958
|
+
imageAllowedTypes: ['jpeg', 'jpg', 'png'],
|
|
959
|
+
contentChanged: function () {
|
|
960
|
+
obj.callback(editor.html.get());
|
|
961
|
+
},
|
|
962
|
+
'image.uploaded': function (response) {
|
|
963
|
+
console.info(`image.uploaded`);
|
|
964
|
+
return false;
|
|
965
|
+
},
|
|
966
|
+
'image.inserted': function ($img, response) {
|
|
967
|
+
console.info(`image.inserted`);
|
|
968
|
+
return false;
|
|
969
|
+
},
|
|
970
|
+
'image.replaced': function ($img, response) {
|
|
971
|
+
console.info(`image.replaced`);
|
|
972
|
+
return false;
|
|
973
|
+
},
|
|
974
|
+
'image.beforePasteUpload': (e, images) => {
|
|
975
|
+
var _a;
|
|
976
|
+
function base64ToBlob(base64, mimeType) {
|
|
977
|
+
mimeType = mimeType || '';
|
|
978
|
+
var byteCharacters = atob(base64);
|
|
979
|
+
var byteNumbers = new Array(byteCharacters.length);
|
|
980
|
+
for (var i = 0; i < byteCharacters.length; i++) {
|
|
981
|
+
byteNumbers[i] = byteCharacters.charCodeAt(i);
|
|
982
|
+
}
|
|
983
|
+
var byteArray = new Uint8Array(byteNumbers);
|
|
984
|
+
return new Blob([byteArray], { type: mimeType });
|
|
981
985
|
}
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
dd.element.src = res.links[index];
|
|
986
|
+
const mimeType = 'image/jpeg';
|
|
987
|
+
const blob = base64ToBlob(e.src.split(',')[1], mimeType);
|
|
988
|
+
const saasConfig = window.saasConfig;
|
|
989
|
+
glitter.share.wait_up_f = (_a = glitter.share.wait_up_f) !== null && _a !== void 0 ? _a : [];
|
|
990
|
+
glitter.share.wait_up_f.push({
|
|
991
|
+
file: new File([blob], gvc.glitter.getUUID() + '.jpeg', { type: mimeType }),
|
|
992
|
+
element: e,
|
|
993
|
+
});
|
|
994
|
+
clearInterval(glitter.share.wait_up_f_timer);
|
|
995
|
+
glitter.share.wait_up_f_timer = setTimeout(() => {
|
|
996
|
+
const dialog = new ShareDialog(obj.gvc.glitter);
|
|
997
|
+
dialog.dataLoading({ visible: true });
|
|
998
|
+
saasConfig.api
|
|
999
|
+
.uploadFileAll(glitter.share.wait_up_f.map((dd) => {
|
|
1000
|
+
return dd.file;
|
|
1001
|
+
}))
|
|
1002
|
+
.then((res) => {
|
|
1003
|
+
dialog.dataLoading({ visible: false });
|
|
1004
|
+
glitter.share.wait_up_f.map((dd, index) => {
|
|
1005
|
+
dd.element.src = res.links[index];
|
|
1006
|
+
});
|
|
1007
|
+
glitter.share.wait_up_f = [];
|
|
1005
1008
|
});
|
|
1006
|
-
|
|
1009
|
+
}, 100);
|
|
1010
|
+
e.src = '';
|
|
1011
|
+
return false;
|
|
1012
|
+
},
|
|
1013
|
+
'image.beforeUpload': function (e, images) {
|
|
1014
|
+
EditorElem.uploadFileFunction({
|
|
1015
|
+
gvc: gvc,
|
|
1016
|
+
callback: (text) => {
|
|
1017
|
+
editor.html.insert(`<img${text}">`);
|
|
1018
|
+
},
|
|
1019
|
+
file: e[0],
|
|
1007
1020
|
});
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
return false;
|
|
1011
|
-
},
|
|
1012
|
-
'image.beforeUpload': function (e, images) {
|
|
1013
|
-
EditorElem.uploadFileFunction({
|
|
1014
|
-
gvc: gvc,
|
|
1015
|
-
callback: (text) => {
|
|
1016
|
-
editor.html.insert(`<img${text}">`);
|
|
1017
|
-
},
|
|
1018
|
-
file: e[0],
|
|
1019
|
-
});
|
|
1020
|
-
return false;
|
|
1021
|
+
return false;
|
|
1022
|
+
},
|
|
1021
1023
|
},
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1024
|
+
key: 'hWA2C-7I2B2C4B3E4E2G3wd1DBKSPF1WKTUCQOa1OURPJ1KDe2F-11D2C2D2D2C3B3C1D6B1C2==',
|
|
1025
|
+
});
|
|
1026
|
+
if (glitter.document.querySelector(`.${richID}-loading`)) {
|
|
1027
|
+
glitter.document.querySelector(`.${richID}-loading`).remove();
|
|
1028
|
+
}
|
|
1029
|
+
setTimeout(() => {
|
|
1030
|
+
const target = glitter.document.querySelector(`[data-cmd="insertImage"]`);
|
|
1031
|
+
if (!target) {
|
|
1032
|
+
try {
|
|
1033
|
+
editor.destroy();
|
|
1034
|
+
}
|
|
1035
|
+
catch (e) {
|
|
1036
|
+
}
|
|
1037
|
+
render();
|
|
1038
|
+
return;
|
|
1039
|
+
}
|
|
1040
|
+
target.outerHTML = html ` <button
|
|
1031
1041
|
id="insertImage-replace"
|
|
1032
1042
|
type="button"
|
|
1033
1043
|
tabindex="-1"
|
|
@@ -1035,45 +1045,45 @@ ${obj.structEnd ? obj.structEnd : '})()'}`,
|
|
|
1035
1045
|
class="fr-command fr-btn "
|
|
1036
1046
|
data-title="插入圖片 (⌘P)"
|
|
1037
1047
|
onclick="${obj.gvc.event(() => {
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
dialog.dataLoading({ visible: true });
|
|
1049
|
-
const file = data[0].file;
|
|
1050
|
-
saasConfig.api.uploadFile(file.name).then((data) => {
|
|
1051
|
-
dialog.dataLoading({ visible: false });
|
|
1052
|
-
const data1 = data.response;
|
|
1048
|
+
if (obj.insertImageEvent) {
|
|
1049
|
+
obj.insertImageEvent(editor);
|
|
1050
|
+
}
|
|
1051
|
+
else {
|
|
1052
|
+
glitter.ut.chooseMediaCallback({
|
|
1053
|
+
single: true,
|
|
1054
|
+
accept: 'image/*',
|
|
1055
|
+
callback(data) {
|
|
1056
|
+
const saasConfig = window.saasConfig;
|
|
1057
|
+
const dialog = new ShareDialog(glitter);
|
|
1053
1058
|
dialog.dataLoading({ visible: true });
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
type: 'put',
|
|
1057
|
-
data: file,
|
|
1058
|
-
headers: {
|
|
1059
|
-
'Content-Type': data1.type,
|
|
1060
|
-
},
|
|
1061
|
-
}).then((res) => {
|
|
1059
|
+
const file = data[0].file;
|
|
1060
|
+
saasConfig.api.uploadFile(file.name).then((data) => {
|
|
1062
1061
|
dialog.dataLoading({ visible: false });
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1062
|
+
const data1 = data.response;
|
|
1063
|
+
dialog.dataLoading({ visible: true });
|
|
1064
|
+
BaseApi.create({
|
|
1065
|
+
url: data1.url,
|
|
1066
|
+
type: 'put',
|
|
1067
|
+
data: file,
|
|
1068
|
+
headers: {
|
|
1069
|
+
'Content-Type': data1.type,
|
|
1070
|
+
},
|
|
1071
|
+
}).then((res) => {
|
|
1072
|
+
dialog.dataLoading({ visible: false });
|
|
1073
|
+
if (res.result) {
|
|
1074
|
+
const imgElement = html `<img src="${data1.fullUrl}" style="max-width: 100%;" />`;
|
|
1075
|
+
editor.html.insert(imgElement);
|
|
1076
|
+
editor.undo.saveStep();
|
|
1077
|
+
}
|
|
1078
|
+
else {
|
|
1079
|
+
dialog.errorMessage({ text: '上傳失敗' });
|
|
1080
|
+
}
|
|
1081
|
+
});
|
|
1071
1082
|
});
|
|
1072
|
-
}
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
}
|
|
1076
|
-
})}"
|
|
1083
|
+
},
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
})}"
|
|
1077
1087
|
>
|
|
1078
1088
|
<svg class="fr-svg" focusable="false" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
1079
1089
|
<path
|
|
@@ -1082,20 +1092,22 @@ ${obj.structEnd ? obj.structEnd : '})()'}`,
|
|
|
1082
1092
|
</svg>
|
|
1083
1093
|
<span class="fr-sr-only">插入圖片</span>
|
|
1084
1094
|
</button>`;
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1095
|
+
if (obj.rich_height) {
|
|
1096
|
+
glitter.document.querySelector(`#` + richID).querySelector(`.fr-view`).style.height = obj.rich_height;
|
|
1097
|
+
glitter.document.querySelector(`#` + richID).querySelector(`.fr-view`).style.minHeight = 'auto';
|
|
1098
|
+
glitter.document.querySelector(`#` + richID).querySelector(`.fr-view`).style.overflowY = 'auto';
|
|
1099
|
+
}
|
|
1100
|
+
if (obj.readonly) {
|
|
1101
|
+
editor.edit.off();
|
|
1102
|
+
editor.toolbar.disable();
|
|
1103
|
+
}
|
|
1104
|
+
}, 200);
|
|
1105
|
+
}, 100);
|
|
1106
|
+
clearInterval(interval);
|
|
1107
|
+
}
|
|
1108
|
+
}, 100);
|
|
1109
|
+
}
|
|
1110
|
+
render();
|
|
1099
1111
|
},
|
|
1100
1112
|
};
|
|
1101
1113
|
});
|
|
@@ -991,10 +991,11 @@ ${obj.structEnd ? obj.structEnd : '})()'}`,
|
|
|
991
991
|
style: `${obj.style || `overflow-y: auto;`}position:relative;`,
|
|
992
992
|
},
|
|
993
993
|
onCreate: () => {
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
994
|
+
function render(){
|
|
995
|
+
const interval = setInterval(() => {
|
|
996
|
+
if ((glitter.window as any).FroalaEditor) {
|
|
997
|
+
setTimeout(() => {
|
|
998
|
+
gvc.addStyle(`
|
|
998
999
|
#insertImage-1 {
|
|
999
1000
|
display: none !important;
|
|
1000
1001
|
}
|
|
@@ -1005,8 +1006,8 @@ ${obj.structEnd ? obj.structEnd : '})()'}`,
|
|
|
1005
1006
|
display: none !important;
|
|
1006
1007
|
}
|
|
1007
1008
|
${
|
|
1008
|
-
|
|
1009
|
-
|
|
1009
|
+
obj.hiddenBorder
|
|
1010
|
+
? css`
|
|
1010
1011
|
.fr-box {
|
|
1011
1012
|
border: none !important;
|
|
1012
1013
|
}
|
|
@@ -1014,123 +1015,132 @@ ${obj.structEnd ? obj.structEnd : '})()'}`,
|
|
|
1014
1015
|
border: none !important;
|
|
1015
1016
|
}
|
|
1016
1017
|
`
|
|
1017
|
-
|
|
1018
|
-
|
|
1018
|
+
: ''
|
|
1019
|
+
}
|
|
1019
1020
|
`);
|
|
1020
1021
|
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
// 添加8到30的字體大小
|
|
1025
|
-
for (let size = 8; size <= 30; size += 1) {
|
|
1026
|
-
fontSizes.push(size.toString());
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
// 添加30到60的字體大小
|
|
1030
|
-
for (let size = 32; size <= 60; size += 2) {
|
|
1031
|
-
fontSizes.push(size.toString());
|
|
1032
|
-
}
|
|
1022
|
+
function generateFontSizeArray() {
|
|
1023
|
+
let fontSizes = [];
|
|
1033
1024
|
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
return fontSizes;
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
|
-
const editor = new (glitter.window as any).FroalaEditor('#' + richID, {
|
|
1043
|
-
language: 'zh_tw',
|
|
1044
|
-
heightMin: obj.setHeight ?? 350,
|
|
1045
|
-
content: obj.def,
|
|
1046
|
-
fontSize: generateFontSizeArray(),
|
|
1047
|
-
quickInsertEnabled: false,
|
|
1048
|
-
toolbarSticky: true,
|
|
1049
|
-
events: {
|
|
1050
|
-
imageMaxSize: 5 * 1024 * 1024,
|
|
1051
|
-
imageAllowedTypes: ['jpeg', 'jpg', 'png'],
|
|
1052
|
-
contentChanged: function () {
|
|
1053
|
-
obj.callback(editor.html.get());
|
|
1054
|
-
},
|
|
1055
|
-
'image.uploaded': function (response: any) {
|
|
1056
|
-
console.info(`image.uploaded`);
|
|
1057
|
-
return false;
|
|
1058
|
-
},
|
|
1059
|
-
'image.inserted': function ($img: any, response: any) {
|
|
1060
|
-
console.info(`image.inserted`);
|
|
1061
|
-
return false;
|
|
1062
|
-
},
|
|
1063
|
-
'image.replaced': function ($img: any, response: any) {
|
|
1064
|
-
console.info(`image.replaced`);
|
|
1065
|
-
return false;
|
|
1066
|
-
},
|
|
1067
|
-
'image.beforePasteUpload': (e: any, images: any) => {
|
|
1068
|
-
function base64ToBlob(base64: any, mimeType: any) {
|
|
1069
|
-
mimeType = mimeType || ''; // 设置默认 MIME 类型
|
|
1070
|
-
var byteCharacters = atob(base64);
|
|
1071
|
-
var byteNumbers = new Array(byteCharacters.length);
|
|
1072
|
-
|
|
1073
|
-
for (var i = 0; i < byteCharacters.length; i++) {
|
|
1074
|
-
byteNumbers[i] = byteCharacters.charCodeAt(i);
|
|
1075
|
-
}
|
|
1025
|
+
// 添加8到30的字體大小
|
|
1026
|
+
for (let size = 8; size <= 30; size += 1) {
|
|
1027
|
+
fontSizes.push(size.toString());
|
|
1028
|
+
}
|
|
1076
1029
|
|
|
1077
|
-
|
|
1030
|
+
// 添加30到60的字體大小
|
|
1031
|
+
for (let size = 32; size <= 60; size += 2) {
|
|
1032
|
+
fontSizes.push(size.toString());
|
|
1033
|
+
}
|
|
1078
1034
|
|
|
1079
|
-
|
|
1080
|
-
|
|
1035
|
+
// 添加60到96的字體大小
|
|
1036
|
+
for (let size = 64; size <= 96; size += 4) {
|
|
1037
|
+
fontSizes.push(size.toString());
|
|
1038
|
+
}
|
|
1081
1039
|
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1040
|
+
return fontSizes;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
const editor = new (glitter.window as any).FroalaEditor('#' + richID, {
|
|
1044
|
+
language: 'zh_tw',
|
|
1045
|
+
heightMin: obj.setHeight ?? 350,
|
|
1046
|
+
content: obj.def,
|
|
1047
|
+
fontSize: generateFontSizeArray(),
|
|
1048
|
+
quickInsertEnabled: false,
|
|
1049
|
+
toolbarSticky: true,
|
|
1050
|
+
events: {
|
|
1051
|
+
imageMaxSize: 5 * 1024 * 1024,
|
|
1052
|
+
imageAllowedTypes: ['jpeg', 'jpg', 'png'],
|
|
1053
|
+
contentChanged: function () {
|
|
1054
|
+
obj.callback(editor.html.get());
|
|
1055
|
+
},
|
|
1056
|
+
'image.uploaded': function (response: any) {
|
|
1057
|
+
console.info(`image.uploaded`);
|
|
1058
|
+
return false;
|
|
1059
|
+
},
|
|
1060
|
+
'image.inserted': function ($img: any, response: any) {
|
|
1061
|
+
console.info(`image.inserted`);
|
|
1062
|
+
return false;
|
|
1063
|
+
},
|
|
1064
|
+
'image.replaced': function ($img: any, response: any) {
|
|
1065
|
+
console.info(`image.replaced`);
|
|
1066
|
+
return false;
|
|
1067
|
+
},
|
|
1068
|
+
'image.beforePasteUpload': (e: any, images: any) => {
|
|
1069
|
+
function base64ToBlob(base64: any, mimeType: any) {
|
|
1070
|
+
mimeType = mimeType || ''; // 设置默认 MIME 类型
|
|
1071
|
+
var byteCharacters = atob(base64);
|
|
1072
|
+
var byteNumbers = new Array(byteCharacters.length);
|
|
1073
|
+
|
|
1074
|
+
for (var i = 0; i < byteCharacters.length; i++) {
|
|
1075
|
+
byteNumbers[i] = byteCharacters.charCodeAt(i);
|
|
1076
|
+
}
|
|
1085
1077
|
|
|
1086
|
-
|
|
1087
|
-
glitter.share.wait_up_f.push({
|
|
1088
|
-
file: new File([blob], gvc.glitter.getUUID() + '.jpeg', { type: mimeType }),
|
|
1089
|
-
element: e,
|
|
1090
|
-
});
|
|
1091
|
-
clearInterval(glitter.share.wait_up_f_timer);
|
|
1092
|
-
glitter.share.wait_up_f_timer = setTimeout(() => {
|
|
1093
|
-
const dialog = new ShareDialog(obj.gvc.glitter);
|
|
1094
|
-
dialog.dataLoading({ visible: true });
|
|
1095
|
-
saasConfig.api
|
|
1096
|
-
.uploadFileAll(
|
|
1097
|
-
glitter.share.wait_up_f.map((dd: any) => {
|
|
1098
|
-
return dd.file;
|
|
1099
|
-
})
|
|
1100
|
-
)
|
|
1101
|
-
.then((res: { result: boolean; links: string[] }) => {
|
|
1102
|
-
dialog.dataLoading({ visible: false });
|
|
1103
|
-
glitter.share.wait_up_f.map((dd: any, index: number) => {
|
|
1104
|
-
dd.element.src = res.links[index];
|
|
1105
|
-
});
|
|
1106
|
-
glitter.share.wait_up_f = [];
|
|
1107
|
-
});
|
|
1108
|
-
}, 100);
|
|
1078
|
+
var byteArray = new Uint8Array(byteNumbers);
|
|
1109
1079
|
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
},
|
|
1113
|
-
'image.beforeUpload': function (e: any, images: any) {
|
|
1114
|
-
EditorElem.uploadFileFunction({
|
|
1115
|
-
gvc: gvc,
|
|
1116
|
-
callback: (text) => {
|
|
1117
|
-
editor.html.insert(`<img${text}">`);
|
|
1118
|
-
},
|
|
1119
|
-
file: e[0],
|
|
1120
|
-
});
|
|
1121
|
-
return false;
|
|
1122
|
-
},
|
|
1123
|
-
},
|
|
1124
|
-
key: 'hWA2C-7I2B2C4B3E4E2G3wd1DBKSPF1WKTUCQOa1OURPJ1KDe2F-11D2C2D2D2C3B3C1D6B1C2==',
|
|
1125
|
-
});
|
|
1126
|
-
|
|
1127
|
-
if (glitter.document.querySelector(`.${richID}-loading`) as any) {
|
|
1128
|
-
(glitter.document.querySelector(`.${richID}-loading`) as any).remove();
|
|
1129
|
-
}
|
|
1080
|
+
return new Blob([byteArray], { type: mimeType });
|
|
1081
|
+
}
|
|
1130
1082
|
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1083
|
+
const mimeType = 'image/jpeg';
|
|
1084
|
+
const blob = base64ToBlob(e.src.split(',')[1], mimeType);
|
|
1085
|
+
const saasConfig: { config: any; api: any } = (window as any).saasConfig;
|
|
1086
|
+
|
|
1087
|
+
glitter.share.wait_up_f = glitter.share.wait_up_f ?? [];
|
|
1088
|
+
glitter.share.wait_up_f.push({
|
|
1089
|
+
file: new File([blob], gvc.glitter.getUUID() + '.jpeg', { type: mimeType }),
|
|
1090
|
+
element: e,
|
|
1091
|
+
});
|
|
1092
|
+
clearInterval(glitter.share.wait_up_f_timer);
|
|
1093
|
+
glitter.share.wait_up_f_timer = setTimeout(() => {
|
|
1094
|
+
const dialog = new ShareDialog(obj.gvc.glitter);
|
|
1095
|
+
dialog.dataLoading({ visible: true });
|
|
1096
|
+
saasConfig.api
|
|
1097
|
+
.uploadFileAll(
|
|
1098
|
+
glitter.share.wait_up_f.map((dd: any) => {
|
|
1099
|
+
return dd.file;
|
|
1100
|
+
})
|
|
1101
|
+
)
|
|
1102
|
+
.then((res: { result: boolean; links: string[] }) => {
|
|
1103
|
+
dialog.dataLoading({ visible: false });
|
|
1104
|
+
glitter.share.wait_up_f.map((dd: any, index: number) => {
|
|
1105
|
+
dd.element.src = res.links[index];
|
|
1106
|
+
});
|
|
1107
|
+
glitter.share.wait_up_f = [];
|
|
1108
|
+
});
|
|
1109
|
+
}, 100);
|
|
1110
|
+
|
|
1111
|
+
e.src = '';
|
|
1112
|
+
return false;
|
|
1113
|
+
},
|
|
1114
|
+
'image.beforeUpload': function (e: any, images: any) {
|
|
1115
|
+
EditorElem.uploadFileFunction({
|
|
1116
|
+
gvc: gvc,
|
|
1117
|
+
callback: (text) => {
|
|
1118
|
+
editor.html.insert(`<img${text}">`);
|
|
1119
|
+
},
|
|
1120
|
+
file: e[0],
|
|
1121
|
+
});
|
|
1122
|
+
return false;
|
|
1123
|
+
},
|
|
1124
|
+
},
|
|
1125
|
+
key: 'hWA2C-7I2B2C4B3E4E2G3wd1DBKSPF1WKTUCQOa1OURPJ1KDe2F-11D2C2D2D2C3B3C1D6B1C2==',
|
|
1126
|
+
});
|
|
1127
|
+
|
|
1128
|
+
if (glitter.document.querySelector(`.${richID}-loading`) as any) {
|
|
1129
|
+
(glitter.document.querySelector(`.${richID}-loading`) as any).remove();
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
setTimeout(() => {
|
|
1133
|
+
const target: any = glitter.document.querySelector(`[data-cmd="insertImage"]`);
|
|
1134
|
+
if(!target){
|
|
1135
|
+
try {
|
|
1136
|
+
editor.destroy()
|
|
1137
|
+
}catch (e) {
|
|
1138
|
+
|
|
1139
|
+
}
|
|
1140
|
+
render()
|
|
1141
|
+
return
|
|
1142
|
+
}
|
|
1143
|
+
target.outerHTML = html` <button
|
|
1134
1144
|
id="insertImage-replace"
|
|
1135
1145
|
type="button"
|
|
1136
1146
|
tabindex="-1"
|
|
@@ -1138,43 +1148,43 @@ ${obj.structEnd ? obj.structEnd : '})()'}`,
|
|
|
1138
1148
|
class="fr-command fr-btn "
|
|
1139
1149
|
data-title="插入圖片 (⌘P)"
|
|
1140
1150
|
onclick="${obj.gvc.event(() => {
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1151
|
+
if (obj.insertImageEvent) {
|
|
1152
|
+
obj.insertImageEvent(editor);
|
|
1153
|
+
} else {
|
|
1154
|
+
glitter.ut.chooseMediaCallback({
|
|
1155
|
+
single: true,
|
|
1156
|
+
accept: 'image/*',
|
|
1157
|
+
callback(data) {
|
|
1158
|
+
const saasConfig = (window as any).saasConfig;
|
|
1159
|
+
const dialog = new ShareDialog(glitter);
|
|
1160
|
+
dialog.dataLoading({ visible: true });
|
|
1161
|
+
const file = data[0].file;
|
|
1162
|
+
saasConfig.api.uploadFile(file.name).then((data: any) => {
|
|
1163
|
+
dialog.dataLoading({ visible: false });
|
|
1164
|
+
const data1 = data.response;
|
|
1165
|
+
dialog.dataLoading({ visible: true });
|
|
1166
|
+
BaseApi.create({
|
|
1167
|
+
url: data1.url,
|
|
1168
|
+
type: 'put',
|
|
1169
|
+
data: file,
|
|
1170
|
+
headers: {
|
|
1171
|
+
'Content-Type': data1.type,
|
|
1172
|
+
},
|
|
1173
|
+
}).then((res) => {
|
|
1174
|
+
dialog.dataLoading({ visible: false });
|
|
1175
|
+
if (res.result) {
|
|
1176
|
+
const imgElement = html`<img src="${data1.fullUrl}" style="max-width: 100%;" />`;
|
|
1177
|
+
editor.html.insert(imgElement);
|
|
1178
|
+
editor.undo.saveStep();
|
|
1179
|
+
} else {
|
|
1180
|
+
dialog.errorMessage({ text: '上傳失敗' });
|
|
1181
|
+
}
|
|
1182
|
+
});
|
|
1183
|
+
});
|
|
1184
|
+
},
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1187
|
+
})}"
|
|
1178
1188
|
>
|
|
1179
1189
|
<svg class="fr-svg" focusable="false" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
1180
1190
|
<path
|
|
@@ -1183,21 +1193,23 @@ ${obj.structEnd ? obj.structEnd : '})()'}`,
|
|
|
1183
1193
|
</svg>
|
|
1184
1194
|
<span class="fr-sr-only">插入圖片</span>
|
|
1185
1195
|
</button>`;
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1196
|
+
if(obj.rich_height){
|
|
1197
|
+
glitter.document.querySelector(`#`+richID).querySelector(`.fr-view`).style.height=obj.rich_height;
|
|
1198
|
+
glitter.document.querySelector(`#`+richID).querySelector(`.fr-view`).style.minHeight='auto';
|
|
1199
|
+
glitter.document.querySelector(`#`+richID).querySelector(`.fr-view`).style.overflowY='auto';
|
|
1200
|
+
}
|
|
1191
1201
|
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1202
|
+
if (obj.readonly) {
|
|
1203
|
+
editor.edit.off();
|
|
1204
|
+
editor.toolbar.disable();
|
|
1205
|
+
}
|
|
1206
|
+
}, 200);
|
|
1207
|
+
}, 100);
|
|
1208
|
+
clearInterval(interval);
|
|
1209
|
+
}
|
|
1210
|
+
}, 100);
|
|
1211
|
+
}
|
|
1212
|
+
render()
|
|
1201
1213
|
},
|
|
1202
1214
|
};
|
|
1203
1215
|
});
|