@ones-editor/editor 2.2.10-beta.3 → 2.2.10-beta.5
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/core/src/core/blocks/text-blocks/base/text-range.d.ts +1 -1
- package/@ones-editor/core/src/core/editor/editor-dom/dom-events.d.ts +2 -2
- package/@ones-editor/core/src/core/selection/range-from-point.d.ts +1 -1
- package/@ones-editor/core/src/core/types.d.ts +2 -2
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/dist/index.js +31 -30
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2139,7 +2139,6 @@ div.tippy-box[data-theme=editor-tooltip] > .tippy-content {
|
|
|
2139
2139
|
}
|
|
2140
2140
|
.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block [data-type=block-content] {
|
|
2141
2141
|
margin-right: 24px;
|
|
2142
|
-
transition: background-color 0.25s linear;
|
|
2143
2142
|
}
|
|
2144
2143
|
.editor-root [data-type=editor-container].root div[data-type=editor-block].list-block [data-type=block-tools] .editor-mindmap-svg {
|
|
2145
2144
|
position: absolute;
|
|
@@ -2513,6 +2512,7 @@ div.editor-root div.editor-content div[data-block-type=list][data-style-heading=
|
|
|
2513
2512
|
.editor-root:not(.readonly) div[data-type=editor-block].list-block.hover[data-list-type=unchecked] > div[data-type=block-content], .editor-root:not(.readonly) div[data-type=editor-block].list-block.hover[data-list-type=checked] > div.list-container,
|
|
2514
2513
|
.editor-root:not(.readonly) div[data-type=editor-block].list-block.hover[data-list-type=checked] > div[data-type=block-content] {
|
|
2515
2514
|
background-color: #f8f8f8;
|
|
2515
|
+
transition: background-color 0.25s linear;
|
|
2516
2516
|
}
|
|
2517
2517
|
.editor-root:not(.readonly) div[data-type=editor-block].list-block .list-container:hover .list-marker {
|
|
2518
2518
|
cursor: pointer;
|
|
@@ -5179,6 +5179,7 @@ div.editor-root:not(.mobile) div.editor-content div[data-type=editor-container]
|
|
|
5179
5179
|
background-color: var(--op-selected-color);
|
|
5180
5180
|
border-radius: 3px;
|
|
5181
5181
|
pointer-events: none;
|
|
5182
|
+
z-index: 1;
|
|
5182
5183
|
}
|
|
5183
5184
|
.editor-root.history .table-block.history-inserted-block table .child {
|
|
5184
5185
|
pointer-events: none;
|
|
@@ -13088,7 +13089,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13088
13089
|
return createEditorSelectionRange(editor, { anchor: anchor2, focus });
|
|
13089
13090
|
}
|
|
13090
13091
|
const logger$49 = getLogger("range-from-point");
|
|
13091
|
-
function getBlockRangeFromPoint(editor, pointX, pointY) {
|
|
13092
|
+
function getBlockRangeFromPoint(editor, pointX, pointY, dragging) {
|
|
13092
13093
|
const yOffsets = [0, -12, 12];
|
|
13093
13094
|
let x = pointX;
|
|
13094
13095
|
const y = pointY;
|
|
@@ -13136,7 +13137,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13136
13137
|
if (!editor.contains(block)) {
|
|
13137
13138
|
continue;
|
|
13138
13139
|
}
|
|
13139
|
-
const range = getBlockClass(editor, block).getRangeFromPoint(editor, block, x, y + yOffsets[i]);
|
|
13140
|
+
const range = getBlockClass(editor, block).getRangeFromPoint(editor, block, x, y + yOffsets[i], dragging);
|
|
13140
13141
|
if (range) {
|
|
13141
13142
|
return range;
|
|
13142
13143
|
}
|
|
@@ -23732,7 +23733,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23732
23733
|
});
|
|
23733
23734
|
return ret;
|
|
23734
23735
|
}
|
|
23735
|
-
function getTextBlockRangeFromPoint(editor, block, xOrign, yOrign) {
|
|
23736
|
+
function getTextBlockRangeFromPoint(editor, block, xOrign, yOrign, dragging) {
|
|
23736
23737
|
const elem = getElementFromPoint(xOrign, yOrign);
|
|
23737
23738
|
if (!elem)
|
|
23738
23739
|
return null;
|
|
@@ -23787,7 +23788,12 @@ var __publicField = (obj, key, value) => {
|
|
|
23787
23788
|
offset = start;
|
|
23788
23789
|
length = 0;
|
|
23789
23790
|
} else if (isTextBlockContentBoxChild(child)) {
|
|
23790
|
-
|
|
23791
|
+
const blockRect2 = child.getBoundingClientRect();
|
|
23792
|
+
if (!dragging) {
|
|
23793
|
+
offset = start + (blockRect2.x + 10 > x ? 0 : 1);
|
|
23794
|
+
} else {
|
|
23795
|
+
offset = start + (blockRect2.x + blockRect2.width / 2 > x ? 0 : 1);
|
|
23796
|
+
}
|
|
23791
23797
|
length = 0;
|
|
23792
23798
|
} else {
|
|
23793
23799
|
assert(logger$3W, child.firstChild instanceof Text, "child is not text");
|
|
@@ -27432,7 +27438,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27432
27438
|
}
|
|
27433
27439
|
const logger$3g = getLogger("table-scroll");
|
|
27434
27440
|
class DomEventHandler {
|
|
27435
|
-
constructor(editor, dom, name, handler, data2) {
|
|
27441
|
+
constructor(editor, dom, name, handler, data2, options) {
|
|
27436
27442
|
__publicField(this, "handleEvent", (event) => {
|
|
27437
27443
|
this.handler(this.editor, event, this.data);
|
|
27438
27444
|
});
|
|
@@ -27441,7 +27447,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27441
27447
|
this.name = name;
|
|
27442
27448
|
this.handler = handler;
|
|
27443
27449
|
this.data = data2;
|
|
27444
|
-
dom.addEventListener(name, this.handleEvent);
|
|
27450
|
+
dom.addEventListener(name, this.handleEvent, options);
|
|
27445
27451
|
}
|
|
27446
27452
|
destroy() {
|
|
27447
27453
|
this.dom.removeEventListener(this.name, this.handleEvent);
|
|
@@ -27458,16 +27464,16 @@ var __publicField = (obj, key, value) => {
|
|
|
27458
27464
|
this.handlers.delete(element);
|
|
27459
27465
|
});
|
|
27460
27466
|
}
|
|
27461
|
-
addEventListener(element, eventName, eventHandler, data2) {
|
|
27467
|
+
addEventListener(element, eventName, eventHandler, data2, options) {
|
|
27462
27468
|
const existsHandlers = this.handlers.get(element);
|
|
27463
27469
|
if (existsHandlers) {
|
|
27464
27470
|
if (existsHandlers.find((handler) => handler.handler === eventHandler && handler.name === eventName)) {
|
|
27465
27471
|
logger$3g.warn(`event has already registered: ${eventName}`);
|
|
27466
27472
|
return;
|
|
27467
27473
|
}
|
|
27468
|
-
existsHandlers.push(new DomEventHandler(this.editor, element, eventName, eventHandler, data2));
|
|
27474
|
+
existsHandlers.push(new DomEventHandler(this.editor, element, eventName, eventHandler, data2, options));
|
|
27469
27475
|
} else {
|
|
27470
|
-
const handler = new DomEventHandler(this.editor, element, eventName, eventHandler, data2);
|
|
27476
|
+
const handler = new DomEventHandler(this.editor, element, eventName, eventHandler, data2, options);
|
|
27471
27477
|
this.handlers.set(element, [handler]);
|
|
27472
27478
|
}
|
|
27473
27479
|
}
|
|
@@ -28136,7 +28142,7 @@ var __publicField = (obj, key, value) => {
|
|
|
28136
28142
|
if (Math.abs(this.mouseDownEvent.x - event.x) < 3 && Math.abs(this.mouseDownEvent.y - event.y) < 3) {
|
|
28137
28143
|
return;
|
|
28138
28144
|
}
|
|
28139
|
-
const range = getBlockRangeFromPoint(this.editor, event.x, event.y);
|
|
28145
|
+
const range = getBlockRangeFromPoint(this.editor, event.x, event.y, true);
|
|
28140
28146
|
if (!range) {
|
|
28141
28147
|
return;
|
|
28142
28148
|
}
|
|
@@ -58425,9 +58431,9 @@ $$${mathData.mathjaxText}$$
|
|
|
58425
58431
|
if (target.hasAttribute("data-editor-overflow-tooltip")) {
|
|
58426
58432
|
if (this.check(target)) {
|
|
58427
58433
|
const title = target.getAttribute("data-editor-overflow-tooltip");
|
|
58428
|
-
target.setAttribute(`data-editor-tooltip-${this.editor.clientId}`, title);
|
|
58434
|
+
target.setAttribute(`data-editor-tooltip-${this.editor.clientId}-dynamic`, title);
|
|
58429
58435
|
} else {
|
|
58430
|
-
target.removeAttribute(`data-editor-tooltip-${this.editor.clientId}`);
|
|
58436
|
+
target.removeAttribute(`data-editor-tooltip-${this.editor.clientId}-dynamic`);
|
|
58431
58437
|
}
|
|
58432
58438
|
}
|
|
58433
58439
|
});
|
|
@@ -63408,14 +63414,14 @@ ${codeText}
|
|
|
63408
63414
|
}
|
|
63409
63415
|
const code = toPlainText(text2);
|
|
63410
63416
|
const codeData = editor.doc.getBlockData(parentBlockPath.containerId, parentBlockPath.blockIndex);
|
|
63411
|
-
const
|
|
63417
|
+
const getPrismGrammar = (language) => {
|
|
63412
63418
|
if (!language) {
|
|
63413
63419
|
return Prism__default.default.languages.plain;
|
|
63414
63420
|
}
|
|
63415
63421
|
const lang = language.replace(/\s/g, "").toLocaleLowerCase();
|
|
63416
63422
|
return Prism__default.default.languages[lang] || Prism__default.default.languages.plain;
|
|
63417
63423
|
};
|
|
63418
|
-
const grammar =
|
|
63424
|
+
const grammar = getPrismGrammar(codeData.language);
|
|
63419
63425
|
const tokens = Prism__default.default.tokenize(code, grammar);
|
|
63420
63426
|
const tokenToText = (token, attributes) => {
|
|
63421
63427
|
assert(logger$1m, token, "no token");
|
|
@@ -67739,7 +67745,7 @@ ${codeText}
|
|
|
67739
67745
|
this.editor.addListener("selectionChanged", this.handleSelectionChanged);
|
|
67740
67746
|
this.editor.addListener("resize", this.handleEditorResize);
|
|
67741
67747
|
this.editor.addListener("docChanged", this.handleDocChanged);
|
|
67742
|
-
this.editor.
|
|
67748
|
+
this.editor.domEvents.addEventListener(this.editor.scrollContainer, "wheel", (ed, e2) => this.handleScroll(e2), { passive: false });
|
|
67743
67749
|
this.items.forEach((item) => item.addListener("resize", this.handleItemResize));
|
|
67744
67750
|
this.groupItemHandlers = new CommentGroupItemHandlers(this, commentsProvider);
|
|
67745
67751
|
document.addEventListener("click", this.handleDocumentClick);
|
|
@@ -67748,7 +67754,6 @@ ${codeText}
|
|
|
67748
67754
|
this.editor.removeListener("selectionChanged", this.handleSelectionChanged);
|
|
67749
67755
|
this.editor.removeListener("resize", this.handleEditorResize);
|
|
67750
67756
|
this.editor.removeListener("docChanged", this.handleDocChanged);
|
|
67751
|
-
this.editor.scrollContainer.removeEventListener("wheel", this.handleScroll);
|
|
67752
67757
|
super.destroy();
|
|
67753
67758
|
this.unbindEvents();
|
|
67754
67759
|
this.removeAllListeners();
|
|
@@ -79566,6 +79571,7 @@ ${content}
|
|
|
79566
79571
|
}
|
|
79567
79572
|
destroy() {
|
|
79568
79573
|
this.editor.doc.unregisterCallback(this);
|
|
79574
|
+
this.removeAllListeners();
|
|
79569
79575
|
}
|
|
79570
79576
|
isHeadingBlock(blockData) {
|
|
79571
79577
|
return !!blockData.heading;
|
|
@@ -80327,22 +80333,22 @@ ${content}
|
|
|
80327
80333
|
const image = createElement("img", ["editor-template-thumb"], imageContaniner);
|
|
80328
80334
|
image.src = imageSrc;
|
|
80329
80335
|
image.style.display = "none";
|
|
80330
|
-
image
|
|
80336
|
+
editor.domEvents.addEventListener(image, "error", () => {
|
|
80331
80337
|
var _a2;
|
|
80332
80338
|
const placeholder2 = (_a2 = options == null ? void 0 : options.placeHolderImageSrc) != null ? _a2 : TEMPLATE_PLACEHOLDER;
|
|
80333
80339
|
if (image.src !== placeholder2) {
|
|
80334
80340
|
image.src = placeholder2;
|
|
80335
80341
|
}
|
|
80336
|
-
};
|
|
80337
|
-
image
|
|
80342
|
+
});
|
|
80343
|
+
editor.domEvents.addEventListener(image, "load", () => {
|
|
80338
80344
|
image.style.display = "";
|
|
80339
|
-
};
|
|
80345
|
+
});
|
|
80340
80346
|
const nameDiv = createElement("div", ["editor-template-name"], card);
|
|
80341
80347
|
const span = createElement("span", [], nameDiv, name);
|
|
80342
80348
|
if (options == null ? void 0 : options.showTemplateTitleAttr) {
|
|
80343
80349
|
span.setAttribute("title", name);
|
|
80344
80350
|
}
|
|
80345
|
-
card
|
|
80351
|
+
editor.domEvents.addEventListener(card, "click", () => clickHandler(card));
|
|
80346
80352
|
return card;
|
|
80347
80353
|
}
|
|
80348
80354
|
function getDocThumbImage(editor, template) {
|
|
@@ -86446,6 +86452,7 @@ ${data2.flowchartText}
|
|
|
86446
86452
|
embeds: [...StandardEmbeds, ...((_c = options.components) == null ? void 0 : _c.embeds) || []],
|
|
86447
86453
|
boxes: [...StandardBoxes, ...((_d = options.components) == null ? void 0 : _d.boxes) || []],
|
|
86448
86454
|
textRenders: [new BlockPaddingRender()],
|
|
86455
|
+
decorators: [new CodeTextDecorator()],
|
|
86449
86456
|
options: { ...options.componentsOptions }
|
|
86450
86457
|
}
|
|
86451
86458
|
});
|
|
@@ -88343,13 +88350,7 @@ ${data2.flowchartText}
|
|
|
88343
88350
|
}
|
|
88344
88351
|
}
|
|
88345
88352
|
});
|
|
88346
|
-
editor.version = "2.2.10-beta.
|
|
88347
|
-
if (Logger$2.level === LogLevel.DEBUG) {
|
|
88348
|
-
window.setReauthFail = (fail) => {
|
|
88349
|
-
window.isReauthError = fail;
|
|
88350
|
-
};
|
|
88351
|
-
window.reConnect = (token) => editor.doc.externalDoc.client.connection.reConnect(token);
|
|
88352
|
-
}
|
|
88353
|
+
editor.version = "2.2.10-beta.5";
|
|
88353
88354
|
return editor;
|
|
88354
88355
|
}
|
|
88355
88356
|
function isDoc(doc2) {
|
|
@@ -88444,7 +88445,7 @@ ${data2.flowchartText}
|
|
|
88444
88445
|
});
|
|
88445
88446
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
88446
88447
|
OnesEditorToolbar.register(editor);
|
|
88447
|
-
editor.version = "2.2.10-beta.
|
|
88448
|
+
editor.version = "2.2.10-beta.5";
|
|
88448
88449
|
return editor;
|
|
88449
88450
|
}
|
|
88450
88451
|
async function showDocVersions(editor, options, serverUrl) {
|