@ones-editor/editor 2.2.0-beta.2 → 2.2.0-beta.3
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/@ones-editor/block-resizer/src/index.d.ts +1 -1
- package/@ones-editor/core/src/core/composition/editor-input.d.ts +1 -1
- package/@ones-editor/core/src/core/input-handler/input-handler.d.ts +1 -2
- package/@ones-editor/core/src/core/types.d.ts +0 -1
- package/@ones-editor/image-embed/src/image-data.d.ts +4 -1
- package/@ones-editor/image-embed/src/image-object.d.ts +2 -1
- package/@ones-editor/image-embed/src/types.d.ts +2 -1
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/dist/index.js +175 -55
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6096,9 +6096,6 @@ div[data-command-bar-id=mobile-bottom-menu] .mobile-menu-wrap.editor-mention .co
|
|
|
6096
6096
|
flex: 1;
|
|
6097
6097
|
min-width: 0;
|
|
6098
6098
|
}
|
|
6099
|
-
.editor-root [data-type=editor-container].root div[data-type=editor-block].callout-block .callout-root .callout-content > .child {
|
|
6100
|
-
padding: 0;
|
|
6101
|
-
}
|
|
6102
6099
|
.editor-root [data-type=editor-container].root div[data-type=editor-block].callout-block .callout-root .callout-content div[data-type=editor-block].list-block > div.list-container,
|
|
6103
6100
|
.editor-root [data-type=editor-container].root div[data-type=editor-block].callout-block .callout-root .callout-content div[data-type=editor-block].list-block > div[data-type=block-content] {
|
|
6104
6101
|
background-color: transparent;
|
|
@@ -24714,7 +24711,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24714
24711
|
__publicField(this, "composing", false);
|
|
24715
24712
|
__publicField(this, "callbacks");
|
|
24716
24713
|
__publicField(this, "inputElement");
|
|
24717
|
-
__publicField(this, "
|
|
24714
|
+
__publicField(this, "handleWindowBlur", () => {
|
|
24718
24715
|
this.editor.emit("blur", this.editor);
|
|
24719
24716
|
this.callbacks.onBlur();
|
|
24720
24717
|
});
|
|
@@ -24741,7 +24738,8 @@ var __publicField = (obj, key, value) => {
|
|
|
24741
24738
|
return;
|
|
24742
24739
|
}
|
|
24743
24740
|
setTimeout(() => {
|
|
24744
|
-
this.
|
|
24741
|
+
this.editor.emit("blur", this.editor);
|
|
24742
|
+
this.callbacks.onBlur();
|
|
24745
24743
|
});
|
|
24746
24744
|
});
|
|
24747
24745
|
__publicField(this, "handleDocumentSelectionChange", () => {
|
|
@@ -24756,7 +24754,8 @@ var __publicField = (obj, key, value) => {
|
|
|
24756
24754
|
return;
|
|
24757
24755
|
}
|
|
24758
24756
|
}
|
|
24759
|
-
this.
|
|
24757
|
+
this.editor.emit("blur", this.editor);
|
|
24758
|
+
this.callbacks.onBlur();
|
|
24760
24759
|
}, 100);
|
|
24761
24760
|
});
|
|
24762
24761
|
__publicField(this, "handleEditorSelectionChanged", () => {
|
|
@@ -24870,7 +24869,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24870
24869
|
document.addEventListener("selectionchange", this.handleDocumentSelectionChange);
|
|
24871
24870
|
this.editor.addListener("selectionChanged", this.handleEditorSelectionChanged);
|
|
24872
24871
|
this.editor.addListener("readonlyChanged", this.handleReadonlyChanged);
|
|
24873
|
-
window.addEventListener("blur", this.
|
|
24872
|
+
window.addEventListener("blur", this.handleWindowBlur);
|
|
24874
24873
|
window.addEventListener("focus", this.handleWindowFocus);
|
|
24875
24874
|
}
|
|
24876
24875
|
isInCommandBar(target) {
|
|
@@ -24900,7 +24899,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24900
24899
|
input2.oninput = null;
|
|
24901
24900
|
input2.oncopy = null;
|
|
24902
24901
|
document.removeEventListener("paste", this.handlePaste);
|
|
24903
|
-
window.removeEventListener("blur", this.
|
|
24902
|
+
window.removeEventListener("blur", this.handleWindowBlur);
|
|
24904
24903
|
window.removeEventListener("focus", this.handleWindowFocus);
|
|
24905
24904
|
input2.oncut = null;
|
|
24906
24905
|
}
|
|
@@ -28302,16 +28301,7 @@ ${codeText}
|
|
|
28302
28301
|
this.pasteDocs(docs, null, files);
|
|
28303
28302
|
}
|
|
28304
28303
|
});
|
|
28305
|
-
__publicField(this, "onBlur", () => {
|
|
28306
|
-
var _a;
|
|
28307
|
-
for (const handler of this.handlers) {
|
|
28308
|
-
if ((_a = handler.handleBlur) == null ? void 0 : _a.call(handler, this.editor)) {
|
|
28309
|
-
return;
|
|
28310
|
-
}
|
|
28311
|
-
}
|
|
28312
|
-
this.debounceBlur();
|
|
28313
|
-
});
|
|
28314
|
-
__publicField(this, "debounceBlur", debounce__default.default(() => {
|
|
28304
|
+
__publicField(this, "onBlur", debounce__default.default(() => {
|
|
28315
28305
|
const range = this.editor.selection.range;
|
|
28316
28306
|
if (!range.isCollapsed()) {
|
|
28317
28307
|
let block = null;
|
|
@@ -28446,7 +28436,7 @@ ${codeText}
|
|
|
28446
28436
|
}
|
|
28447
28437
|
onFocus() {
|
|
28448
28438
|
addClass(this.editor.rootElement, "active");
|
|
28449
|
-
this.
|
|
28439
|
+
this.onBlur.cancel();
|
|
28450
28440
|
this.removeActiveForBlur.cancel();
|
|
28451
28441
|
}
|
|
28452
28442
|
addHandler(handler) {
|
|
@@ -59921,6 +59911,9 @@ $$${mathData.mathjaxText}$$
|
|
|
59921
59911
|
md5Cache.set(src, key);
|
|
59922
59912
|
return `${key}_width`;
|
|
59923
59913
|
}
|
|
59914
|
+
function getImageWidthRealKey(widthKey) {
|
|
59915
|
+
return `${widthKey}_r`;
|
|
59916
|
+
}
|
|
59924
59917
|
function getImageHeightKeyFromSrc(src) {
|
|
59925
59918
|
if (md5Cache.has(src)) {
|
|
59926
59919
|
const key2 = md5Cache.get(src);
|
|
@@ -59963,9 +59956,11 @@ $$${mathData.mathjaxText}$$
|
|
|
59963
59956
|
src2 = `empty:${index2}`;
|
|
59964
59957
|
}
|
|
59965
59958
|
const widthKey = getImageWidthKeyFromSrc(src2);
|
|
59959
|
+
const widthRealKey = getImageWidthRealKey(widthKey);
|
|
59966
59960
|
const heightKey = getImageHeightKeyFromSrc(src2);
|
|
59967
59961
|
const flexKey = getImageFlexKeyFromSrc(index2);
|
|
59968
59962
|
let width = data2[widthKey];
|
|
59963
|
+
const widthReal = data2[widthRealKey];
|
|
59969
59964
|
let height = data2[heightKey];
|
|
59970
59965
|
let flex = data2[flexKey];
|
|
59971
59966
|
if (typeof width === "string") {
|
|
@@ -59977,7 +59972,11 @@ $$${mathData.mathjaxText}$$
|
|
|
59977
59972
|
if (typeof flex === "string") {
|
|
59978
59973
|
flex = Number.parseInt(flex, 10);
|
|
59979
59974
|
}
|
|
59980
|
-
|
|
59975
|
+
const result = { src: src2, width: width != null ? width : "auto", height: height != null ? height : "auto", flex, virtualSize: !width || !height };
|
|
59976
|
+
if (widthReal) {
|
|
59977
|
+
result.widthReal = widthReal;
|
|
59978
|
+
}
|
|
59979
|
+
return result;
|
|
59981
59980
|
};
|
|
59982
59981
|
let images = [];
|
|
59983
59982
|
const src = data2.src;
|
|
@@ -59998,6 +59997,52 @@ $$${mathData.mathjaxText}$$
|
|
|
59998
59997
|
}
|
|
59999
59998
|
return imageData.widthPercent;
|
|
60000
59999
|
}
|
|
60000
|
+
function getWidthReal(blockData) {
|
|
60001
|
+
const images = getImages$1(blockData.embedData);
|
|
60002
|
+
if (images.length > 1) {
|
|
60003
|
+
return void 0;
|
|
60004
|
+
}
|
|
60005
|
+
const image = images[0];
|
|
60006
|
+
return image.widthReal;
|
|
60007
|
+
}
|
|
60008
|
+
function clearWidthReal(imageData) {
|
|
60009
|
+
const keys = Object.keys(imageData);
|
|
60010
|
+
keys.forEach((key) => {
|
|
60011
|
+
if (key.endsWith("_r")) {
|
|
60012
|
+
delete imageData[key];
|
|
60013
|
+
}
|
|
60014
|
+
});
|
|
60015
|
+
}
|
|
60016
|
+
function setWidthPercentAndWidthReal(blockData, widthPercent, widthReal) {
|
|
60017
|
+
const imageData = blockData.embedData;
|
|
60018
|
+
imageData.widthPercent = widthPercent;
|
|
60019
|
+
const images = getImages$1(blockData.embedData);
|
|
60020
|
+
clearWidthReal(blockData.embedData);
|
|
60021
|
+
if (images.length > 1) {
|
|
60022
|
+
return;
|
|
60023
|
+
}
|
|
60024
|
+
const image = images[0];
|
|
60025
|
+
const widthKey = getImageWidthKeyFromSrc(image.src);
|
|
60026
|
+
const widthRealKey = getImageWidthRealKey(widthKey);
|
|
60027
|
+
if (widthReal) {
|
|
60028
|
+
imageData[widthRealKey] = widthReal;
|
|
60029
|
+
} else if (isValidSize(image.width)) {
|
|
60030
|
+
imageData[widthRealKey] = image.width;
|
|
60031
|
+
}
|
|
60032
|
+
}
|
|
60033
|
+
function getHeightReal(blockData, containerElement) {
|
|
60034
|
+
const images = getImages$1(blockData.embedData);
|
|
60035
|
+
if (images.length > 1) {
|
|
60036
|
+
return void 0;
|
|
60037
|
+
}
|
|
60038
|
+
let containerWidth = containerElement.getBoundingClientRect().width;
|
|
60039
|
+
containerWidth -= Number.parseFloat(window.getComputedStyle(containerElement).paddingLeft) + Number.parseFloat(window.getComputedStyle(containerElement).paddingRight);
|
|
60040
|
+
const image = images[0];
|
|
60041
|
+
if (image.widthReal && image.width && image.width !== "auto" && image.height && image.height !== "auto") {
|
|
60042
|
+
return Math.min(image.widthReal, containerWidth) * image.height / image.width;
|
|
60043
|
+
}
|
|
60044
|
+
return void 0;
|
|
60045
|
+
}
|
|
60001
60046
|
function calImageBlockStyleWidth(editor, blockData, parentContainerElement, failedLoad) {
|
|
60002
60047
|
const images = getImages$1(blockData.embedData);
|
|
60003
60048
|
if (images.length > 1) {
|
|
@@ -60006,26 +60051,33 @@ $$${mathData.mathjaxText}$$
|
|
|
60006
60051
|
if (failedLoad) {
|
|
60007
60052
|
return "100%";
|
|
60008
60053
|
}
|
|
60054
|
+
const widthReal = getWidthReal(blockData);
|
|
60055
|
+
if (widthReal) {
|
|
60056
|
+
return `${widthReal}px`;
|
|
60057
|
+
}
|
|
60058
|
+
const image = images[0];
|
|
60009
60059
|
const percent = getWidthPercent(blockData);
|
|
60010
60060
|
const totalWidth = editor.rootContainer.getBoundingClientRect().width;
|
|
60011
60061
|
if (percent) {
|
|
60012
60062
|
const parentWidth = getContainerContentWidth(parentContainerElement);
|
|
60013
60063
|
return `${Math.min(totalWidth * percent / 100, parentWidth)}px`;
|
|
60014
60064
|
}
|
|
60015
|
-
if (isValidSize(
|
|
60016
|
-
return `${
|
|
60065
|
+
if (isValidSize(image.width)) {
|
|
60066
|
+
return `${image.width}px`;
|
|
60017
60067
|
}
|
|
60018
60068
|
return "auto";
|
|
60019
60069
|
}
|
|
60020
|
-
function toImageEmbedData(images, widthPercent) {
|
|
60070
|
+
function toImageEmbedData(editor, images, widthPercent) {
|
|
60021
60071
|
const src = images.map((image) => image.src).join("|");
|
|
60022
60072
|
const result = {
|
|
60023
60073
|
src,
|
|
60024
60074
|
widthPercent
|
|
60025
60075
|
};
|
|
60076
|
+
const editorWidth = editor.rootContainer.clientWidth;
|
|
60026
60077
|
images.forEach((image, index2) => {
|
|
60027
60078
|
const src2 = image.src || `empty:${index2}`;
|
|
60028
60079
|
const widthKey = getImageWidthKeyFromSrc(src2);
|
|
60080
|
+
const widthRealKey = getImageWidthRealKey(widthKey);
|
|
60029
60081
|
if (widthKey && isValidSize(image.width)) {
|
|
60030
60082
|
result[widthKey] = image.width;
|
|
60031
60083
|
}
|
|
@@ -60036,6 +60088,12 @@ $$${mathData.mathjaxText}$$
|
|
|
60036
60088
|
assert(logger$1z, image.flex, "no image flex");
|
|
60037
60089
|
const flexKey = getImageFlexKeyFromSrc(index2);
|
|
60038
60090
|
result[flexKey] = image.flex;
|
|
60091
|
+
if (widthKey && images.length === 1) {
|
|
60092
|
+
if (widthPercent && image.width !== "auto") {
|
|
60093
|
+
const widthReal = widthPercent === 100 ? image.width : editorWidth * widthPercent / 100;
|
|
60094
|
+
result[widthRealKey] = widthReal;
|
|
60095
|
+
}
|
|
60096
|
+
}
|
|
60039
60097
|
});
|
|
60040
60098
|
return result;
|
|
60041
60099
|
}
|
|
@@ -60060,7 +60118,8 @@ $$${mathData.mathjaxText}$$
|
|
|
60060
60118
|
const imageHeight = image.height;
|
|
60061
60119
|
return imageHeight === "auto" ? "auto" : `${imageHeight}px`;
|
|
60062
60120
|
}
|
|
60063
|
-
|
|
60121
|
+
const containerWidth = parentContainer.getBoundingClientRect().width;
|
|
60122
|
+
let totalWidth = containerWidth * (widthPercent / 100);
|
|
60064
60123
|
totalWidth -= Number.parseFloat(window.getComputedStyle(parentContainer).paddingLeft) + Number.parseFloat(window.getComputedStyle(parentContainer).paddingRight);
|
|
60065
60124
|
if (parentContainer === editor.rootContainer && parentContainer !== parentContainerElement) {
|
|
60066
60125
|
totalWidth = Math.min(totalWidth, getContainerContentWidth(parentContainerElement));
|
|
@@ -60070,6 +60129,10 @@ $$${mathData.mathjaxText}$$
|
|
|
60070
60129
|
if (image.virtualSize) {
|
|
60071
60130
|
return "";
|
|
60072
60131
|
}
|
|
60132
|
+
const heightReal = getHeightReal(imageData, parentContainerElement);
|
|
60133
|
+
if (heightReal) {
|
|
60134
|
+
return `${heightReal}px`;
|
|
60135
|
+
}
|
|
60073
60136
|
const width = image.width === "auto" ? DEFAULT_WIDTH$1 : image.width;
|
|
60074
60137
|
const imageHeight = image.height / (width / totalWidth);
|
|
60075
60138
|
return `${imageHeight}px`;
|
|
@@ -60231,7 +60294,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60231
60294
|
}
|
|
60232
60295
|
setDefaultCursor("");
|
|
60233
60296
|
this.unbindEvents();
|
|
60234
|
-
this.emit("resized", this);
|
|
60297
|
+
this.emit("resized", this, event);
|
|
60235
60298
|
const element = this.getResizableElement();
|
|
60236
60299
|
if (!element || !this.block) {
|
|
60237
60300
|
return;
|
|
@@ -60430,7 +60493,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60430
60493
|
}
|
|
60431
60494
|
const block = this.data.block;
|
|
60432
60495
|
const imageObject = getImageObject(this.editor, block);
|
|
60433
|
-
imageObject.
|
|
60496
|
+
imageObject.setDisableResizing(true);
|
|
60434
60497
|
}
|
|
60435
60498
|
onDragging(drag, event, elem, deltaX, deltaY) {
|
|
60436
60499
|
const block = this.data.block;
|
|
@@ -60464,7 +60527,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60464
60527
|
imageContainers[i].style.flexGrow = `${flex}`;
|
|
60465
60528
|
}
|
|
60466
60529
|
const blockData = cloneDeep__default.default(this.editor.getBlockData(block));
|
|
60467
|
-
const embedData = toImageEmbedData(images, getWidthPercent(blockData));
|
|
60530
|
+
const embedData = toImageEmbedData(this.editor, images, getWidthPercent(blockData));
|
|
60468
60531
|
blockData.embedData = embedData;
|
|
60469
60532
|
updateImageBlockSize(this.editor, blockData, block, null);
|
|
60470
60533
|
}
|
|
@@ -60477,7 +60540,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60477
60540
|
return flex2;
|
|
60478
60541
|
});
|
|
60479
60542
|
imageObject.updateFlex(flex);
|
|
60480
|
-
imageObject.
|
|
60543
|
+
imageObject.setDisableResizing(false);
|
|
60481
60544
|
}
|
|
60482
60545
|
}
|
|
60483
60546
|
function getParentImageSplitter(eventTarget) {
|
|
@@ -60837,6 +60900,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60837
60900
|
__publicField(this, "images", []);
|
|
60838
60901
|
__publicField(this, "selectedIndex", -1);
|
|
60839
60902
|
__publicField(this, "blockResizer");
|
|
60903
|
+
__publicField(this, "disableResizing", false);
|
|
60840
60904
|
__publicField(this, "resizing", false);
|
|
60841
60905
|
__publicField(this, "parentContainerResizerObserver", null);
|
|
60842
60906
|
__publicField(this, "autoFix", false);
|
|
@@ -60860,7 +60924,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60860
60924
|
if (this.isEmpty()) {
|
|
60861
60925
|
return;
|
|
60862
60926
|
}
|
|
60863
|
-
if (this.
|
|
60927
|
+
if (this.disableResizing) {
|
|
60864
60928
|
return;
|
|
60865
60929
|
}
|
|
60866
60930
|
const block = this.editor.findBlockById(this.blockData.id);
|
|
@@ -60868,7 +60932,28 @@ $$${mathData.mathjaxText}$$
|
|
|
60868
60932
|
return;
|
|
60869
60933
|
}
|
|
60870
60934
|
if (getParentContainer(block) === container) {
|
|
60871
|
-
|
|
60935
|
+
const resizeObj = block.resizeObj || [];
|
|
60936
|
+
const rect = container.getBoundingClientRect();
|
|
60937
|
+
const now = Date.now();
|
|
60938
|
+
let found = false;
|
|
60939
|
+
for (let i = resizeObj.length - 1; i >= 0; i--) {
|
|
60940
|
+
if (now - resizeObj[i].time > 200) {
|
|
60941
|
+
resizeObj.splice(i, 1);
|
|
60942
|
+
continue;
|
|
60943
|
+
}
|
|
60944
|
+
if (rect.width === resizeObj[i].width) {
|
|
60945
|
+
found = true;
|
|
60946
|
+
break;
|
|
60947
|
+
}
|
|
60948
|
+
}
|
|
60949
|
+
resizeObj.push({
|
|
60950
|
+
time: now,
|
|
60951
|
+
width: rect.width
|
|
60952
|
+
});
|
|
60953
|
+
block.resizeObj = resizeObj;
|
|
60954
|
+
if (!found) {
|
|
60955
|
+
updateImageBlockSize(this.editor, this.blockData, block, null);
|
|
60956
|
+
}
|
|
60872
60957
|
}
|
|
60873
60958
|
});
|
|
60874
60959
|
__publicField(this, "handleResizing", (resizer, rect) => {
|
|
@@ -60876,6 +60961,8 @@ $$${mathData.mathjaxText}$$
|
|
|
60876
60961
|
if (!block) {
|
|
60877
60962
|
return;
|
|
60878
60963
|
}
|
|
60964
|
+
this.resizing = true;
|
|
60965
|
+
window.isDragging = true;
|
|
60879
60966
|
if (!this.autoFix) {
|
|
60880
60967
|
this.setAutoFix(true);
|
|
60881
60968
|
}
|
|
@@ -60888,25 +60975,42 @@ $$${mathData.mathjaxText}$$
|
|
|
60888
60975
|
if (newWidth < 50) {
|
|
60889
60976
|
newWidth = 50;
|
|
60890
60977
|
}
|
|
60891
|
-
|
|
60892
|
-
|
|
60978
|
+
let widthPercent = newWidth * 100 / totalWidth;
|
|
60979
|
+
if (newWidth === blockRect.width) {
|
|
60980
|
+
widthPercent = 100;
|
|
60981
|
+
}
|
|
60982
|
+
const rootBlock = getRootBlock(block);
|
|
60983
|
+
if (getBlockType(rootBlock) !== "layout" && widthPercent === 100) {
|
|
60984
|
+
widthPercent = 99.99;
|
|
60985
|
+
}
|
|
60986
|
+
setWidthPercentAndWidthReal(this.blockData, widthPercent, newWidth);
|
|
60893
60987
|
updateImageBlockSize(this.editor, this.blockData, block, null);
|
|
60894
60988
|
});
|
|
60895
|
-
__publicField(this, "handleResized", () => {
|
|
60989
|
+
__publicField(this, "handleResized", (resizer, event) => {
|
|
60896
60990
|
const block = this.editor.findBlockById(this.blockData.id);
|
|
60897
60991
|
if (!block) {
|
|
60898
60992
|
return;
|
|
60899
60993
|
}
|
|
60900
|
-
|
|
60901
|
-
|
|
60994
|
+
this.resizing = false;
|
|
60995
|
+
window.isDragging = false;
|
|
60996
|
+
const rootBlock = getRootBlock(block);
|
|
60997
|
+
const widthPercent = getWidthPercent(this.blockData);
|
|
60998
|
+
const embedData = toImageEmbedData(this.editor, this.images, widthPercent);
|
|
60999
|
+
if (getBlockType(rootBlock) === "layout" && widthPercent === 100) {
|
|
61000
|
+
clearWidthReal(embedData);
|
|
61001
|
+
}
|
|
60902
61002
|
this.blockResizer.enableResize(block);
|
|
61003
|
+
if (!block.contains(event.target)) {
|
|
61004
|
+
this.disableResizer();
|
|
61005
|
+
}
|
|
61006
|
+
this.editor.updateEmbedData(block, embedData);
|
|
60903
61007
|
});
|
|
60904
61008
|
__publicField(this, "fixImageSizes", debounce__default.default(() => {
|
|
60905
61009
|
const block = this.editor.findBlockById(this.blockData.id);
|
|
60906
61010
|
if (!block) {
|
|
60907
61011
|
return;
|
|
60908
61012
|
}
|
|
60909
|
-
const embedData = toImageEmbedData(this.images, getWidthPercent(this.blockData));
|
|
61013
|
+
const embedData = toImageEmbedData(this.editor, this.images, getWidthPercent(this.blockData));
|
|
60910
61014
|
this.editor.updateEmbedData(block, embedData);
|
|
60911
61015
|
}, 1e3));
|
|
60912
61016
|
this.editor = editor;
|
|
@@ -60970,8 +61074,8 @@ $$${mathData.mathjaxText}$$
|
|
|
60970
61074
|
isEmpty() {
|
|
60971
61075
|
return this.images.length === 1 && isEmptyImage$1(this.images[0]);
|
|
60972
61076
|
}
|
|
60973
|
-
|
|
60974
|
-
this.
|
|
61077
|
+
setDisableResizing(disable) {
|
|
61078
|
+
this.disableResizing = disable;
|
|
60975
61079
|
}
|
|
60976
61080
|
getSelectedIndex() {
|
|
60977
61081
|
return this.selectedIndex;
|
|
@@ -61027,6 +61131,9 @@ $$${mathData.mathjaxText}$$
|
|
|
61027
61131
|
}
|
|
61028
61132
|
}
|
|
61029
61133
|
disableResizer() {
|
|
61134
|
+
if (this.resizing) {
|
|
61135
|
+
return;
|
|
61136
|
+
}
|
|
61030
61137
|
this.blockResizer.disableResize();
|
|
61031
61138
|
}
|
|
61032
61139
|
fixImageSize(index2, image) {
|
|
@@ -61064,7 +61171,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61064
61171
|
if (this.selectedIndex >= newImages.length) {
|
|
61065
61172
|
this.selectedIndex = newImages.length - 1;
|
|
61066
61173
|
}
|
|
61067
|
-
const embedData = toImageEmbedData(newImages, getWidthPercent(this.blockData));
|
|
61174
|
+
const embedData = toImageEmbedData(this.editor, newImages, getWidthPercent(this.blockData));
|
|
61068
61175
|
this.editor.updateEmbedData(block, embedData);
|
|
61069
61176
|
return true;
|
|
61070
61177
|
}
|
|
@@ -61083,7 +61190,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61083
61190
|
imageData.virtualSize = false;
|
|
61084
61191
|
this.images[0].flex = NaN;
|
|
61085
61192
|
calcImagesFlexIfNeeded(this.images);
|
|
61086
|
-
const embedData = toImageEmbedData(this.images, getWidthPercent(this.blockData));
|
|
61193
|
+
const embedData = toImageEmbedData(this.editor, this.images, getWidthPercent(this.blockData));
|
|
61087
61194
|
this.editor.updateEmbedData(block, embedData);
|
|
61088
61195
|
}
|
|
61089
61196
|
const newImageData = {
|
|
@@ -61118,7 +61225,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61118
61225
|
return false;
|
|
61119
61226
|
}
|
|
61120
61227
|
removeClass(block2, "media-block-uploading");
|
|
61121
|
-
const embedData = toImageEmbedData(this.images, getWidthPercent(this.blockData));
|
|
61228
|
+
const embedData = toImageEmbedData(this.editor, this.images, getWidthPercent(this.blockData));
|
|
61122
61229
|
this.editor.updateEmbedData(block2, embedData);
|
|
61123
61230
|
return true;
|
|
61124
61231
|
} catch (err) {
|
|
@@ -61143,7 +61250,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61143
61250
|
for (let i = 0; i < this.images.length; i++) {
|
|
61144
61251
|
this.images[i].flex = flex[i];
|
|
61145
61252
|
}
|
|
61146
|
-
const embedData = toImageEmbedData(this.images, getWidthPercent(this.blockData));
|
|
61253
|
+
const embedData = toImageEmbedData(this.editor, this.images, getWidthPercent(this.blockData));
|
|
61147
61254
|
this.editor.updateEmbedData(block, embedData);
|
|
61148
61255
|
}
|
|
61149
61256
|
resetFlex() {
|
|
@@ -61154,7 +61261,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61154
61261
|
const newImages = cloneDeep__default.default(this.images);
|
|
61155
61262
|
newImages[0].flex = NaN;
|
|
61156
61263
|
calcImagesFlexIfNeeded(newImages);
|
|
61157
|
-
const embedData = toImageEmbedData(newImages, getWidthPercent(this.blockData));
|
|
61264
|
+
const embedData = toImageEmbedData(this.editor, newImages, getWidthPercent(this.blockData));
|
|
61158
61265
|
this.editor.updateEmbedData(block, embedData);
|
|
61159
61266
|
}
|
|
61160
61267
|
setData(blockData) {
|
|
@@ -64281,13 +64388,13 @@ ${codeText}
|
|
|
64281
64388
|
const image = images[0];
|
|
64282
64389
|
const widthPercent = 100 * (image.flex / totalFlex);
|
|
64283
64390
|
image.flex = 1;
|
|
64284
|
-
const embedData2 = toImageEmbedData([image], widthPercent);
|
|
64391
|
+
const embedData2 = toImageEmbedData(editor, [image], widthPercent);
|
|
64285
64392
|
editor.updateEmbedData(block, embedData2);
|
|
64286
64393
|
return;
|
|
64287
64394
|
}
|
|
64288
64395
|
images[0].flex = NaN;
|
|
64289
64396
|
calcImagesFlexIfNeeded(images);
|
|
64290
|
-
const embedData = toImageEmbedData(images, imageObject.getWidthPercent());
|
|
64397
|
+
const embedData = toImageEmbedData(editor, images, imageObject.getWidthPercent());
|
|
64291
64398
|
editor.updateEmbedData(block, embedData);
|
|
64292
64399
|
}
|
|
64293
64400
|
function processInsertFilesToImage(editor, files, targetBlock, insertPos) {
|
|
@@ -64323,7 +64430,7 @@ ${codeText}
|
|
|
64323
64430
|
virtualSize: true
|
|
64324
64431
|
};
|
|
64325
64432
|
images.splice(insertIndex, 0, itemData);
|
|
64326
|
-
const embedData = toImageEmbedData(images, imageObject.getWidthPercent());
|
|
64433
|
+
const embedData = toImageEmbedData(editor, images, imageObject.getWidthPercent());
|
|
64327
64434
|
editor.updateEmbedData(targetBlock, embedData);
|
|
64328
64435
|
imageObject.replaceImage(insertIndex, file2);
|
|
64329
64436
|
insertIndex += 1;
|
|
@@ -64355,9 +64462,9 @@ ${codeText}
|
|
|
64355
64462
|
if (insertPos === "after") {
|
|
64356
64463
|
blockIndex += 1;
|
|
64357
64464
|
}
|
|
64358
|
-
const
|
|
64359
|
-
const widthPercent =
|
|
64360
|
-
const embedData = toImageEmbedData([draggedImage.image], widthPercent);
|
|
64465
|
+
const sourceData = editor.getBlockData(block);
|
|
64466
|
+
const widthPercent = sourceData.embedData.widthPercent;
|
|
64467
|
+
const embedData = toImageEmbedData(editor, [draggedImage.image], widthPercent);
|
|
64361
64468
|
const blockData = {
|
|
64362
64469
|
id: genId(),
|
|
64363
64470
|
type: "embed",
|
|
@@ -64402,7 +64509,7 @@ ${codeText}
|
|
|
64402
64509
|
images.splice(fromIndex, 1);
|
|
64403
64510
|
images.splice(toIndex, 0, image);
|
|
64404
64511
|
}
|
|
64405
|
-
const embedData = toImageEmbedData(images, imageObject.getWidthPercent());
|
|
64512
|
+
const embedData = toImageEmbedData(editor, images, imageObject.getWidthPercent());
|
|
64406
64513
|
editor.updateEmbedData(targetBlock, embedData);
|
|
64407
64514
|
imageObject.setSelectedIndex(resultIndex);
|
|
64408
64515
|
(_a2 = editor.findCustom("drag-handler")) == null ? void 0 : _a2.handleDragEnd();
|
|
@@ -64410,7 +64517,7 @@ ${codeText}
|
|
|
64410
64517
|
images.splice(imageInsertIndex, 0, draggedImage.image);
|
|
64411
64518
|
images[0].flex = NaN;
|
|
64412
64519
|
calcImagesFlexIfNeeded(images);
|
|
64413
|
-
const embedData = toImageEmbedData(images, imageObject.getWidthPercent());
|
|
64520
|
+
const embedData = toImageEmbedData(editor, images, imageObject.getWidthPercent());
|
|
64414
64521
|
editor.updateEmbedData(targetBlock, embedData);
|
|
64415
64522
|
deleteImageFromBlock(editor, sourceBlock, draggedImage.index);
|
|
64416
64523
|
(_b2 = editor.findCustom("drag-handler")) == null ? void 0 : _b2.handleDragEnd();
|
|
@@ -64754,7 +64861,7 @@ ${codeText}
|
|
|
64754
64861
|
function getImageClipboardData(editor, img, imageObject, index2) {
|
|
64755
64862
|
const imageData = imageObject.getImages()[index2];
|
|
64756
64863
|
const widthPercent = imageObject.getImages().length === 1 ? imageObject.getWidthPercent() : imageData.flex * 100;
|
|
64757
|
-
const embedData = toImageEmbedData([imageData], widthPercent);
|
|
64864
|
+
const embedData = toImageEmbedData(editor, [imageData], widthPercent);
|
|
64758
64865
|
const blockData = {
|
|
64759
64866
|
id: genId(),
|
|
64760
64867
|
type: "embed",
|
|
@@ -65474,7 +65581,7 @@ ${codeText}
|
|
|
65474
65581
|
flex: 1,
|
|
65475
65582
|
virtualSize: false
|
|
65476
65583
|
};
|
|
65477
|
-
const embedData = toImageEmbedData([imageItem], widthPercent);
|
|
65584
|
+
const embedData = toImageEmbedData(editor, [imageItem], widthPercent);
|
|
65478
65585
|
const blockData = {
|
|
65479
65586
|
id: genId(),
|
|
65480
65587
|
type: "embed",
|
|
@@ -80670,6 +80777,10 @@ ${content}
|
|
|
80670
80777
|
}
|
|
80671
80778
|
if (sourceBlock && !(isHeadingBlock$1(sourceBlock) && isCollapsedHeadingBlock(sourceBlock))) {
|
|
80672
80779
|
const sourceBlockData = editor.getBlockData(sourceBlock);
|
|
80780
|
+
if (sourceBlock && isEmbedBlock(sourceBlock) && getEmbedType(sourceBlock) === "image") {
|
|
80781
|
+
clearWidthReal(sourceBlockData.embedData);
|
|
80782
|
+
sourceBlockData.embedData.widthPercent = 100;
|
|
80783
|
+
}
|
|
80673
80784
|
newContainerID = createContainer$1(editor.doc, cloneBlock(editor.editorBlocks, editor.doc.toJSON(), sourceBlockData));
|
|
80674
80785
|
editor.deleteBlock(sourceBlock);
|
|
80675
80786
|
} else {
|
|
@@ -80699,6 +80810,11 @@ ${content}
|
|
|
80699
80810
|
blockData.children.splice(removeIndex, 1);
|
|
80700
80811
|
if (blockData.children.length === 1) {
|
|
80701
80812
|
const remainContent = cloneChildContainer(editor.editorBlocks, editor.doc.toJSON(), blockData.children[0]);
|
|
80813
|
+
remainContent.blocks.root.forEach((remainBlockData) => {
|
|
80814
|
+
if (remainBlockData.type === "embed" && remainBlockData.embedType === "image" && remainBlockData.embedData.widthPercent === 100) {
|
|
80815
|
+
setWidthPercentAndWidthReal(remainBlockData, 100);
|
|
80816
|
+
}
|
|
80817
|
+
});
|
|
80702
80818
|
editor.insertDocAt(editor.getContainerById("root"), editor.getBlockIndex(layoutBlock), remainContent);
|
|
80703
80819
|
editor.deleteBlock(layoutBlock);
|
|
80704
80820
|
return;
|
|
@@ -80970,11 +81086,13 @@ ${content}
|
|
|
80970
81086
|
} else {
|
|
80971
81087
|
if (isEmbedBlock(source) && getEmbedType(source) === "image") {
|
|
80972
81088
|
sourceData = editor.getBlockData(source);
|
|
81089
|
+
clearWidthReal(sourceData.embedData);
|
|
80973
81090
|
sourceData.embedData.widthPercent = 100;
|
|
80974
81091
|
}
|
|
80975
81092
|
let targetData;
|
|
80976
81093
|
if (isEmbedBlock(target) && getEmbedType(target) === "image") {
|
|
80977
81094
|
targetData = editor.getBlockData(target);
|
|
81095
|
+
clearWidthReal(targetData.embedData);
|
|
80978
81096
|
targetData.embedData.widthPercent = 100;
|
|
80979
81097
|
}
|
|
80980
81098
|
const cols = position === "left" ? [source, target] : [target, source];
|
|
@@ -81489,6 +81607,7 @@ ${content}
|
|
|
81489
81607
|
this.dragRecord.dragItem = dragger;
|
|
81490
81608
|
this.showDragging();
|
|
81491
81609
|
document.addEventListener("mousemove", this.handleDragging);
|
|
81610
|
+
window.isDragging = true;
|
|
81492
81611
|
});
|
|
81493
81612
|
__publicField(this, "handleDragging", (event) => {
|
|
81494
81613
|
if (!this.dragRecord)
|
|
@@ -81550,6 +81669,7 @@ ${content}
|
|
|
81550
81669
|
__publicField(this, "handleMouseUp", () => {
|
|
81551
81670
|
document.removeEventListener("mousemove", this.handleDragging);
|
|
81552
81671
|
this.updateBlockData();
|
|
81672
|
+
window.isDragging = false;
|
|
81553
81673
|
this.hideDragging();
|
|
81554
81674
|
this.draggingRef = null;
|
|
81555
81675
|
this.dragRecord = null;
|
|
@@ -86873,7 +86993,7 @@ ${data2.flowchartText}
|
|
|
86873
86993
|
}
|
|
86874
86994
|
}
|
|
86875
86995
|
});
|
|
86876
|
-
editor.version = "2.2.0-beta.
|
|
86996
|
+
editor.version = "2.2.0-beta.3";
|
|
86877
86997
|
if (Logger$2.level === LogLevel.DEBUG) {
|
|
86878
86998
|
window.setReauthFail = (fail) => {
|
|
86879
86999
|
window.isReauthError = fail;
|
|
@@ -86974,7 +87094,7 @@ ${data2.flowchartText}
|
|
|
86974
87094
|
});
|
|
86975
87095
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
86976
87096
|
OnesEditorToolbar.register(editor);
|
|
86977
|
-
editor.version = "2.2.0-beta.
|
|
87097
|
+
editor.version = "2.2.0-beta.3";
|
|
86978
87098
|
return editor;
|
|
86979
87099
|
}
|
|
86980
87100
|
async function showDocVersions(editor, options, serverUrl) {
|