@worktile/theia 1.2.14 → 1.2.15

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.
@@ -376,7 +376,6 @@
376
376
  var ZERO_WIDTH_CHAR = '\u200B';
377
377
  var CLIPBOARD_FORMAT_KEY = 'x-theia-fragment';
378
378
  var DEFAULT_SCROLL_CONTAINER = '.the-editable-container';
379
- var BLOCK_INSERT_ORIGIN = 'block-insert';
380
379
  var ELEMENT_UNIQUE_ID = 'key';
381
380
  exports.TheMode = void 0;
382
381
  (function (TheMode) {
@@ -2378,6 +2377,9 @@
2378
2377
  return "the-toolbar-" + uuid;
2379
2378
  };
2380
2379
 
2380
+ var IS_MAC = typeof window != 'undefined' && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform);
2381
+ var CONTROL_KEY = IS_MAC ? '⌘' : 'Ctrl';
2382
+
2381
2383
  var withDeserializeMd = function (options) { return function (editor) {
2382
2384
  var insertData = editor.insertData, onKeydown = editor.onKeydown;
2383
2385
  editor.onKeydown = function (event) {
@@ -2418,8 +2420,13 @@
2418
2420
  });
2419
2421
  return;
2420
2422
  }
2423
+ else {
2424
+ closeConversionHint(editor);
2425
+ }
2426
+ }
2427
+ catch (error) {
2428
+ closeConversionHint(editor);
2421
2429
  }
2422
- catch (error) { }
2423
2430
  }
2424
2431
  },
2425
2432
  origin: origin,
@@ -5858,6 +5865,7 @@
5858
5865
  key: exports.MarkTypes.bold,
5859
5866
  icon: 'bold',
5860
5867
  name: '加粗',
5868
+ shortcutKey: CONTROL_KEY + "+B",
5861
5869
  execute: function (editor) { return MarkEditor.toggleMark(editor, exports.MarkTypes.bold); },
5862
5870
  active: function (editor) { return MarkEditor.isMarkActive(editor, exports.MarkTypes.bold); }
5863
5871
  },
@@ -5865,6 +5873,7 @@
5865
5873
  key: exports.MarkTypes.italic,
5866
5874
  icon: 'italic',
5867
5875
  name: '斜体',
5876
+ shortcutKey: CONTROL_KEY + "+I",
5868
5877
  execute: function (editor) { return MarkEditor.toggleMark(editor, exports.MarkTypes.italic); },
5869
5878
  active: function (editor) { return MarkEditor.isMarkActive(editor, exports.MarkTypes.italic); }
5870
5879
  },
@@ -5879,6 +5888,7 @@
5879
5888
  key: exports.MarkTypes.underline,
5880
5889
  icon: 'underline',
5881
5890
  name: '下划线',
5891
+ shortcutKey: CONTROL_KEY + "+U",
5882
5892
  execute: function (editor) { return MarkEditor.toggleMark(editor, exports.MarkTypes.underline); },
5883
5893
  active: function (editor) { return MarkEditor.isMarkActive(editor, exports.MarkTypes.underline); }
5884
5894
  },
@@ -5886,6 +5896,7 @@
5886
5896
  key: exports.MarkTypes.codeLine,
5887
5897
  icon: 'code',
5888
5898
  name: '行内代码',
5899
+ shortcutKey: CONTROL_KEY + "+E",
5889
5900
  execute: function (editor) { return MarkEditor.toggleMark(editor, exports.MarkTypes.codeLine); },
5890
5901
  active: function (editor) { return MarkEditor.isMarkActive(editor, exports.MarkTypes.codeLine); }
5891
5902
  }
@@ -11274,12 +11285,14 @@
11274
11285
  key: exports.ToolbarActionTypes.undo,
11275
11286
  icon: 'undo',
11276
11287
  name: '撤销',
11288
+ shortcutKey: CONTROL_KEY + "+Z",
11277
11289
  execute: function (editor) { return editor.undo(); }
11278
11290
  },
11279
11291
  {
11280
11292
  key: exports.ToolbarActionTypes.redo,
11281
11293
  icon: 'redo',
11282
11294
  name: '重做',
11295
+ shortcutKey: CONTROL_KEY + "+Shift+Z",
11283
11296
  execute: function (editor) { return editor.redo(); }
11284
11297
  },
11285
11298
  {
@@ -11400,12 +11413,12 @@
11400
11413
  return TheToolbarItemComponent;
11401
11414
  }(TheToolbarBaseItemComponent));
