@worktile/theia 3.1.0-next.2 → 3.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.
@@ -7,7 +7,7 @@ import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
7
7
  import * as i1 from 'slate-angular';
8
8
  import { BaseTextComponent, BaseElementComponent, AngularEditor, NODE_TO_PARENT, NODE_TO_INDEX, IS_SAFARI, hotkeys, getPlainText as getPlainText$1, ELEMENT_TO_COMPONENT, hasBlockCard, isCardLeft, FAKE_RIGHT_BLOCK_CARD_OFFSET, isComponentType, EDITOR_TO_ELEMENT, withAngular, SlateModule } from 'slate-angular';
9
9
  import { mixinUnsubscribe, MixinBase } from 'ngx-tethys/core';
10
- import isHotkey, { isKeyHotkey } from 'is-hotkey';
10
+ import { isKeyHotkey } from 'is-hotkey';
11
11
  import { Range, Node, Element as Element$1, Text, Editor, Transforms, Span, Path, Point, Operation, createEditor } from 'slate';
12
12
  import { HistoryEditor, withHistory } from 'slate-history';
13
13
  import { Subject, fromEvent, timer, combineLatest, Observable, BehaviorSubject, merge, ReplaySubject } from 'rxjs';
@@ -18,7 +18,7 @@ import { ThyIconModule } from 'ngx-tethys/icon';
18
18
  import * as i5 from 'ngx-tethys/input';
19
19
  import { ThyInputModule } from 'ngx-tethys/input';
20
20
  import { TheiaConverter } from '@atinc/selene';
21
- import * as _lodash from 'lodash';
21
+ import { cloneDeep, assign, map, defaults, groupBy, uniq, debounce } from 'lodash';
22
22
  import { isObject } from 'ngx-tethys/util';
23
23
  import * as i2 from '@angular/cdk/overlay';
24
24
  import { Overlay, OverlayModule } from '@angular/cdk/overlay';
@@ -27,7 +27,7 @@ import * as i1$6 from 'ngx-tethys';
27
27
  import { isArray } from 'ngx-tethys';
28
28
  import * as i1$2 from 'ngx-tethys/alert';
29
29
  import { ThyAlertModule } from 'ngx-tethys/alert';
30
- import { map, takeUntil, take, delay, startWith, distinctUntilChanged, skip, share, filter, mapTo, debounceTime, pairwise } from 'rxjs/operators';
30
+ import { map as map$1, takeUntil, take, delay, startWith, distinctUntilChanged, skip, share, filter, mapTo, debounceTime, pairwise } from 'rxjs/operators';
31
31
  import { ThyUploadStatus } from 'ngx-tethys/upload';
32
32
  import * as i1$3 from '@angular/platform-browser';
33
33
  import * as i6 from 'ngx-tethys/progress';
@@ -1060,8 +1060,6 @@ const autoScrollViewHandle = (editor, scrollContainer) => {
1060
1060
  previousHeight = currentHeight;
1061
1061
  };
1062
1062
 
1063
- const _ = _lodash;
1064
-
1065
1063
  /**
1066
1064
  * 循环 plugins 到 editor.plugins 和 editor.pluginsByKey
1067
1065
  * 如果有 key 重复则进行覆盖
@@ -1070,7 +1068,7 @@ const flattenDeepPlugins = (editor, plugins) => {
1070
1068
  if (!plugins)
1071
1069
  return;
1072
1070
  plugins.forEach((plugin) => {
1073
- let p = _.cloneDeep(plugin);
1071
+ let p = cloneDeep(plugin);
1074
1072
  if (!p.options)
1075
1073
  p.options = {};
1076
1074
  if (!p.nestedStructureByKey)
@@ -1114,7 +1112,7 @@ const mergeOptions = (plugin, override) => {
1114
1112
  continue;
1115
1113
  }
1116
1114
  if (isObject(override.options[option]) && newOptions[option]) {
1117
- newOptions[option] = _.assign(newOptions[option], override.options[option]);
1115
+ newOptions[option] = assign(newOptions[option], override.options[option]);
1118
1116
  continue;
1119
1117
  }
1120
1118
  newOptions[option] = override.options[option];
@@ -1189,7 +1187,7 @@ const withTheia = (editor, plugins = []) => {
1189
1187
  };
1190
1188
 
1191
1189
  const createPluginFactory = (defaultPlugin) => (override, overrideByKey = {}) => {
1192
- return _.cloneDeep(defaultPlugin);
1190
+ return cloneDeep(defaultPlugin);
1193
1191
  };
1194
1192
 
1195
1193
  const toolbarInitialize = (toolbarItems, global = DefaultGlobalToolbarDefinition, inline = DefaultInlineToolbarDefinition, quick = DefaultQuickToolbarDefinition) => {
@@ -1807,7 +1805,7 @@ const getPointBefore = (editor, at, options) => {
1807
1805
  text: beforeString
1808
1806
  });
1809
1807
  stack.pop();
1810
- beforeStringToMatch = _.map(stack.slice(0, -1), 'text').join('');
1808
+ beforeStringToMatch = map(stack.slice(0, -1), 'text').join('');
1811
1809
  }
1812
1810
  if (matchString.includes(beforeStringToMatch) ||
1813
1811
  (options.match ? options.match({ beforeString: beforeStringToMatch, beforePoint, at }) : '')) {
@@ -2198,7 +2196,7 @@ const onKeyDownResetBlockType = ({ rules }) => (event, editor) => {
2198
2196
  let reset;
2199
2197
  if (editor.selection && isCollapsed(editor.selection)) {
2200
2198
  rules.forEach(({ types, defaultType, hotkey, predicate, onReset }) => {
2201
- if (!event || (hotkey && isHotkey(hotkey, event))) {
2199
+ if (!event || (hotkey && isKeyHotkey(hotkey, event))) {
2202
2200
  if (predicate(editor) && isNodeTypeIn(editor, types)) {
2203
2201
  if (event !== null) {
2204
2202
  event.preventDefault();
@@ -2262,7 +2260,7 @@ const applyDeepToNodes = ({ node, source, apply, query }) => {
2262
2260
  * Recursively merge a source object to children nodes with a query.
2263
2261
  */
