@worktile/theia 2.2.1 → 2.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.
@@ -7172,10 +7172,35 @@
7172
7172
  }
7173
7173
  i1.AngularEditor.focus(this.editor);
7174
7174
  slate.Transforms.select(this.editor, i1.AngularEditor.findPath(this.editor, this.element));
7175
- document.execCommand('copy');
7176
- this.thyNotifyService.success('复制成功');
7175
+ if (i1.IS_SAFARI) {
7176
+ this.safariCopy();
7177
+ return;
7178
+ }
7179
+ document.execCommand('copy') ? this.thyNotifyService.success('复制成功') : this.thyNotifyService.error('复制失败');
7177
7180
  i1.AngularEditor.deselect(this.editor);
7178
7181
  };
7182
+ TheCodeComponent.prototype.safariCopy = function () {
7183
+ var currentElement = i1.AngularEditor.toDOMNode(this.editor, this.element);
7184
+ var blockCard = currentElement.closest('.slate-block-card');
7185
+ var span = document.createElement('pre');
7186
+ span.appendChild(blockCard.cloneNode(true));
7187
+ span.textContent = this.element.content;
7188
+ span.setAttribute('data-language', this.element.language);
7189
+ span.setAttribute('data-auto-wrap', String(this.element.autoWrap));
7190
+ span.setAttribute('data-height', String(this.element.height));
7191
+ document.body.appendChild(span);
7192
+ var selection = window.getSelection();
7193
+ var range = document.createRange();
7194
+ if (selection) {
7195
+ selection.removeAllRanges();
7196
+ range.selectNode(span);
7197
+ selection.addRange(range);
7198
+ document.execCommand('copy') ? this.thyNotifyService.success('复制成功') : this.thyNotifyService.error('复制失败');
7199
+ selection.removeAllRanges();
7200
+ document.body.removeChild(span);
7201
+ i1.AngularEditor.deselect(this.editor);
7202
+ }
7203
+ };
7179
7204
  TheCodeComponent.prototype.focusChange = function (codeMirrorFocused) {
7180
7205
  if (codeMirrorFocused) {
7181
7206
  this.isHightLight = false;
@@ -10574,10 +10599,23 @@
10574
10599
  .pipe(takeUntilDestroyed, operators.filter(function (columnSize) { return columnSize.tableCell === _this.elementRef.nativeElement; }))
10575
10600
  .subscribe(function (_c) {
10576
10601
  var deltaSize = _c.deltaSize, previousSize = _c.previousSize, completeImmediately = _c.completeImmediately;
10577
- _this.elementRef.nativeElement.classList.add(OVERLAY_ACTIVE_CLASS);
10578
- _this.applySize(deltaSize, previousSize);
10579
- if (completeImmediately) {
10580
- _this._completeResizeOperation();
10602
+ var _d = _this.elementRef.nativeElement.getBoundingClientRect(), top = _d.top, left = _d.left;
10603
+ var clientY = event.clientY, clientX = event.clientX;
10604
+ var isApplySize = false;
10605
+ if (_this.isXAxisHover) {
10606
+ var width = _this.hoverdDirection === 'left' ? 0 : _this.tableOptions.minWidthPx;
10607
+ isApplySize = deltaSize > 0 && left + width - clientX <= 0;
10608
+ }
10609
+ else {
10610
+ var height = _this.hoverdDirection === 'bottom' ? 0 : _this.tableOptions.minHeightPx;
10611
+ isApplySize = deltaSize > 0 && top + height - clientY <= 0;
10612
+ }
10613
+ if (isApplySize || deltaSize < 0) {
10614
+ _this.elementRef.nativeElement.classList.add(OVERLAY_ACTIVE_CLASS);
10615
+ _this.applySize(deltaSize, previousSize);
10616
+ if (completeImmediately) {
10617
+ _this._completeResizeOperation();
10618
+ }
10581
10619
  }
10582
10620
  });
10583
10621
  rxjs.merge(this.resizeNotifier.resizeCanceled, this.resizeNotifier.resizeCompleted)
@@ -12167,7 +12205,7 @@
12167
12205
  return TheIndentToolbarComponent;
12168
12206
  }(TheToolbarBaseItemComponent));
12169
12207
  TheIndentToolbarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheIndentToolbarComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i1__namespace$3.ThyPopover }, { token: i0__namespace.ViewContainerRef }, { token: i2__namespace.Overlay }], target: i0__namespace.ɵɵFactoryTarget.Component });
