@worktile/theia 2.1.1 → 2.1.5
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 +505 -210
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/components/toolbar/toolbar.component.d.ts +1 -0
- package/components/toolbar/toolbar.component.scss +2 -0
- package/components/toolbar-dropdown/toolbar-dropdown.component.d.ts +7 -5
- package/components/toolbar-dropdown/toolbar-dropdown.component.scss +2 -0
- package/components/toolbar-item/toolbar-item.component.d.ts +3 -0
- package/constants/default.d.ts +1 -1
- package/constants/node-types.d.ts +19 -3
- package/custom-types.d.ts +4 -1
- package/editor.module.d.ts +22 -23
- package/esm2015/components/toolbar/toolbar.component.js +18 -5
- package/esm2015/components/toolbar-dropdown/toolbar-dropdown.component.js +14 -5
- package/esm2015/components/toolbar-item/toolbar-item.component.js +20 -6
- package/esm2015/constants/auto-format-rules.js +8 -3
- package/esm2015/constants/default.js +2 -2
- package/esm2015/constants/node-types.js +33 -4
- package/esm2015/constants/toolbar.js +5 -5
- package/esm2015/custom-types.js +1 -1
- package/esm2015/editor.component.js +12 -7
- package/esm2015/editor.module.js +8 -8
- package/esm2015/interfaces/auto-format.js +1 -1
- package/esm2015/interfaces/editor.js +1 -1
- package/esm2015/interfaces/element.js +1 -1
- package/esm2015/interfaces/toolbar.js +1 -1
- package/esm2015/plugins/align/options.js +2 -1
- package/esm2015/plugins/autoformat/autoformat.plugin.js +2 -1
- package/esm2015/plugins/autoformat/transforms/auto-format-inline.js +27 -14
- package/esm2015/plugins/code/code.component.js +26 -10
- package/esm2015/plugins/deserializers/deserialize-md.plugin.js +2 -2
- package/esm2015/plugins/font-size/font-size.editor.js +81 -0
- package/esm2015/plugins/font-size/options.js +20 -6
- package/esm2015/plugins/heading/heading.editor.js +13 -2
- package/esm2015/plugins/heading/options.js +2 -1
- package/esm2015/plugins/index.js +7 -3
- package/esm2015/plugins/inline-code/inline-code.component.js +27 -0
- package/esm2015/plugins/inline-code/inline-code.editor.js +45 -0
- package/esm2015/plugins/inline-code/inline-code.plugin.js +46 -0
- package/esm2015/plugins/inline-code/options.js +14 -0
- package/esm2015/plugins/link/link.component.js +4 -2
- package/esm2015/plugins/list/components/list-item.component.js +69 -1
- package/esm2015/plugins/mark/mark.plugin.js +15 -10
- package/esm2015/plugins/mark/options.js +1 -9
- package/esm2015/plugins/table/table.editor.js +1 -1
- package/esm2015/services/context.service.js +9 -1
- package/esm2015/services/toolbar.service.js +2 -2
- package/esm2015/shortcuts/mark.js +10 -4
- package/fesm2015/worktile-theia.js +465 -184
- package/fesm2015/worktile-theia.js.map +1 -1
- package/interfaces/auto-format.d.ts +1 -1
- package/interfaces/editor.d.ts +3 -1
- package/interfaces/element.d.ts +1 -1
- package/interfaces/toolbar.d.ts +2 -1
- package/package.json +1 -1
- package/plugins/autoformat/transforms/auto-format-inline.d.ts +3 -1
- package/plugins/code/code.component.d.ts +6 -3
- package/plugins/code/code.component.scss +17 -1
- package/plugins/font-size/font-size.editor.d.ts +10 -0
- package/plugins/font-size/options.d.ts +0 -1
- package/plugins/font-size/toolbar-item.component.scss +1 -11
- package/plugins/heading/heading.editor.d.ts +1 -1
- package/plugins/inline-code/inline-code.component.d.ts +14 -0
- package/plugins/inline-code/inline-code.component.scss +13 -0
- package/plugins/inline-code/inline-code.editor.d.ts +7 -0
- package/plugins/inline-code/inline-code.plugin.d.ts +2 -0
- package/plugins/inline-code/options.d.ts +2 -0
- package/plugins/list/components/list-item.component.d.ts +7 -0
- package/plugins/table/table.editor.d.ts +1 -1
- package/queries/get-container-blocks.d.ts +1 -1
- package/queries/get-selection-marks.d.ts +1 -1
- package/services/context.service.d.ts +5 -1
- package/styles/editor.scss +32 -1
- package/styles/index.scss +1 -0
- package/styles/typo.scss +2 -1
- package/transforms/set-marks.d.ts +1 -1
- package/esm2015/plugins/font-size/toolbar-item.component.js +0 -129
- package/plugins/font-size/toolbar-item.component.d.ts +0 -35
|
@@ -375,10 +375,10 @@
|
|
|
375
375
|
var A_TAG_REL_ATTR = 'noopener noreferrer nofollow external ugc';
|
|
376
376
|
var LINK_DEFAULT_TEXT = '链接';
|
|
377
377
|
var TAB_SPACE = ' ';
|
|
378
|
-
var ZERO_WIDTH_CHAR = '\u200B';
|
|
379
378
|
var CLIPBOARD_FORMAT_KEY = 'x-theia-fragment';
|
|
380
379
|
var DEFAULT_SCROLL_CONTAINER = '.the-editable-container';
|
|
381
380
|
var ELEMENT_UNIQUE_ID = 'key';
|
|
381
|
+
var ZERO_WIDTH_CHAR = '\u200B';
|
|
382
382
|
exports.TheMode = void 0;
|
|
383
383
|
(function (TheMode) {
|
|
384
384
|
TheMode["fullMode"] = "full";
|
|
@@ -409,6 +409,7 @@
|
|
|
409
409
|
ElementKinds["hr"] = "hr";
|
|
410
410
|
ElementKinds["link"] = "link";
|
|
411
411
|
ElementKinds["default"] = "paragraph";
|
|
412
|
+
ElementKinds["inlineCode"] = "inline-code";
|
|
412
413
|
})(exports.ElementKinds || (exports.ElementKinds = {}));
|
|
413
414
|
exports.Alignment = void 0;
|
|
414
415
|
(function (Alignment) {
|
|
@@ -422,6 +423,34 @@
|
|
|
422
423
|
VerticalAlignment["middle"] = "middle";
|
|
423
424
|
VerticalAlignment["bottom"] = "bottom";
|
|
424
425
|
})(exports.VerticalAlignment || (exports.VerticalAlignment = {}));
|
|
426
|
+
exports.FontSizes = void 0;
|
|
427
|
+
(function (FontSizes) {
|
|
428
|
+
FontSizes["fontSize12"] = "12";
|
|
429
|
+
FontSizes["fontSize13"] = "13";
|
|
430
|
+
FontSizes["fontSize14"] = "14";
|
|
431
|
+
FontSizes["fontSize15"] = "15";
|
|
432
|
+
FontSizes["fontSize16"] = "16";
|
|
433
|
+
FontSizes["fontSize18"] = "18";
|
|
434
|
+
FontSizes["fontSize20"] = "20";
|
|
435
|
+
FontSizes["fontSize24"] = "24";
|
|
436
|
+
FontSizes["fontSize28"] = "28";
|
|
437
|
+
FontSizes["fontSize32"] = "32";
|
|
438
|
+
FontSizes["fontSize40"] = "40";
|
|
439
|
+
FontSizes["fontSize48"] = "48";
|
|
440
|
+
})(exports.FontSizes || (exports.FontSizes = {}));
|
|
441
|
+
var FontSizeTypes = [
|
|
442
|
+
exports.FontSizes.fontSize12,
|
|
443
|
+
exports.FontSizes.fontSize13,
|
|
444
|
+
exports.FontSizes.fontSize14,
|
|
445
|
+
exports.FontSizes.fontSize15,
|
|
446
|
+
exports.FontSizes.fontSize16,
|
|
447
|
+
exports.FontSizes.fontSize20,
|
|
448
|
+
exports.FontSizes.fontSize24,
|
|
449
|
+
exports.FontSizes.fontSize28,
|
|
450
|
+
exports.FontSizes.fontSize32,
|
|
451
|
+
exports.FontSizes.fontSize40,
|
|
452
|
+
exports.FontSizes.fontSize48
|
|
453
|
+
];
|
|
425
454
|
exports.MarkTypes = void 0;
|
|
426
455
|
(function (MarkTypes) {
|
|
427
456
|
MarkTypes["bold"] = "bold";
|
|
@@ -430,8 +459,8 @@
|
|
|
430
459
|
MarkTypes["strike"] = "strike";
|
|
431
460
|
MarkTypes["color"] = "color";
|
|
432
461
|
MarkTypes["backgroundColor"] = "background-color";
|
|
433
|
-
MarkTypes["codeLine"] = "code-line";
|
|
434
462
|
MarkTypes["fontSize"] = "font-size";
|
|
463
|
+
MarkTypes["codeLine"] = "code-line";
|
|
435
464
|
})(exports.MarkTypes || (exports.MarkTypes = {}));
|
|
436
465
|
exports.ToolbarActionTypes = void 0;
|
|
437
466
|
(function (ToolbarActionTypes) {
|
|
@@ -456,12 +485,12 @@
|
|
|
456
485
|
var MarkProps = [
|
|
457
486
|
exports.MarkTypes.backgroundColor,
|
|
458
487
|
exports.MarkTypes.bold,
|
|
459
|
-
exports.MarkTypes.codeLine,
|
|
460
488
|
exports.MarkTypes.color,
|
|
461
489
|
exports.MarkTypes.italic,
|
|
462
490
|
exports.MarkTypes.strike,
|
|
463
491
|
exports.MarkTypes.underline,
|
|
464
|
-
exports.MarkTypes.fontSize
|
|
492
|
+
exports.MarkTypes.fontSize,
|
|
493
|
+
exports.MarkTypes.codeLine
|
|
465
494
|
];
|
|
466
495
|
var THE_INLINE_TOOLBAR_TYPES = [exports.ElementKinds.default, exports.ElementKinds.listItem, exports.ElementKinds.checkItem];
|
|
467
496
|
var STANDARD_HEADING_TYPES = [
|
|
@@ -497,7 +526,7 @@
|
|
|
497
526
|
exports.MarkTypes.italic,
|
|
498
527
|
exports.MarkTypes.underline,
|
|
499
528
|
exports.MarkTypes.strike,
|
|
500
|
-
exports.
|
|
529
|
+
exports.ElementKinds.inlineCode,
|
|
501
530
|
exports.MarkTypes.color,
|
|
502
531
|
exports.MarkTypes.backgroundColor,
|
|
503
532
|
exports.ToolbarActionTypes.split,
|
|
@@ -506,7 +535,7 @@
|
|
|
506
535
|
exports.ToolbarActionTypes.split,
|
|
507
536
|
exports.ElementKinds.numberedList,
|
|
508
537
|
exports.ElementKinds.bulletedList,
|
|
509
|
-
|
|
538
|
+
// ElementKinds.checkItem,
|
|
510
539
|
exports.ToolbarActionTypes.split,
|
|
511
540
|
exports.ElementKinds.link,
|
|
512
541
|
exports.ElementKinds.image,
|
|
@@ -521,7 +550,7 @@
|
|
|
521
550
|
exports.MarkTypes.italic,
|
|
522
551
|
exports.MarkTypes.underline,
|
|
523
552
|
exports.MarkTypes.strike,
|
|
524
|
-
exports.
|
|
553
|
+
exports.ElementKinds.inlineCode,
|
|
525
554
|
exports.MarkTypes.color,
|
|
526
555
|
exports.MarkTypes.backgroundColor,
|
|
527
556
|
exports.ToolbarActionTypes.split,
|
|
@@ -533,7 +562,7 @@
|
|
|
533
562
|
exports.ToolbarActionTypes.split,
|
|
534
563
|
exports.ElementKinds.numberedList,
|
|
535
564
|
exports.ElementKinds.bulletedList,
|
|
536
|
-
|
|
565
|
+
// ElementKinds.checkItem,
|
|
537
566
|
exports.ToolbarActionTypes.split,
|
|
538
567
|
exports.ElementKinds.link,
|
|
539
568
|
exports.ElementKinds.image,
|
|
@@ -2136,6 +2165,50 @@
|
|
|
2136
2165
|
}
|
|
2137
2166
|
};
|
|
2138
2167
|
|
|
2168
|
+
var InlineCodeEditor = {
|
|
2169
|
+
toggleInlineCode: function (editor, text) {
|
|
2170
|
+
var isActive = InlineCodeEditor.isInlineCodeActive(editor);
|
|
2171
|
+
if (isActive) {
|
|
2172
|
+
InlineCodeEditor.unwrapInlineCode(editor);
|
|
2173
|
+
return;
|
|
2174
|
+
}
|
|
2175
|
+
if (slate.Range.isCollapsed(editor.selection)) {
|
|
2176
|
+
InlineCodeEditor.wrapInlineCode(editor, text);
|
|
2177
|
+
}
|
|
2178
|
+
else {
|
|
2179
|
+
var fragment = slate.Node.fragment(editor, editor.selection)[0];
|
|
2180
|
+
var selectNode = slate.Node.get(fragment, []);
|
|
2181
|
+
var selectText = slate.Node.string(selectNode);
|
|
2182
|
+
InlineCodeEditor.wrapInlineCode(editor, selectText);
|
|
2183
|
+
}
|
|
2184
|
+
},
|
|
2185
|
+
wrapInlineCode: function (editor, text) {
|
|
2186
|
+
if (text === void 0) { text = ''; }
|
|
2187
|
+
if (InlineCodeEditor.isInlineCodeActive(editor)) {
|
|
2188
|
+
InlineCodeEditor.unwrapInlineCode(editor);
|
|
2189
|
+
}
|
|
2190
|
+
var selection = editor.selection;
|
|
2191
|
+
var isCollapsed = selection && slate.Range.isCollapsed(selection);
|
|
2192
|
+
var inlineCode = {
|
|
2193
|
+
type: exports.ElementKinds.inlineCode,
|
|
2194
|
+
children: isCollapsed ? [{ text: text ? text : ZERO_WIDTH_CHAR }] : []
|
|
2195
|
+
};
|
|
2196
|
+
if (isCollapsed) {
|
|
2197
|
+
slate.Transforms.insertNodes(editor, inlineCode);
|
|
2198
|
+
}
|
|
2199
|
+
else {
|
|
2200
|
+
slate.Transforms.wrapNodes(editor, inlineCode, { split: true });
|
|
2201
|
+
}
|
|
2202
|
+
},
|
|
2203
|
+
unwrapInlineCode: function (editor) {
|
|
2204
|
+
slate.Transforms.unwrapNodes(editor, { match: function (n) { return slate.Element.isElement(n) && n.type === exports.ElementKinds.inlineCode; } });
|
|
2205
|
+
},
|
|
2206
|
+
isInlineCodeActive: function (editor) {
|
|
2207
|
+
var _a = __read(slate.Editor.nodes(editor, { match: function (n) { return slate.Element.isElement(n) && n.type === exports.ElementKinds.inlineCode; } }), 1), inlineCode = _a[0];
|
|
2208
|
+
return !!inlineCode;
|
|
2209
|
+
}
|
|
2210
|
+
};
|
|
2211
|
+
|
|
2139
2212
|
var autoFormatRules = [
|
|
2140
2213
|
{
|
|
2141
2214
|
type: exports.ElementKinds.heading_1,
|
|
@@ -2193,10 +2266,13 @@
|
|
|
2193
2266
|
insertTrigger: true
|
|
2194
2267
|
},
|
|
2195
2268
|
{
|
|
2196
|
-
type: exports.
|
|
2269
|
+
type: exports.ElementKinds.inlineCode,
|
|
2197
2270
|
between: ['`', '`'],
|
|
2198
2271
|
mode: 'inline',
|
|
2199
|
-
|
|
2272
|
+
format: function (editor, text) {
|
|
2273
|
+
InlineCodeEditor.toggleInlineCode(editor, text);
|
|
2274
|
+
slate.Transforms.select(editor, slate.Editor.after(editor, editor.selection));
|
|
2275
|
+
}
|
|
2200
2276
|
},
|
|
2201
2277
|
{
|
|
2202
2278
|
type: exports.MarkTypes.strike,
|
|
@@ -2421,7 +2497,7 @@
|
|
|
2421
2497
|
editor: editor,
|
|
2422
2498
|
conversion: function () {
|
|
2423
2499
|
try {
|
|
2424
|
-
var html = marked__default["default"](plainFragment, { gfm: true });
|
|
2500
|
+
var html = marked__default["default"](plainFragment.replace(/\n```/g, "\n\n```"), { gfm: true });
|
|
2425
2501
|
var htmlDom = new DOMParser().parseFromString(html, 'text/html');
|
|
2426
2502
|
var fragment_1 = selene.TheiaConverter.convertToTheia(Array.from(htmlDom.body.children));
|
|
2427
2503
|
if (!isUnformatted(fragment_1)) {
|
|
@@ -2681,6 +2757,13 @@
|
|
|
2681
2757
|
}
|
|
2682
2758
|
return this.options;
|
|
2683
2759
|
};
|
|
2760
|
+
TheContextService.prototype.getTheOptions = function () {
|
|
2761
|
+
return this.options.theOptions;
|
|
2762
|
+
};
|
|
2763
|
+
TheContextService.prototype.getDefaultFontSize = function () {
|
|
2764
|
+
var _a;
|
|
2765
|
+
return ((_a = this.options.theOptions) === null || _a === void 0 ? void 0 : _a.fontSize) || exports.FontSizes.fontSize14;
|
|
2766
|
+
};
|
|
2684
2767
|
TheContextService.prototype.getEditableElement = function () {
|
|
2685
2768
|
return this.options.nativeElement.querySelector('.the-editor-typo');
|
|
2686
2769
|
};
|
|
@@ -3811,9 +3894,84 @@
|
|
|
3811
3894
|
TheListItemComponent.prototype.ngOnInit = function () {
|
|
3812
3895
|
_super.prototype.ngOnInit.call(this);
|
|
3813
3896
|
};
|
|
3897
|
+
TheListItemComponent.prototype.onContextChange = function () {
|
|
3898
|
+
_super.prototype.onContextChange.call(this);
|
|
3899
|
+
this.addFontSize();
|
|
3900
|
+
this.addMultiDigit();
|
|
3901
|
+
};
|
|
3814
3902
|
TheListItemComponent.prototype.ngOnDestroy = function () {
|
|
3815
3903
|
_super.prototype.ngOnDestroy.call(this);
|
|
3816
3904
|
};
|
|
3905
|
+
TheListItemComponent.prototype.addFontSize = function () {
|
|
3906
|
+
var e_1, _c;
|
|
3907
|
+
var _a, _b;
|
|
3908
|
+
var firstText;
|
|
3909
|
+
try {
|
|
3910
|
+
for (var _d = __values(slate.Node.descendants(this.element)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
3911
|
+
var entry = _e.value;
|
|
3912
|
+
var node = entry[0];
|
|
3913
|
+
if (slate.Text.isText(node) && !firstText) {
|
|
3914
|
+
firstText = node;
|
|
3915
|
+
break;
|
|
3916
|
+
}
|
|
3917
|
+
}
|
|
3918
|
+
}
|
|
3919
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3920
|
+
finally {
|
|
3921
|
+
try {
|
|
3922
|
+
if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
|
|
3923
|
+
}
|
|
3924
|
+
finally { if (e_1) throw e_1.error; }
|
|
3925
|
+
}
|
|
3926
|
+
if (!firstText) {
|
|
3927
|
+
return;
|
|
3928
|
+
}
|
|
3929
|
+
var text = firstText.text, rest = __rest(firstText, ["text"]);
|
|
3930
|
+
var size = rest[exports.MarkTypes.fontSize];
|
|
3931
|
+
if (size) {
|
|
3932
|
+
var sizeClass = "font-size-" + size;
|
|
3933
|
+
var isContains = (_b = (_a = this.elementRef.nativeElement) === null || _a === void 0 ? void 0 : _a.classList) === null || _b === void 0 ? void 0 : _b.contains(sizeClass);
|
|
3934
|
+
if (isContains) {
|
|
3935
|
+
return;
|
|
3936
|
+
}
|
|
3937
|
+
this.clearFontSize();
|
|
3938
|
+
this.elementRef.nativeElement.classList.add(sizeClass);
|
|
3939
|
+
this.fontSizeClass = sizeClass;
|
|
3940
|
+
}
|
|
3941
|
+
else {
|
|
3942
|
+
this.clearFontSize();
|
|
3943
|
+
}
|
|
3944
|
+
};
|
|
3945
|
+
TheListItemComponent.prototype.clearFontSize = function () {
|
|
3946
|
+
if (this.fontSizeClass) {
|
|
3947
|
+
this.elementRef.nativeElement.classList.remove(this.fontSizeClass);
|
|
3948
|
+
this.fontSizeClass = null;
|
|
3949
|
+
}
|
|
3950
|
+
};
|
|
3951
|
+
TheListItemComponent.prototype.getStart = function () {
|
|
3952
|
+
var parent = this.elementRef.nativeElement.closest('.slate-element-numbered-list');
|
|
3953
|
+
var start = (parent === null || parent === void 0 ? void 0 : parent.getAttribute('start')) || 1;
|
|
3954
|
+
return Number(start);
|
|
3955
|
+
};
|
|
3956
|
+
TheListItemComponent.prototype.getLiIndex = function () {
|
|
3957
|
+
var path = findPath(this.editor, this.element);
|
|
3958
|
+
var index = path[path.length - 1];
|
|
3959
|
+
return index || 0;
|
|
3960
|
+
};
|
|
3961
|
+
TheListItemComponent.prototype.addMultiDigit = function () {
|
|
3962
|
+
var start = this.getStart();
|
|
3963
|
+
var index = this.getLiIndex();
|
|
3964
|
+
var multiDigit = 'data-multi-digit';
|
|
3965
|
+
// start number + index
|
|
3966
|
+
// when it is greater than 9, it is a multi-digit serial number
|
|
3967
|
+
// exclude Font size >= 20
|
|
3968
|
+
if (start + index > 9) {
|
|
3969
|
+
this.elementRef.nativeElement.setAttribute(multiDigit, true);
|
|
3970
|
+
}
|
|
3971
|
+
else {
|
|
3972
|
+
this.elementRef.nativeElement.removeAttribute(multiDigit);
|
|
3973
|
+
}
|
|
3974
|
+
};
|
|
3817
3975
|
return TheListItemComponent;
|
|
3818
3976
|
}(TheBaseElementComponent));
|
|
3819
3977
|
TheListItemComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheListItemComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
@@ -4322,11 +4480,14 @@
|
|
|
4322
4480
|
delete marks[key];
|
|
4323
4481
|
editor.marks = marks;
|
|
4324
4482
|
var text = slate.Editor.string(e, selection.anchor.path);
|
|
4325
|
-
if (text
|
|
4326
|
-
slate.
|
|
4483
|
+
if (text !== '') {
|
|
4484
|
+
slate.Editor.setNormalizing(editor, false);
|
|
4485
|
+
e.insertText('');
|
|
4486
|
+
editor.marks = marks;
|
|
4487
|
+
slate.Editor.setNormalizing(editor, true);
|
|
4327
4488
|
}
|
|
4328
|
-
|
|
4329
|
-
e.
|
|
4489
|
+
else {
|
|
4490
|
+
slate.Transforms.unsetNodes(e, key, { at: selection.anchor.path });
|
|
4330
4491
|
}
|
|
4331
4492
|
if (shouldChange) {
|
|
4332
4493
|
editor.onChange();
|
|
@@ -4345,11 +4506,14 @@
|
|
|
4345
4506
|
var marks = Object.assign(Object.assign({}, (slate.Editor.marks(e) || {})), (_b = {}, _b[key] = value, _b));
|
|
4346
4507
|
editor.marks = marks;
|
|
4347
4508
|
var text = slate.Editor.string(e, selection.anchor.path);
|
|
4348
|
-
if (text
|
|
4349
|
-
slate.
|
|
4509
|
+
if (text !== '') {
|
|
4510
|
+
slate.Editor.setNormalizing(editor, false);
|
|
4511
|
+
e.insertText('');
|
|
4512
|
+
editor.marks = marks;
|
|
4513
|
+
slate.Editor.setNormalizing(editor, true);
|
|
4350
4514
|
}
|
|
4351
|
-
|
|
4352
|
-
|
|
4515
|
+
else {
|
|
4516
|
+
slate.Transforms.setNodes(e, (_c = {}, _c[key] = value, _c), { at: selection.anchor.path });
|
|
4353
4517
|
}
|
|
4354
4518
|
}
|
|
4355
4519
|
}
|
|
@@ -4427,7 +4591,7 @@
|
|
|
4427
4591
|
};
|
|
4428
4592
|
|
|
4429
4593
|
var autoFormatInline = function (editor, _a) {
|
|
4430
|
-
var type = _a.type, between = _a.between, markup = _a.markup, ignoreTrim = _a.ignoreTrim;
|
|
4594
|
+
var type = _a.type, between = _a.between, markup = _a.markup, ignoreTrim = _a.ignoreTrim, format = _a.format;
|
|
4431
4595
|
var selection = editor.selection;
|
|
4432
4596
|
var startMarkup = between ? between[0] : markup;
|
|
4433
4597
|
var endMarkup = between ? between[1] : '';
|
|
@@ -4471,22 +4635,35 @@
|
|
|
4471
4635
|
}
|
|
4472
4636
|
});
|
|
4473
4637
|
}
|
|
4474
|
-
// add mark to the text between the markups
|
|
4475
|
-
slate.Transforms.select(editor, markupRange);
|
|
4476
|
-
editor.addMark(type, true);
|
|
4477
|
-
slate.Transforms.collapse(editor, { edge: 'end' });
|
|
4478
|
-
editor.removeMark(type, false);
|
|
4479
|
-
// delete start markup
|
|
4480
4638
|
var startMarkupPointBefore = getPointBefore(editor, selection, {
|
|
4481
4639
|
matchString: startMarkup,
|
|
4482
4640
|
skipInvalid: true
|
|
4483
4641
|
});
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4642
|
+
if (format) {
|
|
4643
|
+
var markupText = getText(editor, markupRange);
|
|
4644
|
+
format(editor, markupText);
|
|
4645
|
+
// delete start to end selection
|
|
4646
|
+
slate.Transforms.delete(editor, {
|
|
4647
|
+
at: {
|
|
4648
|
+
anchor: startMarkupPointBefore,
|
|
4649
|
+
focus: selection.anchor
|
|
4650
|
+
}
|
|
4651
|
+
});
|
|
4652
|
+
}
|
|
4653
|
+
else {
|
|
4654
|
+
// add mark to the text between the markups
|
|
4655
|
+
slate.Transforms.select(editor, markupRange);
|
|
4656
|
+
editor.addMark(type, true);
|
|
4657
|
+
slate.Transforms.collapse(editor, { edge: 'end' });
|
|
4658
|
+
editor.removeMark(type, false);
|
|
4659
|
+
// delete start markup
|
|
4660
|
+
slate.Transforms.delete(editor, {
|
|
4661
|
+
at: {
|
|
4662
|
+
anchor: startMarkupPointBefore,
|
|
4663
|
+
focus: startMarkupPointAfter
|
|
4664
|
+
}
|
|
4665
|
+
});
|
|
4666
|
+
}
|
|
4490
4667
|
return true;
|
|
4491
4668
|
};
|
|
4492
4669
|
|
|
@@ -4562,6 +4739,7 @@
|
|
|
4562
4739
|
type: type,
|
|
4563
4740
|
between: between,
|
|
4564
4741
|
ignoreTrim: ignoreTrim,
|
|
4742
|
+
format: format,
|
|
4565
4743
|
markup: Array.isArray(markup) ? markup[0] : markup
|
|
4566
4744
|
})) {
|
|
4567
4745
|
return { value: valid() };
|
|
@@ -5961,14 +6139,6 @@
|
|
|
5961
6139
|
shortcutKey: CONTROL_KEY + "+U",
|
|
5962
6140
|
execute: function (editor) { return MarkEditor.toggleMark(editor, exports.MarkTypes.underline); },
|
|
5963
6141
|
active: function (editor) { return MarkEditor.isMarkActive(editor, exports.MarkTypes.underline); }
|
|
5964
|
-
},
|
|
5965
|
-
{
|
|
5966
|
-
key: exports.MarkTypes.codeLine,
|
|
5967
|
-
icon: 'code',
|
|
5968
|
-
name: '行内代码',
|
|
5969
|
-
shortcutKey: CONTROL_KEY + "+E",
|
|
5970
|
-
execute: function (editor) { return MarkEditor.toggleMark(editor, exports.MarkTypes.codeLine); },
|
|
5971
|
-
active: function (editor) { return MarkEditor.isMarkActive(editor, exports.MarkTypes.codeLine); }
|
|
5972
6142
|
}
|
|
5973
6143
|
];
|
|
5974
6144
|
|
|
@@ -6018,6 +6188,7 @@
|
|
|
6018
6188
|
var HeadingEditor = {
|
|
6019
6189
|
setHeading: function (editor, heading) {
|
|
6020
6190
|
slate.Editor.withoutNormalizing(editor, function () {
|
|
6191
|
+
var _a;
|
|
6021
6192
|
var types = [exports.ElementKinds.bulletedList, exports.ElementKinds.numberedList, exports.ElementKinds.listItem];
|
|
6022
6193
|
slate.Transforms.unwrapNodes(editor, {
|
|
6023
6194
|
at: editor.selection,
|
|
@@ -6026,6 +6197,15 @@
|
|
|
6026
6197
|
split: true
|
|
6027
6198
|
});
|
|
6028
6199
|
slate.Transforms.setNodes(editor, { type: heading });
|
|
6200
|
+
var entry = anchorBlockEntry(editor);
|
|
6201
|
+
var unMarks = (_a = {},
|
|
6202
|
+
_a[exports.MarkTypes.fontSize] = null,
|
|
6203
|
+
_a);
|
|
6204
|
+
if (entry) {
|
|
6205
|
+
setMarks(editor, unMarks, entry[1]);
|
|
6206
|
+
return;
|
|
6207
|
+
}
|
|
6208
|
+
setMarks(editor, unMarks, editor.selection);
|
|
6029
6209
|
});
|
|
6030
6210
|
},
|
|
6031
6211
|
isHeadingActive: function (editor, heading) {
|
|
@@ -6042,6 +6222,7 @@
|
|
|
6042
6222
|
name: '正文',
|
|
6043
6223
|
key: exports.ElementKinds.headingList,
|
|
6044
6224
|
type: exports.ToolbarItemType.toolDropdown,
|
|
6225
|
+
dropdownItemKey: exports.ElementKinds.paragraph,
|
|
6045
6226
|
includes: __spreadArray([exports.ElementKinds.paragraph], __read(STANDARD_HEADING_TYPES))
|
|
6046
6227
|
},
|
|
6047
6228
|
{
|
|
@@ -6136,6 +6317,7 @@
|
|
|
6136
6317
|
key: exports.ToolbarActionTypes.alignType,
|
|
6137
6318
|
type: exports.ToolbarItemType.toolDropdown,
|
|
6138
6319
|
dropdownMode: exports.DropdownMode.icon,
|
|
6320
|
+
dropdownItemKey: exports.ToolbarActionTypes.alignLeft,
|
|
6139
6321
|
includes: [exports.ToolbarActionTypes.alignLeft, exports.ToolbarActionTypes.alignCenter, exports.ToolbarActionTypes.alignRight],
|
|
6140
6322
|
name: '对齐方式'
|
|
6141
6323
|
},
|
|
@@ -6734,6 +6916,7 @@
|
|
|
6734
6916
|
_this.overlay = overlay;
|
|
6735
6917
|
_this.mode = exports.DropdownMode.text;
|
|
6736
6918
|
_this.dropdownMode = exports.DropdownMode;
|
|
6919
|
+
_this.disabled = false;
|
|
6737
6920
|
return _this;
|
|
6738
6921
|
}
|
|
6739
6922
|
Object.defineProperty(TheToolbarDropdownComponent.prototype, "item", {
|
|
@@ -6757,7 +6940,7 @@
|
|
|
6757
6940
|
TheToolbarDropdownComponent.prototype.toggleDropdown = function (event) {
|
|
6758
6941
|
var _a;
|
|
6759
6942
|
_super.prototype.execute.call(this, event);
|
|
6760
|
-
if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.disabled) {
|
|
6943
|
+
if (((_a = this.editor) === null || _a === void 0 ? void 0 : _a.disabled) || this.disabled) {
|
|
6761
6944
|
return;
|
|
6762
6945
|
}
|
|
6763
6946
|
this.openDropdownPopover();
|
|
@@ -6767,6 +6950,13 @@
|
|
|
6767
6950
|
this.closeDropdownPopover();
|
|
6768
6951
|
}
|
|
6769
6952
|
};
|
|
6953
|
+
Object.defineProperty(TheToolbarDropdownComponent.prototype, "disabledState", {
|
|
6954
|
+
get: function () {
|
|
6955
|
+
return this.disabled;
|
|
6956
|
+
},
|
|
6957
|
+
enumerable: false,
|
|
6958
|
+
configurable: true
|
|
6959
|
+
});
|
|
6770
6960
|
TheToolbarDropdownComponent.prototype.ngOnInit = function () {
|
|
6771
6961
|
var _a;
|
|
6772
6962
|
if (!this.template) {
|
|
@@ -6780,12 +6970,14 @@
|
|
|
6780
6970
|
}
|
|
6781
6971
|
};
|
|
6782
6972
|
TheToolbarDropdownComponent.prototype.statusChange = function (editor) {
|
|
6973
|
+
var _a, _b;
|
|
6974
|
+
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;
|
|
6783
6975
|
var activeItem = this.menus.find(function (i) {
|
|
6784
6976
|
if (i === null || i === void 0 ? void 0 : i.active) {
|
|
6785
6977
|
return i === null || i === void 0 ? void 0 : i.active(editor);
|
|
6786
6978
|
}
|
|
6787
6979
|
});
|
|
6788
|
-
this.activeMenu = activeItem ? activeItem : this.
|
|
6980
|
+
this.activeMenu = activeItem ? activeItem : this.item;
|
|
6789
6981
|
};
|
|
6790
6982
|
TheToolbarDropdownComponent.prototype.itemMousedown = function (event, item) {
|
|
6791
6983
|
_super.prototype.execute.call(this, event);
|
|
@@ -6840,7 +7032,7 @@
|
|
|
6840
7032
|
return TheToolbarDropdownComponent;
|
|
6841
7033
|
}(TheToolbarBaseItemComponent));
|
|
6842
7034
|
TheToolbarDropdownComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheToolbarDropdownComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i1__namespace$3.ThyPopover }, { token: i0__namespace.ViewContainerRef }, { token: i2__namespace.Overlay }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
6843
|
-
TheToolbarDropdownComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarDropdownComponent, selector: "the-toolbar-dropdown", inputs: { toolbarItem: "toolbarItem", menus: "menus", mode: "mode", item: "item", itemMousedownHandle: "itemMousedownHandle" }, host: { listeners: { "mousedown": "toggleDropdown($event)", "document: mousedown": "handleDocumentMouseDown($event)" }, classAttribute: "the-toolbar-dropdown-container" }, viewQueries: [{ propertyName: "iconModeTemplate", first: true, predicate: ["iconModeTemplate"], descendants: true, static: true }, { propertyName: "textModeTemplate", first: true, predicate: ["textModeTemplate"], descendants: true, static: true }, { propertyName: "dropdownTemplate", first: true, predicate: ["dropdownTemplate"], descendants: true, static: true }], usesInheritance: true, ngImport: i0__namespace, template: "<ng-template [ngTemplateOutlet]=\"template\"></ng-template>\n\n<ng-template #iconModeTemplate>\n <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</ng-template>\n\n<ng-template #textModeTemplate>\n <a thyIconNavLink class=\"text-mode\" [thyTooltip]=\"activeMenu?.name\" thyTooltipPlacement=\"top\">\n <span class=\"show-text\">{{ activeMenu?.name }}</span>\n <thy-icon class=\"text-caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n </a>\n</ng-template>\n\n<ng-template #dropdownTemplate>\n <thy-action-menu class=\"dropdown\">\n <ng-container *ngFor=\"let menu of menus\">\n <a\n *ngIf=\"menu.key !== 'split'\"\n thyActionMenuItem\n href=\"javascript:;\"\n [thyActionMenuItemActive]=\"menu.key === activeMenu.key\"\n (mousedown)=\"itemMousedown($event, menu)\"\n [ngStyle]=\"menu?.styles\"\n >\n <span *ngIf=\"menu.icon && mode === dropdownMode.icon\" thyActionMenuItemIcon>\n <thy-icon [thyIconName]=\"menu.icon\"></thy-icon>\n </span>\n <span *ngIf=\"menu.name\" thyActionMenuItemName>{{ menu.name }}</span>\n </a>\n <thy-action-menu-divider *ngIf=\"menu.key === 'split'\"></thy-action-menu-divider>\n </ng-container>\n </thy-action-menu>\n</ng-template>\n", components: [{ type: i3__namespace.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4__namespace$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i5__namespace$2.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }, { type: i5__namespace$2.ThyActionMenuDividerComponent, selector: "thy-action-menu-divider", inputs: ["thyTitle", "thyType"] }], directives: [{ type: i6__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i5__namespace$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5__namespace$2.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i5__namespace$2.ThyActionMenuItemActiveDirective, selector: "[thyActionMenuItemActive]", inputs: ["thyActionMenuItemActive"] }, { type: i6__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i5__namespace$2.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i5__namespace$2.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }] });
|
|
7035
|
+
TheToolbarDropdownComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarDropdownComponent, selector: "the-toolbar-dropdown", inputs: { toolbarItem: "toolbarItem", menus: "menus", mode: "mode", item: "item", itemMousedownHandle: "itemMousedownHandle" }, host: { listeners: { "mousedown": "toggleDropdown($event)", "document: mousedown": "handleDocumentMouseDown($event)" }, properties: { "class.disabled": "this.disabledState" }, classAttribute: "the-toolbar-dropdown-container" }, viewQueries: [{ propertyName: "iconModeTemplate", first: true, predicate: ["iconModeTemplate"], descendants: true, static: true }, { propertyName: "textModeTemplate", first: true, predicate: ["textModeTemplate"], descendants: true, static: true }, { propertyName: "dropdownTemplate", first: true, predicate: ["dropdownTemplate"], descendants: true, static: true }], usesInheritance: true, ngImport: i0__namespace, template: "<ng-template [ngTemplateOutlet]=\"template\"></ng-template>\n\n<ng-template #iconModeTemplate>\n <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</ng-template>\n\n<ng-template #textModeTemplate>\n <a thyIconNavLink class=\"text-mode\" [thyTooltip]=\"activeMenu?.name\" thyTooltipPlacement=\"top\">\n <span class=\"show-text\">{{ activeMenu?.name }}</span>\n <thy-icon class=\"text-caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n </a>\n</ng-template>\n\n<ng-template #dropdownTemplate>\n <thy-action-menu class=\"dropdown\">\n <ng-container *ngFor=\"let menu of menus\">\n <a\n *ngIf=\"menu.key !== 'split'\"\n thyActionMenuItem\n href=\"javascript:;\"\n [thyActionMenuItemActive]=\"menu.key === activeMenu.key\"\n (mousedown)=\"itemMousedown($event, menu)\"\n [ngStyle]=\"menu?.styles\"\n >\n <span *ngIf=\"menu.icon && mode === dropdownMode.icon\" thyActionMenuItemIcon>\n <thy-icon [thyIconName]=\"menu.icon\"></thy-icon>\n </span>\n <span *ngIf=\"menu.name\" thyActionMenuItemName>{{ menu.name }}</span>\n </a>\n <thy-action-menu-divider *ngIf=\"menu.key === 'split'\"></thy-action-menu-divider>\n </ng-container>\n </thy-action-menu>\n</ng-template>\n", components: [{ type: i3__namespace.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4__namespace$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i5__namespace$2.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }, { type: i5__namespace$2.ThyActionMenuDividerComponent, selector: "thy-action-menu-divider", inputs: ["thyTitle", "thyType"] }], directives: [{ type: i6__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i5__namespace$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5__namespace$2.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i5__namespace$2.ThyActionMenuItemActiveDirective, selector: "[thyActionMenuItemActive]", inputs: ["thyActionMenuItemActive"] }, { type: i6__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i5__namespace$2.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i5__namespace$2.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }] });
|
|
6844
7036
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheToolbarDropdownComponent, decorators: [{
|
|
6845
7037
|
type: i0.Component,
|
|
6846
7038
|
args: [{
|
|
@@ -6875,6 +7067,9 @@
|
|
|
6875
7067
|
}], handleDocumentMouseDown: [{
|
|
6876
7068
|
type: i0.HostListener,
|
|
6877
7069
|
args: ['document: mousedown', ['$event']]
|
|
7070
|
+
}], disabledState: [{
|
|
7071
|
+
type: i0.HostBinding,
|
|
7072
|
+
args: ['class.disabled']
|
|
6878
7073
|
}] } });
|
|
6879
7074
|
|
|
6880
7075
|
var NavSplitLineComponent = /** @class */ (function () {
|
|
@@ -6936,8 +7131,9 @@
|
|
|
6936
7131
|
_this.menus = CODE_MODES.map(function (item) {
|
|
6937
7132
|
return { key: item.value, name: item.showName };
|
|
6938
7133
|
});
|
|
7134
|
+
_this.destroy$ = new rxjs.Subject();
|
|
6939
7135
|
_this.ToolbarItemMode = exports.ToolbarItemMode;
|
|
6940
|
-
_this.
|
|
7136
|
+
_this.isHightLight = false;
|
|
6941
7137
|
_this.resizeHeight = null;
|
|
6942
7138
|
_this.options = {
|
|
6943
7139
|
mode: _this.menus[0].key,
|
|
@@ -6979,13 +7175,22 @@
|
|
|
6979
7175
|
if (this.resizeHeight !== this.element.height) {
|
|
6980
7176
|
this.useHeight();
|
|
6981
7177
|
}
|
|
6982
|
-
if (!this.isCollapsed) {
|
|
6983
|
-
this.isFocusCode = false;
|
|
6984
|
-
}
|
|
6985
7178
|
}
|
|
6986
7179
|
};
|
|
6987
7180
|
TheCodeComponent.prototype.ngOnInit = function () {
|
|
7181
|
+
var _this = this;
|
|
6988
7182
|
_super.prototype.ngOnInit.call(this);
|
|
7183
|
+
this.ngZone.runOutsideAngular(function () {
|
|
7184
|
+
rxjs.fromEvent(_this.nativeElement, 'mousedown')
|
|
7185
|
+
.pipe(operators.takeUntil(_this.destroy$))
|
|
7186
|
+
.subscribe(function (event) {
|
|
7187
|
+
event.stopPropagation();
|
|
7188
|
+
var isBlockOperation = _this.isCollapsed &&
|
|
7189
|
+
_this.nativeElement.querySelector('.the-code-block-operation').contains(event.target);
|
|
7190
|
+
var isCodemirror = _this.nativeElement.querySelector('.ng-codemirror').contains(event.target);
|
|
7191
|
+
_this.isHightLight = !isCodemirror && !isBlockOperation;
|
|
7192
|
+
});
|
|
7193
|
+
});
|
|
6989
7194
|
this.elementRef.nativeElement.classList.add('the-code-container');
|
|
6990
7195
|
};
|
|
6991
7196
|
TheCodeComponent.prototype.ngAfterViewInit = function () {
|
|
@@ -7029,11 +7234,11 @@
|
|
|
7029
7234
|
}
|
|
7030
7235
|
};
|
|
7031
7236
|
TheCodeComponent.prototype.codeChange = function ($event) {
|
|
7237
|
+
this.isHightLight = false;
|
|
7032
7238
|
CodeEditor.setCodeAttribute(this.editor, this.element, { content: $event });
|
|
7033
7239
|
};
|
|
7034
7240
|
TheCodeComponent.prototype.onDelete = function (event) {
|
|
7035
7241
|
event.preventDefault();
|
|
7036
|
-
this.isFocusCode = false;
|
|
7037
7242
|
deleteElement(this.editor, this.element);
|
|
7038
7243
|
};
|
|
7039
7244
|
TheCodeComponent.prototype.onCopy = function (event) {
|
|
@@ -7051,8 +7256,9 @@
|
|
|
7051
7256
|
i1.AngularEditor.deselect(this.editor);
|
|
7052
7257
|
};
|
|
7053
7258
|
TheCodeComponent.prototype.focusChange = function (codeMirrorFocused) {
|
|
7054
|
-
if (codeMirrorFocused)
|
|
7055
|
-
this.
|
|
7259
|
+
if (codeMirrorFocused) {
|
|
7260
|
+
this.isHightLight = false;
|
|
7261
|
+
}
|
|
7056
7262
|
};
|
|
7057
7263
|
TheCodeComponent.prototype.useMode = function () {
|
|
7058
7264
|
var _this = this;
|
|
@@ -7081,13 +7287,18 @@
|
|
|
7081
7287
|
CodeEditor.setCodeAttribute(this.editor, this.element, { height: this.resizeHeight });
|
|
7082
7288
|
};
|
|
7083
7289
|
TheCodeComponent.prototype.onChangeWrap = function (value) {
|
|
7290
|
+
this.isHightLight = false;
|
|
7084
7291
|
this.options = Object.assign(Object.assign({}, this.options), { lineWrapping: value || false });
|
|
7085
7292
|
CodeEditor.setCodeAttribute(this.editor, this.element, { autoWrap: value ? value : null });
|
|
7086
7293
|
};
|
|
7294
|
+
TheCodeComponent.prototype.ngOnDestroy = function () {
|
|
7295
|
+
this.destroy$.next();
|
|
7296
|
+
this.destroy$.complete();
|
|
7297
|
+
};
|
|
7087
7298
|
return TheCodeComponent;
|
|
7088
7299
|
}(TheBaseElementComponent));
|
|
7089
7300
|
TheCodeComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheCodeComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }, { token: i1__namespace$4.ThyNotifyService }, { token: TheContextService }, { token: i0__namespace.NgZone }, { token: THE_CODE_MODE_TOKEN }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
7090
|
-
TheCodeComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheCodeComponent, selector: "div[theCode]", viewQueries: [{ propertyName: "codemirror", first: true, predicate: ["codemirror"], descendants: true, read: i8.CodeMirrorComponent }], usesInheritance: true, ngImport: i0__namespace, template: "<div contenteditable=\"false\" class=\"the-code-block-operation\" *ngIf=\"
|
|
7301
|
+
TheCodeComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheCodeComponent, selector: "div[theCode]", viewQueries: [{ propertyName: "codemirror", first: true, predicate: ["codemirror"], descendants: true, read: i8.CodeMirrorComponent }], usesInheritance: true, ngImport: i0__namespace, template: "<div contenteditable=\"false\" class=\"the-code-block-operation\" *ngIf=\"isCollapsed && codemirror && !options.readOnly\">\n <thy-icon-nav>\n <the-toolbar-dropdown [menus]=\"menus\" [item]=\"actives\" [itemMousedownHandle]=\"onChangeLangulage\"> </the-toolbar-dropdown>\n <a\n href=\"javascript:;\"\n thyIconNavLink\n thyIconNavLinkIcon=\"copy\"\n thyTooltip=\"\u590D\u5236\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"onCopy($event)\"\n ></a>\n <a\n href=\"javascript:;\"\n thyIconNavLink\n thyIconNavLinkIcon=\"trash\"\n thyTooltip=\"\u5220\u9664\"\n class=\"remove-link\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"onDelete($event)\"\n ></a>\n <nav-split-line [mode]=\"ToolbarItemMode.vertical\"></nav-split-line>\n <span class=\"auto-wrap d-flex align-items-center\">\n <span>\u81EA\u52A8\u6362\u884C</span>\n <thy-switch\n class=\"auto-wrap-btn d-flex\"\n [(ngModel)]=\"options.lineWrapping\"\n (ngModelChange)=\"onChangeWrap($event)\"\n thySize=\"sm\"\n ></thy-switch>\n </span>\n </thy-icon-nav>\n</div>\n\n<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n\n<!-- \u53EA\u8BFB\u6A21\u5F0F\u4E0BCodeMirror-sizer\u9AD8\u5EA6\u6BD4\u7F16\u8F91\u6A21\u5F0F\u4E0B\u591A2px\uFF0C\u8BBE\u7F6EthyMinHeight\u4E3A46px\u9632\u6B62\u62D6\u62FD\u5230\u6700\u5C0F\u9AD8\u5EA6\u65F6\u53EA\u8BFB\u6A21\u5F0F\u4E0B\u51FA\u73B0\u6EDA\u52A8\u6761 -->\n<div\n thyResizable\n [thyMinHeight]=\"46\"\n [thyBounds]=\"resizeBounds\"\n [style.height.px]=\"resizeHeight\"\n (thyResize)=\"onResize($event)\"\n (thyResizeEnd)=\"onEndResize()\"\n class=\"resize-code-container\"\n [ngClass]=\"{ focus: isCollapsed, readonly: options.readOnly, active: isHightLight && isCollapsed }\"\n>\n <ng-codemirror\n *ngIf=\"startRenderCodemirror\"\n #codemirror\n contenteditable=\"false\"\n class=\"ng-codemirror-wrapper\"\n [ngStyle]=\"{ maxHeight: maxHeight > 0 ? maxHeight + 'px' : 'auto' }\"\n [options]=\"options\"\n [ngModel]=\"code\"\n [delayRefreshTime]=\"300\"\n (ngModelChange)=\"codeChange($event)\"\n (focusChange)=\"focusChange($event)\"\n [autoMaxHeight]=\"maxHeight\"\n >\n </ng-codemirror>\n <thy-resize-handle thyDirection=\"bottom\" class=\"code-resize-icon\" *ngIf=\"isCollapsed && !options.readOnly\"></thy-resize-handle>\n</div>\n", components: [{ type: i3__namespace.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: TheToolbarDropdownComponent, selector: "the-toolbar-dropdown", inputs: ["toolbarItem", "menus", "mode", "item", "itemMousedownHandle"] }, { type: i3__namespace.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }, { type: i6__namespace$1.ThySwitchComponent, selector: "thy-switch", inputs: ["thyType", "thySize", "thyDisabled"], outputs: ["thyChange"] }, { type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i8__namespace.CodeMirrorComponent, selector: "ng-codemirror, [ngCodeMirror]", inputs: ["autoMaxHeight", "delayRefreshTime", "options"], outputs: ["focusChange"] }, { type: i9__namespace.ThyResizeHandleComponent, selector: "thy-resize-handle, [thy-resize-handle]", inputs: ["thyDirection"], outputs: ["thyMouseDown"], exportAs: ["thyResizeHandle"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5__namespace$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i4__namespace$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4__namespace$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i9__namespace.ThyResizableDirective, selector: "[thyResizable]", inputs: ["thyBounds", "thyMaxHeight", "thyMaxWidth", "thyMinHeight", "thyMinWidth", "thyGridColumnCount", "thyMaxColumn", "thyMinColumn", "thyLockAspectRatio", "thyPreview", "thyDisabled"], outputs: ["thyResize", "thyResizeEnd", "thyResizeStart"] }, { type: i6__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
7091
7302
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheCodeComponent, decorators: [{
|
|
7092
7303
|
type: i0.Component,
|
|
7093
7304
|
args: [{
|
|
@@ -7384,7 +7595,9 @@
|
|
|
7384
7595
|
}
|
|
7385
7596
|
};
|
|
7386
7597
|
TheBaseLinkComponent.prototype.mousedownHandle = function (event) {
|
|
7387
|
-
this.
|
|
7598
|
+
if (!this.readonly && !this.editor.disabled) {
|
|
7599
|
+
this.openLinkHover();
|
|
7600
|
+
}
|
|
7388
7601
|
};
|
|
7389
7602
|
TheBaseLinkComponent.prototype.openLinkEdit = function (tag) {
|
|
7390
7603
|
var _this = this;
|
|
@@ -11514,8 +11727,19 @@
|
|
|
11514
11727
|
_this.itemMode = exports.ToolbarItemMode.horizontal;
|
|
11515
11728
|
_this.ToolbarItemMode = exports.ToolbarItemMode;
|
|
11516
11729
|
_this.active = false;
|
|
11730
|
+
_this.disabled = false;
|
|
11517
11731
|
return _this;
|
|
11518
11732
|
}
|
|
11733
|
+
TheToolbarItemComponent.prototype.toggleDropdown = function (event) {
|
|
11734
|
+
_super.prototype.execute.call(this, event);
|
|
11735
|
+
};
|
|
11736
|
+
Object.defineProperty(TheToolbarItemComponent.prototype, "disabledState", {
|
|
11737
|
+
get: function () {
|
|
11738
|
+
return this.disabled;
|
|
11739
|
+
},
|
|
11740
|
+
enumerable: false,
|
|
11741
|
+
configurable: true
|
|
11742
|
+
});
|
|
11519
11743
|
TheToolbarItemComponent.prototype.ngOnInit = function () {
|
|
11520
11744
|
var _a, _b;
|
|
11521
11745
|
if (((_a = this.item) === null || _a === void 0 ? void 0 : _a.quickItemComponent) && i1.isComponentType((_b = this.item) === null || _b === void 0 ? void 0 : _b.quickItemComponent)) {
|
|
@@ -11523,13 +11747,14 @@
|
|
|
11523
11747
|
}
|
|
11524
11748
|
};
|
|
11525
11749
|
TheToolbarItemComponent.prototype.statusChange = function (editor) {
|
|
11526
|
-
var _a, _b;
|
|
11527
|
-
this.
|
|
11750
|
+
var _a, _b, _c, _d;
|
|
11751
|
+
this.disabled = ((_a = this.item) === null || _a === void 0 ? void 0 : _a.disable) ? (_b = this.item) === null || _b === void 0 ? void 0 : _b.disable(editor) : false;
|
|
11752
|
+
this.active = ((_c = this.item) === null || _c === void 0 ? void 0 : _c.active) ? (_d = this.item) === null || _d === void 0 ? void 0 : _d.active(editor) : false;
|
|
11528
11753
|
};
|
|
11529
11754
|
TheToolbarItemComponent.prototype.execute = function (event) {
|
|
11530
11755
|
var _a, _b, _c;
|
|
11531
11756
|
_super.prototype.execute.call(this, event);
|
|
11532
|
-
if (
|
|
11757
|
+
if (((_a = this.editor) === null || _a === void 0 ? void 0 : _a.disabled) || this.disabled || !((_b = this.item) === null || _b === void 0 ? void 0 : _b.execute)) {
|
|
11533
11758
|
return;
|
|
11534
11759
|
}
|
|
11535
11760
|
(_c = this.item) === null || _c === void 0 ? void 0 : _c.execute(this.editor);
|
|
@@ -11547,7 +11772,7 @@
|
|
|
11547
11772
|
return TheToolbarItemComponent;
|
|
11548
11773
|
}(TheToolbarBaseItemComponent));
|
|
11549
11774
|
TheToolbarItemComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheToolbarItemComponent, deps: [{ token: i0__namespace.NgZone }, { token: i0__namespace.ComponentFactoryResolver }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
11550
|
-
TheToolbarItemComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarItemComponent, selector: "the-toolbar-item", inputs: { item: "item", editor: "editor", itemMode: "itemMode" }, host: { classAttribute: "the-toolbar-item" }, viewQueries: [{ propertyName: "toolbarContainer", first: true, predicate: ["toolbarContainer"], descendants: true, read: i0.ViewContainerRef, static: true }], usesInheritance: true, ngImport: i0__namespace, template: "\n <ng-container *ngIf=\"itemMode === ToolbarItemMode.horizontal; else selectionItem\">\n <a\n thyIconNavLink\n [thyIconNavLinkIcon]=\"item.icon\"\n [thyTooltip]=\"tooltip\"\n [thyTooltipTemplateContext]=\"{ name: item.name, shortcutKey: item.shortcutKey }\"\n thyTooltipPlacement=\"top\"\n [thyIconNavLinkActive]=\"active\"\n (mousedown)=\"execute($event)\"\n ></a>\n </ng-container>\n <ng-template #selectionItem>\n <ng-container *ngIf=\"!item?.quickItemComponent\">\n <thy-icon [thyIconName]=\"item?.icon\" [thyIconRotate]=\"0\" class=\"quick-toolbar-icon\"></thy-icon>\n <span class=\"quick-toolbar-name\">{{ item?.name }}</span>\n </ng-container>\n </ng-template>\n <ng-template #tooltip let-data> {{ data.name }} {{ data.shortcutKey }} </ng-template>\n <ng-container #toolbarContainer></ng-container>\n ", isInline: true, components: [{ type: i3__namespace.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4__namespace$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5__namespace$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
|
|
11775
|
+
TheToolbarItemComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarItemComponent, selector: "the-toolbar-item", inputs: { item: "item", editor: "editor", itemMode: "itemMode" }, host: { listeners: { "mousedown": "toggleDropdown($event)" }, properties: { "class.disabled": "this.disabledState" }, classAttribute: "the-toolbar-item" }, viewQueries: [{ propertyName: "toolbarContainer", first: true, predicate: ["toolbarContainer"], descendants: true, read: i0.ViewContainerRef, static: true }], usesInheritance: true, ngImport: i0__namespace, template: "\n <ng-container *ngIf=\"itemMode === ToolbarItemMode.horizontal; else selectionItem\">\n <a\n thyIconNavLink\n [thyIconNavLinkIcon]=\"item.icon\"\n [thyTooltip]=\"tooltip\"\n [thyTooltipTemplateContext]=\"{ name: item.name, shortcutKey: item.shortcutKey }\"\n thyTooltipPlacement=\"top\"\n [thyIconNavLinkActive]=\"active\"\n (mousedown)=\"execute($event)\"\n ></a>\n </ng-container>\n <ng-template #selectionItem>\n <ng-container *ngIf=\"!item?.quickItemComponent\">\n <thy-icon [thyIconName]=\"item?.icon\" [thyIconRotate]=\"0\" class=\"quick-toolbar-icon\"></thy-icon>\n <span class=\"quick-toolbar-name\">{{ item?.name }}</span>\n </ng-container>\n </ng-template>\n <ng-template #tooltip let-data> {{ data.name }} {{ data.shortcutKey }} </ng-template>\n <ng-container #toolbarContainer></ng-container>\n ", isInline: true, components: [{ type: i3__namespace.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4__namespace$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5__namespace$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
|
|
11551
11776
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheToolbarItemComponent, decorators: [{
|
|
11552
11777
|
type: i0.Component,
|
|
11553
11778
|
args: [{
|
|
@@ -11566,6 +11791,12 @@
|
|
|
11566
11791
|
}], toolbarContainer: [{
|
|
11567
11792
|
type: i0.ViewChild,
|
|
11568
11793
|
args: ['toolbarContainer', { read: i0.ViewContainerRef, static: true }]
|
|
11794
|
+
}], toggleDropdown: [{
|
|
11795
|
+
type: i0.HostListener,
|
|
11796
|
+
args: ['mousedown', ['$event']]
|
|
11797
|
+
}], disabledState: [{
|
|
11798
|
+
type: i0.HostBinding,
|
|
11799
|
+
args: ['class.disabled']
|
|
11569
11800
|
}] } });
|
|
11570
11801
|
|
|
11571
11802
|
var TheQuickToolbarComponent = /** @class */ (function (_super) {
|
|
@@ -11738,141 +11969,181 @@
|
|
|
11738
11969
|
};
|
|
11739
11970
|
};
|
|
11740
11971
|
|
|
11741
|
-
var
|
|
11742
|
-
|
|
11743
|
-
|
|
11744
|
-
var
|
|
11745
|
-
|
|
11746
|
-
|
|
11747
|
-
|
|
11748
|
-
|
|
11749
|
-
_this.fontSizes = FontSizes;
|
|
11750
|
-
_this.disabled = false;
|
|
11751
|
-
_this.disableGroup = HEADING_TYPES;
|
|
11752
|
-
_this.toolbarItemContainer = true;
|
|
11753
|
-
_this.fontSizeToolbarItem = true;
|
|
11754
|
-
return _this;
|
|
11755
|
-
}
|
|
11756
|
-
Object.defineProperty(TheFontSizeToolbarItemComponent.prototype, "isOpen", {
|
|
11757
|
-
get: function () {
|
|
11758
|
-
return this.dropdownPopoverRef && this.dropdownPopoverRef.getOverlayRef() && this.dropdownPopoverRef.getOverlayRef().hasAttached();
|
|
11759
|
-
},
|
|
11760
|
-
enumerable: false,
|
|
11761
|
-
configurable: true
|
|
11762
|
-
});
|
|
11763
|
-
Object.defineProperty(TheFontSizeToolbarItemComponent.prototype, "disableClass", {
|
|
11764
|
-
get: function () {
|
|
11765
|
-
return this.disabled;
|
|
11766
|
-
},
|
|
11767
|
-
enumerable: false,
|
|
11768
|
-
configurable: true
|
|
11769
|
-
});
|
|
11770
|
-
TheFontSizeToolbarItemComponent.prototype.toggleDropdown = function (event) {
|
|
11771
|
-
var _a;
|
|
11772
|
-
_super.prototype.execute.call(this, event);
|
|
11773
|
-
if (((_a = this.editor) === null || _a === void 0 ? void 0 : _a.disabled) || this.disabled) {
|
|
11972
|
+
var FontSizeEditor = {
|
|
11973
|
+
setFontSize: function (editor, size) {
|
|
11974
|
+
var contextService = editor.injector.get(TheContextService);
|
|
11975
|
+
var defaultFontSize = contextService.getDefaultFontSize();
|
|
11976
|
+
var marks = getSelectionMarks(editor);
|
|
11977
|
+
var fontSizeMark = marks[exports.MarkTypes.fontSize];
|
|
11978
|
+
var isDefaultFontSize = size === defaultFontSize;
|
|
11979
|
+
if (!fontSizeMark && isDefaultFontSize) {
|
|
11774
11980
|
return;
|
|
11775
11981
|
}
|
|
11776
|
-
|
|
11777
|
-
|
|
11778
|
-
TheFontSizeToolbarItemComponent.prototype.handleDocumentMouseDown = function (event) {
|
|
11779
|
-
if (!this.elementRef.nativeElement.contains(event.target)) {
|
|
11780
|
-
this.closeDropdownPopover();
|
|
11781
|
-
}
|
|
11782
|
-
};
|
|
11783
|
-
TheFontSizeToolbarItemComponent.prototype.ngOnInit = function () {
|
|
11784
|
-
this.activeSize = this.fontSizes[2];
|
|
11785
|
-
};
|
|
11786
|
-
TheFontSizeToolbarItemComponent.prototype.statusChange = function (editor) {
|
|
11787
|
-
if (editor.selection) {
|
|
11788
|
-
var anchorBlock$1 = anchorBlock(editor);
|
|
11789
|
-
if (anchorBlock$1 && this.disableGroup.includes(anchorBlock$1.type)) {
|
|
11790
|
-
this.activeSize = null;
|
|
11791
|
-
this.disabled = true;
|
|
11792
|
-
return;
|
|
11793
|
-
}
|
|
11794
|
-
var marks = getSelectionMarks(editor);
|
|
11795
|
-
var fontSizeMark = marks[exports.MarkTypes.fontSize];
|
|
11796
|
-
this.activeSize = fontSizeMark ? fontSizeMark : this.fontSizes[2];
|
|
11797
|
-
this.disabled = false;
|
|
11798
|
-
}
|
|
11799
|
-
};
|
|
11800
|
-
TheFontSizeToolbarItemComponent.prototype.itemMousedown = function (event, size) {
|
|
11801
|
-
var _a, _b;
|
|
11802
|
-
_super.prototype.execute.call(this, event);
|
|
11803
|
-
this.closeDropdownPopover();
|
|
11804
|
-
if (((_a = this.editor) === null || _a === void 0 ? void 0 : _a.disabled) || ((_b = this.editor) === null || _b === void 0 ? void 0 : _b.readOnly)) {
|
|
11982
|
+
// unset fontSize
|
|
11983
|
+
if (FontSizeEditor.unsetFontSize(editor, size, fontSizeMark, isDefaultFontSize)) {
|
|
11805
11984
|
return;
|
|
11806
11985
|
}
|
|
11807
|
-
|
|
11808
|
-
|
|
11986
|
+
FontSizeEditor.setFontSizeMark(editor, size);
|
|
11987
|
+
},
|
|
11988
|
+
setFontSizeMark: function (editor, size) {
|
|
11989
|
+
// set Table selectedCells fontSize
|
|
11990
|
+
if (TableEditor.toggleMark(editor, false, exports.MarkTypes.fontSize, Number(size))) {
|
|
11809
11991
|
return;
|
|
11810
11992
|
}
|
|
11811
|
-
|
|
11812
|
-
|
|
11813
|
-
|
|
11814
|
-
|
|
11815
|
-
this.dropdownPopoverRef = this.thyPopover.open(this.dropdownTemplate, {
|
|
11816
|
-
origin: this.elementRef,
|
|
11817
|
-
panelClass: ['the-toolbar-dropdown-popover', (_a = this.item) === null || _a === void 0 ? void 0 : _a.key],
|
|
11818
|
-
placement: 'bottomLeft',
|
|
11819
|
-
insideClosable: false,
|
|
11820
|
-
backdropClosable: true,
|
|
11821
|
-
hasBackdrop: false,
|
|
11822
|
-
offset: 10,
|
|
11823
|
-
viewContainerRef: this.viewContainerRef,
|
|
11824
|
-
scrollStrategy: this.overlay.scrollStrategies.reposition()
|
|
11825
|
-
});
|
|
11826
|
-
};
|
|
11827
|
-
TheFontSizeToolbarItemComponent.prototype.closeDropdownPopover = function () {
|
|
11993
|
+
// set paragraph text fontSize
|
|
11994
|
+
slate.Editor.addMark(editor, exports.MarkTypes.fontSize, Number(size));
|
|
11995
|
+
},
|
|
11996
|
+
unsetFontSize: function (editor, size, fontSizeMark, isDefaultFontSize) {
|
|
11828
11997
|
var _a;
|
|
11829
|
-
|
|
11830
|
-
|
|
11998
|
+
var isTable = TableEditor.isActive(editor);
|
|
11999
|
+
if (fontSizeMark && isDefaultFontSize) {
|
|
12000
|
+
// unset Table selectedCells fontSize
|
|
12001
|
+
if (isTable && TableEditor.toggleMark(editor, true, exports.MarkTypes.fontSize, Number(size))) {
|
|
12002
|
+
return true;
|
|
12003
|
+
}
|
|
12004
|
+
// unset paragraph text fontSize
|
|
12005
|
+
setMarks(editor, (_a = {},
|
|
12006
|
+
_a[exports.MarkTypes.fontSize] = null,
|
|
12007
|
+
_a), editor.selection);
|
|
12008
|
+
return true;
|
|
11831
12009
|
}
|
|
11832
|
-
|
|
11833
|
-
|
|
11834
|
-
|
|
11835
|
-
|
|
11836
|
-
|
|
11837
|
-
|
|
11838
|
-
|
|
11839
|
-
|
|
11840
|
-
|
|
11841
|
-
|
|
11842
|
-
|
|
11843
|
-
|
|
11844
|
-
|
|
11845
|
-
|
|
11846
|
-
|
|
11847
|
-
|
|
11848
|
-
|
|
11849
|
-
|
|
11850
|
-
|
|
11851
|
-
|
|
11852
|
-
|
|
11853
|
-
|
|
11854
|
-
|
|
11855
|
-
|
|
11856
|
-
}
|
|
11857
|
-
|
|
11858
|
-
|
|
11859
|
-
|
|
11860
|
-
|
|
11861
|
-
|
|
11862
|
-
|
|
11863
|
-
|
|
11864
|
-
|
|
11865
|
-
|
|
12010
|
+
return false;
|
|
12011
|
+
},
|
|
12012
|
+
isFontSizeActive: function (editor, size) {
|
|
12013
|
+
if (editor.selection) {
|
|
12014
|
+
var anchorBlock$1 = anchorBlock(editor);
|
|
12015
|
+
switch (anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type) {
|
|
12016
|
+
case exports.ElementKinds.heading_1:
|
|
12017
|
+
return size === exports.FontSizes.fontSize28;
|
|
12018
|
+
case exports.ElementKinds.heading_2:
|
|
12019
|
+
return size === exports.FontSizes.fontSize24;
|
|
12020
|
+
case exports.ElementKinds.heading_3:
|
|
12021
|
+
return size === exports.FontSizes.fontSize20;
|
|
12022
|
+
case exports.ElementKinds.heading_4:
|
|
12023
|
+
return size === exports.FontSizes.fontSize18;
|
|
12024
|
+
case exports.ElementKinds.heading_5:
|
|
12025
|
+
return size === exports.FontSizes.fontSize16;
|
|
12026
|
+
case exports.ElementKinds.heading_6:
|
|
12027
|
+
return size === exports.FontSizes.fontSize14;
|
|
12028
|
+
case exports.ElementKinds.paragraph:
|
|
12029
|
+
var marks = getSelectionMarks(editor);
|
|
12030
|
+
var fontSizeMark = marks[exports.MarkTypes.fontSize];
|
|
12031
|
+
return Number(size) === fontSizeMark;
|
|
12032
|
+
default:
|
|
12033
|
+
return false;
|
|
12034
|
+
}
|
|
12035
|
+
}
|
|
12036
|
+
return false;
|
|
12037
|
+
},
|
|
12038
|
+
isDisabled: function (editor) {
|
|
12039
|
+
if (editor.selection) {
|
|
12040
|
+
var disableGroup = HEADING_TYPES;
|
|
12041
|
+
var anchorBlock$1 = anchorBlock(editor);
|
|
12042
|
+
return anchorBlock$1 && disableGroup.includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
|
|
12043
|
+
}
|
|
12044
|
+
return false;
|
|
12045
|
+
}
|
|
12046
|
+
};
|
|
11866
12047
|
|
|
11867
|
-
var
|
|
11868
|
-
|
|
12048
|
+
var sizeOptions = function () {
|
|
12049
|
+
return FontSizeTypes.map(function (fontSize) {
|
|
12050
|
+
return {
|
|
12051
|
+
key: fontSize,
|
|
12052
|
+
name: fontSize,
|
|
12053
|
+
execute: function (editor) { return FontSizeEditor.setFontSize(editor, fontSize); },
|
|
12054
|
+
active: function (editor) { return FontSizeEditor.isFontSizeActive(editor, fontSize); }
|
|
12055
|
+
};
|
|
12056
|
+
});
|
|
12057
|
+
};
|
|
12058
|
+
var FontSizeOptions = __spreadArray([
|
|
11869
12059
|
{
|
|
11870
12060
|
key: exports.MarkTypes.fontSize,
|
|
11871
12061
|
name: '字号',
|
|
11872
|
-
|
|
12062
|
+
type: exports.ToolbarItemType.toolDropdown,
|
|
12063
|
+
dropdownItemKey: exports.FontSizes.fontSize14,
|
|
12064
|
+
includes: FontSizeTypes,
|
|
12065
|
+
disable: function (editor) { return FontSizeEditor.isDisabled(editor); }
|
|
12066
|
+
}
|
|
12067
|
+
], __read(sizeOptions()));
|
|
12068
|
+
|
|
12069
|
+
var InlineCodeOptions = [
|
|
12070
|
+
{
|
|
12071
|
+
key: exports.ElementKinds.inlineCode,
|
|
12072
|
+
icon: 'code',
|
|
12073
|
+
name: '行内代码',
|
|
12074
|
+
shortcutKey: CONTROL_KEY + "+E",
|
|
12075
|
+
execute: function (editor) { return InlineCodeEditor.toggleInlineCode(editor); },
|
|
12076
|
+
active: function (editor) { return InlineCodeEditor.isInlineCodeActive(editor); }
|
|
11873
12077
|
}
|
|
11874
12078
|
];
|
|
11875
12079
|
|
|
12080
|
+
var TheInlineCodeComponent = /** @class */ (function (_super) {
|
|
12081
|
+
__extends(TheInlineCodeComponent, _super);
|
|
12082
|
+
function TheInlineCodeComponent(elementRef, cdr) {
|
|
12083
|
+
var _this = _super.call(this, elementRef, cdr) || this;
|
|
12084
|
+
_this.elementRef = elementRef;
|
|
12085
|
+
_this.cdr = cdr;
|
|
12086
|
+
return _this;
|
|
12087
|
+
}
|
|
12088
|
+
TheInlineCodeComponent.prototype.ngOnInit = function () {
|
|
12089
|
+
_super.prototype.ngOnInit.call(this);
|
|
12090
|
+
};
|
|
12091
|
+
TheInlineCodeComponent.prototype.ngOnDestroy = function () {
|
|
12092
|
+
_super.prototype.ngOnDestroy.call(this);
|
|
12093
|
+
};
|
|
12094
|
+
return TheInlineCodeComponent;
|
|
12095
|
+
}(TheBaseElementComponent));
|
|
12096
|
+
TheInlineCodeComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheInlineCodeComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
12097
|
+
TheInlineCodeComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheInlineCodeComponent, selector: "span[theInlineCode]", usesInheritance: true, ngImport: i0__namespace, template: '<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>', isInline: true, components: [{ type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
|
|
12098
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheInlineCodeComponent, decorators: [{
|
|
12099
|
+
type: i0.Component,
|
|
12100
|
+
args: [{
|
|
12101
|
+
selector: 'span[theInlineCode]',
|
|
12102
|
+
template: '<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>'
|
|
12103
|
+
}]
|
|
12104
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }]; } });
|
|
12105
|
+
|
|
12106
|
+
var withInlineCode = function (editor) {
|
|
12107
|
+
var isInline = editor.isInline, renderElement = editor.renderElement, insertText = editor.insertText;
|
|
12108
|
+
editor.isInline = function (element) {
|
|
12109
|
+
return element.type === exports.ElementKinds.inlineCode ? true : isInline(element);
|
|
12110
|
+
};
|
|
12111
|
+
editor.renderElement = function (element) {
|
|
12112
|
+
if (element.type === exports.ElementKinds.inlineCode) {
|
|
12113
|
+
return TheInlineCodeComponent;
|
|
12114
|
+
}
|
|
12115
|
+
return renderElement(element);
|
|
12116
|
+
};
|
|
12117
|
+
editor.insertText = function (text) {
|
|
12118
|
+
if (text && InlineCodeEditor.isInlineCodeActive(editor)) {
|
|
12119
|
+
var selection = editor.selection;
|
|
12120
|
+
var currentNodeText = slate.Editor.string(editor, editor.selection.anchor.path);
|
|
12121
|
+
insertText(text);
|
|
12122
|
+
if (currentNodeText == ZERO_WIDTH_CHAR) {
|
|
12123
|
+
var inlineCodePath = slate.Editor.path(editor, editor.selection);
|
|
12124
|
+
var range = {
|
|
12125
|
+
anchor: slate.Editor.before(editor, selection.anchor),
|
|
12126
|
+
focus: selection.anchor
|
|
12127
|
+
};
|
|
12128
|
+
if (slate.Editor.isStart(editor, selection.anchor, inlineCodePath)) {
|
|
12129
|
+
range = {
|
|
12130
|
+
anchor: editor.selection.anchor,
|
|
12131
|
+
focus: slate.Editor.after(editor, editor.selection)
|
|
12132
|
+
};
|
|
12133
|
+
}
|
|
12134
|
+
slate.Transforms.delete(editor, {
|
|
12135
|
+
at: range
|
|
12136
|
+
});
|
|
12137
|
+
}
|
|
12138
|
+
}
|
|
12139
|
+
else {
|
|
12140
|
+
insertText(text);
|
|
12141
|
+
}
|
|
12142
|
+
};
|
|
12143
|
+
editor = withRemoveEmptyNodes({ type: exports.ElementKinds.inlineCode })(editor);
|
|
12144
|
+
return editor;
|
|
12145
|
+
};
|
|
12146
|
+
|
|
11876
12147
|
var internalPlugins = [
|
|
11877
12148
|
withTheHistory,
|
|
11878
12149
|
withAutoInsertData(),
|
|
@@ -11912,9 +12183,10 @@
|
|
|
11912
12183
|
withImage,
|
|
11913
12184
|
withDeserializeHMTL,
|
|
11914
12185
|
withDeserializeMd(),
|
|
11915
|
-
withQuickInsert
|
|
12186
|
+
withQuickInsert,
|
|
12187
|
+
withInlineCode
|
|
11916
12188
|
];
|
|
11917
|
-
var internalToolbarItems = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(AlignOptions)), __read(MarkOptions)), __read(ColorOptions)), __read(HeadingOptions)), __read(FontSizeOptions)), __read(TodoItemOptions)), __read(ListOptions)), __read(ImageOptions)), __read(HrOptions)), __read(BlockquoteOptions)), __read(CodeOptions)), __read(LinkOptions)), __read(TableOptions)), __read(VerticalAlignOptions)), __read(PaintFormatOptions));
|
|
12189
|
+
var internalToolbarItems = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(AlignOptions)), __read(MarkOptions)), __read(ColorOptions)), __read(HeadingOptions)), __read(FontSizeOptions)), __read(TodoItemOptions)), __read(ListOptions)), __read(ImageOptions)), __read(HrOptions)), __read(BlockquoteOptions)), __read(CodeOptions)), __read(LinkOptions)), __read(TableOptions)), __read(VerticalAlignOptions)), __read(PaintFormatOptions)), __read(InlineCodeOptions));
|
|
11918
12190
|
var toolbarCompose = function (toolbarItems) {
|
|
11919
12191
|
if (toolbarItems === void 0) { toolbarItems = []; }
|
|
11920
12192
|
return __spreadArray(__spreadArray([], __read(internalToolbarItems)), __read(toolbarItems));
|
|
@@ -11936,14 +12208,19 @@
|
|
|
11936
12208
|
'mod+b': exports.MarkTypes.bold,
|
|
11937
12209
|
'mod+i': exports.MarkTypes.italic,
|
|
11938
12210
|
'mod+u': exports.MarkTypes.underline,
|
|
11939
|
-
'mod+e': exports.
|
|
12211
|
+
'mod+e': exports.ElementKinds.inlineCode
|
|
11940
12212
|
};
|
|
11941
12213
|
var markShortcuts = function (editor, event) {
|
|
11942
12214
|
for (var hotkey in HOTKEYS) {
|
|
11943
12215
|
if (isHotkey__default["default"](hotkey, event)) {
|
|
11944
12216
|
event.preventDefault();
|
|
11945
12217
|
var mark = HOTKEYS[hotkey];
|
|
11946
|
-
|
|
12218
|
+
if (mark === exports.ElementKinds.inlineCode) {
|
|
12219
|
+
InlineCodeEditor.toggleInlineCode(editor);
|
|
12220
|
+
}
|
|
12221
|
+
else {
|
|
12222
|
+
MarkEditor.toggleMark(editor, mark);
|
|
12223
|
+
}
|
|
11947
12224
|
}
|
|
11948
12225
|
}
|
|
11949
12226
|
};
|
|
@@ -12076,9 +12353,9 @@
|
|
|
12076
12353
|
}
|
|
12077
12354
|
};
|
|
12078
12355
|
TheToolbarComponent.prototype.setToolbarClass = function () {
|
|
12079
|
-
var
|
|
12356
|
+
var _b;
|
|
12080
12357
|
if (this.editor && !!this.containerClass.length) {
|
|
12081
|
-
(
|
|
12358
|
+
(_b = this.elementRef.nativeElement.classList).add.apply(_b, __spreadArray([], __read(this.containerClass)));
|
|
12082
12359
|
}
|
|
12083
12360
|
};
|
|
12084
12361
|
TheToolbarComponent.prototype.resizeElement = function () {
|
|
@@ -12086,7 +12363,7 @@
|
|
|
12086
12363
|
var editableElement = this.elementRef.nativeElement;
|
|
12087
12364
|
// @ts-ignore
|
|
12088
12365
|
this.resizeObserver = new ResizeObserver(function (entries) {
|
|
12089
|
-
var e_1,
|
|
12366
|
+
var e_1, _b;
|
|
12090
12367
|
try {
|
|
12091
12368
|
for (var entries_1 = __values(entries), entries_1_1 = entries_1.next(); !entries_1_1.done; entries_1_1 = entries_1.next()) {
|
|
12092
12369
|
var entry = entries_1_1.value;
|
|
@@ -12100,7 +12377,7 @@
|
|
|
12100
12377
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
12101
12378
|
finally {
|
|
12102
12379
|
try {
|
|
12103
|
-
if (entries_1_1 && !entries_1_1.done && (
|
|
12380
|
+
if (entries_1_1 && !entries_1_1.done && (_b = entries_1.return)) _b.call(entries_1);
|
|
12104
12381
|
}
|
|
12105
12382
|
finally { if (e_1) throw e_1.error; }
|
|
12106
12383
|
}
|
|
@@ -12108,7 +12385,7 @@
|
|
|
12108
12385
|
this.resizeObserver.observe(editableElement);
|
|
12109
12386
|
};
|
|
12110
12387
|
TheToolbarComponent.prototype.statusChange = function (editor) {
|
|
12111
|
-
var e_2,
|
|
12388
|
+
var e_2, _b;
|
|
12112
12389
|
var toolbarItems = __spreadArray(__spreadArray([], __read(this.toolbarItems)), [this.moreGroupMenu]);
|
|
12113
12390
|
try {
|
|
12114
12391
|
for (var toolbarItems_1 = __values(toolbarItems), toolbarItems_1_1 = toolbarItems_1.next(); !toolbarItems_1_1.done; toolbarItems_1_1 = toolbarItems_1.next()) {
|
|
@@ -12124,7 +12401,7 @@
|
|
|
12124
12401
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
12125
12402
|
finally {
|
|
12126
12403
|
try {
|
|
12127
|
-
if (toolbarItems_1_1 && !toolbarItems_1_1.done && (
|
|
12404
|
+
if (toolbarItems_1_1 && !toolbarItems_1_1.done && (_b = toolbarItems_1.return)) _b.call(toolbarItems_1);
|
|
12128
12405
|
}
|
|
12129
12406
|
finally { if (e_2) throw e_2.error; }
|
|
12130
12407
|
}
|
|
@@ -12136,7 +12413,7 @@
|
|
|
12136
12413
|
var toolbarItems = this.toolbarItemsCompose();
|
|
12137
12414
|
var items = toolbarItems.items, group = toolbarItems.group;
|
|
12138
12415
|
this.ngZone.run(function () {
|
|
12139
|
-
var e_3,
|
|
12416
|
+
var e_3, _b;
|
|
12140
12417
|
try {
|
|
12141
12418
|
for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
|
|
12142
12419
|
var item = items_1_1.value;
|
|
@@ -12150,7 +12427,7 @@
|
|
|
12150
12427
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
12151
12428
|
finally {
|
|
12152
12429
|
try {
|
|
12153
|
-
if (items_1_1 && !items_1_1.done && (
|
|
12430
|
+
if (items_1_1 && !items_1_1.done && (_b = items_1.return)) _b.call(items_1);
|
|
12154
12431
|
}
|
|
12155
12432
|
finally { if (e_3) throw e_3.error; }
|
|
12156
12433
|
}
|
|
@@ -12173,7 +12450,7 @@
|
|
|
12173
12450
|
* set aside 50px
|
|
12174
12451
|
*/
|
|
12175
12452
|
TheToolbarComponent.prototype.toolbarItemsCompose = function () {
|
|
12176
|
-
var e_4,
|
|
12453
|
+
var e_4, _b;
|
|
12177
12454
|
var elementWidth = this.isMore ? this.elementWidth : null;
|
|
12178
12455
|
var maxItemWidth = 50;
|
|
12179
12456
|
var defaultItemWidth = 35;
|
|
@@ -12183,8 +12460,8 @@
|
|
|
12183
12460
|
var items = [];
|
|
12184
12461
|
var group = [];
|
|
12185
12462
|
try {
|
|
12186
|
-
for (var
|
|
12187
|
-
var item =
|
|
12463
|
+
for (var _c = __values(this.toolbarItems), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
12464
|
+
var item = _d.value;
|
|
12188
12465
|
if (!this.isMore) {
|
|
12189
12466
|
items.push(item);
|
|
12190
12467
|
continue;
|
|
@@ -12213,7 +12490,7 @@
|
|
|
12213
12490
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
12214
12491
|
finally {
|
|
12215
12492
|
try {
|
|
12216
|
-
if (
|
|
12493
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
12217
12494
|
}
|
|
12218
12495
|
finally { if (e_4) throw e_4.error; }
|
|
12219
12496
|
}
|
|
@@ -12226,12 +12503,12 @@
|
|
|
12226
12503
|
* externally designated more group
|
|
12227
12504
|
*/
|
|
12228
12505
|
TheToolbarComponent.prototype.toolbarItemsAndMoreCompose = function () {
|
|
12229
|
-
var e_5,
|
|
12506
|
+
var e_5, _b;
|
|
12230
12507
|
var items = [];
|
|
12231
12508
|
var group = [];
|
|
12232
12509
|
try {
|
|
12233
|
-
for (var
|
|
12234
|
-
var item =
|
|
12510
|
+
for (var _c = __values(this.toolbarItems), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
12511
|
+
var item = _d.value;
|
|
12235
12512
|
if (item.key === exports.ToolbarActionTypes.split) {
|
|
12236
12513
|
items.push(item);
|
|
12237
12514
|
continue;
|
|
@@ -12242,7 +12519,7 @@
|
|
|
12242
12519
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
12243
12520
|
finally {
|
|
12244
12521
|
try {
|
|
12245
|
-
if (
|
|
12522
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
12246
12523
|
}
|
|
12247
12524
|
finally { if (e_5) throw e_5.error; }
|
|
12248
12525
|
}
|
|
@@ -12269,14 +12546,15 @@
|
|
|
12269
12546
|
});
|
|
12270
12547
|
};
|
|
12271
12548
|
TheToolbarComponent.prototype.createToolbarItem = function (item) {
|
|
12272
|
-
var iconComponent = item.iconComponent, type = item.type, dropdownMode = item.dropdownMode, args = __rest(item, ["iconComponent", "type", "dropdownMode"]);
|
|
12549
|
+
var iconComponent = item.iconComponent, type = item.type, dropdownMode = item.dropdownMode, dropdownItemKey = item.dropdownItemKey, includes = item.includes, args = __rest(item, ["iconComponent", "type", "dropdownMode", "dropdownItemKey", "includes"]);
|
|
12273
12550
|
var viewComponent = this.viewComponentType(type);
|
|
12551
|
+
var dropdownItem = this.getDropdownItem(item);
|
|
12274
12552
|
var factory = this.cfr.resolveComponentFactory(iconComponent ? iconComponent : viewComponent);
|
|
12275
12553
|
var compRef = this.toolbarContainer.createComponent(factory);
|
|
12276
12554
|
compRef.instance.editor = this.editor;
|
|
12277
12555
|
compRef.instance.toolbarItem = item;
|
|
12278
|
-
compRef.instance.menus =
|
|
12279
|
-
compRef.instance.item =
|
|
12556
|
+
compRef.instance.menus = includes;
|
|
12557
|
+
compRef.instance.item = includes && dropdownItem ? dropdownItem : args;
|
|
12280
12558
|
compRef.instance.mode = dropdownMode;
|
|
12281
12559
|
this.components.set(item.key, compRef);
|
|
12282
12560
|
};
|
|
@@ -12303,6 +12581,17 @@
|
|
|
12303
12581
|
}
|
|
12304
12582
|
return TheToolbarItemComponent;
|
|
12305
12583
|
};
|
|
12584
|
+
TheToolbarComponent.prototype.getDropdownItem = function (item) {
|
|
12585
|
+
var _a;
|
|
12586
|
+
var dropdownKey = item === null || item === void 0 ? void 0 : item.dropdownItemKey;
|
|
12587
|
+
// modify the fontsize option externally
|
|
12588
|
+
var contextService = this.editor.injector.get(TheContextService);
|
|
12589
|
+
var fontSize = contextService.getDefaultFontSize();
|
|
12590
|
+
if (item.key === exports.MarkTypes.fontSize && fontSize) {
|
|
12591
|
+
dropdownKey = fontSize;
|
|
12592
|
+
}
|
|
12593
|
+
return (_a = item === null || item === void 0 ? void 0 : item.includes) === null || _a === void 0 ? void 0 : _a.find(function (item) { return item.key === dropdownKey; });
|
|
12594
|
+
};
|
|
12306
12595
|
return TheToolbarComponent;
|
|
12307
12596
|
}());
|
|
12308
12597
|
TheToolbarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheToolbarComponent, deps: [{ token: i0__namespace.ComponentFactoryResolver }, { token: i0__namespace.ElementRef }, { token: i0__namespace.NgZone }, { token: TheToolbarGroupToken }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
@@ -12709,14 +12998,14 @@
|
|
|
12709
12998
|
return leaf ? leaf : null;
|
|
12710
12999
|
};
|
|
12711
13000
|
_this.renderText = function (text) {
|
|
12712
|
-
if (text.text.length === 0) {
|
|
12713
|
-
return;
|
|
12714
|
-
}
|
|
12715
13001
|
for (var key in exports.MarkTypes) {
|
|
12716
13002
|
if (text[exports.MarkTypes[key]]) {
|
|
12717
13003
|
return TheTextComponent;
|
|
12718
13004
|
}
|
|
12719
13005
|
}
|
|
13006
|
+
if (text.text.length === 0) {
|
|
13007
|
+
return;
|
|
13008
|
+
}
|
|
12720
13009
|
};
|
|
12721
13010
|
_this.onKeyDown = function (event) {
|
|
12722
13011
|
shortcuts(_this.editor, event);
|
|
@@ -12845,7 +13134,11 @@
|
|
|
12845
13134
|
this.editor.disabled = (_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.disabled;
|
|
12846
13135
|
this.editor.extraElementOptions = (_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.extraElementOptions;
|
|
12847
13136
|
setEditorUUID(this.editor, idCreator());
|
|
12848
|
-
this.theContextService.initialize({
|
|
13137
|
+
this.theContextService.initialize({
|
|
13138
|
+
theOptions: this.theOptions,
|
|
13139
|
+
nativeElement: this.elementRef.nativeElement,
|
|
13140
|
+
viewContainerRef: this.viewContainerRef
|
|
13141
|
+
});
|
|
12849
13142
|
this.toolbarCalculate();
|
|
12850
13143
|
setTimeout(function () {
|
|
12851
13144
|
var _a;
|
|
@@ -13037,12 +13330,13 @@
|
|
|
13037
13330
|
useExisting: i0.forwardRef(function () { return TheEditorComponent; }),
|
|
13038
13331
|
multi: true
|
|
13039
13332
|
}
|
|
13040
|
-
], 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 }, { propertyName: "placeholderInstance", first: true, predicate: ["placeholder"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace, 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 [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 *ngIf=\"!theOptions?.readonly\" [editor]=\"editor\" [toolbarItems]=\"toolbarEntity.inline\"></the-inline-toolbar>\n <div #quickInsert theQuickInsert [editor]=\"editor\" [quickToolbarItems]=\"quickToolbarItems\"></div>\n <div #placeholder thePlaceholder [editor]=\"editor\" [options]=\"theOptions\"></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__namespace.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"] }, { type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: ["editor", "options"] }, { type: TheTemplateComponent, selector: "the-template,[theTemplate]" }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4__namespace$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4__namespace$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
13333
|
+
], 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 }, { propertyName: "placeholderInstance", first: true, predicate: ["placeholder"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace, 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 [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 *ngIf=\"!theOptions?.readonly\" [editor]=\"editor\" [toolbarItems]=\"toolbarEntity.inline\"></the-inline-toolbar>\n <div #quickInsert theQuickInsert [editor]=\"editor\" [quickToolbarItems]=\"quickToolbarItems\"></div>\n <div #placeholder thePlaceholder [editor]=\"editor\" [options]=\"theOptions\"></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__namespace.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"] }, { type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: ["editor", "options"] }, { type: TheTemplateComponent, selector: "the-template,[theTemplate]" }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4__namespace$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4__namespace$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
13041
13334
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheEditorComponent, decorators: [{
|
|
13042
13335
|
type: i0.Component,
|
|
13043
13336
|
args: [{
|
|
13044
13337
|
selector: 'the-editor, theEditor',
|
|
13045
13338
|
templateUrl: 'editor.component.html',
|
|
13339
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
13046
13340
|
providers: [
|
|
13047
13341
|
TheToolbarService,
|
|
13048
13342
|
TheContextService,
|
|
@@ -13280,8 +13574,7 @@
|
|
|
13280
13574
|
TheTableSelectComponent,
|
|
13281
13575
|
TheTableToolbarItemComponent,
|
|
13282
13576
|
TheConversionHintComponent,
|
|
13283
|
-
TheVerticalToolbarItemComponent
|
|
13284
|
-
TheFontSizeToolbarItemComponent
|
|
13577
|
+
TheVerticalToolbarItemComponent
|
|
13285
13578
|
];
|
|
13286
13579
|
var PLUGIN_COMPONENTS = [
|
|
13287
13580
|
TheImageComponent,
|
|
@@ -13301,7 +13594,8 @@
|
|
|
13301
13594
|
TheTableComponent,
|
|
13302
13595
|
TheTableRowComponent,
|
|
13303
13596
|
TheTdComponent,
|
|
13304
|
-
ThePlaceholderComponent
|
|
13597
|
+
ThePlaceholderComponent,
|
|
13598
|
+
TheInlineCodeComponent
|
|
13305
13599
|
];
|
|
13306
13600
|
var PIPES = [ElementStylePipe, ElementClassPipe];
|
|
13307
13601
|
var TheEditorModule = /** @class */ (function () {
|
|
@@ -13327,8 +13621,7 @@
|
|
|
13327
13621
|
TheTableSelectComponent,
|
|
13328
13622
|
TheTableToolbarItemComponent,
|
|
13329
13623
|
TheConversionHintComponent,
|
|
13330
|
-
TheVerticalToolbarItemComponent,
|
|
13331
|
-
TheFontSizeToolbarItemComponent, TheImageComponent,
|
|
13624
|
+
TheVerticalToolbarItemComponent, TheImageComponent,
|
|
13332
13625
|
TheTemplateComponent,
|
|
13333
13626
|
TheHrComponent,
|
|
13334
13627
|
TheBlockquoteComponent,
|
|
@@ -13345,7 +13638,8 @@
|
|
|
13345
13638
|
TheTableComponent,
|
|
13346
13639
|
TheTableRowComponent,
|
|
13347
13640
|
TheTdComponent,
|
|
13348
|
-
ThePlaceholderComponent
|
|
13641
|
+
ThePlaceholderComponent,
|
|
13642
|
+
TheInlineCodeComponent], imports: [i6.CommonModule, i1.SlateModule, i4$2.FormsModule, i4$1.ThyIconModule,
|
|
13349
13643
|
avatar.ThyAvatarModule,
|
|
13350
13644
|
i3.ThyNavModule,
|
|
13351
13645
|
i2$1.ThyFormModule,
|
|
@@ -13415,6 +13709,7 @@
|
|
|
13415
13709
|
exports.DefaultInlineToolbarDefinition = DefaultInlineToolbarDefinition;
|
|
13416
13710
|
exports.DefaultQuickToolbarDefinition = DefaultQuickToolbarDefinition;
|
|
13417
13711
|
exports.ELEMENT_UNIQUE_ID = ELEMENT_UNIQUE_ID;
|
|
13712
|
+
exports.FontSizeTypes = FontSizeTypes;
|
|
13418
13713
|
exports.HEADING_TYPES = HEADING_TYPES;
|
|
13419
13714
|
exports.HeadingEditor = HeadingEditor;
|
|
13420
13715
|
exports.HrEditor = HrEditor;
|