slate-angular 1.6.3 → 1.7.1
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/slate-angular.umd.js +111 -153
- package/bundles/slate-angular.umd.js.map +1 -1
- package/components/editable/editable.component.d.ts +7 -2
- package/esm2015/components/editable/editable.component.js +68 -20
- package/esm2015/components/leaf/default-leaf.component.js +12 -3
- package/esm2015/plugins/with-angular.js +2 -98
- package/esm2015/types/feature.js +2 -0
- package/esm2015/types/index.js +2 -1
- package/esm2015/view/base.js +2 -2
- package/esm2015/view/container.js +39 -33
- package/fesm2015/slate-angular.js +115 -149
- package/fesm2015/slate-angular.js.map +1 -1
- package/package.json +8 -9
- package/styles/index.scss +10 -0
- package/types/feature.d.ts +4 -0
- package/types/index.d.ts +1 -0
- package/view/container.d.ts +2 -1
|
@@ -5,7 +5,6 @@ import { TemplateRef, Component, ViewChild, Directive, Input, HostBinding, Chang
|
|
|
5
5
|
import { __rest } from 'tslib';
|
|
6
6
|
import getDirection from 'direction';
|
|
7
7
|
import { Subject } from 'rxjs';
|
|
8
|
-
import scrollIntoView from 'scroll-into-view-if-needed';
|
|
9
8
|
import Debug from 'debug';
|
|
10
9
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
11
10
|
import { HistoryEditor } from 'slate-history';
|
|
@@ -1183,102 +1182,6 @@ const withAngular = (editor, clipboardFormatKey = 'x-slate-fragment') => {
|
|
|
1183
1182
|
}
|
|
1184
1183
|
}
|
|
1185
1184
|
};
|
|
1186
|
-
// override slate layer logic
|
|
1187
|
-
e.normalizeNode = (entry) => {
|
|
1188
|
-
const [node, path] = entry;
|
|
1189
|
-
// There are no core normalizations for text nodes.
|
|
1190
|
-
if (Text$1.isText(node)) {
|
|
1191
|
-
return;
|
|
1192
|
-
}
|
|
1193
|
-
// Ensure that block and inline nodes have at least one text child.
|
|
1194
|
-
if (Element.isElement(node) && node.children.length === 0) {
|
|
1195
|
-
const child = { text: '' };
|
|
1196
|
-
Transforms.insertNodes(editor, child, {
|
|
1197
|
-
at: path.concat(0),
|
|
1198
|
-
voids: true,
|
|
1199
|
-
});
|
|
1200
|
-
return;
|
|
1201
|
-
}
|
|
1202
|
-
// Determine whether the node should have block or inline children.
|
|
1203
|
-
const shouldHaveInlines = Editor.isEditor(node)
|
|
1204
|
-
? false
|
|
1205
|
-
: Element.isElement(node) &&
|
|
1206
|
-
(editor.isInline(node) ||
|
|
1207
|
-
node.children.length === 0 ||
|
|
1208
|
-
Text$1.isText(node.children[0]) ||
|
|
1209
|
-
editor.isInline(node.children[0]));
|
|
1210
|
-
// Since we'll be applying operations while iterating, keep track of an
|
|
1211
|
-
// index that accounts for any added/removed nodes.
|
|
1212
|
-
let n = 0;
|
|
1213
|
-
for (let i = 0; i < node.children.length; i++, n++) {
|
|
1214
|
-
const child = node.children[i];
|
|
1215
|
-
const prev = node.children[i - 1];
|
|
1216
|
-
const isLast = i === node.children.length - 1;
|
|
1217
|
-
const isInlineOrText = Text$1.isText(child) ||
|
|
1218
|
-
(Element.isElement(child) && editor.isInline(child));
|
|
1219
|
-
// Only allow block nodes in the top-level children and parent blocks
|
|
1220
|
-
// that only contain block nodes. Similarly, only allow inline nodes in
|
|
1221
|
-
// other inline nodes, or parent blocks that only contain inlines and
|
|
1222
|
-
// text.
|
|
1223
|
-
if (isInlineOrText !== shouldHaveInlines) {
|
|
1224
|
-
Transforms.removeNodes(editor, { at: path.concat(n), voids: true });
|
|
1225
|
-
n--;
|
|
1226
|
-
}
|
|
1227
|
-
else if (Element.isElement(child)) {
|
|
1228
|
-
// Ensure that inline nodes are surrounded by text nodes.
|
|
1229
|
-
if (editor.isInline(child)) {
|
|
1230
|
-
if (prev == null || !Text$1.isText(prev)) {
|
|
1231
|
-
const newChild = { text: '' };
|
|
1232
|
-
Transforms.insertNodes(editor, newChild, {
|
|
1233
|
-
at: path.concat(n),
|
|
1234
|
-
voids: true,
|
|
1235
|
-
});
|
|
1236
|
-
n++;
|
|
1237
|
-
}
|
|
1238
|
-
else if (isLast) {
|
|
1239
|
-
const newChild = { text: '' };
|
|
1240
|
-
Transforms.insertNodes(editor, newChild, {
|
|
1241
|
-
at: path.concat(n + 1),
|
|
1242
|
-
voids: true,
|
|
1243
|
-
});
|
|
1244
|
-
n++;
|
|
1245
|
-
}
|
|
1246
|
-
}
|
|
1247
|
-
}
|
|
1248
|
-
else {
|
|
1249
|
-
// Merge adjacent text nodes that are empty or match.
|
|
1250
|
-
if (prev != null && Text$1.isText(prev)) {
|
|
1251
|
-
// adjust logic: first remove empty text to avoid merge empty text #WIK-3805
|
|
1252
|
-
if (prev.text === '') {
|
|
1253
|
-
// adjust logic: adjust cursor location when empty text is first child of node #WIK-3631
|
|
1254
|
-
// ensure current selection in the text #WIK-3762
|
|
1255
|
-
const prevFocused = editor.selection &&
|
|
1256
|
-
Range.isCollapsed(editor.selection) &&
|
|
1257
|
-
Path.equals(editor.selection.anchor.path, path.concat(n - 1));
|
|
1258
|
-
if (prev === node.children[0] && prevFocused) {
|
|
1259
|
-
Transforms.select(editor, Editor.start(editor, path.concat(n)));
|
|
1260
|
-
}
|
|
1261
|
-
Transforms.removeNodes(editor, {
|
|
1262
|
-
at: path.concat(n - 1),
|
|
1263
|
-
voids: true,
|
|
1264
|
-
});
|
|
1265
|
-
n--;
|
|
1266
|
-
}
|
|
1267
|
-
else if (Text$1.equals(child, prev, { loose: true })) {
|
|
1268
|
-
Transforms.mergeNodes(editor, { at: path.concat(n), voids: true });
|
|
1269
|
-
n--;
|
|
1270
|
-
}
|
|
1271
|
-
else if (isLast && child.text === '') {
|
|
1272
|
-
Transforms.removeNodes(editor, {
|
|
1273
|
-
at: path.concat(n),
|
|
1274
|
-
voids: true,
|
|
1275
|
-
});
|
|
1276
|
-
n--;
|
|
1277
|
-
}
|
|
1278
|
-
}
|
|
1279
|
-
}
|
|
1280
|
-
}
|
|
1281
|
-
};
|
|
1282
1185
|
e.onKeydown = () => { };
|
|
1283
1186
|
e.onClick = () => { };
|
|
1284
1187
|
e.isBlockCard = (element) => false;
|
|
@@ -1920,7 +1823,7 @@ class BaseTextComponent extends BaseComponent {
|
|
|
1920
1823
|
this.initialized = false;
|
|
1921
1824
|
}
|
|
1922
1825
|
get text() {
|
|
1923
|
-
return this._context.text;
|
|
1826
|
+
return this._context && this._context.text;
|
|
1924
1827
|
}
|
|
1925
1828
|
ngOnInit() {
|
|
1926
1829
|
this.updateWeakMap();
|
|
@@ -1966,7 +1869,6 @@ class ViewContainer {
|
|
|
1966
1869
|
// first diff
|
|
1967
1870
|
differ.diff(this.childrenComponent);
|
|
1968
1871
|
const parentElement = this.elementRef.nativeElement.parentElement;
|
|
1969
|
-
let firstChildComponent = this.childrenComponent.first;
|
|
1970
1872
|
if (this.childrenComponent.length > 0) {
|
|
1971
1873
|
parentElement.insertBefore(this.createFragment(), this.elementRef.nativeElement);
|
|
1972
1874
|
this.elementRef.nativeElement.remove();
|
|
@@ -1974,41 +1876,15 @@ class ViewContainer {
|
|
|
1974
1876
|
this.childrenComponent.changes.subscribe((value) => {
|
|
1975
1877
|
const iterableChanges = differ.diff(this.childrenComponent);
|
|
1976
1878
|
if (iterableChanges) {
|
|
1977
|
-
iterableChanges.
|
|
1978
|
-
//
|
|
1979
|
-
if (
|
|
1980
|
-
const fragment = document.createDocumentFragment();
|
|
1981
|
-
fragment.append(...record.item.rootNodes);
|
|
1982
|
-
parentElement.insertBefore(fragment, this.elementRef.nativeElement);
|
|
1983
|
-
this.elementRef.nativeElement.remove();
|
|
1879
|
+
iterableChanges.forEachOperation((record, previousIndex, currentIndex) => {
|
|
1880
|
+
// removed
|
|
1881
|
+
if (currentIndex === null) {
|
|
1984
1882
|
return;
|
|
1985
1883
|
}
|
|
1986
|
-
//
|
|
1987
|
-
|
|
1988
|
-
const fragment = document.createDocumentFragment();
|
|
1989
|
-
fragment.append(...record.item.rootNodes);
|
|
1990
|
-
parentElement.prepend(fragment);
|
|
1991
|
-
}
|
|
1992
|
-
else {
|
|
1993
|
-
// insert afterend of previous component end
|
|
1994
|
-
let previousRootNode = this.getPreviousRootNode(record.currentIndex);
|
|
1995
|
-
if (previousRootNode) {
|
|
1996
|
-
record.item.rootNodes.forEach((rootNode) => {
|
|
1997
|
-
previousRootNode.insertAdjacentElement('afterend', rootNode);
|
|
1998
|
-
previousRootNode = rootNode;
|
|
1999
|
-
});
|
|
2000
|
-
}
|
|
2001
|
-
else {
|
|
2002
|
-
this.viewContext.editor.onError({
|
|
2003
|
-
code: SlateErrorCode.NotFoundPreviousRootNodeError,
|
|
2004
|
-
name: 'not found previous rootNode',
|
|
2005
|
-
nativeError: null
|
|
2006
|
-
});
|
|
2007
|
-
}
|
|
2008
|
-
}
|
|
1884
|
+
// added or moved
|
|
1885
|
+
this.handleContainerItemChange(record, parentElement);
|
|
2009
1886
|
});
|
|
2010
1887
|
}
|
|
2011
|
-
firstChildComponent = this.childrenComponent.first;
|
|
2012
1888
|
});
|
|
2013
1889
|
}
|
|
2014
1890
|
getPreviousRootNode(currentIndex) {
|
|
@@ -2031,6 +1907,39 @@ class ViewContainer {
|
|
|
2031
1907
|
});
|
|
2032
1908
|
return fragment;
|
|
2033
1909
|
}
|
|
1910
|
+
handleContainerItemChange(record, parentElement) {
|
|
1911
|
+
// first insert
|
|
1912
|
+
if (this.elementRef.nativeElement.parentElement && this.elementRef.nativeElement.parentElement === parentElement) {
|
|
1913
|
+
const fragment = document.createDocumentFragment();
|
|
1914
|
+
fragment.append(...record.item.rootNodes);
|
|
1915
|
+
parentElement.insertBefore(fragment, this.elementRef.nativeElement);
|
|
1916
|
+
this.elementRef.nativeElement.remove();
|
|
1917
|
+
return;
|
|
1918
|
+
}
|
|
1919
|
+
// insert at start location
|
|
1920
|
+
if (record.currentIndex === 0) {
|
|
1921
|
+
const fragment = document.createDocumentFragment();
|
|
1922
|
+
fragment.append(...record.item.rootNodes);
|
|
1923
|
+
parentElement.prepend(fragment);
|
|
1924
|
+
}
|
|
1925
|
+
else {
|
|
1926
|
+
// insert afterend of previous component end
|
|
1927
|
+
let previousRootNode = this.getPreviousRootNode(record.currentIndex);
|
|
1928
|
+
if (previousRootNode) {
|
|
1929
|
+
record.item.rootNodes.forEach((rootNode) => {
|
|
1930
|
+
previousRootNode.insertAdjacentElement('afterend', rootNode);
|
|
1931
|
+
previousRootNode = rootNode;
|
|
1932
|
+
});
|
|
1933
|
+
}
|
|
1934
|
+
else {
|
|
1935
|
+
this.viewContext.editor.onError({
|
|
1936
|
+
code: SlateErrorCode.NotFoundPreviousRootNodeError,
|
|
1937
|
+
name: 'not found previous rootNode',
|
|
1938
|
+
nativeError: null
|
|
1939
|
+
});
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
2034
1943
|
}
|
|
2035
1944
|
ViewContainer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: ViewContainer, deps: [{ token: i0.ElementRef }, { token: i0.IterableDiffers }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2036
1945
|
ViewContainer.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.7", type: ViewContainer, inputs: { viewContext: "viewContext" }, ngImport: i0 });
|
|
@@ -2111,12 +2020,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
|
|
|
2111
2020
|
class SlateDefaultLeafComponent extends BaseLeafComponent {
|
|
2112
2021
|
}
|
|
2113
2022
|
SlateDefaultLeafComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: SlateDefaultLeafComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2114
|
-
SlateDefaultLeafComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: SlateDefaultLeafComponent, selector: "span[slateDefaultLeaf]", host: { attributes: { "data-slate-leaf": "true" } }, usesInheritance: true, ngImport: i0, template:
|
|
2023
|
+
SlateDefaultLeafComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: SlateDefaultLeafComponent, selector: "span[slateDefaultLeaf]", host: { attributes: { "data-slate-leaf": "true" } }, usesInheritance: true, ngImport: i0, template: `
|
|
2024
|
+
<ng-container *ngIf="context.leaf['placeholder']">
|
|
2025
|
+
<span contenteditable="false" data-slate-placeholder="true" slate-placeholder="true">{{context.leaf['placeholder']}}</span>
|
|
2026
|
+
</ng-container>
|
|
2027
|
+
<span slateString [context]="context" [viewContext]="viewContext"><span>`, isInline: true, components: [{ type: SlateStringComponent, selector: "span[slateString]", inputs: ["context"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2115
2028
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: SlateDefaultLeafComponent, decorators: [{
|
|
2116
2029
|
type: Component,
|
|
2117
2030
|
args: [{
|
|
2118
2031
|
selector: 'span[slateDefaultLeaf]',
|
|
2119
|
-
template:
|
|
2032
|
+
template: `
|
|
2033
|
+
<ng-container *ngIf="context.leaf['placeholder']">
|
|
2034
|
+
<span contenteditable="false" data-slate-placeholder="true" slate-placeholder="true">{{context.leaf['placeholder']}}</span>
|
|
2035
|
+
</ng-container>
|
|
2036
|
+
<span slateString [context]="context" [viewContext]="viewContext"><span>`,
|
|
2120
2037
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2121
2038
|
host: {
|
|
2122
2039
|
'data-slate-leaf': 'true'
|
|
@@ -2597,6 +2514,7 @@ class SlateEditableComponent {
|
|
|
2597
2514
|
});
|
|
2598
2515
|
this.editor.children = normalize(value);
|
|
2599
2516
|
}
|
|
2517
|
+
this.initializeContext();
|
|
2600
2518
|
this.cdr.markForCheck();
|
|
2601
2519
|
}
|
|
2602
2520
|
}
|
|
@@ -2677,14 +2595,6 @@ class SlateEditableComponent {
|
|
|
2677
2595
|
// eslint-disable-next-line max-len
|
|
2678
2596
|
domSelection.setBaseAndExtent(newDomRange.startContainer, newDomRange.startOffset, newDomRange.endContainer, newDomRange.endOffset);
|
|
2679
2597
|
}
|
|
2680
|
-
const leafEl = newDomRange.startContainer.parentElement;
|
|
2681
|
-
leafEl.getBoundingClientRect = newDomRange.getBoundingClientRect.bind(newDomRange);
|
|
2682
|
-
scrollIntoView(leafEl, {
|
|
2683
|
-
scrollMode: 'if-needed',
|
|
2684
|
-
boundary: el,
|
|
2685
|
-
});
|
|
2686
|
-
// @ts-ignore
|
|
2687
|
-
delete leafEl.getBoundingClientRect;
|
|
2688
2598
|
}
|
|
2689
2599
|
setTimeout(() => {
|
|
2690
2600
|
// COMPAT: In Firefox, it's not enough to create a range, you also need
|
|
@@ -2720,7 +2630,7 @@ class SlateEditableComponent {
|
|
|
2720
2630
|
// need exec after this.cdr.detectChanges() to render HTML
|
|
2721
2631
|
// need exec before this.toNativeSelection() to correct native selection
|
|
2722
2632
|
if (this.isComposing) {
|
|
2723
|
-
//
|
|
2633
|
+
// Composition input text be not rendered when user composition input with selection is expanded
|
|
2724
2634
|
// At this time, the following matching conditions are met, assign isComposing to false, and the status is wrong
|
|
2725
2635
|
// this time condition is true and isComposiing is assigned false
|
|
2726
2636
|
// Therefore, need to wait for the composition input text to be rendered before performing condition matching
|
|
@@ -2753,7 +2663,7 @@ class SlateEditableComponent {
|
|
|
2753
2663
|
this.context = {
|
|
2754
2664
|
parent: this.editor,
|
|
2755
2665
|
selection: this.editor.selection,
|
|
2756
|
-
decorations: this.
|
|
2666
|
+
decorations: this.generateDecorations(),
|
|
2757
2667
|
decorate: this.decorate,
|
|
2758
2668
|
readonly: this.readonly
|
|
2759
2669
|
};
|
|
@@ -2770,20 +2680,49 @@ class SlateEditableComponent {
|
|
|
2770
2680
|
};
|
|
2771
2681
|
}
|
|
2772
2682
|
detectContext() {
|
|
2683
|
+
const decorations = this.generateDecorations();
|
|
2773
2684
|
if (this.context.selection !== this.editor.selection ||
|
|
2774
2685
|
this.context.decorate !== this.decorate ||
|
|
2775
|
-
this.context.readonly !== this.readonly
|
|
2776
|
-
|
|
2777
|
-
const isSameDecorations = isDecoratorRangeListEqual(this.context.decorations, decorations);
|
|
2686
|
+
this.context.readonly !== this.readonly ||
|
|
2687
|
+
!isDecoratorRangeListEqual(this.context.decorations, decorations)) {
|
|
2778
2688
|
this.context = {
|
|
2779
2689
|
parent: this.editor,
|
|
2780
2690
|
selection: this.editor.selection,
|
|
2781
|
-
decorations:
|
|
2691
|
+
decorations: decorations,
|
|
2782
2692
|
decorate: this.decorate,
|
|
2783
2693
|
readonly: this.readonly
|
|
2784
2694
|
};
|
|
2785
2695
|
}
|
|
2786
2696
|
}
|
|
2697
|
+
composePlaceholderDecorate(editor) {
|
|
2698
|
+
if (this.placeholderDecorate) {
|
|
2699
|
+
return this.placeholderDecorate(editor) || [];
|
|
2700
|
+
}
|
|
2701
|
+
if (this.placeholder &&
|
|
2702
|
+
editor.children.length === 1 &&
|
|
2703
|
+
Array.from(Node.texts(editor)).length === 1 &&
|
|
2704
|
+
Node.string(editor) === '') {
|
|
2705
|
+
const start = Editor.start(editor, []);
|
|
2706
|
+
return [
|
|
2707
|
+
{
|
|
2708
|
+
placeholder: this.placeholder,
|
|
2709
|
+
anchor: start,
|
|
2710
|
+
focus: start,
|
|
2711
|
+
},
|
|
2712
|
+
];
|
|
2713
|
+
}
|
|
2714
|
+
else {
|
|
2715
|
+
return [];
|
|
2716
|
+
}
|
|
2717
|
+
}
|
|
2718
|
+
generateDecorations() {
|
|
2719
|
+
const decorations = this.decorate([this.editor, []]);
|
|
2720
|
+
const placeholderDecorations = this.isComposing
|
|
2721
|
+
? []
|
|
2722
|
+
: this.composePlaceholderDecorate(this.editor);
|
|
2723
|
+
decorations.push(...placeholderDecorations);
|
|
2724
|
+
return decorations;
|
|
2725
|
+
}
|
|
2787
2726
|
//#region event proxy
|
|
2788
2727
|
addEventListener(eventName, listener, target = this.elementRef.nativeElement) {
|
|
2789
2728
|
this.manualListeners.push(this.renderer2.listen(target, eventName, (event) => {
|
|
@@ -3002,6 +2941,8 @@ class SlateEditableComponent {
|
|
|
3002
2941
|
// so we need avoid repeat isnertText by isComposing === true,
|
|
3003
2942
|
this.isComposing = false;
|
|
3004
2943
|
}
|
|
2944
|
+
this.detectContext();
|
|
2945
|
+
this.cdr.detectChanges();
|
|
3005
2946
|
}
|
|
3006
2947
|
onDOMCompositionStart(event) {
|
|
3007
2948
|
const { selection } = this.editor;
|
|
@@ -3015,6 +2956,8 @@ class SlateEditableComponent {
|
|
|
3015
2956
|
if (hasEditableTarget(this.editor, event.target) && !this.isDOMEventHandled(event, this.compositionStart)) {
|
|
3016
2957
|
this.isComposing = true;
|
|
3017
2958
|
}
|
|
2959
|
+
this.detectContext();
|
|
2960
|
+
this.cdr.detectChanges();
|
|
3018
2961
|
}
|
|
3019
2962
|
onDOMCopy(event) {
|
|
3020
2963
|
const window = AngularEditor.getWindow(this.editor);
|
|
@@ -3284,6 +3227,25 @@ class SlateEditableComponent {
|
|
|
3284
3227
|
return;
|
|
3285
3228
|
}
|
|
3286
3229
|
}
|
|
3230
|
+
else {
|
|
3231
|
+
if (IS_CHROME || IS_SAFARI) {
|
|
3232
|
+
// COMPAT: Chrome and Safari support `beforeinput` event but do not fire
|
|
3233
|
+
// an event when deleting backwards in a selected void inline node
|
|
3234
|
+
if (selection &&
|
|
3235
|
+
(hotkeys.isDeleteBackward(nativeEvent) ||
|
|
3236
|
+
hotkeys.isDeleteForward(nativeEvent)) &&
|
|
3237
|
+
Range.isCollapsed(selection)) {
|
|
3238
|
+
const currentNode = Node.parent(editor, selection.anchor.path);
|
|
3239
|
+
if (Element.isElement(currentNode) &&
|
|
3240
|
+
Editor.isVoid(editor, currentNode) &&
|
|
3241
|
+
Editor.isInline(editor, currentNode)) {
|
|
3242
|
+
event.preventDefault();
|
|
3243
|
+
Editor.deleteBackward(editor, { unit: 'block' });
|
|
3244
|
+
return;
|
|
3245
|
+
}
|
|
3246
|
+
}
|
|
3247
|
+
}
|
|
3248
|
+
}
|
|
3287
3249
|
}
|
|
3288
3250
|
catch (error) {
|
|
3289
3251
|
this.editor.onError({ code: SlateErrorCode.OnDOMKeydownError, nativeError: error });
|
|
@@ -3318,7 +3280,7 @@ class SlateEditableComponent {
|
|
|
3318
3280
|
if (!Range.isCollapsed(this.editor.selection)) {
|
|
3319
3281
|
Editor.deleteFragment(this.editor);
|
|
3320
3282
|
}
|
|
3321
|
-
// just handle Non-IME input
|
|
3283
|
+
// just handle Non-IME input
|
|
3322
3284
|
if (!this.isComposing) {
|
|
3323
3285
|
Editor.insertText(this.editor, text);
|
|
3324
3286
|
}
|
|
@@ -3346,11 +3308,11 @@ class SlateEditableComponent {
|
|
|
3346
3308
|
}
|
|
3347
3309
|
}
|
|
3348
3310
|
SlateEditableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: SlateEditableComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
|
|
3349
|
-
SlateEditableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: SlateEditableComponent, selector: "slate-editable", inputs: { editor: "editor", renderElement: "renderElement", renderLeaf: "renderLeaf", renderText: "renderText", decorate: "decorate", isStrictDecorate: "isStrictDecorate", trackBy: "trackBy", readonly: "readonly", beforeInput: "beforeInput", blur: "blur", click: "click", compositionEnd: "compositionEnd", compositionStart: "compositionStart", copy: "copy", cut: "cut", dragOver: "dragOver", dragStart: "dragStart", dragEnd: "dragEnd", drop: "drop", focus: "focus", keydown: "keydown", paste: "paste", spellCheck: "spellCheck", autoCorrect: "autoCorrect", autoCapitalize: "autoCapitalize" }, host: { properties: { "attr.contenteditable": "readonly ? undefined : true", "attr.role": "readonly ? undefined : 'textbox'", "attr.spellCheck": "!hasBeforeInputSupport ? false : spellCheck", "attr.autoCorrect": "!hasBeforeInputSupport ? 'false' : autoCorrect", "attr.autoCapitalize": "!hasBeforeInputSupport ? 'false' : autoCapitalize", "attr.data-slate-editor": "this.dataSlateEditor", "attr.data-slate-node": "this.dataSlateNode", "attr.data-gramm": "this.dataGramm" }, classAttribute: "slate-editable-container" }, providers: [{
|
|
3311
|
+
SlateEditableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: SlateEditableComponent, selector: "slate-editable", inputs: { editor: "editor", renderElement: "renderElement", renderLeaf: "renderLeaf", renderText: "renderText", decorate: "decorate", placeholderDecorate: "placeholderDecorate", isStrictDecorate: "isStrictDecorate", trackBy: "trackBy", readonly: "readonly", placeholder: "placeholder", beforeInput: "beforeInput", blur: "blur", click: "click", compositionEnd: "compositionEnd", compositionStart: "compositionStart", copy: "copy", cut: "cut", dragOver: "dragOver", dragStart: "dragStart", dragEnd: "dragEnd", drop: "drop", focus: "focus", keydown: "keydown", paste: "paste", spellCheck: "spellCheck", autoCorrect: "autoCorrect", autoCapitalize: "autoCapitalize" }, host: { properties: { "attr.contenteditable": "readonly ? undefined : true", "attr.role": "readonly ? undefined : 'textbox'", "attr.spellCheck": "!hasBeforeInputSupport ? false : spellCheck", "attr.autoCorrect": "!hasBeforeInputSupport ? 'false' : autoCorrect", "attr.autoCapitalize": "!hasBeforeInputSupport ? 'false' : autoCapitalize", "attr.data-slate-editor": "this.dataSlateEditor", "attr.data-slate-node": "this.dataSlateNode", "attr.data-gramm": "this.dataGramm" }, classAttribute: "slate-editable-container" }, providers: [{
|
|
3350
3312
|
provide: NG_VALUE_ACCESSOR,
|
|
3351
3313
|
useExisting: forwardRef(() => SlateEditableComponent),
|
|
3352
3314
|
multi: true
|
|
3353
|
-
}], viewQueries: [{ propertyName: "templateComponent", first: true, predicate: ["templateComponent"], descendants: true, static: true }, { propertyName: "templateElementRef", first: true, predicate: ["templateComponent"], descendants: true, read: ElementRef, static: true }], usesOnChanges: true, ngImport: i0, template: "<slate-children [children]=\"editor.children\" [context]=\"context\" [viewContext]=\"viewContext\"
|
|
3315
|
+
}], viewQueries: [{ propertyName: "templateComponent", first: true, predicate: ["templateComponent"], descendants: true, static: true }, { propertyName: "templateElementRef", first: true, predicate: ["templateComponent"], descendants: true, read: ElementRef, static: true }], usesOnChanges: true, ngImport: i0, template: "<slate-children [children]=\"editor.children\" [context]=\"context\" [viewContext]=\"viewContext\"></slate-children>\n<slate-string-template #templateComponent></slate-string-template>", components: [{ type: SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: SlateStringTemplateComponent, selector: "slate-string-template" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3354
3316
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: SlateEditableComponent, decorators: [{
|
|
3355
3317
|
type: Component,
|
|
3356
3318
|
args: [{
|
|
@@ -3381,12 +3343,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
|
|
|
3381
3343
|
type: Input
|
|
3382
3344
|
}], decorate: [{
|
|
3383
3345
|
type: Input
|
|
3346
|
+
}], placeholderDecorate: [{
|
|
3347
|
+
type: Input
|
|
3384
3348
|
}], isStrictDecorate: [{
|
|
3385
3349
|
type: Input
|
|
3386
3350
|
}], trackBy: [{
|
|
3387
3351
|
type: Input
|
|
3388
3352
|
}], readonly: [{
|
|
3389
3353
|
type: Input
|
|
3354
|
+
}], placeholder: [{
|
|
3355
|
+
type: Input
|
|
3390
3356
|
}], beforeInput: [{
|
|
3391
3357
|
type: Input
|
|
3392
3358
|
}], blur: [{
|