12170
- TheIndentToolbarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheIndentToolbarComponent, selector: "the-indent-toolbar-item", inputs: { toolbarItem: "toolbarItem", menus: "menus", mode: "mode", item: "item" }, host: { listeners: { "mousedown": "toggleDropdown($event)", "document: mousedown": "handleDocumentMouseDown($event)" }, properties: { "class.disabled": "this.disabledState" }, classAttribute: "the-toolbar-dropdown-container" }, viewQueries: [{ propertyName: "dropdownTemplate", first: true, predicate: ["dropdownTemplate"], descendants: true, static: true }], usesInheritance: true, ngImport: i0__namespace, template: "<a thyIconNavLink class=\"icon-mode link-with-down\" [thyTooltip]=\"activeMenu?.name\" thyTooltipPlacement=\"top\">\n <thy-icon [thyIconName]=\"activeMenu?.icon\"></thy-icon>\n <thy-icon class=\"caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n</a>\n\n<ng-template #dropdownTemplate>\n <thy-action-menu class=\"dropdown-menu\">\n <ng-container *ngFor=\"let menu of menus\">\n <a thyActionMenuItem href=\"javascript:;\" (mousedown)=\"itemMousedown($event, menu)\">\n <span thyActionMenuItemIcon>\n <thy-icon [thyIconName]=\"menu.icon\"></thy-icon>\n </span>\n <span thyActionMenuItemName>{{ menu.name }}</span>\n </a>\n </ng-container>\n </thy-action-menu>\n</ng-template>\n", components: [{ type: i3__namespace.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4__namespace$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i5__namespace$2.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }], directives: [{ type: i5__namespace$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5__namespace$2.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i5__namespace$2.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i5__namespace$2.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }] });
12208
+ TheIndentToolbarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheIndentToolbarComponent, selector: "the-indent-toolbar-item", inputs: { toolbarItem: "toolbarItem", menus: "menus", mode: "mode", item: "item" }, host: { listeners: { "mousedown": "toggleDropdown($event)", "document: mousedown": "handleDocumentMouseDown($event)" }, properties: { "class.disabled": "this.disabledState" }, classAttribute: "the-toolbar-dropdown-container" }, viewQueries: [{ propertyName: "dropdownTemplate", first: true, predicate: ["dropdownTemplate"], descendants: true, static: true }], usesInheritance: true, ngImport: i0__namespace, template: "<a thyIconNavLink class=\"icon-mode link-with-down\" [thyTooltip]=\"activeMenu?.name\" thyTooltipPlacement=\"top\">\n <thy-icon [thyIconName]=\"activeMenu?.icon\"></thy-icon>\n <thy-icon class=\"caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n</a>\n\n<ng-template #dropdownTemplate>\n <thy-action-menu class=\"dropdown-menu\">\n <ng-container *ngFor=\"let menu of menus\">\n <a\n thyActionMenuItem\n href=\"javascript:;\"\n [thyTooltip]=\"tooltip\"\n [thyTooltipTemplateContext]=\"{ name: menu.name, shortcutKey: menu.shortcutKey }\"\n thyTooltipPlacement=\"right\"\n (mousedown)=\"itemMousedown($event, menu)\"\n >\n <span thyActionMenuItemIcon>\n <thy-icon [thyIconName]=\"menu.icon\"></thy-icon>\n </span>\n <span thyActionMenuItemName>{{ menu.name }}</span>\n </a>\n </ng-container>\n </thy-action-menu>\n</ng-template>\n\n<ng-template #tooltip let-data>{{ data?.shortcutKey }}</ng-template>\n", components: [{ type: i3__namespace.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4__namespace$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i5__namespace$2.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }], directives: [{ type: i5__namespace$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5__namespace$2.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i5__namespace$2.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i5__namespace$2.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }] });
12171
12209
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheIndentToolbarComponent, decorators: [{
12172
12210
  type: i0.Component,
12173
12211
  args: [{
@@ -12199,7 +12237,7 @@
12199
12237
  args: ['class.disabled']
12200
12238
  }] } });
12201
12239
 
