@worktile/theia 2.1.14 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/worktile-theia.umd.js +433 -224
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/components/element/element.component.d.ts +1 -0
- package/constants/node-types.d.ts +6 -1
- package/custom-types.d.ts +1 -0
- package/editor.module.d.ts +44 -44
- package/esm2015/components/element/element.component.js +11 -4
- package/esm2015/constants/node-types.js +7 -1
- package/esm2015/custom-types.js +1 -1
- package/esm2015/editor.component.js +1 -1
- package/esm2015/editor.module.js +6 -3
- package/esm2015/interfaces/editor.js +1 -1
- package/esm2015/plugins/common/block-card.plugin.js +2 -2
- package/esm2015/plugins/indent/indent.editor.js +87 -0
- package/esm2015/plugins/indent/indent.plugin.js +3 -3
- package/esm2015/plugins/indent/on-keydown-indent.js +40 -54
- package/esm2015/plugins/indent/options.js +28 -0
- package/esm2015/plugins/indent/toolbar-item.component.js +115 -0
- package/esm2015/plugins/index.js +5 -3
- package/esm2015/plugins/inline-code/inline-code.component.js +2 -2
- package/esm2015/plugins/list/components/bulleted-list.component.js +11 -14
- package/esm2015/plugins/list/components/numbered-list.component.js +12 -15
- package/esm2015/plugins/todo-item/todo-item.component.js +8 -26
- package/esm2015/utils/is-clean-empty-paragraph.js +3 -1
- package/fesm2015/worktile-theia.js +412 -219
- package/fesm2015/worktile-theia.js.map +1 -1
- package/interfaces/editor.d.ts +1 -1
- package/package.json +1 -1
- package/plugins/indent/indent.editor.d.ts +10 -0
- package/plugins/indent/indent.plugin.d.ts +2 -1
- package/plugins/indent/on-keydown-indent.d.ts +1 -1
- package/plugins/indent/options.d.ts +2 -0
- package/plugins/indent/toolbar-item.component.d.ts +36 -0
- package/plugins/list/components/bulleted-list.component.d.ts +2 -4
- package/plugins/list/components/numbered-list.component.d.ts +2 -4
- package/plugins/todo-item/todo-item.component.d.ts +2 -3
- package/plugins/todo-item/todo-item.component.scss +0 -3
- package/styles/editor.scss +15 -0
- package/styles/typo.scss +0 -5
|
@@ -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;
|
|
@@ -2068,12 +2081,14 @@ const isCleanEmptyParagraph = (editor) => {
|
|
|
2068
2081
|
const align = 'align';
|
|
2069
2082
|
const hasTextIndent = block[textIndent];
|
|
2070
2083
|
const hasAlign = block[align];
|
|
2084
|
+
const hasIndent = block[ElementKinds.indent];
|
|
2071
2085
|
if (Node.string(block) === '' &&
|
|
2072
2086
|
Element$1.isElement(block) &&
|
|
2073
2087
|
block.type === ElementKinds.paragraph &&
|
|
2074
2088
|
block.children.length === 1 &&
|
|
2075
2089
|
Text.isText(block.children[0]) &&
|
|
2076
2090
|
!Editor.isVoid(editor, block) &&
|
|
2091
|
+
!hasIndent &&
|
|
2077
2092
|
!hasTextIndent &&
|
|
2078
2093
|
!hasAlign) {
|
|
2079
2094
|
return true;
|
|
@@ -2675,86 +2690,6 @@ const withImage = (editor) => {
|
|
|
2675
2690
|
return editor;
|
|
2676
2691
|
};
|
|
2677
2692
|
|
|
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
2693
|
const isList = (n) => {
|
|
2759
2694
|
return [...LIST_BLOCK_TYPES].includes(n.type);
|
|
2760
2695
|
};
|
|
@@ -3314,57 +3249,18 @@ function onKeyDownList(e, editor) {
|
|
|
3314
3249
|
}
|
|
3315
3250
|
}
|
|
3316
3251
|
|
|
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
3252
|
class TheNumberedListComponent extends TheBaseElementComponent {
|
|
3357
|
-
constructor(elementRef, cdr
|
|
3253
|
+
constructor(elementRef, cdr) {
|
|
3358
3254
|
super(elementRef, cdr);
|
|
3359
3255
|
this.elementRef = elementRef;
|
|
3360
3256
|
this.cdr = cdr;
|
|
3361
|
-
this.elementClassPipe = elementClassPipe;
|
|
3362
3257
|
}
|
|
3363
3258
|
get start() {
|
|
3364
3259
|
return this.element.start;
|
|
3365
3260
|
}
|
|
3366
|
-
get
|
|
3367
|
-
|
|
3261
|
+
get level() {
|
|
3262
|
+
var _a;
|
|
3263
|
+
return (_a = this.element) === null || _a === void 0 ? void 0 : _a.indent;
|
|
3368
3264
|
}
|
|
3369
3265
|
ngOnInit() {
|
|
3370
3266
|
super.ngOnInit();
|
|
@@ -3373,32 +3269,31 @@ class TheNumberedListComponent extends TheBaseElementComponent {
|
|
|
3373
3269
|
super.ngOnDestroy();
|
|
3374
3270
|
}
|
|
3375
3271
|
}
|
|
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", "
|
|
3272
|
+
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 });
|
|
3273
|
+
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
3274
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheNumberedListComponent, decorators: [{
|
|
3379
3275
|
type: Component,
|
|
3380
3276
|
args: [{
|
|
3381
3277
|
selector: 'ol[theOl]',
|
|
3382
|
-
template: `<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children
|
|
3383
|
-
providers: [ElementClassPipe]
|
|
3278
|
+
template: `<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>`
|
|
3384
3279
|
}]
|
|
3385
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }
|
|
3280
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { start: [{
|
|
3386
3281
|
type: HostBinding,
|
|
3387
3282
|
args: ['attr.start']
|
|
3388
|
-
}],
|
|
3283
|
+
}], level: [{
|
|
3389
3284
|
type: HostBinding,
|
|
3390
|
-
args: ['
|
|
3285
|
+
args: ['attr.the-level']
|
|
3391
3286
|
}] } });
|
|
3392
3287
|
|
|
3393
3288
|
class TheBulletedListComponent extends TheBaseElementComponent {
|
|
3394
|
-
constructor(elementRef, cdr
|
|
3289
|
+
constructor(elementRef, cdr) {
|
|
3395
3290
|
super(elementRef, cdr);
|
|
3396
3291
|
this.elementRef = elementRef;
|
|
3397
3292
|
this.cdr = cdr;
|
|
3398
|
-
this.elementClassPipe = elementClassPipe;
|
|
3399
3293
|
}
|
|
3400
|
-
get
|
|
3401
|
-
|
|
3294
|
+
get level() {
|
|
3295
|
+
var _a;
|
|
3296
|
+
return (_a = this.element) === null || _a === void 0 ? void 0 : _a.indent;
|
|
3402
3297
|
}
|
|
3403
3298
|
ngOnInit() {
|
|
3404
3299
|
super.ngOnInit();
|
|
@@ -3407,18 +3302,17 @@ class TheBulletedListComponent extends TheBaseElementComponent {
|
|
|
3407
3302
|
super.ngOnDestroy();
|
|
3408
3303
|
}
|
|
3409
3304
|
}
|
|
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: { "
|
|
3305
|
+
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 });
|
|
3306
|
+
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
3307
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheBulletedListComponent, decorators: [{
|
|
3413
3308
|
type: Component,
|
|
3414
3309
|
args: [{
|
|
3415
3310
|
selector: 'ul[theUl]',
|
|
3416
|
-
template: `<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children
|
|
3417
|
-
providers: [ElementClassPipe]
|
|
3311
|
+
template: `<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>`
|
|
3418
3312
|
}]
|
|
3419
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }
|
|
3313
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { level: [{
|
|
3420
3314
|
type: HostBinding,
|
|
3421
|
-
args: ['
|
|
3315
|
+
args: ['attr.the-level']
|
|
3422
3316
|
}] } });
|
|
3423
3317
|
|
|
3424
3318
|
class TheListItemComponent extends TheBaseElementComponent {
|
|
@@ -3734,52 +3628,6 @@ const withList = ({ validLiChildrenTypes } = {}) => (editor) => {
|
|
|
3734
3628
|
return editor;
|
|
3735
3629
|
};
|
|
3736
3630
|
|
|
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
3631
|
class TheTodoItemComponent extends TheBaseElementComponent {
|
|
3784
3632
|
constructor(elementRef, cdr) {
|
|
3785
3633
|
super(elementRef, cdr);
|
|
@@ -3787,15 +3635,12 @@ class TheTodoItemComponent extends TheBaseElementComponent {
|
|
|
3787
3635
|
this.cdr = cdr;
|
|
3788
3636
|
this.checkItemClass = true;
|
|
3789
3637
|
}
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
this.useIndentClass(this.elementRef.nativeElement, this.element);
|
|
3794
|
-
}
|
|
3638
|
+
get level() {
|
|
3639
|
+
var _a;
|
|
3640
|
+
return (_a = this.element) === null || _a === void 0 ? void 0 : _a.indent;
|
|
3795
3641
|
}
|
|
3796
3642
|
ngOnInit() {
|
|
3797
3643
|
super.ngOnInit();
|
|
3798
|
-
this.useIndentClass(this.elementRef.nativeElement, this.element);
|
|
3799
3644
|
}
|
|
3800
3645
|
onCheck(checked) {
|
|
3801
3646
|
if (this.readonly) {
|
|
@@ -3803,26 +3648,9 @@ class TheTodoItemComponent extends TheBaseElementComponent {
|
|
|
3803
3648
|
}
|
|
3804
3649
|
setNode(this.editor, { checked }, this.element);
|
|
3805
3650
|
}
|
|
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
3651
|
}
|
|
3824
3652
|
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: `
|
|
3653
|
+
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
3654
|
<span contenteditable="false" class="todo-item-status">
|
|
3827
3655
|
<input #checkbox type="checkbox" [checked]="element.checked" (click)="onCheck(checkbox.checked)" />
|
|
3828
3656
|
</span>
|
|
@@ -3842,6 +3670,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
3842
3670
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { checkItemClass: [{
|
|
3843
3671
|
type: HostBinding,
|
|
3844
3672
|
args: ['class.the-check-item']
|
|
3673
|
+
}], level: [{
|
|
3674
|
+
type: HostBinding,
|
|
3675
|
+
args: ['attr.the-level']
|
|
3845
3676
|
}] } });
|
|
3846
3677
|
|
|
3847
3678
|
const withTodoItem = (editor) => {
|
|
@@ -4454,7 +4285,7 @@ const withBlockCard = (editor) => {
|
|
|
4454
4285
|
return;
|
|
4455
4286
|
}
|
|
4456
4287
|
// → + right-block-card
|
|
4457
|
-
if (
|
|
4288
|
+
if (isMoveForward && !isCardLeftCursor) {
|
|
4458
4289
|
nativeEvent.preventDefault();
|
|
4459
4290
|
const [, path] = AngularEditor.toSlateCardEntry(editor, anchorNode);
|
|
4460
4291
|
const nextPath = Path.next(path);
|
|
@@ -8020,6 +7851,52 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
8020
7851
|
type: Injectable
|
|
8021
7852
|
}], ctorParameters: function () { return []; } });
|
|
8022
7853
|
|
|
7854
|
+
/** Converts CSS pixel values to numbers, eg "123px" to 123. Returns NaN for non pixel values. */
|
|
7855
|
+
function coercePixelsFromCssValue(cssValue) {
|
|
7856
|
+
const match = cssValue.match(/(\d+)px/);
|
|
7857
|
+
if (match) {
|
|
7858
|
+
return Number(match[1]);
|
|
7859
|
+
}
|
|
7860
|
+
}
|
|
7861
|
+
function getElementWidth(element) {
|
|
7862
|
+
// Optimization: Check style.width first as we probably set it already before reading
|
|
7863
|
+
// offsetWidth which triggers layout.
|
|
7864
|
+
return coercePixelsFromCssValue(element.style.width) || element.offsetWidth;
|
|
7865
|
+
}
|
|
7866
|
+
function getElementHeight(element) {
|
|
7867
|
+
return Math.round(element.getBoundingClientRect().height);
|
|
7868
|
+
}
|
|
7869
|
+
function getColsTotalWidth(cols) {
|
|
7870
|
+
return cols.reduce((total, col) => {
|
|
7871
|
+
return total + getElementWidth(col);
|
|
7872
|
+
}, 0);
|
|
7873
|
+
}
|
|
7874
|
+
function getRowsTotalHeight(rows) {
|
|
7875
|
+
return rows.reduce((total, row) => {
|
|
7876
|
+
return total + getElementHeight(row);
|
|
7877
|
+
}, 0);
|
|
7878
|
+
}
|
|
7879
|
+
function useElementStyle(el, element) {
|
|
7880
|
+
if (element.align) {
|
|
7881
|
+
el.style.textAlign = element.align || Alignment.left;
|
|
7882
|
+
}
|
|
7883
|
+
if (element.textIndent) {
|
|
7884
|
+
el.style.textIndent = element.textIndent + 'em';
|
|
7885
|
+
}
|
|
7886
|
+
if (element.verticalAlign) {
|
|
7887
|
+
el.style.verticalAlign = element.verticalAlign;
|
|
7888
|
+
}
|
|
7889
|
+
}
|
|
7890
|
+
function getElementClassByPrefix(el, prefix) {
|
|
7891
|
+
let matchClass = null;
|
|
7892
|
+
el.classList.forEach((value, key) => {
|
|
7893
|
+
if (value.includes(prefix)) {
|
|
7894
|
+
matchClass = value;
|
|
7895
|
+
}
|
|
7896
|
+
});
|
|
7897
|
+
return matchClass;
|
|
7898
|
+
}
|
|
7899
|
+
|
|
8023
7900
|
function splitCell(editor) {
|
|
8024
7901
|
const opts = new TableOptions$1();
|
|
8025
7902
|
const { anchor } = editor.selection;
|
|
@@ -11279,7 +11156,7 @@ class TheInlineCodeComponent extends TheBaseElementComponent {
|
|
|
11279
11156
|
super(...arguments);
|
|
11280
11157
|
// Put this at the start and end of an inline component to work around this Chromium bug:
|
|
11281
11158
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=1249405
|
|
11282
|
-
this.inlineChromiumBugfix =
|
|
11159
|
+
this.inlineChromiumBugfix = String.fromCodePoint(160);
|
|
11283
11160
|
}
|
|
11284
11161
|
}
|
|
11285
11162
|
TheInlineCodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheInlineCodeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -11337,6 +11214,280 @@ const withInlineCode = (editor) => {
|
|
|
11337
11214
|
return editor;
|
|
11338
11215
|
};
|
|
11339
11216
|
|
|
11217
|
+
class TheIndentToolbarComponent extends TheToolbarBaseItemComponent {
|
|
11218
|
+
constructor(elementRef, thyPopover, viewContainerRef, overlay) {
|
|
11219
|
+
super();
|
|
11220
|
+
this.elementRef = elementRef;
|
|
11221
|
+
this.thyPopover = thyPopover;
|
|
11222
|
+
this.viewContainerRef = viewContainerRef;
|
|
11223
|
+
this.overlay = overlay;
|
|
11224
|
+
this.mode = DropdownMode.text;
|
|
11225
|
+
this.dropdownMode = DropdownMode;
|
|
11226
|
+
this.disabled = false;
|
|
11227
|
+
}
|
|
11228
|
+
get isOpen() {
|
|
11229
|
+
return this.dropdownPopoverRef && this.dropdownPopoverRef.getOverlayRef() && this.dropdownPopoverRef.getOverlayRef().hasAttached();
|
|
11230
|
+
}
|
|
11231
|
+
toggleDropdown(event) {
|
|
11232
|
+
var _a;
|
|
11233
|
+
super.execute(event);
|
|
11234
|
+
if (((_a = this.editor) === null || _a === void 0 ? void 0 : _a.disabled) || this.disabled) {
|
|
11235
|
+
return;
|
|
11236
|
+
}
|
|
11237
|
+
this.openDropdownPopover();
|
|
11238
|
+
}
|
|
11239
|
+
handleDocumentMouseDown(event) {
|
|
11240
|
+
if (!this.elementRef.nativeElement.contains(event.target)) {
|
|
11241
|
+
this.closeDropdownPopover();
|
|
11242
|
+
}
|
|
11243
|
+
}
|
|
11244
|
+
get disabledState() {
|
|
11245
|
+
return this.disabled;
|
|
11246
|
+
}
|
|
11247
|
+
ngOnInit() {
|
|
11248
|
+
var _a;
|
|
11249
|
+
if (!this.activeMenu) {
|
|
11250
|
+
this.activeMenu = this.menus[0];
|
|
11251
|
+
}
|
|
11252
|
+
if (this.toolbarItem) {
|
|
11253
|
+
this.elementRef.nativeElement.classList.add(`${(_a = this.toolbarItem) === null || _a === void 0 ? void 0 : _a.key}`);
|
|
11254
|
+
}
|
|
11255
|
+
}
|
|
11256
|
+
statusChange(editor) {
|
|
11257
|
+
var _a, _b;
|
|
11258
|
+
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;
|
|
11259
|
+
}
|
|
11260
|
+
itemMousedown(event, item) {
|
|
11261
|
+
super.execute(event);
|
|
11262
|
+
this.closeDropdownPopover();
|
|
11263
|
+
if (item === null || item === void 0 ? void 0 : item.execute) {
|
|
11264
|
+
item === null || item === void 0 ? void 0 : item.execute(this.editor);
|
|
11265
|
+
}
|
|
11266
|
+
}
|
|
11267
|
+
openDropdownPopover() {
|
|
11268
|
+
var _a;
|
|
11269
|
+
this.dropdownPopoverRef = this.thyPopover.open(this.dropdownTemplate, {
|
|
11270
|
+
origin: this.elementRef,
|
|
11271
|
+
panelClass: ['the-toolbar-dropdown-popover', (_a = this.toolbarItem) === null || _a === void 0 ? void 0 : _a.key],
|
|
11272
|
+
placement: 'bottomLeft',
|
|
11273
|
+
insideClosable: false,
|
|
11274
|
+
backdropClosable: true,
|
|
11275
|
+
hasBackdrop: false,
|
|
11276
|
+
offset: 10,
|
|
11277
|
+
viewContainerRef: this.viewContainerRef,
|
|
11278
|
+
scrollStrategy: this.overlay.scrollStrategies.reposition()
|
|
11279
|
+
});
|
|
11280
|
+
}
|
|
11281
|
+
closeDropdownPopover() {
|
|
11282
|
+
var _a;
|
|
11283
|
+
if (this.dropdownPopoverRef) {
|
|
11284
|
+
(_a = this.dropdownPopoverRef) === null || _a === void 0 ? void 0 : _a.close();
|
|
11285
|
+
}
|
|
11286
|
+
}
|
|
11287
|
+
}
|
|
11288
|
+
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 });
|
|
11289
|
+
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\n thyActionMenuItem\n href=\"javascript:;\"\n [thyTooltip]=\"tooltip\"\n [thyTooltipTemplateContext]=\"{ name: menu.name, shortcutKey: menu.shortcutKey }\"\n thyTooltipPlacement=\"right\"\n (mousedown)=\"itemMousedown($event, menu)\"\n >\n <span thyActionMenuItemIcon>\n <thy-icon [thyIconName]=\"menu.icon\"></thy-icon>\n </span>\n <span thyActionMenuItemName>{{ menu.name }}</span>\n </a>\n </ng-container>\n </thy-action-menu>\n</ng-template>\n\n<ng-template #tooltip let-data>{{ data?.shortcutKey }}</ng-template>\n", components: [{ type: i3.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]" }] });
|
|
11290
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheIndentToolbarComponent, decorators: [{
|
|
11291
|
+
type: Component,
|
|
11292
|
+
args: [{
|
|
11293
|
+
selector: 'the-indent-toolbar-item',
|
|
11294
|
+
templateUrl: './toolbar-item.component.html',
|
|
11295
|
+
host: {
|
|
11296
|
+
class: 'the-toolbar-dropdown-container'
|
|
11297
|
+
}
|
|
11298
|
+
}]
|
|
11299
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$3.ThyPopover }, { type: i0.ViewContainerRef }, { type: i2.Overlay }]; }, propDecorators: { toolbarItem: [{
|
|
11300
|
+
type: Input
|
|
11301
|
+
}], menus: [{
|
|
11302
|
+
type: Input
|
|
11303
|
+
}], mode: [{
|
|
11304
|
+
type: Input
|
|
11305
|
+
}], item: [{
|
|
11306
|
+
type: Input
|
|
11307
|
+
}], dropdownTemplate: [{
|
|
11308
|
+
type: ViewChild,
|
|
11309
|
+
args: ['dropdownTemplate', { static: true }]
|
|
11310
|
+
}], toggleDropdown: [{
|
|
11311
|
+
type: HostListener,
|
|
11312
|
+
args: ['mousedown', ['$event']]
|
|
11313
|
+
}], handleDocumentMouseDown: [{
|
|
11314
|
+
type: HostListener,
|
|
11315
|
+
args: ['document: mousedown', ['$event']]
|
|
11316
|
+
}], disabledState: [{
|
|
11317
|
+
type: HostBinding,
|
|
11318
|
+
args: ['class.disabled']
|
|
11319
|
+
}] } });
|
|
11320
|
+
|
|
11321
|
+
const MaxIndent = 13;
|
|
11322
|
+
const includesIndentTypes = [
|
|
11323
|
+
ElementKinds.checkItem,
|
|
11324
|
+
ElementKinds.numberedList,
|
|
11325
|
+
ElementKinds.bulletedList,
|
|
11326
|
+
ElementKinds.paragraph,
|
|
11327
|
+
...HEADING_TYPES
|
|
11328
|
+
];
|
|
11329
|
+
const IndentEditor = {
|
|
11330
|
+
setIndent(editor) {
|
|
11331
|
+
const nodes = Array.from(Editor.nodes(editor, {
|
|
11332
|
+
mode: 'highest',
|
|
11333
|
+
match: n => Element$1.isElement(n) && includesIndentTypes.includes(n.type)
|
|
11334
|
+
}));
|
|
11335
|
+
const [startBlock] = nodes;
|
|
11336
|
+
if (startBlock) {
|
|
11337
|
+
let [{ indent }] = startBlock;
|
|
11338
|
+
indent = indent ? indent : 0;
|
|
11339
|
+
indent += 1;
|
|
11340
|
+
if (indent <= MaxIndent) {
|
|
11341
|
+
Transforms.setNodes(editor, { indent }, {
|
|
11342
|
+
mode: 'highest',
|
|
11343
|
+
match: n => Element$1.isElement(n) && includesIndentTypes.includes(n.type)
|
|
11344
|
+
});
|
|
11345
|
+
}
|
|
11346
|
+
}
|
|
11347
|
+
},
|
|
11348
|
+
cancelIndent(editor) {
|
|
11349
|
+
const nodes = Array.from(Editor.nodes(editor, {
|
|
11350
|
+
mode: 'highest',
|
|
11351
|
+
match: n => Element$1.isElement(n) && includesIndentTypes.includes(n.type)
|
|
11352
|
+
}));
|
|
11353
|
+
const [startBlock] = nodes;
|
|
11354
|
+
if (startBlock) {
|
|
11355
|
+
let [{ indent }] = startBlock;
|
|
11356
|
+
indent = indent === 1 ? null : (indent -= 1);
|
|
11357
|
+
Transforms.setNodes(editor, { indent }, {
|
|
11358
|
+
mode: 'highest',
|
|
11359
|
+
match: n => Element$1.isElement(n) && includesIndentTypes.includes(n.type)
|
|
11360
|
+
});
|
|
11361
|
+
}
|
|
11362
|
+
},
|
|
11363
|
+
setTextIndent(editor, kinds, textIndent) {
|
|
11364
|
+
Transforms.setNodes(editor, { textIndent }, {
|
|
11365
|
+
mode: 'highest',
|
|
11366
|
+
match: node => Element$1.isElement(node) && kinds.includes(node.type)
|
|
11367
|
+
});
|
|
11368
|
+
},
|
|
11369
|
+
cancelTextIntent(editor, event, anchorBlock, kinds) {
|
|
11370
|
+
let { textIndent, indent } = anchorBlock;
|
|
11371
|
+
if (textIndent > 2) {
|
|
11372
|
+
event.preventDefault();
|
|
11373
|
+
textIndent -= 2;
|
|
11374
|
+
IndentEditor.setTextIndent(editor, kinds, textIndent);
|
|
11375
|
+
return true;
|
|
11376
|
+
}
|
|
11377
|
+
if (textIndent === 2) {
|
|
11378
|
+
event.preventDefault();
|
|
11379
|
+
IndentEditor.setTextIndent(editor, kinds, null);
|
|
11380
|
+
return true;
|
|
11381
|
+
}
|
|
11382
|
+
if (indent) {
|
|
11383
|
+
event.preventDefault();
|
|
11384
|
+
IndentEditor.cancelIndent(editor);
|
|
11385
|
+
return true;
|
|
11386
|
+
}
|
|
11387
|
+
return false;
|
|
11388
|
+
},
|
|
11389
|
+
isDisabled(editor) {
|
|
11390
|
+
if (editor.selection) {
|
|
11391
|
+
const allowGroup = [
|
|
11392
|
+
ElementKinds.paragraph,
|
|
11393
|
+
ElementKinds.numberedList,
|
|
11394
|
+
ElementKinds.bulletedList,
|
|
11395
|
+
ElementKinds.checkItem,
|
|
11396
|
+
...HEADING_TYPES
|
|
11397
|
+
];
|
|
11398
|
+
const anchorBlock$1 = anchorBlock(editor);
|
|
11399
|
+
return anchorBlock$1 && !allowGroup.includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
|
|
11400
|
+
}
|
|
11401
|
+
return false;
|
|
11402
|
+
}
|
|
11403
|
+
};
|
|
11404
|
+
|
|
11405
|
+
const IndentOptions = [
|
|
11406
|
+
{
|
|
11407
|
+
key: ElementKinds.indent,
|
|
11408
|
+
includes: [Indents.indentRight, Indents.indentLeft],
|
|
11409
|
+
iconComponent: TheIndentToolbarComponent,
|
|
11410
|
+
disable: editor => IndentEditor.isDisabled(editor)
|
|
11411
|
+
},
|
|
11412
|
+
{
|
|
11413
|
+
key: Indents.indentRight,
|
|
11414
|
+
name: '增加缩进',
|
|
11415
|
+
icon: 'float-left',
|
|
11416
|
+
shortcutKey: 'Tab',
|
|
11417
|
+
execute: editor => IndentEditor.setIndent(editor)
|
|
11418
|
+
},
|
|
11419
|
+
{
|
|
11420
|
+
key: Indents.indentLeft,
|
|
11421
|
+
name: '减少缩进',
|
|
11422
|
+
icon: 'float-right',
|
|
11423
|
+
shortcutKey: 'Shift+Tab/BackSpace',
|
|
11424
|
+
type: ToolbarItemType.toolDropdown,
|
|
11425
|
+
execute: editor => IndentEditor.cancelIndent(editor)
|
|
11426
|
+
}
|
|
11427
|
+
];
|
|
11428
|
+
|
|
11429
|
+
const onKeydownTextIndent = (editor, event, kinds) => {
|
|
11430
|
+
const { selection } = editor;
|
|
11431
|
+
const isExpanded = Range.isExpanded(selection);
|
|
11432
|
+
const nodes = Array.from(Editor.nodes(editor, {
|
|
11433
|
+
mode: 'highest',
|
|
11434
|
+
match: node => Element$1.isElement(node) && kinds.includes(node.type)
|
|
11435
|
+
}));
|
|
11436
|
+
const [startBlock] = nodes;
|
|
11437
|
+
if (!startBlock) {
|
|
11438
|
+
return false;
|
|
11439
|
+
}
|
|
11440
|
+
const [block, path] = startBlock;
|
|
11441
|
+
const currentPath = [path[0]];
|
|
11442
|
+
const isStart = Editor.isStart(editor, selection.anchor, currentPath);
|
|
11443
|
+
const textIndentDisable = [ElementKinds.bulletedList, ElementKinds.numberedList, ElementKinds.checkItem];
|
|
11444
|
+
if (isHotkey('Tab', event)) {
|
|
11445
|
+
event.preventDefault();
|
|
11446
|
+
if (startBlock && (isExpanded || isStart)) {
|
|
11447
|
+
if (!editor.isVoid(block)) {
|
|
11448
|
+
let { textIndent, type } = block;
|
|
11449
|
+
// do not apply first-line indentation for lists
|
|
11450
|
+
if (!textIndent && !textIndentDisable.includes(type)) {
|
|
11451
|
+
IndentEditor.setTextIndent(editor, kinds, 2);
|
|
11452
|
+
return true;
|
|
11453
|
+
}
|
|
11454
|
+
else {
|
|
11455
|
+
IndentEditor.setIndent(editor);
|
|
11456
|
+
return true;
|
|
11457
|
+
}
|
|
11458
|
+
}
|
|
11459
|
+
}
|
|
11460
|
+
else {
|
|
11461
|
+
editor.insertText(TAB_SPACE);
|
|
11462
|
+
return true;
|
|
11463
|
+
}
|
|
11464
|
+
}
|
|
11465
|
+
if (isHotkey('shift+Tab', event)) {
|
|
11466
|
+
if (startBlock && (isExpanded || isStart)) {
|
|
11467
|
+
if (!editor.isVoid(block)) {
|
|
11468
|
+
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
11469
|
+
}
|
|
11470
|
+
}
|
|
11471
|
+
}
|
|
11472
|
+
if (selection && Range.isCollapsed(selection) && hotkeys.isDeleteBackward(event)) {
|
|
11473
|
+
if (startBlock && isStart) {
|
|
11474
|
+
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
11475
|
+
}
|
|
11476
|
+
}
|
|
11477
|
+
return false;
|
|
11478
|
+
};
|
|
11479
|
+
|
|
11480
|
+
const withIndent = (kinds) => (editor) => {
|
|
11481
|
+
const { onKeydown } = editor;
|
|
11482
|
+
editor.onKeydown = (event) => {
|
|
11483
|
+
const isContinue = !onKeydownTextIndent(editor, event, kinds);
|
|
11484
|
+
if (isContinue) {
|
|
11485
|
+
onKeydown(event);
|
|
11486
|
+
}
|
|
11487
|
+
};
|
|
11488
|
+
return editor;
|
|
11489
|
+
};
|
|
11490
|
+
|
|
11340
11491
|
const internalPlugins = [
|
|
11341
11492
|
withTheHistory,
|
|
11342
11493
|
withAutoInsertData(),
|
|
@@ -11395,7 +11546,8 @@ const internalToolbarItems = [
|
|
|
11395
11546
|
...TableOptions,
|
|
11396
11547
|
...VerticalAlignOptions,
|
|
11397
11548
|
...PaintFormatOptions,
|
|
11398
|
-
...InlineCodeOptions
|
|
11549
|
+
...InlineCodeOptions,
|
|
11550
|
+
...IndentOptions
|
|
11399
11551
|
];
|
|
11400
11552
|
const toolbarCompose = (toolbarItems = []) => {
|
|
11401
11553
|
return [...internalToolbarItems, ...toolbarItems];
|
|
@@ -11972,6 +12124,45 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
11972
12124
|
args: ['mousedown', ['$event']]
|
|
11973
12125
|
}] } });
|
|
11974
12126
|
|
|
12127
|
+
class ElementStylePipe {
|
|
12128
|
+
transform(element, align) {
|
|
12129
|
+
const style = {};
|
|
12130
|
+
if (element.align || align) {
|
|
12131
|
+
style.textAlign = element.align || align || Alignment.left;
|
|
12132
|
+
}
|
|
12133
|
+
if (element.textIndent) {
|
|
12134
|
+
style.textIndent = element.textIndent + 'em';
|
|
12135
|
+
}
|
|
12136
|
+
return style;
|
|
12137
|
+
}
|
|
12138
|
+
}
|
|
12139
|
+
ElementStylePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementStylePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
12140
|
+
ElementStylePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementStylePipe, name: "elementStyle" });
|
|
12141
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementStylePipe, decorators: [{
|
|
12142
|
+
type: Pipe,
|
|
12143
|
+
args: [{
|
|
12144
|
+
name: 'elementStyle'
|
|
12145
|
+
}]
|
|
12146
|
+
}] });
|
|
12147
|
+
class ElementClassPipe {
|
|
12148
|
+
transform(element) {
|
|
12149
|
+
let classStr = '';
|
|
12150
|
+
const prefix = 'indent';
|
|
12151
|
+
if (element.textIndent) {
|
|
12152
|
+
classStr += `${prefix}-${element.textIndent}`;
|
|
12153
|
+
}
|
|
12154
|
+
return classStr;
|
|
12155
|
+
}
|
|
12156
|
+
}
|
|
12157
|
+
ElementClassPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementClassPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
12158
|
+
ElementClassPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementClassPipe, name: "elementClass" });
|
|
12159
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementClassPipe, decorators: [{
|
|
12160
|
+
type: Pipe,
|
|
12161
|
+
args: [{
|
|
12162
|
+
name: 'elementClass'
|
|
12163
|
+
}]
|
|
12164
|
+
}] });
|
|
12165
|
+
|
|
11975
12166
|
class TheTemplateComponent {
|
|
11976
12167
|
constructor() {
|
|
11977
12168
|
this.renderElement = (element) => {
|
|
@@ -12607,7 +12798,8 @@ const COMPONENTS = [
|
|
|
12607
12798
|
TheTableSelectComponent,
|
|
12608
12799
|
TheTableToolbarItemComponent,
|
|
12609
12800
|
TheConversionHintComponent,
|
|
12610
|
-
TheVerticalToolbarItemComponent
|
|
12801
|
+
TheVerticalToolbarItemComponent,
|
|
12802
|
+
TheIndentToolbarComponent
|
|
12611
12803
|
];
|
|
12612
12804
|
const PLUGIN_COMPONENTS = [
|
|
12613
12805
|
TheImageComponent,
|
|
@@ -12650,7 +12842,8 @@ TheEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
|
|
|
12650
12842
|
TheTableSelectComponent,
|
|
12651
12843
|
TheTableToolbarItemComponent,
|
|
12652
12844
|
TheConversionHintComponent,
|
|
12653
|
-
TheVerticalToolbarItemComponent,
|
|
12845
|
+
TheVerticalToolbarItemComponent,
|
|
12846
|
+
TheIndentToolbarComponent, TheImageComponent,
|
|
12654
12847
|
TheTemplateComponent,
|
|
12655
12848
|
TheHrComponent,
|
|
12656
12849
|
TheBlockquoteComponent,
|
|
@@ -12716,5 +12909,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
12716
12909
|
* Generated bundle index. Do not edit.
|
|
12717
12910
|
*/
|
|
12718
12911
|
|
|
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 };
|
|
12912
|
+
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
12913
|
//# sourceMappingURL=worktile-theia.js.map
|