@worktile/theia 2.1.5 → 2.1.6
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 +79 -160
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/editor.component.d.ts +0 -2
- package/editor.module.d.ts +25 -27
- package/esm2015/components/toolbar/toolbar.component.js +6 -6
- package/esm2015/editor.component.js +14 -17
- package/esm2015/editor.module.js +1 -4
- package/esm2015/interfaces/editor.js +1 -1
- package/esm2015/plugins/list/transforms/insert-list-item.js +11 -7
- package/esm2015/plugins/quick-insert/components/quick-insert.component.js +10 -9
- package/esm2015/transforms/handle-continual-insert-break.js +1 -4
- package/esm2015/utils/index.js +2 -1
- package/fesm2015/worktile-theia.js +63 -142
- package/fesm2015/worktile-theia.js.map +1 -1
- package/interfaces/editor.d.ts +3 -3
- package/package.json +1 -1
- package/plugins/quick-insert/components/quick-insert.component.d.ts +2 -1
- package/styles/index.scss +0 -1
- package/utils/index.d.ts +1 -0
- package/esm2015/plugins/placeholder/placeholder.component.js +0 -83
- package/plugins/placeholder/placeholder.component.d.ts +0 -21
- package/plugins/placeholder/placeholder.component.scss +0 -10
|
@@ -1941,9 +1941,6 @@
|
|
|
1941
1941
|
var aboveResult = slate.Editor.above(editor, {
|
|
1942
1942
|
match: function (n) { return slate.Editor.isBlock(editor, n) && n.type === type; }
|
|
1943
1943
|
});
|
|
1944
|
-
if (isEnd) {
|
|
1945
|
-
editor.marks = {};
|
|
1946
|
-
}
|
|
1947
1944
|
if (aboveResult && aboveResult[0] && isEnd && isEmpty) {
|
|
1948
1945
|
var wrapBlock = aboveResult[0];
|
|
1949
1946
|
if (wrapBlock.type === type) {
|
|
@@ -2470,6 +2467,35 @@
|
|
|
2470
2467
|
var IS_MAC = typeof window != 'undefined' && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform);
|
|
2471
2468
|
var CONTROL_KEY = IS_MAC ? '⌘' : 'Ctrl';
|
|
2472
2469
|
|
|
2470
|
+
/**
|
|
2471
|
+
* whether the current node is a clean paragraph
|
|
2472
|
+
* @param editor
|
|
2473
|
+
* @param text
|
|
2474
|
+
* @returns boolean
|
|
2475
|
+
*/
|
|
2476
|
+
var isCleanEmptyParagraph = function (editor) {
|
|
2477
|
+
var isCollapsedCursor = TheEditor.isFocused(editor) && editor.selection && slate.Range.isCollapsed(editor.selection);
|
|
2478
|
+
if (!isCollapsedCursor) {
|
|
2479
|
+
return false;
|
|
2480
|
+
}
|
|
2481
|
+
var block = slate.Node.ancestor(editor, [editor.selection.anchor.path[0]]);
|
|
2482
|
+
var textIndent = 'textIndent';
|
|
2483
|
+
var align = 'align';
|
|
2484
|
+
var hasTextIndent = block[textIndent];
|
|
2485
|
+
var hasAlign = block[align];
|
|
2486
|
+
if (slate.Node.string(block) === '' &&
|
|
2487
|
+
slate.Element.isElement(block) &&
|
|
2488
|
+
block.type === exports.ElementKinds.paragraph &&
|
|
2489
|
+
block.children.length === 1 &&
|
|
2490
|
+
slate.Text.isText(block.children[0]) &&
|
|
2491
|
+
!slate.Editor.isVoid(editor, block) &&
|
|
2492
|
+
!hasTextIndent &&
|
|
2493
|
+
!hasAlign) {
|
|
2494
|
+
return true;
|
|
2495
|
+
}
|
|
2496
|
+
return false;
|
|
2497
|
+
};
|
|
2498
|
+
|
|
2473
2499
|
var withDeserializeMd = function (options) { return function (editor) {
|
|
2474
2500
|
var insertData = editor.insertData, onKeydown = editor.onKeydown;
|
|
2475
2501
|
editor.onKeydown = function (event) {
|
|
@@ -3484,14 +3510,17 @@
|
|
|
3484
3510
|
}
|
|
3485
3511
|
else {
|
|
3486
3512
|
/**
|
|
3487
|
-
* If end,
|
|
3513
|
+
* If end, split nodes
|
|
3488
3514
|
*/
|
|
3489
3515
|
slate.Editor.withoutNormalizing(editor, function () {
|
|
3490
|
-
slate.Transforms.
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3516
|
+
slate.Transforms.splitNodes(editor, {
|
|
3517
|
+
always: true,
|
|
3518
|
+
mode: 'highest',
|
|
3519
|
+
match: function (node) {
|
|
3520
|
+
var path = node && TheEditor.findPath(editor, node);
|
|
3521
|
+
return path && path.length === nextListItemPath_1.length;
|
|
3522
|
+
}
|
|
3523
|
+
});
|
|
3495
3524
|
});
|
|
3496
3525
|
}
|
|
3497
3526
|
/**
|
|
@@ -11689,35 +11718,6 @@
|
|
|
11689
11718
|
}
|
|
11690
11719
|
];
|
|
11691
11720
|
|
|
11692
|
-
/**
|
|
11693
|
-
* whether the current node is a clean paragraph
|
|
11694
|
-
* @param editor
|
|
11695
|
-
* @param text
|
|
11696
|
-
* @returns boolean
|
|
11697
|
-
*/
|
|
11698
|
-
var isCleanEmptyParagraph = function (editor) {
|
|
11699
|
-
var isCollapsedCursor = TheEditor.isFocused(editor) && editor.selection && slate.Range.isCollapsed(editor.selection);
|
|
11700
|
-
if (!isCollapsedCursor) {
|
|
11701
|
-
return false;
|
|
11702
|
-
}
|
|
11703
|
-
var block = slate.Node.ancestor(editor, [editor.selection.anchor.path[0]]);
|
|
11704
|
-
var textIndent = 'textIndent';
|
|
11705
|
-
var align = 'align';
|
|
11706
|
-
var hasTextIndent = block[textIndent];
|
|
11707
|
-
var hasAlign = block[align];
|
|
11708
|
-
if (slate.Node.string(block) === '' &&
|
|
11709
|
-
slate.Element.isElement(block) &&
|
|
11710
|
-
block.type === exports.ElementKinds.paragraph &&
|
|
11711
|
-
block.children.length === 1 &&
|
|
11712
|
-
slate.Text.isText(block.children[0]) &&
|
|
11713
|
-
!slate.Editor.isVoid(editor, block) &&
|
|
11714
|
-
!hasTextIndent &&
|
|
11715
|
-
!hasAlign) {
|
|
11716
|
-
return true;
|
|
11717
|
-
}
|
|
11718
|
-
return false;
|
|
11719
|
-
};
|
|
11720
|
-
|
|
11721
11721
|
var TheToolbarItemComponent = /** @class */ (function (_super) {
|
|
11722
11722
|
__extends(TheToolbarItemComponent, _super);
|
|
11723
11723
|
function TheToolbarItemComponent(ngZone, cfr) {
|
|
@@ -12353,9 +12353,9 @@
|
|
|
12353
12353
|
}
|
|
12354
12354
|
};
|
|
12355
12355
|
TheToolbarComponent.prototype.setToolbarClass = function () {
|
|
12356
|
-
var
|
|
12356
|
+
var _d;
|
|
12357
12357
|
if (this.editor && !!this.containerClass.length) {
|
|
12358
|
-
(
|
|
12358
|
+
(_d = this.elementRef.nativeElement.classList).add.apply(_d, __spreadArray([], __read(this.containerClass)));
|
|
12359
12359
|
}
|
|
12360
12360
|
};
|
|
12361
12361
|
TheToolbarComponent.prototype.resizeElement = function () {
|
|
@@ -12363,7 +12363,7 @@
|
|
|
12363
12363
|
var editableElement = this.elementRef.nativeElement;
|
|
12364
12364
|
// @ts-ignore
|
|
12365
12365
|
this.resizeObserver = new ResizeObserver(function (entries) {
|
|
12366
|
-
var e_1,
|
|
12366
|
+
var e_1, _d;
|
|
12367
12367
|
try {
|
|
12368
12368
|
for (var entries_1 = __values(entries), entries_1_1 = entries_1.next(); !entries_1_1.done; entries_1_1 = entries_1.next()) {
|
|
12369
12369
|
var entry = entries_1_1.value;
|
|
@@ -12377,7 +12377,7 @@
|
|
|
12377
12377
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
12378
12378
|
finally {
|
|
12379
12379
|
try {
|
|
12380
|
-
if (entries_1_1 && !entries_1_1.done && (
|
|
12380
|
+
if (entries_1_1 && !entries_1_1.done && (_d = entries_1.return)) _d.call(entries_1);
|
|
12381
12381
|
}
|
|
12382
12382
|
finally { if (e_1) throw e_1.error; }
|
|
12383
12383
|
}
|
|
@@ -12385,7 +12385,7 @@
|
|
|
12385
12385
|
this.resizeObserver.observe(editableElement);
|
|
12386
12386
|
};
|
|
12387
12387
|
TheToolbarComponent.prototype.statusChange = function (editor) {
|
|
12388
|
-
var e_2,
|
|
12388
|
+
var e_2, _d;
|
|
12389
12389
|
var toolbarItems = __spreadArray(__spreadArray([], __read(this.toolbarItems)), [this.moreGroupMenu]);
|
|
12390
12390
|
try {
|
|
12391
12391
|
for (var toolbarItems_1 = __values(toolbarItems), toolbarItems_1_1 = toolbarItems_1.next(); !toolbarItems_1_1.done; toolbarItems_1_1 = toolbarItems_1.next()) {
|
|
@@ -12401,7 +12401,7 @@
|
|
|
12401
12401
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
12402
12402
|
finally {
|
|
12403
12403
|
try {
|
|
12404
|
-
if (toolbarItems_1_1 && !toolbarItems_1_1.done && (
|
|
12404
|
+
if (toolbarItems_1_1 && !toolbarItems_1_1.done && (_d = toolbarItems_1.return)) _d.call(toolbarItems_1);
|
|
12405
12405
|
}
|
|
12406
12406
|
finally { if (e_2) throw e_2.error; }
|
|
12407
12407
|
}
|
|
@@ -12413,7 +12413,7 @@
|
|
|
12413
12413
|
var toolbarItems = this.toolbarItemsCompose();
|
|
12414
12414
|
var items = toolbarItems.items, group = toolbarItems.group;
|
|
12415
12415
|
this.ngZone.run(function () {
|
|
12416
|
-
var e_3,
|
|
12416
|
+
var e_3, _d;
|
|
12417
12417
|
try {
|
|
12418
12418
|
for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
|
|
12419
12419
|
var item = items_1_1.value;
|
|
@@ -12427,7 +12427,7 @@
|
|
|
12427
12427
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
12428
12428
|
finally {
|
|
12429
12429
|
try {
|
|
12430
|
-
if (items_1_1 && !items_1_1.done && (
|
|
12430
|
+
if (items_1_1 && !items_1_1.done && (_d = items_1.return)) _d.call(items_1);
|
|
12431
12431
|
}
|
|
12432
12432
|
finally { if (e_3) throw e_3.error; }
|
|
12433
12433
|
}
|
|
@@ -12450,7 +12450,7 @@
|
|
|
12450
12450
|
* set aside 50px
|
|
12451
12451
|
*/
|
|
12452
12452
|
TheToolbarComponent.prototype.toolbarItemsCompose = function () {
|
|
12453
|
-
var e_4,
|
|
12453
|
+
var e_4, _d;
|
|
12454
12454
|
var elementWidth = this.isMore ? this.elementWidth : null;
|
|
12455
12455
|
var maxItemWidth = 50;
|
|
12456
12456
|
var defaultItemWidth = 35;
|
|
@@ -12460,8 +12460,8 @@
|
|
|
12460
12460
|
var items = [];
|
|
12461
12461
|
var group = [];
|
|
12462
12462
|
try {
|
|
12463
|
-
for (var
|
|
12464
|
-
var item =
|
|
12463
|
+
for (var _e = __values(this.toolbarItems), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
12464
|
+
var item = _f.value;
|
|
12465
12465
|
if (!this.isMore) {
|
|
12466
12466
|
items.push(item);
|
|
12467
12467
|
continue;
|
|
@@ -12490,7 +12490,7 @@
|
|
|
12490
12490
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
12491
12491
|
finally {
|
|
12492
12492
|
try {
|
|
12493
|
-
if (
|
|
12493
|
+
if (_f && !_f.done && (_d = _e.return)) _d.call(_e);
|
|
12494
12494
|
}
|
|
12495
12495
|
finally { if (e_4) throw e_4.error; }
|
|
12496
12496
|
}
|
|
@@ -12503,12 +12503,12 @@
|
|
|
12503
12503
|
* externally designated more group
|
|
12504
12504
|
*/
|
|
12505
12505
|
TheToolbarComponent.prototype.toolbarItemsAndMoreCompose = function () {
|
|
12506
|
-
var e_5,
|
|
12506
|
+
var e_5, _d;
|
|
12507
12507
|
var items = [];
|
|
12508
12508
|
var group = [];
|
|
12509
12509
|
try {
|
|
12510
|
-
for (var
|
|
12511
|
-
var item =
|
|
12510
|
+
for (var _e = __values(this.toolbarItems), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
12511
|
+
var item = _f.value;
|
|
12512
12512
|
if (item.key === exports.ToolbarActionTypes.split) {
|
|
12513
12513
|
items.push(item);
|
|
12514
12514
|
continue;
|
|
@@ -12519,7 +12519,7 @@
|
|
|
12519
12519
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
12520
12520
|
finally {
|
|
12521
12521
|
try {
|
|
12522
|
-
if (
|
|
12522
|
+
if (_f && !_f.done && (_d = _e.return)) _d.call(_e);
|
|
12523
12523
|
}
|
|
12524
12524
|
finally { if (e_5) throw e_5.error; }
|
|
12525
12525
|
}
|
|
@@ -12582,15 +12582,15 @@
|
|
|
12582
12582
|
return TheToolbarItemComponent;
|
|
12583
12583
|
};
|
|
12584
12584
|
TheToolbarComponent.prototype.getDropdownItem = function (item) {
|
|
12585
|
-
var _a;
|
|
12585
|
+
var _a, _b, _c;
|
|
12586
12586
|
var dropdownKey = item === null || item === void 0 ? void 0 : item.dropdownItemKey;
|
|
12587
12587
|
// modify the fontsize option externally
|
|
12588
|
-
var contextService = this.editor.injector.get(TheContextService);
|
|
12589
|
-
var fontSize = contextService.getDefaultFontSize();
|
|
12590
|
-
if (item.key === exports.MarkTypes.fontSize && fontSize) {
|
|
12588
|
+
var contextService = (_b = (_a = this.editor) === null || _a === void 0 ? void 0 : _a.injector) === null || _b === void 0 ? void 0 : _b.get(TheContextService);
|
|
12589
|
+
var fontSize = contextService === null || contextService === void 0 ? void 0 : contextService.getDefaultFontSize();
|
|
12590
|
+
if (contextService && item.key === exports.MarkTypes.fontSize && fontSize) {
|
|
12591
12591
|
dropdownKey = fontSize;
|
|
12592
12592
|
}
|
|
12593
|
-
return (
|
|
12593
|
+
return (_c = item === null || item === void 0 ? void 0 : item.includes) === null || _c === void 0 ? void 0 : _c.find(function (item) { return item.key === dropdownKey; });
|
|
12594
12594
|
};
|
|
12595
12595
|
return TheToolbarComponent;
|
|
12596
12596
|
}());
|
|
@@ -12761,6 +12761,7 @@
|
|
|
12761
12761
|
this.renderer = renderer;
|
|
12762
12762
|
this.elementRef = elementRef;
|
|
12763
12763
|
this.cdr = cdr;
|
|
12764
|
+
this.isVisible = false;
|
|
12764
12765
|
this.isHide = true;
|
|
12765
12766
|
this.defaultIconName = 'plus-circle-thin';
|
|
12766
12767
|
this.iconNameFill = 'plus-circle-thin-fill';
|
|
@@ -12771,15 +12772,12 @@
|
|
|
12771
12772
|
event.stopPropagation();
|
|
12772
12773
|
};
|
|
12773
12774
|
TheQuickInsertComponent.prototype.checkStatus = function () {
|
|
12774
|
-
var
|
|
12775
|
+
var _a;
|
|
12775
12776
|
var editor = this.editor;
|
|
12776
|
-
if (isCleanEmptyParagraph(editor)) {
|
|
12777
|
-
|
|
12778
|
-
|
|
12779
|
-
|
|
12780
|
-
var rootNode = i1.AngularEditor.toDOMNode(editor, block);
|
|
12781
|
-
_this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
|
|
12782
|
-
});
|
|
12777
|
+
if (this.isVisible && isCleanEmptyParagraph(editor)) {
|
|
12778
|
+
var block = slate.Node.ancestor(editor, [(_a = editor === null || editor === void 0 ? void 0 : editor.selection) === null || _a === void 0 ? void 0 : _a.anchor.path[0]]);
|
|
12779
|
+
var rootNode = i1.AngularEditor.toDOMNode(editor, block);
|
|
12780
|
+
this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
|
|
12783
12781
|
return;
|
|
12784
12782
|
}
|
|
12785
12783
|
this.isHide = true;
|
|
@@ -12805,7 +12803,7 @@
|
|
|
12805
12803
|
return TheQuickInsertComponent;
|
|
12806
12804
|
}());
|
|
12807
12805
|
TheQuickInsertComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheQuickInsertComponent, deps: [{ token: i0__namespace.Renderer2 }, { token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
12808
|
-
TheQuickInsertComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheQuickInsertComponent, selector: "[theQuickInsert]", inputs: { editor: "editor", quickToolbarItems: "quickToolbarItems" }, host: { listeners: { "mousedown": "handleMousedownNativeElement($event)" }, properties: { "class.hide": "isHide" }, classAttribute: "the-quick-insert" }, viewQueries: [{ propertyName: "iconElement", first: true, predicate: ["iconElement"], descendants: true, read: i0.ElementRef }], ngImport: i0__namespace, template: "<thy-icon\n #iconElement\n [thyIconName]=\"displayIconName\"\n class=\"quick-insert-icon text-desc font-size-xlg\"\n (mouseenter)=\"mouseEnter($event)\"\n (mouseleave)=\"mouseLeave($event)\"\n (mousedown)=\"handleClick($event)\"\n></thy-icon>\n", components: [{ type: i4__namespace$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }] });
|
|
12806
|
+
TheQuickInsertComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheQuickInsertComponent, selector: "[theQuickInsert]", inputs: { editor: "editor", quickToolbarItems: "quickToolbarItems", isVisible: "isVisible" }, host: { listeners: { "mousedown": "handleMousedownNativeElement($event)" }, properties: { "class.hide": "isHide" }, classAttribute: "the-quick-insert" }, viewQueries: [{ propertyName: "iconElement", first: true, predicate: ["iconElement"], descendants: true, read: i0.ElementRef }], ngImport: i0__namespace, template: "<thy-icon\n #iconElement\n [thyIconName]=\"displayIconName\"\n class=\"quick-insert-icon text-desc font-size-xlg\"\n (mouseenter)=\"mouseEnter($event)\"\n (mouseleave)=\"mouseLeave($event)\"\n (mousedown)=\"handleClick($event)\"\n></thy-icon>\n", components: [{ type: i4__namespace$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }] });
|
|
12809
12807
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheQuickInsertComponent, decorators: [{
|
|
12810
12808
|
type: i0.Component,
|
|
12811
12809
|
args: [{
|
|
@@ -12820,6 +12818,8 @@
|
|
|
12820
12818
|
type: i0.Input
|
|
12821
12819
|
}], quickToolbarItems: [{
|
|
12822
12820
|
type: i0.Input
|
|
12821
|
+
}], isVisible: [{
|
|
12822
|
+
type: i0.Input
|
|
12823
12823
|
}], iconElement: [{
|
|
12824
12824
|
type: i0.ViewChild,
|
|
12825
12825
|
args: ['iconElement', { read: i0.ElementRef, static: false }]
|
|
@@ -12828,84 +12828,6 @@
|
|
|
12828
12828
|
args: ['mousedown', ['$event']]
|
|
12829
12829
|
}] } });
|
|
12830
12830
|
|
|
12831
|
-
var ThePlaceholderComponent = /** @class */ (function () {
|
|
12832
|
-
function ThePlaceholderComponent(renderer, elementRef, contextService) {
|
|
12833
|
-
this.renderer = renderer;
|
|
12834
|
-
this.elementRef = elementRef;
|
|
12835
|
-
this.contextService = contextService;
|
|
12836
|
-
this.isHide = true;
|
|
12837
|
-
}
|
|
12838
|
-
ThePlaceholderComponent.prototype.handleCompositionStart = function () {
|
|
12839
|
-
var _a;
|
|
12840
|
-
if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.selection) {
|
|
12841
|
-
this.hide();
|
|
12842
|
-
}
|
|
12843
|
-
};
|
|
12844
|
-
ThePlaceholderComponent.prototype.handleCompositionEnd = function (event) {
|
|
12845
|
-
if (!event.data) {
|
|
12846
|
-
this.checkStatus();
|
|
12847
|
-
}
|
|
12848
|
-
};
|
|
12849
|
-
ThePlaceholderComponent.prototype.checkStatus = function () {
|
|
12850
|
-
var _this = this;
|
|
12851
|
-
var _a, _b, _c;
|
|
12852
|
-
var editor = this.editor;
|
|
12853
|
-
var isEmptyShow = typeof ((_a = this.options) === null || _a === void 0 ? void 0 : _a.isEmptyShowPlaceholder) === 'undefined' ? true : this.options.isEmptyShowPlaceholder;
|
|
12854
|
-
var isMustShow = (_b = this.options) === null || _b === void 0 ? void 0 : _b.isMustShowPlaceholder;
|
|
12855
|
-
var isReadonly = (_c = this.options) === null || _c === void 0 ? void 0 : _c.readonly;
|
|
12856
|
-
// empty content and no selection processing
|
|
12857
|
-
if (!isReadonly && isEmptyShow && isEmptyContent(editor.children)) {
|
|
12858
|
-
var firstElementChild = this.contextService.getFirstElementChild();
|
|
12859
|
-
var offsetTop = firstElementChild.offsetTop;
|
|
12860
|
-
var offsetLeft = firstElementChild.offsetLeft;
|
|
12861
|
-
this.updatePosition(offsetLeft, offsetTop);
|
|
12862
|
-
return;
|
|
12863
|
-
}
|
|
12864
|
-
if (isMustShow && isCleanEmptyParagraph(editor)) {
|
|
12865
|
-
setTimeout(function () {
|
|
12866
|
-
var _a;
|
|
12867
|
-
var block = slate.Node.ancestor(editor, [(_a = editor === null || editor === void 0 ? void 0 : editor.selection) === null || _a === void 0 ? void 0 : _a.anchor.path[0]]);
|
|
12868
|
-
var rootNode = i1.AngularEditor.toDOMNode(editor, block);
|
|
12869
|
-
_this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
|
|
12870
|
-
});
|
|
12871
|
-
return;
|
|
12872
|
-
}
|
|
12873
|
-
this.isHide = true;
|
|
12874
|
-
};
|
|
12875
|
-
ThePlaceholderComponent.prototype.updatePosition = function (left, top) {
|
|
12876
|
-
this.isHide = false;
|
|
12877
|
-
this.renderer.setStyle(this.elementRef.nativeElement, 'top', top + "px");
|
|
12878
|
-
this.renderer.setStyle(this.elementRef.nativeElement, 'left', left + "px");
|
|
12879
|
-
};
|
|
12880
|
-
ThePlaceholderComponent.prototype.hide = function () {
|
|
12881
|
-
this.isHide = true;
|
|
12882
|
-
};
|
|
12883
|
-
return ThePlaceholderComponent;
|
|
12884
|
-
}());
|
|
12885
|
-
ThePlaceholderComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: ThePlaceholderComponent, deps: [{ token: i0__namespace.Renderer2 }, { token: i0__namespace.ElementRef }, { token: TheContextService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
12886
|
-
ThePlaceholderComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: { editor: "editor", options: "options" }, host: { listeners: { "document:compositionstart": "handleCompositionStart()", "document:compositionend": "handleCompositionEnd($event)" }, properties: { "class.hide": "isHide" }, classAttribute: "the-placeholder" }, ngImport: i0__namespace, template: "{{ options?.placeholder }}", isInline: true });
|
|
12887
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: ThePlaceholderComponent, decorators: [{
|
|
12888
|
-
type: i0.Component,
|
|
12889
|
-
args: [{
|
|
12890
|
-
selector: 'div[thePlaceholder]',
|
|
12891
|
-
template: "{{ options?.placeholder }}",
|
|
12892
|
-
host: {
|
|
12893
|
-
class: 'the-placeholder',
|
|
12894
|
-
'[class.hide]': 'isHide'
|
|
12895
|
-
}
|
|
12896
|
-
}]
|
|
12897
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.Renderer2 }, { type: i0__namespace.ElementRef }, { type: TheContextService }]; }, propDecorators: { editor: [{
|
|
12898
|
-
type: i0.Input
|
|
12899
|
-
}], options: [{
|
|
12900
|
-
type: i0.Input
|
|
12901
|
-
}], handleCompositionStart: [{
|
|
12902
|
-
type: i0.HostListener,
|
|
12903
|
-
args: ['document:compositionstart']
|
|
12904
|
-
}], handleCompositionEnd: [{
|
|
12905
|
-
type: i0.HostListener,
|
|
12906
|
-
args: ['document:compositionend', ['$event']]
|
|
12907
|
-
}] } });
|
|
12908
|
-
|
|
12909
12831
|
var TheTemplateComponent = /** @class */ (function () {
|
|
12910
12832
|
function TheTemplateComponent() {
|
|
12911
12833
|
var _this = this;
|
|
@@ -13141,9 +13063,7 @@
|
|
|
13141
13063
|
});
|
|
13142
13064
|
this.toolbarCalculate();
|
|
13143
13065
|
setTimeout(function () {
|
|
13144
|
-
var _a;
|
|
13145
13066
|
_this.theEditorCreated.emit(_this.editor);
|
|
13146
|
-
(_a = _this.placeholderInstance) === null || _a === void 0 ? void 0 : _a.checkStatus();
|
|
13147
13067
|
_this.applyAutoFocus();
|
|
13148
13068
|
});
|
|
13149
13069
|
};
|
|
@@ -13194,13 +13114,16 @@
|
|
|
13194
13114
|
};
|
|
13195
13115
|
TheEditorComponent.prototype.valueChange = function (value) {
|
|
13196
13116
|
var _a, _b, _c, _d, _e, _f;
|
|
13197
|
-
(_a = this.
|
|
13198
|
-
(
|
|
13199
|
-
|
|
13117
|
+
var isEditable = !((_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.readonly) && !((_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.disabled);
|
|
13118
|
+
(_c = this.theGlobalToolbarInstance) === null || _c === void 0 ? void 0 : _c.statusChange(this.editor);
|
|
13119
|
+
// quick insert button
|
|
13120
|
+
if (isEditable) {
|
|
13121
|
+
(_d = this.quickInsertInstance) === null || _d === void 0 ? void 0 : _d.checkStatus();
|
|
13122
|
+
}
|
|
13200
13123
|
// auto scroll view
|
|
13201
|
-
var scrollContainer = (
|
|
13202
|
-
var maxHeight = (
|
|
13203
|
-
if (
|
|
13124
|
+
var scrollContainer = (_e = this.theOptions) === null || _e === void 0 ? void 0 : _e.scrollContainer;
|
|
13125
|
+
var maxHeight = (_f = this.theOptions) === null || _f === void 0 ? void 0 : _f.maxHeight;
|
|
13126
|
+
if (isEditable && (scrollContainer || maxHeight)) {
|
|
13204
13127
|
var container = maxHeight ? DEFAULT_SCROLL_CONTAINER : scrollContainer;
|
|
13205
13128
|
this.autoScrollView(this.editor, container);
|
|
13206
13129
|
}
|
|
@@ -13330,7 +13253,7 @@
|
|
|
13330
13253
|
useExisting: i0.forwardRef(function () { return TheEditorComponent; }),
|
|
13331
13254
|
multi: true
|
|
13332
13255
|
}
|
|
13333
|
-
], viewQueries: [{ propertyName: "templateInstance", first: true, predicate: ["templateInstance"], descendants: true, static: true }, { propertyName: "globalToolbarInstance", first: true, predicate: ["globalToolbar"], descendants: true }, { propertyName: "quickInsertInstance", first: true, predicate: ["quickInsert"], descendants: true, static: true }
|
|
13256
|
+
], viewQueries: [{ propertyName: "templateInstance", first: true, predicate: ["templateInstance"], descendants: true, static: true }, { propertyName: "globalToolbarInstance", first: true, predicate: ["globalToolbar"], descendants: true }, { propertyName: "quickInsertInstance", first: true, predicate: ["quickInsert"], descendants: true, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace, template: "<the-toolbar\n *ngIf=\"!theOptions?.readonly && !theGlobalToolbar\"\n [ngClass]=\"{\n 'the-toolbar-disabled': theOptions?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.global\"\n [containerClass]=\"globalToolbarClass\"\n [align]=\"theOptions?.toolbar?.align\"\n></the-toolbar>\n\n<div\n class=\"the-editable-container\"\n [ngClass]=\"{\n 'the-editor-disabled': theOptions?.disabled,\n 'max-height': maxHeight\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n (ngModelChange)=\"valueChange($event)\"\n [decorate]=\"decorate\"\n [placeholder]=\"theOptions?.placeholder\"\n [placeholderDecorate]=\"theOptions?.placeholderDecorate ? theOptions?.placeholderDecorate : null\"\n [renderElement]=\"renderElement\"\n [renderText]=\"renderText\"\n [renderLeaf]=\"renderLeaf\"\n [readonly]=\"theOptions?.readonly || theOptions?.disabled\"\n [keydown]=\"onKeyDown\"\n [click]=\"onClick\"\n [paste]=\"onSlaPaste\"\n [beforeInput]=\"onSlaBeforeInput\"\n [blur]=\"onSlaBlur\"\n [focus]=\"onSlaFocus\"\n [copy]=\"onSlaCopy\"\n [cut]=\"onSlaCut\"\n [isStrictDecorate]=\"false\"\n [compositionStart]=\"onSlaCompositionStart\"\n [compositionEnd]=\"onSlaCompositionEnd\"\n [dragStart]=\"onSlaDragStart\"\n [dragOver]=\"onSlaDragOver\"\n [drop]=\"onDrop\"\n (mousedown)=\"mousedown($event)\"\n ></slate-editable>\n <the-inline-toolbar *ngIf=\"!theOptions?.readonly\" [editor]=\"editor\" [toolbarItems]=\"toolbarEntity.inline\"></the-inline-toolbar>\n <div\n #quickInsert\n theQuickInsert\n [editor]=\"editor\"\n [quickToolbarItems]=\"quickToolbarItems\"\n [isVisible]=\"theOptions?.quickInsertVisible\"\n ></div>\n <the-template #templateInstance></the-template>\n</div>\n", components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "containerClass", "isMore", "afterTemplate"] }, { type: i1__namespace.SlateEditableComponent, selector: "slate-editable", inputs: ["editor", "renderElement", "renderLeaf", "renderText", "decorate", "placeholderDecorate", "isStrictDecorate", "trackBy", "readonly", "placeholder", "beforeInput", "blur", "click", "compositionEnd", "compositionStart", "copy", "cut", "dragOver", "dragStart", "dragEnd", "drop", "focus", "keydown", "paste", "spellCheck", "autoCorrect", "autoCapitalize"] }, { type: TheInlineToolbarComponent, selector: "the-inline-toolbar", inputs: ["editor", "toolbarItems"] }, { type: TheQuickInsertComponent, selector: "[theQuickInsert]", inputs: ["editor", "quickToolbarItems", "isVisible"] }, { type: TheTemplateComponent, selector: "the-template,[theTemplate]" }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4__namespace$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4__namespace$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
13334
13257
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheEditorComponent, decorators: [{
|
|
13335
13258
|
type: i0.Component,
|
|
13336
13259
|
args: [{
|
|
@@ -13377,9 +13300,6 @@
|
|
|
13377
13300
|
}], quickInsertInstance: [{
|
|
13378
13301
|
type: i0.ViewChild,
|
|
13379
13302
|
args: ['quickInsert', { static: true }]
|
|
13380
|
-
}], placeholderInstance: [{
|
|
13381
|
-
type: i0.ViewChild,
|
|
13382
|
-
args: ['placeholder']
|
|
13383
13303
|
}] } });
|
|
13384
13304
|
|
|
13385
13305
|
var ENTRY_COMMON_COMPONENTS = [TheColumnResizeOverlayHandleComponent];
|
|
@@ -13594,7 +13514,6 @@
|
|
|
13594
13514
|
TheTableComponent,
|
|
13595
13515
|
TheTableRowComponent,
|
|
13596
13516
|
TheTdComponent,
|
|
13597
|
-
ThePlaceholderComponent,
|
|
13598
13517
|
TheInlineCodeComponent
|
|
13599
13518
|
];
|
|
13600
13519
|
var PIPES = [ElementStylePipe, ElementClassPipe];
|
|
@@ -13638,7 +13557,6 @@
|
|
|
13638
13557
|
TheTableComponent,
|
|
13639
13558
|
TheTableRowComponent,
|
|
13640
13559
|
TheTdComponent,
|
|
13641
|
-
ThePlaceholderComponent,
|
|
13642
13560
|
TheInlineCodeComponent], imports: [i6.CommonModule, i1.SlateModule, i4$2.FormsModule, i4$1.ThyIconModule,
|
|
13643
13561
|
avatar.ThyAvatarModule,
|
|
13644
13562
|
i3.ThyNavModule,
|
|
@@ -13764,6 +13682,7 @@
|
|
|
13764
13682
|
exports.getToolbarClass = getToolbarClass;
|
|
13765
13683
|
exports.htmlToTheia = htmlToTheia;
|
|
13766
13684
|
exports.inValidTypes = inValidTypes;
|
|
13685
|
+
exports.isCleanEmptyParagraph = isCleanEmptyParagraph;
|
|
13767
13686
|
exports.plainToTheia = plainToTheia;
|
|
13768
13687
|
exports.toolbarCompose = toolbarCompose;
|
|
13769
13688
|
exports.withTheEditor = withTheEditor;
|