12202
- var MaxIndent = 13;
12240
+ var MaxIndent = 11;
12203
12241
  var includesIndentTypes = __spreadArray([
12204
12242
  exports.ElementKinds.checkItem,
12205
12243
  exports.ElementKinds.numberedList,
@@ -12248,29 +12286,34 @@
12248
12286
  },
12249
12287
  cancelTextIntent: function (editor, event, anchorBlock, kinds) {
12250
12288
  var textIndent = anchorBlock.textIndent, indent = anchorBlock.indent;
12251
- if (indent) {
12252
- event.preventDefault();
12253
- IndentEditor.cancelIndent(editor);
12254
- return true;
12255
- }
12256
- if (!indent && textIndent > 2) {
12289
+ if (textIndent > 2) {
12257
12290
  event.preventDefault();
12258
12291
  textIndent -= 2;
12259
12292
  IndentEditor.setTextIndent(editor, kinds, textIndent);
12260
12293
  return true;
12261
12294
  }
12262
- if (!indent && textIndent === 2) {
12295
+ if (textIndent === 2) {
12263
12296
  event.preventDefault();
12264
12297
  IndentEditor.setTextIndent(editor, kinds, null);
12265
12298
  return true;
12266
12299
  }
12300
+ if (indent) {
12301
+ event.preventDefault();
12302
+ IndentEditor.cancelIndent(editor);
12303
+ return true;
12304
+ }
12267
12305
  return false;
12268
12306
  },
12269
12307
  isDisabled: function (editor) {
12270
12308
  if (editor.selection) {
12271
- var disableGroup = HEADING_TYPES;
12309
+ var allowGroup = __spreadArray([
12310
+ exports.ElementKinds.paragraph,
12311
+ exports.ElementKinds.numberedList,
12312
+ exports.ElementKinds.bulletedList,
12313
+ exports.ElementKinds.checkItem
12314
+ ], __read(HEADING_TYPES));
12272
12315
  var anchorBlock$1 = anchorBlock(editor);
12273
- return anchorBlock$1 && disableGroup.includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
12316
+ return anchorBlock$1 && !allowGroup.includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
12274
12317
  }
12275
12318
  return false;
12276
12319
  }
@@ -12287,12 +12330,14 @@
12287
12330
  key: exports.Indents.indentRight,
12288
12331
  name: '增加缩进',
12289
12332
  icon: 'float-left',
12333
+ shortcutKey: 'Tab',
12290
12334
  execute: function (editor) { return IndentEditor.setIndent(editor); }
12291
12335
  },
12292
12336
  {
12293
12337
  key: exports.Indents.indentLeft,
12294
12338
  name: '减少缩进',
12295
12339
  icon: 'float-right',
12340
+ shortcutKey: 'Shift+Tab/BackSpace',
12296
12341
  type: exports.ToolbarItemType.toolDropdown,
12297
12342
  execute: function (editor) { return IndentEditor.cancelIndent(editor); }
12298
12343
  }
@@ -12313,7 +12358,7 @@
12313
12358
  var currentPath = [path[0]];
12314
12359
  var isStart = slate.Editor.isStart(editor, selection.anchor, currentPath);
12315
12360
  var textIndentDisable = [exports.ElementKinds.bulletedList, exports.ElementKinds.numberedList, exports.ElementKinds.checkItem];
12316
- if (isHotkey__default["default"]('Tab', event)) {
12361
+ if (isHotkey.isKeyHotkey('Tab', event)) {
12317
12362
  event.preventDefault();
12318
12363
  if (startBlock && (isExpanded || isStart)) {
12319
12364
  if (!editor.isVoid(block)) {
@@ -12334,7 +12379,7 @@
12334
12379
  return true;
12335
12380
  }
12336
12381
  }
12337
- if (isHotkey__default["default"]('shift+Tab', event)) {
12382
+ if (isHotkey.isKeyHotkey('shift+Tab', event)) {
12338
12383
  if (startBlock && (isExpanded || isStart)) {
12339
12384
  if (!editor.isVoid(block)) {
12340
12385
  return IndentEditor.cancelTextIntent(editor, event, block, kinds);
@@ -12352,24 +12397,6 @@
12352
12397
  var withIndent = function (kinds) { return function (editor) {
12353
12398
  var onKeydown = editor.onKeydown;
12354
12399
  editor.onKeydown = function (event) {
12355
- var HOTKEYS = {
12356
- 'mod+]': exports.Indents.indentRight,
12357
- 'mod+[': exports.Indents.indentLeft
12358
- };
12359
- for (var hotkey in HOTKEYS) {
12360
- if (isHotkey__default["default"](hotkey, event)) {
12361
- event.preventDefault();
12362
- var mark = HOTKEYS[hotkey];
12363
- switch (mark) {
12364
- case exports.Indents.indentRight:
12365
- IndentEditor.setIndent(editor);
12366
- break;
12367
- case exports.Indents.indentLeft:
12368
- IndentEditor.cancelIndent(editor);
12369
- break;
12370
- }
12371
- }
12372
- }
12373
12400
  var isContinue = !onKeydownTextIndent(editor, event, kinds);
12374
12401
  if (isContinue) {
12375
12402
  onKeydown(event);