@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, Component, ChangeDetectionStrategy, Input, HostListener, ViewContainerRef, ChangeDetectorRef, Injectable, Inject, ViewChild,
|
|
2
|
+
import { InjectionToken, Component, ChangeDetectionStrategy, HostBinding, Input, HostListener, ViewContainerRef, ChangeDetectorRef, Injectable, Inject, ViewChild, Directive, ElementRef, TemplateRef, Pipe, EventEmitter, forwardRef, Output, NgModule } from '@angular/core';
|
|
3
3
|
import * as i6 from '@angular/common';
|
|
4
4
|
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
5
5
|
import * as i4$2 from '@angular/forms';
|
|
@@ -100,6 +100,7 @@ var ElementKinds;
|
|
|
100
100
|
ElementKinds["link"] = "link";
|
|
101
101
|
ElementKinds["default"] = "paragraph";
|
|
102
102
|
ElementKinds["inlineCode"] = "inline-code";
|
|
103
|
+
ElementKinds["indent"] = "indent";
|
|
103
104
|
})(ElementKinds || (ElementKinds = {}));
|
|
104
105
|
var Alignment;
|
|
105
106
|
(function (Alignment) {
|
|
@@ -141,6 +142,11 @@ const FontSizeTypes = [
|
|
|
141
142
|
FontSizes.fontSize40,
|
|
142
143
|
FontSizes.fontSize48
|
|
143
144
|
];
|
|
145
|
+
var Indents;
|
|
146
|
+
(function (Indents) {
|
|
147
|
+
Indents["indentRight"] = "indent-right";
|
|
148
|
+
Indents["indentLeft"] = "indent-left";
|
|
149
|
+
})(Indents || (Indents = {}));
|
|
144
150
|
var MarkTypes;
|
|
145
151
|
(function (MarkTypes) {
|
|
146
152
|
MarkTypes["bold"] = "bold";
|
|
@@ -425,9 +431,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
425
431
|
}] });
|
|
426
432
|
|
|
427
433
|
class TheDefaultElementComponent extends TheBaseElementComponent {
|
|
434
|
+
get indent() {
|
|
435
|
+
var _a;
|
|
436
|
+
return (_a = this.element) === null || _a === void 0 ? void 0 : _a.indent;
|
|
437
|
+
}
|
|
428
438
|
}
|
|
429
439
|
TheDefaultElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheDefaultElementComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
430
|
-
TheDefaultElementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheDefaultElementComponent, selector: "[theDefaultElement]", usesInheritance: true, ngImport: i0, template: '<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>', isInline: true, components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
440
|
+
TheDefaultElementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheDefaultElementComponent, selector: "[theDefaultElement]", host: { properties: { "attr.the-indent": "this.indent" } }, usesInheritance: true, ngImport: i0, template: '<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>', isInline: true, components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
431
441
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheDefaultElementComponent, decorators: [{
|
|
432
442
|
type: Component,
|
|
433
443
|
args: [{
|
|
@@ -435,7 +445,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
435
445
|
template: '<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>',
|
|
436
446
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
437
447
|
}]
|
|
438
|
-
}]
|
|
448
|
+
}], propDecorators: { indent: [{
|
|
449
|
+
type: HostBinding,
|
|
450
|
+
args: ['attr.the-indent']
|
|
451
|
+
}] } });
|
|
439
452
|
|
|
440
453
|
const TheEditor = Object.assign({}, AngularEditor);
|
|
441
454
|
var TheDataMode;
|
|
@@ -2675,86 +2688,6 @@ const withImage = (editor) => {
|
|
|
2675
2688
|
return editor;
|
|
2676
2689
|
};
|
|
2677
2690
|
|
|
2678
|
-
const onKeydownIndent = (editor, event, kinds) => {
|
|
2679
|
-
const { selection } = editor;
|
|
2680
|
-
if (event.key === 'Tab') {
|
|
2681
|
-
event.preventDefault();
|
|
2682
|
-
const isExpanded = Range.isExpanded(selection);
|
|
2683
|
-
const nodes = Array.from(Editor.nodes(editor, {
|
|
2684
|
-
mode: 'highest',
|
|
2685
|
-
match: indentNodeMatch(kinds)
|
|
2686
|
-
}));
|
|
2687
|
-
const startBlock = nodes[0];
|
|
2688
|
-
if (startBlock && (isExpanded || Editor.isStart(editor, selection.anchor, [startBlock[1][0]]))) {
|
|
2689
|
-
if (!editor.isVoid(startBlock[0])) {
|
|
2690
|
-
if (event.shiftKey) {
|
|
2691
|
-
return cancelTextIntent(editor, startBlock[0], kinds);
|
|
2692
|
-
}
|
|
2693
|
-
let { textIndent } = startBlock[0];
|
|
2694
|
-
textIndent = textIndent ? textIndent : 0;
|
|
2695
|
-
textIndent += 2;
|
|
2696
|
-
if (textIndent < 50) {
|
|
2697
|
-
Transforms.setNodes(editor, { textIndent }, {
|
|
2698
|
-
mode: 'highest',
|
|
2699
|
-
match: indentNodeMatch(kinds)
|
|
2700
|
-
});
|
|
2701
|
-
return true;
|
|
2702
|
-
}
|
|
2703
|
-
}
|
|
2704
|
-
}
|
|
2705
|
-
else {
|
|
2706
|
-
editor.insertText(TAB_SPACE);
|
|
2707
|
-
return true;
|
|
2708
|
-
}
|
|
2709
|
-
}
|
|
2710
|
-
if (selection && Range.isCollapsed(selection) && event.key === 'Backspace') {
|
|
2711
|
-
const nodes = Array.from(Editor.nodes(editor, {
|
|
2712
|
-
mode: 'highest',
|
|
2713
|
-
match: indentNodeMatch(kinds)
|
|
2714
|
-
}));
|
|
2715
|
-
const startBlock = nodes[0];
|
|
2716
|
-
if (startBlock && Editor.isStart(editor, selection.anchor, [startBlock[1][0]])) {
|
|
2717
|
-
return cancelTextIntent(editor, startBlock[0], kinds);
|
|
2718
|
-
}
|
|
2719
|
-
}
|
|
2720
|
-
return false;
|
|
2721
|
-
};
|
|
2722
|
-
const indentNodeMatch = (kinds) => node => Element$1.isElement(node) && kinds.includes(node.type);
|
|
2723
|
-
function cancelTextIntent(editor, anchorBlock, kinds) {
|
|
2724
|
-
let { textIndent } = anchorBlock;
|
|
2725
|
-
if (textIndent > 2) {
|
|
2726
|
-
// prevent deleteBackward function
|
|
2727
|
-
event.preventDefault();
|
|
2728
|
-
textIndent -= 2;
|
|
2729
|
-
Transforms.setNodes(editor, { textIndent }, {
|
|
2730
|
-
mode: 'highest',
|
|
2731
|
-
match: indentNodeMatch(kinds)
|
|
2732
|
-
});
|
|
2733
|
-
return true;
|
|
2734
|
-
}
|
|
2735
|
-
if (textIndent === 2) {
|
|
2736
|
-
// prevent deleteBackward function
|
|
2737
|
-
event.preventDefault();
|
|
2738
|
-
Transforms.setNodes(editor, { textIndent: null }, {
|
|
2739
|
-
mode: 'highest',
|
|
2740
|
-
match: node => Element$1.isElement(node) && kinds.includes(node.type)
|
|
2741
|
-
});
|
|
2742
|
-
return true;
|
|
2743
|
-
}
|
|
2744
|
-
return false;
|
|
2745
|
-
}
|
|
2746
|
-
|
|
2747
|
-
const withIndent = (kinds) => (editor) => {
|
|
2748
|
-
const { onKeydown } = editor;
|
|
2749
|
-
editor.onKeydown = (event) => {
|
|
2750
|
-
const isContinue = !onKeydownIndent(editor, event, kinds);
|
|
2751
|
-
if (isContinue) {
|
|
2752
|
-
onKeydown(event);
|
|
2753
|
-
}
|
|
2754
|
-
};
|
|
2755
|
-
return editor;
|
|
2756
|
-
};
|
|
2757
|
-
|
|
2758
2691
|
const isList = (n) => {
|
|
2759
2692
|
return [...LIST_BLOCK_TYPES].includes(n.type);
|
|
2760
2693
|
};
|
|
@@ -3314,57 +3247,18 @@ function onKeyDownList(e, editor) {
|
|
|
3314
3247
|
}
|
|
3315
3248
|
}
|
|
3316
3249
|
|
|
3317
|
-
class ElementStylePipe {
|
|
3318
|
-
transform(element, align) {
|
|
3319
|
-
const style = {};
|
|
3320
|
-
if (element.align || align) {
|
|
3321
|
-
style.textAlign = element.align || align || Alignment.left;
|
|
3322
|
-
}
|
|
3323
|
-
if (element.textIndent) {
|
|
3324
|
-
style.textIndent = element.textIndent + 'em';
|
|
3325
|
-
}
|
|
3326
|
-
return style;
|
|
3327
|
-
}
|
|
3328
|
-
}
|
|
3329
|
-
ElementStylePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementStylePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
3330
|
-
ElementStylePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementStylePipe, name: "elementStyle" });
|
|
3331
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementStylePipe, decorators: [{
|
|
3332
|
-
type: Pipe,
|
|
3333
|
-
args: [{
|
|
3334
|
-
name: 'elementStyle'
|
|
3335
|
-
}]
|
|
3336
|
-
}] });
|
|
3337
|
-
class ElementClassPipe {
|
|
3338
|
-
transform(element) {
|
|
3339
|
-
let classStr = '';
|
|
3340
|
-
const prefix = 'indent';
|
|
3341
|
-
if (element.textIndent) {
|
|
3342
|
-
classStr += `${prefix}-${element.textIndent}`;
|
|
3343
|
-
}
|
|
3344
|
-
return classStr;
|
|
3345
|
-
}
|
|
3346
|
-
}
|
|
3347
|
-
ElementClassPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementClassPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
3348
|
-
ElementClassPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementClassPipe, name: "elementClass" });
|
|
3349
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementClassPipe, decorators: [{
|
|
3350
|
-
type: Pipe,
|
|
3351
|
-
args: [{
|
|
3352
|
-
name: 'elementClass'
|
|
3353
|
-
}]
|
|
3354
|
-
}] });
|
|
3355
|
-
|
|
3356
3250
|
class TheNumberedListComponent extends TheBaseElementComponent {
|
|
3357
|
-
constructor(elementRef, cdr
|
|
3251
|
+
constructor(elementRef, cdr) {
|
|
3358
3252
|
super(elementRef, cdr);
|
|
3359
3253
|
this.elementRef = elementRef;
|
|
3360
3254
|
this.cdr = cdr;
|
|
3361
|
-
this.elementClassPipe = elementClassPipe;
|
|
3362
3255
|
}
|
|
3363
3256
|
get start() {
|
|
3364
3257
|
return this.element.start;
|
|
3365
3258
|
}
|
|
3366
|
-
get
|
|
3367
|
-
|
|
3259
|
+
get level() {
|
|
3260
|
+
var _a;
|
|
3261
|
+
return (_a = this.element) === null || _a === void 0 ? void 0 : _a.indent;
|
|
3368
3262
|
}
|
|
3369
3263
|
ngOnInit() {
|
|
3370
3264
|
super.ngOnInit();
|
|
@@ -3373,32 +3267,31 @@ class TheNumberedListComponent extends TheBaseElementComponent {
|
|
|
3373
3267
|
super.ngOnDestroy();
|
|
3374
3268
|
}
|
|
3375
3269
|
}
|
|
3376
|
-
TheNumberedListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheNumberedListComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }
|
|
3377
|
-
TheNumberedListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheNumberedListComponent, selector: "ol[theOl]", host: { properties: { "attr.start": "this.start", "
|
|
3270
|
+
TheNumberedListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheNumberedListComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3271
|
+
TheNumberedListComponent.ɵcmp = i0.ɵɵ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, template: `<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>`, isInline: true, components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
|
|
3378
3272
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheNumberedListComponent, decorators: [{
|
|
3379
3273
|
type: Component,
|
|
3380
3274
|
args: [{
|
|
3381
3275
|
selector: 'ol[theOl]',
|
|
3382
|
-
template: `<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children
|
|
3383
|
-
providers: [ElementClassPipe]
|
|
3276
|
+
template: `<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>`
|
|
3384
3277
|
}]
|
|
3385
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }
|
|
3278
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { start: [{
|
|
3386
3279
|
type: HostBinding,
|
|
3387
3280
|
args: ['attr.start']
|
|
3388
|
-
}],
|
|
3281
|
+
}], level: [{
|
|
3389
3282
|
type: HostBinding,
|
|
3390
|
-
args: ['
|
|
3283
|
+
args: ['attr.the-level']
|
|
3391
3284
|
}] } });
|
|
3392
3285
|
|
|
3393
3286
|
class TheBulletedListComponent extends TheBaseElementComponent {
|
|
3394
|
-
constructor(elementRef, cdr
|
|
3287
|
+
constructor(elementRef, cdr) {
|
|
3395
3288
|
super(elementRef, cdr);
|
|
3396
3289
|
this.elementRef = elementRef;
|
|
3397
3290
|
this.cdr = cdr;
|
|
3398
|
-
this.elementClassPipe = elementClassPipe;
|
|
3399
3291
|
}
|
|
3400
|
-
get
|
|
3401
|
-
|
|
3292
|
+
get level() {
|
|
3293
|
+
var _a;
|
|
3294
|
+
return (_a = this.element) === null || _a === void 0 ? void 0 : _a.indent;
|
|
3402
3295
|
}
|
|
3403
3296
|
ngOnInit() {
|
|
3404
3297
|
super.ngOnInit();
|
|
@@ -3407,18 +3300,17 @@ class TheBulletedListComponent extends TheBaseElementComponent {
|
|
|
3407
3300
|
super.ngOnDestroy();
|
|
3408
3301
|
}
|
|
3409
3302
|
}
|
|
3410
|
-
TheBulletedListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheBulletedListComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }
|
|
3411
|
-
TheBulletedListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheBulletedListComponent, selector: "ul[theUl]", host: { properties: { "
|
|
3303
|
+
TheBulletedListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheBulletedListComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3304
|
+
TheBulletedListComponent.ɵcmp = i0.ɵɵ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, template: `<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>`, isInline: true, components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
|
|
3412
3305
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheBulletedListComponent, decorators: [{
|
|
3413
3306
|
type: Component,
|
|
3414
3307
|
args: [{
|
|
3415
3308
|
selector: 'ul[theUl]',
|
|
3416
|
-
template: `<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children
|
|
3417
|
-
providers: [ElementClassPipe]
|
|
3309
|
+
template: `<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>`
|
|
3418
3310
|
}]
|
|
3419
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }
|
|
3311
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { level: [{
|
|
3420
3312
|
type: HostBinding,
|
|
3421
|
-
args: ['
|
|
3313
|
+
args: ['attr.the-level']
|
|
3422
3314
|
}] } });
|
|
3423
3315
|
|
|
3424
3316
|
class TheListItemComponent extends TheBaseElementComponent {
|
|
@@ -3734,52 +3626,6 @@ const withList = ({ validLiChildrenTypes } = {}) => (editor) => {
|
|
|
3734
3626
|
return editor;
|
|
3735
3627
|
};
|
|
3736
3628
|
|
|
3737
|
-
/** Converts CSS pixel values to numbers, eg "123px" to 123. Returns NaN for non pixel values. */
|
|
3738
|
-
function coercePixelsFromCssValue(cssValue) {
|
|
3739
|
-
const match = cssValue.match(/(\d+)px/);
|
|
3740
|
-
if (match) {
|
|
3741
|
-
return Number(match[1]);
|
|
3742
|
-
}
|
|
3743
|
-
}
|
|
3744
|
-
function getElementWidth(element) {
|
|
3745
|
-
// Optimization: Check style.width first as we probably set it already before reading
|
|
3746
|
-
// offsetWidth which triggers layout.
|
|
3747
|
-
return coercePixelsFromCssValue(element.style.width) || element.offsetWidth;
|
|
3748
|
-
}
|
|
3749
|
-
function getElementHeight(element) {
|
|
3750
|
-
return Math.round(element.getBoundingClientRect().height);
|
|
3751
|
-
}
|
|
3752
|
-
function getColsTotalWidth(cols) {
|
|
3753
|
-
return cols.reduce((total, col) => {
|
|
3754
|
-
return total + getElementWidth(col);
|
|
3755
|
-
}, 0);
|
|
3756
|
-
}
|
|
3757
|
-
function getRowsTotalHeight(rows) {
|
|
3758
|
-
return rows.reduce((total, row) => {
|
|
3759
|
-
return total + getElementHeight(row);
|
|
3760
|
-
}, 0);
|
|
3761
|
-
}
|
|
3762
|
-
function useElementStyle(el, element) {
|
|
3763
|
-
if (element.align) {
|
|
3764
|
-
el.style.textAlign = element.align || Alignment.left;
|
|
3765
|
-
}
|
|
3766
|
-
if (element.textIndent) {
|
|
3767
|
-
el.style.textIndent = element.textIndent + 'em';
|
|
3768
|
-
}
|
|
3769
|
-
if (element.verticalAlign) {
|
|
3770
|
-
el.style.verticalAlign = element.verticalAlign;
|
|
3771
|
-
}
|
|
3772
|
-
}
|
|
3773
|
-
function getElementClassByPrefix(el, prefix) {
|
|
3774
|
-
let matchClass = null;
|
|
3775
|
-
el.classList.forEach((value, key) => {
|
|
3776
|
-
if (value.includes(prefix)) {
|
|
3777
|
-
matchClass = value;
|
|
3778
|
-
}
|
|
3779
|
-
});
|
|
3780
|
-
return matchClass;
|
|
3781
|
-
}
|
|
3782
|
-
|
|
3783
3629
|
class TheTodoItemComponent extends TheBaseElementComponent {
|
|
3784
3630
|
constructor(elementRef, cdr) {
|
|
3785
3631
|
super(elementRef, cdr);
|
|
@@ -3787,15 +3633,12 @@ class TheTodoItemComponent extends TheBaseElementComponent {
|
|
|
3787
3633
|
this.cdr = cdr;
|
|
3788
3634
|
this.checkItemClass = true;
|
|
3789
3635
|
}
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
this.useIndentClass(this.elementRef.nativeElement, this.element);
|
|
3794
|
-
}
|
|
3636
|
+
get level() {
|
|
3637
|
+
var _a;
|
|
3638
|
+
return (_a = this.element) === null || _a === void 0 ? void 0 : _a.indent;
|
|
3795
3639
|
}
|
|
3796
3640
|
ngOnInit() {
|
|
3797
3641
|
super.ngOnInit();
|
|
3798
|
-
this.useIndentClass(this.elementRef.nativeElement, this.element);
|
|
3799
3642
|
}
|
|
3800
3643
|
onCheck(checked) {
|
|
3801
3644
|
if (this.readonly) {
|
|
@@ -3803,26 +3646,9 @@ class TheTodoItemComponent extends TheBaseElementComponent {
|
|
|
3803
3646
|
}
|
|
3804
3647
|
setNode(this.editor, { checked }, this.element);
|
|
3805
3648
|
}
|
|
3806
|
-
useIndentClass(el, element) {
|
|
3807
|
-
const prefix = 'indent';
|
|
3808
|
-
if (element.textIndent) {
|
|
3809
|
-
const oldClass = getElementClassByPrefix(el, prefix);
|
|
3810
|
-
if (oldClass) {
|
|
3811
|
-
el.classList.remove(oldClass);
|
|
3812
|
-
}
|
|
3813
|
-
const newClassName = `${prefix}-${element.textIndent}`;
|
|
3814
|
-
el.classList.add(newClassName);
|
|
3815
|
-
}
|
|
3816
|
-
else {
|
|
3817
|
-
const oldClass = getElementClassByPrefix(el, prefix);
|
|
3818
|
-
if (oldClass) {
|
|
3819
|
-
el.classList.remove(oldClass);
|
|
3820
|
-
}
|
|
3821
|
-
}
|
|
3822
|
-
}
|
|
3823
3649
|
}
|
|
3824
3650
|
TheTodoItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheTodoItemComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3825
|
-
TheTodoItemComponent.ɵcmp = i0.ɵɵ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, template: `
|
|
3651
|
+
TheTodoItemComponent.ɵcmp = i0.ɵɵ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, template: `
|
|
3826
3652
|
<span contenteditable="false" class="todo-item-status">
|
|
3827
3653
|
<input #checkbox type="checkbox" [checked]="element.checked" (click)="onCheck(checkbox.checked)" />
|
|
3828
3654
|
</span>
|
|
@@ -3842,6 +3668,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
3842
3668
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { checkItemClass: [{
|
|
3843
3669
|
type: HostBinding,
|
|
3844
3670
|
args: ['class.the-check-item']
|
|
3671
|
+
}], level: [{
|
|
3672
|
+
type: HostBinding,
|
|
3673
|
+
args: ['attr.the-level']
|
|
3845
3674
|
}] } });
|
|
3846
3675
|
|
|
3847
3676
|
const withTodoItem = (editor) => {
|
|
@@ -4454,7 +4283,7 @@ const withBlockCard = (editor) => {
|
|
|
4454
4283
|
return;
|
|
4455
4284
|
}
|
|
4456
4285
|
// → + right-block-card
|
|
4457
|
-
if (
|
|
4286
|
+
if (isMoveForward && !isCardLeftCursor) {
|
|
4458
4287
|
nativeEvent.preventDefault();
|
|
4459
4288
|
const [, path] = AngularEditor.toSlateCardEntry(editor, anchorNode);
|
|
4460
4289
|
const nextPath = Path.next(path);
|
|
@@ -8020,6 +7849,52 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
8020
7849
|
type: Injectable
|
|
8021
7850
|
}], ctorParameters: function () { return []; } });
|
|
8022
7851
|
|
|
7852
|
+
/** Converts CSS pixel values to numbers, eg "123px" to 123. Returns NaN for non pixel values. */
|
|
7853
|
+
function coercePixelsFromCssValue(cssValue) {
|
|
7854
|
+
const match = cssValue.match(/(\d+)px/);
|
|
7855
|
+
if (match) {
|
|
7856
|
+
return Number(match[1]);
|
|
7857
|
+
}
|
|
7858
|
+
}
|
|
7859
|
+
function getElementWidth(element) {
|
|
7860
|
+
// Optimization: Check style.width first as we probably set it already before reading
|
|
7861
|
+
// offsetWidth which triggers layout.
|
|
7862
|
+
return coercePixelsFromCssValue(element.style.width) || element.offsetWidth;
|
|
7863
|
+
}
|
|
7864
|
+
function getElementHeight(element) {
|
|
7865
|
+
return Math.round(element.getBoundingClientRect().height);
|
|
7866
|
+
}
|
|
7867
|
+
function getColsTotalWidth(cols) {
|
|
7868
|
+
return cols.reduce((total, col) => {
|
|
7869
|
+
return total + getElementWidth(col);
|
|
7870
|
+
}, 0);
|
|
7871
|
+
}
|
|
7872
|
+
function getRowsTotalHeight(rows) {
|
|
7873
|
+
return rows.reduce((total, row) => {
|
|
7874
|
+
return total + getElementHeight(row);
|
|
7875
|
+
}, 0);
|
|
7876
|
+
}
|
|
7877
|
+
function useElementStyle(el, element) {
|
|
7878
|
+
if (element.align) {
|
|
7879
|
+
el.style.textAlign = element.align || Alignment.left;
|
|
7880
|
+
}
|
|
7881
|
+
if (element.textIndent) {
|
|
7882
|
+
el.style.textIndent = element.textIndent + 'em';
|
|
7883
|
+
}
|
|
7884
|
+
if (element.verticalAlign) {
|
|
7885
|
+
el.style.verticalAlign = element.verticalAlign;
|
|
7886
|
+
}
|
|
7887
|
+
}
|
|
7888
|
+
function getElementClassByPrefix(el, prefix) {
|
|
7889
|
+
let matchClass = null;
|
|
7890
|
+
el.classList.forEach((value, key) => {
|
|
7891
|
+
if (value.includes(prefix)) {
|
|
7892
|
+
matchClass = value;
|
|
7893
|
+
}
|
|
7894
|
+
});
|
|
7895
|
+
return matchClass;
|
|
7896
|
+
}
|
|
7897
|
+
|
|
8023
7898
|
function splitCell(editor) {
|
|
8024
7899
|
const opts = new TableOptions$1();
|
|
8025
7900
|
const { anchor } = editor.selection;
|
|
@@ -11279,7 +11154,7 @@ class TheInlineCodeComponent extends TheBaseElementComponent {
|
|
|
11279
11154
|
super(...arguments);
|
|
11280
11155
|
// Put this at the start and end of an inline component to work around this Chromium bug:
|
|
11281
11156
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=1249405
|
|
11282
|
-
this.inlineChromiumBugfix =
|
|
11157
|
+
this.inlineChromiumBugfix = String.fromCodePoint(160);
|
|
11283
11158
|
}
|
|
11284
11159
|
}
|
|
11285
11160
|
TheInlineCodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheInlineCodeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -11337,6 +11212,290 @@ const withInlineCode = (editor) => {
|
|
|
11337
11212
|
return editor;
|
|
11338
11213
|
};
|
|
11339
11214
|
|
|
11215
|
+
class TheIndentToolbarComponent extends TheToolbarBaseItemComponent {
|
|
11216
|
+
constructor(elementRef, thyPopover, viewContainerRef, overlay) {
|
|
11217
|
+
super();
|
|
11218
|
+
this.elementRef = elementRef;
|
|
11219
|
+
this.thyPopover = thyPopover;
|
|
11220
|
+
this.viewContainerRef = viewContainerRef;
|
|
11221
|
+
this.overlay = overlay;
|
|
11222
|
+
this.mode = DropdownMode.text;
|
|
11223
|
+
this.dropdownMode = DropdownMode;
|
|
11224
|
+
this.disabled = false;
|
|
11225
|
+
}
|
|
11226
|
+
get isOpen() {
|
|
11227
|
+
return this.dropdownPopoverRef && this.dropdownPopoverRef.getOverlayRef() && this.dropdownPopoverRef.getOverlayRef().hasAttached();
|
|
11228
|
+
}
|
|
11229
|
+
toggleDropdown(event) {
|
|
11230
|
+
var _a;
|
|
11231
|
+
super.execute(event);
|
|
11232
|
+
if (((_a = this.editor) === null || _a === void 0 ? void 0 : _a.disabled) || this.disabled) {
|
|
11233
|
+
return;
|
|
11234
|
+
}
|
|
11235
|
+
this.openDropdownPopover();
|
|
11236
|
+
}
|
|
11237
|
+
handleDocumentMouseDown(event) {
|
|
11238
|
+
if (!this.elementRef.nativeElement.contains(event.target)) {
|
|
11239
|
+
this.closeDropdownPopover();
|
|
11240
|
+
}
|
|
11241
|
+
}
|
|
11242
|
+
get disabledState() {
|
|
11243
|
+
return this.disabled;
|
|
11244
|
+
}
|
|
11245
|
+
ngOnInit() {
|
|
11246
|
+
var _a;
|
|
11247
|
+
if (!this.activeMenu) {
|
|
11248
|
+
this.activeMenu = this.menus[0];
|
|
11249
|
+
}
|
|
11250
|
+
if (this.toolbarItem) {
|
|
11251
|
+
this.elementRef.nativeElement.classList.add(`${(_a = this.toolbarItem) === null || _a === void 0 ? void 0 : _a.key}`);
|
|
11252
|
+
}
|
|
11253
|
+
}
|
|
11254
|
+
statusChange(editor) {
|
|
11255
|
+
var _a, _b;
|
|
11256
|
+
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;
|
|
11257
|
+
}
|
|
11258
|
+
itemMousedown(event, item) {
|
|
11259
|
+
super.execute(event);
|
|
11260
|
+
this.closeDropdownPopover();
|
|
11261
|
+
if (item === null || item === void 0 ? void 0 : item.execute) {
|
|
11262
|
+
item === null || item === void 0 ? void 0 : item.execute(this.editor);
|
|
11263
|
+
}
|
|
11264
|
+
}
|
|
11265
|
+
openDropdownPopover() {
|
|
11266
|
+
var _a;
|
|
11267
|
+
this.dropdownPopoverRef = this.thyPopover.open(this.dropdownTemplate, {
|
|
11268
|
+
origin: this.elementRef,
|
|
11269
|
+
panelClass: ['the-toolbar-dropdown-popover', (_a = this.toolbarItem) === null || _a === void 0 ? void 0 : _a.key],
|
|
11270
|
+
placement: 'bottomLeft',
|
|
11271
|
+
insideClosable: false,
|
|
11272
|
+
backdropClosable: true,
|
|
11273
|
+
hasBackdrop: false,
|
|
11274
|
+
offset: 10,
|
|
11275
|
+
viewContainerRef: this.viewContainerRef,
|
|
11276
|
+
scrollStrategy: this.overlay.scrollStrategies.reposition()
|
|
11277
|
+
});
|
|
11278
|
+
}
|
|
11279
|
+
closeDropdownPopover() {
|
|
11280
|
+
var _a;
|
|
11281
|
+
if (this.dropdownPopoverRef) {
|
|
11282
|
+
(_a = this.dropdownPopoverRef) === null || _a === void 0 ? void 0 : _a.close();
|
|
11283
|
+
}
|
|
11284
|
+
}
|
|
11285
|
+
}
|
|
11286
|
+
TheIndentToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheIndentToolbarComponent, deps: [{ token: i0.ElementRef }, { token: i1$3.ThyPopover }, { token: i0.ViewContainerRef }, { token: i2.Overlay }], target: i0.ɵɵFactoryTarget.Component });
|
|
11287
|
+
TheIndentToolbarComponent.ɵcmp = i0.ɵɵ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, 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.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i5$2.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }], directives: [{ type: i5$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5$2.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i5$2.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i5$2.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }] });
|
|
11288
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheIndentToolbarComponent, decorators: [{
|
|
11289
|
+
type: Component,
|
|
11290
|
+
args: [{
|
|
11291
|
+
selector: 'the-indent-toolbar-item',
|
|
11292
|
+
templateUrl: './toolbar-item.component.html',
|
|
11293
|
+
host: {
|
|
11294
|
+
class: 'the-toolbar-dropdown-container'
|
|
11295
|
+
}
|
|
11296
|
+
}]
|
|
11297
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$3.ThyPopover }, { type: i0.ViewContainerRef }, { type: i2.Overlay }]; }, propDecorators: { toolbarItem: [{
|
|
11298
|
+
type: Input
|
|
11299
|
+
}], menus: [{
|
|
11300
|
+
type: Input
|
|
11301
|
+
}], mode: [{
|
|
11302
|
+
type: Input
|
|
11303
|
+
}], item: [{
|
|
11304
|
+
type: Input
|
|
11305
|
+
}], dropdownTemplate: [{
|
|
11306
|
+
type: ViewChild,
|
|
11307
|
+
args: ['dropdownTemplate', { static: true }]
|
|
11308
|
+
}], toggleDropdown: [{
|
|
11309
|
+
type: HostListener,
|
|
11310
|
+
args: ['mousedown', ['$event']]
|
|
11311
|
+
}], handleDocumentMouseDown: [{
|
|
11312
|
+
type: HostListener,
|
|
11313
|
+
args: ['document: mousedown', ['$event']]
|
|
11314
|
+
}], disabledState: [{
|
|
11315
|
+
type: HostBinding,
|
|
11316
|
+
args: ['class.disabled']
|
|
11317
|
+
}] } });
|
|
11318
|
+
|
|
11319
|
+
const MaxIndent = 13;
|
|
11320
|
+
const includesIndentTypes = [
|
|
11321
|
+
ElementKinds.checkItem,
|
|
11322
|
+
ElementKinds.numberedList,
|
|
11323
|
+
ElementKinds.bulletedList,
|
|
11324
|
+
ElementKinds.paragraph,
|
|
11325
|
+
...HEADING_TYPES
|
|
11326
|
+
];
|
|
11327
|
+
const IndentEditor = {
|
|
11328
|
+
setIndent(editor) {
|
|
11329
|
+
const nodes = Array.from(Editor.nodes(editor, {
|
|
11330
|
+
mode: 'highest',
|
|
11331
|
+
match: n => Element$1.isElement(n) && includesIndentTypes.includes(n.type)
|
|
11332
|
+
}));
|
|
11333
|
+
const [startBlock] = nodes;
|
|
11334
|
+
if (startBlock) {
|
|
11335
|
+
let [{ indent }] = startBlock;
|
|
11336
|
+
indent = indent ? indent : 0;
|
|
11337
|
+
indent += 1;
|
|
11338
|
+
if (indent <= MaxIndent) {
|
|
11339
|
+
Transforms.setNodes(editor, { indent }, {
|
|
11340
|
+
mode: 'highest',
|
|
11341
|
+
match: n => Element$1.isElement(n) && includesIndentTypes.includes(n.type)
|
|
11342
|
+
});
|
|
11343
|
+
}
|
|
11344
|
+
}
|
|
11345
|
+
},
|
|
11346
|
+
cancelIndent(editor) {
|
|
11347
|
+
const nodes = Array.from(Editor.nodes(editor, {
|
|
11348
|
+
mode: 'highest',
|
|
11349
|
+
match: n => Element$1.isElement(n) && includesIndentTypes.includes(n.type)
|
|
11350
|
+
}));
|
|
11351
|
+
const [startBlock] = nodes;
|
|
11352
|
+
if (startBlock) {
|
|
11353
|
+
let [{ indent }] = startBlock;
|
|
11354
|
+
indent = indent === 1 ? null : (indent -= 1);
|
|
11355
|
+
Transforms.setNodes(editor, { indent }, {
|
|
11356
|
+
mode: 'highest',
|
|
11357
|
+
match: n => Element$1.isElement(n) && includesIndentTypes.includes(n.type)
|
|
11358
|
+
});
|
|
11359
|
+
}
|
|
11360
|
+
},
|
|
11361
|
+
setTextIndent(editor, kinds, textIndent) {
|
|
11362
|
+
Transforms.setNodes(editor, { textIndent }, {
|
|
11363
|
+
mode: 'highest',
|
|
11364
|
+
match: node => Element$1.isElement(node) && kinds.includes(node.type)
|
|
11365
|
+
});
|
|
11366
|
+
},
|
|
11367
|
+
cancelTextIntent(editor, event, anchorBlock, kinds) {
|
|
11368
|
+
let { textIndent, indent } = anchorBlock;
|
|
11369
|
+
if (indent) {
|
|
11370
|
+
event.preventDefault();
|
|
11371
|
+
IndentEditor.cancelIndent(editor);
|
|
11372
|
+
return true;
|
|
11373
|
+
}
|
|
11374
|
+
if (!indent && textIndent > 2) {
|
|
11375
|
+
event.preventDefault();
|
|
11376
|
+
textIndent -= 2;
|
|
11377
|
+
IndentEditor.setTextIndent(editor, kinds, textIndent);
|
|
11378
|
+
return true;
|
|
11379
|
+
}
|
|
11380
|
+
if (!indent && textIndent === 2) {
|
|
11381
|
+
event.preventDefault();
|
|
11382
|
+
IndentEditor.setTextIndent(editor, kinds, null);
|
|
11383
|
+
return true;
|
|
11384
|
+
}
|
|
11385
|
+
return false;
|
|
11386
|
+
},
|
|
11387
|
+
isDisabled(editor) {
|
|
11388
|
+
if (editor.selection) {
|
|
11389
|
+
const disableGroup = HEADING_TYPES;
|
|
11390
|
+
const anchorBlock$1 = anchorBlock(editor);
|
|
11391
|
+
return anchorBlock$1 && disableGroup.includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
|
|
11392
|
+
}
|
|
11393
|
+
return false;
|
|
11394
|
+
}
|
|
11395
|
+
};
|
|
11396
|
+
|
|
11397
|
+
const IndentOptions = [
|
|
11398
|
+
{
|
|
11399
|
+
key: ElementKinds.indent,
|
|
11400
|
+
includes: [Indents.indentRight, Indents.indentLeft],
|
|
11401
|
+
iconComponent: TheIndentToolbarComponent,
|
|
11402
|
+
disable: editor => IndentEditor.isDisabled(editor)
|
|
11403
|
+
},
|
|
11404
|
+
{
|
|
11405
|
+
key: Indents.indentRight,
|
|
11406
|
+
name: '增加缩进',
|
|
11407
|
+
icon: 'indent',
|
|
11408
|
+
execute: editor => IndentEditor.setIndent(editor)
|
|
11409
|
+
},
|
|
11410
|
+
{
|
|
11411
|
+
key: Indents.indentLeft,
|
|
11412
|
+
name: '减少缩进',
|
|
11413
|
+
icon: 'outdent',
|
|
11414
|
+
type: ToolbarItemType.toolDropdown,
|
|
11415
|
+
execute: editor => IndentEditor.cancelIndent(editor)
|
|
11416
|
+
}
|
|
11417
|
+
];
|
|
11418
|
+
|
|
11419
|
+
const onKeydownTextIndent = (editor, event, kinds) => {
|
|
11420
|
+
const { selection } = editor;
|
|
11421
|
+
const isExpanded = Range.isExpanded(selection);
|
|
11422
|
+
const nodes = Array.from(Editor.nodes(editor, {
|
|
11423
|
+
mode: 'highest',
|
|
11424
|
+
match: node => Element$1.isElement(node) && kinds.includes(node.type)
|
|
11425
|
+
}));
|
|
11426
|
+
const [startBlock] = nodes;
|
|
11427
|
+
if (!startBlock) {
|
|
11428
|
+
return false;
|
|
11429
|
+
}
|
|
11430
|
+
const [block, path] = startBlock;
|
|
11431
|
+
const currentPath = [path[0]];
|
|
11432
|
+
const isStart = Editor.isStart(editor, selection.anchor, currentPath);
|
|
11433
|
+
const textIndentDisable = [ElementKinds.bulletedList, ElementKinds.numberedList, ElementKinds.checkItem];
|
|
11434
|
+
if (isHotkey('Tab', event)) {
|
|
11435
|
+
event.preventDefault();
|
|
11436
|
+
if (startBlock && (isExpanded || isStart)) {
|
|
11437
|
+
if (!editor.isVoid(block)) {
|
|
11438
|
+
let { textIndent, type } = block;
|
|
11439
|
+
// do not apply first-line indentation for lists
|
|
11440
|
+
if (!textIndent && !textIndentDisable.includes(type)) {
|
|
11441
|
+
IndentEditor.setTextIndent(editor, kinds, 2);
|
|
11442
|
+
return true;
|
|
11443
|
+
}
|
|
11444
|
+
else {
|
|
11445
|
+
IndentEditor.setIndent(editor);
|
|
11446
|
+
return true;
|
|
11447
|
+
}
|
|
11448
|
+
}
|
|
11449
|
+
}
|
|
11450
|
+
else {
|
|
11451
|
+
editor.insertText(TAB_SPACE);
|
|
11452
|
+
return true;
|
|
11453
|
+
}
|
|
11454
|
+
}
|
|
11455
|
+
if (isHotkey('shift+Tab', event)) {
|
|
11456
|
+
if (startBlock && (isExpanded || isStart)) {
|
|
11457
|
+
if (!editor.isVoid(block)) {
|
|
11458
|
+
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
11459
|
+
}
|
|
11460
|
+
}
|
|
11461
|
+
}
|
|
11462
|
+
if (selection && Range.isCollapsed(selection) && hotkeys.isDeleteBackward(event)) {
|
|
11463
|
+
if (startBlock && isStart) {
|
|
11464
|
+
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
11465
|
+
}
|
|
11466
|
+
}
|
|
11467
|
+
return false;
|
|
11468
|
+
};
|
|
11469
|
+
|
|
11470
|
+
const withIndent = (kinds) => (editor) => {
|
|
11471
|
+
const { onKeydown } = editor;
|
|
11472
|
+
editor.onKeydown = (event) => {
|
|
11473
|
+
const HOTKEYS = {
|
|
11474
|
+
'mod+]': Indents.indentRight,
|
|
11475
|
+
'mod+[': Indents.indentLeft
|
|
11476
|
+
};
|
|
11477
|
+
for (const hotkey in HOTKEYS) {
|
|
11478
|
+
if (isHotkey(hotkey, event)) {
|
|
11479
|
+
event.preventDefault();
|
|
11480
|
+
const mark = HOTKEYS[hotkey];
|
|
11481
|
+
switch (mark) {
|
|
11482
|
+
case Indents.indentRight:
|
|
11483
|
+
IndentEditor.setIndent(editor);
|
|
11484
|
+
break;
|
|
11485
|
+
case Indents.indentLeft:
|
|
11486
|
+
IndentEditor.cancelIndent(editor);
|
|
11487
|
+
break;
|
|
11488
|
+
}
|
|
11489
|
+
}
|
|
11490
|
+
}
|
|
11491
|
+
const isContinue = !onKeydownTextIndent(editor, event, kinds);
|
|
11492
|
+
if (isContinue) {
|
|
11493
|
+
onKeydown(event);
|
|
11494
|
+
}
|
|
11495
|
+
};
|
|
11496
|
+
return editor;
|
|
11497
|
+
};
|
|
11498
|
+
|
|
11340
11499
|
const internalPlugins = [
|
|
11341
11500
|
withTheHistory,
|
|
11342
11501
|
withAutoInsertData(),
|
|
@@ -11395,7 +11554,8 @@ const internalToolbarItems = [
|
|
|
11395
11554
|
...TableOptions,
|
|
11396
11555
|
...VerticalAlignOptions,
|
|
11397
11556
|
...PaintFormatOptions,
|
|
11398
|
-
...InlineCodeOptions
|
|
11557
|
+
...InlineCodeOptions,
|
|
11558
|
+
...IndentOptions
|
|
11399
11559
|
];
|
|
11400
11560
|
const toolbarCompose = (toolbarItems = []) => {
|
|
11401
11561
|
return [...internalToolbarItems, ...toolbarItems];
|
|
@@ -11972,6 +12132,45 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
11972
12132
|
args: ['mousedown', ['$event']]
|
|
11973
12133
|
}] } });
|
|
11974
12134
|
|
|
12135
|
+
class ElementStylePipe {
|
|
12136
|
+
transform(element, align) {
|
|
12137
|
+
const style = {};
|
|
12138
|
+
if (element.align || align) {
|
|
12139
|
+
style.textAlign = element.align || align || Alignment.left;
|
|
12140
|
+
}
|
|
12141
|
+
if (element.textIndent) {
|
|
12142
|
+
style.textIndent = element.textIndent + 'em';
|
|
12143
|
+
}
|
|
12144
|
+
return style;
|
|
12145
|
+
}
|
|
12146
|
+
}
|
|
12147
|
+
ElementStylePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementStylePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
12148
|
+
ElementStylePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementStylePipe, name: "elementStyle" });
|
|
12149
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementStylePipe, decorators: [{
|
|
12150
|
+
type: Pipe,
|
|
12151
|
+
args: [{
|
|
12152
|
+
name: 'elementStyle'
|
|
12153
|
+
}]
|
|
12154
|
+
}] });
|
|
12155
|
+
class ElementClassPipe {
|
|
12156
|
+
transform(element) {
|
|
12157
|
+
let classStr = '';
|
|
12158
|
+
const prefix = 'indent';
|
|
12159
|
+
if (element.textIndent) {
|
|
12160
|
+
classStr += `${prefix}-${element.textIndent}`;
|
|
12161
|
+
}
|
|
12162
|
+
return classStr;
|
|
12163
|
+
}
|
|
12164
|
+
}
|
|
12165
|
+
ElementClassPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementClassPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
12166
|
+
ElementClassPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementClassPipe, name: "elementClass" });
|
|
12167
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementClassPipe, decorators: [{
|
|
12168
|
+
type: Pipe,
|
|
12169
|
+
args: [{
|
|
12170
|
+
name: 'elementClass'
|
|
12171
|
+
}]
|
|
12172
|
+
}] });
|
|
12173
|
+
|
|
11975
12174
|
class TheTemplateComponent {
|
|
11976
12175
|
constructor() {
|
|
11977
12176
|
this.renderElement = (element) => {
|
|
@@ -12607,7 +12806,8 @@ const COMPONENTS = [
|
|
|
12607
12806
|
TheTableSelectComponent,
|
|
12608
12807
|
TheTableToolbarItemComponent,
|
|
12609
12808
|
TheConversionHintComponent,
|
|
12610
|
-
TheVerticalToolbarItemComponent
|
|
12809
|
+
TheVerticalToolbarItemComponent,
|
|
12810
|
+
TheIndentToolbarComponent
|
|
12611
12811
|
];
|
|
12612
12812
|
const PLUGIN_COMPONENTS = [
|
|
12613
12813
|
TheImageComponent,
|
|
@@ -12650,7 +12850,8 @@ TheEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
|
|
|
12650
12850
|
TheTableSelectComponent,
|
|
12651
12851
|
TheTableToolbarItemComponent,
|
|
12652
12852
|
TheConversionHintComponent,
|
|
12653
|
-
TheVerticalToolbarItemComponent,
|
|
12853
|
+
TheVerticalToolbarItemComponent,
|
|
12854
|
+
TheIndentToolbarComponent, TheImageComponent,
|
|
12654
12855
|
TheTemplateComponent,
|
|
12655
12856
|
TheHrComponent,
|
|
12656
12857
|
TheBlockquoteComponent,
|
|
@@ -12716,5 +12917,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
12716
12917
|
* Generated bundle index. Do not edit.
|
|
12717
12918
|
*/
|
|
12718
12919
|
|
|
12719
|
-
export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETEBACKWARD_TYPES, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, COMPONENTS, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, CodeMode, ColorEditor, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DefaultQuickToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, ElementKinds, ErrorCodes, FontSizeTypes, FontSizes, HEADING_TYPES, HeadingEditor, HrEditor, IS_MAC, ImageEditor, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PLUGIN_COMPONENTS, QUICK_TOOLBAR_HOTKEY, QuickInsertEditor, STANDARD_HEADING_TYPES, TAB_SPACE, THE_CODE_MODE_PROVIDER, THE_CODE_MODE_TOKEN, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_QUICK_TOOLBAR_REF, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_UPLOAD_SERVICE_TOKEN, TableEditor, TheBaseElementComponent, TheCodeConfig, TheContextService, TheDataMode, TheDefaultElementComponent, TheEditor, TheEditorComponent, TheEditorModule, TheImageComponent, TheMode, index$1 as TheQueries, TheToolbarBaseItemComponent, TheToolbarComponent, TheToolbarDropdownComponent, TheToolbarGroupComponent, TheToolbarGroupToken, TheToolbarItemComponent, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemMode, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, createEmptyParagraph, dataDeserialize, dataSerializing, getToolbarClass, htmlToTheia, inValidTypes, isCleanEmptyParagraph, plainToTheia, toolbarCompose, withTheEditor };
|
|
12920
|
+
export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETEBACKWARD_TYPES, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, COMPONENTS, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, CodeMode, ColorEditor, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DefaultQuickToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, ElementKinds, ErrorCodes, FontSizeTypes, FontSizes, HEADING_TYPES, HeadingEditor, HrEditor, IS_MAC, ImageEditor, Indents, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PLUGIN_COMPONENTS, QUICK_TOOLBAR_HOTKEY, QuickInsertEditor, STANDARD_HEADING_TYPES, TAB_SPACE, THE_CODE_MODE_PROVIDER, THE_CODE_MODE_TOKEN, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_QUICK_TOOLBAR_REF, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_UPLOAD_SERVICE_TOKEN, TableEditor, TheBaseElementComponent, TheCodeConfig, TheContextService, TheDataMode, TheDefaultElementComponent, TheEditor, TheEditorComponent, TheEditorModule, TheImageComponent, TheMode, index$1 as TheQueries, TheToolbarBaseItemComponent, TheToolbarComponent, TheToolbarDropdownComponent, TheToolbarGroupComponent, TheToolbarGroupToken, TheToolbarItemComponent, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemMode, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, createEmptyParagraph, dataDeserialize, dataSerializing, getToolbarClass, htmlToTheia, inValidTypes, isCleanEmptyParagraph, plainToTheia, toolbarCompose, withTheEditor };
|
|
12720
12921
|
//# sourceMappingURL=worktile-theia.js.map
|