@worktile/theia 20.2.3 → 20.2.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.
@@ -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, ELEMENT_KEY_TO_HEIGHTS, getRealHeightByElement, isDebug, debugLog, DEFAULT_ELEMENT_HEIGHT, DefaultTextFlavour, defaultScrollSelectionIntoView, getDataTransferClipboard, 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, getCachedHeightByElement, isDebug, debugLog, 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';
@@ -10128,7 +10128,7 @@ class TheTable extends TheBaseElement {
10128
10128
  this.listenSelectstartEvent();
10129
10129
  this.listenTableContextMenuEvent();
10130
10130
  this.listenTableWrapperScroll();
10131
- this.subscribeScrollContainerScroll(this.tableWrapperLeft);
10131
+ this.subscribeScrollContainerScroll();
10132
10132
  this.initHorizontalScrollbar();
10133
10133
  if (isPrintMode) {
10134
10134
  this.cdr.markForCheck();
@@ -10188,15 +10188,12 @@ class TheTable extends TheBaseElement {
10188
10188
  }
10189
10189
  return { height, top };
10190
10190
  }
10191
- subscribeScrollContainerScroll(tableWrapperLeft) {
10191
+ subscribeScrollContainerScroll() {
10192
10192
  this.ngZone.runOutsideAngular(() => {
10193
10193
  this.contextService.containerScrolled$
10194
10194
  .pipe(takeUntil(this.destroy$), map$1(entires => {
10195
10195
  const { event, direction } = entires;
10196
10196
  if (direction === ScrollDirection.X) {
10197
- const { left } = this.nativeElement.getBoundingClientRect();
10198
- this.isScrolledXOfScrollContainer = tableWrapperLeft !== left;
10199
- this.tableWrapperLeft = left;
10200
10197
  this.setHeaderRowShadow();
10201
10198
  this.setStickyElementLeftStyle();
10202
10199
  }
@@ -10235,7 +10232,7 @@ class TheTable extends TheBaseElement {
10235
10232
  }
10236
10233
  }
10237
10234
  updateFreezeState() {
10238
- this.isFreezeRow = this.freezeRowPipe.transform(this.element, this.tablePluginOptions, this.editor);
10235
+ this.isFreezeRow = this.freezeRowPipe.transform(this.element, this.tablePluginOptions, this.editor) && this.children.length > 1;
10239
10236
  this.isFreezeColumn = this.freezeColumnPipe.transform(this.element, this.tablePluginOptions, this.tableWrapperWidth, this.editor);
10240
10237
  }
10241
10238
  setTableHeaderStyle() {
@@ -10283,8 +10280,10 @@ class TheTable extends TheBaseElement {
10283
10280
  }
10284
10281
  else {
10285
10282
  if (this.readonly) {
10286
- cellsWidth = getColumnsWidth(headerRow);
10287
- gridColumns = getGridColumns(headerRow, cellsWidth);
10283
+ // 预览模式且没有colgroup,使用数据行的宽度计算固定列宽
10284
+ const dataRow = this.tbodyElement.nativeElement.childNodes[1];
10285
+ cellsWidth = getColumnsWidth(dataRow);
10286
+ gridColumns = getGridColumns(dataRow, cellsWidth);
10288
10287
  }
10289
10288
  else {
10290
10289
  const columnCount = this.element.children[0].children.length;
@@ -10723,9 +10722,11 @@ class TheTable extends TheBaseElement {
10723
10722
  const cornerControl = this.cornerControl.nativeElement;
10724
10723
  const rowControl = this.rowControlsButtonWrapper.first?.nativeElement;
10725
10724
  const buffer = this.isInTable ? -TABLE_CONTROL : 0;
10726
- if (this.isStickyTop && this.isScrolledXOfScrollContainer) {
10725
+ if (this.isStickyTop) {
10726
+ this.getWrapperWidthAndLeft();
10727
+ const controlButtonBorder = 1;
10727
10728
  stickyRows.forEach((element) => {
10728
- this.renderer.setStyle(element, 'left', `${this.tableWrapperLeft}px`);
10729
+ this.renderer.setStyle(element, 'left', `${this.tableWrapperLeft + (this.readonly ? 0 : this.getColControlButtonWidth() - controlButtonBorder)}px`);
10729
10730
  });
10730
10731
  this.renderer.setStyle(cornerControl, 'left', `${this.tableWrapperLeft + buffer}px`);
10731
10732
  rowControl && this.renderer.setStyle(rowControl, 'left', `${this.tableWrapperLeft + buffer}px`);
@@ -11329,6 +11330,20 @@ function getCollapsedStandardHeadingAbove(editor, path) {
11329
11330
  }
11330
11331
  return linkedHeadingPaths;
11331
11332
  }
11333
+ function getPreviousHeading(editor, path, options) {
11334
+ const index = path[0];
11335
+ const linkedHeadingPaths = [];
11336
+ for (let i = index - 1; i >= 0; i--) {
11337
+ const element = editor.children[i];
11338
+ if (isStandardHeadingElement(element) && editor.isVisible(element)) {
11339
+ linkedHeadingPaths.push([i]);
11340
+ if (options?.isFirst) {
11341
+ return linkedHeadingPaths;
11342
+ }
11343
+ }
11344
+ }
11345
+ return linkedHeadingPaths;
11346
+ }
11332
11347
 
11333
11348
  class TheTableSelect {
11334
11349
  constructor(popoverRef) {
@@ -14390,7 +14405,7 @@ class TheImage extends TheBaseElement {
14390
14405
  if (!AngularEditor.isEnabledVirtualScroll(this.editor)) {
14391
14406
  return;
14392
14407
  }
14393
- const realHeight = getRealHeightByElement(this.editor, this.element);
14408
+ const realHeight = getCachedHeightByElement(this.editor, this.element);
14394
14409
  if (realHeight) {
14395
14410
  const blockCard = getBlockCardByNativeElement(this.nativeElement);
14396
14411
  if (blockCard) {
@@ -14577,7 +14592,7 @@ class TheImage extends TheBaseElement {
14577
14592
  width: this.imageEntry.width,
14578
14593
  height: this.imageEntry.height
14579
14594
  }, { at: this.selection });
14580
- this.cacheImageHeight(this.getRealHeight());
14595
+ this.cacheImageHeight(this.calcHeight());
14581
14596
  }
14582
14597
  }
14583
14598
  cancelUpload() {
@@ -14684,7 +14699,7 @@ class TheImage extends TheBaseElement {
14684
14699
  // }
14685
14700
  const result = this.clearMinHeight();
14686
14701
  if (!result) {
14687
- this.cacheImageHeight(this.getRealHeight());
14702
+ this.cacheImageHeight(this.calcHeight());
14688
14703
  }
14689
14704
  }, 0);
14690
14705
  }
@@ -19040,5 +19055,5 @@ const withTestPlugin = (plugins, initValue) => {
19040
19055
  * Generated bundle index. Do not edit.
19041
19056
  */
19042
19057
 
19043
- export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETE_BACKWARD_TYPES, BLOCK_HIDDEN_CLASS, BasicTest, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_DEFAULT_MAX_HEIGHT, CODEMIRROR_PADDING_TOP, CODE_MODES, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, ColorEditor, ColumnResizeNotifierSource, ColumnResizingStore, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DISABLED_OPERATE_TYPES, DataTransferFaker, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, EditorPresetConfigFactoryMock, ElementKinds, ErrorCodes, FontSizeTypes, FontSizes, HEADING_TYPES, HeaderLevelMap, HeadingEditor, HoveredCellInfo, HrEditor, IS_MAC, ImageEditor, IndentEditor, Indents, InlineCodeEditor, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LOWEST_TEXT_CONTAINER_TYPES, LayoutTypes, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, MentionEditor, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PluginKeys, PluginMenuIcons, PluginMenuSvgs, Position, QUICK_INSERT_HOTKEY, QuickInsertEditor, ROOT_ELEMENT_MARGIN_BOTTOM, ResizeRef, SLA_TABLE_CELL_SELECTOR, SLA_TABLE_SELECTOR, STANDARD_HEADING_TYPES, ScrollDirection, SpecialBackgroundColor, TAB_SPACE, THE_EDITOR_BG_COLOR, THE_EDITOR_COLOR, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_ORIGIN_ANCHOR, THE_EDITOR_POPOVER_REF, THE_EDITOR_PREVIOUS_SELECTION, THE_EDITOR_UUID, THE_I18N_DE_DE, THE_I18N_EN_US, THE_I18N_JA_JP, THE_I18N_LOCALE_ID, THE_I18N_RU_RU, THE_I18N_ZH_HANS, THE_I18N_ZH_HANT, THE_IMAGE_SERVICE_TOKEN, THE_LISTBOX_PARENT_GROUP_TOKEN, THE_LISTBOX_PARENT_OPTION_TOKEN, THE_LISTBOX_TOKEN, THE_MODE_PROVIDER, THE_MODE_TOKEN, THE_PLUGIN_MENU_REF, THE_PRESET_CONFIG_TOKEN, TableCellEventDispatcher, TableEditor, TableHeaderBackgroundColor, TablePosition, TheBaseElement, TheBaseSuggestion, TheBaseToolbarDropdown, TheBaseToolbarItem, TheCode, TheColumnResizeDirective, TheColumnResizeOverlayHandle, TheContextMenu, TheContextService, TheConversionHint, TheDataMode, TheEditor, TheEditorComponent, TheEditorModule, TheI18nService, TheImage, TheInlineToolbar, TheListboxDirective, TheListboxGroupDirective, TheListboxOptionDirective, TheLocaleType, TheMode, TheModeConfig, ThePluginMenu, ThePluginMenuComponent, ThePluginMenuItemType, ThePreventDefaultDirective, index$1 as TheQueries, TheQuickInsert, TheTable, TheTableSelect, TheToolbarComponent, TheToolbarDropdown, TheToolbarGroup, TheToolbarGroupToken, TheToolbarItem, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, autoFocus, base64toBlob, bottomLeftPosition, bottomRightPosition, buildPluginMenu, buildPluginMenuItemMap, buildQuickInsertMenus, calcPrintColumnWidth, calcSpanForColumn, calcSpanForRow, calculateHeaderRowHeight, calculateRowControls, coercePixelsFromCssValue, combinePlugins, copyNode, createBreakBarChar, createCell, createEmptyContent, createEmptyParagraph, createMentionPlugin, createPluginFactory, createRow, createTable, createTablePosition, createTest1Plugin, createTestPlugin, createToolbar, createVerticalAlignPlugin, customPluginMock, customPluginMockKey, dataDeserialize, dataSerializing, deDeLocale, deleteElementKey, enUsLocale, errorImageUrlMock, expandPreviousHeadings, extractFragment, extractFragmentByHTML, filterTextFormat, fixBlockWithoutParagraph, fixBlockWithoutText, flattenDeepPlugins, getCellPositionsFromRange, getCollapsedStandardHeadingAbove, getColsTotalWidth, getColumnsWidth, getDirtyElements, getEditorScrollContainer, getEditorUUID, getElementClassByPrefix, getElementHeight, getElementWidth, getEndBlock, getFollowElements, getGridColumns, getMode, getNextCell, getOriginCell, getPlugin, getPluginOptions, getPlugins, getPreviousRelatedHeadingElements, getRowsTotalHeight, getSelectCellNode, getSelectedCellPositions, getStartBlock, getTableByCell, getTableByRow, getTheDefaultPluginMenu, getToolbarClass, hasHeaderRow, hasNumberedColumn, headingOptions, htmlToTheia, idCreator, inValidTypes, initializeDefaultMenuIcons, injectTranslations, insertDataByInvalidType, internalPlugins, isCleanEmptyParagraph, isColorIndicator, isColorInput, isColorPanel, isDirectionKeydown, isHeadingElement, isInside, isMobileMode, isPrintMode, isPureEmptyParagraph, isPureHeading, isPureParagraph, isRangeInTable, isRectangularInTableCells, isSelectedAllCell, isSelectionInTable, isStandardHeadingElement, isStandardHeadingElementByType, isUrl, isVirtualKey, jaJpLocale, matchOptions, mergeArray, mergeDeepPlugins, mergeElementOptions, mergeOptions, nestedStructureByKey, normalizeValue, originOptions, plainToTheia, pluginKey, pluginKey1, pluginsByKey, reSelection, recursionNodes, refocus, ruRuLocale, setClipboardDataByDom, setEditorUUID, theTethysIconRegistryFaker, toggleClass, toggleHeadingRelatedElement, toggleProperty, toggleStyle, topLeftPosition, topRightPosition, uniqueCellPosition, updatePopoverPosition, withMention, withTestPlugin, withTheia, zhHansLocale, zhHantLocale };
19058
+ export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETE_BACKWARD_TYPES, BLOCK_HIDDEN_CLASS, BasicTest, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_DEFAULT_MAX_HEIGHT, CODEMIRROR_PADDING_TOP, CODE_MODES, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, ColorEditor, ColumnResizeNotifierSource, ColumnResizingStore, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DISABLED_OPERATE_TYPES, DataTransferFaker, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, EditorPresetConfigFactoryMock, ElementKinds, ErrorCodes, FontSizeTypes, FontSizes, HEADING_TYPES, HeaderLevelMap, HeadingEditor, HoveredCellInfo, HrEditor, IS_MAC, ImageEditor, IndentEditor, Indents, InlineCodeEditor, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LOWEST_TEXT_CONTAINER_TYPES, LayoutTypes, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, MentionEditor, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PluginKeys, PluginMenuIcons, PluginMenuSvgs, Position, QUICK_INSERT_HOTKEY, QuickInsertEditor, ROOT_ELEMENT_MARGIN_BOTTOM, ResizeRef, SLA_TABLE_CELL_SELECTOR, SLA_TABLE_SELECTOR, STANDARD_HEADING_TYPES, ScrollDirection, SpecialBackgroundColor, TAB_SPACE, THE_EDITOR_BG_COLOR, THE_EDITOR_COLOR, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_ORIGIN_ANCHOR, THE_EDITOR_POPOVER_REF, THE_EDITOR_PREVIOUS_SELECTION, THE_EDITOR_UUID, THE_I18N_DE_DE, THE_I18N_EN_US, THE_I18N_JA_JP, THE_I18N_LOCALE_ID, THE_I18N_RU_RU, THE_I18N_ZH_HANS, THE_I18N_ZH_HANT, THE_IMAGE_SERVICE_TOKEN, THE_LISTBOX_PARENT_GROUP_TOKEN, THE_LISTBOX_PARENT_OPTION_TOKEN, THE_LISTBOX_TOKEN, THE_MODE_PROVIDER, THE_MODE_TOKEN, THE_PLUGIN_MENU_REF, THE_PRESET_CONFIG_TOKEN, TableCellEventDispatcher, TableEditor, TableHeaderBackgroundColor, TablePosition, TheBaseElement, TheBaseSuggestion, TheBaseToolbarDropdown, TheBaseToolbarItem, TheCode, TheColumnResizeDirective, TheColumnResizeOverlayHandle, TheContextMenu, TheContextService, TheConversionHint, TheDataMode, TheEditor, TheEditorComponent, TheEditorModule, TheI18nService, TheImage, TheInlineToolbar, TheListboxDirective, TheListboxGroupDirective, TheListboxOptionDirective, TheLocaleType, TheMode, TheModeConfig, ThePluginMenu, ThePluginMenuComponent, ThePluginMenuItemType, ThePreventDefaultDirective, index$1 as TheQueries, TheQuickInsert, TheTable, TheTableSelect, TheToolbarComponent, TheToolbarDropdown, TheToolbarGroup, TheToolbarGroupToken, TheToolbarItem, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, autoFocus, base64toBlob, bottomLeftPosition, bottomRightPosition, buildPluginMenu, buildPluginMenuItemMap, buildQuickInsertMenus, calcPrintColumnWidth, calcSpanForColumn, calcSpanForRow, calculateHeaderRowHeight, calculateRowControls, coercePixelsFromCssValue, combinePlugins, copyNode, createBreakBarChar, createCell, createEmptyContent, createEmptyParagraph, createMentionPlugin, createPluginFactory, createRow, createTable, createTablePosition, createTest1Plugin, createTestPlugin, createToolbar, createVerticalAlignPlugin, customPluginMock, customPluginMockKey, dataDeserialize, dataSerializing, deDeLocale, deleteElementKey, enUsLocale, errorImageUrlMock, expandPreviousHeadings, extractFragment, extractFragmentByHTML, filterTextFormat, fixBlockWithoutParagraph, fixBlockWithoutText, flattenDeepPlugins, getCellPositionsFromRange, getCollapsedStandardHeadingAbove, getColsTotalWidth, getColumnsWidth, getDirtyElements, getEditorScrollContainer, getEditorUUID, getElementClassByPrefix, getElementHeight, getElementWidth, getEndBlock, getFollowElements, getGridColumns, getMode, getNextCell, getOriginCell, getPlugin, getPluginOptions, getPlugins, getPreviousHeading, getPreviousRelatedHeadingElements, getRowsTotalHeight, getSelectCellNode, getSelectedCellPositions, getStartBlock, getTableByCell, getTableByRow, getTheDefaultPluginMenu, getToolbarClass, hasHeaderRow, hasNumberedColumn, headingOptions, htmlToTheia, idCreator, inValidTypes, initializeDefaultMenuIcons, injectTranslations, insertDataByInvalidType, internalPlugins, isCleanEmptyParagraph, isColorIndicator, isColorInput, isColorPanel, isDirectionKeydown, isHeadingElement, isInside, isMobileMode, isPrintMode, isPureEmptyParagraph, isPureHeading, isPureParagraph, isRangeInTable, isRectangularInTableCells, isSelectedAllCell, isSelectionInTable, isStandardHeadingElement, isStandardHeadingElementByType, isUrl, isVirtualKey, jaJpLocale, matchOptions, mergeArray, mergeDeepPlugins, mergeElementOptions, mergeOptions, nestedStructureByKey, normalizeValue, originOptions, plainToTheia, pluginKey, pluginKey1, pluginsByKey, reSelection, recursionNodes, refocus, ruRuLocale, setClipboardDataByDom, setEditorUUID, theTethysIconRegistryFaker, toggleClass, toggleHeadingRelatedElement, toggleProperty, toggleStyle, topLeftPosition, topRightPosition, uniqueCellPosition, updatePopoverPosition, withMention, withTestPlugin, withTheia, zhHansLocale, zhHantLocale };
19044
19059
  //# sourceMappingURL=worktile-theia.mjs.map