@worktile/theia 20.1.0-next.0 → 20.1.0-next.10
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.
|
@@ -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, EDITOR_TO_VIRTUAL_SCROLL_SELECTION, 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';
|
|
@@ -3906,9 +3906,6 @@ const withTheia = (editor, plugins = []) => {
|
|
|
3906
3906
|
e.isContainer = (value) => false;
|
|
3907
3907
|
e.globalMousedown = (event) => null;
|
|
3908
3908
|
e.mousedown = (event) => { };
|
|
3909
|
-
e.isVisible = (element) => {
|
|
3910
|
-
return true;
|
|
3911
|
-
};
|
|
3912
3909
|
e.extraElementOptions = [];
|
|
3913
3910
|
e.disabled = false;
|
|
3914
3911
|
e.plugins = [];
|
|
@@ -10785,9 +10782,13 @@ class TheTable extends TheBaseElement {
|
|
|
10785
10782
|
});
|
|
10786
10783
|
}
|
|
10787
10784
|
updateHorizontalScrollbar() {
|
|
10785
|
+
this.syncMouseOverState();
|
|
10788
10786
|
this.updateScrollbarVisibility();
|
|
10789
10787
|
this.updateScrollbarFixedState();
|
|
10790
10788
|
}
|
|
10789
|
+
syncMouseOverState() {
|
|
10790
|
+
this.isMouseOverTable = this.nativeElement.matches(':hover');
|
|
10791
|
+
}
|
|
10791
10792
|
// 更新横向滚动条可见性
|
|
10792
10793
|
updateScrollbarVisibility() {
|
|
10793
10794
|
if (!this.tableWrapper || !this.horizontalScrollbarContainer || !this.horizontalScrollbarContent) {
|
|
@@ -11194,9 +11195,13 @@ class TheQuickInsert {
|
|
|
11194
11195
|
}
|
|
11195
11196
|
updateIconDisplay() {
|
|
11196
11197
|
const { editor } = this;
|
|
11198
|
+
const virtualScrollSelection = EDITOR_TO_VIRTUAL_SCROLL_SELECTION.get(editor);
|
|
11199
|
+
const conditionWithVirtualScroll = !AngularEditor.isEnabledVirtualScroll(editor) ||
|
|
11200
|
+
(editor.selection && virtualScrollSelection && Range.equals(virtualScrollSelection, editor.selection));
|
|
11197
11201
|
if (this.isVisible &&
|
|
11198
11202
|
!QuickInsertEditor.isOpenedMenu(editor) &&
|
|
11199
11203
|
isCleanEmptyParagraph(editor) &&
|
|
11204
|
+
conditionWithVirtualScroll &&
|
|
11200
11205
|
!this.hasExcludeAttribute() &&
|
|
11201
11206
|
!this.isRichMediaScope()) {
|
|
11202
11207
|
const block = Node.ancestor(editor, [editor?.selection?.anchor.path[0]]);
|
|
@@ -13327,7 +13332,7 @@ const createBlockCardPlugin = createPluginFactory({
|
|
|
13327
13332
|
});
|
|
13328
13333
|
|
|
13329
13334
|
const withInternalCommon = (editor) => {
|
|
13330
|
-
const { globalMousedown, onKeydown } = editor;
|
|
13335
|
+
const { globalMousedown, onKeydown, selectAll } = editor;
|
|
13331
13336
|
editor.globalMousedown = (event) => {
|
|
13332
13337
|
const target = event.target;
|
|
13333
13338
|
if (isColorIndicator(target)) {
|
|
@@ -13350,6 +13355,34 @@ const withInternalCommon = (editor) => {
|
|
|
13350
13355
|
}
|
|
13351
13356
|
onKeydown(event);
|
|
13352
13357
|
};
|
|
13358
|
+
editor.selectAll = () => {
|
|
13359
|
+
let node = null;
|
|
13360
|
+
if (!editor.selection) {
|
|
13361
|
+
setEndSelection(editor);
|
|
13362
|
+
}
|
|
13363
|
+
const [start, end] = Range.edges(editor.selection);
|
|
13364
|
+
const selectionRange = Editor.range(editor, start, end);
|
|
13365
|
+
const containerBlocks = getContainerBlocks(editor);
|
|
13366
|
+
for (let i = 0; i < containerBlocks.length; i++) {
|
|
13367
|
+
[node] = getNodesByType(editor, containerBlocks[i]);
|
|
13368
|
+
if (node) {
|
|
13369
|
+
const [, path] = node;
|
|
13370
|
+
const isStartParent = Path.equals(path, start.path.slice(0, path.length));
|
|
13371
|
+
const isEndParent = Path.equals(path, end.path.slice(0, path.length));
|
|
13372
|
+
if (isStartParent && isEndParent) {
|
|
13373
|
+
const nodeRange = Editor.range(editor, path);
|
|
13374
|
+
if (!Range.equals(nodeRange, selectionRange)) {
|
|
13375
|
+
Transforms.select(editor, nodeRange);
|
|
13376
|
+
break;
|
|
13377
|
+
}
|
|
13378
|
+
node = null;
|
|
13379
|
+
}
|
|
13380
|
+
}
|
|
13381
|
+
}
|
|
13382
|
+
if (!node) {
|
|
13383
|
+
Transforms.select(editor, []);
|
|
13384
|
+
}
|
|
13385
|
+
};
|
|
13353
13386
|
return editor;
|
|
13354
13387
|
};
|
|
13355
13388
|
const createCommonPlugin = (locale) => createPluginFactory({
|
|
@@ -14273,7 +14306,6 @@ class TheImage extends TheBaseElement {
|
|
|
14273
14306
|
}
|
|
14274
14307
|
];
|
|
14275
14308
|
this.dragable = false;
|
|
14276
|
-
this.resolveImageHeight = null;
|
|
14277
14309
|
this.beforeContextChange = (value) => {
|
|
14278
14310
|
if (value.element !== this.element && value.element.thumbUrl) {
|
|
14279
14311
|
let thumbUrl = value.element.thumbUrl;
|
|
@@ -14313,6 +14345,10 @@ class TheImage extends TheBaseElement {
|
|
|
14313
14345
|
this.subscribeMouseUp();
|
|
14314
14346
|
this.subscribeImageUploadingState();
|
|
14315
14347
|
}
|
|
14348
|
+
afterViewInit() {
|
|
14349
|
+
super.afterViewInit();
|
|
14350
|
+
this.setImageMinHeight();
|
|
14351
|
+
}
|
|
14316
14352
|
onContextChange() {
|
|
14317
14353
|
super.onContextChange();
|
|
14318
14354
|
if (this.initialized && !isMobileMode(this.editor)) {
|
|
@@ -14325,6 +14361,9 @@ class TheImage extends TheBaseElement {
|
|
|
14325
14361
|
}
|
|
14326
14362
|
}
|
|
14327
14363
|
ngOnDestroy() {
|
|
14364
|
+
if (this.imageLoadedCacheHeightTimer) {
|
|
14365
|
+
clearTimeout(this.imageLoadedCacheHeightTimer);
|
|
14366
|
+
}
|
|
14328
14367
|
this.uploadingSubscription.unsubscribe();
|
|
14329
14368
|
this.theContextService.removeUploadFile(this.fileItem);
|
|
14330
14369
|
if (this.uploading) {
|
|
@@ -14332,6 +14371,37 @@ class TheImage extends TheBaseElement {
|
|
|
14332
14371
|
}
|
|
14333
14372
|
super.ngOnDestroy();
|
|
14334
14373
|
}
|
|
14374
|
+
cacheImageHeight(height) {
|
|
14375
|
+
if (!AngularEditor.isEnabledVirtualScroll(this.editor)) {
|
|
14376
|
+
return;
|
|
14377
|
+
}
|
|
14378
|
+
const heights = ELEMENT_KEY_TO_HEIGHTS.get(this.editor);
|
|
14379
|
+
const key = AngularEditor.findKey(this.editor, this.element);
|
|
14380
|
+
heights.set(key.id, height);
|
|
14381
|
+
}
|
|
14382
|
+
setImageMinHeight() {
|
|
14383
|
+
if (!AngularEditor.isEnabledVirtualScroll(this.editor)) {
|
|
14384
|
+
return;
|
|
14385
|
+
}
|
|
14386
|
+
const heights = ELEMENT_KEY_TO_HEIGHTS.get(this.editor);
|
|
14387
|
+
const key = AngularEditor.findKey(this.editor, this.element);
|
|
14388
|
+
if (heights && heights.get(key.id)) {
|
|
14389
|
+
const blockCard = getBlockCardByNativeElement(this.nativeElement);
|
|
14390
|
+
if (blockCard) {
|
|
14391
|
+
const style = getComputedStyle(blockCard);
|
|
14392
|
+
blockCard.style.minHeight = heights.get(key.id) - parseFloat(style.marginTop) - parseFloat(style.marginBottom) + 'px';
|
|
14393
|
+
}
|
|
14394
|
+
}
|
|
14395
|
+
}
|
|
14396
|
+
clearMinHeight() {
|
|
14397
|
+
if (!AngularEditor.isEnabledVirtualScroll(this.editor)) {
|
|
14398
|
+
return;
|
|
14399
|
+
}
|
|
14400
|
+
const blockCard = getBlockCardByNativeElement(this.nativeElement);
|
|
14401
|
+
if (blockCard) {
|
|
14402
|
+
blockCard.style.minHeight = '';
|
|
14403
|
+
}
|
|
14404
|
+
}
|
|
14335
14405
|
setImagePluginOptions() {
|
|
14336
14406
|
this.imagePluginOptions = getPluginOptions(this.editor, PluginKeys.image);
|
|
14337
14407
|
}
|
|
@@ -14484,6 +14554,7 @@ class TheImage extends TheBaseElement {
|
|
|
14484
14554
|
width: this.imageEntry.width,
|
|
14485
14555
|
height: this.imageEntry.height
|
|
14486
14556
|
}, { at: this.selection });
|
|
14557
|
+
this.cacheImageHeight(this.getRealHeight());
|
|
14487
14558
|
}
|
|
14488
14559
|
}
|
|
14489
14560
|
cancelUpload() {
|
|
@@ -14568,14 +14639,15 @@ class TheImage extends TheBaseElement {
|
|
|
14568
14639
|
.withPositions([bottomPosition]);
|
|
14569
14640
|
}
|
|
14570
14641
|
imageLoaded(event) {
|
|
14642
|
+
this.clearMinHeight();
|
|
14571
14643
|
const img = event.target;
|
|
14572
14644
|
this.naturalWidth = img.naturalWidth;
|
|
14573
14645
|
this.naturalHeight = img.naturalHeight;
|
|
14574
|
-
|
|
14575
|
-
|
|
14576
|
-
|
|
14577
|
-
|
|
14578
|
-
}
|
|
14646
|
+
if (AngularEditor.isEnabledVirtualScroll(this.editor)) {
|
|
14647
|
+
this.imageLoadedCacheHeightTimer = setTimeout(() => {
|
|
14648
|
+
this.cacheImageHeight(this.getRealHeight());
|
|
14649
|
+
}, 0);
|
|
14650
|
+
}
|
|
14579
14651
|
}
|
|
14580
14652
|
imageError(event) {
|
|
14581
14653
|
const img = event.target;
|
|
@@ -14622,11 +14694,6 @@ class TheImage extends TheBaseElement {
|
|
|
14622
14694
|
});
|
|
14623
14695
|
}
|
|
14624
14696
|
}
|
|
14625
|
-
getRealHeight() {
|
|
14626
|
-
return new Promise(resolve => {
|
|
14627
|
-
this.resolveImageHeight = resolve;
|
|
14628
|
-
});
|
|
14629
|
-
}
|
|
14630
14697
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TheImage, deps: [{ token: i0.ChangeDetectorRef }, { token: i1$1.ThyImageGroup }, { token: THE_IMAGE_SERVICE_TOKEN }, { token: TheContextService }, { token: i1.ThyPopover }, { token: i2.Overlay }, { token: i0.DestroyRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
14631
14698
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.14", type: TheImage, isStandalone: true, selector: "the-image, [theImage]", providers: [ThyImageService], viewQueries: [{ propertyName: "imageContent", first: true, predicate: ["imageContent"], descendants: true }, { propertyName: "img", first: true, predicate: ["img"], descendants: true }, { propertyName: "layoutToolbar", first: true, predicate: ["layoutToolbar"], descendants: true, static: true }, { propertyName: "imageDirective", first: true, predicate: ThyImageDirective, descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"the-image-container\" contenteditable=\"false\" [style.textAlign]=\"imageEntry.align\">\n @if (imageEntry.thumbUrl) {\n <div #imageContent class=\"image-content\" contenteditable=\"false\" [class.cursor-pointer]=\"!selection\">\n <img\n #img\n thyImage\n class=\"main-image\"\n [class.image-collapsed]=\"selection && !uploading\"\n [ngStyle]=\"{ 'width.px': imageBindingWidth }\"\n [alt]=\"imageEntry.name\"\n [thySrc]=\"imageEntry.thumbUrl\"\n [thyPreviewSrc]=\"imageEntry.thumbUrl\"\n [thyOriginSrc]=\"imageEntry.originUrl\"\n [thyDisablePreview]=\"disablePreview\"\n [thyImageMeta]=\"{ name: imageEntry.name, size: imageEntry.size }\"\n (load)=\"imageLoaded($event)\"\n (mousedown)=\"preventDefault($event)\"\n (error)=\"imageError($event)\"\n (click)=\"imageClick($event)\"\n />\n @if (isCollapsedAndNonReadonly) {\n <div class=\"image-profile\" [class.outline]=\"selection\">\n @if (!loadImageError) {\n <span (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left top\"></span>\n <span (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right top\"></span>\n <span (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right bottom\"></span>\n <span (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left bottom\"></span>\n }\n </div>\n }\n <ng-template [ngTemplateOutlet]=\"imageUploading\"></ng-template>\n @if (!uploading) {\n <div class=\"layer\" [class.readonly]=\"readonly\"></div>\n }\n </div>\n } @else {\n @if (!imageEntry.thumbUrl) {\n <div class=\"image-loading cursor-pointer\" contenteditable=\"false\">\n <thy-icon thyIconName=\"image\"></thy-icon>\n </div>\n }\n <ng-template [ngTemplateOutlet]=\"imageUploading\"></ng-template>\n }\n</div>\n\n<ng-template #layoutToolbar>\n <thy-actions thySize=\"xxs\">\n @for (item of layoutOptions; track $index) {\n @if (item.key !== 'split') {\n <a\n href=\"javascript:;\"\n thyAction\n [thyType]=\"item.key === 'remove' ? 'danger' : 'primary'\"\n [thyActionIcon]=\"item.icon\"\n [thyActionActive]=\"layoutActive(item.key)\"\n [thyTooltip]=\"item.name\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"item?.handle($event, item.key)\"\n ></a>\n }\n @if (item.key === 'split') {\n <thy-divider class=\"mr-2 ml-1 align-self-center\" [thyVertical]=\"true\" thyColor=\"light\"></thy-divider>\n }\n }\n </thy-actions>\n</ng-template>\n\n<ng-template #imageUploading>\n @if (uploading) {\n <div class=\"uploading\">\n <div class=\"uploading-percentage\">\n <thy-progress thyType=\"primary\" [thyValue]=\"percentage\" thySize=\"sm\"></thy-progress>\n <thy-icon (click)=\"cancelUpload($event)\" thyIconName=\"close-circle-bold-fill\" thyIconLegging=\"true\"> </thy-icon>\n </div>\n </div>\n }\n</ng-template>\n", dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "directive", type: ThyImageDirective, selector: "img[thyImage]", inputs: ["thySrc", "thyPreviewSrc", "thyOriginSrc", "thyImageMeta", "thyDisablePreview", "thyResolveSize"], exportAs: ["thyImage"] }, { kind: "component", type: ThyAction, selector: "thy-action, [thyAction]", inputs: ["thyType", "thyIcon", "thyActionIcon", "thyActive", "thyActionActive", "thyTheme", "thyHoverIcon", "thyDisabled"] }, { kind: "component", type: ThyDivider, selector: "thy-divider", inputs: ["thyVertical", "thyStyle", "thyColor", "thyText", "thyTextDirection", "thyDeeper"] }, { kind: "component", type: ThyActions, selector: "thy-actions", inputs: ["thySize"] }, { kind: "directive", type: ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { kind: "component", type: ThyProgress, selector: "thy-progress", inputs: ["thyType", "thySize", "thyValue", "thyMax", "thyTips", "thyShape", "thyGapDegree", "thyGapPosition", "thyStrokeWidth"] }] }); }
|
|
14632
14699
|
}
|
|
@@ -18206,12 +18273,12 @@ class TheEditorComponent {
|
|
|
18206
18273
|
this.theUploadingStatus = new EventEmitter(); // true 上传结束 false 上传中
|
|
18207
18274
|
this.visibleQuickInsertPlus = true;
|
|
18208
18275
|
this.elementToHtml = new WeakMap();
|
|
18209
|
-
this.
|
|
18276
|
+
this.virtualScrollConfig = signal({
|
|
18210
18277
|
enabled: false,
|
|
18211
18278
|
scrollTop: 0,
|
|
18212
18279
|
viewportHeight: 0,
|
|
18213
18280
|
bufferCount: 5
|
|
18214
|
-
}, ...(ngDevMode ? [{ debugName: "
|
|
18281
|
+
}, ...(ngDevMode ? [{ debugName: "virtualScrollConfig" }] : []));
|
|
18215
18282
|
this.onChangeCallback = () => { };
|
|
18216
18283
|
this.onTouchedCallback = () => { };
|
|
18217
18284
|
this.locale = injectTranslations(inject(TheI18nService));
|
|
@@ -18261,9 +18328,6 @@ class TheEditorComponent {
|
|
|
18261
18328
|
event.preventDefault();
|
|
18262
18329
|
return;
|
|
18263
18330
|
}
|
|
18264
|
-
if (isKeyHotkey('mod+a', event) && !event.defaultPrevented) {
|
|
18265
|
-
this.handleSelectAll(event);
|
|
18266
|
-
}
|
|
18267
18331
|
};
|
|
18268
18332
|
this.onClick = (event) => {
|
|
18269
18333
|
AngularEditor.onClick(this.editor, event);
|
|
@@ -18305,7 +18369,7 @@ class TheEditorComponent {
|
|
|
18305
18369
|
initializeDefaultMenuIcons(this.iconRegistry);
|
|
18306
18370
|
}
|
|
18307
18371
|
ngAfterViewInit() {
|
|
18308
|
-
this.
|
|
18372
|
+
this.listenScrollEvent();
|
|
18309
18373
|
}
|
|
18310
18374
|
ngOnChanges(changes) {
|
|
18311
18375
|
const options = changes.theOptions;
|
|
@@ -18326,25 +18390,22 @@ class TheEditorComponent {
|
|
|
18326
18390
|
}
|
|
18327
18391
|
}
|
|
18328
18392
|
ngOnDestroy() {
|
|
18329
|
-
this.scrollContainerResizeObserver?.disconnect();
|
|
18330
18393
|
THE_EDITOR_PREVIOUS_SELECTION.delete(this.editor);
|
|
18331
18394
|
}
|
|
18332
|
-
|
|
18395
|
+
listenScrollEvent() {
|
|
18396
|
+
if (!this.virtualScrollConfig().enabled) {
|
|
18397
|
+
return;
|
|
18398
|
+
}
|
|
18333
18399
|
const scrollContainer = this.theContextService.getScrollContainer();
|
|
18334
18400
|
if (!scrollContainer) {
|
|
18335
18401
|
return;
|
|
18336
18402
|
}
|
|
18337
|
-
this.scrollContainerElement = scrollContainer;
|
|
18338
|
-
this.scrollContainerResizeObserver = new ResizeObserver(() => {
|
|
18339
|
-
this.syncVirtualConfig();
|
|
18340
|
-
});
|
|
18341
|
-
this.scrollContainerResizeObserver.observe(scrollContainer);
|
|
18342
18403
|
this.ngZone.runOutsideAngular(() => {
|
|
18343
18404
|
fromEvent(scrollContainer, 'scroll')
|
|
18344
18405
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
18345
18406
|
.subscribe(() => {
|
|
18346
18407
|
if (!JUST_NOW_UPDATED_VIRTUAL_VIEW.get(this.editor)) {
|
|
18347
|
-
this.
|
|
18408
|
+
this.updateVirtualConfig();
|
|
18348
18409
|
}
|
|
18349
18410
|
else {
|
|
18350
18411
|
if (localStorage.getItem(SLATE_DEBUG_KEY)) {
|
|
@@ -18353,26 +18414,26 @@ class TheEditorComponent {
|
|
|
18353
18414
|
JUST_NOW_UPDATED_VIRTUAL_VIEW.set(this.editor, false);
|
|
18354
18415
|
}
|
|
18355
18416
|
});
|
|
18417
|
+
this.updateVirtualConfig();
|
|
18356
18418
|
});
|
|
18357
|
-
this.syncVirtualConfig();
|
|
18358
18419
|
}
|
|
18359
|
-
|
|
18360
|
-
|
|
18420
|
+
updateVirtualConfig() {
|
|
18421
|
+
const scrollContainer = this.theContextService.getScrollContainer();
|
|
18422
|
+
if (!this.virtualScrollConfig().enabled || !scrollContainer) {
|
|
18361
18423
|
return;
|
|
18362
18424
|
}
|
|
18363
|
-
const { scrollTop,
|
|
18364
|
-
|
|
18365
|
-
if (localStorage.getItem(SLATE_DEBUG_KEY)) {
|
|
18425
|
+
const { scrollTop, offsetHeight } = scrollContainer;
|
|
18426
|
+
if (localStorage.getItem(SLATE_DEBUG_KEY + '__SCROLL_TOP')) {
|
|
18366
18427
|
console.log(`theia: scroll event fired from user: ${scrollTop}`);
|
|
18367
18428
|
}
|
|
18368
|
-
this.
|
|
18429
|
+
this.virtualScrollConfig.update(config => ({
|
|
18369
18430
|
...config,
|
|
18370
18431
|
scrollTop,
|
|
18371
|
-
viewportHeight:
|
|
18432
|
+
viewportHeight: offsetHeight
|
|
18372
18433
|
}));
|
|
18373
18434
|
}
|
|
18374
18435
|
initialize() {
|
|
18375
|
-
this.
|
|
18436
|
+
this.virtualScrollConfig.update(config => ({
|
|
18376
18437
|
...config,
|
|
18377
18438
|
enabled: this.theOptions?.enableVirtualScroll
|
|
18378
18439
|
}));
|
|
@@ -18570,42 +18631,12 @@ class TheEditorComponent {
|
|
|
18570
18631
|
mousedown(event) {
|
|
18571
18632
|
this.editor.mousedown(event);
|
|
18572
18633
|
}
|
|
18573
|
-
handleSelectAll(event) {
|
|
18574
|
-
let node = null;
|
|
18575
|
-
if (!this.editor.selection) {
|
|
18576
|
-
setEndSelection(this.editor);
|
|
18577
|
-
}
|
|
18578
|
-
const [start, end] = Range.edges(this.editor.selection);
|
|
18579
|
-
const selectionRange = Editor.range(this.editor, start, end);
|
|
18580
|
-
const containerBlocks = getContainerBlocks(this.editor);
|
|
18581
|
-
for (let i = 0; i < containerBlocks.length; i++) {
|
|
18582
|
-
[node] = getNodesByType(this.editor, containerBlocks[i]);
|
|
18583
|
-
if (node) {
|
|
18584
|
-
const [, path] = node;
|
|
18585
|
-
const isStartParent = Path.equals(path, start.path.slice(0, path.length));
|
|
18586
|
-
const isEndParent = Path.equals(path, end.path.slice(0, path.length));
|
|
18587
|
-
if (isStartParent && isEndParent) {
|
|
18588
|
-
const nodeRange = Editor.range(this.editor, path);
|
|
18589
|
-
if (!Range.equals(nodeRange, selectionRange)) {
|
|
18590
|
-
Transforms.select(this.editor, nodeRange);
|
|
18591
|
-
break;
|
|
18592
|
-
}
|
|
18593
|
-
node = null;
|
|
18594
|
-
}
|
|
18595
|
-
}
|
|
18596
|
-
}
|
|
18597
|
-
if (!node) {
|
|
18598
|
-
Transforms.select(this.editor, []);
|
|
18599
|
-
}
|
|
18600
|
-
event.preventDefault();
|
|
18601
|
-
return;
|
|
18602
|
-
}
|
|
18603
18634
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TheEditorComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.DestroyRef }, { token: i0.ElementRef }, { token: i0.Injector }, { token: i0.NgZone }, { token: i0.ViewContainerRef }, { token: TheContextService }, { token: i2$5.ThyIconRegistry }, { token: THE_PRESET_CONFIG_TOKEN, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
18604
18635
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.14", type: TheEditorComponent, isStandalone: true, selector: "the-editor, theEditor", inputs: { theOptions: "theOptions", thePlugins: "thePlugins", theGlobalToolbar: "theGlobalToolbar", theDecorate: "theDecorate", theOnError: "theOnError" }, outputs: { theOnSave: "theOnSave", theOnDOMEvent: "theOnDOMEvent", theEditorCreated: "theEditorCreated", theUploadingStatus: "theUploadingStatus" }, host: { properties: { "class.the-editor-readonly": "editor.options?.readonly", "class.the-mobile-editor": "isMobileMode" }, classAttribute: "the-editor" }, providers: [
|
|
18605
18636
|
TheContextService,
|
|
18606
18637
|
{ provide: TheToolbarGroupToken, useValue: TheToolbarGroup },
|
|
18607
18638
|
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => TheEditorComponent), multi: true }
|
|
18608
|
-
], viewQueries: [{ propertyName: "theEditableContainer", first: true, predicate: ["theEditableContainer"], descendants: true, read: ElementRef, static: true }, { propertyName: "globalToolbarInstance", first: true, predicate: ["globalToolbar"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "@if (!options?.readonly && !theGlobalToolbar && !isMobileMode) {\n <the-toolbar\n [ngClass]=\"{\n 'the-toolbar-disabled': options?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.global\"\n [containerClass]=\"globalToolbarClass\"\n [align]=\"options?.toolbar?.align\"\n ></the-toolbar>\n}\n\n<div\n #theEditableContainer\n class=\"the-editable-container\"\n thyImageGroup\n [ngClass]=\"{\n 'the-editor-disabled': options?.disabled,\n 'max-height': maxHeight\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n [renderElement]=\"renderElement\"\n [renderText]=\"renderText\"\n [renderLeaf]=\"renderLeaf\"\n [isStrictDecorate]=\"false\"\n [decorate]=\"decorate\"\n [placeholder]=\"options?.placeholder\"\n [placeholderDecorate]=\"options?.placeholderDecorate ? options?.placeholderDecorate : null\"\n [readonly]=\"options?.readonly || options?.disabled\"\n [keydown]=\"onKeyDown\"\n [click]=\"onClick\"\n [paste]=\"onSlaPaste\"\n [blur]=\"onSlaBlur\"\n [focus]=\"onSlaFocus\"\n [copy]=\"onSlaCopy\"\n [cut]=\"onSlaCut\"\n [beforeInput]=\"onSlaBeforeInput\"\n [compositionStart]=\"onSlaCompositionStart\"\n [compositionEnd]=\"onSlaCompositionEnd\"\n [dragStart]=\"onSlaDragStart\"\n [dragOver]=\"onSlaDragOver\"\n [drop]=\"onDrop\"\n [scrollSelectionIntoView]=\"scrollSelectionIntoView\"\n [virtualScroll]=\"
|
|
18639
|
+
], viewQueries: [{ propertyName: "theEditableContainer", first: true, predicate: ["theEditableContainer"], descendants: true, read: ElementRef, static: true }, { propertyName: "globalToolbarInstance", first: true, predicate: ["globalToolbar"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "@if (!options?.readonly && !theGlobalToolbar && !isMobileMode) {\n <the-toolbar\n [ngClass]=\"{\n 'the-toolbar-disabled': options?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.global\"\n [containerClass]=\"globalToolbarClass\"\n [align]=\"options?.toolbar?.align\"\n ></the-toolbar>\n}\n\n<div\n #theEditableContainer\n class=\"the-editable-container\"\n thyImageGroup\n [ngClass]=\"{\n 'the-editor-disabled': options?.disabled,\n 'max-height': maxHeight\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n [renderElement]=\"renderElement\"\n [renderText]=\"renderText\"\n [renderLeaf]=\"renderLeaf\"\n [isStrictDecorate]=\"false\"\n [decorate]=\"decorate\"\n [placeholder]=\"options?.placeholder\"\n [placeholderDecorate]=\"options?.placeholderDecorate ? options?.placeholderDecorate : null\"\n [readonly]=\"options?.readonly || options?.disabled\"\n [keydown]=\"onKeyDown\"\n [click]=\"onClick\"\n [paste]=\"onSlaPaste\"\n [blur]=\"onSlaBlur\"\n [focus]=\"onSlaFocus\"\n [copy]=\"onSlaCopy\"\n [cut]=\"onSlaCut\"\n [beforeInput]=\"onSlaBeforeInput\"\n [compositionStart]=\"onSlaCompositionStart\"\n [compositionEnd]=\"onSlaCompositionEnd\"\n [dragStart]=\"onSlaDragStart\"\n [dragOver]=\"onSlaDragOver\"\n [drop]=\"onDrop\"\n [scrollSelectionIntoView]=\"scrollSelectionIntoView\"\n [virtualScroll]=\"virtualScrollConfig()\"\n (ngModelChange)=\"valueChange($event)\"\n (mousedown)=\"mousedown($event)\"\n ></slate-editable>\n\n @if (!isMobileMode) {\n @if (!options?.readonly && options?.inlineToolbarVisible) {\n <the-inline-toolbar [editor]=\"editor\" [toolbarItems]=\"toolbarEntity.inline\"></the-inline-toolbar>\n }\n @if (!options?.readonly) {\n <div theQuickInsert [editor]=\"editor\" [isVisible]=\"visibleQuickInsertPlus\"></div>\n }\n }\n</div>\n", dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: SlateModule }, { kind: "component", type: i4.SlateEditable, selector: "slate-editable", inputs: ["editor", "renderElement", "renderLeaf", "renderText", "decorate", "placeholderDecorate", "scrollSelectionIntoView", "isStrictDecorate", "trackBy", "readonly", "placeholder", "virtualScroll", "beforeInput", "blur", "click", "compositionEnd", "compositionUpdate", "compositionStart", "copy", "cut", "dragOver", "dragStart", "dragEnd", "drop", "focus", "keydown", "paste", "spellCheck", "autoCorrect", "autoCapitalize"] }, { kind: "component", type: TheQuickInsert, selector: "[theQuickInsert]", inputs: ["editor", "isVisible"] }, { kind: "component", type: TheInlineToolbar, selector: "the-inline-toolbar", inputs: ["editor", "toolbarItems"] }, { kind: "component", type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "containerClass", "isMore", "afterTemplate"] }, { kind: "component", type: ThyImageGroup, selector: "thy-image-group, [thyImageGroup]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
18609
18640
|
}
|
|
18610
18641
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImport: i0, type: TheEditorComponent, decorators: [{
|
|
18611
18642
|
type: Component,
|
|
@@ -18613,7 +18644,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.14", ngImpo
|
|
|
18613
18644
|
TheContextService,
|
|
18614
18645
|
{ provide: TheToolbarGroupToken, useValue: TheToolbarGroup },
|
|
18615
18646
|
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => TheEditorComponent), multi: true }
|
|
18616
|
-
], template: "@if (!options?.readonly && !theGlobalToolbar && !isMobileMode) {\n <the-toolbar\n [ngClass]=\"{\n 'the-toolbar-disabled': options?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.global\"\n [containerClass]=\"globalToolbarClass\"\n [align]=\"options?.toolbar?.align\"\n ></the-toolbar>\n}\n\n<div\n #theEditableContainer\n class=\"the-editable-container\"\n thyImageGroup\n [ngClass]=\"{\n 'the-editor-disabled': options?.disabled,\n 'max-height': maxHeight\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n [renderElement]=\"renderElement\"\n [renderText]=\"renderText\"\n [renderLeaf]=\"renderLeaf\"\n [isStrictDecorate]=\"false\"\n [decorate]=\"decorate\"\n [placeholder]=\"options?.placeholder\"\n [placeholderDecorate]=\"options?.placeholderDecorate ? options?.placeholderDecorate : null\"\n [readonly]=\"options?.readonly || options?.disabled\"\n [keydown]=\"onKeyDown\"\n [click]=\"onClick\"\n [paste]=\"onSlaPaste\"\n [blur]=\"onSlaBlur\"\n [focus]=\"onSlaFocus\"\n [copy]=\"onSlaCopy\"\n [cut]=\"onSlaCut\"\n [beforeInput]=\"onSlaBeforeInput\"\n [compositionStart]=\"onSlaCompositionStart\"\n [compositionEnd]=\"onSlaCompositionEnd\"\n [dragStart]=\"onSlaDragStart\"\n [dragOver]=\"onSlaDragOver\"\n [drop]=\"onDrop\"\n [scrollSelectionIntoView]=\"scrollSelectionIntoView\"\n [virtualScroll]=\"
|
|
18647
|
+
], template: "@if (!options?.readonly && !theGlobalToolbar && !isMobileMode) {\n <the-toolbar\n [ngClass]=\"{\n 'the-toolbar-disabled': options?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.global\"\n [containerClass]=\"globalToolbarClass\"\n [align]=\"options?.toolbar?.align\"\n ></the-toolbar>\n}\n\n<div\n #theEditableContainer\n class=\"the-editable-container\"\n thyImageGroup\n [ngClass]=\"{\n 'the-editor-disabled': options?.disabled,\n 'max-height': maxHeight\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n [renderElement]=\"renderElement\"\n [renderText]=\"renderText\"\n [renderLeaf]=\"renderLeaf\"\n [isStrictDecorate]=\"false\"\n [decorate]=\"decorate\"\n [placeholder]=\"options?.placeholder\"\n [placeholderDecorate]=\"options?.placeholderDecorate ? options?.placeholderDecorate : null\"\n [readonly]=\"options?.readonly || options?.disabled\"\n [keydown]=\"onKeyDown\"\n [click]=\"onClick\"\n [paste]=\"onSlaPaste\"\n [blur]=\"onSlaBlur\"\n [focus]=\"onSlaFocus\"\n [copy]=\"onSlaCopy\"\n [cut]=\"onSlaCut\"\n [beforeInput]=\"onSlaBeforeInput\"\n [compositionStart]=\"onSlaCompositionStart\"\n [compositionEnd]=\"onSlaCompositionEnd\"\n [dragStart]=\"onSlaDragStart\"\n [dragOver]=\"onSlaDragOver\"\n [drop]=\"onDrop\"\n [scrollSelectionIntoView]=\"scrollSelectionIntoView\"\n [virtualScroll]=\"virtualScrollConfig()\"\n (ngModelChange)=\"valueChange($event)\"\n (mousedown)=\"mousedown($event)\"\n ></slate-editable>\n\n @if (!isMobileMode) {\n @if (!options?.readonly && options?.inlineToolbarVisible) {\n <the-inline-toolbar [editor]=\"editor\" [toolbarItems]=\"toolbarEntity.inline\"></the-inline-toolbar>\n }\n @if (!options?.readonly) {\n <div theQuickInsert [editor]=\"editor\" [isVisible]=\"visibleQuickInsertPlus\"></div>\n }\n }\n</div>\n" }]
|
|
18617
18648
|
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.DestroyRef }, { type: i0.ElementRef }, { type: i0.Injector }, { type: i0.NgZone }, { type: i0.ViewContainerRef }, { type: TheContextService }, { type: i2$5.ThyIconRegistry }, { type: undefined, decorators: [{
|
|
18618
18649
|
type: Optional
|
|
18619
18650
|
}, {
|