@worktile/theia 2.1.14 → 2.2.0
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 +442 -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 +81 -0
- package/esm2015/plugins/indent/indent.plugin.js +24 -3
- package/esm2015/plugins/indent/on-keydown-indent.js +40 -54
- package/esm2015/plugins/indent/options.js +26 -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/fesm2015/worktile-theia.js +420 -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;
|
|
@@ -3138,86 +3155,6 @@
|
|
|
3138
3155
|
return editor;
|
|
3139
3156
|
};
|
|
3140
3157
|
|
|
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
3158
|
var isList = function (n) {
|
|
3222
3159
|
return __spreadArray([], __read(LIST_BLOCK_TYPES)).includes(n.type);
|
|
3223
3160
|
};
|
|
@@ -3787,58 +3724,12 @@
|
|
|
3787
3724
|
}
|
|
3788
3725
|
}
|
|
3789
3726
|
|
|
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
3727
|
var TheNumberedListComponent = /** @class */ (function (_super) {
|
|
3836
3728
|
__extends(TheNumberedListComponent, _super);
|
|
3837
|
-
function TheNumberedListComponent(elementRef, cdr
|
|
3729
|
+
function TheNumberedListComponent(elementRef, cdr) {
|
|
3838
3730
|
var _this = _super.call(this, elementRef, cdr) || this;
|
|
3839
3731
|
_this.elementRef = elementRef;
|
|
3840
3732
|
_this.cdr = cdr;
|
|
3841
|
-
_this.elementClassPipe = elementClassPipe;
|
|
3842
3733
|
return _this;
|
|
3843
3734
|
}
|
|
3844
3735
|
Object.defineProperty(TheNumberedListComponent.prototype, "start", {
|
|
@@ -3848,9 +3739,10 @@
|
|
|
3848
3739
|
enumerable: false,
|
|
3849
3740
|
configurable: true
|
|
3850
3741
|
});
|
|
3851
|
-
Object.defineProperty(TheNumberedListComponent.prototype, "
|
|
3742
|
+
Object.defineProperty(TheNumberedListComponent.prototype, "level", {
|
|
3852
3743
|
get: function () {
|
|
3853
|
-
|
|
3744
|
+
var _a;
|
|
3745
|
+
return (_a = this.element) === null || _a === void 0 ? void 0 : _a.indent;
|
|
3854
3746
|
},
|
|
3855
3747
|
enumerable: false,
|
|
3856
3748
|
configurable: true
|
|
@@ -3863,35 +3755,34 @@
|
|
|
3863
3755
|
};
|
|
3864
3756
|
return TheNumberedListComponent;
|
|
3865
3757
|
}(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", "
|
|
3758
|
+
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 });
|
|
3759
|
+
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
3760
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheNumberedListComponent, decorators: [{
|
|
3869
3761
|
type: i0.Component,
|
|
3870
3762
|
args: [{
|
|
3871
3763
|
selector: 'ol[theOl]',
|
|
3872
|
-
template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>"
|
|
3873
|
-
providers: [ElementClassPipe]
|
|
3764
|
+
template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>"
|
|
3874
3765
|
}]
|
|
3875
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }
|
|
3766
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { start: [{
|
|
3876
3767
|
type: i0.HostBinding,
|
|
3877
3768
|
args: ['attr.start']
|
|
3878
|
-
}],
|
|
3769
|
+
}], level: [{
|
|
3879
3770
|
type: i0.HostBinding,
|
|
3880
|
-
args: ['
|
|
3771
|
+
args: ['attr.the-level']
|
|
3881
3772
|
}] } });
|
|
3882
3773
|
|
|
3883
3774
|
var TheBulletedListComponent = /** @class */ (function (_super) {
|
|
3884
3775
|
__extends(TheBulletedListComponent, _super);
|
|
3885
|
-
function TheBulletedListComponent(elementRef, cdr
|
|
3776
|
+
function TheBulletedListComponent(elementRef, cdr) {
|
|
3886
3777
|
var _this = _super.call(this, elementRef, cdr) || this;
|
|
3887
3778
|
_this.elementRef = elementRef;
|
|
3888
3779
|
_this.cdr = cdr;
|
|
3889
|
-
_this.elementClassPipe = elementClassPipe;
|
|
3890
3780
|
return _this;
|
|
3891
3781
|
}
|
|
3892
|
-
Object.defineProperty(TheBulletedListComponent.prototype, "
|
|
3782
|
+
Object.defineProperty(TheBulletedListComponent.prototype, "level", {
|
|
3893
3783
|
get: function () {
|
|
3894
|
-
|
|
3784
|
+
var _a;
|
|
3785
|
+
return (_a = this.element) === null || _a === void 0 ? void 0 : _a.indent;
|
|
3895
3786
|
},
|
|
3896
3787
|
enumerable: false,
|
|
3897
3788
|
configurable: true
|
|
@@ -3904,18 +3795,17 @@
|
|
|
3904
3795
|
};
|
|
3905
3796
|
return TheBulletedListComponent;
|
|
3906
3797
|
}(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: { "
|
|
3798
|
+
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 });
|
|
3799
|
+
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
3800
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheBulletedListComponent, decorators: [{
|
|
3910
3801
|
type: i0.Component,
|
|
3911
3802
|
args: [{
|
|
3912
3803
|
selector: 'ul[theUl]',
|
|
3913
|
-
template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>"
|
|
3914
|
-
providers: [ElementClassPipe]
|
|
3804
|
+
template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>"
|
|
3915
3805
|
}]
|
|
3916
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }
|
|
3806
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { level: [{
|
|
3917
3807
|
type: i0.HostBinding,
|
|
3918
|
-
args: ['
|
|
3808
|
+
args: ['attr.the-level']
|
|
3919
3809
|
}] } });
|
|
3920
3810
|
|
|
3921
3811
|
var TheListItemComponent = /** @class */ (function (_super) {
|
|
@@ -4248,52 +4138,6 @@
|
|
|
4248
4138
|
};
|
|
4249
4139
|
};
|
|
4250
4140
|
|
|
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
4141
|
var TheTodoItemComponent = /** @class */ (function (_super) {
|
|
4298
4142
|
__extends(TheTodoItemComponent, _super);
|
|
4299
4143
|
function TheTodoItemComponent(elementRef, cdr) {
|
|
@@ -4303,15 +4147,16 @@
|
|
|
4303
4147
|
_this.checkItemClass = true;
|
|
4304
4148
|
return _this;
|
|
4305
4149
|
}
|
|
4306
|
-
TheTodoItemComponent.prototype
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
}
|
|
4311
|
-
|
|
4150
|
+
Object.defineProperty(TheTodoItemComponent.prototype, "level", {
|
|
4151
|
+
get: function () {
|
|
4152
|
+
var _a;
|
|
4153
|
+
return (_a = this.element) === null || _a === void 0 ? void 0 : _a.indent;
|
|
4154
|
+
},
|
|
4155
|
+
enumerable: false,
|
|
4156
|
+
configurable: true
|
|
4157
|
+
});
|
|
4312
4158
|
TheTodoItemComponent.prototype.ngOnInit = function () {
|
|
4313
4159
|
_super.prototype.ngOnInit.call(this);
|
|
4314
|
-
this.useIndentClass(this.elementRef.nativeElement, this.element);
|
|
4315
4160
|
};
|
|
4316
4161
|
TheTodoItemComponent.prototype.onCheck = function (checked) {
|
|
4317
4162
|
if (this.readonly) {
|
|
@@ -4319,27 +4164,10 @@
|
|
|
4319
4164
|
}
|
|
4320
4165
|
setNode(this.editor, { checked: checked }, this.element);
|
|
4321
4166
|
};
|
|
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
4167
|
return TheTodoItemComponent;
|
|
4340
4168
|
}(TheBaseElementComponent));
|
|
4341
4169
|
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"] }] });
|
|
4170
|
+
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
4171
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheTodoItemComponent, decorators: [{
|
|
4344
4172
|
type: i0.Component,
|
|
4345
4173
|
args: [{
|
|
@@ -4349,6 +4177,9 @@
|
|
|
4349
4177
|
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { checkItemClass: [{
|
|
4350
4178
|
type: i0.HostBinding,
|
|
4351
4179
|
args: ['class.the-check-item']
|
|
4180
|
+
}], level: [{
|
|
4181
|
+
type: i0.HostBinding,
|
|
4182
|
+
args: ['attr.the-level']
|
|
4352
4183
|
}] } });
|
|
4353
4184
|
|
|
4354
4185
|
var withTodoItem = function (editor) {
|
|
@@ -4987,7 +4818,7 @@
|
|
|
4987
4818
|
return;
|
|
4988
4819
|
}
|
|
4989
4820
|
// → + right-block-card
|
|
4990
|
-
if (
|
|
4821
|
+
if (isMoveForward && !isCardLeftCursor) {
|
|
4991
4822
|
nativeEvent.preventDefault();
|
|
4992
4823
|
var _c = __read(i1.AngularEditor.toSlateCardEntry(editor, anchorNode), 2), path = _c[1];
|
|
4993
4824
|
var nextPath = slate.Path.next(path);
|
|
@@ -8706,6 +8537,52 @@
|
|
|
8706
8537
|
type: i0.Injectable
|
|
8707
8538
|
}], ctorParameters: function () { return []; } });
|
|
8708
8539
|
|
|
8540
|
+
/** Converts CSS pixel values to numbers, eg "123px" to 123. Returns NaN for non pixel values. */
|
|
8541
|
+
function coercePixelsFromCssValue(cssValue) {
|
|
8542
|
+
var match = cssValue.match(/(\d+)px/);
|
|
8543
|
+
if (match) {
|
|
8544
|
+
return Number(match[1]);
|
|
8545
|
+
}
|
|
8546
|
+
}
|
|
8547
|
+
function getElementWidth(element) {
|
|
8548
|
+
// Optimization: Check style.width first as we probably set it already before reading
|
|
8549
|
+
// offsetWidth which triggers layout.
|
|
8550
|
+
return coercePixelsFromCssValue(element.style.width) || element.offsetWidth;
|
|
8551
|
+
}
|
|
8552
|
+
function getElementHeight(element) {
|
|
8553
|
+
return Math.round(element.getBoundingClientRect().height);
|
|
8554
|
+
}
|
|
8555
|
+
function getColsTotalWidth(cols) {
|
|
8556
|
+
return cols.reduce(function (total, col) {
|
|
8557
|
+
return total + getElementWidth(col);
|
|
8558
|
+
}, 0);
|
|
8559
|
+
}
|
|
8560
|
+
function getRowsTotalHeight(rows) {
|
|
8561
|
+
return rows.reduce(function (total, row) {
|
|
8562
|
+
return total + getElementHeight(row);
|
|
8563
|
+
}, 0);
|
|
8564
|
+
}
|
|
8565
|
+
function useElementStyle(el, element) {
|
|
8566
|
+
if (element.align) {
|
|
8567
|
+
el.style.textAlign = element.align || exports.Alignment.left;
|
|
8568
|
+
}
|
|
8569
|
+
if (element.textIndent) {
|
|
8570
|
+
el.style.textIndent = element.textIndent + 'em';
|
|
8571
|
+
}
|
|
8572
|
+
if (element.verticalAlign) {
|
|
8573
|
+
el.style.verticalAlign = element.verticalAlign;
|
|
8574
|
+
}
|
|
8575
|
+
}
|
|
8576
|
+
function getElementClassByPrefix(el, prefix) {
|
|
8577
|
+
var matchClass = null;
|
|
8578
|
+
el.classList.forEach(function (value, key) {
|
|
8579
|
+
if (value.includes(prefix)) {
|
|
8580
|
+
matchClass = value;
|
|
8581
|
+
}
|
|
8582
|
+
});
|
|
8583
|
+
return matchClass;
|
|
8584
|
+
}
|
|
8585
|
+
|
|
8709
8586
|
function splitCell(editor) {
|
|
8710
8587
|
var opts = new TableOptions$1();
|
|
8711
8588
|
var anchor = editor.selection.anchor;
|
|
@@ -12149,7 +12026,7 @@
|
|
|
12149
12026
|
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
12150
12027
|
// Put this at the start and end of an inline component to work around this Chromium bug:
|
|
12151
12028
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=1249405
|
|
12152
|
-
_this.inlineChromiumBugfix =
|
|
12029
|
+
_this.inlineChromiumBugfix = String.fromCodePoint(160);
|
|
12153
12030
|
return _this;
|
|
12154
12031
|
}
|
|
12155
12032
|
return TheInlineCodeComponent;
|
|
@@ -12205,6 +12082,300 @@
|
|
|
12205
12082
|
return editor;
|
|
12206
12083
|
};
|
|
12207
12084
|
|
|
12085
|
+
var TheIndentToolbarComponent = /** @class */ (function (_super) {
|
|
12086
|
+
__extends(TheIndentToolbarComponent, _super);
|
|
12087
|
+
function TheIndentToolbarComponent(elementRef, thyPopover, viewContainerRef, overlay) {
|
|
12088
|
+
var _this = _super.call(this) || this;
|
|
12089
|
+
_this.elementRef = elementRef;
|
|
12090
|
+
_this.thyPopover = thyPopover;
|
|
12091
|
+
_this.viewContainerRef = viewContainerRef;
|
|
12092
|
+
_this.overlay = overlay;
|
|
12093
|
+
_this.mode = exports.DropdownMode.text;
|
|
12094
|
+
_this.dropdownMode = exports.DropdownMode;
|
|
12095
|
+
_this.disabled = false;
|
|
12096
|
+
return _this;
|
|
12097
|
+
}
|
|
12098
|
+
Object.defineProperty(TheIndentToolbarComponent.prototype, "isOpen", {
|
|
12099
|
+
get: function () {
|
|
12100
|
+
return this.dropdownPopoverRef && this.dropdownPopoverRef.getOverlayRef() && this.dropdownPopoverRef.getOverlayRef().hasAttached();
|
|
12101
|
+
},
|
|
12102
|
+
enumerable: false,
|
|
12103
|
+
configurable: true
|
|
12104
|
+
});
|
|
12105
|
+
TheIndentToolbarComponent.prototype.toggleDropdown = function (event) {
|
|
12106
|
+
var _a;
|
|
12107
|
+
_super.prototype.execute.call(this, event);
|
|
12108
|
+
if (((_a = this.editor) === null || _a === void 0 ? void 0 : _a.disabled) || this.disabled) {
|
|
12109
|
+
return;
|
|
12110
|
+
}
|
|
12111
|
+
this.openDropdownPopover();
|
|
12112
|
+
};
|
|
12113
|
+
TheIndentToolbarComponent.prototype.handleDocumentMouseDown = function (event) {
|
|
12114
|
+
if (!this.elementRef.nativeElement.contains(event.target)) {
|
|
12115
|
+
this.closeDropdownPopover();
|
|
12116
|
+
}
|
|
12117
|
+
};
|
|
12118
|
+
Object.defineProperty(TheIndentToolbarComponent.prototype, "disabledState", {
|
|
12119
|
+
get: function () {
|
|
12120
|
+
return this.disabled;
|
|
12121
|
+
},
|
|
12122
|
+
enumerable: false,
|
|
12123
|
+
configurable: true
|
|
12124
|
+
});
|
|
12125
|
+
TheIndentToolbarComponent.prototype.ngOnInit = function () {
|
|
12126
|
+
var _a;
|
|
12127
|
+
if (!this.activeMenu) {
|
|
12128
|
+
this.activeMenu = this.menus[0];
|
|
12129
|
+
}
|
|
12130
|
+
if (this.toolbarItem) {
|
|
12131
|
+
this.elementRef.nativeElement.classList.add("" + ((_a = this.toolbarItem) === null || _a === void 0 ? void 0 : _a.key));
|
|
12132
|
+
}
|
|
12133
|
+
};
|
|
12134
|
+
TheIndentToolbarComponent.prototype.statusChange = function (editor) {
|
|
12135
|
+
var _a, _b;
|
|
12136
|
+
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;
|
|
12137
|
+
};
|
|
12138
|
+
TheIndentToolbarComponent.prototype.itemMousedown = function (event, item) {
|
|
12139
|
+
_super.prototype.execute.call(this, event);
|
|
12140
|
+
this.closeDropdownPopover();
|
|
12141
|
+
if (item === null || item === void 0 ? void 0 : item.execute) {
|
|
12142
|
+
item === null || item === void 0 ? void 0 : item.execute(this.editor);
|
|
12143
|
+
}
|
|
12144
|
+
};
|
|
12145
|
+
TheIndentToolbarComponent.prototype.openDropdownPopover = function () {
|
|
12146
|
+
var _a;
|
|
12147
|
+
this.dropdownPopoverRef = this.thyPopover.open(this.dropdownTemplate, {
|
|
12148
|
+
origin: this.elementRef,
|
|
12149
|
+
panelClass: ['the-toolbar-dropdown-popover', (_a = this.toolbarItem) === null || _a === void 0 ? void 0 : _a.key],
|
|
12150
|
+
placement: 'bottomLeft',
|
|
12151
|
+
insideClosable: false,
|
|
12152
|
+
backdropClosable: true,
|
|
12153
|
+
hasBackdrop: false,
|
|
12154
|
+
offset: 10,
|
|
12155
|
+
viewContainerRef: this.viewContainerRef,
|
|
12156
|
+
scrollStrategy: this.overlay.scrollStrategies.reposition()
|
|
12157
|
+
});
|
|
12158
|
+
};
|
|
12159
|
+
TheIndentToolbarComponent.prototype.closeDropdownPopover = function () {
|
|
12160
|
+
var _a;
|
|
12161
|
+
if (this.dropdownPopoverRef) {
|
|
12162
|
+
(_a = this.dropdownPopoverRef) === null || _a === void 0 ? void 0 : _a.close();
|
|
12163
|
+
}
|
|
12164
|
+
};
|
|
12165
|
+
return TheIndentToolbarComponent;
|
|
12166
|
+
}(TheToolbarBaseItemComponent));
|
|
12167
|
+
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 });
|
|
12168
|
+
TheIndentToolbarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheIndentToolbarComponent, selector: "the-indent-toolbar-item", inputs: { toolbarItem: "toolbarItem", menus: "menus", mode: "mode", item: "item" }, host: { listeners: { "mousedown": "toggleDropdown($event)", "document: mousedown": "handleDocumentMouseDown($event)" }, properties: { "class.disabled": "this.disabledState" }, classAttribute: "the-toolbar-dropdown-container" }, viewQueries: [{ propertyName: "dropdownTemplate", first: true, predicate: ["dropdownTemplate"], descendants: true, static: true }], usesInheritance: true, ngImport: i0__namespace, template: "<a thyIconNavLink class=\"icon-mode link-with-down\" [thyTooltip]=\"activeMenu?.name\" thyTooltipPlacement=\"top\">\n <thy-icon [thyIconName]=\"activeMenu?.icon\"></thy-icon>\n <thy-icon class=\"caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n</a>\n\n<ng-template #dropdownTemplate>\n <thy-action-menu class=\"dropdown-menu\">\n <ng-container *ngFor=\"let menu of menus\">\n <a thyActionMenuItem href=\"javascript:;\" (mousedown)=\"itemMousedown($event, menu)\">\n <span thyActionMenuItemIcon>\n <thy-icon [thyIconName]=\"menu.icon\"></thy-icon>\n </span>\n <span thyActionMenuItemName>{{ menu.name }}</span>\n </a>\n </ng-container>\n </thy-action-menu>\n</ng-template>\n", components: [{ type: i3__namespace.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4__namespace$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i5__namespace$2.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }], directives: [{ type: i5__namespace$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5__namespace$2.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i5__namespace$2.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i5__namespace$2.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }] });
|
|
12169
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheIndentToolbarComponent, decorators: [{
|
|
12170
|
+
type: i0.Component,
|
|
12171
|
+
args: [{
|
|
12172
|
+
selector: 'the-indent-toolbar-item',
|
|
12173
|
+
templateUrl: './toolbar-item.component.html',
|
|
12174
|
+
host: {
|
|
12175
|
+
class: 'the-toolbar-dropdown-container'
|
|
12176
|
+
}
|
|
12177
|
+
}]
|
|
12178
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i1__namespace$3.ThyPopover }, { type: i0__namespace.ViewContainerRef }, { type: i2__namespace.Overlay }]; }, propDecorators: { toolbarItem: [{
|
|
12179
|
+
type: i0.Input
|
|
12180
|
+
}], menus: [{
|
|
12181
|
+
type: i0.Input
|
|
12182
|
+
}], mode: [{
|
|
12183
|
+
type: i0.Input
|
|
12184
|
+
}], item: [{
|
|
12185
|
+
type: i0.Input
|
|
12186
|
+
}], dropdownTemplate: [{
|
|
12187
|
+
type: i0.ViewChild,
|
|
12188
|
+
args: ['dropdownTemplate', { static: true }]
|
|
12189
|
+
}], toggleDropdown: [{
|
|
12190
|
+
type: i0.HostListener,
|
|
12191
|
+
args: ['mousedown', ['$event']]
|
|
12192
|
+
}], handleDocumentMouseDown: [{
|
|
12193
|
+
type: i0.HostListener,
|
|
12194
|
+
args: ['document: mousedown', ['$event']]
|
|
12195
|
+
}], disabledState: [{
|
|
12196
|
+
type: i0.HostBinding,
|
|
12197
|
+
args: ['class.disabled']
|
|
12198
|
+
}] } });
|
|
12199
|
+
|
|
12200
|
+
var MaxIndent = 13;
|
|
12201
|
+
var includesIndentTypes = __spreadArray([
|
|
12202
|
+
exports.ElementKinds.checkItem,
|
|
12203
|
+
exports.ElementKinds.numberedList,
|
|
12204
|
+
exports.ElementKinds.bulletedList,
|
|
12205
|
+
exports.ElementKinds.paragraph
|
|
12206
|
+
], __read(HEADING_TYPES));
|
|
12207
|
+
var IndentEditor = {
|
|
12208
|
+
setIndent: function (editor) {
|
|
12209
|
+
var nodes = Array.from(slate.Editor.nodes(editor, {
|
|
12210
|
+
mode: 'highest',
|
|
12211
|
+
match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
|
|
12212
|
+
}));
|
|
12213
|
+
var _a = __read(nodes, 1), startBlock = _a[0];
|
|
12214
|
+
if (startBlock) {
|
|
12215
|
+
var _b = __read(startBlock, 1), indent = _b[0].indent;
|
|
12216
|
+
indent = indent ? indent : 0;
|
|
12217
|
+
indent += 1;
|
|
12218
|
+
if (indent <= MaxIndent) {
|
|
12219
|
+
slate.Transforms.setNodes(editor, { indent: indent }, {
|
|
12220
|
+
mode: 'highest',
|
|
12221
|
+
match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
|
|
12222
|
+
});
|
|
12223
|
+
}
|
|
12224
|
+
}
|
|
12225
|
+
},
|
|
12226
|
+
cancelIndent: function (editor) {
|
|
12227
|
+
var nodes = Array.from(slate.Editor.nodes(editor, {
|
|
12228
|
+
mode: 'highest',
|
|
12229
|
+
match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
|
|
12230
|
+
}));
|
|
12231
|
+
var _a = __read(nodes, 1), startBlock = _a[0];
|
|
12232
|
+
if (startBlock) {
|
|
12233
|
+
var _b = __read(startBlock, 1), indent = _b[0].indent;
|
|
12234
|
+
indent = indent === 1 ? null : (indent -= 1);
|
|
12235
|
+
slate.Transforms.setNodes(editor, { indent: indent }, {
|
|
12236
|
+
mode: 'highest',
|
|
12237
|
+
match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
|
|
12238
|
+
});
|
|
12239
|
+
}
|
|
12240
|
+
},
|
|
12241
|
+
setTextIndent: function (editor, kinds, textIndent) {
|
|
12242
|
+
slate.Transforms.setNodes(editor, { textIndent: textIndent }, {
|
|
12243
|
+
mode: 'highest',
|
|
12244
|
+
match: function (node) { return slate.Element.isElement(node) && kinds.includes(node.type); }
|
|
12245
|
+
});
|
|
12246
|
+
},
|
|
12247
|
+
cancelTextIntent: function (editor, event, anchorBlock, kinds) {
|
|
12248
|
+
var textIndent = anchorBlock.textIndent, indent = anchorBlock.indent;
|
|
12249
|
+
if (indent) {
|
|
12250
|
+
event.preventDefault();
|
|
12251
|
+
IndentEditor.cancelIndent(editor);
|
|
12252
|
+
return true;
|
|
12253
|
+
}
|
|
12254
|
+
if (!indent && textIndent > 2) {
|
|
12255
|
+
event.preventDefault();
|
|
12256
|
+
textIndent -= 2;
|
|
12257
|
+
IndentEditor.setTextIndent(editor, kinds, textIndent);
|
|
12258
|
+
return true;
|
|
12259
|
+
}
|
|
12260
|
+
if (!indent && textIndent === 2) {
|
|
12261
|
+
event.preventDefault();
|
|
12262
|
+
IndentEditor.setTextIndent(editor, kinds, null);
|
|
12263
|
+
return true;
|
|
12264
|
+
}
|
|
12265
|
+
return false;
|
|
12266
|
+
},
|
|
12267
|
+
isDisabled: function (editor) {
|
|
12268
|
+
if (editor.selection) {
|
|
12269
|
+
var disableGroup = HEADING_TYPES;
|
|
12270
|
+
var anchorBlock$1 = anchorBlock(editor);
|
|
12271
|
+
return anchorBlock$1 && disableGroup.includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
|
|
12272
|
+
}
|
|
12273
|
+
return false;
|
|
12274
|
+
}
|
|
12275
|
+
};
|
|
12276
|
+
|
|
12277
|
+
var IndentOptions = [
|
|
12278
|
+
{
|
|
12279
|
+
key: exports.ElementKinds.indent,
|
|
12280
|
+
includes: [exports.Indents.indentRight, exports.Indents.indentLeft],
|
|
12281
|
+
iconComponent: TheIndentToolbarComponent,
|
|
12282
|
+
disable: function (editor) { return IndentEditor.isDisabled(editor); }
|
|
12283
|
+
},
|
|
12284
|
+
{
|
|
12285
|
+
key: exports.Indents.indentRight,
|
|
12286
|
+
name: '增加缩进',
|
|
12287
|
+
icon: 'indent',
|
|
12288
|
+
execute: function (editor) { return IndentEditor.setIndent(editor); }
|
|
12289
|
+
},
|
|
12290
|
+
{
|
|
12291
|
+
key: exports.Indents.indentLeft,
|
|
12292
|
+
name: '减少缩进',
|
|
12293
|
+
icon: 'outdent',
|
|
12294
|
+
type: exports.ToolbarItemType.toolDropdown,
|
|
12295
|
+
execute: function (editor) { return IndentEditor.cancelIndent(editor); }
|
|
12296
|
+
}
|
|
12297
|
+
];
|
|
12298
|
+
|
|
12299
|
+
var onKeydownTextIndent = function (editor, event, kinds) {
|
|
12300
|
+
var selection = editor.selection;
|
|
12301
|
+
var isExpanded = slate.Range.isExpanded(selection);
|
|
12302
|
+
var nodes = Array.from(slate.Editor.nodes(editor, {
|
|
12303
|
+
mode: 'highest',
|
|
12304
|
+
match: function (node) { return slate.Element.isElement(node) && kinds.includes(node.type); }
|
|
12305
|
+
}));
|
|
12306
|
+
var _a = __read(nodes, 1), startBlock = _a[0];
|
|
12307
|
+
if (!startBlock) {
|
|
12308
|
+
return false;
|
|
12309
|
+
}
|
|
12310
|
+
var _b = __read(startBlock, 2), block = _b[0], path = _b[1];
|
|
12311
|
+
var currentPath = [path[0]];
|
|
12312
|
+
var isStart = slate.Editor.isStart(editor, selection.anchor, currentPath);
|
|
12313
|
+
var textIndentDisable = [exports.ElementKinds.bulletedList, exports.ElementKinds.numberedList, exports.ElementKinds.checkItem];
|
|
12314
|
+
if (isHotkey__default["default"]('Tab', event)) {
|
|
12315
|
+
event.preventDefault();
|
|
12316
|
+
if (startBlock && (isExpanded || isStart)) {
|
|
12317
|
+
if (!editor.isVoid(block)) {
|
|
12318
|
+
var textIndent = block.textIndent, type = block.type;
|
|
12319
|
+
// do not apply first-line indentation for lists
|
|
12320
|
+
if (!textIndent && !textIndentDisable.includes(type)) {
|
|
12321
|
+
IndentEditor.setTextIndent(editor, kinds, 2);
|
|
12322
|
+
return true;
|
|
12323
|
+
}
|
|
12324
|
+
else {
|
|
12325
|
+
IndentEditor.setIndent(editor);
|
|
12326
|
+
return true;
|
|
12327
|
+
}
|
|
12328
|
+
}
|
|
12329
|
+
}
|
|
12330
|
+
else {
|
|
12331
|
+
editor.insertText(TAB_SPACE);
|
|
12332
|
+
return true;
|
|
12333
|
+
}
|
|
12334
|
+
}
|
|
12335
|
+
if (isHotkey__default["default"]('shift+Tab', event)) {
|
|
12336
|
+
if (startBlock && (isExpanded || isStart)) {
|
|
12337
|
+
if (!editor.isVoid(block)) {
|
|
12338
|
+
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
12339
|
+
}
|
|
12340
|
+
}
|
|
12341
|
+
}
|
|
12342
|
+
if (selection && slate.Range.isCollapsed(selection) && i1.hotkeys.isDeleteBackward(event)) {
|
|
12343
|
+
if (startBlock && isStart) {
|
|
12344
|
+
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
12345
|
+
}
|
|
12346
|
+
}
|
|
12347
|
+
return false;
|
|
12348
|
+
};
|
|
12349
|
+
|
|
12350
|
+
var withIndent = function (kinds) { return function (editor) {
|
|
12351
|
+
var onKeydown = editor.onKeydown;
|
|
12352
|
+
editor.onKeydown = function (event) {
|
|
12353
|
+
var HOTKEYS = {
|
|
12354
|
+
'mod+]': exports.Indents.indentRight,
|
|
12355
|
+
'mod+[': exports.Indents.indentLeft
|
|
12356
|
+
};
|
|
12357
|
+
for (var hotkey in HOTKEYS) {
|
|
12358
|
+
if (isHotkey__default["default"](hotkey, event)) {
|
|
12359
|
+
event.preventDefault();
|
|
12360
|
+
var mark = HOTKEYS[hotkey];
|
|
12361
|
+
switch (mark) {
|
|
12362
|
+
case exports.Indents.indentRight:
|
|
12363
|
+
IndentEditor.setIndent(editor);
|
|
12364
|
+
break;
|
|
12365
|
+
case exports.Indents.indentLeft:
|
|
12366
|
+
IndentEditor.cancelIndent(editor);
|
|
12367
|
+
break;
|
|
12368
|
+
}
|
|
12369
|
+
}
|
|
12370
|
+
}
|
|
12371
|
+
var isContinue = !onKeydownTextIndent(editor, event, kinds);
|
|
12372
|
+
if (isContinue) {
|
|
12373
|
+
onKeydown(event);
|
|
12374
|
+
}
|
|
12375
|
+
};
|
|
12376
|
+
return editor;
|
|
12377
|
+
}; };
|
|
12378
|
+
|
|
12208
12379
|
var internalPlugins = [
|
|
12209
12380
|
withTheHistory,
|
|
12210
12381
|
withAutoInsertData(),
|
|
@@ -12247,7 +12418,7 @@
|
|
|
12247
12418
|
withQuickInsert,
|
|
12248
12419
|
withInlineCode
|
|
12249
12420
|
];
|
|
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));
|
|
12421
|
+
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
12422
|
var toolbarCompose = function (toolbarItems) {
|
|
12252
12423
|
if (toolbarItems === void 0) { toolbarItems = []; }
|
|
12253
12424
|
return __spreadArray(__spreadArray([], __read(internalToolbarItems)), __read(toolbarItems));
|
|
@@ -12894,6 +13065,51 @@
|
|
|
12894
13065
|
args: ['mousedown', ['$event']]
|
|
12895
13066
|
}] } });
|
|
12896
13067
|
|
|
13068
|
+
var ElementStylePipe = /** @class */ (function () {
|
|
13069
|
+
function ElementStylePipe() {
|
|
13070
|
+
}
|
|
13071
|
+
ElementStylePipe.prototype.transform = function (element, align) {
|
|
13072
|
+
var style = {};
|
|
13073
|
+
if (element.align || align) {
|
|
13074
|
+
style.textAlign = element.align || align || exports.Alignment.left;
|
|
13075
|
+
}
|
|
13076
|
+
if (element.textIndent) {
|
|
13077
|
+
style.textIndent = element.textIndent + 'em';
|
|
13078
|
+
}
|
|
13079
|
+
return style;
|
|
13080
|
+
};
|
|
13081
|
+
return ElementStylePipe;
|
|
13082
|
+
}());
|
|
13083
|
+
ElementStylePipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementStylePipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
|
|
13084
|
+
ElementStylePipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementStylePipe, name: "elementStyle" });
|
|
13085
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementStylePipe, decorators: [{
|
|
13086
|
+
type: i0.Pipe,
|
|
13087
|
+
args: [{
|
|
13088
|
+
name: 'elementStyle'
|
|
13089
|
+
}]
|
|
13090
|
+
}] });
|
|
13091
|
+
var ElementClassPipe = /** @class */ (function () {
|
|
13092
|
+
function ElementClassPipe() {
|
|
13093
|
+
}
|
|
13094
|
+
ElementClassPipe.prototype.transform = function (element) {
|
|
13095
|
+
var classStr = '';
|
|
13096
|
+
var prefix = 'indent';
|
|
13097
|
+
if (element.textIndent) {
|
|
13098
|
+
classStr += prefix + "-" + element.textIndent;
|
|
13099
|
+
}
|
|
13100
|
+
return classStr;
|
|
13101
|
+
};
|
|
13102
|
+
return ElementClassPipe;
|
|
13103
|
+
}());
|
|
13104
|
+
ElementClassPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementClassPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
|
|
13105
|
+
ElementClassPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementClassPipe, name: "elementClass" });
|
|
13106
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementClassPipe, decorators: [{
|
|
13107
|
+
type: i0.Pipe,
|
|
13108
|
+
args: [{
|
|
13109
|
+
name: 'elementClass'
|
|
13110
|
+
}]
|
|
13111
|
+
}] });
|
|
13112
|
+
|
|
12897
13113
|
var TheTemplateComponent = /** @class */ (function () {
|
|
12898
13114
|
function TheTemplateComponent() {
|
|
12899
13115
|
var _this = this;
|
|
@@ -13568,7 +13784,8 @@
|
|
|
13568
13784
|
TheTableSelectComponent,
|
|
13569
13785
|
TheTableToolbarItemComponent,
|
|
13570
13786
|
TheConversionHintComponent,
|
|
13571
|
-
TheVerticalToolbarItemComponent
|
|
13787
|
+
TheVerticalToolbarItemComponent,
|
|
13788
|
+
TheIndentToolbarComponent
|
|
13572
13789
|
];
|
|
13573
13790
|
var PLUGIN_COMPONENTS = [
|
|
13574
13791
|
TheImageComponent,
|
|
@@ -13614,7 +13831,8 @@
|
|
|
13614
13831
|
TheTableSelectComponent,
|
|
13615
13832
|
TheTableToolbarItemComponent,
|
|
13616
13833
|
TheConversionHintComponent,
|
|
13617
|
-
TheVerticalToolbarItemComponent,
|
|
13834
|
+
TheVerticalToolbarItemComponent,
|
|
13835
|
+
TheIndentToolbarComponent, TheImageComponent,
|
|
13618
13836
|
TheTemplateComponent,
|
|
13619
13837
|
TheHrComponent,
|
|
13620
13838
|
TheBlockquoteComponent,
|