@worktile/theia 2.1.8 → 2.1.12
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 +148 -127
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/constants/index.d.ts +1 -2
- package/editor.component.d.ts +1 -0
- package/esm2015/components/toolbar/toolbar.component.js +1 -1
- package/esm2015/constants/index.js +2 -3
- package/esm2015/editor.component.js +10 -4
- package/esm2015/interfaces/editor.js +1 -1
- package/esm2015/plugins/align/align.editor.js +2 -2
- package/esm2015/plugins/code/code.component.js +2 -2
- package/esm2015/plugins/common/move-selection.plugin.js +47 -2
- package/esm2015/plugins/font-size/font-size.editor.js +11 -14
- package/esm2015/plugins/image/image.component.js +4 -3
- package/esm2015/plugins/inline-code/inline-code.plugin.js +1 -39
- package/esm2015/plugins/link/link.component.js +7 -9
- package/esm2015/plugins/vertical-align/toolbar-item.component.js +3 -3
- package/esm2015/utils/is-inline.js +10 -0
- package/fesm2015/worktile-theia.js +153 -134
- package/fesm2015/worktile-theia.js.map +1 -1
- package/interfaces/editor.d.ts +1 -0
- package/package.json +1 -1
- package/plugins/font-size/font-size.editor.d.ts +1 -1
- package/styles/editor.scss +11 -0
- package/utils/is-inline.d.ts +2 -0
|
@@ -196,74 +196,6 @@ const LIST_BLOCK_TYPES = [ElementKinds.numberedList, ElementKinds.bulletedList];
|
|
|
196
196
|
const VOID_BLOCK_TYPES = [ElementKinds.image, ElementKinds.hr];
|
|
197
197
|
const BLOCK_DELETEBACKWARD_TYPES = [ElementKinds.tableCell];
|
|
198
198
|
|
|
199
|
-
const TheToolbarGroupToken = new InjectionToken('the-toolbar-group-token');
|
|
200
|
-
const QUICK_TOOLBAR_HOTKEY = '/';
|
|
201
|
-
var DropdownMode;
|
|
202
|
-
(function (DropdownMode) {
|
|
203
|
-
DropdownMode["icon"] = "icon-mode";
|
|
204
|
-
DropdownMode["text"] = "text-mode";
|
|
205
|
-
})(DropdownMode || (DropdownMode = {}));
|
|
206
|
-
var ToolbarItemMode;
|
|
207
|
-
(function (ToolbarItemMode) {
|
|
208
|
-
ToolbarItemMode[ToolbarItemMode["horizontal"] = 0] = "horizontal";
|
|
209
|
-
ToolbarItemMode[ToolbarItemMode["vertical"] = 1] = "vertical";
|
|
210
|
-
})(ToolbarItemMode || (ToolbarItemMode = {}));
|
|
211
|
-
const DefaultGlobalToolbarDefinition = [
|
|
212
|
-
ElementKinds.headingList,
|
|
213
|
-
ToolbarActionTypes.split,
|
|
214
|
-
MarkTypes.bold,
|
|
215
|
-
MarkTypes.italic,
|
|
216
|
-
MarkTypes.underline,
|
|
217
|
-
MarkTypes.strike,
|
|
218
|
-
ElementKinds.inlineCode,
|
|
219
|
-
MarkTypes.color,
|
|
220
|
-
MarkTypes.backgroundColor,
|
|
221
|
-
ToolbarActionTypes.split,
|
|
222
|
-
ToolbarActionTypes.alignType,
|
|
223
|
-
ToolbarActionTypes.verticalAlign,
|
|
224
|
-
ToolbarActionTypes.split,
|
|
225
|
-
ElementKinds.numberedList,
|
|
226
|
-
ElementKinds.bulletedList,
|
|
227
|
-
ToolbarActionTypes.split,
|
|
228
|
-
ElementKinds.link,
|
|
229
|
-
ElementKinds.image,
|
|
230
|
-
ElementKinds.table,
|
|
231
|
-
ElementKinds.blockquote,
|
|
232
|
-
ElementKinds.code
|
|
233
|
-
];
|
|
234
|
-
const DefaultInlineToolbarDefinition = [
|
|
235
|
-
ToolbarActionTypes.clean,
|
|
236
|
-
ToolbarActionTypes.split,
|
|
237
|
-
MarkTypes.bold,
|
|
238
|
-
MarkTypes.italic,
|
|
239
|
-
MarkTypes.underline,
|
|
240
|
-
MarkTypes.strike,
|
|
241
|
-
ElementKinds.inlineCode,
|
|
242
|
-
MarkTypes.color,
|
|
243
|
-
MarkTypes.backgroundColor,
|
|
244
|
-
ToolbarActionTypes.split,
|
|
245
|
-
ToolbarActionTypes.alignType,
|
|
246
|
-
ToolbarActionTypes.split,
|
|
247
|
-
ElementKinds.link
|
|
248
|
-
];
|
|
249
|
-
const DefaultQuickToolbarDefinition = [
|
|
250
|
-
...STANDARD_HEADING_TYPES,
|
|
251
|
-
ToolbarActionTypes.split,
|
|
252
|
-
ElementKinds.numberedList,
|
|
253
|
-
ElementKinds.bulletedList,
|
|
254
|
-
ToolbarActionTypes.split,
|
|
255
|
-
ElementKinds.link,
|
|
256
|
-
ElementKinds.image,
|
|
257
|
-
ElementKinds.table,
|
|
258
|
-
ElementKinds.blockquote,
|
|
259
|
-
ElementKinds.hr,
|
|
260
|
-
ElementKinds.code
|
|
261
|
-
];
|
|
262
|
-
const ToolbarMoreGroup = {
|
|
263
|
-
key: 'more',
|
|
264
|
-
icon: 'more'
|
|
265
|
-
};
|
|
266
|
-
|
|
267
199
|
var ErrorCodes;
|
|
268
200
|
(function (ErrorCodes) {
|
|
269
201
|
ErrorCodes[ErrorCodes["UNKNOW_ERROR"] = 1000] = "UNKNOW_ERROR";
|
|
@@ -353,6 +285,74 @@ const THE_CODE_MODE_PROVIDER = {
|
|
|
353
285
|
};
|
|
354
286
|
const CODEMIRROR_PADDING_TOP = 10;
|
|
355
287
|
|
|
288
|
+
const TheToolbarGroupToken = new InjectionToken('the-toolbar-group-token');
|
|
289
|
+
const QUICK_TOOLBAR_HOTKEY = '/';
|
|
290
|
+
var DropdownMode;
|
|
291
|
+
(function (DropdownMode) {
|
|
292
|
+
DropdownMode["icon"] = "icon-mode";
|
|
293
|
+
DropdownMode["text"] = "text-mode";
|
|
294
|
+
})(DropdownMode || (DropdownMode = {}));
|
|
295
|
+
var ToolbarItemMode;
|
|
296
|
+
(function (ToolbarItemMode) {
|
|
297
|
+
ToolbarItemMode[ToolbarItemMode["horizontal"] = 0] = "horizontal";
|
|
298
|
+
ToolbarItemMode[ToolbarItemMode["vertical"] = 1] = "vertical";
|
|
299
|
+
})(ToolbarItemMode || (ToolbarItemMode = {}));
|
|
300
|
+
const DefaultGlobalToolbarDefinition = [
|
|
301
|
+
ElementKinds.headingList,
|
|
302
|
+
ToolbarActionTypes.split,
|
|
303
|
+
MarkTypes.bold,
|
|
304
|
+
MarkTypes.italic,
|
|
305
|
+
MarkTypes.underline,
|
|
306
|
+
MarkTypes.strike,
|
|
307
|
+
ElementKinds.inlineCode,
|
|
308
|
+
MarkTypes.color,
|
|
309
|
+
MarkTypes.backgroundColor,
|
|
310
|
+
ToolbarActionTypes.split,
|
|
311
|
+
ToolbarActionTypes.alignType,
|
|
312
|
+
ToolbarActionTypes.verticalAlign,
|
|
313
|
+
ToolbarActionTypes.split,
|
|
314
|
+
ElementKinds.numberedList,
|
|
315
|
+
ElementKinds.bulletedList,
|
|
316
|
+
ToolbarActionTypes.split,
|
|
317
|
+
ElementKinds.link,
|
|
318
|
+
ElementKinds.image,
|
|
319
|
+
ElementKinds.table,
|
|
320
|
+
ElementKinds.blockquote,
|
|
321
|
+
ElementKinds.code
|
|
322
|
+
];
|
|
323
|
+
const DefaultInlineToolbarDefinition = [
|
|
324
|
+
ToolbarActionTypes.clean,
|
|
325
|
+
ToolbarActionTypes.split,
|
|
326
|
+
MarkTypes.bold,
|
|
327
|
+
MarkTypes.italic,
|
|
328
|
+
MarkTypes.underline,
|
|
329
|
+
MarkTypes.strike,
|
|
330
|
+
ElementKinds.inlineCode,
|
|
331
|
+
MarkTypes.color,
|
|
332
|
+
MarkTypes.backgroundColor,
|
|
333
|
+
ToolbarActionTypes.split,
|
|
334
|
+
ToolbarActionTypes.alignType,
|
|
335
|
+
ToolbarActionTypes.split,
|
|
336
|
+
ElementKinds.link
|
|
337
|
+
];
|
|
338
|
+
const DefaultQuickToolbarDefinition = [
|
|
339
|
+
...STANDARD_HEADING_TYPES,
|
|
340
|
+
ToolbarActionTypes.split,
|
|
341
|
+
ElementKinds.numberedList,
|
|
342
|
+
ElementKinds.bulletedList,
|
|
343
|
+
ToolbarActionTypes.split,
|
|
344
|
+
ElementKinds.link,
|
|
345
|
+
ElementKinds.image,
|
|
346
|
+
ElementKinds.table,
|
|
347
|
+
ElementKinds.blockquote,
|
|
348
|
+
ElementKinds.hr,
|
|
349
|
+
ElementKinds.code
|
|
350
|
+
];
|
|
351
|
+
const ToolbarMoreGroup = {
|
|
352
|
+
key: 'more',
|
|
353
|
+
icon: 'more'
|
|
354
|
+
};
|
|
355
|
+
|
|
356
356
|
class TheTextComponent extends BaseTextComponent {
|
|
357
357
|
constructor(elementRef, renderer2, cdr) {
|
|
358
358
|
super(elementRef, cdr);
|
|
@@ -2410,7 +2410,7 @@ class TheImageComponent extends TheBaseElementComponent {
|
|
|
2410
2410
|
height: value.element.height,
|
|
2411
2411
|
thumbUrl: value.element.thumbUrl,
|
|
2412
2412
|
originUrl: value.element.originUrl,
|
|
2413
|
-
align: value.element.align || Alignment.
|
|
2413
|
+
align: value.element.align || Alignment.left
|
|
2414
2414
|
};
|
|
2415
2415
|
}
|
|
2416
2416
|
};
|
|
@@ -2451,6 +2451,7 @@ class TheImageComponent extends TheBaseElementComponent {
|
|
|
2451
2451
|
this.imageEntry = {
|
|
2452
2452
|
height,
|
|
2453
2453
|
width,
|
|
2454
|
+
align: this.imageEntry.align || Alignment.center,
|
|
2454
2455
|
thumbUrl: this.sanitizer.bypassSecurityTrustResourceUrl(URL.createObjectURL(file))
|
|
2455
2456
|
};
|
|
2456
2457
|
this.uploading = true;
|
|
@@ -2560,7 +2561,7 @@ class TheImageComponent extends TheBaseElementComponent {
|
|
|
2560
2561
|
}
|
|
2561
2562
|
}
|
|
2562
2563
|
TheImageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheImageComponent, deps: [{ token: i0.ElementRef }, { token: i1$2.DomSanitizer }, { token: THE_UPLOAD_SERVICE_TOKEN }, { token: i0.ChangeDetectorRef }, { token: TheContextService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2563
|
-
TheImageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheImageComponent, selector: "the-image, [theImage]", viewQueries: [{ propertyName: "imageContent", first: true, predicate: ["imageContent"], descendants: true }, { propertyName: "img", first: true, predicate: ["img"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n<div class=\"image-container\" contenteditable=\"false\" [style.textAlign]=\"imageEntry.align
|
|
2564
|
+
TheImageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheImageComponent, selector: "the-image, [theImage]", viewQueries: [{ propertyName: "imageContent", first: true, predicate: ["imageContent"], descendants: true }, { propertyName: "img", first: true, predicate: ["img"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n<div class=\"image-container\" contenteditable=\"false\" [style.textAlign]=\"imageEntry.align\">\n <div\n #imageContent\n *ngIf=\"imageEntry.thumbUrl\"\n class=\"image-content\"\n [class.pointer]=\"!selection\"\n [ngStyle]=\"{ width: imageEntry.width + 'px', height: imageEntry.height + 'px' }\"\n >\n <img #img class=\"main-image\" [src]=\"imageEntry.thumbUrl\" [alt]=\"imageEntry.name\" />\n <div *ngIf=\"selection\" class=\"image-profile\" [class.outline]=\"selection\">\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right bottom\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left bottom\"></span>\n </div>\n <div *ngIf=\"uploading\" class=\"uploading\">\n <div class=\"uploading-percentage\">\n <thy-progress thyType=\"primary\" [thyValue]=\"percentage\" thySize=\"sm\"></thy-progress>\n <thy-icon (click)=\"cancelUpload($event)\" thyIconName=\"close-circle-bold-fill\" thyIconLegging=\"true\"></thy-icon>\n </div>\n </div>\n <div *ngIf=\"!uploading\" class=\"layer\" (mousedown)=\"preview($event)\" [class.readonly]=\"readonly\"></div>\n </div>\n <div *ngIf=\"!imageEntry.thumbUrl\" class=\"image-loading\" contenteditable=\"false\">\n <thy-icon thyIconName=\"image\"></thy-icon>\n </div>\n</div>\n", components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i4.ThyProgressComponent, selector: "thy-progress", inputs: ["thyType", "thySize", "thyValue", "thyMax", "thyTips"] }, { type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
2564
2565
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheImageComponent, decorators: [{
|
|
2565
2566
|
type: Component,
|
|
2566
2567
|
args: [{
|
|
@@ -4572,6 +4573,15 @@ const withBlockCard = (editor) => {
|
|
|
4572
4573
|
return editor;
|
|
4573
4574
|
};
|
|
4574
4575
|
|
|
4576
|
+
const isInline = (editor, path) => {
|
|
4577
|
+
var _a;
|
|
4578
|
+
const [inlineNode] = Editor.nodes(editor, {
|
|
4579
|
+
at: path ? path : (_a = editor.selection) === null || _a === void 0 ? void 0 : _a.anchor.path,
|
|
4580
|
+
match: n => Element$1.isElement(n) && Editor.isInline(editor, n) && !Editor.isVoid(editor, n)
|
|
4581
|
+
});
|
|
4582
|
+
return !!inlineNode;
|
|
4583
|
+
};
|
|
4584
|
+
|
|
4575
4585
|
const withMoveSelection = (editor) => {
|
|
4576
4586
|
const { onClick, deleteBackward, onKeydown } = editor;
|
|
4577
4587
|
editor.onClick = (event) => {
|
|
@@ -4604,6 +4614,50 @@ const withMoveSelection = (editor) => {
|
|
|
4604
4614
|
}
|
|
4605
4615
|
deleteBackward(unit);
|
|
4606
4616
|
};
|
|
4617
|
+
editor.onKeydown = (event) => {
|
|
4618
|
+
const { selection } = editor;
|
|
4619
|
+
if (!selection || !selection.anchor || !selection.focus) {
|
|
4620
|
+
onKeydown(event);
|
|
4621
|
+
return;
|
|
4622
|
+
}
|
|
4623
|
+
const isMoveBackward = hotkeys.isMoveBackward(event);
|
|
4624
|
+
const isMoveForward = hotkeys.isMoveForward(event);
|
|
4625
|
+
const isCollapsed$1 = selection && isCollapsed(selection);
|
|
4626
|
+
const isInlineNode = isInline(editor);
|
|
4627
|
+
if (isCollapsed$1 && isMoveForward) {
|
|
4628
|
+
let isInlineCodeBefore = false;
|
|
4629
|
+
if (!isInlineNode) {
|
|
4630
|
+
try {
|
|
4631
|
+
const { path } = Editor.after(editor, selection);
|
|
4632
|
+
if (path) {
|
|
4633
|
+
isInlineCodeBefore = isInline(editor, path);
|
|
4634
|
+
}
|
|
4635
|
+
}
|
|
4636
|
+
catch (error) { }
|
|
4637
|
+
}
|
|
4638
|
+
if (isInlineNode || isInlineCodeBefore) {
|
|
4639
|
+
event.preventDefault();
|
|
4640
|
+
Transforms.move(editor, { unit: 'offset' });
|
|
4641
|
+
return;
|
|
4642
|
+
}
|
|
4643
|
+
}
|
|
4644
|
+
if (isCollapsed$1 && isMoveBackward) {
|
|
4645
|
+
let isInlineCodeAfter = false;
|
|
4646
|
+
if (!isInlineNode) {
|
|
4647
|
+
try {
|
|
4648
|
+
const { path } = Editor.before(editor, selection);
|
|
4649
|
+
isInlineCodeAfter = isInline(editor, path);
|
|
4650
|
+
}
|
|
4651
|
+
catch (error) { }
|
|
4652
|
+
}
|
|
4653
|
+
if (isInlineNode || isInlineCodeAfter) {
|
|
4654
|
+
event.preventDefault();
|
|
4655
|
+
Transforms.move(editor, { unit: 'offset', reverse: true });
|
|
4656
|
+
return;
|
|
4657
|
+
}
|
|
4658
|
+
}
|
|
4659
|
+
onKeydown(event);
|
|
4660
|
+
};
|
|
4607
4661
|
return editor;
|
|
4608
4662
|
};
|
|
4609
4663
|
|
|
@@ -5744,7 +5798,7 @@ const AlignEditor = {
|
|
|
5744
5798
|
return;
|
|
5745
5799
|
}
|
|
5746
5800
|
const props = {
|
|
5747
|
-
align: alignment
|
|
5801
|
+
align: alignment !== Alignment.left ? alignment : null
|
|
5748
5802
|
};
|
|
5749
5803
|
Transforms.setNodes(editor, props, {
|
|
5750
5804
|
at: editor.selection,
|
|
@@ -6695,7 +6749,7 @@ class TheCodeComponent extends TheBaseElementComponent {
|
|
|
6695
6749
|
this.options = Object.assign(Object.assign({}, this.options), { lineWrapping: this.element.autoWrap || false });
|
|
6696
6750
|
}
|
|
6697
6751
|
useHeight() {
|
|
6698
|
-
if (this.element.height) {
|
|
6752
|
+
if (this.element.height && this.config.mode !== 'print') {
|
|
6699
6753
|
this.resizeHeight = this.element.height;
|
|
6700
6754
|
this.maxHeight = this.element.height;
|
|
6701
6755
|
}
|
|
@@ -7109,18 +7163,16 @@ class TheLinkComponent extends TheBaseLinkComponent {
|
|
|
7109
7163
|
}
|
|
7110
7164
|
}
|
|
7111
7165
|
TheLinkComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheLinkComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
7112
|
-
TheLinkComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheLinkComponent, selector: "span[theLink]", usesInheritance: true, ngImport: i0, template: `
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
<span contenteditable="false" style="font-size: 0;">{{ inlineChromiumBugfix }}</span>`, isInline: true, components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
|
|
7166
|
+
TheLinkComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheLinkComponent, selector: "span[theLink]", usesInheritance: true, ngImport: i0, template: ` <span contenteditable="false" style="font-size: 0;">{{ inlineChromiumBugfix }}</span>
|
|
7167
|
+
<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>
|
|
7168
|
+
<span contenteditable="false" style="font-size: 0;">{{ inlineChromiumBugfix }}</span>`, isInline: true, components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
|
|
7116
7169
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheLinkComponent, decorators: [{
|
|
7117
7170
|
type: Component,
|
|
7118
7171
|
args: [{
|
|
7119
7172
|
selector: 'span[theLink]',
|
|
7120
|
-
template: `
|
|
7121
|
-
|
|
7122
|
-
|
|
7123
|
-
<span contenteditable="false" style="font-size: 0;">{{ inlineChromiumBugfix }}</span>`
|
|
7173
|
+
template: ` <span contenteditable="false" style="font-size: 0;">{{ inlineChromiumBugfix }}</span>
|
|
7174
|
+
<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>
|
|
7175
|
+
<span contenteditable="false" style="font-size: 0;">{{ inlineChromiumBugfix }}</span>`
|
|
7124
7176
|
}]
|
|
7125
7177
|
}] });
|
|
7126
7178
|
class TheReadonlyLinkComponent extends TheBaseLinkComponent {
|
|
@@ -10630,7 +10682,7 @@ class TheVerticalToolbarItemComponent extends TheToolbarBaseItemComponent {
|
|
|
10630
10682
|
execute(event) {
|
|
10631
10683
|
var _a, _b;
|
|
10632
10684
|
super.execute(event);
|
|
10633
|
-
if (
|
|
10685
|
+
if (((_a = this.editor) === null || _a === void 0 ? void 0 : _a.readOnly) || ((_b = this.editor) === null || _b === void 0 ? void 0 : _b.disabled)) {
|
|
10634
10686
|
return;
|
|
10635
10687
|
}
|
|
10636
10688
|
this.openPopover();
|
|
@@ -10663,7 +10715,7 @@ class TheVerticalToolbarItemComponent extends TheToolbarBaseItemComponent {
|
|
|
10663
10715
|
}
|
|
10664
10716
|
}
|
|
10665
10717
|
TheVerticalToolbarItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheVerticalToolbarItemComponent, deps: [{ token: i0.ElementRef }, { token: i1$6.ThyPopover }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
10666
|
-
TheVerticalToolbarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheVerticalToolbarItemComponent, selector: "the-toolbar-vertical-align-item", inputs: { item: "item", menus: "menus", editor: "editor", toolbarItem: "toolbarItem" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)" }, properties: { "class.hide": "!active" }, classAttribute: "the-toolbar-dropdown-container verticalAlign" }, viewQueries: [{ propertyName: "template", first: true, predicate: ["VerticalAlignItems"], descendants: true, read: TemplateRef, static: true }], usesInheritance: true, ngImport: i0, template: "<a\n thyIconNavLink\n class=\"icon-mode link-with-down\"\n [thyTooltip]=\"toolbarItem?.name\"\n [thyIconNavLinkActive]=\"isOpened\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"execute($event)\"\n>\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 #VerticalAlignItems>\n <thy-action-menu class=\"dropdown\">\n <ng-container *ngFor=\"let menu of toolbarItem?.includes\">\n <a\n thyActionMenuItem\n href=\"javascript:;\"\n [thyActionMenuItemActive]=\"menu.key === activeMenu?.key\"\n
|
|
10718
|
+
TheVerticalToolbarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheVerticalToolbarItemComponent, selector: "the-toolbar-vertical-align-item", inputs: { item: "item", menus: "menus", editor: "editor", toolbarItem: "toolbarItem" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)" }, properties: { "class.hide": "!active" }, classAttribute: "the-toolbar-dropdown-container verticalAlign" }, viewQueries: [{ propertyName: "template", first: true, predicate: ["VerticalAlignItems"], descendants: true, read: TemplateRef, static: true }], usesInheritance: true, ngImport: i0, template: "<a\n thyIconNavLink\n class=\"icon-mode link-with-down\"\n [thyTooltip]=\"toolbarItem?.name\"\n [thyIconNavLinkActive]=\"isOpened\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"execute($event)\"\n>\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 #VerticalAlignItems>\n <thy-action-menu class=\"dropdown\">\n <ng-container *ngFor=\"let menu of toolbarItem?.includes\">\n <a\n thyActionMenuItem\n href=\"javascript:;\"\n [thyActionMenuItemActive]=\"menu.key === activeMenu?.key\"\n (mousedown)=\"itemMousedown($event, menu)\"\n >\n <span *ngIf=\"menu.icon\" 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.ThyActionMenuItemActiveDirective, selector: "[thyActionMenuItemActive]", inputs: ["thyActionMenuItemActive"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$2.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i5$2.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }] });
|
|
10667
10719
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheVerticalToolbarItemComponent, decorators: [{
|
|
10668
10720
|
type: Component,
|
|
10669
10721
|
args: [{
|
|
@@ -11118,7 +11170,8 @@ const FontSizeEditor = {
|
|
|
11118
11170
|
return;
|
|
11119
11171
|
}
|
|
11120
11172
|
// unset fontSize
|
|
11121
|
-
if (
|
|
11173
|
+
if (isDefaultFontSize && Number(defaultFontSize) === fontSizeMark) {
|
|
11174
|
+
FontSizeEditor.unsetFontSize(editor, size);
|
|
11122
11175
|
return;
|
|
11123
11176
|
}
|
|
11124
11177
|
FontSizeEditor.setFontSizeMark(editor, size);
|
|
@@ -11131,20 +11184,16 @@ const FontSizeEditor = {
|
|
|
11131
11184
|
// set paragraph text fontSize
|
|
11132
11185
|
Editor.addMark(editor, MarkTypes.fontSize, Number(size));
|
|
11133
11186
|
},
|
|
11134
|
-
unsetFontSize(editor, size
|
|
11187
|
+
unsetFontSize(editor, size) {
|
|
11135
11188
|
const isTable = TableEditor.isActive(editor);
|
|
11136
|
-
|
|
11137
|
-
|
|
11138
|
-
|
|
11139
|
-
return true;
|
|
11140
|
-
}
|
|
11141
|
-
// unset paragraph text fontSize
|
|
11142
|
-
setMarks(editor, {
|
|
11143
|
-
[MarkTypes.fontSize]: null
|
|
11144
|
-
}, editor.selection);
|
|
11145
|
-
return true;
|
|
11189
|
+
// unset Table selectedCells fontSize
|
|
11190
|
+
if (isTable && TableEditor.toggleMark(editor, true, MarkTypes.fontSize, Number(size))) {
|
|
11191
|
+
return;
|
|
11146
11192
|
}
|
|
11147
|
-
|
|
11193
|
+
// unset paragraph text fontSize
|
|
11194
|
+
setMarks(editor, {
|
|
11195
|
+
[MarkTypes.fontSize]: null
|
|
11196
|
+
}, editor.selection);
|
|
11148
11197
|
},
|
|
11149
11198
|
isFontSizeActive(editor, size) {
|
|
11150
11199
|
if (editor.selection) {
|
|
@@ -11274,42 +11323,6 @@ const withInlineCode = (editor) => {
|
|
|
11274
11323
|
insertText(text);
|
|
11275
11324
|
}
|
|
11276
11325
|
};
|
|
11277
|
-
editor.onKeydown = (event) => {
|
|
11278
|
-
const { selection } = editor;
|
|
11279
|
-
if (!selection || !selection.anchor || !selection.focus) {
|
|
11280
|
-
onKeydown(event);
|
|
11281
|
-
return;
|
|
11282
|
-
}
|
|
11283
|
-
const isMoveBackward = hotkeys.isMoveBackward(event);
|
|
11284
|
-
const isMoveForward = hotkeys.isMoveForward(event);
|
|
11285
|
-
const isCollapsed$1 = selection && isCollapsed(selection);
|
|
11286
|
-
const isInlineCode = InlineCodeEditor.isInlineCodeActive(editor);
|
|
11287
|
-
if (isCollapsed$1 && isMoveForward) {
|
|
11288
|
-
let isInlineCodeBefore = false;
|
|
11289
|
-
if (!isInlineCode) {
|
|
11290
|
-
const { path } = Editor.after(editor, selection);
|
|
11291
|
-
isInlineCodeBefore = InlineCodeEditor.isInlineCodeActive(editor, path);
|
|
11292
|
-
}
|
|
11293
|
-
if (isInlineCode || isInlineCodeBefore) {
|
|
11294
|
-
event.preventDefault();
|
|
11295
|
-
Transforms.move(editor, { unit: 'offset' });
|
|
11296
|
-
return;
|
|
11297
|
-
}
|
|
11298
|
-
}
|
|
11299
|
-
if (isCollapsed$1 && isMoveBackward) {
|
|
11300
|
-
let isInlineCodeAfter = false;
|
|
11301
|
-
if (!isInlineCode) {
|
|
11302
|
-
const { path } = Editor.before(editor, selection);
|
|
11303
|
-
isInlineCodeAfter = InlineCodeEditor.isInlineCodeActive(editor, path);
|
|
11304
|
-
}
|
|
11305
|
-
if (isInlineCode || isInlineCodeAfter) {
|
|
11306
|
-
event.preventDefault();
|
|
11307
|
-
Transforms.move(editor, { unit: 'offset', reverse: true });
|
|
11308
|
-
return;
|
|
11309
|
-
}
|
|
11310
|
-
}
|
|
11311
|
-
onKeydown(event);
|
|
11312
|
-
};
|
|
11313
11326
|
editor = withRemoveEmptyNodes({ type: ElementKinds.inlineCode })(editor);
|
|
11314
11327
|
return editor;
|
|
11315
11328
|
};
|
|
@@ -12168,6 +12181,9 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
|
|
|
12168
12181
|
});
|
|
12169
12182
|
this.toolbarCalculate();
|
|
12170
12183
|
setTimeout(() => {
|
|
12184
|
+
// You need to wait for the editor rendering to complete
|
|
12185
|
+
// before triggering the external toolbar assignment detection
|
|
12186
|
+
this.globalToolbarInit();
|
|
12171
12187
|
this.theEditorCreated.emit(this.editor);
|
|
12172
12188
|
this.applyAutoFocus();
|
|
12173
12189
|
});
|
|
@@ -12196,11 +12212,14 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
|
|
|
12196
12212
|
const toolbarOption = this.toolbarService.initialize(toolbarItems, toolbar === null || toolbar === void 0 ? void 0 : toolbar.global, toolbar === null || toolbar === void 0 ? void 0 : toolbar.inline, toolbar === null || toolbar === void 0 ? void 0 : toolbar.quick);
|
|
12197
12213
|
this.globalToolbarClass = ['the-global-toolbar', getToolbarClass(this.editor)];
|
|
12198
12214
|
this.toolbarEntity = toolbarOption.toolbarEntity;
|
|
12215
|
+
}
|
|
12216
|
+
globalToolbarInit() {
|
|
12217
|
+
var _a, _b;
|
|
12199
12218
|
if (this.theGlobalToolbar) {
|
|
12200
12219
|
this.theGlobalToolbarInstance.editor = this.editor;
|
|
12201
|
-
this.theGlobalToolbarInstance.toolbarItems =
|
|
12220
|
+
this.theGlobalToolbarInstance.toolbarItems = this.toolbarEntity.global;
|
|
12202
12221
|
this.theGlobalToolbarInstance.containerClass = this.globalToolbarClass;
|
|
12203
|
-
this.theGlobalToolbarInstance.align =
|
|
12222
|
+
this.theGlobalToolbarInstance.align = (_b = (_a = this === null || this === void 0 ? void 0 : this.theOptions) === null || _a === void 0 ? void 0 : _a.toolbar) === null || _b === void 0 ? void 0 : _b.align;
|
|
12204
12223
|
this.theGlobalToolbarInstance.setToolbarClass();
|
|
12205
12224
|
this.theGlobalToolbarInstance.renderToolbarView();
|
|
12206
12225
|
}
|
|
@@ -12354,7 +12373,7 @@ TheEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
|
|
|
12354
12373
|
useExisting: forwardRef(() => TheEditorComponent),
|
|
12355
12374
|
multi: true
|
|
12356
12375
|
}
|
|
12357
|
-
], viewQueries: [{ propertyName: "templateInstance", first: true, predicate: ["templateInstance"], descendants: true, static: true }, { propertyName: "globalToolbarInstance", first: true, predicate: ["globalToolbar"], descendants: true }, { propertyName: "quickInsertInstance", first: true, predicate: ["quickInsert"], descendants: true, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<the-toolbar\n *ngIf=\"!theOptions?.readonly && !theGlobalToolbar\"\n [ngClass]=\"{\n 'the-toolbar-disabled': theOptions?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.global\"\n [containerClass]=\"globalToolbarClass\"\n [align]=\"theOptions?.toolbar?.align\"\n></the-toolbar>\n\n<div\n class=\"the-editable-container\"\n [ngClass]=\"{\n 'the-editor-disabled': theOptions?.disabled,\n 'max-height': maxHeight\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n (ngModelChange)=\"valueChange($event)\"\n [decorate]=\"decorate\"\n [placeholder]=\"theOptions?.placeholder\"\n [placeholderDecorate]=\"theOptions?.placeholderDecorate ? theOptions?.placeholderDecorate : null\"\n [renderElement]=\"renderElement\"\n [renderText]=\"renderText\"\n [renderLeaf]=\"renderLeaf\"\n [readonly]=\"theOptions?.readonly || theOptions?.disabled\"\n [keydown]=\"onKeyDown\"\n [click]=\"onClick\"\n [paste]=\"onSlaPaste\"\n [beforeInput]=\"onSlaBeforeInput\"\n [blur]=\"onSlaBlur\"\n [focus]=\"onSlaFocus\"\n [copy]=\"onSlaCopy\"\n [cut]=\"onSlaCut\"\n [isStrictDecorate]=\"false\"\n [compositionStart]=\"onSlaCompositionStart\"\n [compositionEnd]=\"onSlaCompositionEnd\"\n [dragStart]=\"onSlaDragStart\"\n [dragOver]=\"onSlaDragOver\"\n [drop]=\"onDrop\"\n (mousedown)=\"mousedown($event)\"\n ></slate-editable>\n <the-inline-toolbar
|
|
12376
|
+
], viewQueries: [{ propertyName: "templateInstance", first: true, predicate: ["templateInstance"], descendants: true, static: true }, { propertyName: "globalToolbarInstance", first: true, predicate: ["globalToolbar"], descendants: true }, { propertyName: "quickInsertInstance", first: true, predicate: ["quickInsert"], descendants: true, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<the-toolbar\n *ngIf=\"!theOptions?.readonly && !theGlobalToolbar\"\n [ngClass]=\"{\n 'the-toolbar-disabled': theOptions?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.global\"\n [containerClass]=\"globalToolbarClass\"\n [align]=\"theOptions?.toolbar?.align\"\n></the-toolbar>\n\n<div\n class=\"the-editable-container\"\n [ngClass]=\"{\n 'the-editor-disabled': theOptions?.disabled,\n 'max-height': maxHeight\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n (ngModelChange)=\"valueChange($event)\"\n [decorate]=\"decorate\"\n [placeholder]=\"theOptions?.placeholder\"\n [placeholderDecorate]=\"theOptions?.placeholderDecorate ? theOptions?.placeholderDecorate : null\"\n [renderElement]=\"renderElement\"\n [renderText]=\"renderText\"\n [renderLeaf]=\"renderLeaf\"\n [readonly]=\"theOptions?.readonly || theOptions?.disabled\"\n [keydown]=\"onKeyDown\"\n [click]=\"onClick\"\n [paste]=\"onSlaPaste\"\n [beforeInput]=\"onSlaBeforeInput\"\n [blur]=\"onSlaBlur\"\n [focus]=\"onSlaFocus\"\n [copy]=\"onSlaCopy\"\n [cut]=\"onSlaCut\"\n [isStrictDecorate]=\"false\"\n [compositionStart]=\"onSlaCompositionStart\"\n [compositionEnd]=\"onSlaCompositionEnd\"\n [dragStart]=\"onSlaDragStart\"\n [dragOver]=\"onSlaDragOver\"\n [drop]=\"onDrop\"\n (mousedown)=\"mousedown($event)\"\n ></slate-editable>\n <the-inline-toolbar\n *ngIf=\"!theOptions?.readonly && theOptions?.inlineToobarVisible\"\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.inline\"\n ></the-inline-toolbar>\n <div\n #quickInsert\n theQuickInsert\n [editor]=\"editor\"\n [quickToolbarItems]=\"quickToolbarItems\"\n [isVisible]=\"theOptions?.quickInsertVisible\"\n ></div>\n <the-template #templateInstance></the-template>\n</div>\n", components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "containerClass", "isMore", "afterTemplate"] }, { type: i1.SlateEditableComponent, selector: "slate-editable", inputs: ["editor", "renderElement", "renderLeaf", "renderText", "decorate", "placeholderDecorate", "isStrictDecorate", "trackBy", "readonly", "placeholder", "beforeInput", "blur", "click", "compositionEnd", "compositionStart", "copy", "cut", "dragOver", "dragStart", "dragEnd", "drop", "focus", "keydown", "paste", "spellCheck", "autoCorrect", "autoCapitalize"] }, { type: TheInlineToolbarComponent, selector: "the-inline-toolbar", inputs: ["editor", "toolbarItems"] }, { type: TheQuickInsertComponent, selector: "[theQuickInsert]", inputs: ["editor", "quickToolbarItems", "isVisible"] }, { type: TheTemplateComponent, selector: "the-template,[theTemplate]" }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
12358
12377
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheEditorComponent, decorators: [{
|
|
12359
12378
|
type: Component,
|
|
12360
12379
|
args: [{
|