@worktile/theia 2.4.6 → 2.4.7
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.
- package/bundles/worktile-theia.umd.js +127 -97
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/esm2015/editor.component.js +2 -3
- package/esm2015/interfaces/editor.js +1 -1
- package/esm2015/plugins/indent/indent.editor.js +7 -12
- package/esm2015/plugins/indent/indent.plugin.js +1 -8
- package/esm2015/plugins/public-api.js +3 -1
- package/esm2015/plugins/table/components/table.component.js +37 -6
- package/fesm2015/worktile-theia.js +107 -89
- package/fesm2015/worktile-theia.js.map +1 -1
- package/interfaces/editor.d.ts +0 -2
- package/package.json +1 -1
- package/plugins/indent/indent.editor.d.ts +1 -0
- package/plugins/public-api.d.ts +2 -0
- package/plugins/table/components/table.component.d.ts +1 -0
- package/plugins/table/components/table.component.scss +7 -2
|
@@ -9794,19 +9794,41 @@
|
|
|
9794
9794
|
};
|
|
9795
9795
|
TheTableComponent.prototype.ngAfterViewInit = function () {
|
|
9796
9796
|
var _this = this;
|
|
9797
|
-
this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
|
|
9798
|
-
var blockCardElement
|
|
9799
|
-
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
|
|
9805
|
-
|
|
9806
|
-
|
|
9807
|
-
|
|
9808
|
-
|
|
9809
|
-
|
|
9797
|
+
this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
9798
|
+
var _a, blockCardElement, loadImageDone;
|
|
9799
|
+
var _this = this;
|
|
9800
|
+
return __generator(this, function (_c) {
|
|
9801
|
+
switch (_c.label) {
|
|
9802
|
+
case 0:
|
|
9803
|
+
blockCardElement = this.nativeElement.closest('slate-block-card');
|
|
9804
|
+
if (blockCardElement) {
|
|
9805
|
+
blockCardElement.classList.add("slate-block-card-" + this.element.type);
|
|
9806
|
+
}
|
|
9807
|
+
this.tableStore.initEditor(this.editor);
|
|
9808
|
+
this.subscribeCellsChange();
|
|
9809
|
+
this.subscribeCellPositionChange();
|
|
9810
|
+
this.listenTableContextMenuEvent();
|
|
9811
|
+
this.useTableWrapperWidth();
|
|
9812
|
+
if (!((_a = this.element.options) === null || _a === void 0 ? void 0 : _a.numberedColumn)) return [3 /*break*/, 2];
|
|
9813
|
+
return [4 /*yield*/, this.resolveImage()];
|
|
9814
|
+
case 1:
|
|
9815
|
+
loadImageDone = _c.sent();
|
|
9816
|
+
// 等待序号列表格内图片加载完成后再去渲染表格行高度
|
|
9817
|
+
if (loadImageDone) {
|
|
9818
|
+
setTimeout(function () {
|
|
9819
|
+
_this.useRowControls();
|
|
9820
|
+
_this.cdr.detectChanges();
|
|
9821
|
+
}, 200); // 200ms:通过通知打开页面动画加载时间
|
|
9822
|
+
}
|
|
9823
|
+
return [3 /*break*/, 3];
|
|
9824
|
+
case 2:
|
|
9825
|
+
this.useRowControls();
|
|
9826
|
+
this.cdr.markForCheck();
|
|
9827
|
+
_c.label = 3;
|
|
9828
|
+
case 3: return [2 /*return*/];
|
|
9829
|
+
}
|
|
9830
|
+
});
|
|
9831
|
+
}); });
|
|
9810
9832
|
};
|
|
9811
9833
|
TheTableComponent.prototype.subscribeCellPositionChange = function () {
|
|
9812
9834
|
var _this = this;
|
|
@@ -9841,7 +9863,6 @@
|
|
|
9841
9863
|
var _a;
|
|
9842
9864
|
if (this.selection || ((_a = this.element.options) === null || _a === void 0 ? void 0 : _a.numberedColumn)) {
|
|
9843
9865
|
this.rowControls = this.calculateRowControls();
|
|
9844
|
-
this.cdr.markForCheck();
|
|
9845
9866
|
}
|
|
9846
9867
|
};
|
|
9847
9868
|
TheTableComponent.prototype.detectChanges = function () {
|
|
@@ -9945,6 +9966,24 @@
|
|
|
9945
9966
|
});
|
|
9946
9967
|
return belowRowlHeight;
|
|
9947
9968
|
};
|
|
9969
|
+
TheTableComponent.prototype.resolveImage = function () {
|
|
9970
|
+
var imageElements = this.nativeElement.querySelectorAll('img');
|
|
9971
|
+
if (imageElements.length) {
|
|
9972
|
+
var imageResolves_1 = [];
|
|
9973
|
+
imageElements.forEach(function (item) {
|
|
9974
|
+
var image = new Image();
|
|
9975
|
+
var imageLoad = new Promise(function (resolve) {
|
|
9976
|
+
image.onload = function () {
|
|
9977
|
+
resolve(true);
|
|
9978
|
+
};
|
|
9979
|
+
image.src = item.getAttribute('src');
|
|
9980
|
+
});
|
|
9981
|
+
imageResolves_1.push(imageLoad);
|
|
9982
|
+
});
|
|
9983
|
+
return Promise.all(imageResolves_1);
|
|
9984
|
+
}
|
|
9985
|
+
return Promise.resolve(true);
|
|
9986
|
+
};
|
|
9948
9987
|
TheTableComponent.prototype.getColControls = function () {
|
|
9949
9988
|
var _a, _b;
|
|
9950
9989
|
this.colControls = ((_b = (_a = this.element) === null || _a === void 0 ? void 0 : _a.children[0]) === null || _b === void 0 ? void 0 : _b.children) || [];
|
|
@@ -12649,78 +12688,6 @@
|
|
|
12649
12688
|
args: ['class.disabled']
|
|
12650
12689
|
}] } });
|
|
12651
12690
|
|
|
12652
|
-
var onKeydownTextIndent = function (editor, event, kinds, textIndentDisabled) {
|
|
12653
|
-
var selection = editor.selection;
|
|
12654
|
-
var isExpanded = slate.Range.isExpanded(selection);
|
|
12655
|
-
var nodes = Array.from(slate.Editor.nodes(editor, {
|
|
12656
|
-
mode: 'highest',
|
|
12657
|
-
match: function (node) { return slate.Element.isElement(node) && kinds.includes(node.type); }
|
|
12658
|
-
}));
|
|
12659
|
-
var _a = __read(nodes, 1), startBlock = _a[0];
|
|
12660
|
-
if (!startBlock) {
|
|
12661
|
-
return false;
|
|
12662
|
-
}
|
|
12663
|
-
var _b = __read(startBlock, 2), block = _b[0], path = _b[1];
|
|
12664
|
-
var isStart = slate.Editor.isStart(editor, selection.anchor, path);
|
|
12665
|
-
if (isHotkey.isKeyHotkey('Tab', event)) {
|
|
12666
|
-
event.preventDefault();
|
|
12667
|
-
if (startBlock && (isExpanded || isStart)) {
|
|
12668
|
-
if (!editor.isVoid(block)) {
|
|
12669
|
-
var textIndent = block.textIndent, type = block.type;
|
|
12670
|
-
// do not apply first-line indentation for lists
|
|
12671
|
-
if (!textIndent && !textIndentDisabled.includes(type)) {
|
|
12672
|
-
IndentEditor.setTextIndent(editor, kinds, 2);
|
|
12673
|
-
return true;
|
|
12674
|
-
}
|
|
12675
|
-
else {
|
|
12676
|
-
IndentEditor.setIndent(editor);
|
|
12677
|
-
return true;
|
|
12678
|
-
}
|
|
12679
|
-
}
|
|
12680
|
-
}
|
|
12681
|
-
else {
|
|
12682
|
-
editor.insertText(TAB_SPACE);
|
|
12683
|
-
return true;
|
|
12684
|
-
}
|
|
12685
|
-
}
|
|
12686
|
-
if (isHotkey.isKeyHotkey('shift+Tab', event)) {
|
|
12687
|
-
if (startBlock && (isExpanded || isStart)) {
|
|
12688
|
-
if (!editor.isVoid(block)) {
|
|
12689
|
-
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
12690
|
-
}
|
|
12691
|
-
}
|
|
12692
|
-
}
|
|
12693
|
-
if (selection && slate.Range.isCollapsed(selection) && i1.hotkeys.isDeleteBackward(event)) {
|
|
12694
|
-
if (startBlock && isStart) {
|
|
12695
|
-
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
12696
|
-
}
|
|
12697
|
-
}
|
|
12698
|
-
return false;
|
|
12699
|
-
};
|
|
12700
|
-
|
|
12701
|
-
var withIndent = function (kinds) { return function (editor) {
|
|
12702
|
-
var onKeydown = editor.onKeydown;
|
|
12703
|
-
editor.onKeydown = function (event) {
|
|
12704
|
-
var _a, _b, _c, _d;
|
|
12705
|
-
var indentTypes = kinds;
|
|
12706
|
-
var disableIndentTypes = [exports.ElementKinds.bulletedList, exports.ElementKinds.numberedList, exports.ElementKinds.checkItem];
|
|
12707
|
-
if ((_b = (_a = editor.extraIndentOptions) === null || _a === void 0 ? void 0 : _a.indentTypes) === null || _b === void 0 ? void 0 : _b.length) {
|
|
12708
|
-
indentTypes = mergIndentTypes(kinds, editor.extraIndentOptions.indentTypes);
|
|
12709
|
-
}
|
|
12710
|
-
if ((_d = (_c = editor.extraIndentOptions) === null || _c === void 0 ? void 0 : _c.disabledIndentTypes) === null || _d === void 0 ? void 0 : _d.length) {
|
|
12711
|
-
disableIndentTypes = mergIndentTypes(disableIndentTypes, editor.extraIndentOptions.disabledIndentTypes);
|
|
12712
|
-
}
|
|
12713
|
-
var isContinue = !onKeydownTextIndent(editor, event, indentTypes, disableIndentTypes);
|
|
12714
|
-
if (isContinue) {
|
|
12715
|
-
onKeydown(event);
|
|
12716
|
-
}
|
|
12717
|
-
};
|
|
12718
|
-
return editor;
|
|
12719
|
-
}; };
|
|
12720
|
-
var mergIndentTypes = function (defaultTypes, indentTypes) {
|
|
12721
|
-
return Array.from(new Set(__spreadArray(__spreadArray([], __read(defaultTypes)), __read(indentTypes))));
|
|
12722
|
-
};
|
|
12723
|
-
|
|
12724
12691
|
var MaxIndent = 11;
|
|
12725
12692
|
var includesIndentTypes = __spreadArray([
|
|
12726
12693
|
exports.ElementKinds.checkItem,
|
|
@@ -12728,15 +12695,11 @@
|
|
|
12728
12695
|
exports.ElementKinds.bulletedList,
|
|
12729
12696
|
exports.ElementKinds.paragraph
|
|
12730
12697
|
], __read(HEADING_TYPES));
|
|
12731
|
-
var getIndentTypes = function (editor) {
|
|
12732
|
-
var indentTypes = editor.extraIndentOptions ? editor.extraIndentOptions.indentTypes : [];
|
|
12733
|
-
return mergIndentTypes(includesIndentTypes, indentTypes);
|
|
12734
|
-
};
|
|
12735
12698
|
var IndentEditor = {
|
|
12736
12699
|
setIndent: function (editor) {
|
|
12737
12700
|
var nodes = Array.from(slate.Editor.nodes(editor, {
|
|
12738
12701
|
mode: 'highest',
|
|
12739
|
-
match: function (n) { return slate.Element.isElement(n) &&
|
|
12702
|
+
match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
|
|
12740
12703
|
}));
|
|
12741
12704
|
var _a = __read(nodes, 1), startBlock = _a[0];
|
|
12742
12705
|
if (startBlock) {
|
|
@@ -12746,7 +12709,7 @@
|
|
|
12746
12709
|
if (indent <= MaxIndent) {
|
|
12747
12710
|
slate.Transforms.setNodes(editor, { indent: indent }, {
|
|
12748
12711
|
mode: 'highest',
|
|
12749
|
-
match: function (n) { return slate.Element.isElement(n) &&
|
|
12712
|
+
match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
|
|
12750
12713
|
});
|
|
12751
12714
|
}
|
|
12752
12715
|
}
|
|
@@ -12754,7 +12717,7 @@
|
|
|
12754
12717
|
cancelIndent: function (editor) {
|
|
12755
12718
|
var nodes = Array.from(slate.Editor.nodes(editor, {
|
|
12756
12719
|
mode: 'highest',
|
|
12757
|
-
match: function (n) { return slate.Element.isElement(n) &&
|
|
12720
|
+
match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
|
|
12758
12721
|
}));
|
|
12759
12722
|
var _a = __read(nodes, 1), startBlock = _a[0];
|
|
12760
12723
|
if (startBlock) {
|
|
@@ -12762,7 +12725,7 @@
|
|
|
12762
12725
|
indent = indent === 1 ? null : (indent -= 1);
|
|
12763
12726
|
slate.Transforms.setNodes(editor, { indent: indent }, {
|
|
12764
12727
|
mode: 'highest',
|
|
12765
|
-
match: function (n) { return slate.Element.isElement(n) &&
|
|
12728
|
+
match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
|
|
12766
12729
|
});
|
|
12767
12730
|
}
|
|
12768
12731
|
},
|
|
@@ -12795,7 +12758,7 @@
|
|
|
12795
12758
|
isDisabled: function (editor) {
|
|
12796
12759
|
if (editor.selection) {
|
|
12797
12760
|
var anchorBlock$1 = anchorBlock(editor);
|
|
12798
|
-
return anchorBlock$1 && !
|
|
12761
|
+
return anchorBlock$1 && !includesIndentTypes.includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
|
|
12799
12762
|
}
|
|
12800
12763
|
return false;
|
|
12801
12764
|
}
|
|
@@ -12825,6 +12788,71 @@
|
|
|
12825
12788
|
}
|
|
12826
12789
|
];
|
|
12827
12790
|
|
|
12791
|
+
var onKeydownTextIndent = function (editor, event, kinds, textIndentDisabled) {
|
|
12792
|
+
var selection = editor.selection;
|
|
12793
|
+
var isExpanded = slate.Range.isExpanded(selection);
|
|
12794
|
+
var nodes = Array.from(slate.Editor.nodes(editor, {
|
|
12795
|
+
mode: 'highest',
|
|
12796
|
+
match: function (node) { return slate.Element.isElement(node) && kinds.includes(node.type); }
|
|
12797
|
+
}));
|
|
12798
|
+
var _a = __read(nodes, 1), startBlock = _a[0];
|
|
12799
|
+
if (!startBlock) {
|
|
12800
|
+
return false;
|
|
12801
|
+
}
|
|
12802
|
+
var _b = __read(startBlock, 2), block = _b[0], path = _b[1];
|
|
12803
|
+
var isStart = slate.Editor.isStart(editor, selection.anchor, path);
|
|
12804
|
+
if (isHotkey.isKeyHotkey('Tab', event)) {
|
|
12805
|
+
event.preventDefault();
|
|
12806
|
+
if (startBlock && (isExpanded || isStart)) {
|
|
12807
|
+
if (!editor.isVoid(block)) {
|
|
12808
|
+
var textIndent = block.textIndent, type = block.type;
|
|
12809
|
+
// do not apply first-line indentation for lists
|
|
12810
|
+
if (!textIndent && !textIndentDisabled.includes(type)) {
|
|
12811
|
+
IndentEditor.setTextIndent(editor, kinds, 2);
|
|
12812
|
+
return true;
|
|
12813
|
+
}
|
|
12814
|
+
else {
|
|
12815
|
+
IndentEditor.setIndent(editor);
|
|
12816
|
+
return true;
|
|
12817
|
+
}
|
|
12818
|
+
}
|
|
12819
|
+
}
|
|
12820
|
+
else {
|
|
12821
|
+
editor.insertText(TAB_SPACE);
|
|
12822
|
+
return true;
|
|
12823
|
+
}
|
|
12824
|
+
}
|
|
12825
|
+
if (isHotkey.isKeyHotkey('shift+Tab', event)) {
|
|
12826
|
+
if (startBlock && (isExpanded || isStart)) {
|
|
12827
|
+
if (!editor.isVoid(block)) {
|
|
12828
|
+
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
12829
|
+
}
|
|
12830
|
+
}
|
|
12831
|
+
}
|
|
12832
|
+
if (selection && slate.Range.isCollapsed(selection) && i1.hotkeys.isDeleteBackward(event)) {
|
|
12833
|
+
if (startBlock && isStart) {
|
|
12834
|
+
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
12835
|
+
}
|
|
12836
|
+
}
|
|
12837
|
+
return false;
|
|
12838
|
+
};
|
|
12839
|
+
|
|
12840
|
+
var withIndent = function (kinds) { return function (editor) {
|
|
12841
|
+
var onKeydown = editor.onKeydown;
|
|
12842
|
+
editor.onKeydown = function (event) {
|
|
12843
|
+
var indentTypes = kinds;
|
|
12844
|
+
var disableIndentTypes = [exports.ElementKinds.bulletedList, exports.ElementKinds.numberedList, exports.ElementKinds.checkItem];
|
|
12845
|
+
var isContinue = !onKeydownTextIndent(editor, event, indentTypes, disableIndentTypes);
|
|
12846
|
+
if (isContinue) {
|
|
12847
|
+
onKeydown(event);
|
|
12848
|
+
}
|
|
12849
|
+
};
|
|
12850
|
+
return editor;
|
|
12851
|
+
}; };
|
|
12852
|
+
var mergIndentTypes = function (defaultTypes, indentTypes) {
|
|
12853
|
+
return Array.from(new Set(__spreadArray(__spreadArray([], __read(defaultTypes)), __read(indentTypes))));
|
|
12854
|
+
};
|
|
12855
|
+
|
|
12828
12856
|
var internalPlugins = [
|
|
12829
12857
|
withTheHistory,
|
|
12830
12858
|
withAutoInsertData(),
|
|
@@ -13800,13 +13828,12 @@
|
|
|
13800
13828
|
};
|
|
13801
13829
|
TheEditorComponent.prototype.initialize = function () {
|
|
13802
13830
|
var _this = this;
|
|
13803
|
-
var _a, _b, _c
|
|
13831
|
+
var _a, _b, _c;
|
|
13804
13832
|
this.editor = withTheEditor(this.thePlugins, slateHistory.withHistory(i1.withAngular(slate.createEditor(), CLIPBOARD_FORMAT_KEY)));
|
|
13805
13833
|
this.generateDecorate();
|
|
13806
13834
|
this.editor.disabled = (_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.disabled;
|
|
13807
13835
|
this.editor.extraElementOptions = (_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.extraElementOptions;
|
|
13808
13836
|
this.editor.extraAutoFormatRules = (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.extraAutoFormatRules;
|
|
13809
|
-
this.editor.extraIndentOptions = (_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.extraIndentOptions;
|
|
13810
13837
|
this.editor.options = this.theOptions;
|
|
13811
13838
|
setEditorUUID(this.editor, idCreator());
|
|
13812
13839
|
this.theContextService.initialize({
|
|
@@ -14404,6 +14431,7 @@
|
|
|
14404
14431
|
exports.HrEditor = HrEditor;
|
|
14405
14432
|
exports.IS_MAC = IS_MAC;
|
|
14406
14433
|
exports.ImageEditor = ImageEditor;
|
|
14434
|
+
exports.IndentEditor = IndentEditor;
|
|
14407
14435
|
exports.LINK_DEFAULT_TEXT = LINK_DEFAULT_TEXT;
|
|
14408
14436
|
exports.LIST_BLOCK_TYPES = LIST_BLOCK_TYPES;
|
|
14409
14437
|
exports.LinkEditor = LinkEditor;
|
|
@@ -14433,6 +14461,7 @@
|
|
|
14433
14461
|
exports.TheEditorComponent = TheEditorComponent;
|
|
14434
14462
|
exports.TheEditorModule = TheEditorModule;
|
|
14435
14463
|
exports.TheImageComponent = TheImageComponent;
|
|
14464
|
+
exports.TheIndentToolbarComponent = TheIndentToolbarComponent;
|
|
14436
14465
|
exports.TheQueries = index$1;
|
|
14437
14466
|
exports.TheToolbarBaseItemComponent = TheToolbarBaseItemComponent;
|
|
14438
14467
|
exports.TheToolbarComponent = TheToolbarComponent;
|
|
@@ -14459,6 +14488,7 @@
|
|
|
14459
14488
|
exports.getToolbarClass = getToolbarClass;
|
|
14460
14489
|
exports.htmlToTheia = htmlToTheia;
|
|
14461
14490
|
exports.inValidTypes = inValidTypes;
|
|
14491
|
+
exports.includesIndentTypes = includesIndentTypes;
|
|
14462
14492
|
exports.isCleanEmptyParagraph = isCleanEmptyParagraph;
|
|
14463
14493
|
exports.isPureEmptyParagraph = isPureEmptyParagraph;
|
|
14464
14494
|
exports.mergeElementOptions = mergeElementOptions;
|