@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
|
@@ -20,7 +20,7 @@ import * as i2 from '@angular/cdk/overlay';
|
|
|
20
20
|
import { Overlay, OverlayModule } from '@angular/cdk/overlay';
|
|
21
21
|
import * as i1$1 from 'ngx-tethys/alert';
|
|
22
22
|
import { ThyAlertModule } from 'ngx-tethys/alert';
|
|
23
|
-
import { map, take, delay, startWith, distinctUntilChanged, skip, share, filter, throttleTime,
|
|
23
|
+
import { map, takeUntil, take, delay, startWith, distinctUntilChanged, skip, share, filter, throttleTime, mapTo, debounceTime, pairwise } from 'rxjs/operators';
|
|
24
24
|
import { ThyUploadStatus } from 'ngx-tethys/uploader';
|
|
25
25
|
import * as i1$2 from '@angular/platform-browser';
|
|
26
26
|
import { fromEvent, timer, Subject, combineLatest, Observable, BehaviorSubject, merge, ReplaySubject } from 'rxjs';
|
|
@@ -65,10 +65,10 @@ const PICTURE_ACCEPTED_UPLOAD_SIZE = 20;
|
|
|
65
65
|
const A_TAG_REL_ATTR = 'noopener noreferrer nofollow external ugc';
|
|
66
66
|
const LINK_DEFAULT_TEXT = '链接';
|
|
67
67
|
const TAB_SPACE = ' ';
|
|
68
|
-
const ZERO_WIDTH_CHAR = '\u200B';
|
|
69
68
|
const CLIPBOARD_FORMAT_KEY = 'x-theia-fragment';
|
|
70
69
|
const DEFAULT_SCROLL_CONTAINER = '.the-editable-container';
|
|
71
70
|
const ELEMENT_UNIQUE_ID = 'key';
|
|
71
|
+
const ZERO_WIDTH_CHAR = '\u200B';
|
|
72
72
|
var TheMode;
|
|
73
73
|
(function (TheMode) {
|
|
74
74
|
TheMode["fullMode"] = "full";
|
|
@@ -99,6 +99,7 @@ var ElementKinds;
|
|
|
99
99
|
ElementKinds["hr"] = "hr";
|
|
100
100
|
ElementKinds["link"] = "link";
|
|
101
101
|
ElementKinds["default"] = "paragraph";
|
|
102
|
+
ElementKinds["inlineCode"] = "inline-code";
|
|
102
103
|
})(ElementKinds || (ElementKinds = {}));
|
|
103
104
|
var Alignment;
|
|
104
105
|
(function (Alignment) {
|
|
@@ -112,6 +113,34 @@ var VerticalAlignment;
|
|
|
112
113
|
VerticalAlignment["middle"] = "middle";
|
|
113
114
|
VerticalAlignment["bottom"] = "bottom";
|
|
114
115
|
})(VerticalAlignment || (VerticalAlignment = {}));
|
|
116
|
+
var FontSizes;
|
|
117
|
+
(function (FontSizes) {
|
|
118
|
+
FontSizes["fontSize12"] = "12";
|
|
119
|
+
FontSizes["fontSize13"] = "13";
|
|
120
|
+
FontSizes["fontSize14"] = "14";
|
|
121
|
+
FontSizes["fontSize15"] = "15";
|
|
122
|
+
FontSizes["fontSize16"] = "16";
|
|
123
|
+
FontSizes["fontSize18"] = "18";
|
|
124
|
+
FontSizes["fontSize20"] = "20";
|
|
125
|
+
FontSizes["fontSize24"] = "24";
|
|
126
|
+
FontSizes["fontSize28"] = "28";
|
|
127
|
+
FontSizes["fontSize32"] = "32";
|
|
128
|
+
FontSizes["fontSize40"] = "40";
|
|
129
|
+
FontSizes["fontSize48"] = "48";
|
|
130
|
+
})(FontSizes || (FontSizes = {}));
|
|
131
|
+
const FontSizeTypes = [
|
|
132
|
+
FontSizes.fontSize12,
|
|
133
|
+
FontSizes.fontSize13,
|
|
134
|
+
FontSizes.fontSize14,
|
|
135
|
+
FontSizes.fontSize15,
|
|
136
|
+
FontSizes.fontSize16,
|
|
137
|
+
FontSizes.fontSize20,
|
|
138
|
+
FontSizes.fontSize24,
|
|
139
|
+
FontSizes.fontSize28,
|
|
140
|
+
FontSizes.fontSize32,
|
|
141
|
+
FontSizes.fontSize40,
|
|
142
|
+
FontSizes.fontSize48
|
|
143
|
+
];
|
|
115
144
|
var MarkTypes;
|
|
116
145
|
(function (MarkTypes) {
|
|
117
146
|
MarkTypes["bold"] = "bold";
|
|
@@ -120,8 +149,8 @@ var MarkTypes;
|
|
|
120
149
|
MarkTypes["strike"] = "strike";
|
|
121
150
|
MarkTypes["color"] = "color";
|
|
122
151
|
MarkTypes["backgroundColor"] = "background-color";
|
|
123
|
-
MarkTypes["codeLine"] = "code-line";
|
|
124
152
|
MarkTypes["fontSize"] = "font-size";
|
|
153
|
+
MarkTypes["codeLine"] = "code-line";
|
|
125
154
|
})(MarkTypes || (MarkTypes = {}));
|
|
126
155
|
var ToolbarActionTypes;
|
|
127
156
|
(function (ToolbarActionTypes) {
|
|
@@ -146,12 +175,12 @@ var ToolbarActionTypes;
|
|
|
146
175
|
const MarkProps = [
|
|
147
176
|
MarkTypes.backgroundColor,
|
|
148
177
|
MarkTypes.bold,
|
|
149
|
-
MarkTypes.codeLine,
|
|
150
178
|
MarkTypes.color,
|
|
151
179
|
MarkTypes.italic,
|
|
152
180
|
MarkTypes.strike,
|
|
153
181
|
MarkTypes.underline,
|
|
154
|
-
MarkTypes.fontSize
|
|
182
|
+
MarkTypes.fontSize,
|
|
183
|
+
MarkTypes.codeLine
|
|
155
184
|
];
|
|
156
185
|
const THE_INLINE_TOOLBAR_TYPES = [ElementKinds.default, ElementKinds.listItem, ElementKinds.checkItem];
|
|
157
186
|
const STANDARD_HEADING_TYPES = [
|
|
@@ -187,7 +216,7 @@ const DefaultGlobalToolbarDefinition = [
|
|
|
187
216
|
MarkTypes.italic,
|
|
188
217
|
MarkTypes.underline,
|
|
189
218
|
MarkTypes.strike,
|
|
190
|
-
|
|
219
|
+
ElementKinds.inlineCode,
|
|
191
220
|
MarkTypes.color,
|
|
192
221
|
MarkTypes.backgroundColor,
|
|
193
222
|
ToolbarActionTypes.split,
|
|
@@ -196,7 +225,7 @@ const DefaultGlobalToolbarDefinition = [
|
|
|
196
225
|
ToolbarActionTypes.split,
|
|
197
226
|
ElementKinds.numberedList,
|
|
198
227
|
ElementKinds.bulletedList,
|
|
199
|
-
ElementKinds.checkItem,
|
|
228
|
+
// ElementKinds.checkItem,
|
|
200
229
|
ToolbarActionTypes.split,
|
|
201
230
|
ElementKinds.link,
|
|
202
231
|
ElementKinds.image,
|
|
@@ -211,7 +240,7 @@ const DefaultInlineToolbarDefinition = [
|
|
|
211
240
|
MarkTypes.italic,
|
|
212
241
|
MarkTypes.underline,
|
|
213
242
|
MarkTypes.strike,
|
|
214
|
-
|
|
243
|
+
ElementKinds.inlineCode,
|
|
215
244
|
MarkTypes.color,
|
|
216
245
|
MarkTypes.backgroundColor,
|
|
217
246
|
ToolbarActionTypes.split,
|
|
@@ -224,7 +253,7 @@ const DefaultQuickToolbarDefinition = [
|
|
|
224
253
|
ToolbarActionTypes.split,
|
|
225
254
|
ElementKinds.numberedList,
|
|
226
255
|
ElementKinds.bulletedList,
|
|
227
|
-
ElementKinds.checkItem,
|
|
256
|
+
// ElementKinds.checkItem,
|
|
228
257
|
ToolbarActionTypes.split,
|
|
229
258
|
ElementKinds.link,
|
|
230
259
|
ElementKinds.image,
|
|
@@ -1719,6 +1748,49 @@ const BlockquoteEditor = {
|
|
|
1719
1748
|
}
|
|
1720
1749
|
};
|
|
1721
1750
|
|
|
1751
|
+
const InlineCodeEditor = {
|
|
1752
|
+
toggleInlineCode(editor, text) {
|
|
1753
|
+
const isActive = InlineCodeEditor.isInlineCodeActive(editor);
|
|
1754
|
+
if (isActive) {
|
|
1755
|
+
InlineCodeEditor.unwrapInlineCode(editor);
|
|
1756
|
+
return;
|
|
1757
|
+
}
|
|
1758
|
+
if (Range.isCollapsed(editor.selection)) {
|
|
1759
|
+
InlineCodeEditor.wrapInlineCode(editor, text);
|
|
1760
|
+
}
|
|
1761
|
+
else {
|
|
1762
|
+
const fragment = Node.fragment(editor, editor.selection)[0];
|
|
1763
|
+
const selectNode = Node.get(fragment, []);
|
|
1764
|
+
const selectText = Node.string(selectNode);
|
|
1765
|
+
InlineCodeEditor.wrapInlineCode(editor, selectText);
|
|
1766
|
+
}
|
|
1767
|
+
},
|
|
1768
|
+
wrapInlineCode(editor, text = '') {
|
|
1769
|
+
if (InlineCodeEditor.isInlineCodeActive(editor)) {
|
|
1770
|
+
InlineCodeEditor.unwrapInlineCode(editor);
|
|
1771
|
+
}
|
|
1772
|
+
const { selection } = editor;
|
|
1773
|
+
const isCollapsed = selection && Range.isCollapsed(selection);
|
|
1774
|
+
const inlineCode = {
|
|
1775
|
+
type: ElementKinds.inlineCode,
|
|
1776
|
+
children: isCollapsed ? [{ text: text ? text : ZERO_WIDTH_CHAR }] : []
|
|
1777
|
+
};
|
|
1778
|
+
if (isCollapsed) {
|
|
1779
|
+
Transforms.insertNodes(editor, inlineCode);
|
|
1780
|
+
}
|
|
1781
|
+
else {
|
|
1782
|
+
Transforms.wrapNodes(editor, inlineCode, { split: true });
|
|
1783
|
+
}
|
|
1784
|
+
},
|
|
1785
|
+
unwrapInlineCode(editor) {
|
|
1786
|
+
Transforms.unwrapNodes(editor, { match: n => Element$1.isElement(n) && n.type === ElementKinds.inlineCode });
|
|
1787
|
+
},
|
|
1788
|
+
isInlineCodeActive(editor) {
|
|
1789
|
+
const [inlineCode] = Editor.nodes(editor, { match: n => Element$1.isElement(n) && n.type === ElementKinds.inlineCode });
|
|
1790
|
+
return !!inlineCode;
|
|
1791
|
+
}
|
|
1792
|
+
};
|
|
1793
|
+
|
|
1722
1794
|
const autoFormatRules = [
|
|
1723
1795
|
{
|
|
1724
1796
|
type: ElementKinds.heading_1,
|
|
@@ -1776,10 +1848,13 @@ const autoFormatRules = [
|
|
|
1776
1848
|
insertTrigger: true
|
|
1777
1849
|
},
|
|
1778
1850
|
{
|
|
1779
|
-
type:
|
|
1851
|
+
type: ElementKinds.inlineCode,
|
|
1780
1852
|
between: ['`', '`'],
|
|
1781
1853
|
mode: 'inline',
|
|
1782
|
-
|
|
1854
|
+
format: (editor, text) => {
|
|
1855
|
+
InlineCodeEditor.toggleInlineCode(editor, text);
|
|
1856
|
+
Transforms.select(editor, Editor.after(editor, editor.selection));
|
|
1857
|
+
}
|
|
1783
1858
|
},
|
|
1784
1859
|
{
|
|
1785
1860
|
type: MarkTypes.strike,
|
|
@@ -2002,7 +2077,7 @@ const withDeserializeMd = (options) => (editor) => {
|
|
|
2002
2077
|
editor,
|
|
2003
2078
|
conversion: () => {
|
|
2004
2079
|
try {
|
|
2005
|
-
const html = marked(plainFragment, { gfm: true });
|
|
2080
|
+
const html = marked(plainFragment.replace(/\n```/g, "\n\n```"), { gfm: true });
|
|
2006
2081
|
const htmlDom = new DOMParser().parseFromString(html, 'text/html');
|
|
2007
2082
|
const fragment = TheiaConverter.convertToTheia(Array.from(htmlDom.body.children));
|
|
2008
2083
|
if (!isUnformatted(fragment)) {
|
|
@@ -2261,6 +2336,13 @@ class TheContextService {
|
|
|
2261
2336
|
}
|
|
2262
2337
|
return this.options;
|
|
2263
2338
|
}
|
|
2339
|
+
getTheOptions() {
|
|
2340
|
+
return this.options.theOptions;
|
|
2341
|
+
}
|
|
2342
|
+
getDefaultFontSize() {
|
|
2343
|
+
var _a;
|
|
2344
|
+
return ((_a = this.options.theOptions) === null || _a === void 0 ? void 0 : _a.fontSize) || FontSizes.fontSize14;
|
|
2345
|
+
}
|
|
2264
2346
|
getEditableElement() {
|
|
2265
2347
|
return this.options.nativeElement.querySelector('.the-editor-typo');
|
|
2266
2348
|
}
|
|
@@ -3313,9 +3395,73 @@ class TheListItemComponent extends TheBaseElementComponent {
|
|
|
3313
3395
|
ngOnInit() {
|
|
3314
3396
|
super.ngOnInit();
|
|
3315
3397
|
}
|
|
3398
|
+
onContextChange() {
|
|
3399
|
+
super.onContextChange();
|
|
3400
|
+
this.addFontSize();
|
|
3401
|
+
this.addMultiDigit();
|
|
3402
|
+
}
|
|
3316
3403
|
ngOnDestroy() {
|
|
3317
3404
|
super.ngOnDestroy();
|
|
3318
3405
|
}
|
|
3406
|
+
addFontSize() {
|
|
3407
|
+
var _a, _b;
|
|
3408
|
+
let firstText;
|
|
3409
|
+
for (const entry of Node.descendants(this.element)) {
|
|
3410
|
+
const node = entry[0];
|
|
3411
|
+
if (Text.isText(node) && !firstText) {
|
|
3412
|
+
firstText = node;
|
|
3413
|
+
break;
|
|
3414
|
+
}
|
|
3415
|
+
}
|
|
3416
|
+
if (!firstText) {
|
|
3417
|
+
return;
|
|
3418
|
+
}
|
|
3419
|
+
const { text } = firstText, rest = __rest(firstText, ["text"]);
|
|
3420
|
+
const size = rest[MarkTypes.fontSize];
|
|
3421
|
+
if (size) {
|
|
3422
|
+
const sizeClass = `font-size-${size}`;
|
|
3423
|
+
const isContains = (_b = (_a = this.elementRef.nativeElement) === null || _a === void 0 ? void 0 : _a.classList) === null || _b === void 0 ? void 0 : _b.contains(sizeClass);
|
|
3424
|
+
if (isContains) {
|
|
3425
|
+
return;
|
|
3426
|
+
}
|
|
3427
|
+
this.clearFontSize();
|
|
3428
|
+
this.elementRef.nativeElement.classList.add(sizeClass);
|
|
3429
|
+
this.fontSizeClass = sizeClass;
|
|
3430
|
+
}
|
|
3431
|
+
else {
|
|
3432
|
+
this.clearFontSize();
|
|
3433
|
+
}
|
|
3434
|
+
}
|
|
3435
|
+
clearFontSize() {
|
|
3436
|
+
if (this.fontSizeClass) {
|
|
3437
|
+
this.elementRef.nativeElement.classList.remove(this.fontSizeClass);
|
|
3438
|
+
this.fontSizeClass = null;
|
|
3439
|
+
}
|
|
3440
|
+
}
|
|
3441
|
+
getStart() {
|
|
3442
|
+
const parent = this.elementRef.nativeElement.closest('.slate-element-numbered-list');
|
|
3443
|
+
const start = (parent === null || parent === void 0 ? void 0 : parent.getAttribute('start')) || 1;
|
|
3444
|
+
return Number(start);
|
|
3445
|
+
}
|
|
3446
|
+
getLiIndex() {
|
|
3447
|
+
const path = findPath(this.editor, this.element);
|
|
3448
|
+
const index = path[path.length - 1];
|
|
3449
|
+
return index || 0;
|
|
3450
|
+
}
|
|
3451
|
+
addMultiDigit() {
|
|
3452
|
+
const start = this.getStart();
|
|
3453
|
+
const index = this.getLiIndex();
|
|
3454
|
+
const multiDigit = 'data-multi-digit';
|
|
3455
|
+
// start number + index
|
|
3456
|
+
// when it is greater than 9, it is a multi-digit serial number
|
|
3457
|
+
// exclude Font size >= 20
|
|
3458
|
+
if (start + index > 9) {
|
|
3459
|
+
this.elementRef.nativeElement.setAttribute(multiDigit, true);
|
|
3460
|
+
}
|
|
3461
|
+
else {
|
|
3462
|
+
this.elementRef.nativeElement.removeAttribute(multiDigit);
|
|
3463
|
+
}
|
|
3464
|
+
}
|
|
3319
3465
|
}
|
|
3320
3466
|
TheListItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheListItemComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3321
3467
|
TheListItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheListItemComponent, selector: "li[theLi]", usesInheritance: true, ngImport: i0, template: `<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>`, isInline: true, components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
|
|
@@ -3832,11 +3978,14 @@ const withMark = () => (editor) => {
|
|
|
3832
3978
|
delete marks[key];
|
|
3833
3979
|
editor.marks = marks;
|
|
3834
3980
|
const text = Editor.string(e, selection.anchor.path);
|
|
3835
|
-
if (text
|
|
3836
|
-
|
|
3981
|
+
if (text !== '') {
|
|
3982
|
+
Editor.setNormalizing(editor, false);
|
|
3983
|
+
e.insertText('');
|
|
3984
|
+
editor.marks = marks;
|
|
3985
|
+
Editor.setNormalizing(editor, true);
|
|
3837
3986
|
}
|
|
3838
|
-
|
|
3839
|
-
e.
|
|
3987
|
+
else {
|
|
3988
|
+
Transforms.unsetNodes(e, key, { at: selection.anchor.path });
|
|
3840
3989
|
}
|
|
3841
3990
|
if (shouldChange) {
|
|
3842
3991
|
editor.onChange();
|
|
@@ -3854,11 +4003,14 @@ const withMark = () => (editor) => {
|
|
|
3854
4003
|
const marks = Object.assign(Object.assign({}, (Editor.marks(e) || {})), { [key]: value });
|
|
3855
4004
|
editor.marks = marks;
|
|
3856
4005
|
const text = Editor.string(e, selection.anchor.path);
|
|
3857
|
-
if (text
|
|
3858
|
-
|
|
4006
|
+
if (text !== '') {
|
|
4007
|
+
Editor.setNormalizing(editor, false);
|
|
4008
|
+
e.insertText('');
|
|
4009
|
+
editor.marks = marks;
|
|
4010
|
+
Editor.setNormalizing(editor, true);
|
|
3859
4011
|
}
|
|
3860
|
-
|
|
3861
|
-
e.
|
|
4012
|
+
else {
|
|
4013
|
+
Transforms.setNodes(e, { [key]: value }, { at: selection.anchor.path });
|
|
3862
4014
|
}
|
|
3863
4015
|
}
|
|
3864
4016
|
}
|
|
@@ -3927,7 +4079,7 @@ const autoFormatBlock = (editor, type, at, { preFormat, format }, markups) => {
|
|
|
3927
4079
|
}
|
|
3928
4080
|
};
|
|
3929
4081
|
|
|
3930
|
-
const autoFormatInline = (editor, { type, between, markup, ignoreTrim }) => {
|
|
4082
|
+
const autoFormatInline = (editor, { type, between, markup, ignoreTrim, format }) => {
|
|
3931
4083
|
const selection = editor.selection;
|
|
3932
4084
|
const startMarkup = between ? between[0] : markup;
|
|
3933
4085
|
const endMarkup = between ? between[1] : '';
|
|
@@ -3971,22 +4123,35 @@ const autoFormatInline = (editor, { type, between, markup, ignoreTrim }) => {
|
|
|
3971
4123
|
}
|
|
3972
4124
|
});
|
|
3973
4125
|
}
|
|
3974
|
-
// add mark to the text between the markups
|
|
3975
|
-
Transforms.select(editor, markupRange);
|
|
3976
|
-
editor.addMark(type, true);
|
|
3977
|
-
Transforms.collapse(editor, { edge: 'end' });
|
|
3978
|
-
editor.removeMark(type, false);
|
|
3979
|
-
// delete start markup
|
|
3980
4126
|
const startMarkupPointBefore = getPointBefore(editor, selection, {
|
|
3981
4127
|
matchString: startMarkup,
|
|
3982
4128
|
skipInvalid: true
|
|
3983
4129
|
});
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
4130
|
+
if (format) {
|
|
4131
|
+
const markupText = getText(editor, markupRange);
|
|
4132
|
+
format(editor, markupText);
|
|
4133
|
+
// delete start to end selection
|
|
4134
|
+
Transforms.delete(editor, {
|
|
4135
|
+
at: {
|
|
4136
|
+
anchor: startMarkupPointBefore,
|
|
4137
|
+
focus: selection.anchor
|
|
4138
|
+
}
|
|
4139
|
+
});
|
|
4140
|
+
}
|
|
4141
|
+
else {
|
|
4142
|
+
// add mark to the text between the markups
|
|
4143
|
+
Transforms.select(editor, markupRange);
|
|
4144
|
+
editor.addMark(type, true);
|
|
4145
|
+
Transforms.collapse(editor, { edge: 'end' });
|
|
4146
|
+
editor.removeMark(type, false);
|
|
4147
|
+
// delete start markup
|
|
4148
|
+
Transforms.delete(editor, {
|
|
4149
|
+
at: {
|
|
4150
|
+
anchor: startMarkupPointBefore,
|
|
4151
|
+
focus: startMarkupPointAfter
|
|
4152
|
+
}
|
|
4153
|
+
});
|
|
4154
|
+
}
|
|
3990
4155
|
return true;
|
|
3991
4156
|
};
|
|
3992
4157
|
|
|
@@ -4059,6 +4224,7 @@ const withAutoFormat = ({ rules }) => (editor) => {
|
|
|
4059
4224
|
type,
|
|
4060
4225
|
between,
|
|
4061
4226
|
ignoreTrim,
|
|
4227
|
+
format,
|
|
4062
4228
|
markup: Array.isArray(markup) ? markup[0] : markup
|
|
4063
4229
|
})) {
|
|
4064
4230
|
return valid();
|
|
@@ -5385,14 +5551,6 @@ const MarkOptions = [
|
|
|
5385
5551
|
shortcutKey: `${CONTROL_KEY}+U`,
|
|
5386
5552
|
execute: editor => MarkEditor.toggleMark(editor, MarkTypes.underline),
|
|
5387
5553
|
active: editor => MarkEditor.isMarkActive(editor, MarkTypes.underline)
|
|
5388
|
-
},
|
|
5389
|
-
{
|
|
5390
|
-
key: MarkTypes.codeLine,
|
|
5391
|
-
icon: 'code',
|
|
5392
|
-
name: '行内代码',
|
|
5393
|
-
shortcutKey: `${CONTROL_KEY}+E`,
|
|
5394
|
-
execute: editor => MarkEditor.toggleMark(editor, MarkTypes.codeLine),
|
|
5395
|
-
active: editor => MarkEditor.isMarkActive(editor, MarkTypes.codeLine)
|
|
5396
5554
|
}
|
|
5397
5555
|
];
|
|
5398
5556
|
|
|
@@ -5450,6 +5608,15 @@ const HeadingEditor = {
|
|
|
5450
5608
|
split: true
|
|
5451
5609
|
});
|
|
5452
5610
|
Transforms.setNodes(editor, { type: heading });
|
|
5611
|
+
const entry = anchorBlockEntry(editor);
|
|
5612
|
+
const unMarks = {
|
|
5613
|
+
[MarkTypes.fontSize]: null
|
|
5614
|
+
};
|
|
5615
|
+
if (entry) {
|
|
5616
|
+
setMarks(editor, unMarks, entry[1]);
|
|
5617
|
+
return;
|
|
5618
|
+
}
|
|
5619
|
+
setMarks(editor, unMarks, editor.selection);
|
|
5453
5620
|
});
|
|
5454
5621
|
},
|
|
5455
5622
|
isHeadingActive(editor, heading) {
|
|
@@ -5466,6 +5633,7 @@ const HeadingOptions = [
|
|
|
5466
5633
|
name: '正文',
|
|
5467
5634
|
key: ElementKinds.headingList,
|
|
5468
5635
|
type: ToolbarItemType.toolDropdown,
|
|
5636
|
+
dropdownItemKey: ElementKinds.paragraph,
|
|
5469
5637
|
includes: [ElementKinds.paragraph, ...STANDARD_HEADING_TYPES]
|
|
5470
5638
|
},
|
|
5471
5639
|
{
|
|
@@ -5560,6 +5728,7 @@ const AlignOptions = [
|
|
|
5560
5728
|
key: ToolbarActionTypes.alignType,
|
|
5561
5729
|
type: ToolbarItemType.toolDropdown,
|
|
5562
5730
|
dropdownMode: DropdownMode.icon,
|
|
5731
|
+
dropdownItemKey: ToolbarActionTypes.alignLeft,
|
|
5563
5732
|
includes: [ToolbarActionTypes.alignLeft, ToolbarActionTypes.alignCenter, ToolbarActionTypes.alignRight],
|
|
5564
5733
|
name: '对齐方式'
|
|
5565
5734
|
},
|
|
@@ -6176,6 +6345,7 @@ class TheToolbarDropdownComponent extends TheToolbarBaseItemComponent {
|
|
|
6176
6345
|
this.overlay = overlay;
|
|
6177
6346
|
this.mode = DropdownMode.text;
|
|
6178
6347
|
this.dropdownMode = DropdownMode;
|
|
6348
|
+
this.disabled = false;
|
|
6179
6349
|
}
|
|
6180
6350
|
set item(i) {
|
|
6181
6351
|
this._item = i;
|
|
@@ -6190,7 +6360,7 @@ class TheToolbarDropdownComponent extends TheToolbarBaseItemComponent {
|
|
|
6190
6360
|
toggleDropdown(event) {
|
|
6191
6361
|
var _a;
|
|
6192
6362
|
super.execute(event);
|
|
6193
|
-
if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.disabled) {
|
|
6363
|
+
if (((_a = this.editor) === null || _a === void 0 ? void 0 : _a.disabled) || this.disabled) {
|
|
6194
6364
|
return;
|
|
6195
6365
|
}
|
|
6196
6366
|
this.openDropdownPopover();
|
|
@@ -6200,6 +6370,9 @@ class TheToolbarDropdownComponent extends TheToolbarBaseItemComponent {
|
|
|
6200
6370
|
this.closeDropdownPopover();
|
|
6201
6371
|
}
|
|
6202
6372
|
}
|
|
6373
|
+
get disabledState() {
|
|
6374
|
+
return this.disabled;
|
|
6375
|
+
}
|
|
6203
6376
|
ngOnInit() {
|
|
6204
6377
|
var _a;
|
|
6205
6378
|
if (!this.template) {
|
|
@@ -6213,12 +6386,14 @@ class TheToolbarDropdownComponent extends TheToolbarBaseItemComponent {
|
|
|
6213
6386
|
}
|
|
6214
6387
|
}
|
|
6215
6388
|
statusChange(editor) {
|
|
6389
|
+
var _a, _b;
|
|
6390
|
+
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;
|
|
6216
6391
|
const activeItem = this.menus.find(i => {
|
|
6217
6392
|
if (i === null || i === void 0 ? void 0 : i.active) {
|
|
6218
6393
|
return i === null || i === void 0 ? void 0 : i.active(editor);
|
|
6219
6394
|
}
|
|
6220
6395
|
});
|
|
6221
|
-
this.activeMenu = activeItem ? activeItem : this.
|
|
6396
|
+
this.activeMenu = activeItem ? activeItem : this.item;
|
|
6222
6397
|
}
|
|
6223
6398
|
itemMousedown(event, item) {
|
|
6224
6399
|
super.execute(event);
|
|
@@ -6272,7 +6447,7 @@ class TheToolbarDropdownComponent extends TheToolbarBaseItemComponent {
|
|
|
6272
6447
|
}
|
|
6273
6448
|
}
|
|
6274
6449
|
TheToolbarDropdownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarDropdownComponent, deps: [{ token: i0.ElementRef }, { token: i1$3.ThyPopover }, { token: i0.ViewContainerRef }, { token: i2.Overlay }], target: i0.ɵɵFactoryTarget.Component });
|
|
6275
|
-
TheToolbarDropdownComponent.ɵcmp = i0.ɵɵ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, 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.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i5$2.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }, { type: i5$2.ThyActionMenuDividerComponent, selector: "thy-action-menu-divider", inputs: ["thyTitle", "thyType"] }], directives: [{ type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i5$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$2.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i5$2.ThyActionMenuItemActiveDirective, selector: "[thyActionMenuItemActive]", inputs: ["thyActionMenuItemActive"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i5$2.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i5$2.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }] });
|
|
6450
|
+
TheToolbarDropdownComponent.ɵcmp = i0.ɵɵ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, 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.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i5$2.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }, { type: i5$2.ThyActionMenuDividerComponent, selector: "thy-action-menu-divider", inputs: ["thyTitle", "thyType"] }], directives: [{ type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i5$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$2.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i5$2.ThyActionMenuItemActiveDirective, selector: "[thyActionMenuItemActive]", inputs: ["thyActionMenuItemActive"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i5$2.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i5$2.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }] });
|
|
6276
6451
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarDropdownComponent, decorators: [{
|
|
6277
6452
|
type: Component,
|
|
6278
6453
|
args: [{
|
|
@@ -6307,6 +6482,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
|
|
|
6307
6482
|
}], handleDocumentMouseDown: [{
|
|
6308
6483
|
type: HostListener,
|
|
6309
6484
|
args: ['document: mousedown', ['$event']]
|
|
6485
|
+
}], disabledState: [{
|
|
6486
|
+
type: HostBinding,
|
|
6487
|
+
args: ['class.disabled']
|
|
6310
6488
|
}] } });
|
|
6311
6489
|
|
|
6312
6490
|
class NavSplitLineComponent {
|
|
@@ -6358,8 +6536,9 @@ class TheCodeComponent extends TheBaseElementComponent {
|
|
|
6358
6536
|
this.menus = CODE_MODES.map(item => {
|
|
6359
6537
|
return { key: item.value, name: item.showName };
|
|
6360
6538
|
});
|
|
6539
|
+
this.destroy$ = new Subject();
|
|
6361
6540
|
this.ToolbarItemMode = ToolbarItemMode;
|
|
6362
|
-
this.
|
|
6541
|
+
this.isHightLight = false;
|
|
6363
6542
|
this.resizeHeight = null;
|
|
6364
6543
|
this.options = {
|
|
6365
6544
|
mode: this.menus[0].key,
|
|
@@ -6396,13 +6575,21 @@ class TheCodeComponent extends TheBaseElementComponent {
|
|
|
6396
6575
|
if (this.resizeHeight !== this.element.height) {
|
|
6397
6576
|
this.useHeight();
|
|
6398
6577
|
}
|
|
6399
|
-
if (!this.isCollapsed) {
|
|
6400
|
-
this.isFocusCode = false;
|
|
6401
|
-
}
|
|
6402
6578
|
}
|
|
6403
6579
|
}
|
|
6404
6580
|
ngOnInit() {
|
|
6405
6581
|
super.ngOnInit();
|
|
6582
|
+
this.ngZone.runOutsideAngular(() => {
|
|
6583
|
+
fromEvent(this.nativeElement, 'mousedown')
|
|
6584
|
+
.pipe(takeUntil(this.destroy$))
|
|
6585
|
+
.subscribe(event => {
|
|
6586
|
+
event.stopPropagation();
|
|
6587
|
+
const isBlockOperation = this.isCollapsed &&
|
|
6588
|
+
this.nativeElement.querySelector('.the-code-block-operation').contains(event.target);
|
|
6589
|
+
const isCodemirror = this.nativeElement.querySelector('.ng-codemirror').contains(event.target);
|
|
6590
|
+
this.isHightLight = !isCodemirror && !isBlockOperation;
|
|
6591
|
+
});
|
|
6592
|
+
});
|
|
6406
6593
|
this.elementRef.nativeElement.classList.add('the-code-container');
|
|
6407
6594
|
}
|
|
6408
6595
|
ngAfterViewInit() {
|
|
@@ -6444,11 +6631,11 @@ class TheCodeComponent extends TheBaseElementComponent {
|
|
|
6444
6631
|
}
|
|
6445
6632
|
}
|
|
6446
6633
|
codeChange($event) {
|
|
6634
|
+
this.isHightLight = false;
|
|
6447
6635
|
CodeEditor.setCodeAttribute(this.editor, this.element, { content: $event });
|
|
6448
6636
|
}
|
|
6449
6637
|
onDelete(event) {
|
|
6450
6638
|
event.preventDefault();
|
|
6451
|
-
this.isFocusCode = false;
|
|
6452
6639
|
deleteElement(this.editor, this.element);
|
|
6453
6640
|
}
|
|
6454
6641
|
onCopy(event) {
|
|
@@ -6466,8 +6653,9 @@ class TheCodeComponent extends TheBaseElementComponent {
|
|
|
6466
6653
|
AngularEditor.deselect(this.editor);
|
|
6467
6654
|
}
|
|
6468
6655
|
focusChange(codeMirrorFocused) {
|
|
6469
|
-
if (codeMirrorFocused)
|
|
6470
|
-
this.
|
|
6656
|
+
if (codeMirrorFocused) {
|
|
6657
|
+
this.isHightLight = false;
|
|
6658
|
+
}
|
|
6471
6659
|
}
|
|
6472
6660
|
useMode() {
|
|
6473
6661
|
this.options = Object.assign(Object.assign({}, this.options), { mode: this.element.language });
|
|
@@ -6494,12 +6682,17 @@ class TheCodeComponent extends TheBaseElementComponent {
|
|
|
6494
6682
|
CodeEditor.setCodeAttribute(this.editor, this.element, { height: this.resizeHeight });
|
|
6495
6683
|
}
|
|
6496
6684
|
onChangeWrap(value) {
|
|
6685
|
+
this.isHightLight = false;
|
|
6497
6686
|
this.options = Object.assign(Object.assign({}, this.options), { lineWrapping: value || false });
|
|
6498
6687
|
CodeEditor.setCodeAttribute(this.editor, this.element, { autoWrap: value ? value : null });
|
|
6499
6688
|
}
|
|
6689
|
+
ngOnDestroy() {
|
|
6690
|
+
this.destroy$.next();
|
|
6691
|
+
this.destroy$.complete();
|
|
6692
|
+
}
|
|
6500
6693
|
}
|
|
6501
6694
|
TheCodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheCodeComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$4.ThyNotifyService }, { token: TheContextService }, { token: i0.NgZone }, { token: THE_CODE_MODE_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
|
|
6502
|
-
TheCodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheCodeComponent, selector: "div[theCode]", viewQueries: [{ propertyName: "codemirror", first: true, predicate: ["codemirror"], descendants: true, read: CodeMirrorComponent }], usesInheritance: true, ngImport: i0, template: "<div contenteditable=\"false\" class=\"the-code-block-operation\" *ngIf=\"
|
|
6695
|
+
TheCodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheCodeComponent, selector: "div[theCode]", viewQueries: [{ propertyName: "codemirror", first: true, predicate: ["codemirror"], descendants: true, read: CodeMirrorComponent }], usesInheritance: true, ngImport: i0, 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.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: TheToolbarDropdownComponent, selector: "the-toolbar-dropdown", inputs: ["toolbarItem", "menus", "mode", "item", "itemMousedownHandle"] }, { type: i3.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }, { type: i6$1.ThySwitchComponent, selector: "thy-switch", inputs: ["thyType", "thySize", "thyDisabled"], outputs: ["thyChange"] }, { type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i8.CodeMirrorComponent, selector: "ng-codemirror, [ngCodeMirror]", inputs: ["autoMaxHeight", "delayRefreshTime", "options"], outputs: ["focusChange"] }, { type: i9.ThyResizeHandleComponent, selector: "thy-resize-handle, [thy-resize-handle]", inputs: ["thyDirection"], outputs: ["thyMouseDown"], exportAs: ["thyResizeHandle"] }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i4$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i9.ThyResizableDirective, selector: "[thyResizable]", inputs: ["thyBounds", "thyMaxHeight", "thyMaxWidth", "thyMinHeight", "thyMinWidth", "thyGridColumnCount", "thyMaxColumn", "thyMinColumn", "thyLockAspectRatio", "thyPreview", "thyDisabled"], outputs: ["thyResize", "thyResizeEnd", "thyResizeStart"] }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6503
6696
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheCodeComponent, decorators: [{
|
|
6504
6697
|
type: Component,
|
|
6505
6698
|
args: [{
|
|
@@ -6781,7 +6974,9 @@ class TheBaseLinkComponent extends TheBaseElementComponent {
|
|
|
6781
6974
|
}
|
|
6782
6975
|
}
|
|
6783
6976
|
mousedownHandle(event) {
|
|
6784
|
-
this.
|
|
6977
|
+
if (!this.readonly && !this.editor.disabled) {
|
|
6978
|
+
this.openLinkHover();
|
|
6979
|
+
}
|
|
6785
6980
|
}
|
|
6786
6981
|
openLinkEdit(tag) {
|
|
6787
6982
|
if (this.linkHoverOpened) {
|
|
@@ -10632,6 +10827,13 @@ class TheToolbarItemComponent extends TheToolbarBaseItemComponent {
|
|
|
10632
10827
|
this.itemMode = ToolbarItemMode.horizontal;
|
|
10633
10828
|
this.ToolbarItemMode = ToolbarItemMode;
|
|
10634
10829
|
this.active = false;
|
|
10830
|
+
this.disabled = false;
|
|
10831
|
+
}
|
|
10832
|
+
toggleDropdown(event) {
|
|
10833
|
+
super.execute(event);
|
|
10834
|
+
}
|
|
10835
|
+
get disabledState() {
|
|
10836
|
+
return this.disabled;
|
|
10635
10837
|
}
|
|
10636
10838
|
ngOnInit() {
|
|
10637
10839
|
var _a, _b;
|
|
@@ -10640,13 +10842,14 @@ class TheToolbarItemComponent extends TheToolbarBaseItemComponent {
|
|
|
10640
10842
|
}
|
|
10641
10843
|
}
|
|
10642
10844
|
statusChange(editor) {
|
|
10643
|
-
var _a, _b;
|
|
10644
|
-
this.
|
|
10845
|
+
var _a, _b, _c, _d;
|
|
10846
|
+
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;
|
|
10847
|
+
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;
|
|
10645
10848
|
}
|
|
10646
10849
|
execute(event) {
|
|
10647
10850
|
var _a, _b, _c;
|
|
10648
10851
|
super.execute(event);
|
|
10649
|
-
if (
|
|
10852
|
+
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)) {
|
|
10650
10853
|
return;
|
|
10651
10854
|
}
|
|
10652
10855
|
(_c = this.item) === null || _c === void 0 ? void 0 : _c.execute(this.editor);
|
|
@@ -10662,7 +10865,7 @@ class TheToolbarItemComponent extends TheToolbarBaseItemComponent {
|
|
|
10662
10865
|
}
|
|
10663
10866
|
}
|
|
10664
10867
|
TheToolbarItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarItemComponent, deps: [{ token: i0.NgZone }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Component });
|
|
10665
|
-
TheToolbarItemComponent.ɵcmp = i0.ɵɵ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: ViewContainerRef, static: true }], usesInheritance: true, ngImport: i0, template: `
|
|
10868
|
+
TheToolbarItemComponent.ɵcmp = i0.ɵɵ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: ViewContainerRef, static: true }], usesInheritance: true, ngImport: i0, template: `
|
|
10666
10869
|
<ng-container *ngIf="itemMode === ToolbarItemMode.horizontal; else selectionItem">
|
|
10667
10870
|
<a
|
|
10668
10871
|
thyIconNavLink
|
|
@@ -10721,6 +10924,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
|
|
|
10721
10924
|
}], toolbarContainer: [{
|
|
10722
10925
|
type: ViewChild,
|
|
10723
10926
|
args: ['toolbarContainer', { read: ViewContainerRef, static: true }]
|
|
10927
|
+
}], toggleDropdown: [{
|
|
10928
|
+
type: HostListener,
|
|
10929
|
+
args: ['mousedown', ['$event']]
|
|
10930
|
+
}], disabledState: [{
|
|
10931
|
+
type: HostBinding,
|
|
10932
|
+
args: ['class.disabled']
|
|
10724
10933
|
}] } });
|
|
10725
10934
|
|
|
10726
10935
|
class TheQuickToolbarComponent extends mixinUnsubscribe(MixinBase) {
|
|
@@ -10885,130 +11094,178 @@ const withSoftBreak = (options = { rules: [{ hotkey: 'shift+enter' }] }) => (edi
|
|
|
10885
11094
|
return editor;
|
|
10886
11095
|
};
|
|
10887
11096
|
|
|
10888
|
-
|
|
10889
|
-
|
|
10890
|
-
|
|
10891
|
-
|
|
10892
|
-
|
|
10893
|
-
|
|
10894
|
-
|
|
10895
|
-
|
|
10896
|
-
this.disabled = false;
|
|
10897
|
-
this.disableGroup = HEADING_TYPES;
|
|
10898
|
-
this.toolbarItemContainer = true;
|
|
10899
|
-
this.fontSizeToolbarItem = true;
|
|
10900
|
-
}
|
|
10901
|
-
get isOpen() {
|
|
10902
|
-
return this.dropdownPopoverRef && this.dropdownPopoverRef.getOverlayRef() && this.dropdownPopoverRef.getOverlayRef().hasAttached();
|
|
10903
|
-
}
|
|
10904
|
-
get disableClass() {
|
|
10905
|
-
return this.disabled;
|
|
10906
|
-
}
|
|
10907
|
-
toggleDropdown(event) {
|
|
10908
|
-
var _a;
|
|
10909
|
-
super.execute(event);
|
|
10910
|
-
if (((_a = this.editor) === null || _a === void 0 ? void 0 : _a.disabled) || this.disabled) {
|
|
11097
|
+
const FontSizeEditor = {
|
|
11098
|
+
setFontSize(editor, size) {
|
|
11099
|
+
const contextService = editor.injector.get(TheContextService);
|
|
11100
|
+
const defaultFontSize = contextService.getDefaultFontSize();
|
|
11101
|
+
const marks = getSelectionMarks(editor);
|
|
11102
|
+
const fontSizeMark = marks[MarkTypes.fontSize];
|
|
11103
|
+
const isDefaultFontSize = size === defaultFontSize;
|
|
11104
|
+
if (!fontSizeMark && isDefaultFontSize) {
|
|
10911
11105
|
return;
|
|
10912
11106
|
}
|
|
10913
|
-
|
|
10914
|
-
|
|
10915
|
-
|
|
10916
|
-
if (!this.elementRef.nativeElement.contains(event.target)) {
|
|
10917
|
-
this.closeDropdownPopover();
|
|
11107
|
+
// unset fontSize
|
|
11108
|
+
if (FontSizeEditor.unsetFontSize(editor, size, fontSizeMark, isDefaultFontSize)) {
|
|
11109
|
+
return;
|
|
10918
11110
|
}
|
|
10919
|
-
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
-
|
|
11111
|
+
FontSizeEditor.setFontSizeMark(editor, size);
|
|
11112
|
+
},
|
|
11113
|
+
setFontSizeMark(editor, size) {
|
|
11114
|
+
// set Table selectedCells fontSize
|
|
11115
|
+
if (TableEditor.toggleMark(editor, false, MarkTypes.fontSize, Number(size))) {
|
|
11116
|
+
return;
|
|
11117
|
+
}
|
|
11118
|
+
// set paragraph text fontSize
|
|
11119
|
+
Editor.addMark(editor, MarkTypes.fontSize, Number(size));
|
|
11120
|
+
},
|
|
11121
|
+
unsetFontSize(editor, size, fontSizeMark, isDefaultFontSize) {
|
|
11122
|
+
const isTable = TableEditor.isActive(editor);
|
|
11123
|
+
if (fontSizeMark && isDefaultFontSize) {
|
|
11124
|
+
// unset Table selectedCells fontSize
|
|
11125
|
+
if (isTable && TableEditor.toggleMark(editor, true, MarkTypes.fontSize, Number(size))) {
|
|
11126
|
+
return true;
|
|
11127
|
+
}
|
|
11128
|
+
// unset paragraph text fontSize
|
|
11129
|
+
setMarks(editor, {
|
|
11130
|
+
[MarkTypes.fontSize]: null
|
|
11131
|
+
}, editor.selection);
|
|
11132
|
+
return true;
|
|
11133
|
+
}
|
|
11134
|
+
return false;
|
|
11135
|
+
},
|
|
11136
|
+
isFontSizeActive(editor, size) {
|
|
10924
11137
|
if (editor.selection) {
|
|
10925
11138
|
const anchorBlock$1 = anchorBlock(editor);
|
|
10926
|
-
|
|
10927
|
-
|
|
10928
|
-
|
|
10929
|
-
|
|
11139
|
+
switch (anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type) {
|
|
11140
|
+
case ElementKinds.heading_1:
|
|
11141
|
+
return size === FontSizes.fontSize28;
|
|
11142
|
+
case ElementKinds.heading_2:
|
|
11143
|
+
return size === FontSizes.fontSize24;
|
|
11144
|
+
case ElementKinds.heading_3:
|
|
11145
|
+
return size === FontSizes.fontSize20;
|
|
11146
|
+
case ElementKinds.heading_4:
|
|
11147
|
+
return size === FontSizes.fontSize18;
|
|
11148
|
+
case ElementKinds.heading_5:
|
|
11149
|
+
return size === FontSizes.fontSize16;
|
|
11150
|
+
case ElementKinds.heading_6:
|
|
11151
|
+
return size === FontSizes.fontSize14;
|
|
11152
|
+
case ElementKinds.paragraph:
|
|
11153
|
+
const marks = getSelectionMarks(editor);
|
|
11154
|
+
const fontSizeMark = marks[MarkTypes.fontSize];
|
|
11155
|
+
return Number(size) === fontSizeMark;
|
|
11156
|
+
default:
|
|
11157
|
+
return false;
|
|
10930
11158
|
}
|
|
10931
|
-
const marks = getSelectionMarks(editor);
|
|
10932
|
-
const fontSizeMark = marks[MarkTypes.fontSize];
|
|
10933
|
-
this.activeSize = fontSizeMark ? fontSizeMark : this.fontSizes[2];
|
|
10934
|
-
this.disabled = false;
|
|
10935
|
-
}
|
|
10936
|
-
}
|
|
10937
|
-
itemMousedown(event, size) {
|
|
10938
|
-
var _a, _b;
|
|
10939
|
-
super.execute(event);
|
|
10940
|
-
this.closeDropdownPopover();
|
|
10941
|
-
if (((_a = this.editor) === null || _a === void 0 ? void 0 : _a.disabled) || ((_b = this.editor) === null || _b === void 0 ? void 0 : _b.readOnly)) {
|
|
10942
|
-
return;
|
|
10943
11159
|
}
|
|
10944
|
-
|
|
10945
|
-
|
|
10946
|
-
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
|
|
10950
|
-
|
|
10951
|
-
var _a;
|
|
10952
|
-
this.dropdownPopoverRef = this.thyPopover.open(this.dropdownTemplate, {
|
|
10953
|
-
origin: this.elementRef,
|
|
10954
|
-
panelClass: ['the-toolbar-dropdown-popover', (_a = this.item) === null || _a === void 0 ? void 0 : _a.key],
|
|
10955
|
-
placement: 'bottomLeft',
|
|
10956
|
-
insideClosable: false,
|
|
10957
|
-
backdropClosable: true,
|
|
10958
|
-
hasBackdrop: false,
|
|
10959
|
-
offset: 10,
|
|
10960
|
-
viewContainerRef: this.viewContainerRef,
|
|
10961
|
-
scrollStrategy: this.overlay.scrollStrategies.reposition()
|
|
10962
|
-
});
|
|
10963
|
-
}
|
|
10964
|
-
closeDropdownPopover() {
|
|
10965
|
-
var _a;
|
|
10966
|
-
if (this.dropdownPopoverRef) {
|
|
10967
|
-
(_a = this.dropdownPopoverRef) === null || _a === void 0 ? void 0 : _a.close();
|
|
11160
|
+
return false;
|
|
11161
|
+
},
|
|
11162
|
+
isDisabled(editor) {
|
|
11163
|
+
if (editor.selection) {
|
|
11164
|
+
const disableGroup = HEADING_TYPES;
|
|
11165
|
+
const anchorBlock$1 = anchorBlock(editor);
|
|
11166
|
+
return anchorBlock$1 && disableGroup.includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
|
|
10968
11167
|
}
|
|
11168
|
+
return false;
|
|
10969
11169
|
}
|
|
10970
|
-
}
|
|
10971
|
-
TheFontSizeToolbarItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheFontSizeToolbarItemComponent, deps: [{ token: i0.ElementRef }, { token: i1$3.ThyPopover }, { token: i0.ViewContainerRef }, { token: i2.Overlay }], target: i0.ɵɵFactoryTarget.Component });
|
|
10972
|
-
TheFontSizeToolbarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheFontSizeToolbarItemComponent, selector: "the-font-size-toolbar-item", inputs: { editor: "editor", item: "item" }, host: { listeners: { "mousedown": "toggleDropdown($event)", "document: mousedown": "handleDocumentMouseDown($event)" }, properties: { "class.the-toolbar-dropdown-container": "this.toolbarItemContainer", "class.the-font-size-toolbar-item": "this.fontSizeToolbarItem", "class.disabled": "this.disableClass" } }, viewQueries: [{ propertyName: "dropdownTemplate", first: true, predicate: ["dropdownTemplate"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<a thyIconNavLink class=\"text-mode\" [thyTooltip]=\"item?.name\" thyTooltipPlacement=\"top\">\n <span *ngIf=\"activeSize\" class=\"show-text\">{{ activeSize }}</span>\n <thy-icon class=\"text-caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n</a>\n\n<ng-template #dropdownTemplate>\n <thy-action-menu class=\"dropdown\">\n <ng-container *ngFor=\"let size of fontSizes\">\n <a\n thyActionMenuItem\n href=\"javascript:;\"\n [thyActionMenuItemActive]=\"size === activeSize\"\n (mousedown)=\"itemMousedown($event, size)\"\n >\n <span thyActionMenuItemName>{{ size }}</span>\n </a>\n </ng-container>\n </thy-action-menu>\n</ng-template>\n", components: [{ type: i3.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i5$2.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }], directives: [{ type: i5$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5$2.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i5$2.ThyActionMenuItemActiveDirective, selector: "[thyActionMenuItemActive]", inputs: ["thyActionMenuItemActive"] }, { type: i5$2.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }] });
|
|
10973
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheFontSizeToolbarItemComponent, decorators: [{
|
|
10974
|
-
type: Component,
|
|
10975
|
-
args: [{
|
|
10976
|
-
selector: 'the-font-size-toolbar-item',
|
|
10977
|
-
templateUrl: './toolbar-item.component.html'
|
|
10978
|
-
}]
|
|
10979
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$3.ThyPopover }, { type: i0.ViewContainerRef }, { type: i2.Overlay }]; }, propDecorators: { editor: [{
|
|
10980
|
-
type: Input
|
|
10981
|
-
}], item: [{
|
|
10982
|
-
type: Input
|
|
10983
|
-
}], dropdownTemplate: [{
|
|
10984
|
-
type: ViewChild,
|
|
10985
|
-
args: ['dropdownTemplate', { static: true }]
|
|
10986
|
-
}], toolbarItemContainer: [{
|
|
10987
|
-
type: HostBinding,
|
|
10988
|
-
args: ['class.the-toolbar-dropdown-container']
|
|
10989
|
-
}], fontSizeToolbarItem: [{
|
|
10990
|
-
type: HostBinding,
|
|
10991
|
-
args: ['class.the-font-size-toolbar-item']
|
|
10992
|
-
}], disableClass: [{
|
|
10993
|
-
type: HostBinding,
|
|
10994
|
-
args: ['class.disabled']
|
|
10995
|
-
}], toggleDropdown: [{
|
|
10996
|
-
type: HostListener,
|
|
10997
|
-
args: ['mousedown', ['$event']]
|
|
10998
|
-
}], handleDocumentMouseDown: [{
|
|
10999
|
-
type: HostListener,
|
|
11000
|
-
args: ['document: mousedown', ['$event']]
|
|
11001
|
-
}] } });
|
|
11170
|
+
};
|
|
11002
11171
|
|
|
11003
|
-
const
|
|
11172
|
+
const sizeOptions = () => {
|
|
11173
|
+
return FontSizeTypes.map(fontSize => {
|
|
11174
|
+
return {
|
|
11175
|
+
key: fontSize,
|
|
11176
|
+
name: fontSize,
|
|
11177
|
+
execute: editor => FontSizeEditor.setFontSize(editor, fontSize),
|
|
11178
|
+
active: editor => FontSizeEditor.isFontSizeActive(editor, fontSize)
|
|
11179
|
+
};
|
|
11180
|
+
});
|
|
11181
|
+
};
|
|
11004
11182
|
const FontSizeOptions = [
|
|
11005
11183
|
{
|
|
11006
11184
|
key: MarkTypes.fontSize,
|
|
11007
11185
|
name: '字号',
|
|
11008
|
-
|
|
11186
|
+
type: ToolbarItemType.toolDropdown,
|
|
11187
|
+
dropdownItemKey: FontSizes.fontSize14,
|
|
11188
|
+
includes: FontSizeTypes,
|
|
11189
|
+
disable: editor => FontSizeEditor.isDisabled(editor)
|
|
11190
|
+
},
|
|
11191
|
+
...sizeOptions()
|
|
11192
|
+
];
|
|
11193
|
+
|
|
11194
|
+
const InlineCodeOptions = [
|
|
11195
|
+
{
|
|
11196
|
+
key: ElementKinds.inlineCode,
|
|
11197
|
+
icon: 'code',
|
|
11198
|
+
name: '行内代码',
|
|
11199
|
+
shortcutKey: `${CONTROL_KEY}+E`,
|
|
11200
|
+
execute: editor => InlineCodeEditor.toggleInlineCode(editor),
|
|
11201
|
+
active: editor => InlineCodeEditor.isInlineCodeActive(editor)
|
|
11009
11202
|
}
|
|
11010
11203
|
];
|
|
11011
11204
|
|
|
11205
|
+
class TheInlineCodeComponent extends TheBaseElementComponent {
|
|
11206
|
+
constructor(elementRef, cdr) {
|
|
11207
|
+
super(elementRef, cdr);
|
|
11208
|
+
this.elementRef = elementRef;
|
|
11209
|
+
this.cdr = cdr;
|
|
11210
|
+
}
|
|
11211
|
+
ngOnInit() {
|
|
11212
|
+
super.ngOnInit();
|
|
11213
|
+
}
|
|
11214
|
+
ngOnDestroy() {
|
|
11215
|
+
super.ngOnDestroy();
|
|
11216
|
+
}
|
|
11217
|
+
}
|
|
11218
|
+
TheInlineCodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheInlineCodeComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
11219
|
+
TheInlineCodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheInlineCodeComponent, selector: "span[theInlineCode]", usesInheritance: true, ngImport: i0, template: '<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>', isInline: true, components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
|
|
11220
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheInlineCodeComponent, decorators: [{
|
|
11221
|
+
type: Component,
|
|
11222
|
+
args: [{
|
|
11223
|
+
selector: 'span[theInlineCode]',
|
|
11224
|
+
template: '<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>'
|
|
11225
|
+
}]
|
|
11226
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; } });
|
|
11227
|
+
|
|
11228
|
+
const withInlineCode = (editor) => {
|
|
11229
|
+
const { isInline, renderElement, insertText } = editor;
|
|
11230
|
+
editor.isInline = (element) => {
|
|
11231
|
+
return element.type === ElementKinds.inlineCode ? true : isInline(element);
|
|
11232
|
+
};
|
|
11233
|
+
editor.renderElement = (element) => {
|
|
11234
|
+
if (element.type === ElementKinds.inlineCode) {
|
|
11235
|
+
return TheInlineCodeComponent;
|
|
11236
|
+
}
|
|
11237
|
+
return renderElement(element);
|
|
11238
|
+
};
|
|
11239
|
+
editor.insertText = text => {
|
|
11240
|
+
if (text && InlineCodeEditor.isInlineCodeActive(editor)) {
|
|
11241
|
+
let selection = editor.selection;
|
|
11242
|
+
const currentNodeText = Editor.string(editor, editor.selection.anchor.path);
|
|
11243
|
+
insertText(text);
|
|
11244
|
+
if (currentNodeText == ZERO_WIDTH_CHAR) {
|
|
11245
|
+
const inlineCodePath = Editor.path(editor, editor.selection);
|
|
11246
|
+
let range = {
|
|
11247
|
+
anchor: Editor.before(editor, selection.anchor),
|
|
11248
|
+
focus: selection.anchor
|
|
11249
|
+
};
|
|
11250
|
+
if (Editor.isStart(editor, selection.anchor, inlineCodePath)) {
|
|
11251
|
+
range = {
|
|
11252
|
+
anchor: editor.selection.anchor,
|
|
11253
|
+
focus: Editor.after(editor, editor.selection)
|
|
11254
|
+
};
|
|
11255
|
+
}
|
|
11256
|
+
Transforms.delete(editor, {
|
|
11257
|
+
at: range
|
|
11258
|
+
});
|
|
11259
|
+
}
|
|
11260
|
+
}
|
|
11261
|
+
else {
|
|
11262
|
+
insertText(text);
|
|
11263
|
+
}
|
|
11264
|
+
};
|
|
11265
|
+
editor = withRemoveEmptyNodes({ type: ElementKinds.inlineCode })(editor);
|
|
11266
|
+
return editor;
|
|
11267
|
+
};
|
|
11268
|
+
|
|
11012
11269
|
const internalPlugins = [
|
|
11013
11270
|
withTheHistory,
|
|
11014
11271
|
withAutoInsertData(),
|
|
@@ -11048,7 +11305,8 @@ const internalPlugins = [
|
|
|
11048
11305
|
withImage,
|
|
11049
11306
|
withDeserializeHMTL,
|
|
11050
11307
|
withDeserializeMd(),
|
|
11051
|
-
withQuickInsert
|
|
11308
|
+
withQuickInsert,
|
|
11309
|
+
withInlineCode
|
|
11052
11310
|
];
|
|
11053
11311
|
const internalToolbarItems = [
|
|
11054
11312
|
...AlignOptions,
|
|
@@ -11065,7 +11323,8 @@ const internalToolbarItems = [
|
|
|
11065
11323
|
...LinkOptions,
|
|
11066
11324
|
...TableOptions,
|
|
11067
11325
|
...VerticalAlignOptions,
|
|
11068
|
-
...PaintFormatOptions
|
|
11326
|
+
...PaintFormatOptions,
|
|
11327
|
+
...InlineCodeOptions
|
|
11069
11328
|
];
|
|
11070
11329
|
const toolbarCompose = (toolbarItems = []) => {
|
|
11071
11330
|
return [...internalToolbarItems, ...toolbarItems];
|
|
@@ -11087,14 +11346,19 @@ const HOTKEYS = {
|
|
|
11087
11346
|
'mod+b': MarkTypes.bold,
|
|
11088
11347
|
'mod+i': MarkTypes.italic,
|
|
11089
11348
|
'mod+u': MarkTypes.underline,
|
|
11090
|
-
'mod+e':
|
|
11349
|
+
'mod+e': ElementKinds.inlineCode
|
|
11091
11350
|
};
|
|
11092
11351
|
const markShortcuts = (editor, event) => {
|
|
11093
11352
|
for (const hotkey in HOTKEYS) {
|
|
11094
11353
|
if (isHotkey(hotkey, event)) {
|
|
11095
11354
|
event.preventDefault();
|
|
11096
11355
|
const mark = HOTKEYS[hotkey];
|
|
11097
|
-
|
|
11356
|
+
if (mark === ElementKinds.inlineCode) {
|
|
11357
|
+
InlineCodeEditor.toggleInlineCode(editor);
|
|
11358
|
+
}
|
|
11359
|
+
else {
|
|
11360
|
+
MarkEditor.toggleMark(editor, mark);
|
|
11361
|
+
}
|
|
11098
11362
|
}
|
|
11099
11363
|
}
|
|
11100
11364
|
};
|
|
@@ -11127,7 +11391,7 @@ class TheToolbarService {
|
|
|
11127
11391
|
return entity;
|
|
11128
11392
|
}
|
|
11129
11393
|
getToolbarItemByKeys(keys, toolbarItems) {
|
|
11130
|
-
return keys.map(key => {
|
|
11394
|
+
return keys.map((key) => {
|
|
11131
11395
|
if (key === `split`) {
|
|
11132
11396
|
return { key: `split` };
|
|
11133
11397
|
}
|
|
@@ -11355,14 +11619,15 @@ class TheToolbarComponent {
|
|
|
11355
11619
|
});
|
|
11356
11620
|
}
|
|
11357
11621
|
createToolbarItem(item) {
|
|
11358
|
-
const { iconComponent, type, dropdownMode } = item, args = __rest(item, ["iconComponent", "type", "dropdownMode"]);
|
|
11622
|
+
const { iconComponent, type, dropdownMode, dropdownItemKey, includes } = item, args = __rest(item, ["iconComponent", "type", "dropdownMode", "dropdownItemKey", "includes"]);
|
|
11359
11623
|
const viewComponent = this.viewComponentType(type);
|
|
11624
|
+
const dropdownItem = this.getDropdownItem(item);
|
|
11360
11625
|
const factory = this.cfr.resolveComponentFactory(iconComponent ? iconComponent : viewComponent);
|
|
11361
11626
|
const compRef = this.toolbarContainer.createComponent(factory);
|
|
11362
11627
|
compRef.instance.editor = this.editor;
|
|
11363
11628
|
compRef.instance.toolbarItem = item;
|
|
11364
|
-
compRef.instance.menus =
|
|
11365
|
-
compRef.instance.item =
|
|
11629
|
+
compRef.instance.menus = includes;
|
|
11630
|
+
compRef.instance.item = includes && dropdownItem ? dropdownItem : args;
|
|
11366
11631
|
compRef.instance.mode = dropdownMode;
|
|
11367
11632
|
this.components.set(item.key, compRef);
|
|
11368
11633
|
}
|
|
@@ -11389,6 +11654,17 @@ class TheToolbarComponent {
|
|
|
11389
11654
|
}
|
|
11390
11655
|
return TheToolbarItemComponent;
|
|
11391
11656
|
}
|
|
11657
|
+
getDropdownItem(item) {
|
|
11658
|
+
var _a;
|
|
11659
|
+
let dropdownKey = item === null || item === void 0 ? void 0 : item.dropdownItemKey;
|
|
11660
|
+
// modify the fontsize option externally
|
|
11661
|
+
const contextService = this.editor.injector.get(TheContextService);
|
|
11662
|
+
const fontSize = contextService.getDefaultFontSize();
|
|
11663
|
+
if (item.key === MarkTypes.fontSize && fontSize) {
|
|
11664
|
+
dropdownKey = fontSize;
|
|
11665
|
+
}
|
|
11666
|
+
return (_a = item === null || item === void 0 ? void 0 : item.includes) === null || _a === void 0 ? void 0 : _a.find((item) => item.key === dropdownKey);
|
|
11667
|
+
}
|
|
11392
11668
|
}
|
|
11393
11669
|
TheToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarComponent, deps: [{ token: i0.ComponentFactoryResolver }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: TheToolbarGroupToken }], target: i0.ɵɵFactoryTarget.Component });
|
|
11394
11670
|
TheToolbarComponent.ɵcmp = i0.ɵɵ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: ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0, 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.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
|
|
@@ -11784,14 +12060,14 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
|
|
|
11784
12060
|
return leaf ? leaf : null;
|
|
11785
12061
|
};
|
|
11786
12062
|
this.renderText = (text) => {
|
|
11787
|
-
if (text.text.length === 0) {
|
|
11788
|
-
return;
|
|
11789
|
-
}
|
|
11790
12063
|
for (const key in MarkTypes) {
|
|
11791
12064
|
if (text[MarkTypes[key]]) {
|
|
11792
12065
|
return TheTextComponent;
|
|
11793
12066
|
}
|
|
11794
12067
|
}
|
|
12068
|
+
if (text.text.length === 0) {
|
|
12069
|
+
return;
|
|
12070
|
+
}
|
|
11795
12071
|
};
|
|
11796
12072
|
this.onKeyDown = (event) => {
|
|
11797
12073
|
shortcuts(this.editor, event);
|
|
@@ -11906,7 +12182,11 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
|
|
|
11906
12182
|
this.editor.disabled = (_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.disabled;
|
|
11907
12183
|
this.editor.extraElementOptions = (_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.extraElementOptions;
|
|
11908
12184
|
setEditorUUID(this.editor, idCreator());
|
|
11909
|
-
this.theContextService.initialize({
|
|
12185
|
+
this.theContextService.initialize({
|
|
12186
|
+
theOptions: this.theOptions,
|
|
12187
|
+
nativeElement: this.elementRef.nativeElement,
|
|
12188
|
+
viewContainerRef: this.viewContainerRef
|
|
12189
|
+
});
|
|
11910
12190
|
this.toolbarCalculate();
|
|
11911
12191
|
setTimeout(() => {
|
|
11912
12192
|
var _a;
|
|
@@ -12093,12 +12373,13 @@ TheEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
|
|
|
12093
12373
|
useExisting: forwardRef(() => TheEditorComponent),
|
|
12094
12374
|
multi: true
|
|
12095
12375
|
}
|
|
12096
|
-
], 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, 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.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.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
12376
|
+
], viewQueries: [{ propertyName: "templateInstance", first: true, predicate: ["templateInstance"], descendants: true, static: true }, { propertyName: "globalToolbarInstance", first: true, predicate: ["globalToolbar"], descendants: true }, { propertyName: "quickInsertInstance", first: true, predicate: ["quickInsert"], descendants: true, static: true }, { propertyName: "placeholderInstance", first: true, predicate: ["placeholder"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<the-toolbar\n *ngIf=\"!theOptions?.readonly && !theGlobalToolbar\"\n [ngClass]=\"{\n 'the-toolbar-disabled': theOptions?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.global\"\n [containerClass]=\"globalToolbarClass\"\n [align]=\"theOptions?.toolbar?.align\"\n></the-toolbar>\n\n<div\n class=\"the-editable-container\"\n [ngClass]=\"{\n 'the-editor-disabled': theOptions?.disabled,\n 'max-height': maxHeight\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n (ngModelChange)=\"valueChange($event)\"\n [decorate]=\"decorate\"\n [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.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.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
12097
12377
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheEditorComponent, decorators: [{
|
|
12098
12378
|
type: Component,
|
|
12099
12379
|
args: [{
|
|
12100
12380
|
selector: 'the-editor, theEditor',
|
|
12101
12381
|
templateUrl: 'editor.component.html',
|
|
12382
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
12102
12383
|
providers: [
|
|
12103
12384
|
TheToolbarService,
|
|
12104
12385
|
TheContextService,
|
|
@@ -12319,8 +12600,7 @@ const COMPONENTS = [
|
|
|
12319
12600
|
TheTableSelectComponent,
|
|
12320
12601
|
TheTableToolbarItemComponent,
|
|
12321
12602
|
TheConversionHintComponent,
|
|
12322
|
-
TheVerticalToolbarItemComponent
|
|
12323
|
-
TheFontSizeToolbarItemComponent
|
|
12603
|
+
TheVerticalToolbarItemComponent
|
|
12324
12604
|
];
|
|
12325
12605
|
const PLUGIN_COMPONENTS = [
|
|
12326
12606
|
TheImageComponent,
|
|
@@ -12340,7 +12620,8 @@ const PLUGIN_COMPONENTS = [
|
|
|
12340
12620
|
TheTableComponent,
|
|
12341
12621
|
TheTableRowComponent,
|
|
12342
12622
|
TheTdComponent,
|
|
12343
|
-
ThePlaceholderComponent
|
|
12623
|
+
ThePlaceholderComponent,
|
|
12624
|
+
TheInlineCodeComponent
|
|
12344
12625
|
];
|
|
12345
12626
|
const PIPES = [ElementStylePipe, ElementClassPipe];
|
|
12346
12627
|
class TheEditorModule {
|
|
@@ -12363,8 +12644,7 @@ TheEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
|
|
|
12363
12644
|
TheTableSelectComponent,
|
|
12364
12645
|
TheTableToolbarItemComponent,
|
|
12365
12646
|
TheConversionHintComponent,
|
|
12366
|
-
TheVerticalToolbarItemComponent,
|
|
12367
|
-
TheFontSizeToolbarItemComponent, TheImageComponent,
|
|
12647
|
+
TheVerticalToolbarItemComponent, TheImageComponent,
|
|
12368
12648
|
TheTemplateComponent,
|
|
12369
12649
|
TheHrComponent,
|
|
12370
12650
|
TheBlockquoteComponent,
|
|
@@ -12381,7 +12661,8 @@ TheEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
|
|
|
12381
12661
|
TheTableComponent,
|
|
12382
12662
|
TheTableRowComponent,
|
|
12383
12663
|
TheTdComponent,
|
|
12384
|
-
ThePlaceholderComponent
|
|
12664
|
+
ThePlaceholderComponent,
|
|
12665
|
+
TheInlineCodeComponent], imports: [CommonModule, SlateModule, FormsModule, ThyIconModule,
|
|
12385
12666
|
ThyAvatarModule,
|
|
12386
12667
|
ThyNavModule,
|
|
12387
12668
|
ThyFormModule,
|
|
@@ -12430,5 +12711,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
|
|
|
12430
12711
|
* Generated bundle index. Do not edit.
|
|
12431
12712
|
*/
|
|
12432
12713
|
|
|
12433
|
-
export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETEBACKWARD_TYPES, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, COMPONENTS, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, CodeMode, ColorEditor, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DefaultQuickToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, ElementKinds, ErrorCodes, HEADING_TYPES, HeadingEditor, HrEditor, IS_MAC, ImageEditor, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PLUGIN_COMPONENTS, QUICK_TOOLBAR_HOTKEY, QuickInsertEditor, STANDARD_HEADING_TYPES, TAB_SPACE, THE_CODE_MODE_PROVIDER, THE_CODE_MODE_TOKEN, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_QUICK_TOOLBAR_REF, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_UPLOAD_SERVICE_TOKEN, TableEditor, TheBaseElementComponent, TheCodeConfig, TheContextService, TheDataMode, TheDefaultElementComponent, TheEditor, TheEditorComponent, TheEditorModule, TheImageComponent, TheMode, index$1 as TheQueries, TheToolbarBaseItemComponent, TheToolbarComponent, TheToolbarDropdownComponent, TheToolbarGroupComponent, TheToolbarGroupToken, TheToolbarItemComponent, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemMode, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, createEmptyParagraph, dataDeserialize, dataSerializing, getToolbarClass, htmlToTheia, inValidTypes, plainToTheia, toolbarCompose, withTheEditor };
|
|
12714
|
+
export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETEBACKWARD_TYPES, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, COMPONENTS, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, CodeMode, ColorEditor, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DefaultQuickToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, ElementKinds, ErrorCodes, FontSizeTypes, FontSizes, HEADING_TYPES, HeadingEditor, HrEditor, IS_MAC, ImageEditor, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PLUGIN_COMPONENTS, QUICK_TOOLBAR_HOTKEY, QuickInsertEditor, STANDARD_HEADING_TYPES, TAB_SPACE, THE_CODE_MODE_PROVIDER, THE_CODE_MODE_TOKEN, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_QUICK_TOOLBAR_REF, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_UPLOAD_SERVICE_TOKEN, TableEditor, TheBaseElementComponent, TheCodeConfig, TheContextService, TheDataMode, TheDefaultElementComponent, TheEditor, TheEditorComponent, TheEditorModule, TheImageComponent, TheMode, index$1 as TheQueries, TheToolbarBaseItemComponent, TheToolbarComponent, TheToolbarDropdownComponent, TheToolbarGroupComponent, TheToolbarGroupToken, TheToolbarItemComponent, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemMode, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, createEmptyParagraph, dataDeserialize, dataSerializing, getToolbarClass, htmlToTheia, inValidTypes, plainToTheia, toolbarCompose, withTheEditor };
|
|
12434
12715
|
//# sourceMappingURL=worktile-theia.js.map
|