@worktile/theia 20.1.0-next.3 → 20.1.0-next.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/fesm2022/worktile-theia.mjs +35 -9
- package/fesm2022/worktile-theia.mjs.map +1 -1
- package/index.d.ts +4 -1
- package/package.json +2 -2
|
@@ -10,7 +10,7 @@ import { cloneDeep, map, assign, defaults, groupBy, uniq, isEqual } from 'lodash
|
|
|
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, BaseElementFlavour, hasBlockCard, isCardLeft, DefaultTextFlavour, defaultScrollSelectionIntoView, getDataTransferClipboard, JUST_NOW_UPDATED_VIRTUAL_VIEW, SLATE_DEBUG_KEY, withAngular } 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, BaseElementFlavour, hasBlockCard, isCardLeft, ELEMENT_KEY_TO_HEIGHTS, DefaultTextFlavour, defaultScrollSelectionIntoView, getDataTransferClipboard, JUST_NOW_UPDATED_VIRTUAL_VIEW, 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';
|
|
@@ -14340,6 +14340,10 @@ class TheImage extends TheBaseElement {
|
|
|
14340
14340
|
this.subscribeMouseUp();
|
|
14341
14341
|
this.subscribeImageUploadingState();
|
|
14342
14342
|
}
|
|
14343
|
+
afterViewInit() {
|
|
14344
|
+
super.afterViewInit();
|
|
14345
|
+
this.setImageMinHeight();
|
|
14346
|
+
}
|
|
14343
14347
|
onContextChange() {
|
|
14344
14348
|
super.onContextChange();
|
|
14345
14349
|
if (this.initialized && !isMobileMode(this.editor)) {
|
|
@@ -14359,6 +14363,28 @@ class TheImage extends TheBaseElement {
|
|
|
14359
14363
|
}
|
|
14360
14364
|
super.ngOnDestroy();
|
|
14361
14365
|
}
|
|
14366
|
+
cacheImageHeight(height) {
|
|
14367
|
+
const heights = ELEMENT_KEY_TO_HEIGHTS.get(this.editor);
|
|
14368
|
+
const key = AngularEditor.findKey(this.editor, this.element);
|
|
14369
|
+
heights.set(key.id, height);
|
|
14370
|
+
}
|
|
14371
|
+
setImageMinHeight() {
|
|
14372
|
+
const heights = ELEMENT_KEY_TO_HEIGHTS.get(this.editor);
|
|
14373
|
+
const key = AngularEditor.findKey(this.editor, this.element);
|
|
14374
|
+
if (heights && heights.get(key.id)) {
|
|
14375
|
+
const blockCard = getBlockCardByNativeElement(this.nativeElement);
|
|
14376
|
+
if (blockCard) {
|
|
14377
|
+
const style = getComputedStyle(blockCard);
|
|
14378
|
+
blockCard.style.minHeight = heights.get(key.id) - parseFloat(style.marginTop) - parseFloat(style.marginBottom) + 'px';
|
|
14379
|
+
}
|
|
14380
|
+
}
|
|
14381
|
+
}
|
|
14382
|
+
clearMinHeight() {
|
|
14383
|
+
const blockCard = getBlockCardByNativeElement(this.nativeElement);
|
|
14384
|
+
if (blockCard) {
|
|
14385
|
+
blockCard.style.minHeight = '';
|
|
14386
|
+
}
|
|
14387
|
+
}
|
|
14362
14388
|
setImagePluginOptions() {
|
|
14363
14389
|
this.imagePluginOptions = getPluginOptions(this.editor, PluginKeys.image);
|
|
14364
14390
|
}
|
|
@@ -14511,6 +14537,7 @@ class TheImage extends TheBaseElement {
|
|
|
14511
14537
|
width: this.imageEntry.width,
|
|
14512
14538
|
height: this.imageEntry.height
|
|
14513
14539
|
}, { at: this.selection });
|
|
14540
|
+
this.cacheImageHeight(this.getRealHeight());
|
|
14514
14541
|
}
|
|
14515
14542
|
}
|
|
14516
14543
|
cancelUpload() {
|
|
@@ -14595,9 +14622,13 @@ class TheImage extends TheBaseElement {
|
|
|
14595
14622
|
.withPositions([bottomPosition]);
|
|
14596
14623
|
}
|
|
14597
14624
|
imageLoaded(event) {
|
|
14625
|
+
this.clearMinHeight();
|
|
14598
14626
|
const img = event.target;
|
|
14599
14627
|
this.naturalWidth = img.naturalWidth;
|
|
14600
14628
|
this.naturalHeight = img.naturalHeight;
|
|
14629
|
+
setTimeout(() => {
|
|
14630
|
+
this.cacheImageHeight(this.getRealHeight());
|
|
14631
|
+
}, 0);
|
|
14601
14632
|
}
|
|
14602
14633
|
imageError(event) {
|
|
14603
14634
|
const img = event.target;
|
|
@@ -18340,7 +18371,6 @@ class TheEditorComponent {
|
|
|
18340
18371
|
}
|
|
18341
18372
|
}
|
|
18342
18373
|
ngOnDestroy() {
|
|
18343
|
-
this.scrollContainerResizeObserver?.disconnect();
|
|
18344
18374
|
THE_EDITOR_PREVIOUS_SELECTION.delete(this.editor);
|
|
18345
18375
|
}
|
|
18346
18376
|
bindVirtualScrollContainer() {
|
|
@@ -18349,10 +18379,6 @@ class TheEditorComponent {
|
|
|
18349
18379
|
return;
|
|
18350
18380
|
}
|
|
18351
18381
|
this.scrollContainerElement = scrollContainer;
|
|
18352
|
-
this.scrollContainerResizeObserver = new ResizeObserver(() => {
|
|
18353
|
-
this.syncVirtualConfig();
|
|
18354
|
-
});
|
|
18355
|
-
this.scrollContainerResizeObserver.observe(scrollContainer);
|
|
18356
18382
|
this.ngZone.runOutsideAngular(() => {
|
|
18357
18383
|
fromEvent(scrollContainer, 'scroll')
|
|
18358
18384
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
@@ -18367,21 +18393,21 @@ class TheEditorComponent {
|
|
|
18367
18393
|
JUST_NOW_UPDATED_VIRTUAL_VIEW.set(this.editor, false);
|
|
18368
18394
|
}
|
|
18369
18395
|
});
|
|
18396
|
+
this.syncVirtualConfig();
|
|
18370
18397
|
});
|
|
18371
|
-
this.syncVirtualConfig();
|
|
18372
18398
|
}
|
|
18373
18399
|
syncVirtualConfig() {
|
|
18374
18400
|
if (!this.virtualConfig().enabled || !this.scrollContainerElement) {
|
|
18375
18401
|
return;
|
|
18376
18402
|
}
|
|
18377
|
-
const { scrollTop,
|
|
18403
|
+
const { scrollTop, offsetHeight } = this.scrollContainerElement;
|
|
18378
18404
|
if (localStorage.getItem(SLATE_DEBUG_KEY + '__SCROLL_TOP')) {
|
|
18379
18405
|
console.log(`theia: scroll event fired from user: ${scrollTop}`);
|
|
18380
18406
|
}
|
|
18381
18407
|
this.virtualConfig.update(config => ({
|
|
18382
18408
|
...config,
|
|
18383
18409
|
scrollTop,
|
|
18384
|
-
viewportHeight:
|
|
18410
|
+
viewportHeight: offsetHeight
|
|
18385
18411
|
}));
|
|
18386
18412
|
}
|
|
18387
18413
|
initialize() {
|