@worktile/theia 2.1.14 → 2.2.3
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 +433 -224
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/components/element/element.component.d.ts +1 -0
- package/constants/node-types.d.ts +6 -1
- package/custom-types.d.ts +1 -0
- package/editor.module.d.ts +44 -44
- package/esm2015/components/element/element.component.js +11 -4
- package/esm2015/constants/node-types.js +7 -1
- package/esm2015/custom-types.js +1 -1
- package/esm2015/editor.component.js +1 -1
- package/esm2015/editor.module.js +6 -3
- package/esm2015/interfaces/editor.js +1 -1
- package/esm2015/plugins/common/block-card.plugin.js +2 -2
- package/esm2015/plugins/indent/indent.editor.js +87 -0
- package/esm2015/plugins/indent/indent.plugin.js +3 -3
- package/esm2015/plugins/indent/on-keydown-indent.js +40 -54
- package/esm2015/plugins/indent/options.js +28 -0
- package/esm2015/plugins/indent/toolbar-item.component.js +115 -0
- package/esm2015/plugins/index.js +5 -3
- package/esm2015/plugins/inline-code/inline-code.component.js +2 -2
- package/esm2015/plugins/list/components/bulleted-list.component.js +11 -14
- package/esm2015/plugins/list/components/numbered-list.component.js +12 -15
- package/esm2015/plugins/todo-item/todo-item.component.js +8 -26
- package/esm2015/utils/is-clean-empty-paragraph.js +3 -1
- package/fesm2015/worktile-theia.js +412 -219
- package/fesm2015/worktile-theia.js.map +1 -1
- package/interfaces/editor.d.ts +1 -1
- package/package.json +1 -1
- package/plugins/indent/indent.editor.d.ts +10 -0
- package/plugins/indent/indent.plugin.d.ts +2 -1
- package/plugins/indent/on-keydown-indent.d.ts +1 -1
- package/plugins/indent/options.d.ts +2 -0
- package/plugins/indent/toolbar-item.component.d.ts +36 -0
- package/plugins/list/components/bulleted-list.component.d.ts +2 -4
- package/plugins/list/components/numbered-list.component.d.ts +2 -4
- package/plugins/todo-item/todo-item.component.d.ts +2 -3
- package/plugins/todo-item/todo-item.component.scss +0 -3
- package/styles/editor.scss +15 -0
- package/styles/typo.scss +0 -5
|
@@ -410,6 +410,7 @@
|
|
|
410
410
|
ElementKinds["link"] = "link";
|
|
411
411
|
ElementKinds["default"] = "paragraph";
|
|
412
412
|
ElementKinds["inlineCode"] = "inline-code";
|
|
413
|
+
ElementKinds["indent"] = "indent";
|
|
413
414
|
})(exports.ElementKinds || (exports.ElementKinds = {}));
|
|
414
415
|
exports.Alignment = void 0;
|
|
415
416
|
(function (Alignment) {
|
|
@@ -451,6 +452,11 @@
|
|
|
451
452
|
exports.FontSizes.fontSize40,
|
|
452
453
|
exports.FontSizes.fontSize48
|
|
453
454
|
];
|
|
455
|
+
exports.Indents = void 0;
|
|
456
|
+
(function (Indents) {
|
|
457
|
+
Indents["indentRight"] = "indent-right";
|
|
458
|
+
Indents["indentLeft"] = "indent-left";
|
|
459
|
+
})(exports.Indents || (exports.Indents = {}));
|
|
454
460
|
exports.MarkTypes = void 0;
|
|
455
461
|
(function (MarkTypes) {
|
|
456
462
|
MarkTypes["bold"] = "bold";
|
|
@@ -750,10 +756,18 @@
|
|
|
750
756
|
function TheDefaultElementComponent() {
|
|
751
757
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
752
758
|
}
|
|
759
|
+
Object.defineProperty(TheDefaultElementComponent.prototype, "indent", {
|
|
760
|
+
get: function () {
|
|
761
|
+
var _a;
|
|
762
|
+
return (_a = this.element) === null || _a === void 0 ? void 0 : _a.indent;
|
|
763
|
+
},
|
|
764
|
+
enumerable: false,
|
|
765
|
+
configurable: true
|
|
766
|
+
});
|
|
753
767
|
return TheDefaultElementComponent;
|
|
754
768
|
}(TheBaseElementComponent));
|
|
755
769
|
TheDefaultElementComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheDefaultElementComponent, deps: null, target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
756
|
-
TheDefaultElementComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheDefaultElementComponent, selector: "[theDefaultElement]", usesInheritance: true, ngImport: i0__namespace, template: '<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>', isInline: true, components: [{ type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
770
|
+
TheDefaultElementComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheDefaultElementComponent, selector: "[theDefaultElement]", host: { properties: { "attr.the-indent": "this.indent" } }, usesInheritance: true, ngImport: i0__namespace, template: '<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>', isInline: true, components: [{ type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
757
771
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheDefaultElementComponent, decorators: [{
|
|
758
772
|
type: i0.Component,
|
|
759
773
|
args: [{
|
|
@@ -761,7 +775,10 @@
|
|
|
761
775
|
template: '<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>',
|
|
762
776
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
763
777
|
}]
|
|
764
|
-
}]
|
|
778
|
+
}], propDecorators: { indent: [{
|
|
779
|
+
type: i0.HostBinding,
|
|
780
|
+
args: ['attr.the-indent']
|
|
781
|
+
}] } });
|
|
765
782
|
|
|
766
783
|
var TheEditor = Object.assign({}, i1.AngularEditor);
|
|
767
784
|
exports.TheDataMode = void 0;
|
|
@@ -2488,12 +2505,14 @@
|
|
|
2488
2505
|
var align = 'align';
|
|
2489
2506
|
var hasTextIndent = block[textIndent];
|
|
2490
2507
|
var hasAlign = block[align];
|
|
2508
|
+
var hasIndent = block[exports.ElementKinds.indent];
|
|
2491
2509
|
if (slate.Node.string(block) === '' &&
|
|
2492
2510
|
slate.Element.isElement(block) &&
|
|
2493
2511
|
block.type === exports.ElementKinds.paragraph &&
|
|
2494
2512
|
block.children.length === 1 &&
|
|
2495
2513
|
slate.Text.isText(block.children[0]) &&
|
|
2496
2514
|
!slate.Editor.isVoid(editor, block) &&
|
|
2515
|
+
!hasIndent &&
|
|
2497
2516
|
!hasTextIndent &&
|
|
2498
2517
|
!hasAlign) {
|
|
2499
2518
|
return true;
|
|
@@ -3138,86 +3157,6 @@
|
|
|
3138
3157
|
return editor;
|
|
3139
3158
|
};
|
|
3140
3159
|
|
|
3141
|
-
var onKeydownIndent = function (editor, event, kinds) {
|
|
3142
|
-
var selection = editor.selection;
|
|
3143
|
-
if (event.key === 'Tab') {
|
|
3144
|
-
event.preventDefault();
|
|
3145
|
-
var isExpanded = slate.Range.isExpanded(selection);
|
|
3146
|
-
var nodes = Array.from(slate.Editor.nodes(editor, {
|
|
3147
|
-
mode: 'highest',
|
|
3148
|
-
match: indentNodeMatch(kinds)
|
|
3149
|
-
}));
|
|
3150
|
-
var startBlock = nodes[0];
|
|
3151
|
-
if (startBlock && (isExpanded || slate.Editor.isStart(editor, selection.anchor, [startBlock[1][0]]))) {
|
|
3152
|
-
if (!editor.isVoid(startBlock[0])) {
|
|
3153
|
-
if (event.shiftKey) {
|
|
3154
|
-
return cancelTextIntent(editor, startBlock[0], kinds);
|
|
3155
|
-
}
|
|
3156
|
-
var textIndent = startBlock[0].textIndent;
|
|
3157
|
-
textIndent = textIndent ? textIndent : 0;
|
|
3158
|
-
textIndent += 2;
|
|
3159
|
-
if (textIndent < 50) {
|
|
3160
|
-
slate.Transforms.setNodes(editor, { textIndent: textIndent }, {
|
|
3161
|
-
mode: 'highest',
|
|
3162
|
-
match: indentNodeMatch(kinds)
|
|
3163
|
-
});
|
|
3164
|
-
return true;
|
|
3165
|
-
}
|
|
3166
|
-
}
|
|
3167
|
-
}
|
|
3168
|
-
else {
|
|
3169
|
-
editor.insertText(TAB_SPACE);
|
|
3170
|
-
return true;
|
|
3171
|
-
}
|
|
3172
|
-
}
|
|
3173
|
-
if (selection && slate.Range.isCollapsed(selection) && event.key === 'Backspace') {
|
|
3174
|
-
var nodes = Array.from(slate.Editor.nodes(editor, {
|
|
3175
|
-
mode: 'highest',
|
|
3176
|
-
match: indentNodeMatch(kinds)
|
|
3177
|
-
}));
|
|
3178
|
-
var startBlock = nodes[0];
|
|
3179
|
-
if (startBlock && slate.Editor.isStart(editor, selection.anchor, [startBlock[1][0]])) {
|
|
3180
|
-
return cancelTextIntent(editor, startBlock[0], kinds);
|
|
3181
|
-
}
|
|
3182
|
-
}
|
|
3183
|
-
return false;
|
|
3184
|
-
};
|
|
3185
|
-
var indentNodeMatch = function (kinds) { return function (node) { return slate.Element.isElement(node) && kinds.includes(node.type); }; };
|
|
3186
|
-
function cancelTextIntent(editor, anchorBlock, kinds) {
|
|
3187
|
-
var textIndent = anchorBlock.textIndent;
|
|
3188
|
-
if (textIndent > 2) {
|
|
3189
|
-
// prevent deleteBackward function
|
|
3190
|
-
event.preventDefault();
|
|
3191
|
-
textIndent -= 2;
|
|
3192
|
-
slate.Transforms.setNodes(editor, { textIndent: textIndent }, {
|
|
3193
|
-
mode: 'highest',
|
|
3194
|
-
match: indentNodeMatch(kinds)
|
|
3195
|
-
});
|
|
3196
|
-
return true;
|
|
3197
|
-
}
|
|
3198
|
-
if (textIndent === 2) {
|
|
3199
|
-
// prevent deleteBackward function
|
|
3200
|
-
event.preventDefault();
|
|
3201
|
-
slate.Transforms.setNodes(editor, { textIndent: null }, {
|
|
3202
|
-
mode: 'highest',
|
|
3203
|
-
match: function (node) { return slate.Element.isElement(node) && kinds.includes(node.type); }
|
|
3204
|
-
});
|
|
3205
|
-
return true;
|
|
3206
|
-
}
|
|
3207
|
-
return false;
|
|
3208
|
-
}
|
|
3209
|
-
|
|
3210
|
-
var withIndent = function (kinds) { return function (editor) {
|
|
3211
|
-
var onKeydown = editor.onKeydown;
|
|
3212
|
-
editor.onKeydown = function (event) {
|
|
3213
|
-
var isContinue = !onKeydownIndent(editor, event, kinds);
|
|
3214
|
-
if (isContinue) {
|
|
3215
|
-
onKeydown(event);
|
|
3216
|
-
}
|
|
3217
|
-
};
|
|
3218
|
-
return editor;
|
|
3219
|
-
}; };
|
|
3220
|
-
|
|
3221
3160
|
var isList = function (n) {
|
|
3222
3161
|
return __spreadArray([], __read(LIST_BLOCK_TYPES)).includes(n.type);
|
|
3223
3162
|
};
|
|
@@ -3787,58 +3726,12 @@
|
|
|
3787
3726
|
}
|
|
3788
3727
|
}
|
|
3789
3728
|
|
|
3790
|
-
var ElementStylePipe = /** @class */ (function () {
|
|
3791
|
-
function ElementStylePipe() {
|
|
3792
|
-
}
|
|
3793
|
-
ElementStylePipe.prototype.transform = function (element, align) {
|
|
3794
|
-
var style = {};
|
|
3795
|
-
if (element.align || align) {
|
|
3796
|
-
style.textAlign = element.align || align || exports.Alignment.left;
|
|
3797
|
-
}
|
|
3798
|
-
if (element.textIndent) {
|
|
3799
|
-
style.textIndent = element.textIndent + 'em';
|
|
3800
|
-
}
|
|
3801
|
-
return style;
|
|
3802
|
-
};
|
|
3803
|
-
return ElementStylePipe;
|
|
3804
|
-
}());
|
|
3805
|
-
ElementStylePipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementStylePipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
|
|
3806
|
-
ElementStylePipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementStylePipe, name: "elementStyle" });
|
|
3807
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementStylePipe, decorators: [{
|
|
3808
|
-
type: i0.Pipe,
|
|
3809
|
-
args: [{
|
|
3810
|
-
name: 'elementStyle'
|
|
3811
|
-
}]
|
|
3812
|
-
}] });
|
|
3813
|
-
var ElementClassPipe = /** @class */ (function () {
|
|
3814
|
-
function ElementClassPipe() {
|
|
3815
|
-
}
|
|
3816
|
-
ElementClassPipe.prototype.transform = function (element) {
|
|
3817
|
-
var classStr = '';
|
|
3818
|
-
var prefix = 'indent';
|
|
3819
|
-
if (element.textIndent) {
|
|
3820
|
-
classStr += prefix + "-" + element.textIndent;
|
|
3821
|
-
}
|
|
3822
|
-
return classStr;
|
|
3823
|
-
};
|
|
3824
|
-
return ElementClassPipe;
|
|
3825
|
-
}());
|
|
3826
|
-
ElementClassPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementClassPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
|
|
3827
|
-
ElementClassPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementClassPipe, name: "elementClass" });
|
|
3828
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementClassPipe, decorators: [{
|
|
3829
|
-
type: i0.Pipe,
|
|
3830
|
-
args: [{
|
|
3831
|
-
name: 'elementClass'
|
|
3832
|
-
}]
|
|
3833
|
-
}] });
|
|
3834
|
-
|
|
3835
3729
|
var TheNumberedListComponent = /** @class */ (function (_super) {
|
|
3836
3730
|
__extends(TheNumberedListComponent, _super);
|
|
3837
|
-
function TheNumberedListComponent(elementRef, cdr
|
|
3731
|
+
function TheNumberedListComponent(elementRef, cdr) {
|
|
3838
3732
|
var _this = _super.call(this, elementRef, cdr) || this;
|
|
3839
3733
|
_this.elementRef = elementRef;
|
|
3840
3734
|
_this.cdr = cdr;
|
|
3841
|
-
_this.elementClassPipe = elementClassPipe;
|
|
3842
3735
|
return _this;
|
|
3843
3736
|
}
|
|
3844
3737
|
Object.defineProperty(TheNumberedListComponent.prototype, "start", {
|
|
@@ -3848,9 +3741,10 @@
|
|
|
3848
3741
|
enumerable: false,
|
|
3849
3742
|
configurable: true
|
|
3850
3743
|
});
|
|
3851
|
-
Object.defineProperty(TheNumberedListComponent.prototype, "
|
|
3744
|
+
Object.defineProperty(TheNumberedListComponent.prototype, "level", {
|
|
3852
3745
|
get: function () {
|
|
3853
|
-
|
|
3746
|
+
var _a;
|
|
3747
|
+
return (_a = this.element) === null || _a === void 0 ? void 0 : _a.indent;
|
|
3854
3748
|
},
|
|
3855
3749
|
enumerable: false,
|
|
3856
3750
|
configurable: true
|
|
@@ -3863,35 +3757,34 @@
|
|
|
3863
3757
|
};
|
|
3864
3758
|
return TheNumberedListComponent;
|
|
3865
3759
|
}(TheBaseElementComponent));
|
|
3866
|
-
TheNumberedListComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheNumberedListComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }
|
|
3867
|
-
TheNumberedListComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheNumberedListComponent, selector: "ol[theOl]", host: { properties: { "attr.start": "this.start", "
|
|
3760
|
+
TheNumberedListComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheNumberedListComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
3761
|
+
TheNumberedListComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheNumberedListComponent, selector: "ol[theOl]", host: { properties: { "attr.start": "this.start", "attr.the-level": "this.level" } }, usesInheritance: true, ngImport: i0__namespace, template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>", isInline: true, components: [{ type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
|
|
3868
3762
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheNumberedListComponent, decorators: [{
|
|
3869
3763
|
type: i0.Component,
|
|
3870
3764
|
args: [{
|
|
3871
3765
|
selector: 'ol[theOl]',
|
|
3872
|
-
template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>"
|
|
3873
|
-
providers: [ElementClassPipe]
|
|
3766
|
+
template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>"
|
|
3874
3767
|
}]
|
|
3875
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }
|
|
3768
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { start: [{
|
|
3876
3769
|
type: i0.HostBinding,
|
|
3877
3770
|
args: ['attr.start']
|
|
3878
|
-
}],
|
|
3771
|
+
}], level: [{
|
|
3879
3772
|
type: i0.HostBinding,
|
|
3880
|
-
args: ['
|
|
3773
|
+
args: ['attr.the-level']
|
|
3881
3774
|
}] } });
|
|
3882
3775
|
|
|
3883
3776
|
var TheBulletedListComponent = /** @class */ (function (_super) {
|
|
3884
3777
|
__extends(TheBulletedListComponent, _super);
|
|
3885
|
-
function TheBulletedListComponent(elementRef, cdr
|
|
3778
|
+
function TheBulletedListComponent(elementRef, cdr) {
|
|
3886
3779
|
var _this = _super.call(this, elementRef, cdr) || this;
|
|
3887
3780
|
_this.elementRef = elementRef;
|
|
3888
3781
|
_this.cdr = cdr;
|
|
3889
|
-
_this.elementClassPipe = elementClassPipe;
|
|
3890
3782
|
return _this;
|
|
3891
3783
|
}
|
|
3892
|
-
Object.defineProperty(TheBulletedListComponent.prototype, "
|
|
3784
|
+
Object.defineProperty(TheBulletedListComponent.prototype, "level", {
|
|
3893
3785
|
get: function () {
|
|
3894
|
-
|
|
3786
|
+
var _a;
|
|
3787
|
+
return (_a = this.element) === null || _a === void 0 ? void 0 : _a.indent;
|
|
3895
3788
|
},
|
|
3896
3789
|
enumerable: false,
|
|
3897
3790
|
configurable: true
|
|
@@ -3904,18 +3797,17 @@
|
|
|
3904
3797
|
};
|
|
3905
3798
|
return TheBulletedListComponent;
|
|
3906
3799
|
}(TheBaseElementComponent));
|
|
3907
|
-
TheBulletedListComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheBulletedListComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }
|
|
3908
|
-
TheBulletedListComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheBulletedListComponent, selector: "ul[theUl]", host: { properties: { "
|
|
3800
|
+
TheBulletedListComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheBulletedListComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
3801
|
+
TheBulletedListComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheBulletedListComponent, selector: "ul[theUl]", host: { properties: { "attr.the-level": "this.level" } }, usesInheritance: true, ngImport: i0__namespace, template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>", isInline: true, components: [{ type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
|
|
3909
3802
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheBulletedListComponent, decorators: [{
|
|
3910
3803
|
type: i0.Component,
|
|
3911
3804
|
args: [{
|
|
3912
3805
|
selector: 'ul[theUl]',
|
|
3913
|
-
template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>"
|
|
3914
|
-
providers: [ElementClassPipe]
|
|
3806
|
+
template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>"
|
|
3915
3807
|
}]
|
|
3916
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }
|
|
3808
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { level: [{
|
|
3917
3809
|
type: i0.HostBinding,
|
|
3918
|
-
args: ['
|
|
3810
|
+
args: ['attr.the-level']
|
|
3919
3811
|
}] } });
|
|
3920
3812
|
|
|
3921
3813
|
var TheListItemComponent = /** @class */ (function (_super) {
|
|
@@ -4248,52 +4140,6 @@
|
|
|
4248
4140
|
};
|
|
4249
4141
|
};
|
|
4250
4142
|
|
|
4251
|
-
/** Converts CSS pixel values to numbers, eg "123px" to 123. Returns NaN for non pixel values. */
|
|
4252
|
-
function coercePixelsFromCssValue(cssValue) {
|
|
4253
|
-
var match = cssValue.match(/(\d+)px/);
|
|
4254
|
-
if (match) {
|
|
4255
|
-
return Number(match[1]);
|
|
4256
|
-
}
|
|
4257
|
-
}
|
|
4258
|
-
function getElementWidth(element) {
|
|
4259
|
-
// Optimization: Check style.width first as we probably set it already before reading
|
|
4260
|
-
// offsetWidth which triggers layout.
|
|
4261
|
-
return coercePixelsFromCssValue(element.style.width) || element.offsetWidth;
|
|
4262
|
-
}
|
|
4263
|
-
function getElementHeight(element) {
|
|
4264
|
-
return Math.round(element.getBoundingClientRect().height);
|
|
4265
|
-
}
|
|
4266
|
-
function getColsTotalWidth(cols) {
|
|
4267
|
-
return cols.reduce(function (total, col) {
|
|
4268
|
-
return total + getElementWidth(col);
|
|
4269
|
-
}, 0);
|
|
4270
|
-
}
|
|
4271
|
-
function getRowsTotalHeight(rows) {
|
|
4272
|
-
return rows.reduce(function (total, row) {
|
|
4273
|
-
return total + getElementHeight(row);
|
|
4274
|
-
}, 0);
|
|
4275
|
-
}
|
|
4276
|
-
function useElementStyle(el, element) {
|
|
4277
|
-
if (element.align) {
|
|
4278
|
-
el.style.textAlign = element.align || exports.Alignment.left;
|
|
4279
|
-
}
|
|
4280
|
-
if (element.textIndent) {
|
|
4281
|
-
el.style.textIndent = element.textIndent + 'em';
|
|
4282
|
-
}
|
|
4283
|
-
if (element.verticalAlign) {
|
|
4284
|
-
el.style.verticalAlign = element.verticalAlign;
|
|
4285
|
-
}
|
|
4286
|
-
}
|
|
4287
|
-
function getElementClassByPrefix(el, prefix) {
|
|
4288
|
-
var matchClass = null;
|
|
4289
|
-
el.classList.forEach(function (value, key) {
|
|
4290
|
-
if (value.includes(prefix)) {
|
|
4291
|
-
matchClass = value;
|
|
4292
|
-
}
|
|
4293
|
-
});
|
|
4294
|
-
return matchClass;
|
|
4295
|
-
}
|
|
4296
|
-
|
|
4297
4143
|
var TheTodoItemComponent = /** @class */ (function (_super) {
|
|
4298
4144
|
__extends(TheTodoItemComponent, _super);
|
|
4299
4145
|
function TheTodoItemComponent(elementRef, cdr) {
|
|
@@ -4303,15 +4149,16 @@
|
|
|
4303
4149
|
_this.checkItemClass = true;
|
|
4304
4150
|
return _this;
|
|
4305
4151
|
}
|
|
4306
|
-
TheTodoItemComponent.prototype
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
}
|
|
4311
|
-
|
|
4152
|
+
Object.defineProperty(TheTodoItemComponent.prototype, "level", {
|
|
4153
|
+
get: function () {
|
|
4154
|
+
var _a;
|
|
4155
|
+
return (_a = this.element) === null || _a === void 0 ? void 0 : _a.indent;
|
|
4156
|
+
},
|
|
4157
|
+
enumerable: false,
|
|
4158
|
+
configurable: true
|
|
4159
|
+
});
|
|
4312
4160
|
TheTodoItemComponent.prototype.ngOnInit = function () {
|
|
4313
4161
|
_super.prototype.ngOnInit.call(this);
|
|
4314
|
-
this.useIndentClass(this.elementRef.nativeElement, this.element);
|
|
4315
4162
|
};
|
|
4316
4163
|
TheTodoItemComponent.prototype.onCheck = function (checked) {
|
|
4317
4164
|
if (this.readonly) {
|
|
@@ -4319,27 +4166,10 @@
|
|
|
4319
4166
|
}
|
|
4320
4167
|
setNode(this.editor, { checked: checked }, this.element);
|
|
4321
4168
|
};
|
|
4322
|
-
TheTodoItemComponent.prototype.useIndentClass = function (el, element) {
|
|
4323
|
-
var prefix = 'indent';
|
|
4324
|
-
if (element.textIndent) {
|
|
4325
|
-
var oldClass = getElementClassByPrefix(el, prefix);
|
|
4326
|
-
if (oldClass) {
|
|
4327
|
-
el.classList.remove(oldClass);
|
|
4328
|
-
}
|
|
4329
|
-
var newClassName = prefix + "-" + element.textIndent;
|
|
4330
|
-
el.classList.add(newClassName);
|
|
4331
|
-
}
|
|
4332
|
-
else {
|
|
4333
|
-
var oldClass = getElementClassByPrefix(el, prefix);
|
|
4334
|
-
if (oldClass) {
|
|
4335
|
-
el.classList.remove(oldClass);
|
|
4336
|
-
}
|
|
4337
|
-
}
|
|
4338
|
-
};
|
|
4339
4169
|
return TheTodoItemComponent;
|
|
4340
4170
|
}(TheBaseElementComponent));
|
|
4341
4171
|
TheTodoItemComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheTodoItemComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
4342
|
-
TheTodoItemComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheTodoItemComponent, selector: "div[theTodoItem]", host: { properties: { "class.the-check-item": "this.checkItemClass" } }, usesInheritance: true, ngImport: i0__namespace, template: "\n <span contenteditable=\"false\" class=\"todo-item-status\">\n <input #checkbox type=\"checkbox\" [checked]=\"element.checked\" (click)=\"onCheck(checkbox.checked)\" />\n </span>\n <slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n ", isInline: true, components: [{ type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
|
|
4172
|
+
TheTodoItemComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheTodoItemComponent, selector: "div[theTodoItem]", host: { properties: { "class.the-check-item": "this.checkItemClass", "attr.the-level": "this.level" } }, usesInheritance: true, ngImport: i0__namespace, template: "\n <span contenteditable=\"false\" class=\"todo-item-status\">\n <input #checkbox type=\"checkbox\" [checked]=\"element.checked\" (click)=\"onCheck(checkbox.checked)\" />\n </span>\n <slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n ", isInline: true, components: [{ type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
|
|
4343
4173
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheTodoItemComponent, decorators: [{
|
|
4344
4174
|
type: i0.Component,
|
|
4345
4175
|
args: [{
|
|
@@ -4349,6 +4179,9 @@
|
|
|
4349
4179
|
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { checkItemClass: [{
|
|
4350
4180
|
type: i0.HostBinding,
|
|
4351
4181
|
args: ['class.the-check-item']
|
|
4182
|
+
}], level: [{
|
|
4183
|
+
type: i0.HostBinding,
|
|
4184
|
+
args: ['attr.the-level']
|
|
4352
4185
|
}] } });
|
|
4353
4186
|
|
|
4354
4187
|
var withTodoItem = function (editor) {
|
|
@@ -4987,7 +4820,7 @@
|
|
|
4987
4820
|
return;
|
|
4988
4821
|
}
|
|
4989
4822
|
// → + right-block-card
|
|
4990
|
-
if (
|
|
4823
|
+
if (isMoveForward && !isCardLeftCursor) {
|
|
4991
4824
|
nativeEvent.preventDefault();
|
|
4992
4825
|
var _c = __read(i1.AngularEditor.toSlateCardEntry(editor, anchorNode), 2), path = _c[1];
|
|
4993
4826
|
var nextPath = slate.Path.next(path);
|
|
@@ -8706,6 +8539,52 @@
|
|
|
8706
8539
|
type: i0.Injectable
|
|
8707
8540
|
}], ctorParameters: function () { return []; } });
|
|
8708
8541
|
|
|
8542
|
+
/** Converts CSS pixel values to numbers, eg "123px" to 123. Returns NaN for non pixel values. */
|
|
8543
|
+
function coercePixelsFromCssValue(cssValue) {
|
|
8544
|
+
var match = cssValue.match(/(\d+)px/);
|
|
8545
|
+
if (match) {
|
|
8546
|
+
return Number(match[1]);
|
|
8547
|
+
}
|
|
8548
|
+
}
|
|
8549
|
+
function getElementWidth(element) {
|
|
8550
|
+
// Optimization: Check style.width first as we probably set it already before reading
|
|
8551
|
+
// offsetWidth which triggers layout.
|
|
8552
|
+
return coercePixelsFromCssValue(element.style.width) || element.offsetWidth;
|
|
8553
|
+
}
|
|
8554
|
+
function getElementHeight(element) {
|
|
8555
|
+
return Math.round(element.getBoundingClientRect().height);
|
|
8556
|
+
}
|
|
8557
|
+
function getColsTotalWidth(cols) {
|
|
8558
|
+
return cols.reduce(function (total, col) {
|
|
8559
|
+
return total + getElementWidth(col);
|
|
8560
|
+
}, 0);
|
|
8561
|
+
}
|
|
8562
|
+
function getRowsTotalHeight(rows) {
|
|
8563
|
+
return rows.reduce(function (total, row) {
|
|
8564
|
+
return total + getElementHeight(row);
|
|
8565
|
+
}, 0);
|
|
8566
|
+
}
|
|
8567
|
+
function useElementStyle(el, element) {
|
|
8568
|
+
if (element.align) {
|
|
8569
|
+
el.style.textAlign = element.align || exports.Alignment.left;
|
|
8570
|
+
}
|
|
8571
|
+
if (element.textIndent) {
|
|
8572
|
+
el.style.textIndent = element.textIndent + 'em';
|
|
8573
|
+
}
|
|
8574
|
+
if (element.verticalAlign) {
|
|
8575
|
+
el.style.verticalAlign = element.verticalAlign;
|
|
8576
|
+
}
|
|
8577
|
+
}
|
|
8578
|
+
function getElementClassByPrefix(el, prefix) {
|
|
8579
|
+
var matchClass = null;
|
|
8580
|
+
el.classList.forEach(function (value, key) {
|
|
8581
|
+
if (value.includes(prefix)) {
|
|
8582
|
+
matchClass = value;
|
|
8583
|
+
}
|
|
8584
|
+
});
|
|
8585
|
+
return matchClass;
|
|
8586
|
+
}
|
|
8587
|
+
|
|
8709
8588
|
function splitCell(editor) {
|
|
8710
8589
|
var opts = new TableOptions$1();
|
|
8711
8590
|
var anchor = editor.selection.anchor;
|
|
@@ -12149,7 +12028,7 @@
|
|
|
12149
12028
|
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
12150
12029
|
// Put this at the start and end of an inline component to work around this Chromium bug:
|
|
12151
12030
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=1249405
|
|
12152
|
-
_this.inlineChromiumBugfix =
|
|
12031
|
+
_this.inlineChromiumBugfix = String.fromCodePoint(160);
|
|
12153
12032
|
return _this;
|
|
12154
12033
|
}
|
|
12155
12034
|
return TheInlineCodeComponent;
|
|
@@ -12205,6 +12084,289 @@
|
|
|
12205
12084
|
return editor;
|
|
12206
12085
|
};
|
|
12207
12086
|
|
|
12087
|
+
var TheIndentToolbarComponent = /** @class */ (function (_super) {
|
|
12088
|
+
__extends(TheIndentToolbarComponent, _super);
|
|
12089
|
+
function TheIndentToolbarComponent(elementRef, thyPopover, viewContainerRef, overlay) {
|
|
12090
|
+
var _this = _super.call(this) || this;
|
|
12091
|
+
_this.elementRef = elementRef;
|
|
12092
|
+
_this.thyPopover = thyPopover;
|
|
12093
|
+
_this.viewContainerRef = viewContainerRef;
|
|
12094
|
+
_this.overlay = overlay;
|
|
12095
|
+
_this.mode = exports.DropdownMode.text;
|
|
12096
|
+
_this.dropdownMode = exports.DropdownMode;
|
|
12097
|
+
_this.disabled = false;
|
|
12098
|
+
return _this;
|
|
12099
|
+
}
|
|
12100
|
+
Object.defineProperty(TheIndentToolbarComponent.prototype, "isOpen", {
|
|
12101
|
+
get: function () {
|
|
12102
|
+
return this.dropdownPopoverRef && this.dropdownPopoverRef.getOverlayRef() && this.dropdownPopoverRef.getOverlayRef().hasAttached();
|
|
12103
|
+
},
|
|
12104
|
+
enumerable: false,
|
|
12105
|
+
configurable: true
|
|
12106
|
+
});
|
|
12107
|
+
TheIndentToolbarComponent.prototype.toggleDropdown = function (event) {
|
|
12108
|
+
var _a;
|
|
12109
|
+
_super.prototype.execute.call(this, event);
|
|
12110
|
+
if (((_a = this.editor) === null || _a === void 0 ? void 0 : _a.disabled) || this.disabled) {
|
|
12111
|
+
return;
|
|
12112
|
+
}
|
|
12113
|
+
this.openDropdownPopover();
|
|
12114
|
+
};
|
|
12115
|
+
TheIndentToolbarComponent.prototype.handleDocumentMouseDown = function (event) {
|
|
12116
|
+
if (!this.elementRef.nativeElement.contains(event.target)) {
|
|
12117
|
+
this.closeDropdownPopover();
|
|
12118
|
+
}
|
|
12119
|
+
};
|
|
12120
|
+
Object.defineProperty(TheIndentToolbarComponent.prototype, "disabledState", {
|
|
12121
|
+
get: function () {
|
|
12122
|
+
return this.disabled;
|
|
12123
|
+
},
|
|
12124
|
+
enumerable: false,
|
|
12125
|
+
configurable: true
|
|
12126
|
+
});
|
|
12127
|
+
TheIndentToolbarComponent.prototype.ngOnInit = function () {
|
|
12128
|
+
var _a;
|
|
12129
|
+
if (!this.activeMenu) {
|
|
12130
|
+
this.activeMenu = this.menus[0];
|
|
12131
|
+
}
|
|
12132
|
+
if (this.toolbarItem) {
|
|
12133
|
+
this.elementRef.nativeElement.classList.add("" + ((_a = this.toolbarItem) === null || _a === void 0 ? void 0 : _a.key));
|
|
12134
|
+
}
|
|
12135
|
+
};
|
|
12136
|
+
TheIndentToolbarComponent.prototype.statusChange = function (editor) {
|
|
12137
|
+
var _a, _b;
|
|
12138
|
+
this.disabled = ((_a = this.toolbarItem) === null || _a === void 0 ? void 0 : _a.disable) ? (_b = this.toolbarItem) === null || _b === void 0 ? void 0 : _b.disable(editor) : false;
|
|
12139
|
+
};
|
|
12140
|
+
TheIndentToolbarComponent.prototype.itemMousedown = function (event, item) {
|
|
12141
|
+
_super.prototype.execute.call(this, event);
|
|
12142
|
+
this.closeDropdownPopover();
|
|
12143
|
+
if (item === null || item === void 0 ? void 0 : item.execute) {
|
|
12144
|
+
item === null || item === void 0 ? void 0 : item.execute(this.editor);
|
|
12145
|
+
}
|
|
12146
|
+
};
|
|
12147
|
+
TheIndentToolbarComponent.prototype.openDropdownPopover = function () {
|
|
12148
|
+
var _a;
|
|
12149
|
+
this.dropdownPopoverRef = this.thyPopover.open(this.dropdownTemplate, {
|
|
12150
|
+
origin: this.elementRef,
|
|
12151
|
+
panelClass: ['the-toolbar-dropdown-popover', (_a = this.toolbarItem) === null || _a === void 0 ? void 0 : _a.key],
|
|
12152
|
+
placement: 'bottomLeft',
|
|
12153
|
+
insideClosable: false,
|
|
12154
|
+
backdropClosable: true,
|
|
12155
|
+
hasBackdrop: false,
|
|
12156
|
+
offset: 10,
|
|
12157
|
+
viewContainerRef: this.viewContainerRef,
|
|
12158
|
+
scrollStrategy: this.overlay.scrollStrategies.reposition()
|
|
12159
|
+
});
|
|
12160
|
+
};
|
|
12161
|
+
TheIndentToolbarComponent.prototype.closeDropdownPopover = function () {
|
|
12162
|
+
var _a;
|
|
12163
|
+
if (this.dropdownPopoverRef) {
|
|
12164
|
+
(_a = this.dropdownPopoverRef) === null || _a === void 0 ? void 0 : _a.close();
|
|
12165
|
+
}
|
|
12166
|
+
};
|
|
12167
|
+
return TheIndentToolbarComponent;
|
|
12168
|
+
}(TheToolbarBaseItemComponent));
|
|
12169
|
+
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\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
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheIndentToolbarComponent, decorators: [{
|
|
12172
|
+
type: i0.Component,
|
|
12173
|
+
args: [{
|
|
12174
|
+
selector: 'the-indent-toolbar-item',
|
|
12175
|
+
templateUrl: './toolbar-item.component.html',
|
|
12176
|
+
host: {
|
|
12177
|
+
class: 'the-toolbar-dropdown-container'
|
|
12178
|
+
}
|
|
12179
|
+
}]
|
|
12180
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i1__namespace$3.ThyPopover }, { type: i0__namespace.ViewContainerRef }, { type: i2__namespace.Overlay }]; }, propDecorators: { toolbarItem: [{
|
|
12181
|
+
type: i0.Input
|
|
12182
|
+
}], menus: [{
|
|
12183
|
+
type: i0.Input
|
|
12184
|
+
}], mode: [{
|
|
12185
|
+
type: i0.Input
|
|
12186
|
+
}], item: [{
|
|
12187
|
+
type: i0.Input
|
|
12188
|
+
}], dropdownTemplate: [{
|
|
12189
|
+
type: i0.ViewChild,
|
|
12190
|
+
args: ['dropdownTemplate', { static: true }]
|
|
12191
|
+
}], toggleDropdown: [{
|
|
12192
|
+
type: i0.HostListener,
|
|
12193
|
+
args: ['mousedown', ['$event']]
|
|
12194
|
+
}], handleDocumentMouseDown: [{
|
|
12195
|
+
type: i0.HostListener,
|
|
12196
|
+
args: ['document: mousedown', ['$event']]
|
|
12197
|
+
}], disabledState: [{
|
|
12198
|
+
type: i0.HostBinding,
|
|
12199
|
+
args: ['class.disabled']
|
|
12200
|
+
}] } });
|
|
12201
|
+
|
|
12202
|
+
var MaxIndent = 13;
|
|
12203
|
+
var includesIndentTypes = __spreadArray([
|
|
12204
|
+
exports.ElementKinds.checkItem,
|
|
12205
|
+
exports.ElementKinds.numberedList,
|
|
12206
|
+
exports.ElementKinds.bulletedList,
|
|
12207
|
+
exports.ElementKinds.paragraph
|
|
12208
|
+
], __read(HEADING_TYPES));
|
|
12209
|
+
var IndentEditor = {
|
|
12210
|
+
setIndent: function (editor) {
|
|
12211
|
+
var nodes = Array.from(slate.Editor.nodes(editor, {
|
|
12212
|
+
mode: 'highest',
|
|
12213
|
+
match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
|
|
12214
|
+
}));
|
|
12215
|
+
var _a = __read(nodes, 1), startBlock = _a[0];
|
|
12216
|
+
if (startBlock) {
|
|
12217
|
+
var _b = __read(startBlock, 1), indent = _b[0].indent;
|
|
12218
|
+
indent = indent ? indent : 0;
|
|
12219
|
+
indent += 1;
|
|
12220
|
+
if (indent <= MaxIndent) {
|
|
12221
|
+
slate.Transforms.setNodes(editor, { indent: indent }, {
|
|
12222
|
+
mode: 'highest',
|
|
12223
|
+
match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
|
|
12224
|
+
});
|
|
12225
|
+
}
|
|
12226
|
+
}
|
|
12227
|
+
},
|
|
12228
|
+
cancelIndent: function (editor) {
|
|
12229
|
+
var nodes = Array.from(slate.Editor.nodes(editor, {
|
|
12230
|
+
mode: 'highest',
|
|
12231
|
+
match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
|
|
12232
|
+
}));
|
|
12233
|
+
var _a = __read(nodes, 1), startBlock = _a[0];
|
|
12234
|
+
if (startBlock) {
|
|
12235
|
+
var _b = __read(startBlock, 1), indent = _b[0].indent;
|
|
12236
|
+
indent = indent === 1 ? null : (indent -= 1);
|
|
12237
|
+
slate.Transforms.setNodes(editor, { indent: indent }, {
|
|
12238
|
+
mode: 'highest',
|
|
12239
|
+
match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
|
|
12240
|
+
});
|
|
12241
|
+
}
|
|
12242
|
+
},
|
|
12243
|
+
setTextIndent: function (editor, kinds, textIndent) {
|
|
12244
|
+
slate.Transforms.setNodes(editor, { textIndent: textIndent }, {
|
|
12245
|
+
mode: 'highest',
|
|
12246
|
+
match: function (node) { return slate.Element.isElement(node) && kinds.includes(node.type); }
|
|
12247
|
+
});
|
|
12248
|
+
},
|
|
12249
|
+
cancelTextIntent: function (editor, event, anchorBlock, kinds) {
|
|
12250
|
+
var textIndent = anchorBlock.textIndent, indent = anchorBlock.indent;
|
|
12251
|
+
if (textIndent > 2) {
|
|
12252
|
+
event.preventDefault();
|
|
12253
|
+
textIndent -= 2;
|
|
12254
|
+
IndentEditor.setTextIndent(editor, kinds, textIndent);
|
|
12255
|
+
return true;
|
|
12256
|
+
}
|
|
12257
|
+
if (textIndent === 2) {
|
|
12258
|
+
event.preventDefault();
|
|
12259
|
+
IndentEditor.setTextIndent(editor, kinds, null);
|
|
12260
|
+
return true;
|
|
12261
|
+
}
|
|
12262
|
+
if (indent) {
|
|
12263
|
+
event.preventDefault();
|
|
12264
|
+
IndentEditor.cancelIndent(editor);
|
|
12265
|
+
return true;
|
|
12266
|
+
}
|
|
12267
|
+
return false;
|
|
12268
|
+
},
|
|
12269
|
+
isDisabled: function (editor) {
|
|
12270
|
+
if (editor.selection) {
|
|
12271
|
+
var allowGroup = __spreadArray([
|
|
12272
|
+
exports.ElementKinds.paragraph,
|
|
12273
|
+
exports.ElementKinds.numberedList,
|
|
12274
|
+
exports.ElementKinds.bulletedList,
|
|
12275
|
+
exports.ElementKinds.checkItem
|
|
12276
|
+
], __read(HEADING_TYPES));
|
|
12277
|
+
var anchorBlock$1 = anchorBlock(editor);
|
|
12278
|
+
return anchorBlock$1 && !allowGroup.includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
|
|
12279
|
+
}
|
|
12280
|
+
return false;
|
|
12281
|
+
}
|
|
12282
|
+
};
|
|
12283
|
+
|
|
12284
|
+
var IndentOptions = [
|
|
12285
|
+
{
|
|
12286
|
+
key: exports.ElementKinds.indent,
|
|
12287
|
+
includes: [exports.Indents.indentRight, exports.Indents.indentLeft],
|
|
12288
|
+
iconComponent: TheIndentToolbarComponent,
|
|
12289
|
+
disable: function (editor) { return IndentEditor.isDisabled(editor); }
|
|
12290
|
+
},
|
|
12291
|
+
{
|
|
12292
|
+
key: exports.Indents.indentRight,
|
|
12293
|
+
name: '增加缩进',
|
|
12294
|
+
icon: 'float-left',
|
|
12295
|
+
shortcutKey: 'Tab',
|
|
12296
|
+
execute: function (editor) { return IndentEditor.setIndent(editor); }
|
|
12297
|
+
},
|
|
12298
|
+
{
|
|
12299
|
+
key: exports.Indents.indentLeft,
|
|
12300
|
+
name: '减少缩进',
|
|
12301
|
+
icon: 'float-right',
|
|
12302
|
+
shortcutKey: 'Shift+Tab/BackSpace',
|
|
12303
|
+
type: exports.ToolbarItemType.toolDropdown,
|
|
12304
|
+
execute: function (editor) { return IndentEditor.cancelIndent(editor); }
|
|
12305
|
+
}
|
|
12306
|
+
];
|
|
12307
|
+
|
|
12308
|
+
var onKeydownTextIndent = function (editor, event, kinds) {
|
|
12309
|
+
var selection = editor.selection;
|
|
12310
|
+
var isExpanded = slate.Range.isExpanded(selection);
|
|
12311
|
+
var nodes = Array.from(slate.Editor.nodes(editor, {
|
|
12312
|
+
mode: 'highest',
|
|
12313
|
+
match: function (node) { return slate.Element.isElement(node) && kinds.includes(node.type); }
|
|
12314
|
+
}));
|
|
12315
|
+
var _a = __read(nodes, 1), startBlock = _a[0];
|
|
12316
|
+
if (!startBlock) {
|
|
12317
|
+
return false;
|
|
12318
|
+
}
|
|
12319
|
+
var _b = __read(startBlock, 2), block = _b[0], path = _b[1];
|
|
12320
|
+
var currentPath = [path[0]];
|
|
12321
|
+
var isStart = slate.Editor.isStart(editor, selection.anchor, currentPath);
|
|
12322
|
+
var textIndentDisable = [exports.ElementKinds.bulletedList, exports.ElementKinds.numberedList, exports.ElementKinds.checkItem];
|
|
12323
|
+
if (isHotkey__default["default"]('Tab', event)) {
|
|
12324
|
+
event.preventDefault();
|
|
12325
|
+
if (startBlock && (isExpanded || isStart)) {
|
|
12326
|
+
if (!editor.isVoid(block)) {
|
|
12327
|
+
var textIndent = block.textIndent, type = block.type;
|
|
12328
|
+
// do not apply first-line indentation for lists
|
|
12329
|
+
if (!textIndent && !textIndentDisable.includes(type)) {
|
|
12330
|
+
IndentEditor.setTextIndent(editor, kinds, 2);
|
|
12331
|
+
return true;
|
|
12332
|
+
}
|
|
12333
|
+
else {
|
|
12334
|
+
IndentEditor.setIndent(editor);
|
|
12335
|
+
return true;
|
|
12336
|
+
}
|
|
12337
|
+
}
|
|
12338
|
+
}
|
|
12339
|
+
else {
|
|
12340
|
+
editor.insertText(TAB_SPACE);
|
|
12341
|
+
return true;
|
|
12342
|
+
}
|
|
12343
|
+
}
|
|
12344
|
+
if (isHotkey__default["default"]('shift+Tab', event)) {
|
|
12345
|
+
if (startBlock && (isExpanded || isStart)) {
|
|
12346
|
+
if (!editor.isVoid(block)) {
|
|
12347
|
+
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
12348
|
+
}
|
|
12349
|
+
}
|
|
12350
|
+
}
|
|
12351
|
+
if (selection && slate.Range.isCollapsed(selection) && i1.hotkeys.isDeleteBackward(event)) {
|
|
12352
|
+
if (startBlock && isStart) {
|
|
12353
|
+
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
12354
|
+
}
|
|
12355
|
+
}
|
|
12356
|
+
return false;
|
|
12357
|
+
};
|
|
12358
|
+
|
|
12359
|
+
var withIndent = function (kinds) { return function (editor) {
|
|
12360
|
+
var onKeydown = editor.onKeydown;
|
|
12361
|
+
editor.onKeydown = function (event) {
|
|
12362
|
+
var isContinue = !onKeydownTextIndent(editor, event, kinds);
|
|
12363
|
+
if (isContinue) {
|
|
12364
|
+
onKeydown(event);
|
|
12365
|
+
}
|
|
12366
|
+
};
|
|
12367
|
+
return editor;
|
|
12368
|
+
}; };
|
|
12369
|
+
|
|
12208
12370
|
var internalPlugins = [
|
|
12209
12371
|
withTheHistory,
|
|
12210
12372
|
withAutoInsertData(),
|
|
@@ -12247,7 +12409,7 @@
|
|
|
12247
12409
|
withQuickInsert,
|
|
12248
12410
|
withInlineCode
|
|
12249
12411
|
];
|
|
12250
|
-
var internalToolbarItems = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(AlignOptions)), __read(MarkOptions)), __read(ColorOptions)), __read(HeadingOptions)), __read(FontSizeOptions)), __read(TodoItemOptions)), __read(ListOptions)), __read(ImageOptions)), __read(HrOptions)), __read(BlockquoteOptions)), __read(CodeOptions)), __read(LinkOptions)), __read(TableOptions)), __read(VerticalAlignOptions)), __read(PaintFormatOptions)), __read(InlineCodeOptions));
|
|
12412
|
+
var internalToolbarItems = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(AlignOptions)), __read(MarkOptions)), __read(ColorOptions)), __read(HeadingOptions)), __read(FontSizeOptions)), __read(TodoItemOptions)), __read(ListOptions)), __read(ImageOptions)), __read(HrOptions)), __read(BlockquoteOptions)), __read(CodeOptions)), __read(LinkOptions)), __read(TableOptions)), __read(VerticalAlignOptions)), __read(PaintFormatOptions)), __read(InlineCodeOptions)), __read(IndentOptions));
|
|
12251
12413
|
var toolbarCompose = function (toolbarItems) {
|
|
12252
12414
|
if (toolbarItems === void 0) { toolbarItems = []; }
|
|
12253
12415
|
return __spreadArray(__spreadArray([], __read(internalToolbarItems)), __read(toolbarItems));
|
|
@@ -12894,6 +13056,51 @@
|
|
|
12894
13056
|
args: ['mousedown', ['$event']]
|
|
12895
13057
|
}] } });
|
|
12896
13058
|
|
|
13059
|
+
var ElementStylePipe = /** @class */ (function () {
|
|
13060
|
+
function ElementStylePipe() {
|
|
13061
|
+
}
|
|
13062
|
+
ElementStylePipe.prototype.transform = function (element, align) {
|
|
13063
|
+
var style = {};
|
|
13064
|
+
if (element.align || align) {
|
|
13065
|
+
style.textAlign = element.align || align || exports.Alignment.left;
|
|
13066
|
+
}
|
|
13067
|
+
if (element.textIndent) {
|
|
13068
|
+
style.textIndent = element.textIndent + 'em';
|
|
13069
|
+
}
|
|
13070
|
+
return style;
|
|
13071
|
+
};
|
|
13072
|
+
return ElementStylePipe;
|
|
13073
|
+
}());
|
|
13074
|
+
ElementStylePipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementStylePipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
|
|
13075
|
+
ElementStylePipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementStylePipe, name: "elementStyle" });
|
|
13076
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementStylePipe, decorators: [{
|
|
13077
|
+
type: i0.Pipe,
|
|
13078
|
+
args: [{
|
|
13079
|
+
name: 'elementStyle'
|
|
13080
|
+
}]
|
|
13081
|
+
}] });
|
|
13082
|
+
var ElementClassPipe = /** @class */ (function () {
|
|
13083
|
+
function ElementClassPipe() {
|
|
13084
|
+
}
|
|
13085
|
+
ElementClassPipe.prototype.transform = function (element) {
|
|
13086
|
+
var classStr = '';
|
|
13087
|
+
var prefix = 'indent';
|
|
13088
|
+
if (element.textIndent) {
|
|
13089
|
+
classStr += prefix + "-" + element.textIndent;
|
|
13090
|
+
}
|
|
13091
|
+
return classStr;
|
|
13092
|
+
};
|
|
13093
|
+
return ElementClassPipe;
|
|
13094
|
+
}());
|
|
13095
|
+
ElementClassPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementClassPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
|
|
13096
|
+
ElementClassPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementClassPipe, name: "elementClass" });
|
|
13097
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementClassPipe, decorators: [{
|
|
13098
|
+
type: i0.Pipe,
|
|
13099
|
+
args: [{
|
|
13100
|
+
name: 'elementClass'
|
|
13101
|
+
}]
|
|
13102
|
+
}] });
|
|
13103
|
+
|
|
12897
13104
|
var TheTemplateComponent = /** @class */ (function () {
|
|
12898
13105
|
function TheTemplateComponent() {
|
|
12899
13106
|
var _this = this;
|
|
@@ -13568,7 +13775,8 @@
|
|
|
13568
13775
|
TheTableSelectComponent,
|
|
13569
13776
|
TheTableToolbarItemComponent,
|
|
13570
13777
|
TheConversionHintComponent,
|
|
13571
|
-
TheVerticalToolbarItemComponent
|
|
13778
|
+
TheVerticalToolbarItemComponent,
|
|
13779
|
+
TheIndentToolbarComponent
|
|
13572
13780
|
];
|
|
13573
13781
|
var PLUGIN_COMPONENTS = [
|
|
13574
13782
|
TheImageComponent,
|
|
@@ -13614,7 +13822,8 @@
|
|
|
13614
13822
|
TheTableSelectComponent,
|
|
13615
13823
|
TheTableToolbarItemComponent,
|
|
13616
13824
|
TheConversionHintComponent,
|
|
13617
|
-
TheVerticalToolbarItemComponent,
|
|
13825
|
+
TheVerticalToolbarItemComponent,
|
|
13826
|
+
TheIndentToolbarComponent, TheImageComponent,
|
|
13618
13827
|
TheTemplateComponent,
|
|
13619
13828
|
TheHrComponent,
|
|
13620
13829
|
TheBlockquoteComponent,
|