@worktile/theia 2.1.13 → 2.2.2
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 +451 -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/list/list.editor.js +8 -1
- 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 +429 -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;
|
|
@@ -2077,6 +2094,13 @@
|
|
|
2077
2094
|
slate.Transforms.setNodes(editor, { type: exports.ElementKinds.paragraph, checked: undefined }, // todo remove checked
|
|
2078
2095
|
{ at: path });
|
|
2079
2096
|
}
|
|
2097
|
+
else if (slate.Element.isElement(node) && node.type === exports.ElementKinds.paragraph) {
|
|
2098
|
+
var textIndent = node.textIndent;
|
|
2099
|
+
if (textIndent) {
|
|
2100
|
+
slate.Transforms.setNodes(editor, { textIndent: undefined }, // remove textIndent
|
|
2101
|
+
{ at: path });
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2080
2104
|
if (slate.Node.parent(editor, path).type !== exports.ElementKinds.listItem) {
|
|
2081
2105
|
slate.Transforms.wrapNodes(editor, { type: exports.ElementKinds.listItem, children: [] }, {
|
|
2082
2106
|
at: path,
|
|
@@ -2481,12 +2505,14 @@
|
|
|
2481
2505
|
var align = 'align';
|
|
2482
2506
|
var hasTextIndent = block[textIndent];
|
|
2483
2507
|
var hasAlign = block[align];
|
|
2508
|
+
var hasIndent = block[exports.ElementKinds.indent];
|
|
2484
2509
|
if (slate.Node.string(block) === '' &&
|
|
2485
2510
|
slate.Element.isElement(block) &&
|
|
2486
2511
|
block.type === exports.ElementKinds.paragraph &&
|
|
2487
2512
|
block.children.length === 1 &&
|
|
2488
2513
|
slate.Text.isText(block.children[0]) &&
|
|
2489
2514
|
!slate.Editor.isVoid(editor, block) &&
|
|
2515
|
+
!hasIndent &&
|
|
2490
2516
|
!hasTextIndent &&
|
|
2491
2517
|
!hasAlign) {
|
|
2492
2518
|
return true;
|
|
@@ -3131,86 +3157,6 @@
|
|
|
3131
3157
|
return editor;
|
|
3132
3158
|
};
|
|
3133
3159
|
|
|
3134
|
-
var onKeydownIndent = function (editor, event, kinds) {
|
|
3135
|
-
var selection = editor.selection;
|
|
3136
|
-
if (event.key === 'Tab') {
|
|
3137
|
-
event.preventDefault();
|
|
3138
|
-
var isExpanded = slate.Range.isExpanded(selection);
|
|
3139
|
-
var nodes = Array.from(slate.Editor.nodes(editor, {
|
|
3140
|
-
mode: 'highest',
|
|
3141
|
-
match: indentNodeMatch(kinds)
|
|
3142
|
-
}));
|
|
3143
|
-
var startBlock = nodes[0];
|
|
3144
|
-
if (startBlock && (isExpanded || slate.Editor.isStart(editor, selection.anchor, [startBlock[1][0]]))) {
|
|
3145
|
-
if (!editor.isVoid(startBlock[0])) {
|
|
3146
|
-
if (event.shiftKey) {
|
|
3147
|
-
return cancelTextIntent(editor, startBlock[0], kinds);
|
|
3148
|
-
}
|
|
3149
|
-
var textIndent = startBlock[0].textIndent;
|
|
3150
|
-
textIndent = textIndent ? textIndent : 0;
|
|
3151
|
-
textIndent += 2;
|
|
3152
|
-
if (textIndent < 50) {
|
|
3153
|
-
slate.Transforms.setNodes(editor, { textIndent: textIndent }, {
|
|
3154
|
-
mode: 'highest',
|
|
3155
|
-
match: indentNodeMatch(kinds)
|
|
3156
|
-
});
|
|
3157
|
-
return true;
|
|
3158
|
-
}
|
|
3159
|
-
}
|
|
3160
|
-
}
|
|
3161
|
-
else {
|
|
3162
|
-
editor.insertText(TAB_SPACE);
|
|
3163
|
-
return true;
|
|
3164
|
-
}
|
|
3165
|
-
}
|
|
3166
|
-
if (selection && slate.Range.isCollapsed(selection) && event.key === 'Backspace') {
|
|
3167
|
-
var nodes = Array.from(slate.Editor.nodes(editor, {
|
|
3168
|
-
mode: 'highest',
|
|
3169
|
-
match: indentNodeMatch(kinds)
|
|
3170
|
-
}));
|
|
3171
|
-
var startBlock = nodes[0];
|
|
3172
|
-
if (startBlock && slate.Editor.isStart(editor, selection.anchor, [startBlock[1][0]])) {
|
|
3173
|
-
return cancelTextIntent(editor, startBlock[0], kinds);
|
|
3174
|
-
}
|
|
3175
|
-
}
|
|
3176
|
-
return false;
|
|
3177
|
-
};
|
|
3178
|
-
var indentNodeMatch = function (kinds) { return function (node) { return slate.Element.isElement(node) && kinds.includes(node.type); }; };
|
|
3179
|
-
function cancelTextIntent(editor, anchorBlock, kinds) {
|
|
3180
|
-
var textIndent = anchorBlock.textIndent;
|
|
3181
|
-
if (textIndent > 2) {
|
|
3182
|
-
// prevent deleteBackward function
|
|
3183
|
-
event.preventDefault();
|
|
3184
|
-
textIndent -= 2;
|
|
3185
|
-
slate.Transforms.setNodes(editor, { textIndent: textIndent }, {
|
|
3186
|
-
mode: 'highest',
|
|
3187
|
-
match: indentNodeMatch(kinds)
|
|
3188
|
-
});
|
|
3189
|
-
return true;
|
|
3190
|
-
}
|
|
3191
|
-
if (textIndent === 2) {
|
|
3192
|
-
// prevent deleteBackward function
|
|
3193
|
-
event.preventDefault();
|
|
3194
|
-
slate.Transforms.setNodes(editor, { textIndent: null }, {
|
|
3195
|
-
mode: 'highest',
|
|
3196
|
-
match: function (node) { return slate.Element.isElement(node) && kinds.includes(node.type); }
|
|
3197
|
-
});
|
|
3198
|
-
return true;
|
|
3199
|
-
}
|
|
3200
|
-
return false;
|
|
3201
|
-
}
|
|
3202
|
-
|
|
3203
|
-
var withIndent = function (kinds) { return function (editor) {
|
|
3204
|
-
var onKeydown = editor.onKeydown;
|
|
3205
|
-
editor.onKeydown = function (event) {
|
|
3206
|
-
var isContinue = !onKeydownIndent(editor, event, kinds);
|
|
3207
|
-
if (isContinue) {
|
|
3208
|
-
onKeydown(event);
|
|
3209
|
-
}
|
|
3210
|
-
};
|
|
3211
|
-
return editor;
|
|
3212
|
-
}; };
|
|
3213
|
-
|
|
3214
3160
|
var isList = function (n) {
|
|
3215
3161
|
return __spreadArray([], __read(LIST_BLOCK_TYPES)).includes(n.type);
|
|
3216
3162
|
};
|
|
@@ -3780,58 +3726,12 @@
|
|
|
3780
3726
|
}
|
|
3781
3727
|
}
|
|
3782
3728
|
|
|
3783
|
-
var ElementStylePipe = /** @class */ (function () {
|
|
3784
|
-
function ElementStylePipe() {
|
|
3785
|
-
}
|
|
3786
|
-
ElementStylePipe.prototype.transform = function (element, align) {
|
|
3787
|
-
var style = {};
|
|
3788
|
-
if (element.align || align) {
|
|
3789
|
-
style.textAlign = element.align || align || exports.Alignment.left;
|
|
3790
|
-
}
|
|
3791
|
-
if (element.textIndent) {
|
|
3792
|
-
style.textIndent = element.textIndent + 'em';
|
|
3793
|
-
}
|
|
3794
|
-
return style;
|
|
3795
|
-
};
|
|
3796
|
-
return ElementStylePipe;
|
|
3797
|
-
}());
|
|
3798
|
-
ElementStylePipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementStylePipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
|
|
3799
|
-
ElementStylePipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementStylePipe, name: "elementStyle" });
|
|
3800
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementStylePipe, decorators: [{
|
|
3801
|
-
type: i0.Pipe,
|
|
3802
|
-
args: [{
|
|
3803
|
-
name: 'elementStyle'
|
|
3804
|
-
}]
|
|
3805
|
-
}] });
|
|
3806
|
-
var ElementClassPipe = /** @class */ (function () {
|
|
3807
|
-
function ElementClassPipe() {
|
|
3808
|
-
}
|
|
3809
|
-
ElementClassPipe.prototype.transform = function (element) {
|
|
3810
|
-
var classStr = '';
|
|
3811
|
-
var prefix = 'indent';
|
|
3812
|
-
if (element.textIndent) {
|
|
3813
|
-
classStr += prefix + "-" + element.textIndent;
|
|
3814
|
-
}
|
|
3815
|
-
return classStr;
|
|
3816
|
-
};
|
|
3817
|
-
return ElementClassPipe;
|
|
3818
|
-
}());
|
|
3819
|
-
ElementClassPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementClassPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
|
|
3820
|
-
ElementClassPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementClassPipe, name: "elementClass" });
|
|
3821
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementClassPipe, decorators: [{
|
|
3822
|
-
type: i0.Pipe,
|
|
3823
|
-
args: [{
|
|
3824
|
-
name: 'elementClass'
|
|
3825
|
-
}]
|
|
3826
|
-
}] });
|
|
3827
|
-
|
|
3828
3729
|
var TheNumberedListComponent = /** @class */ (function (_super) {
|
|
3829
3730
|
__extends(TheNumberedListComponent, _super);
|
|
3830
|
-
function TheNumberedListComponent(elementRef, cdr
|
|
3731
|
+
function TheNumberedListComponent(elementRef, cdr) {
|
|
3831
3732
|
var _this = _super.call(this, elementRef, cdr) || this;
|
|
3832
3733
|
_this.elementRef = elementRef;
|
|
3833
3734
|
_this.cdr = cdr;
|
|
3834
|
-
_this.elementClassPipe = elementClassPipe;
|
|
3835
3735
|
return _this;
|
|
3836
3736
|
}
|
|
3837
3737
|
Object.defineProperty(TheNumberedListComponent.prototype, "start", {
|
|
@@ -3841,9 +3741,10 @@
|
|
|
3841
3741
|
enumerable: false,
|
|
3842
3742
|
configurable: true
|
|
3843
3743
|
});
|
|
3844
|
-
Object.defineProperty(TheNumberedListComponent.prototype, "
|
|
3744
|
+
Object.defineProperty(TheNumberedListComponent.prototype, "level", {
|
|
3845
3745
|
get: function () {
|
|
3846
|
-
|
|
3746
|
+
var _a;
|
|
3747
|
+
return (_a = this.element) === null || _a === void 0 ? void 0 : _a.indent;
|
|
3847
3748
|
},
|
|
3848
3749
|
enumerable: false,
|
|
3849
3750
|
configurable: true
|
|
@@ -3856,35 +3757,34 @@
|
|
|
3856
3757
|
};
|
|
3857
3758
|
return TheNumberedListComponent;
|
|
3858
3759
|
}(TheBaseElementComponent));
|
|
3859
|
-
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 }
|
|
3860
|
-
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"] }] });
|
|
3861
3762
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheNumberedListComponent, decorators: [{
|
|
3862
3763
|
type: i0.Component,
|
|
3863
3764
|
args: [{
|
|
3864
3765
|
selector: 'ol[theOl]',
|
|
3865
|
-
template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>"
|
|
3866
|
-
providers: [ElementClassPipe]
|
|
3766
|
+
template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>"
|
|
3867
3767
|
}]
|
|
3868
|
-
}], 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: [{
|
|
3869
3769
|
type: i0.HostBinding,
|
|
3870
3770
|
args: ['attr.start']
|
|
3871
|
-
}],
|
|
3771
|
+
}], level: [{
|
|
3872
3772
|
type: i0.HostBinding,
|
|
3873
|
-
args: ['
|
|
3773
|
+
args: ['attr.the-level']
|
|
3874
3774
|
}] } });
|
|
3875
3775
|
|
|
3876
3776
|
var TheBulletedListComponent = /** @class */ (function (_super) {
|
|
3877
3777
|
__extends(TheBulletedListComponent, _super);
|
|
3878
|
-
function TheBulletedListComponent(elementRef, cdr
|
|
3778
|
+
function TheBulletedListComponent(elementRef, cdr) {
|
|
3879
3779
|
var _this = _super.call(this, elementRef, cdr) || this;
|
|
3880
3780
|
_this.elementRef = elementRef;
|
|
3881
3781
|
_this.cdr = cdr;
|
|
3882
|
-
_this.elementClassPipe = elementClassPipe;
|
|
3883
3782
|
return _this;
|
|
3884
3783
|
}
|
|
3885
|
-
Object.defineProperty(TheBulletedListComponent.prototype, "
|
|
3784
|
+
Object.defineProperty(TheBulletedListComponent.prototype, "level", {
|
|
3886
3785
|
get: function () {
|
|
3887
|
-
|
|
3786
|
+
var _a;
|
|
3787
|
+
return (_a = this.element) === null || _a === void 0 ? void 0 : _a.indent;
|
|
3888
3788
|
},
|
|
3889
3789
|
enumerable: false,
|
|
3890
3790
|
configurable: true
|
|
@@ -3897,18 +3797,17 @@
|
|
|
3897
3797
|
};
|
|
3898
3798
|
return TheBulletedListComponent;
|
|
3899
3799
|
}(TheBaseElementComponent));
|
|
3900
|
-
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 }
|
|
3901
|
-
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"] }] });
|
|
3902
3802
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheBulletedListComponent, decorators: [{
|
|
3903
3803
|
type: i0.Component,
|
|
3904
3804
|
args: [{
|
|
3905
3805
|
selector: 'ul[theUl]',
|
|
3906
|
-
template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>"
|
|
3907
|
-
providers: [ElementClassPipe]
|
|
3806
|
+
template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>"
|
|
3908
3807
|
}]
|
|
3909
|
-
}], 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: [{
|
|
3910
3809
|
type: i0.HostBinding,
|
|
3911
|
-
args: ['
|
|
3810
|
+
args: ['attr.the-level']
|
|
3912
3811
|
}] } });
|
|
3913
3812
|
|
|
3914
3813
|
var TheListItemComponent = /** @class */ (function (_super) {
|
|
@@ -4241,52 +4140,6 @@
|
|
|
4241
4140
|
};
|
|
4242
4141
|
};
|
|
4243
4142
|
|
|
4244
|
-
/** Converts CSS pixel values to numbers, eg "123px" to 123. Returns NaN for non pixel values. */
|
|
4245
|
-
function coercePixelsFromCssValue(cssValue) {
|
|
4246
|
-
var match = cssValue.match(/(\d+)px/);
|
|
4247
|
-
if (match) {
|
|
4248
|
-
return Number(match[1]);
|
|
4249
|
-
}
|
|
4250
|
-
}
|
|
4251
|
-
function getElementWidth(element) {
|
|
4252
|
-
// Optimization: Check style.width first as we probably set it already before reading
|
|
4253
|
-
// offsetWidth which triggers layout.
|
|
4254
|
-
return coercePixelsFromCssValue(element.style.width) || element.offsetWidth;
|
|
4255
|
-
}
|
|
4256
|
-
function getElementHeight(element) {
|
|
4257
|
-
return Math.round(element.getBoundingClientRect().height);
|
|
4258
|
-
}
|
|
4259
|
-
function getColsTotalWidth(cols) {
|
|
4260
|
-
return cols.reduce(function (total, col) {
|
|
4261
|
-
return total + getElementWidth(col);
|
|
4262
|
-
}, 0);
|
|
4263
|
-
}
|
|
4264
|
-
function getRowsTotalHeight(rows) {
|
|
4265
|
-
return rows.reduce(function (total, row) {
|
|
4266
|
-
return total + getElementHeight(row);
|
|
4267
|
-
}, 0);
|
|
4268
|
-
}
|
|
4269
|
-
function useElementStyle(el, element) {
|
|
4270
|
-
if (element.align) {
|
|
4271
|
-
el.style.textAlign = element.align || exports.Alignment.left;
|
|
4272
|
-
}
|
|
4273
|
-
if (element.textIndent) {
|
|
4274
|
-
el.style.textIndent = element.textIndent + 'em';
|
|
4275
|
-
}
|
|
4276
|
-
if (element.verticalAlign) {
|
|
4277
|
-
el.style.verticalAlign = element.verticalAlign;
|
|
4278
|
-
}
|
|
4279
|
-
}
|
|
4280
|
-
function getElementClassByPrefix(el, prefix) {
|
|
4281
|
-
var matchClass = null;
|
|
4282
|
-
el.classList.forEach(function (value, key) {
|
|
4283
|
-
if (value.includes(prefix)) {
|
|
4284
|
-
matchClass = value;
|
|
4285
|
-
}
|
|
4286
|
-
});
|
|
4287
|
-
return matchClass;
|
|
4288
|
-
}
|
|
4289
|
-
|
|
4290
4143
|
var TheTodoItemComponent = /** @class */ (function (_super) {
|
|
4291
4144
|
__extends(TheTodoItemComponent, _super);
|
|
4292
4145
|
function TheTodoItemComponent(elementRef, cdr) {
|
|
@@ -4296,15 +4149,16 @@
|
|
|
4296
4149
|
_this.checkItemClass = true;
|
|
4297
4150
|
return _this;
|
|
4298
4151
|
}
|
|
4299
|
-
TheTodoItemComponent.prototype
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
}
|
|
4304
|
-
|
|
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
|
+
});
|
|
4305
4160
|
TheTodoItemComponent.prototype.ngOnInit = function () {
|
|
4306
4161
|
_super.prototype.ngOnInit.call(this);
|
|
4307
|
-
this.useIndentClass(this.elementRef.nativeElement, this.element);
|
|
4308
4162
|
};
|
|
4309
4163
|
TheTodoItemComponent.prototype.onCheck = function (checked) {
|
|
4310
4164
|
if (this.readonly) {
|
|
@@ -4312,27 +4166,10 @@
|
|
|
4312
4166
|
}
|
|
4313
4167
|
setNode(this.editor, { checked: checked }, this.element);
|
|
4314
4168
|
};
|
|
4315
|
-
TheTodoItemComponent.prototype.useIndentClass = function (el, element) {
|
|
4316
|
-
var prefix = 'indent';
|
|
4317
|
-
if (element.textIndent) {
|
|
4318
|
-
var oldClass = getElementClassByPrefix(el, prefix);
|
|
4319
|
-
if (oldClass) {
|
|
4320
|
-
el.classList.remove(oldClass);
|
|
4321
|
-
}
|
|
4322
|
-
var newClassName = prefix + "-" + element.textIndent;
|
|
4323
|
-
el.classList.add(newClassName);
|
|
4324
|
-
}
|
|
4325
|
-
else {
|
|
4326
|
-
var oldClass = getElementClassByPrefix(el, prefix);
|
|
4327
|
-
if (oldClass) {
|
|
4328
|
-
el.classList.remove(oldClass);
|
|
4329
|
-
}
|
|
4330
|
-
}
|
|
4331
|
-
};
|
|
4332
4169
|
return TheTodoItemComponent;
|
|
4333
4170
|
}(TheBaseElementComponent));
|
|
4334
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 });
|
|
4335
|
-
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"] }] });
|
|
4336
4173
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheTodoItemComponent, decorators: [{
|
|
4337
4174
|
type: i0.Component,
|
|
4338
4175
|
args: [{
|
|
@@ -4342,6 +4179,9 @@
|
|
|
4342
4179
|
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { checkItemClass: [{
|
|
4343
4180
|
type: i0.HostBinding,
|
|
4344
4181
|
args: ['class.the-check-item']
|
|
4182
|
+
}], level: [{
|
|
4183
|
+
type: i0.HostBinding,
|
|
4184
|
+
args: ['attr.the-level']
|
|
4345
4185
|
}] } });
|
|
4346
4186
|
|
|
4347
4187
|
var withTodoItem = function (editor) {
|
|
@@ -4980,7 +4820,7 @@
|
|
|
4980
4820
|
return;
|
|
4981
4821
|
}
|
|
4982
4822
|
// → + right-block-card
|
|
4983
|
-
if (
|
|
4823
|
+
if (isMoveForward && !isCardLeftCursor) {
|
|
4984
4824
|
nativeEvent.preventDefault();
|
|
4985
4825
|
var _c = __read(i1.AngularEditor.toSlateCardEntry(editor, anchorNode), 2), path = _c[1];
|
|
4986
4826
|
var nextPath = slate.Path.next(path);
|
|
@@ -8699,6 +8539,52 @@
|
|
|
8699
8539
|
type: i0.Injectable
|
|
8700
8540
|
}], ctorParameters: function () { return []; } });
|
|
8701
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
|
+
|
|
8702
8588
|
function splitCell(editor) {
|
|
8703
8589
|
var opts = new TableOptions$1();
|
|
8704
8590
|
var anchor = editor.selection.anchor;
|
|
@@ -12142,7 +12028,7 @@
|
|
|
12142
12028
|
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
12143
12029
|
// Put this at the start and end of an inline component to work around this Chromium bug:
|
|
12144
12030
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=1249405
|
|
12145
|
-
_this.inlineChromiumBugfix =
|
|
12031
|
+
_this.inlineChromiumBugfix = String.fromCodePoint(160);
|
|
12146
12032
|
return _this;
|
|
12147
12033
|
}
|
|
12148
12034
|
return TheInlineCodeComponent;
|
|
@@ -12198,6 +12084,300 @@
|
|
|
12198
12084
|
return editor;
|
|
12199
12085
|
};
|
|
12200
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 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]" }] });
|
|
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 disableGroup = HEADING_TYPES;
|
|
12272
|
+
var anchorBlock$1 = anchorBlock(editor);
|
|
12273
|
+
return anchorBlock$1 && disableGroup.includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
|
|
12274
|
+
}
|
|
12275
|
+
return false;
|
|
12276
|
+
}
|
|
12277
|
+
};
|
|
12278
|
+
|
|
12279
|
+
var IndentOptions = [
|
|
12280
|
+
{
|
|
12281
|
+
key: exports.ElementKinds.indent,
|
|
12282
|
+
includes: [exports.Indents.indentRight, exports.Indents.indentLeft],
|
|
12283
|
+
iconComponent: TheIndentToolbarComponent,
|
|
12284
|
+
disable: function (editor) { return IndentEditor.isDisabled(editor); }
|
|
12285
|
+
},
|
|
12286
|
+
{
|
|
12287
|
+
key: exports.Indents.indentRight,
|
|
12288
|
+
name: '增加缩进',
|
|
12289
|
+
icon: 'float-left',
|
|
12290
|
+
execute: function (editor) { return IndentEditor.setIndent(editor); }
|
|
12291
|
+
},
|
|
12292
|
+
{
|
|
12293
|
+
key: exports.Indents.indentLeft,
|
|
12294
|
+
name: '减少缩进',
|
|
12295
|
+
icon: 'float-right',
|
|
12296
|
+
type: exports.ToolbarItemType.toolDropdown,
|
|
12297
|
+
execute: function (editor) { return IndentEditor.cancelIndent(editor); }
|
|
12298
|
+
}
|
|
12299
|
+
];
|
|
12300
|
+
|
|
12301
|
+
var onKeydownTextIndent = function (editor, event, kinds) {
|
|
12302
|
+
var selection = editor.selection;
|
|
12303
|
+
var isExpanded = slate.Range.isExpanded(selection);
|
|
12304
|
+
var nodes = Array.from(slate.Editor.nodes(editor, {
|
|
12305
|
+
mode: 'highest',
|
|
12306
|
+
match: function (node) { return slate.Element.isElement(node) && kinds.includes(node.type); }
|
|
12307
|
+
}));
|
|
12308
|
+
var _a = __read(nodes, 1), startBlock = _a[0];
|
|
12309
|
+
if (!startBlock) {
|
|
12310
|
+
return false;
|
|
12311
|
+
}
|
|
12312
|
+
var _b = __read(startBlock, 2), block = _b[0], path = _b[1];
|
|
12313
|
+
var currentPath = [path[0]];
|
|
12314
|
+
var isStart = slate.Editor.isStart(editor, selection.anchor, currentPath);
|
|
12315
|
+
var textIndentDisable = [exports.ElementKinds.bulletedList, exports.ElementKinds.numberedList, exports.ElementKinds.checkItem];
|
|
12316
|
+
if (isHotkey__default["default"]('Tab', event)) {
|
|
12317
|
+
event.preventDefault();
|
|
12318
|
+
if (startBlock && (isExpanded || isStart)) {
|
|
12319
|
+
if (!editor.isVoid(block)) {
|
|
12320
|
+
var textIndent = block.textIndent, type = block.type;
|
|
12321
|
+
// do not apply first-line indentation for lists
|
|
12322
|
+
if (!textIndent && !textIndentDisable.includes(type)) {
|
|
12323
|
+
IndentEditor.setTextIndent(editor, kinds, 2);
|
|
12324
|
+
return true;
|
|
12325
|
+
}
|
|
12326
|
+
else {
|
|
12327
|
+
IndentEditor.setIndent(editor);
|
|
12328
|
+
return true;
|
|
12329
|
+
}
|
|
12330
|
+
}
|
|
12331
|
+
}
|
|
12332
|
+
else {
|
|
12333
|
+
editor.insertText(TAB_SPACE);
|
|
12334
|
+
return true;
|
|
12335
|
+
}
|
|
12336
|
+
}
|
|
12337
|
+
if (isHotkey__default["default"]('shift+Tab', event)) {
|
|
12338
|
+
if (startBlock && (isExpanded || isStart)) {
|
|
12339
|
+
if (!editor.isVoid(block)) {
|
|
12340
|
+
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
12341
|
+
}
|
|
12342
|
+
}
|
|
12343
|
+
}
|
|
12344
|
+
if (selection && slate.Range.isCollapsed(selection) && i1.hotkeys.isDeleteBackward(event)) {
|
|
12345
|
+
if (startBlock && isStart) {
|
|
12346
|
+
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
12347
|
+
}
|
|
12348
|
+
}
|
|
12349
|
+
return false;
|
|
12350
|
+
};
|
|
12351
|
+
|
|
12352
|
+
var withIndent = function (kinds) { return function (editor) {
|
|
12353
|
+
var onKeydown = editor.onKeydown;
|
|
12354
|
+
editor.onKeydown = function (event) {
|
|
12355
|
+
var HOTKEYS = {
|
|
12356
|
+
'mod+]': exports.Indents.indentRight,
|
|
12357
|
+
'mod+[': exports.Indents.indentLeft
|
|
12358
|
+
};
|
|
12359
|
+
for (var hotkey in HOTKEYS) {
|
|
12360
|
+
if (isHotkey__default["default"](hotkey, event)) {
|
|
12361
|
+
event.preventDefault();
|
|
12362
|
+
var mark = HOTKEYS[hotkey];
|
|
12363
|
+
switch (mark) {
|
|
12364
|
+
case exports.Indents.indentRight:
|
|
12365
|
+
IndentEditor.setIndent(editor);
|
|
12366
|
+
break;
|
|
12367
|
+
case exports.Indents.indentLeft:
|
|
12368
|
+
IndentEditor.cancelIndent(editor);
|
|
12369
|
+
break;
|
|
12370
|
+
}
|
|
12371
|
+
}
|
|
12372
|
+
}
|
|
12373
|
+
var isContinue = !onKeydownTextIndent(editor, event, kinds);
|
|
12374
|
+
if (isContinue) {
|
|
12375
|
+
onKeydown(event);
|
|
12376
|
+
}
|
|
12377
|
+
};
|
|
12378
|
+
return editor;
|
|
12379
|
+
}; };
|
|
12380
|
+
|
|
12201
12381
|
var internalPlugins = [
|
|
12202
12382
|
withTheHistory,
|
|
12203
12383
|
withAutoInsertData(),
|
|
@@ -12240,7 +12420,7 @@
|
|
|
12240
12420
|
withQuickInsert,
|
|
12241
12421
|
withInlineCode
|
|
12242
12422
|
];
|
|
12243
|
-
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));
|
|
12423
|
+
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));
|
|
12244
12424
|
var toolbarCompose = function (toolbarItems) {
|
|
12245
12425
|
if (toolbarItems === void 0) { toolbarItems = []; }
|
|
12246
12426
|
return __spreadArray(__spreadArray([], __read(internalToolbarItems)), __read(toolbarItems));
|
|
@@ -12887,6 +13067,51 @@
|
|
|
12887
13067
|
args: ['mousedown', ['$event']]
|
|
12888
13068
|
}] } });
|
|
12889
13069
|
|
|
13070
|
+
var ElementStylePipe = /** @class */ (function () {
|
|
13071
|
+
function ElementStylePipe() {
|
|
13072
|
+
}
|
|
13073
|
+
ElementStylePipe.prototype.transform = function (element, align) {
|
|
13074
|
+
var style = {};
|
|
13075
|
+
if (element.align || align) {
|
|
13076
|
+
style.textAlign = element.align || align || exports.Alignment.left;
|
|
13077
|
+
}
|
|
13078
|
+
if (element.textIndent) {
|
|
13079
|
+
style.textIndent = element.textIndent + 'em';
|
|
13080
|
+
}
|
|
13081
|
+
return style;
|
|
13082
|
+
};
|
|
13083
|
+
return ElementStylePipe;
|
|
13084
|
+
}());
|
|
13085
|
+
ElementStylePipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementStylePipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
|
|
13086
|
+
ElementStylePipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementStylePipe, name: "elementStyle" });
|
|
13087
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementStylePipe, decorators: [{
|
|
13088
|
+
type: i0.Pipe,
|
|
13089
|
+
args: [{
|
|
13090
|
+
name: 'elementStyle'
|
|
13091
|
+
}]
|
|
13092
|
+
}] });
|
|
13093
|
+
var ElementClassPipe = /** @class */ (function () {
|
|
13094
|
+
function ElementClassPipe() {
|
|
13095
|
+
}
|
|
13096
|
+
ElementClassPipe.prototype.transform = function (element) {
|
|
13097
|
+
var classStr = '';
|
|
13098
|
+
var prefix = 'indent';
|
|
13099
|
+
if (element.textIndent) {
|
|
13100
|
+
classStr += prefix + "-" + element.textIndent;
|
|
13101
|
+
}
|
|
13102
|
+
return classStr;
|
|
13103
|
+
};
|
|
13104
|
+
return ElementClassPipe;
|
|
13105
|
+
}());
|
|
13106
|
+
ElementClassPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementClassPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
|
|
13107
|
+
ElementClassPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementClassPipe, name: "elementClass" });
|
|
13108
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementClassPipe, decorators: [{
|
|
13109
|
+
type: i0.Pipe,
|
|
13110
|
+
args: [{
|
|
13111
|
+
name: 'elementClass'
|
|
13112
|
+
}]
|
|
13113
|
+
}] });
|
|
13114
|
+
|
|
12890
13115
|
var TheTemplateComponent = /** @class */ (function () {
|
|
12891
13116
|
function TheTemplateComponent() {
|
|
12892
13117
|
var _this = this;
|
|
@@ -13561,7 +13786,8 @@
|
|
|
13561
13786
|
TheTableSelectComponent,
|
|
13562
13787
|
TheTableToolbarItemComponent,
|
|
13563
13788
|
TheConversionHintComponent,
|
|
13564
|
-
TheVerticalToolbarItemComponent
|
|
13789
|
+
TheVerticalToolbarItemComponent,
|
|
13790
|
+
TheIndentToolbarComponent
|
|
13565
13791
|
];
|
|
13566
13792
|
var PLUGIN_COMPONENTS = [
|
|
13567
13793
|
TheImageComponent,
|
|
@@ -13607,7 +13833,8 @@
|
|
|
13607
13833
|
TheTableSelectComponent,
|
|
13608
13834
|
TheTableToolbarItemComponent,
|
|
13609
13835
|
TheConversionHintComponent,
|
|
13610
|
-
TheVerticalToolbarItemComponent,
|
|
13836
|
+
TheVerticalToolbarItemComponent,
|
|
13837
|
+
TheIndentToolbarComponent, TheImageComponent,
|
|
13611
13838
|
TheTemplateComponent,
|
|
13612
13839
|
TheHrComponent,
|
|
13613
13840
|
TheBlockquoteComponent,
|