@ones-editor/editor 0.0.7-beta.46 → 0.0.7-beta.49
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/dist/index.js
CHANGED
|
@@ -6804,7 +6804,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6804
6804
|
}
|
|
6805
6805
|
if (innerTextOrDataset) {
|
|
6806
6806
|
if (typeof innerTextOrDataset === "string") {
|
|
6807
|
-
elem.innerText = innerTextOrDataset;
|
|
6807
|
+
elem.innerText = innerTextOrDataset.replace(/\r/g, " ").replace(/\n/g, " ");
|
|
6808
6808
|
} else {
|
|
6809
6809
|
const dataset = innerTextOrDataset;
|
|
6810
6810
|
setDataset(elem, dataset);
|
|
@@ -70650,7 +70650,8 @@ ${data.flowchartText}
|
|
|
70650
70650
|
const zhCN$1 = {
|
|
70651
70651
|
media: {
|
|
70652
70652
|
upload: {
|
|
70653
|
-
failed: '<div class="line-1">{name}\u4E0A\u4F20\u5931\u8D25</div><div class="line-2">\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5 <span class="retry-upload">\u91CD\u8BD5</span></div>'
|
|
70653
|
+
failed: '<div class="line-1">{name}\u4E0A\u4F20\u5931\u8D25</div><div class="line-2">\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5 <span class="retry-upload">\u91CD\u8BD5</span></div>',
|
|
70654
|
+
maxSizeFailed: '<div class="line-1">{name}\u4E0A\u4F20\u5931\u8D25</div><div class="line-2">\u6587\u4EF6\u5927\u5C0F\u8D85\u8FC7\u300C{size}\u300D\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6</div>'
|
|
70654
70655
|
},
|
|
70655
70656
|
load: {
|
|
70656
70657
|
failed: '<div class="line-1">{name}\u52A0\u8F7D\u5931\u8D25</div><div class="line-2">\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5 <span class="retry-upload">\u91CD\u8BD5</span></div>'
|
|
@@ -70668,7 +70669,8 @@ ${data.flowchartText}
|
|
|
70668
70669
|
const enUS$1 = {
|
|
70669
70670
|
media: {
|
|
70670
70671
|
upload: {
|
|
70671
|
-
failed: '<div class="line-1">{name} upload failed</div><div class="line-2">Network error, you can <span class="retry-upload">Retry</span></div>'
|
|
70672
|
+
failed: '<div class="line-1">{name} upload failed</div><div class="line-2">Network error, you can <span class="retry-upload">Retry</span></div>',
|
|
70673
|
+
maxSizeFailed: '<div class="line-1">{name} upload failed</div><div class="line-2">The file size exceeds [{size}]. Please choose another file.'
|
|
70672
70674
|
},
|
|
70673
70675
|
load: {
|
|
70674
70676
|
failed: '<div class="line-1">{name} loading failed</div><div class="line-2">Network error, you can <span class="retry-upload">Retry</span></div>'
|
|
@@ -70686,7 +70688,8 @@ ${data.flowchartText}
|
|
|
70686
70688
|
const jaJP$1 = {
|
|
70687
70689
|
media: {
|
|
70688
70690
|
upload: {
|
|
70689
|
-
failed: '<div class="line-1">{name}\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F</div><div class="line-2">\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 <span class="retry-upload">\u518D\u8A66\u884C</span></div>'
|
|
70691
|
+
failed: '<div class="line-1">{name}\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F</div><div class="line-2">\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 <span class="retry-upload">\u518D\u8A66\u884C</span></div>',
|
|
70692
|
+
maxSizeFailed: '<div class="line-1">{name}\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F</div><div class="line-2">\u30D5\u30A1\u30A4\u30EB\u306E\u30B5\u30A4\u30BA\u304C\u300C{size}\u300D\u3092\u8D85\u3048\u3066\u3044\u308B\u305F\u3081\u3001\u4ED6\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044</div>'
|
|
70690
70693
|
},
|
|
70691
70694
|
load: {
|
|
70692
70695
|
failed: '<div class="line-1">{name}\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F</div><div class="line-2">\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 <span class="retry-upload">\u518D\u8A66\u884C</span></div>'
|
|
@@ -70780,6 +70783,18 @@ ${data.flowchartText}
|
|
|
70780
70783
|
return src === ReservedMediaSrcType.Empty || src === ReservedMediaSrcType.Error;
|
|
70781
70784
|
}
|
|
70782
70785
|
const logger$5 = getLogger("media");
|
|
70786
|
+
function formatFileSize(num, digits = 2) {
|
|
70787
|
+
if (num < 1024) {
|
|
70788
|
+
return `${num}B`;
|
|
70789
|
+
}
|
|
70790
|
+
if (num < 1024 * 1024) {
|
|
70791
|
+
return `${(num / 1024).toFixed(digits)}KB`;
|
|
70792
|
+
}
|
|
70793
|
+
if (num < 1024 * 1024 * 1024) {
|
|
70794
|
+
return `${(num / (1024 * 1024)).toFixed(digits)}MB`;
|
|
70795
|
+
}
|
|
70796
|
+
return `${(num / (1024 * 1024 * 1024)).toFixed(digits)}GB`;
|
|
70797
|
+
}
|
|
70783
70798
|
class Media extends tinyTypedEmitter.TypedEmitter {
|
|
70784
70799
|
constructor(options) {
|
|
70785
70800
|
super();
|
|
@@ -70833,7 +70848,7 @@ ${data.flowchartText}
|
|
|
70833
70848
|
} catch (e2) {
|
|
70834
70849
|
logger$5.error(e2);
|
|
70835
70850
|
this.emit("mediaError", editor, "upload_error", oldBlockData.id);
|
|
70836
|
-
this.renderRetry(file2);
|
|
70851
|
+
this.renderRetry(file2, e2);
|
|
70837
70852
|
}
|
|
70838
70853
|
removeClass(block, "media-block-uploading");
|
|
70839
70854
|
});
|
|
@@ -70888,7 +70903,8 @@ ${data.flowchartText}
|
|
|
70888
70903
|
this.setFullScreen();
|
|
70889
70904
|
return errorContainer;
|
|
70890
70905
|
}
|
|
70891
|
-
renderRetry(file2) {
|
|
70906
|
+
renderRetry(file2, error2) {
|
|
70907
|
+
var _a, _b, _c;
|
|
70892
70908
|
assert(logger$5, this.abstract, "no abstract");
|
|
70893
70909
|
const { editor } = this.options;
|
|
70894
70910
|
const { mediaIcon, mediaName } = this.abstract;
|
|
@@ -70896,16 +70912,27 @@ ${data.flowchartText}
|
|
|
70896
70912
|
const icon = createElement("span", ["media-error-icon"], retry);
|
|
70897
70913
|
icon.innerHTML = mediaIcon;
|
|
70898
70914
|
const errorDetail = createElement("div", [], retry);
|
|
70899
|
-
|
|
70915
|
+
let html = i18n$1.t("media.upload.failed", { name: mediaName });
|
|
70916
|
+
if (((_a = error2.response) == null ? void 0 : _a.status) === 420) {
|
|
70917
|
+
const message = (_c = (_b = error2.response) == null ? void 0 : _b.data) == null ? void 0 : _c.message[0];
|
|
70918
|
+
const fileSizeMatch = message.match(/(\d+)/);
|
|
70919
|
+
if (fileSizeMatch) {
|
|
70920
|
+
const fileSize = Number.parseInt(fileSizeMatch[1], 10);
|
|
70921
|
+
const formattedSize = formatFileSize(fileSize, 0);
|
|
70922
|
+
html = i18n$1.t("media.upload.maxSizeFailed", { name: mediaName, size: formattedSize });
|
|
70923
|
+
}
|
|
70924
|
+
}
|
|
70925
|
+
errorDetail.innerHTML = html;
|
|
70900
70926
|
retry.appendChild(errorDetail);
|
|
70901
70927
|
const action = errorDetail.querySelector(".retry-upload");
|
|
70902
|
-
|
|
70903
|
-
|
|
70904
|
-
|
|
70905
|
-
|
|
70906
|
-
|
|
70907
|
-
|
|
70908
|
-
|
|
70928
|
+
if (action) {
|
|
70929
|
+
editor.domEvents.addEventListener(action, "click", () => {
|
|
70930
|
+
if (editor.readonly)
|
|
70931
|
+
return;
|
|
70932
|
+
assert(logger$5, this.abstract, "no abstract");
|
|
70933
|
+
this.handleUploadFile(file2);
|
|
70934
|
+
});
|
|
70935
|
+
}
|
|
70909
70936
|
this.updateMediaContent(retry);
|
|
70910
70937
|
this.setFullScreen();
|
|
70911
70938
|
}
|