2264
2262
  const mergeDeepToNodes = (options) => {
2265
- applyDeepToNodes({ ...options, apply: _.defaults });
2263
+ applyDeepToNodes({ ...options, apply: defaults });
2266
2264
  };
2267
2265
 
2268
2266
  const unWrap = (editor, kind) => {
@@ -2884,7 +2882,7 @@ class TheImageComponent extends TheBaseElementComponent {
2884
2882
  this.mouseUpSubscription = this.theContextService.onMouseUp$.subscribe(e => this.endDrag(e));
2885
2883
  this.uploadingSubscription = this.imageUploaderService
2886
2884
  .getUploadingItems$()
2887
- .pipe(map(fileUploadingItem => this.fileItem?.file && fileUploadingItem.find(item => item.file === this.fileItem?.file)))
2885
+ .pipe(map$1(fileUploadingItem => this.fileItem?.file && fileUploadingItem.find(item => item.file === this.fileItem?.file)))
2888
2886
  .subscribe(uploadingItem => {
2889
2887
  if (!uploadingItem || !uploadingItem.result) {
2890
2888
  return;
@@ -5774,7 +5772,7 @@ const withNodeID = (e) => {
5774
5772
  // fix can not find path by orign node
5775
5773
  let node = operation.node;
5776
5774
  if (!Object.isExtensible(node)) {
5777
- node = _.cloneDeep(node);
5775
+ node = cloneDeep(node);
5778
5776
  }
5779
5777
  // it will not overwrite ids once it's set as it's read-only
5780
5778
  mergeDeepToNodes({
@@ -5811,7 +5809,7 @@ const withNodeID = (e) => {
5811
5809
  return apply(operation);
5812
5810
  };
5813
5811
  editor.getFragment = () => {
5814
- const fragment = _.cloneDeep(getFragment());
5812
+ const fragment = cloneDeep(getFragment());
5815
5813
  return deleteElementKey(fragment, idKey);
5816
5814
  };
5817
5815
  return editor;
@@ -7757,7 +7755,7 @@ class TableCellEventDispatcher {
7757
7755
  this.tableCellHovered = new Subject();
7758
7756
  this.overlayHandleActiveForCell = new Subject();
7759
7757
  this.tableCellHoveredOrActiveDistinct = combineLatest(this.tableCellHovered.pipe(startWith(null), distinctUntilChanged()), this.overlayHandleActiveForCell.pipe(startWith(null), distinctUntilChanged())).pipe(skip(1), // Ignore initial [null, null] emission.
7760
- map(([hovered, active]) => active || hovered), distinctUntilChanged(), share());
7758
+ map$1(([hovered, active]) => active || hovered), distinctUntilChanged(), share());
7761
7759
  this._tableCellHoveredDistinctReenterZone = this.tableCellHoveredOrActiveDistinct.pipe(this._enterZone(), share());
7762
7760
  this._lastSeenCell = null;
7763
7761
  this._lastSeenCellHover = null;
@@ -7769,7 +7767,7 @@ class TableCellEventDispatcher {
7769
7767
  resizeOverlayVisibleForTableCell(cell) {
7770
7768
  if (cell !== this._lastSeenCell) {
7771
7769
  this._lastSeenCell = cell;
7772
- this._lastSeenCellHover = this._tableCellHoveredDistinctReenterZone.pipe(map(hoveredCell => {
7770
+ this._lastSeenCellHover = this._tableCellHoveredDistinctReenterZone.pipe(map$1(hoveredCell => {
7773
7771
  if (hoveredCell && hoveredCell.cell === cell) {
7774
7772
  return hoveredCell;
7775
7773
  }
@@ -7933,8 +7931,8 @@ class TableStore {
7933
7931
  return TablePosition.create(opts, editor, path);
7934
7932
  }
7935
7933
  setSelectedCells(cells, pos) {
7936
- const rowGroup = _.groupBy(cells, ({ row, col }) => row);
7937
- const colGroup = _.groupBy(cells, ({ row, col }) => col);
7934
+ const rowGroup = groupBy(cells, ({ row, col }) => row);
7935
+ const colGroup = groupBy(cells, ({ row, col }) => col);
7938
7936
  this.selectedRowsIndex = [];
7939
7937
  this.selectedColumnsIndex = [];
7940
7938
  for (const row in rowGroup) {
@@ -7947,8 +7945,8 @@ class TableStore {
7947
7945
  this.selectedColumnsIndex.push(parseInt(col, 10));
7948
7946
  }
7949
7947
  }
7950
- this.selectedRowsIndex = _.uniq(this.selectedRowsIndex);
7951
- this.selectedColumnsIndex = _.uniq(this.selectedColumnsIndex);
7948
+ this.selectedRowsIndex = uniq(this.selectedRowsIndex);
7949
+ this.selectedColumnsIndex = uniq(this.selectedColumnsIndex);
7952
7950
  if (this.selectedRowsIndex.length === pos.getHeight() && this.selectedColumnsIndex.length === pos.getWidth()) {
7953
7951
  this.isSelectedTable = true;
7954
7952
  }
@@ -8214,7 +8212,7 @@ class TableStore {
8214
8212
  }
8215
8213
  setDangerousRows() {
8216
8214
  const cells = this.selectedCells;
8217
- const rows = _(cells).map('row').uniq().valueOf();
8215
+ const rows = uniq(map(cells, 'col'));
8218
8216
  const pos = this.createTablePosition();
8219
8217
  const result = [];
8220
8218
  this.dangerousRowsIndex = rows;
@@ -8234,7 +8232,7 @@ class TableStore {
8234
8232
  }
8235
8233
  setDangerousColumns() {
8236
8234
  const cells = this.selectedCells;
8237
- const cols = _(cells).map('col').uniq().valueOf();
8235
+ const cols = uniq(map(cells, 'col'));
8238
8236
  const pos = this.createTablePosition();
8239
8237
  const result = [];
8240
8238
  this.dangerousColumnsIndex = cols;
@@ -8704,8 +8702,8 @@ var DeleteIcon;
8704
8702
 
8705
8703
  function isVirtualKey(e) {
8706
8704
  const isMod = e.ctrlKey || e.metaKey;
8707
- const isAlt = isHotkey('alt', e);
8708
- const isShift = isHotkey('shift', e);
8705
+ const isAlt = isKeyHotkey('alt', e);
8706
+ const isShift = isKeyHotkey('shift', e);
8709
8707
  const isCapsLock = e.key.includes('CapsLock');
8710
8708
  const isTab = e.key.includes('Tab');
8711
8709
  const isEsc = e.key.includes('Escape');
@@ -9159,7 +9157,7 @@ class TheColumnResizeDirective {
9159
9157
  this.ngZone.runOutsideAngular(() => {
9160
9158
  const element = this.elementRef.nativeElement;
9161
9159
  fromEvent(element, 'mousemove') // mouseover to mousemove 增加灵敏性
9162
- .pipe(filter(() => !this.resizeStarted), map(event => {
9160
+ .pipe(filter(() => !this.resizeStarted), map$1(event => {
9163
9161
  if (!this.theTableComponent.isCollapsed) {
9164
9162
  return null;
9165
9163
  }
@@ -9983,7 +9981,7 @@ class TheColumnResizeOverlayHandleComponent {
9983
9981
  this._notifyResizeEnded(size);
9984
9982
  });
9985
9983
  mousemove
9986
- .pipe(map(({ clientX, clientY }) => {
9984
+ .pipe(map$1(({ clientX, clientY }) => {
9987
9985
  return {
9988
9986
  clientX,
9989
9987
  clientY
@@ -10330,7 +10328,7 @@ class TheTdComponent extends TheBaseElementComponent {
10330
10328
  this.ngZone.runOutsideAngular(() => {
10331
10329
  const element = this.elementRef.nativeElement;
10332
10330
  fromEvent(element, 'mousedown')
10333
- .pipe(takeUntil(this.destroy$), filter((e) => e.button !== 2), map(event => {
10331
+ .pipe(takeUntil(this.destroy$), filter((e) => e.button !== 2), map$1(event => {
10334
10332
  const cell = event.target.closest(SLA_TABLE_CELL_SELECTOR);
10335
10333
  return cell;
10336
10334
  }), filter(cell => !!cell))
@@ -10345,7 +10343,7 @@ class TheTdComponent extends TheBaseElementComponent {
10345
10343
  }
10346
10344
  listenCellMouseEvents() {
10347
10345
  const mouseoverObservable = fromEvent(document, 'mouseover')
10348
- .pipe(takeUntil(this.destroy$), map(event => {
10346
+ .pipe(takeUntil(this.destroy$), map$1(event => {
10349
10347
  event.preventDefault();
10350
10348
  const cell = event.target.closest(SLA_TABLE_CELL_SELECTOR);
10351
10349
  return cell;
@@ -10370,7 +10368,7 @@ class TheTdComponent extends TheBaseElementComponent {
10370
10368
  const element = this.elementRef.nativeElement;
10371
10369
  this.eventDispatcher
10372
10370
  .resizeOverlayVisibleForTableCell(element)
10373
- .pipe(takeUntil(this.destroy$), map(value => {
10371
+ .pipe(takeUntil(this.destroy$), map$1(value => {
10374
10372
  // 禁止第一列左侧
10375
10373
  if (value && value.position === Position.left && this.tablePosition.getColumnIndex() === 0) {
10376
10374
  return null;
@@ -11118,7 +11116,7 @@ const withTable = (editor) => {
11118
11116
  };
11119
11117
  }
11120
11118
  if (tableFragment) {
11121
- tableFragment = normalizeTable(_.cloneDeep(tableFragment));
11119
+ tableFragment = normalizeTable(cloneDeep(tableFragment));
11122
11120
  const plainText = Node.string(tableFragment);
11123
11121
  tableFragment = [tableFragment];
11124
11122
  const stringObj = JSON.stringify(tableFragment);
@@ -11636,7 +11634,7 @@ const withSoftBreak = (editor) => {
11636
11634
  editor.onKeydown = (event) => {
11637
11635
  const entry = getBlockAbove(editor);
11638
11636
  rules.forEach(({ hotkey, query }) => {
11639
- if (isHotkey(hotkey, event) && isNodeType(entry, query)) {
11637
+ if (isKeyHotkey(hotkey, event) && isNodeType(entry, query)) {
11640
11638
  event.preventDefault();
11641
11639
  editor.insertText('\n');
11642
11640
  }
@@ -12453,7 +12451,7 @@ const HOTKEYS = {
12453
12451
  };
12454
12452
  const markShortcuts = (editor, event) => {
12455
12453
  for (const hotkey in HOTKEYS) {
12456
- if (isHotkey(hotkey, event)) {
12454
+ if (isKeyHotkey(hotkey, event)) {
12457
12455
  event.preventDefault();
12458
12456
  const mark = HOTKEYS[hotkey];
12459
12457
  if (mark === ElementKinds.inlineCode) {
@@ -13023,7 +13021,7 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
13023
13021
  this.theOnDOMEvent = new EventEmitter();
13024
13022
  this.theEditorCreated = new EventEmitter();
13025
13023
  this.theUploadingStatus = new EventEmitter(); // true 上传结束 false 上传中
13026
- this.autoScrollView = _.debounce(function (editor, scrollContainer) {
13024
+ this.autoScrollView = debounce(function (editor, scrollContainer) {
13027
13025
  return autoScrollViewHandle(editor, scrollContainer);
13028
13026
  }, 80);
13029
13027
  this.elementToHtml = new WeakMap();
@@ -13056,14 +13054,14 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
13056
13054
  key: event.key
13057
13055
  }
13058
13056
  });
13059
- if (isHotkey('mod+s', event)) {
13057
+ if (isKeyHotkey('mod+s', event)) {
13060
13058
  this.ngZone.run(() => {
13061
13059
  this.theOnSave.emit(this.editorValue);
13062
13060
  });
13063
13061
  event.preventDefault();
13064
13062
  return;
13065
13063
  }
13066
- if (isHotkey('mod+a', event)) {
13064
+ if (isKeyHotkey('mod+a', event)) {
13067
13065
  this.handleSelectAll();
13068
13066
  }
13069
13067
  AngularEditor.onKeydown(this.editor, event);