@worktile/theia 20.2.10 → 20.2.12
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/fesm2022/worktile-theia.mjs +8 -43
- package/fesm2022/worktile-theia.mjs.map +1 -1
- package/index.d.ts +0 -1
- package/package.json +2 -2
|
@@ -10,7 +10,7 @@ import { cloneDeep, map, every, assign, defaults, groupBy, uniq, isEqual } from
|
|
|
10
10
|
export { assign, cloneDeep, debounce, defaults, groupBy, isEqual, map, uniq } from 'lodash';
|
|
11
11
|
import { Editor, Element, Span, Range, Path, Node, Point, Text, Transforms, Operation, createEditor } from 'slate';
|
|
12
12
|
import * as i4 from 'slate-angular';
|
|
13
|
-
import { FAKE_LEFT_BLOCK_CARD_OFFSET, FAKE_RIGHT_BLOCK_CARD_OFFSET, getClipboardData, AngularEditor, hotkeys, getPlainText as getPlainText$1, createClipboardData, setClipboardData, BaseElementComponent, IS_SAFARI, ELEMENT_TO_COMPONENT, SlateModule, getBlockCardByNativeElement, SLATE_BLOCK_CARD_CLASS_NAME, EDITOR_TO_VIRTUAL_SCROLL_SELECTION, BaseElementFlavour, hasBlockCard, isCardLeft,
|
|
13
|
+
import { FAKE_LEFT_BLOCK_CARD_OFFSET, FAKE_RIGHT_BLOCK_CARD_OFFSET, getClipboardData, AngularEditor, hotkeys, getPlainText as getPlainText$1, createClipboardData, setClipboardData, BaseElementComponent, IS_SAFARI, ELEMENT_TO_COMPONENT, SlateModule, getBlockCardByNativeElement, SLATE_BLOCK_CARD_CLASS_NAME, EDITOR_TO_VIRTUAL_SCROLL_SELECTION, BaseElementFlavour, hasBlockCard, isCardLeft, getCachedHeightByElement, isDebug, debugLog, cacheHeightByElement, DEFAULT_ELEMENT_HEIGHT, DefaultTextFlavour, defaultScrollSelectionIntoView, getDataTransferClipboard, SLATE_DEBUG_KEY, withAngular } from 'slate-angular';
|
|
14
14
|
import { HistoryEditor, withHistory } from 'slate-history';
|
|
15
15
|
import { NODE_TO_PARENT, NODE_TO_INDEX, NODE_TO_ELEMENT, DOMEditor, EDITOR_TO_ELEMENT } from 'slate-dom';
|
|
16
16
|
import { TheiaConverter } from '@atinc/selene';
|
|
@@ -14431,14 +14431,6 @@ class TheImage extends TheBaseElement {
|
|
|
14431
14431
|
}
|
|
14432
14432
|
super.ngOnDestroy();
|
|
14433
14433
|
}
|
|
14434
|
-
cacheImageHeight(height) {
|
|
14435
|
-
if (!AngularEditor.isEnabledVirtualScroll(this.editor)) {
|
|
14436
|
-
return;
|
|
14437
|
-
}
|
|
14438
|
-
const heights = ELEMENT_KEY_TO_HEIGHTS.get(this.editor);
|
|
14439
|
-
const key = AngularEditor.findKey(this.editor, this.element);
|
|
14440
|
-
heights.set(key.id, height);
|
|
14441
|
-
}
|
|
14442
14434
|
setImageMinHeight() {
|
|
14443
14435
|
if (!AngularEditor.isEnabledVirtualScroll(this.editor)) {
|
|
14444
14436
|
return;
|
|
@@ -14449,9 +14441,6 @@ class TheImage extends TheBaseElement {
|
|
|
14449
14441
|
if (blockCard) {
|
|
14450
14442
|
const minHeight = realHeight - ROOT_ELEMENT_MARGIN_BOTTOM;
|
|
14451
14443
|
blockCard.style.minHeight = minHeight + 'px';
|
|
14452
|
-
// if (isDebug) {
|
|
14453
|
-
// debugLog('warn', 'setImageMinHeight in blockCard, realHeight(cache): ', realHeight, this.element.key, 'minHeight: ', minHeight);
|
|
14454
|
-
// }
|
|
14455
14444
|
}
|
|
14456
14445
|
else {
|
|
14457
14446
|
if (isDebug) {
|
|
@@ -14461,7 +14450,7 @@ class TheImage extends TheBaseElement {
|
|
|
14461
14450
|
}
|
|
14462
14451
|
else {
|
|
14463
14452
|
if (isDebug) {
|
|
14464
|
-
debugLog('warn', 'image render and
|
|
14453
|
+
debugLog('warn', 'image render and no cache height', this.element.key, 'index: ', this.editor.children.indexOf(this.element));
|
|
14465
14454
|
}
|
|
14466
14455
|
}
|
|
14467
14456
|
}
|
|
@@ -14630,7 +14619,6 @@ class TheImage extends TheBaseElement {
|
|
|
14630
14619
|
width: this.imageEntry.width,
|
|
14631
14620
|
height: this.imageEntry.height
|
|
14632
14621
|
}, { at: this.selection });
|
|
14633
|
-
this.cacheImageHeight(this.calcHeight());
|
|
14634
14622
|
}
|
|
14635
14623
|
}
|
|
14636
14624
|
cancelUpload() {
|
|
@@ -14719,26 +14707,10 @@ class TheImage extends TheBaseElement {
|
|
|
14719
14707
|
this.naturalWidth = img.naturalWidth;
|
|
14720
14708
|
this.naturalHeight = img.naturalHeight;
|
|
14721
14709
|
if (AngularEditor.isEnabledVirtualScroll(this.editor)) {
|
|
14722
|
-
// if (isDebug) {
|
|
14723
|
-
// const realHeight = this.getRealHeight();
|
|
14724
|
-
// debugLog('warn', 'imageLoaded, realHeight: ', realHeight, this.element.key, this.editor.children.indexOf(this.element));
|
|
14725
|
-
// }
|
|
14726
14710
|
this.imageLoadedCacheHeightTimer = setTimeout(() => {
|
|
14727
|
-
// if (isDebug) {
|
|
14728
|
-
// const realHeight = this.getRealHeight();
|
|
14729
|
-
// debugLog(
|
|
14730
|
-
// 'warn',
|
|
14731
|
-
// 'imageLoaded, realHeight setTimeout period: ',
|
|
14732
|
-
// realHeight,
|
|
14733
|
-
// this.element.key,
|
|
14734
|
-
// 'index: ',
|
|
14735
|
-
// this.editor.children.indexOf(this.element)
|
|
14736
|
-
// );
|
|
14737
|
-
// }
|
|
14738
14711
|
const result = this.clearMinHeight();
|
|
14739
|
-
|
|
14740
|
-
|
|
14741
|
-
}
|
|
14712
|
+
const height = this.calcHeight();
|
|
14713
|
+
cacheHeightByElement(this.editor, this.element, height);
|
|
14742
14714
|
}, 0);
|
|
14743
14715
|
}
|
|
14744
14716
|
}
|
|
@@ -18436,9 +18408,7 @@ class TheEditorComponent {
|
|
|
18436
18408
|
this.elementToHtml = new WeakMap();
|
|
18437
18409
|
this.virtualScrollConfig = signal({
|
|
18438
18410
|
enabled: false,
|
|
18439
|
-
scrollTop: 0
|
|
18440
|
-
viewportHeight: 0,
|
|
18441
|
-
viewportBoundingTop: 0
|
|
18411
|
+
scrollTop: 0
|
|
18442
18412
|
}, ...(ngDevMode ? [{ debugName: "virtualScrollConfig" }] : []));
|
|
18443
18413
|
this.onChangeCallback = () => { };
|
|
18444
18414
|
this.onTouchedCallback = () => { };
|
|
@@ -18527,6 +18497,7 @@ class TheEditorComponent {
|
|
|
18527
18497
|
}
|
|
18528
18498
|
ngOnInit() {
|
|
18529
18499
|
this.initialize();
|
|
18500
|
+
this.updateVirtualConfig();
|
|
18530
18501
|
this.onErrorHandler();
|
|
18531
18502
|
initializeDefaultMenuIcons(this.iconRegistry);
|
|
18532
18503
|
}
|
|
@@ -18567,26 +18538,20 @@ class TheEditorComponent {
|
|
|
18567
18538
|
.subscribe(() => {
|
|
18568
18539
|
this.updateVirtualConfig();
|
|
18569
18540
|
});
|
|
18570
|
-
this.updateVirtualConfig();
|
|
18571
18541
|
}
|
|
18572
18542
|
updateVirtualConfig() {
|
|
18573
18543
|
const scrollContainer = this.theContextService.getScrollContainer();
|
|
18574
18544
|
if (!this.virtualScrollConfig().enabled || !scrollContainer) {
|
|
18575
18545
|
return;
|
|
18576
18546
|
}
|
|
18577
|
-
const { scrollTop
|
|
18578
|
-
if (this.scrollContainerBoundingTop === null) {
|
|
18579
|
-
this.scrollContainerBoundingTop = scrollContainer.getBoundingClientRect().top;
|
|
18580
|
-
}
|
|
18547
|
+
const { scrollTop } = scrollContainer;
|
|
18581
18548
|
if (localStorage.getItem(SLATE_DEBUG_KEY + '__SCROLL_TOP')) {
|
|
18582
18549
|
console.log(`theia: scroll event fired from user: ${scrollTop}`);
|
|
18583
18550
|
}
|
|
18584
18551
|
this.virtualScrollConfig.update(config => ({
|
|
18585
18552
|
...config,
|
|
18586
18553
|
scrollTop,
|
|
18587
|
-
|
|
18588
|
-
scrollContainer: this.theContextService.getScrollContainer(),
|
|
18589
|
-
viewportBoundingTop: this.scrollContainerBoundingTop
|
|
18554
|
+
scrollContainer
|
|
18590
18555
|
}));
|
|
18591
18556
|
}
|
|
18592
18557
|
initialize() {
|