@worktile/theia 2.1.13 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/worktile-theia.umd.js +451 -224
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/components/element/element.component.d.ts +1 -0
- package/constants/node-types.d.ts +6 -1
- package/custom-types.d.ts +1 -0
- package/editor.module.d.ts +44 -44
- package/esm2015/components/element/element.component.js +11 -4
- package/esm2015/constants/node-types.js +7 -1
- package/esm2015/custom-types.js +1 -1
- package/esm2015/editor.component.js +1 -1
- package/esm2015/editor.module.js +6 -3
- package/esm2015/interfaces/editor.js +1 -1
- package/esm2015/plugins/common/block-card.plugin.js +2 -2
- package/esm2015/plugins/indent/indent.editor.js +81 -0
- package/esm2015/plugins/indent/indent.plugin.js +24 -3
- package/esm2015/plugins/indent/on-keydown-indent.js +40 -54
- package/esm2015/plugins/indent/options.js +26 -0
- package/esm2015/plugins/indent/toolbar-item.component.js +115 -0
- package/esm2015/plugins/index.js +5 -3
- package/esm2015/plugins/inline-code/inline-code.component.js +2 -2
- package/esm2015/plugins/list/components/bulleted-list.component.js +11 -14
- package/esm2015/plugins/list/components/numbered-list.component.js +12 -15
- package/esm2015/plugins/list/list.editor.js +8 -1
- package/esm2015/plugins/todo-item/todo-item.component.js +8 -26
- package/esm2015/utils/is-clean-empty-paragraph.js +3 -1
- package/fesm2015/worktile-theia.js +429 -219
- package/fesm2015/worktile-theia.js.map +1 -1
- package/interfaces/editor.d.ts +1 -1
- package/package.json +1 -1
- package/plugins/indent/indent.editor.d.ts +10 -0
- package/plugins/indent/indent.plugin.d.ts +2 -1
- package/plugins/indent/on-keydown-indent.d.ts +1 -1
- package/plugins/indent/options.d.ts +2 -0
- package/plugins/indent/toolbar-item.component.d.ts +36 -0
- package/plugins/list/components/bulleted-list.component.d.ts +2 -4
- package/plugins/list/components/numbered-list.component.d.ts +2 -4
- package/plugins/todo-item/todo-item.component.d.ts +2 -3
- package/plugins/todo-item/todo-item.component.scss +0 -3
- package/styles/editor.scss +15 -0
- package/styles/typo.scss +0 -5
|
@@ -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;
|
|
@@ -1668,6 +1681,13 @@ const ListEditor = {
|
|
|
1668
1681
|
Transforms.setNodes(editor, { type: ElementKinds.paragraph, checked: undefined }, // todo remove checked
|
|
1669
1682
|
{ at: path });
|
|
1670
1683
|
}
|
|
1684
|
+
else if (Element$1.isElement(node) && node.type === ElementKinds.paragraph) {
|
|
1685
|
+
let { textIndent } = node;
|
|
1686
|
+
if (textIndent) {
|
|
1687
|
+
Transforms.setNodes(editor, { textIndent: undefined }, // remove textIndent
|
|
1688
|
+
{ at: path });
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1671
1691
|
if (Node.parent(editor, path).type !== ElementKinds.listItem) {
|
|
1672
1692
|
Transforms.wrapNodes(editor, { type: ElementKinds.listItem, children: [] }, {
|
|
1673
1693
|
at: path,
|
|
@@ -2061,12 +2081,14 @@ const isCleanEmptyParagraph = (editor) => {
|
|
|
2061
2081
|
const align = 'align';
|
|
2062
2082
|
const hasTextIndent = block[textIndent];
|
|
2063
2083
|
const hasAlign = block[align];
|
|
2084
|
+
const hasIndent = block[ElementKinds.indent];
|
|
2064
2085
|
if (Node.string(block) === '' &&
|
|
2065
2086
|
Element$1.isElement(block) &&
|
|
2066
2087
|
block.type === ElementKinds.paragraph &&
|
|
2067
2088
|
block.children.length === 1 &&
|
|
2068
2089
|
Text.isText(block.children[0]) &&
|
|
2069
2090
|
!Editor.isVoid(editor, block) &&
|
|
2091
|
+
!hasIndent &&
|
|
2070
2092
|
!hasTextIndent &&
|
|
2071
2093
|
!hasAlign) {
|
|
2072
2094
|
return true;
|
|
@@ -2668,86 +2690,6 @@ const withImage = (editor) => {
|
|
|
2668
2690
|
return editor;
|
|
2669
2691
|
};
|
|
2670
2692
|
|
|
2671
|
-
const onKeydownIndent = (editor, event, kinds) => {
|
|
2672
|
-
const { selection } = editor;
|
|
2673
|
-
if (event.key === 'Tab') {
|
|
2674
|
-
event.preventDefault();
|
|
2675
|
-
const isExpanded = Range.isExpanded(selection);
|
|
2676
|
-
const nodes = Array.from(Editor.nodes(editor, {
|
|
2677
|
-
mode: 'highest',
|
|
2678
|
-
match: indentNodeMatch(kinds)
|
|
2679
|
-
}));
|
|
2680
|
-
const startBlock = nodes[0];
|
|
2681
|
-
if (startBlock && (isExpanded || Editor.isStart(editor, selection.anchor, [startBlock[1][0]]))) {
|
|
2682
|
-
if (!editor.isVoid(startBlock[0])) {
|
|
2683
|
-
if (event.shiftKey) {
|
|
2684
|
-
return cancelTextIntent(editor, startBlock[0], kinds);
|
|
2685
|
-
}
|
|
2686
|
-
let { textIndent } = startBlock[0];
|
|
2687
|
-
textIndent = textIndent ? textIndent : 0;
|
|
2688
|
-
textIndent += 2;
|
|
2689
|
-
if (textIndent < 50) {
|
|
2690
|
-
Transforms.setNodes(editor, { textIndent }, {
|
|
2691
|
-
mode: 'highest',
|
|
2692
|
-
match: indentNodeMatch(kinds)
|
|
2693
|
-
});
|
|
2694
|
-
return true;
|
|
2695
|
-
}
|
|
2696
|
-
}
|
|
2697
|
-
}
|
|
2698
|
-
else {
|
|
2699
|
-
editor.insertText(TAB_SPACE);
|
|
2700
|
-
return true;
|
|
2701
|
-
}
|
|
2702
|
-
}
|
|
2703
|
-
if (selection && Range.isCollapsed(selection) && event.key === 'Backspace') {
|
|
2704
|
-
const nodes = Array.from(Editor.nodes(editor, {
|
|
2705
|
-
mode: 'highest',
|
|
2706
|
-
match: indentNodeMatch(kinds)
|
|
2707
|
-
}));
|
|
2708
|
-
const startBlock = nodes[0];
|
|
2709
|
-
if (startBlock && Editor.isStart(editor, selection.anchor, [startBlock[1][0]])) {
|
|
2710
|
-
return cancelTextIntent(editor, startBlock[0], kinds);
|
|
2711
|
-
}
|
|
2712
|
-
}
|
|
2713
|
-
return false;
|
|
2714
|
-
};
|
|
2715
|
-
const indentNodeMatch = (kinds) => node => Element$1.isElement(node) && kinds.includes(node.type);
|
|
2716
|
-
function cancelTextIntent(editor, anchorBlock, kinds) {
|
|
2717
|
-
let { textIndent } = anchorBlock;
|
|
2718
|
-
if (textIndent > 2) {
|
|
2719
|
-
// prevent deleteBackward function
|
|
2720
|
-
event.preventDefault();
|
|
2721
|
-
textIndent -= 2;
|
|
2722
|
-
Transforms.setNodes(editor, { textIndent }, {
|
|
2723
|
-
mode: 'highest',
|
|
2724
|
-
match: indentNodeMatch(kinds)
|
|
2725
|
-
});
|
|
2726
|
-
return true;
|
|
2727
|
-
}
|
|
2728
|
-
if (textIndent === 2) {
|
|
2729
|
-
// prevent deleteBackward function
|
|
2730
|
-
event.preventDefault();
|
|
2731
|
-
Transforms.setNodes(editor, { textIndent: null }, {
|
|
2732
|
-
mode: 'highest',
|
|
2733
|
-
match: node => Element$1.isElement(node) && kinds.includes(node.type)
|
|
2734
|
-
});
|
|
2735
|
-
return true;
|
|
2736
|
-
}
|
|
2737
|
-
return false;
|
|
2738
|
-
}
|
|
2739
|
-
|
|
2740
|
-
const withIndent = (kinds) => (editor) => {
|
|
2741
|
-
const { onKeydown } = editor;
|
|
2742
|
-
editor.onKeydown = (event) => {
|
|
2743
|
-
const isContinue = !onKeydownIndent(editor, event, kinds);
|
|
2744
|
-
if (isContinue) {
|
|
2745
|
-
onKeydown(event);
|
|
2746
|
-
}
|
|
2747
|
-
};
|
|
2748
|
-
return editor;
|
|
2749
|
-
};
|
|
2750
|
-
|
|
2751
2693
|
const isList = (n) => {
|
|
2752
2694
|
return [...LIST_BLOCK_TYPES].includes(n.type);
|
|
2753
2695
|
};
|
|
@@ -3307,57 +3249,18 @@ function onKeyDownList(e, editor) {
|
|
|
3307
3249
|
}
|
|
3308
3250
|
}
|
|
3309
3251
|
|
|
3310
|
-
class ElementStylePipe {
|
|
3311
|
-
transform(element, align) {
|
|
3312
|
-
const style = {};
|
|
3313
|
-
if (element.align || align) {
|
|
3314
|
-
style.textAlign = element.align || align || Alignment.left;
|
|
3315
|
-
}
|
|
3316
|
-
if (element.textIndent) {
|
|
3317
|
-
style.textIndent = element.textIndent + 'em';
|
|
3318
|
-
}
|
|
3319
|
-
return style;
|
|
3320
|
-
}
|
|
3321
|
-
}
|
|
3322
|
-
ElementStylePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementStylePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
3323
|
-
ElementStylePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementStylePipe, name: "elementStyle" });
|
|
3324
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementStylePipe, decorators: [{
|
|
3325
|
-
type: Pipe,
|
|
3326
|
-
args: [{
|
|
3327
|
-
name: 'elementStyle'
|
|
3328
|
-
}]
|
|
3329
|
-
}] });
|
|
3330
|
-
class ElementClassPipe {
|
|
3331
|
-
transform(element) {
|
|
3332
|
-
let classStr = '';
|
|
3333
|
-
const prefix = 'indent';
|
|
3334
|
-
if (element.textIndent) {
|
|
3335
|
-
classStr += `${prefix}-${element.textIndent}`;
|
|
3336
|
-
}
|
|
3337
|
-
return classStr;
|
|
3338
|
-
}
|
|
3339
|
-
}
|
|
3340
|
-
ElementClassPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementClassPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
3341
|
-
ElementClassPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementClassPipe, name: "elementClass" });
|
|
3342
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementClassPipe, decorators: [{
|
|
3343
|
-
type: Pipe,
|
|
3344
|
-
args: [{
|
|
3345
|
-
name: 'elementClass'
|
|
3346
|
-
}]
|
|
3347
|
-
}] });
|
|
3348
|
-
|
|
3349
3252
|
class TheNumberedListComponent extends TheBaseElementComponent {
|
|
3350
|
-
constructor(elementRef, cdr
|
|
3253
|
+
constructor(elementRef, cdr) {
|
|
3351
3254
|
super(elementRef, cdr);
|
|
3352
3255
|
this.elementRef = elementRef;
|
|
3353
3256
|
this.cdr = cdr;
|
|
3354
|
-
this.elementClassPipe = elementClassPipe;
|
|
3355
3257
|
}
|
|
3356
3258
|
get start() {
|
|
3357
3259
|
return this.element.start;
|
|
3358
3260
|
}
|
|
3359
|
-
get
|
|
3360
|
-
|
|
3261
|
+
get level() {
|
|
3262
|
+
var _a;
|
|
3263
|
+
return (_a = this.element) === null || _a === void 0 ? void 0 : _a.indent;
|
|
3361
3264
|
}
|
|
3362
3265
|
ngOnInit() {
|
|
3363
3266
|
super.ngOnInit();
|
|
@@ -3366,32 +3269,31 @@ class TheNumberedListComponent extends TheBaseElementComponent {
|
|
|
3366
3269
|
super.ngOnDestroy();
|
|
3367
3270
|
}
|
|
3368
3271
|
}
|
|
3369
|
-
TheNumberedListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheNumberedListComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }
|
|
3370
|
-
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"] }] });
|
|
3371
3274
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheNumberedListComponent, decorators: [{
|
|
3372
3275
|
type: Component,
|
|
3373
3276
|
args: [{
|
|
3374
3277
|
selector: 'ol[theOl]',
|
|
3375
|
-
template: `<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children
|
|
3376
|
-
providers: [ElementClassPipe]
|
|
3278
|
+
template: `<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>`
|
|
3377
3279
|
}]
|
|
3378
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }
|
|
3280
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { start: [{
|
|
3379
3281
|
type: HostBinding,
|
|
3380
3282
|
args: ['attr.start']
|
|
3381
|
-
}],
|
|
3283
|
+
}], level: [{
|
|
3382
3284
|
type: HostBinding,
|
|
3383
|
-
args: ['
|
|
3285
|
+
args: ['attr.the-level']
|
|
3384
3286
|
}] } });
|
|
3385
3287
|
|
|
3386
3288
|
class TheBulletedListComponent extends TheBaseElementComponent {
|
|
3387
|
-
constructor(elementRef, cdr
|
|
3289
|
+
constructor(elementRef, cdr) {
|
|
3388
3290
|
super(elementRef, cdr);
|
|
3389
3291
|
this.elementRef = elementRef;
|
|
3390
3292
|
this.cdr = cdr;
|
|
3391
|
-
this.elementClassPipe = elementClassPipe;
|
|
3392
3293
|
}
|
|
3393
|
-
get
|
|
3394
|
-
|
|
3294
|
+
get level() {
|
|
3295
|
+
var _a;
|
|
3296
|
+
return (_a = this.element) === null || _a === void 0 ? void 0 : _a.indent;
|
|
3395
3297
|
}
|
|
3396
3298
|
ngOnInit() {
|
|
3397
3299
|
super.ngOnInit();
|
|
@@ -3400,18 +3302,17 @@ class TheBulletedListComponent extends TheBaseElementComponent {
|
|
|
3400
3302
|
super.ngOnDestroy();
|
|
3401
3303
|
}
|
|
3402
3304
|
}
|
|
3403
|
-
TheBulletedListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheBulletedListComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }
|
|
3404
|
-
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"] }] });
|
|
3405
3307
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheBulletedListComponent, decorators: [{
|
|
3406
3308
|
type: Component,
|
|
3407
3309
|
args: [{
|
|
3408
3310
|
selector: 'ul[theUl]',
|
|
3409
|
-
template: `<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children
|
|
3410
|
-
providers: [ElementClassPipe]
|
|
3311
|
+
template: `<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>`
|
|
3411
3312
|
}]
|
|
3412
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }
|
|
3313
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { level: [{
|
|
3413
3314
|
type: HostBinding,
|
|
3414
|
-
args: ['
|
|
3315
|
+
args: ['attr.the-level']
|
|
3415
3316
|
}] } });
|
|
3416
3317
|
|
|
3417
3318
|
class TheListItemComponent extends TheBaseElementComponent {
|
|
@@ -3727,52 +3628,6 @@ const withList = ({ validLiChildrenTypes } = {}) => (editor) => {
|
|
|
3727
3628
|
return editor;
|
|
3728
3629
|
};
|
|
3729
3630
|
|
|
3730
|
-
/** Converts CSS pixel values to numbers, eg "123px" to 123. Returns NaN for non pixel values. */
|
|
3731
|
-
function coercePixelsFromCssValue(cssValue) {
|
|
3732
|
-
const match = cssValue.match(/(\d+)px/);
|
|
3733
|
-
if (match) {
|
|
3734
|
-
return Number(match[1]);
|
|
3735
|
-
}
|
|
3736
|
-
}
|
|
3737
|
-
function getElementWidth(element) {
|
|
3738
|
-
// Optimization: Check style.width first as we probably set it already before reading
|
|
3739
|
-
// offsetWidth which triggers layout.
|
|
3740
|
-
return coercePixelsFromCssValue(element.style.width) || element.offsetWidth;
|
|
3741
|
-
}
|
|
3742
|
-
function getElementHeight(element) {
|
|
3743
|
-
return Math.round(element.getBoundingClientRect().height);
|
|
3744
|
-
}
|
|
3745
|
-
function getColsTotalWidth(cols) {
|
|
3746
|
-
return cols.reduce((total, col) => {
|
|
3747
|
-
return total + getElementWidth(col);
|
|
3748
|
-
}, 0);
|
|
3749
|
-
}
|
|
3750
|
-
function getRowsTotalHeight(rows) {
|
|
3751
|
-
return rows.reduce((total, row) => {
|
|
3752
|
-
return total + getElementHeight(row);
|
|
3753
|
-
}, 0);
|
|
3754
|
-
}
|
|
3755
|
-
function useElementStyle(el, element) {
|
|
3756
|
-
if (element.align) {
|
|
3757
|
-
el.style.textAlign = element.align || Alignment.left;
|
|
3758
|
-
}
|
|
3759
|
-
if (element.textIndent) {
|
|
3760
|
-
el.style.textIndent = element.textIndent + 'em';
|
|
3761
|
-
}
|
|
3762
|
-
if (element.verticalAlign) {
|
|
3763
|
-
el.style.verticalAlign = element.verticalAlign;
|
|
3764
|
-
}
|
|
3765
|
-
}
|
|
3766
|
-
function getElementClassByPrefix(el, prefix) {
|
|
3767
|
-
let matchClass = null;
|
|
3768
|
-
el.classList.forEach((value, key) => {
|
|
3769
|
-
if (value.includes(prefix)) {
|
|
3770
|
-
matchClass = value;
|
|
3771
|
-
}
|
|
3772
|
-
});
|
|
3773
|
-
return matchClass;
|
|
3774
|
-
}
|
|
3775
|
-
|
|
3776
3631
|
class TheTodoItemComponent extends TheBaseElementComponent {
|
|
3777
3632
|
constructor(elementRef, cdr) {
|
|
3778
3633
|
super(elementRef, cdr);
|
|
@@ -3780,15 +3635,12 @@ class TheTodoItemComponent extends TheBaseElementComponent {
|
|
|
3780
3635
|
this.cdr = cdr;
|
|
3781
3636
|
this.checkItemClass = true;
|
|
3782
3637
|
}
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
this.useIndentClass(this.elementRef.nativeElement, this.element);
|
|
3787
|
-
}
|
|
3638
|
+
get level() {
|
|
3639
|
+
var _a;
|
|
3640
|
+
return (_a = this.element) === null || _a === void 0 ? void 0 : _a.indent;
|
|
3788
3641
|
}
|
|
3789
3642
|
ngOnInit() {
|
|
3790
3643
|
super.ngOnInit();
|
|
3791
|
-
this.useIndentClass(this.elementRef.nativeElement, this.element);
|
|
3792
3644
|
}
|
|
3793
3645
|
onCheck(checked) {
|
|
3794
3646
|
if (this.readonly) {
|
|
@@ -3796,26 +3648,9 @@ class TheTodoItemComponent extends TheBaseElementComponent {
|
|
|
3796
3648
|
}
|
|
3797
3649
|
setNode(this.editor, { checked }, this.element);
|
|
3798
3650
|
}
|
|
3799
|
-
useIndentClass(el, element) {
|
|
3800
|
-
const prefix = 'indent';
|
|
3801
|
-
if (element.textIndent) {
|
|
3802
|
-
const oldClass = getElementClassByPrefix(el, prefix);
|
|
3803
|
-
if (oldClass) {
|
|
3804
|
-
el.classList.remove(oldClass);
|
|
3805
|
-
}
|
|
3806
|
-
const newClassName = `${prefix}-${element.textIndent}`;
|
|
3807
|
-
el.classList.add(newClassName);
|
|
3808
|
-
}
|
|
3809
|
-
else {
|
|
3810
|
-
const oldClass = getElementClassByPrefix(el, prefix);
|
|
3811
|
-
if (oldClass) {
|
|
3812
|
-
el.classList.remove(oldClass);
|
|
3813
|
-
}
|
|
3814
|
-
}
|
|
3815
|
-
}
|
|
3816
3651
|
}
|
|
3817
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 });
|
|
3818
|
-
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: `
|
|
3819
3654
|
<span contenteditable="false" class="todo-item-status">
|
|
3820
3655
|
<input #checkbox type="checkbox" [checked]="element.checked" (click)="onCheck(checkbox.checked)" />
|
|
3821
3656
|
</span>
|
|
@@ -3835,6 +3670,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
3835
3670
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { checkItemClass: [{
|
|
3836
3671
|
type: HostBinding,
|
|
3837
3672
|
args: ['class.the-check-item']
|
|
3673
|
+
}], level: [{
|
|
3674
|
+
type: HostBinding,
|
|
3675
|
+
args: ['attr.the-level']
|
|
3838
3676
|
}] } });
|
|
3839
3677
|
|
|
3840
3678
|
const withTodoItem = (editor) => {
|
|
@@ -4447,7 +4285,7 @@ const withBlockCard = (editor) => {
|
|
|
4447
4285
|
return;
|
|
4448
4286
|
}
|
|
4449
4287
|
// → + right-block-card
|
|
4450
|
-
if (
|
|
4288
|
+
if (isMoveForward && !isCardLeftCursor) {
|
|
4451
4289
|
nativeEvent.preventDefault();
|
|
4452
4290
|
const [, path] = AngularEditor.toSlateCardEntry(editor, anchorNode);
|
|
4453
4291
|
const nextPath = Path.next(path);
|
|
@@ -8013,6 +7851,52 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
8013
7851
|
type: Injectable
|
|
8014
7852
|
}], ctorParameters: function () { return []; } });
|
|
8015
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
|
+
|
|
8016
7900
|
function splitCell(editor) {
|
|
8017
7901
|
const opts = new TableOptions$1();
|
|
8018
7902
|
const { anchor } = editor.selection;
|
|
@@ -11272,7 +11156,7 @@ class TheInlineCodeComponent extends TheBaseElementComponent {
|
|
|
11272
11156
|
super(...arguments);
|
|
11273
11157
|
// Put this at the start and end of an inline component to work around this Chromium bug:
|
|
11274
11158
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=1249405
|
|
11275
|
-
this.inlineChromiumBugfix =
|
|
11159
|
+
this.inlineChromiumBugfix = String.fromCodePoint(160);
|
|
11276
11160
|
}
|
|
11277
11161
|
}
|
|
11278
11162
|
TheInlineCodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheInlineCodeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -11330,6 +11214,290 @@ const withInlineCode = (editor) => {
|
|
|
11330
11214
|
return editor;
|
|
11331
11215
|
};
|
|
11332
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 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]" }] });
|
|
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 disableGroup = HEADING_TYPES;
|
|
11392
|
+
const anchorBlock$1 = anchorBlock(editor);
|
|
11393
|
+
return anchorBlock$1 && disableGroup.includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
|
|
11394
|
+
}
|
|
11395
|
+
return false;
|
|
11396
|
+
}
|
|
11397
|
+
};
|
|
11398
|
+
|
|
11399
|
+
const IndentOptions = [
|
|
11400
|
+
{
|
|
11401
|
+
key: ElementKinds.indent,
|
|
11402
|
+
includes: [Indents.indentRight, Indents.indentLeft],
|
|
11403
|
+
iconComponent: TheIndentToolbarComponent,
|
|
11404
|
+
disable: editor => IndentEditor.isDisabled(editor)
|
|
11405
|
+
},
|
|
11406
|
+
{
|
|
11407
|
+
key: Indents.indentRight,
|
|
11408
|
+
name: '增加缩进',
|
|
11409
|
+
icon: 'float-left',
|
|
11410
|
+
execute: editor => IndentEditor.setIndent(editor)
|
|
11411
|
+
},
|
|
11412
|
+
{
|
|
11413
|
+
key: Indents.indentLeft,
|
|
11414
|
+
name: '减少缩进',
|
|
11415
|
+
icon: 'float-right',
|
|
11416
|
+
type: ToolbarItemType.toolDropdown,
|
|
11417
|
+
execute: editor => IndentEditor.cancelIndent(editor)
|
|
11418
|
+
}
|
|
11419
|
+
];
|
|
11420
|
+
|
|
11421
|
+
const onKeydownTextIndent = (editor, event, kinds) => {
|
|
11422
|
+
const { selection } = editor;
|
|
11423
|
+
const isExpanded = Range.isExpanded(selection);
|
|
11424
|
+
const nodes = Array.from(Editor.nodes(editor, {
|
|
11425
|
+
mode: 'highest',
|
|
11426
|
+
match: node => Element$1.isElement(node) && kinds.includes(node.type)
|
|
11427
|
+
}));
|
|
11428
|
+
const [startBlock] = nodes;
|
|
11429
|
+
if (!startBlock) {
|
|
11430
|
+
return false;
|
|
11431
|
+
}
|
|
11432
|
+
const [block, path] = startBlock;
|
|
11433
|
+
const currentPath = [path[0]];
|
|
11434
|
+
const isStart = Editor.isStart(editor, selection.anchor, currentPath);
|
|
11435
|
+
const textIndentDisable = [ElementKinds.bulletedList, ElementKinds.numberedList, ElementKinds.checkItem];
|
|
11436
|
+
if (isHotkey('Tab', event)) {
|
|
11437
|
+
event.preventDefault();
|
|
11438
|
+
if (startBlock && (isExpanded || isStart)) {
|
|
11439
|
+
if (!editor.isVoid(block)) {
|
|
11440
|
+
let { textIndent, type } = block;
|
|
11441
|
+
// do not apply first-line indentation for lists
|
|
11442
|
+
if (!textIndent && !textIndentDisable.includes(type)) {
|
|
11443
|
+
IndentEditor.setTextIndent(editor, kinds, 2);
|
|
11444
|
+
return true;
|
|
11445
|
+
}
|
|
11446
|
+
else {
|
|
11447
|
+
IndentEditor.setIndent(editor);
|
|
11448
|
+
return true;
|
|
11449
|
+
}
|
|
11450
|
+
}
|
|
11451
|
+
}
|
|
11452
|
+
else {
|
|
11453
|
+
editor.insertText(TAB_SPACE);
|
|
11454
|
+
return true;
|
|
11455
|
+
}
|
|
11456
|
+
}
|
|
11457
|
+
if (isHotkey('shift+Tab', event)) {
|
|
11458
|
+
if (startBlock && (isExpanded || isStart)) {
|
|
11459
|
+
if (!editor.isVoid(block)) {
|
|
11460
|
+
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
11461
|
+
}
|
|
11462
|
+
}
|
|
11463
|
+
}
|
|
11464
|
+
if (selection && Range.isCollapsed(selection) && hotkeys.isDeleteBackward(event)) {
|
|
11465
|
+
if (startBlock && isStart) {
|
|
11466
|
+
return IndentEditor.cancelTextIntent(editor, event, block, kinds);
|
|
11467
|
+
}
|
|
11468
|
+
}
|
|
11469
|
+
return false;
|
|
11470
|
+
};
|
|
11471
|
+
|
|
11472
|
+
const withIndent = (kinds) => (editor) => {
|
|
11473
|
+
const { onKeydown } = editor;
|
|
11474
|
+
editor.onKeydown = (event) => {
|
|
11475
|
+
const HOTKEYS = {
|
|
11476
|
+
'mod+]': Indents.indentRight,
|
|
11477
|
+
'mod+[': Indents.indentLeft
|
|
11478
|
+
};
|
|
11479
|
+
for (const hotkey in HOTKEYS) {
|
|
11480
|
+
if (isHotkey(hotkey, event)) {
|
|
11481
|
+
event.preventDefault();
|
|
11482
|
+
const mark = HOTKEYS[hotkey];
|
|
11483
|
+
switch (mark) {
|
|
11484
|
+
case Indents.indentRight:
|
|
11485
|
+
IndentEditor.setIndent(editor);
|
|
11486
|
+
break;
|
|
11487
|
+
case Indents.indentLeft:
|
|
11488
|
+
IndentEditor.cancelIndent(editor);
|
|
11489
|
+
break;
|
|
11490
|
+
}
|
|
11491
|
+
}
|
|
11492
|
+
}
|
|
11493
|
+
const isContinue = !onKeydownTextIndent(editor, event, kinds);
|
|
11494
|
+
if (isContinue) {
|
|
11495
|
+
onKeydown(event);
|
|
11496
|
+
}
|
|
11497
|
+
};
|
|
11498
|
+
return editor;
|
|
11499
|
+
};
|
|
11500
|
+
|
|
11333
11501
|
const internalPlugins = [
|
|
11334
11502
|
withTheHistory,
|
|
11335
11503
|
withAutoInsertData(),
|
|
@@ -11388,7 +11556,8 @@ const internalToolbarItems = [
|
|
|
11388
11556
|
...TableOptions,
|
|
11389
11557
|
...VerticalAlignOptions,
|
|
11390
11558
|
...PaintFormatOptions,
|
|
11391
|
-
...InlineCodeOptions
|
|
11559
|
+
...InlineCodeOptions,
|
|
11560
|
+
...IndentOptions
|
|
11392
11561
|
];
|
|
11393
11562
|
const toolbarCompose = (toolbarItems = []) => {
|
|
11394
11563
|
return [...internalToolbarItems, ...toolbarItems];
|
|
@@ -11965,6 +12134,45 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
11965
12134
|
args: ['mousedown', ['$event']]
|
|
11966
12135
|
}] } });
|
|
11967
12136
|
|
|
12137
|
+
class ElementStylePipe {
|
|
12138
|
+
transform(element, align) {
|
|
12139
|
+
const style = {};
|
|
12140
|
+
if (element.align || align) {
|
|
12141
|
+
style.textAlign = element.align || align || Alignment.left;
|
|
12142
|
+
}
|
|
12143
|
+
if (element.textIndent) {
|
|
12144
|
+
style.textIndent = element.textIndent + 'em';
|
|
12145
|
+
}
|
|
12146
|
+
return style;
|
|
12147
|
+
}
|
|
12148
|
+
}
|
|
12149
|
+
ElementStylePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementStylePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
12150
|
+
ElementStylePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementStylePipe, name: "elementStyle" });
|
|
12151
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementStylePipe, decorators: [{
|
|
12152
|
+
type: Pipe,
|
|
12153
|
+
args: [{
|
|
12154
|
+
name: 'elementStyle'
|
|
12155
|
+
}]
|
|
12156
|
+
}] });
|
|
12157
|
+
class ElementClassPipe {
|
|
12158
|
+
transform(element) {
|
|
12159
|
+
let classStr = '';
|
|
12160
|
+
const prefix = 'indent';
|
|
12161
|
+
if (element.textIndent) {
|
|
12162
|
+
classStr += `${prefix}-${element.textIndent}`;
|
|
12163
|
+
}
|
|
12164
|
+
return classStr;
|
|
12165
|
+
}
|
|
12166
|
+
}
|
|
12167
|
+
ElementClassPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementClassPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
12168
|
+
ElementClassPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementClassPipe, name: "elementClass" });
|
|
12169
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementClassPipe, decorators: [{
|
|
12170
|
+
type: Pipe,
|
|
12171
|
+
args: [{
|
|
12172
|
+
name: 'elementClass'
|
|
12173
|
+
}]
|
|
12174
|
+
}] });
|
|
12175
|
+
|
|
11968
12176
|
class TheTemplateComponent {
|
|
11969
12177
|
constructor() {
|
|
11970
12178
|
this.renderElement = (element) => {
|
|
@@ -12600,7 +12808,8 @@ const COMPONENTS = [
|
|
|
12600
12808
|
TheTableSelectComponent,
|
|
12601
12809
|
TheTableToolbarItemComponent,
|
|
12602
12810
|
TheConversionHintComponent,
|
|
12603
|
-
TheVerticalToolbarItemComponent
|
|
12811
|
+
TheVerticalToolbarItemComponent,
|
|
12812
|
+
TheIndentToolbarComponent
|
|
12604
12813
|
];
|
|
12605
12814
|
const PLUGIN_COMPONENTS = [
|
|
12606
12815
|
TheImageComponent,
|
|
@@ -12643,7 +12852,8 @@ TheEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
|
|
|
12643
12852
|
TheTableSelectComponent,
|
|
12644
12853
|
TheTableToolbarItemComponent,
|
|
12645
12854
|
TheConversionHintComponent,
|
|
12646
|
-
TheVerticalToolbarItemComponent,
|
|
12855
|
+
TheVerticalToolbarItemComponent,
|
|
12856
|
+
TheIndentToolbarComponent, TheImageComponent,
|
|
12647
12857
|
TheTemplateComponent,
|
|
12648
12858
|
TheHrComponent,
|
|
12649
12859
|
TheBlockquoteComponent,
|
|
@@ -12709,5 +12919,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
|
|
|
12709
12919
|
* Generated bundle index. Do not edit.
|
|
12710
12920
|
*/
|
|
12711
12921
|
|
|
12712
|
-
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 };
|
|
12922
|
+
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 };
|
|
12713
12923
|
//# sourceMappingURL=worktile-theia.js.map
|