@worktile/theia 2.1.4 → 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 +287 -58
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/components/toolbar/toolbar.component.d.ts +1 -3
- package/constants/default.d.ts +1 -0
- package/constants/node-types.d.ts +4 -3
- package/custom-types.d.ts +4 -1
- package/editor.module.d.ts +24 -23
- package/esm2015/components/inline-toolbar/inline-toolbar.component.js +1 -1
- package/esm2015/components/toolbar/toolbar.component.js +7 -6
- package/esm2015/components/toolbar-group/toolbar-group.component.js +1 -1
- package/esm2015/constants/auto-format-rules.js +8 -3
- package/esm2015/constants/default.js +2 -1
- package/esm2015/constants/node-types.js +5 -4
- package/esm2015/constants/toolbar.js +5 -5
- package/esm2015/custom-types.js +1 -1
- package/esm2015/editor.component.js +10 -6
- package/esm2015/editor.module.js +6 -3
- package/esm2015/interfaces/auto-format.js +1 -1
- package/esm2015/interfaces/element.js +1 -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/font-size/font-size.editor.js +35 -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 +29 -3
- package/esm2015/plugins/mark/options.js +1 -9
- package/esm2015/services/context.service.js +9 -1
- package/esm2015/shortcuts/mark.js +10 -4
- package/fesm2015/worktile-theia.js +283 -60
- package/fesm2015/worktile-theia.js.map +1 -1
- package/interfaces/auto-format.d.ts +1 -1
- package/interfaces/element.d.ts +1 -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 +16 -0
- package/plugins/font-size/font-size.editor.d.ts +2 -0
- 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 +4 -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 +18 -4
- package/styles/index.scss +1 -0
- package/transforms/set-marks.d.ts +1 -1
|
@@ -378,6 +378,7 @@
|
|
|
378
378
|
var CLIPBOARD_FORMAT_KEY = 'x-theia-fragment';
|
|
379
379
|
var DEFAULT_SCROLL_CONTAINER = '.the-editable-container';
|
|
380
380
|
var ELEMENT_UNIQUE_ID = 'key';
|
|
381
|
+
var ZERO_WIDTH_CHAR = '\u200B';
|
|
381
382
|
exports.TheMode = void 0;
|
|
382
383
|
(function (TheMode) {
|
|
383
384
|
TheMode["fullMode"] = "full";
|
|
@@ -408,6 +409,7 @@
|
|
|
408
409
|
ElementKinds["hr"] = "hr";
|
|
409
410
|
ElementKinds["link"] = "link";
|
|
410
411
|
ElementKinds["default"] = "paragraph";
|
|
412
|
+
ElementKinds["inlineCode"] = "inline-code";
|
|
411
413
|
})(exports.ElementKinds || (exports.ElementKinds = {}));
|
|
412
414
|
exports.Alignment = void 0;
|
|
413
415
|
(function (Alignment) {
|
|
@@ -457,8 +459,8 @@
|
|
|
457
459
|
MarkTypes["strike"] = "strike";
|
|
458
460
|
MarkTypes["color"] = "color";
|
|
459
461
|
MarkTypes["backgroundColor"] = "background-color";
|
|
460
|
-
MarkTypes["codeLine"] = "code-line";
|
|
461
462
|
MarkTypes["fontSize"] = "font-size";
|
|
463
|
+
MarkTypes["codeLine"] = "code-line";
|
|
462
464
|
})(exports.MarkTypes || (exports.MarkTypes = {}));
|
|
463
465
|
exports.ToolbarActionTypes = void 0;
|
|
464
466
|
(function (ToolbarActionTypes) {
|
|
@@ -483,12 +485,12 @@
|
|
|
483
485
|
var MarkProps = [
|
|
484
486
|
exports.MarkTypes.backgroundColor,
|
|
485
487
|
exports.MarkTypes.bold,
|
|
486
|
-
exports.MarkTypes.codeLine,
|
|
487
488
|
exports.MarkTypes.color,
|
|
488
489
|
exports.MarkTypes.italic,
|
|
489
490
|
exports.MarkTypes.strike,
|
|
490
491
|
exports.MarkTypes.underline,
|
|
491
|
-
exports.MarkTypes.fontSize
|
|
492
|
+
exports.MarkTypes.fontSize,
|
|
493
|
+
exports.MarkTypes.codeLine
|
|
492
494
|
];
|
|
493
495
|
var THE_INLINE_TOOLBAR_TYPES = [exports.ElementKinds.default, exports.ElementKinds.listItem, exports.ElementKinds.checkItem];
|
|
494
496
|
var STANDARD_HEADING_TYPES = [
|
|
@@ -524,7 +526,7 @@
|
|
|
524
526
|
exports.MarkTypes.italic,
|
|
525
527
|
exports.MarkTypes.underline,
|
|
526
528
|
exports.MarkTypes.strike,
|
|
527
|
-
exports.
|
|
529
|
+
exports.ElementKinds.inlineCode,
|
|
528
530
|
exports.MarkTypes.color,
|
|
529
531
|
exports.MarkTypes.backgroundColor,
|
|
530
532
|
exports.ToolbarActionTypes.split,
|
|
@@ -533,7 +535,7 @@
|
|
|
533
535
|
exports.ToolbarActionTypes.split,
|
|
534
536
|
exports.ElementKinds.numberedList,
|
|
535
537
|
exports.ElementKinds.bulletedList,
|
|
536
|
-
|
|
538
|
+
// ElementKinds.checkItem,
|
|
537
539
|
exports.ToolbarActionTypes.split,
|
|
538
540
|
exports.ElementKinds.link,
|
|
539
541
|
exports.ElementKinds.image,
|
|
@@ -548,7 +550,7 @@
|
|
|
548
550
|
exports.MarkTypes.italic,
|
|
549
551
|
exports.MarkTypes.underline,
|
|
550
552
|
exports.MarkTypes.strike,
|
|
551
|
-
exports.
|
|
553
|
+
exports.ElementKinds.inlineCode,
|
|
552
554
|
exports.MarkTypes.color,
|
|
553
555
|
exports.MarkTypes.backgroundColor,
|
|
554
556
|
exports.ToolbarActionTypes.split,
|
|
@@ -560,7 +562,7 @@
|
|
|
560
562
|
exports.ToolbarActionTypes.split,
|
|
561
563
|
exports.ElementKinds.numberedList,
|
|
562
564
|
exports.ElementKinds.bulletedList,
|
|
563
|
-
|
|
565
|
+
// ElementKinds.checkItem,
|
|
564
566
|
exports.ToolbarActionTypes.split,
|
|
565
567
|
exports.ElementKinds.link,
|
|
566
568
|
exports.ElementKinds.image,
|
|
@@ -2163,6 +2165,50 @@
|
|
|
2163
2165
|
}
|
|
2164
2166
|
};
|
|
2165
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
|
+
|
|
2166
2212
|
var autoFormatRules = [
|
|
2167
2213
|
{
|
|
2168
2214
|
type: exports.ElementKinds.heading_1,
|
|
@@ -2220,10 +2266,13 @@
|
|
|
2220
2266
|
insertTrigger: true
|
|
2221
2267
|
},
|
|
2222
2268
|
{
|
|
2223
|
-
type: exports.
|
|
2269
|
+
type: exports.ElementKinds.inlineCode,
|
|
2224
2270
|
between: ['`', '`'],
|
|
2225
2271
|
mode: 'inline',
|
|
2226
|
-
|
|
2272
|
+
format: function (editor, text) {
|
|
2273
|
+
InlineCodeEditor.toggleInlineCode(editor, text);
|
|
2274
|
+
slate.Transforms.select(editor, slate.Editor.after(editor, editor.selection));
|
|
2275
|
+
}
|
|
2227
2276
|
},
|
|
2228
2277
|
{
|
|
2229
2278
|
type: exports.MarkTypes.strike,
|
|
@@ -2708,6 +2757,13 @@
|
|
|
2708
2757
|
}
|
|
2709
2758
|
return this.options;
|
|
2710
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
|
+
};
|
|
2711
2767
|
TheContextService.prototype.getEditableElement = function () {
|
|
2712
2768
|
return this.options.nativeElement.querySelector('.the-editor-typo');
|
|
2713
2769
|
};
|
|
@@ -3840,12 +3896,13 @@
|
|
|
3840
3896
|
};
|
|
3841
3897
|
TheListItemComponent.prototype.onContextChange = function () {
|
|
3842
3898
|
_super.prototype.onContextChange.call(this);
|
|
3843
|
-
this.
|
|
3899
|
+
this.addFontSize();
|
|
3900
|
+
this.addMultiDigit();
|
|
3844
3901
|
};
|
|
3845
3902
|
TheListItemComponent.prototype.ngOnDestroy = function () {
|
|
3846
3903
|
_super.prototype.ngOnDestroy.call(this);
|
|
3847
3904
|
};
|
|
3848
|
-
TheListItemComponent.prototype.
|
|
3905
|
+
TheListItemComponent.prototype.addFontSize = function () {
|
|
3849
3906
|
var e_1, _c;
|
|
3850
3907
|
var _a, _b;
|
|
3851
3908
|
var firstText;
|
|
@@ -3891,6 +3948,30 @@
|
|
|
3891
3948
|
this.fontSizeClass = null;
|
|
3892
3949
|
}
|
|
3893
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
|
+
};
|
|
3894
3975
|
return TheListItemComponent;
|
|
3895
3976
|
}(TheBaseElementComponent));
|
|
3896
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 });
|
|
@@ -4510,7 +4591,7 @@
|
|
|
4510
4591
|
};
|
|
4511
4592
|
|
|
4512
4593
|
var autoFormatInline = function (editor, _a) {
|
|
4513
|
-
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;
|
|
4514
4595
|
var selection = editor.selection;
|
|
4515
4596
|
var startMarkup = between ? between[0] : markup;
|
|
4516
4597
|
var endMarkup = between ? between[1] : '';
|
|
@@ -4554,22 +4635,35 @@
|
|
|
4554
4635
|
}
|
|
4555
4636
|
});
|
|
4556
4637
|
}
|
|
4557
|
-
// add mark to the text between the markups
|
|
4558
|
-
slate.Transforms.select(editor, markupRange);
|
|
4559
|
-
editor.addMark(type, true);
|
|
4560
|
-
slate.Transforms.collapse(editor, { edge: 'end' });
|
|
4561
|
-
editor.removeMark(type, false);
|
|
4562
|
-
// delete start markup
|
|
4563
4638
|
var startMarkupPointBefore = getPointBefore(editor, selection, {
|
|
4564
4639
|
matchString: startMarkup,
|
|
4565
4640
|
skipInvalid: true
|
|
4566
4641
|
});
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
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
|
+
}
|
|
4573
4667
|
return true;
|
|
4574
4668
|
};
|
|
4575
4669
|
|
|
@@ -4645,6 +4739,7 @@
|
|
|
4645
4739
|
type: type,
|
|
4646
4740
|
between: between,
|
|
4647
4741
|
ignoreTrim: ignoreTrim,
|
|
4742
|
+
format: format,
|
|
4648
4743
|
markup: Array.isArray(markup) ? markup[0] : markup
|
|
4649
4744
|
})) {
|
|
4650
4745
|
return { value: valid() };
|
|
@@ -6044,14 +6139,6 @@
|
|
|
6044
6139
|
shortcutKey: CONTROL_KEY + "+U",
|
|
6045
6140
|
execute: function (editor) { return MarkEditor.toggleMark(editor, exports.MarkTypes.underline); },
|
|
6046
6141
|
active: function (editor) { return MarkEditor.isMarkActive(editor, exports.MarkTypes.underline); }
|
|
6047
|
-
},
|
|
6048
|
-
{
|
|
6049
|
-
key: exports.MarkTypes.codeLine,
|
|
6050
|
-
icon: 'code',
|
|
6051
|
-
name: '行内代码',
|
|
6052
|
-
shortcutKey: CONTROL_KEY + "+E",
|
|
6053
|
-
execute: function (editor) { return MarkEditor.toggleMark(editor, exports.MarkTypes.codeLine); },
|
|
6054
|
-
active: function (editor) { return MarkEditor.isMarkActive(editor, exports.MarkTypes.codeLine); }
|
|
6055
6142
|
}
|
|
6056
6143
|
];
|
|
6057
6144
|
|
|
@@ -7044,8 +7131,9 @@
|
|
|
7044
7131
|
_this.menus = CODE_MODES.map(function (item) {
|
|
7045
7132
|
return { key: item.value, name: item.showName };
|
|
7046
7133
|
});
|
|
7134
|
+
_this.destroy$ = new rxjs.Subject();
|
|
7047
7135
|
_this.ToolbarItemMode = exports.ToolbarItemMode;
|
|
7048
|
-
_this.
|
|
7136
|
+
_this.isHightLight = false;
|
|
7049
7137
|
_this.resizeHeight = null;
|
|
7050
7138
|
_this.options = {
|
|
7051
7139
|
mode: _this.menus[0].key,
|
|
@@ -7087,13 +7175,22 @@
|
|
|
7087
7175
|
if (this.resizeHeight !== this.element.height) {
|
|
7088
7176
|
this.useHeight();
|
|
7089
7177
|
}
|
|
7090
|
-
if (!this.isCollapsed) {
|
|
7091
|
-
this.isFocusCode = false;
|
|
7092
|
-
}
|
|
7093
7178
|
}
|
|
7094
7179
|
};
|
|
7095
7180
|
TheCodeComponent.prototype.ngOnInit = function () {
|
|
7181
|
+
var _this = this;
|
|
7096
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
|
+
});
|
|
7097
7194
|
this.elementRef.nativeElement.classList.add('the-code-container');
|
|
7098
7195
|
};
|
|
7099
7196
|
TheCodeComponent.prototype.ngAfterViewInit = function () {
|
|
@@ -7137,11 +7234,11 @@
|
|
|
7137
7234
|
}
|
|
7138
7235
|
};
|
|
7139
7236
|
TheCodeComponent.prototype.codeChange = function ($event) {
|
|
7237
|
+
this.isHightLight = false;
|
|
7140
7238
|
CodeEditor.setCodeAttribute(this.editor, this.element, { content: $event });
|
|
7141
7239
|
};
|
|
7142
7240
|
TheCodeComponent.prototype.onDelete = function (event) {
|
|
7143
7241
|
event.preventDefault();
|
|
7144
|
-
this.isFocusCode = false;
|
|
7145
7242
|
deleteElement(this.editor, this.element);
|
|
7146
7243
|
};
|
|
7147
7244
|
TheCodeComponent.prototype.onCopy = function (event) {
|
|
@@ -7159,8 +7256,9 @@
|
|
|
7159
7256
|
i1.AngularEditor.deselect(this.editor);
|
|
7160
7257
|
};
|
|
7161
7258
|
TheCodeComponent.prototype.focusChange = function (codeMirrorFocused) {
|
|
7162
|
-
if (codeMirrorFocused)
|
|
7163
|
-
this.
|
|
7259
|
+
if (codeMirrorFocused) {
|
|
7260
|
+
this.isHightLight = false;
|
|
7261
|
+
}
|
|
7164
7262
|
};
|
|
7165
7263
|
TheCodeComponent.prototype.useMode = function () {
|
|
7166
7264
|
var _this = this;
|
|
@@ -7189,13 +7287,18 @@
|
|
|
7189
7287
|
CodeEditor.setCodeAttribute(this.editor, this.element, { height: this.resizeHeight });
|
|
7190
7288
|
};
|
|
7191
7289
|
TheCodeComponent.prototype.onChangeWrap = function (value) {
|
|
7290
|
+
this.isHightLight = false;
|
|
7192
7291
|
this.options = Object.assign(Object.assign({}, this.options), { lineWrapping: value || false });
|
|
7193
7292
|
CodeEditor.setCodeAttribute(this.editor, this.element, { autoWrap: value ? value : null });
|
|
7194
7293
|
};
|
|
7294
|
+
TheCodeComponent.prototype.ngOnDestroy = function () {
|
|
7295
|
+
this.destroy$.next();
|
|
7296
|
+
this.destroy$.complete();
|
|
7297
|
+
};
|
|
7195
7298
|
return TheCodeComponent;
|
|
7196
7299
|
}(TheBaseElementComponent));
|
|
7197
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 });
|
|
7198
|
-
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 });
|
|
7199
7302
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheCodeComponent, decorators: [{
|
|
7200
7303
|
type: i0.Component,
|
|
7201
7304
|
args: [{
|
|
@@ -7492,7 +7595,9 @@
|
|
|
7492
7595
|
}
|
|
7493
7596
|
};
|
|
7494
7597
|
TheBaseLinkComponent.prototype.mousedownHandle = function (event) {
|
|
7495
|
-
this.
|
|
7598
|
+
if (!this.readonly && !this.editor.disabled) {
|
|
7599
|
+
this.openLinkHover();
|
|
7600
|
+
}
|
|
7496
7601
|
};
|
|
7497
7602
|
TheBaseLinkComponent.prototype.openLinkEdit = function (tag) {
|
|
7498
7603
|
var _this = this;
|
|
@@ -11866,11 +11971,44 @@
|
|
|
11866
11971
|
|
|
11867
11972
|
var FontSizeEditor = {
|
|
11868
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) {
|
|
11980
|
+
return;
|
|
11981
|
+
}
|
|
11982
|
+
// unset fontSize
|
|
11983
|
+
if (FontSizeEditor.unsetFontSize(editor, size, fontSizeMark, isDefaultFontSize)) {
|
|
11984
|
+
return;
|
|
11985
|
+
}
|
|
11986
|
+
FontSizeEditor.setFontSizeMark(editor, size);
|
|
11987
|
+
},
|
|
11988
|
+
setFontSizeMark: function (editor, size) {
|
|
11989
|
+
// set Table selectedCells fontSize
|
|
11869
11990
|
if (TableEditor.toggleMark(editor, false, exports.MarkTypes.fontSize, Number(size))) {
|
|
11870
11991
|
return;
|
|
11871
11992
|
}
|
|
11993
|
+
// set paragraph text fontSize
|
|
11872
11994
|
slate.Editor.addMark(editor, exports.MarkTypes.fontSize, Number(size));
|
|
11873
11995
|
},
|
|
11996
|
+
unsetFontSize: function (editor, size, fontSizeMark, isDefaultFontSize) {
|
|
11997
|
+
var _a;
|
|
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;
|
|
12009
|
+
}
|
|
12010
|
+
return false;
|
|
12011
|
+
},
|
|
11874
12012
|
isFontSizeActive: function (editor, size) {
|
|
11875
12013
|
if (editor.selection) {
|
|
11876
12014
|
var anchorBlock$1 = anchorBlock(editor);
|
|
@@ -11928,6 +12066,84 @@
|
|
|
11928
12066
|
}
|
|
11929
12067
|
], __read(sizeOptions()));
|
|
11930
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); }
|
|
12077
|
+
}
|
|
12078
|
+
];
|
|
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
|
+
|
|
11931
12147
|
var internalPlugins = [
|
|
11932
12148
|
withTheHistory,
|
|
11933
12149
|
withAutoInsertData(),
|
|
@@ -11967,9 +12183,10 @@
|
|
|
11967
12183
|
withImage,
|
|
11968
12184
|
withDeserializeHMTL,
|
|
11969
12185
|
withDeserializeMd(),
|
|
11970
|
-
withQuickInsert
|
|
12186
|
+
withQuickInsert,
|
|
12187
|
+
withInlineCode
|
|
11971
12188
|
];
|
|
11972
|
-
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));
|
|
11973
12190
|
var toolbarCompose = function (toolbarItems) {
|
|
11974
12191
|
if (toolbarItems === void 0) { toolbarItems = []; }
|
|
11975
12192
|
return __spreadArray(__spreadArray([], __read(internalToolbarItems)), __read(toolbarItems));
|
|
@@ -11991,14 +12208,19 @@
|
|
|
11991
12208
|
'mod+b': exports.MarkTypes.bold,
|
|
11992
12209
|
'mod+i': exports.MarkTypes.italic,
|
|
11993
12210
|
'mod+u': exports.MarkTypes.underline,
|
|
11994
|
-
'mod+e': exports.
|
|
12211
|
+
'mod+e': exports.ElementKinds.inlineCode
|
|
11995
12212
|
};
|
|
11996
12213
|
var markShortcuts = function (editor, event) {
|
|
11997
12214
|
for (var hotkey in HOTKEYS) {
|
|
11998
12215
|
if (isHotkey__default["default"](hotkey, event)) {
|
|
11999
12216
|
event.preventDefault();
|
|
12000
12217
|
var mark = HOTKEYS[hotkey];
|
|
12001
|
-
|
|
12218
|
+
if (mark === exports.ElementKinds.inlineCode) {
|
|
12219
|
+
InlineCodeEditor.toggleInlineCode(editor);
|
|
12220
|
+
}
|
|
12221
|
+
else {
|
|
12222
|
+
MarkEditor.toggleMark(editor, mark);
|
|
12223
|
+
}
|
|
12002
12224
|
}
|
|
12003
12225
|
}
|
|
12004
12226
|
};
|
|
@@ -12363,15 +12585,17 @@
|
|
|
12363
12585
|
var _a;
|
|
12364
12586
|
var dropdownKey = item === null || item === void 0 ? void 0 : item.dropdownItemKey;
|
|
12365
12587
|
// modify the fontsize option externally
|
|
12366
|
-
|
|
12367
|
-
|
|
12588
|
+
var contextService = this.editor.injector.get(TheContextService);
|
|
12589
|
+
var fontSize = contextService.getDefaultFontSize();
|
|
12590
|
+
if (item.key === exports.MarkTypes.fontSize && fontSize) {
|
|
12591
|
+
dropdownKey = fontSize;
|
|
12368
12592
|
}
|
|
12369
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; });
|
|
12370
12594
|
};
|
|
12371
12595
|
return TheToolbarComponent;
|
|
12372
12596
|
}());
|
|
12373
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 });
|
|
12374
|
-
TheToolbarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarComponent, selector: "the-toolbar", inputs: { editor: "editor", toolbarItems: "toolbarItems", align: "align",
|
|
12598
|
+
TheToolbarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarComponent, selector: "the-toolbar", inputs: { editor: "editor", toolbarItems: "toolbarItems", align: "align", containerClass: "containerClass", isMore: "isMore", afterTemplate: "afterTemplate" }, host: { classAttribute: "the-toolbar-container" }, viewQueries: [{ propertyName: "toolbarContainer", first: true, predicate: ["toolbarContainer"], descendants: true, read: i0.ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<thy-icon-nav [style.justifyContent]=\"align\">\n <ng-container #toolbarContainer></ng-container>\n <ng-content></ng-content>\n <ng-template *ngIf=\"afterTemplate\" [ngTemplateOutlet]=\"afterTemplate\"></ng-template>\n</thy-icon-nav>\n", components: [{ type: i3__namespace.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
|
|
12375
12599
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheToolbarComponent, decorators: [{
|
|
12376
12600
|
type: i0.Component,
|
|
12377
12601
|
args: [{
|
|
@@ -12392,8 +12616,6 @@
|
|
|
12392
12616
|
type: i0.Input
|
|
12393
12617
|
}], align: [{
|
|
12394
12618
|
type: i0.Input
|
|
12395
|
-
}], fontSize: [{
|
|
12396
|
-
type: i0.Input
|
|
12397
12619
|
}], containerClass: [{
|
|
12398
12620
|
type: i0.Input
|
|
12399
12621
|
}], isMore: [{
|
|
@@ -12514,7 +12736,7 @@
|
|
|
12514
12736
|
return TheInlineToolbarComponent;
|
|
12515
12737
|
}());
|
|
12516
12738
|
TheInlineToolbarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheInlineToolbarComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i2__namespace.ScrollDispatcher }, { token: i0__namespace.ChangeDetectorRef }, { token: i0__namespace.NgZone }, { token: TheContextService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
12517
|
-
TheInlineToolbarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheInlineToolbarComponent, selector: "the-inline-toolbar", inputs: { editor: "editor", toolbarItems: "toolbarItems" }, host: { properties: { "class.hide": "toolbarItems.length === 0" } }, viewQueries: [{ propertyName: "inlineToolbar", first: true, predicate: ["inlineToolbar"], descendants: true }], ngImport: i0__namespace, template: "<the-toolbar\n #inlineToolbar\n class=\"the-inline-toolbar\"\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarItems\"\n [isMore]=\"false\"\n ></the-toolbar> ", isInline: true, components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "
|
|
12739
|
+
TheInlineToolbarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheInlineToolbarComponent, selector: "the-inline-toolbar", inputs: { editor: "editor", toolbarItems: "toolbarItems" }, host: { properties: { "class.hide": "toolbarItems.length === 0" } }, viewQueries: [{ propertyName: "inlineToolbar", first: true, predicate: ["inlineToolbar"], descendants: true }], ngImport: i0__namespace, template: "<the-toolbar\n #inlineToolbar\n class=\"the-inline-toolbar\"\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarItems\"\n [isMore]=\"false\"\n ></the-toolbar> ", isInline: true, components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "containerClass", "isMore", "afterTemplate"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
12518
12740
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheInlineToolbarComponent, decorators: [{
|
|
12519
12741
|
type: i0.Component,
|
|
12520
12742
|
args: [{
|
|
@@ -12912,7 +13134,11 @@
|
|
|
12912
13134
|
this.editor.disabled = (_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.disabled;
|
|
12913
13135
|
this.editor.extraElementOptions = (_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.extraElementOptions;
|
|
12914
13136
|
setEditorUUID(this.editor, idCreator());
|
|
12915
|
-
this.theContextService.initialize({
|
|
13137
|
+
this.theContextService.initialize({
|
|
13138
|
+
theOptions: this.theOptions,
|
|
13139
|
+
nativeElement: this.elementRef.nativeElement,
|
|
13140
|
+
viewContainerRef: this.viewContainerRef
|
|
13141
|
+
});
|
|
12916
13142
|
this.toolbarCalculate();
|
|
12917
13143
|
setTimeout(function () {
|
|
12918
13144
|
var _a;
|
|
@@ -12939,7 +13165,7 @@
|
|
|
12939
13165
|
}
|
|
12940
13166
|
};
|
|
12941
13167
|
TheEditorComponent.prototype.toolbarCalculate = function () {
|
|
12942
|
-
var _a
|
|
13168
|
+
var _a;
|
|
12943
13169
|
var toolbar = (_a = this === null || this === void 0 ? void 0 : this.theOptions) === null || _a === void 0 ? void 0 : _a.toolbar;
|
|
12944
13170
|
var toolbarItems = toolbarCompose(toolbar === null || toolbar === void 0 ? void 0 : toolbar.toolbarItems);
|
|
12945
13171
|
var 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);
|
|
@@ -12950,7 +13176,6 @@
|
|
|
12950
13176
|
this.theGlobalToolbarInstance.toolbarItems = toolbarOption.toolbarEntity.global;
|
|
12951
13177
|
this.theGlobalToolbarInstance.containerClass = this.globalToolbarClass;
|
|
12952
13178
|
this.theGlobalToolbarInstance.align = toolbar === null || toolbar === void 0 ? void 0 : toolbar.align;
|
|
12953
|
-
this.theGlobalToolbarInstance.fontSize = (_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.fontSize;
|
|
12954
13179
|
this.theGlobalToolbarInstance.setToolbarClass();
|
|
12955
13180
|
this.theGlobalToolbarInstance.renderToolbarView();
|
|
12956
13181
|
}
|
|
@@ -13105,12 +13330,13 @@
|
|
|
13105
13330
|
useExisting: i0.forwardRef(function () { return TheEditorComponent; }),
|
|
13106
13331
|
multi: true
|
|
13107
13332
|
}
|
|
13108
|
-
], 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
|
|
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 });
|
|
13109
13334
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheEditorComponent, decorators: [{
|
|
13110
13335
|
type: i0.Component,
|
|
13111
13336
|
args: [{
|
|
13112
13337
|
selector: 'the-editor, theEditor',
|
|
13113
13338
|
templateUrl: 'editor.component.html',
|
|
13339
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
13114
13340
|
providers: [
|
|
13115
13341
|
TheToolbarService,
|
|
13116
13342
|
TheContextService,
|
|
@@ -13286,7 +13512,7 @@
|
|
|
13286
13512
|
return TheToolbarGroupComponent;
|
|
13287
13513
|
}());
|
|
13288
13514
|
TheToolbarGroupComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheToolbarGroupComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i1__namespace$3.ThyPopover }, { token: i0__namespace.ViewContainerRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
13289
|
-
TheToolbarGroupComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarGroupComponent, selector: "the-toolbar-group", inputs: { menus: "menus", item: "item" }, host: { listeners: { "mousedown": "mousedownHandler($event)", "click": "clickHandle($event)" }, classAttribute: "the-toolbar-group" }, viewQueries: [{ propertyName: "groupTemplate", first: true, predicate: ["groupTemplate"], descendants: true, read: i0.TemplateRef, static: true }], ngImport: i0__namespace, template: "<a thyIconNavLink [thyIconNavLinkIcon]=\"item.icon\" [thyTooltip]=\"item?.name\" thyTooltipPlacement=\"top\" [thyIconNavLinkActive]=\"active\"></a>\n\n<ng-template #groupTemplate>\n <the-toolbar class=\"group\" [editor]=\"editor\" [toolbarItems]=\"menus\" [isMore]=\"false\"></the-toolbar>\n</ng-template>\n", components: [{ type: i3__namespace.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "
|
|
13515
|
+
TheToolbarGroupComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarGroupComponent, selector: "the-toolbar-group", inputs: { menus: "menus", item: "item" }, host: { listeners: { "mousedown": "mousedownHandler($event)", "click": "clickHandle($event)" }, classAttribute: "the-toolbar-group" }, viewQueries: [{ propertyName: "groupTemplate", first: true, predicate: ["groupTemplate"], descendants: true, read: i0.TemplateRef, static: true }], ngImport: i0__namespace, template: "<a thyIconNavLink [thyIconNavLinkIcon]=\"item.icon\" [thyTooltip]=\"item?.name\" thyTooltipPlacement=\"top\" [thyIconNavLinkActive]=\"active\"></a>\n\n<ng-template #groupTemplate>\n <the-toolbar class=\"group\" [editor]=\"editor\" [toolbarItems]=\"menus\" [isMore]=\"false\"></the-toolbar>\n</ng-template>\n", components: [{ type: i3__namespace.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "containerClass", "isMore", "afterTemplate"] }], directives: [{ type: i5__namespace$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
|
|
13290
13516
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheToolbarGroupComponent, decorators: [{
|
|
13291
13517
|
type: i0.Component,
|
|
13292
13518
|
args: [{
|
|
@@ -13368,7 +13594,8 @@
|
|
|
13368
13594
|
TheTableComponent,
|
|
13369
13595
|
TheTableRowComponent,
|
|
13370
13596
|
TheTdComponent,
|
|
13371
|
-
ThePlaceholderComponent
|
|
13597
|
+
ThePlaceholderComponent,
|
|
13598
|
+
TheInlineCodeComponent
|
|
13372
13599
|
];
|
|
13373
13600
|
var PIPES = [ElementStylePipe, ElementClassPipe];
|
|
13374
13601
|
var TheEditorModule = /** @class */ (function () {
|
|
@@ -13411,7 +13638,8 @@
|
|
|
13411
13638
|
TheTableComponent,
|
|
13412
13639
|
TheTableRowComponent,
|
|
13413
13640
|
TheTdComponent,
|
|
13414
|
-
ThePlaceholderComponent
|
|
13641
|
+
ThePlaceholderComponent,
|
|
13642
|
+
TheInlineCodeComponent], imports: [i6.CommonModule, i1.SlateModule, i4$2.FormsModule, i4$1.ThyIconModule,
|
|
13415
13643
|
avatar.ThyAvatarModule,
|
|
13416
13644
|
i3.ThyNavModule,
|
|
13417
13645
|
i2$1.ThyFormModule,
|
|
@@ -13529,6 +13757,7 @@
|
|
|
13529
13757
|
exports.ToolbarMoreGroup = ToolbarMoreGroup;
|
|
13530
13758
|
exports.VOID_BLOCK_TYPES = VOID_BLOCK_TYPES;
|
|
13531
13759
|
exports.VerticalAlignEditor = VerticalAlignEditor;
|
|
13760
|
+
exports.ZERO_WIDTH_CHAR = ZERO_WIDTH_CHAR;
|
|
13532
13761
|
exports.createEmptyParagraph = createEmptyParagraph;
|
|
13533
13762
|
exports.dataDeserialize = dataDeserialize;
|
|
13534
13763
|
exports.dataSerializing = dataSerializing;
|