11402
11415
  TheToolbarItemComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheToolbarItemComponent, deps: [{ token: i0__namespace.NgZone }, { token: i0__namespace.ComponentFactoryResolver }], target: i0__namespace.ɵɵFactoryTarget.Component });
11403
- TheToolbarItemComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarItemComponent, selector: "the-toolbar-item", inputs: { item: "item", editor: "editor", itemMode: "itemMode" }, host: { classAttribute: "the-toolbar-item" }, viewQueries: [{ propertyName: "toolbarContainer", first: true, predicate: ["toolbarContainer"], descendants: true, read: i0.ViewContainerRef, static: true }], usesInheritance: true, ngImport: i0__namespace, template: "\n <ng-container *ngIf=\"itemMode === ToolbarItemMode.horizontal; else selectionItem\">\n <a\n thyIconNavLink\n [thyIconNavLinkIcon]=\"item.icon\"\n [thyTooltip]=\"item.name\"\n thyTooltipPlacement=\"top\"\n [thyIconNavLinkActive]=\"active\"\n (mousedown)=\"execute($event)\"\n ></a>\n </ng-container>\n <ng-template #selectionItem>\n <ng-container *ngIf=\"!item?.quickItemComponent\">\n <thy-icon [thyIconName]=\"item?.icon\" [thyIconRotate]=\"0\" class=\"quick-toolbar-icon\"></thy-icon>\n <span class=\"quick-toolbar-name\">{{ item?.name }}</span>\n </ng-container>\n </ng-template>\n <ng-container #toolbarContainer></ng-container>\n ", isInline: true, components: [{ type: i2__namespace.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4__namespace$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7__namespace.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
11416
+ TheToolbarItemComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarItemComponent, selector: "the-toolbar-item", inputs: { item: "item", editor: "editor", itemMode: "itemMode" }, host: { classAttribute: "the-toolbar-item" }, viewQueries: [{ propertyName: "toolbarContainer", first: true, predicate: ["toolbarContainer"], descendants: true, read: i0.ViewContainerRef, static: true }], usesInheritance: true, ngImport: i0__namespace, template: "\n <ng-container *ngIf=\"itemMode === ToolbarItemMode.horizontal; else selectionItem\">\n <a\n thyIconNavLink\n [thyIconNavLinkIcon]=\"item.icon\"\n [thyTooltip]=\"tooltip\"\n [thyTooltipTemplateContext]=\"{ name: item.name, shortcutKey: item.shortcutKey }\"\n thyTooltipPlacement=\"top\"\n [thyIconNavLinkActive]=\"active\"\n (mousedown)=\"execute($event)\"\n ></a>\n </ng-container>\n <ng-template #selectionItem>\n <ng-container *ngIf=\"!item?.quickItemComponent\">\n <thy-icon [thyIconName]=\"item?.icon\" [thyIconRotate]=\"0\" class=\"quick-toolbar-icon\"></thy-icon>\n <span class=\"quick-toolbar-name\">{{ item?.name }}</span>\n </ng-container>\n </ng-template>\n <ng-template #tooltip let-data> {{ data.name }} {{ data.shortcutKey }} </ng-template>\n <ng-container #toolbarContainer></ng-container>\n ", isInline: true, components: [{ type: i2__namespace.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4__namespace$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7__namespace.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
11404
11417
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheToolbarItemComponent, decorators: [{
11405
11418
  type: i0.Component,
11406
11419
  args: [{
11407
11420
  selector: 'the-toolbar-item',
11408
- template: "\n <ng-container *ngIf=\"itemMode === ToolbarItemMode.horizontal; else selectionItem\">\n <a\n thyIconNavLink\n [thyIconNavLinkIcon]=\"item.icon\"\n [thyTooltip]=\"item.name\"\n thyTooltipPlacement=\"top\"\n [thyIconNavLinkActive]=\"active\"\n (mousedown)=\"execute($event)\"\n ></a>\n </ng-container>\n <ng-template #selectionItem>\n <ng-container *ngIf=\"!item?.quickItemComponent\">\n <thy-icon [thyIconName]=\"item?.icon\" [thyIconRotate]=\"0\" class=\"quick-toolbar-icon\"></thy-icon>\n <span class=\"quick-toolbar-name\">{{ item?.name }}</span>\n </ng-container>\n </ng-template>\n <ng-container #toolbarContainer></ng-container>\n ",
11421
+ template: "\n <ng-container *ngIf=\"itemMode === ToolbarItemMode.horizontal; else selectionItem\">\n <a\n thyIconNavLink\n [thyIconNavLinkIcon]=\"item.icon\"\n [thyTooltip]=\"tooltip\"\n [thyTooltipTemplateContext]=\"{ name: item.name, shortcutKey: item.shortcutKey }\"\n thyTooltipPlacement=\"top\"\n [thyIconNavLinkActive]=\"active\"\n (mousedown)=\"execute($event)\"\n ></a>\n </ng-container>\n <ng-template #selectionItem>\n <ng-container *ngIf=\"!item?.quickItemComponent\">\n <thy-icon [thyIconName]=\"item?.icon\" [thyIconRotate]=\"0\" class=\"quick-toolbar-icon\"></thy-icon>\n <span class=\"quick-toolbar-name\">{{ item?.name }}</span>\n </ng-container>\n </ng-template>\n <ng-template #tooltip let-data> {{ data.name }} {{ data.shortcutKey }} </ng-template>\n <ng-container #toolbarContainer></ng-container>\n ",
11409
11422
  host: {
11410
11423
  class: 'the-toolbar-item'
11411
11424
  }
@@ -11571,6 +11584,26 @@
11571
11584
  return editor;
11572
11585
  };
11573
11586
 
11587
+ var withSoftBreak = function (options) {
11588
+ if (options === void 0) { options = { rules: [{ hotkey: 'shift+enter' }] }; }
11589
+ return function (editor) {
11590
+ var onKeydown = editor.onKeydown;
11591
+ editor.onKeydown = function (event) {
11592
+ var rules = options.rules;
11593
+ var entry = getBlockAbove(editor);
11594
+ rules.forEach(function (_a) {
11595
+ var hotkey = _a.hotkey, query = _a.query;
11596
+ if (isHotkey__default["default"](hotkey, event) && isNodeType(entry, query)) {
11597
+ event.preventDefault();
11598
+ editor.insertText('\n');
11599
+ }
11600
+ });
11601
+ onKeydown(event);
11602
+ };
11603
+ return editor;
11604
+ };
11605
+ };
11606
+
11574
11607
  var internalPlugins = [
11575
11608
  withTheHistory,
11576
11609
  withAutoInsertData(),
@@ -11588,6 +11621,17 @@
11588
11621
  withCode,
11589
11622
  withHeading,
11590
11623
  withMark(),
11624
+ withSoftBreak({
11625
+ rules: [
11626
+ { hotkey: 'shift+enter' },
11627
+ {
11628
+ hotkey: 'enter',
11629
+ query: {
11630
+ allow: [exports.ElementKinds.blockquote]
11631
+ }
11632
+ }
11633
+ ]
11634
+ }),
11591
11635
  withBlockquote,
11592
11636
  withNodeID({ idKey: ELEMENT_UNIQUE_ID, idCreator: idCreator }),
11593
11637
  withAutoFormat({ rules: autoFormatRules }),
@@ -13078,13 +13122,13 @@
13078
13122
  exports.A_TAG_REL_ATTR = A_TAG_REL_ATTR;
13079
13123
  exports.AlignEditor = AlignEditor;
13080
13124
  exports.BLOCK_DELETEBACKWARD_TYPES = BLOCK_DELETEBACKWARD_TYPES;
13081
- exports.BLOCK_INSERT_ORIGIN = BLOCK_INSERT_ORIGIN;
13082
13125
  exports.BlockquoteEditor = BlockquoteEditor;
13083
13126
  exports.CLIPBOARD_FORMAT_KEY = CLIPBOARD_FORMAT_KEY;
13084
13127
  exports.CODEMIRROR_PADDING_TOP = CODEMIRROR_PADDING_TOP;
13085
13128
  exports.CODE_MODES = CODE_MODES;
13086
13129
  exports.COMPONENTS = COMPONENTS;
13087
13130
  exports.CONTAINER_BLOCKS = CONTAINER_BLOCKS;
13131
+ exports.CONTROL_KEY = CONTROL_KEY;
13088
13132
  exports.CodeEditor = CodeEditor;
13089
13133
  exports.CodeMode = CodeMode;
13090
13134
  exports.ColorEditor = ColorEditor;
@@ -13098,6 +13142,7 @@
13098
13142
  exports.HEADING_TYPES = HEADING_TYPES;
13099
13143
  exports.HeadingEditor = HeadingEditor;
13100
13144
  exports.HrEditor = HrEditor;
13145
+ exports.IS_MAC = IS_MAC;
13101
13146
  exports.ImageEditor = ImageEditor;
13102
13147
  exports.LINK_DEFAULT_TEXT = LINK_DEFAULT_TEXT;
13103
13148
  exports.LIST_BLOCK_TYPES = LIST_BLOCK_TYPES;