slate-angular 1.6.4 → 1.7.3
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 +145 -138
- package/bundles/slate-angular.umd.js.map +1 -1
- package/components/editable/editable.component.d.ts +7 -2
- package/components/leaf/default-leaf.component.d.ts +4 -1
- package/esm2015/components/editable/editable.component.js +68 -11
- package/esm2015/components/leaf/default-leaf.component.js +9 -1
- 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 +34 -2
- package/esm2015/view/container.js +39 -33
- package/fesm2015/slate-angular.js +145 -138
- package/fesm2015/slate-angular.js.map +1 -1
- package/package.json +7 -7
- package/styles/index.scss +18 -3
- package/types/feature.d.ts +4 -0
- package/types/index.d.ts +1 -0
- package/view/base.d.ts +3 -0
- package/view/container.d.ts +2 -1
|
@@ -1182,102 +1182,6 @@ const withAngular = (editor, clipboardFormatKey = 'x-slate-fragment') => {
|
|
|
1182
1182
|
}
|
|
1183
1183
|
}
|
|
1184
1184
|
};
|
|
1185
|
-
// override slate layer logic
|
|
1186
|
-
e.normalizeNode = (entry) => {
|
|
1187
|
-
const [node, path] = entry;
|
|
1188
|
-
// There are no core normalizations for text nodes.
|
|
1189
|
-
if (Text$1.isText(node)) {
|
|
1190
|
-
return;
|
|
1191
|
-
}
|
|
1192
|
-
// Ensure that block and inline nodes have at least one text child.
|
|
1193
|
-
if (Element.isElement(node) && node.children.length === 0) {
|
|
1194
|
-
const child = { text: '' };
|
|
1195
|
-
Transforms.insertNodes(editor, child, {
|
|
1196
|
-
at: path.concat(0),
|
|
1197
|
-
voids: true,
|
|
1198
|
-
});
|
|
1199
|
-
return;
|
|
1200
|
-
}
|
|
1201
|
-
// Determine whether the node should have block or inline children.
|
|
1202
|
-
const shouldHaveInlines = Editor.isEditor(node)
|
|
1203
|
-
? false
|
|
1204
|
-
: Element.isElement(node) &&
|
|
1205
|
-
(editor.isInline(node) ||
|
|
1206
|
-
node.children.length === 0 ||
|
|
1207
|
-
Text$1.isText(node.children[0]) ||
|
|
1208
|
-
editor.isInline(node.children[0]));
|
|
1209
|
-
// Since we'll be applying operations while iterating, keep track of an
|
|
1210
|
-
// index that accounts for any added/removed nodes.
|
|
1211
|
-
let n = 0;
|
|
1212
|
-
for (let i = 0; i < node.children.length; i++, n++) {
|
|
1213
|
-
const child = node.children[i];
|
|
1214
|
-
const prev = node.children[i - 1];
|
|
1215
|
-
const isLast = i === node.children.length - 1;
|
|
1216
|
-
const isInlineOrText = Text$1.isText(child) ||
|
|
1217
|
-
(Element.isElement(child) && editor.isInline(child));
|
|
1218
|
-
// Only allow block nodes in the top-level children and parent blocks
|
|
1219
|
-
// that only contain block nodes. Similarly, only allow inline nodes in
|
|
1220
|
-
// other inline nodes, or parent blocks that only contain inlines and
|
|
1221
|
-
// text.
|
|
1222
|
-
if (isInlineOrText !== shouldHaveInlines) {
|
|
1223
|
-
Transforms.removeNodes(editor, { at: path.concat(n), voids: true });
|
|
1224
|
-
n--;
|
|
1225
|
-
}
|
|
1226
|
-
else if (Element.isElement(child)) {
|
|
1227
|
-
// Ensure that inline nodes are surrounded by text nodes.
|
|
1228
|
-
if (editor.isInline(child)) {
|
|
1229
|
-
if (prev == null || !Text$1.isText(prev)) {
|
|
1230
|
-
const newChild = { text: '' };
|
|
1231
|
-
Transforms.insertNodes(editor, newChild, {
|
|
1232
|
-
at: path.concat(n),
|
|
1233
|
-
voids: true,
|
|
1234
|
-
});
|
|
1235
|
-
n++;
|
|
1236
|
-
}
|
|
1237
|
-
else if (isLast) {
|
|
1238
|
-
const newChild = { text: '' };
|
|
1239
|
-
Transforms.insertNodes(editor, newChild, {
|
|
1240
|
-
at: path.concat(n + 1),
|
|
1241
|
-
voids: true,
|
|
1242
|
-
});
|
|
1243
|
-
n++;
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
}
|
|
1247
|
-
else {
|
|
1248
|
-
// Merge adjacent text nodes that are empty or match.
|
|
1249
|
-
if (prev != null && Text$1.isText(prev)) {
|
|
1250
|
-
// adjust logic: first remove empty text to avoid merge empty text #WIK-3805
|
|
1251
|
-
if (prev.text === '') {
|
|
1252
|
-
// adjust logic: adjust cursor location when empty text is first child of node #WIK-3631
|
|
1253
|
-
// ensure current selection in the text #WIK-3762
|
|
1254
|
-
const prevFocused = editor.selection &&
|
|
1255
|
-
Range.isCollapsed(editor.selection) &&
|
|
1256
|
-
Path.equals(editor.selection.anchor.path, path.concat(n - 1));
|
|
1257
|
-
if (prev === node.children[0] && prevFocused) {
|
|
1258
|
-
Transforms.select(editor, Editor.start(editor, path.concat(n)));
|
|
1259
|
-
}
|
|
1260
|
-
Transforms.removeNodes(editor, {
|
|
1261
|
-
at: path.concat(n - 1),
|
|
1262
|
-
voids: true,
|
|
1263
|
-
});
|
|
1264
|
-
n--;
|
|
1265
|
-
}
|
|
1266
|
-
else if (Text$1.equals(child, prev, { loose: true })) {
|
|
1267
|
-
Transforms.mergeNodes(editor, { at: path.concat(n), voids: true });
|
|
1268
|
-
n--;
|
|
1269
|
-
}
|
|
1270
|
-
else if (isLast && child.text === '') {
|
|
1271
|
-
Transforms.removeNodes(editor, {
|
|
1272
|
-
at: path.concat(n),
|
|
1273
|
-
voids: true,
|
|
1274
|
-
});
|
|
1275
|
-
n--;
|
|
1276
|
-
}
|
|
1277
|
-
}
|
|
1278
|
-
}
|
|
1279
|
-
}
|
|
1280
|
-
};
|
|
1281
1185
|
e.onKeydown = () => { };
|
|
1282
1186
|
e.onClick = () => { };
|
|
1283
1187
|
e.isBlockCard = (element) => false;
|
|
@@ -1832,6 +1736,38 @@ class BaseLeafComponent extends BaseComponent {
|
|
|
1832
1736
|
}
|
|
1833
1737
|
this.cdr.markForCheck();
|
|
1834
1738
|
}
|
|
1739
|
+
renderPlaceholder() {
|
|
1740
|
+
var _a, _b, _c;
|
|
1741
|
+
// issue-1: IME input was interrupted
|
|
1742
|
+
// issue-2: IME input focus jumping
|
|
1743
|
+
// Issue occurs when the placeholder node is removed (in leaf span)
|
|
1744
|
+
// So add a placeholder span to the block element root node
|
|
1745
|
+
if (this.context.leaf['placeholder']) {
|
|
1746
|
+
if (!this.placeholderElement) {
|
|
1747
|
+
this.placeholderElement = document.createElement('span');
|
|
1748
|
+
this.placeholderElement.innerText = this.context.leaf['placeholder'];
|
|
1749
|
+
this.placeholderElement.contentEditable = 'false';
|
|
1750
|
+
this.placeholderElement.setAttribute('data-slate-placeholder', 'true');
|
|
1751
|
+
(_a = this.nativeElement.closest('[data-slate-node="element"]')) === null || _a === void 0 ? void 0 : _a.classList.add('element-placeholder');
|
|
1752
|
+
(_b = this.nativeElement.closest('[data-slate-node="element"]')) === null || _b === void 0 ? void 0 : _b.appendChild(this.placeholderElement);
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
else {
|
|
1756
|
+
if (this.placeholderElement) {
|
|
1757
|
+
this.placeholderElement.remove();
|
|
1758
|
+
this.placeholderElement = null;
|
|
1759
|
+
(_c = this.nativeElement.closest('[data-slate-node="element"]')) === null || _c === void 0 ? void 0 : _c.classList.remove('element-placeholder');
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
destroyPlaceholder() {
|
|
1764
|
+
var _a, _b;
|
|
1765
|
+
if (this.placeholderElement) {
|
|
1766
|
+
this.placeholderElement.remove();
|
|
1767
|
+
this.placeholderElement = null;
|
|
1768
|
+
(_b = (_a = this.nativeElement) === null || _a === void 0 ? void 0 : _a.closest('[data-slate-node="element"]')) === null || _b === void 0 ? void 0 : _b.classList.remove('element-placeholder');
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1835
1771
|
}
|
|
1836
1772
|
BaseLeafComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: BaseLeafComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1837
1773
|
BaseLeafComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.7", type: BaseLeafComponent, host: { properties: { "attr.data-slate-leaf": "this.isSlateLeaf" } }, usesInheritance: true, ngImport: i0 });
|
|
@@ -1919,7 +1855,7 @@ class BaseTextComponent extends BaseComponent {
|
|
|
1919
1855
|
this.initialized = false;
|
|
1920
1856
|
}
|
|
1921
1857
|
get text() {
|
|
1922
|
-
return this._context.text;
|
|
1858
|
+
return this._context && this._context.text;
|
|
1923
1859
|
}
|
|
1924
1860
|
ngOnInit() {
|
|
1925
1861
|
this.updateWeakMap();
|
|
@@ -1965,7 +1901,6 @@ class ViewContainer {
|
|
|
1965
1901
|
// first diff
|
|
1966
1902
|
differ.diff(this.childrenComponent);
|
|
1967
1903
|
const parentElement = this.elementRef.nativeElement.parentElement;
|
|
1968
|
-
let firstChildComponent = this.childrenComponent.first;
|
|
1969
1904
|
if (this.childrenComponent.length > 0) {
|
|
1970
1905
|
parentElement.insertBefore(this.createFragment(), this.elementRef.nativeElement);
|
|
1971
1906
|
this.elementRef.nativeElement.remove();
|
|
@@ -1973,41 +1908,15 @@ class ViewContainer {
|
|
|
1973
1908
|
this.childrenComponent.changes.subscribe((value) => {
|
|
1974
1909
|
const iterableChanges = differ.diff(this.childrenComponent);
|
|
1975
1910
|
if (iterableChanges) {
|
|
1976
|
-
iterableChanges.
|
|
1977
|
-
//
|
|
1978
|
-
if (
|
|
1979
|
-
const fragment = document.createDocumentFragment();
|
|
1980
|
-
fragment.append(...record.item.rootNodes);
|
|
1981
|
-
parentElement.insertBefore(fragment, this.elementRef.nativeElement);
|
|
1982
|
-
this.elementRef.nativeElement.remove();
|
|
1911
|
+
iterableChanges.forEachOperation((record, previousIndex, currentIndex) => {
|
|
1912
|
+
// removed
|
|
1913
|
+
if (currentIndex === null) {
|
|
1983
1914
|
return;
|
|
1984
1915
|
}
|
|
1985
|
-
//
|
|
1986
|
-
|
|
1987
|
-
const fragment = document.createDocumentFragment();
|
|
1988
|
-
fragment.append(...record.item.rootNodes);
|
|
1989
|
-
parentElement.prepend(fragment);
|
|
1990
|
-
}
|
|
1991
|
-
else {
|
|
1992
|
-
// insert afterend of previous component end
|
|
1993
|
-
let previousRootNode = this.getPreviousRootNode(record.currentIndex);
|
|
1994
|
-
if (previousRootNode) {
|
|
1995
|
-
record.item.rootNodes.forEach((rootNode) => {
|
|
1996
|
-
previousRootNode.insertAdjacentElement('afterend', rootNode);
|
|
1997
|
-
previousRootNode = rootNode;
|
|
1998
|
-
});
|
|
1999
|
-
}
|
|
2000
|
-
else {
|
|
2001
|
-
this.viewContext.editor.onError({
|
|
2002
|
-
code: SlateErrorCode.NotFoundPreviousRootNodeError,
|
|
2003
|
-
name: 'not found previous rootNode',
|
|
2004
|
-
nativeError: null
|
|
2005
|
-
});
|
|
2006
|
-
}
|
|
2007
|
-
}
|
|
1916
|
+
// added or moved
|
|
1917
|
+
this.handleContainerItemChange(record, parentElement);
|
|
2008
1918
|
});
|
|
2009
1919
|
}
|
|
2010
|
-
firstChildComponent = this.childrenComponent.first;
|
|
2011
1920
|
});
|
|
2012
1921
|
}
|
|
2013
1922
|
getPreviousRootNode(currentIndex) {
|
|
@@ -2030,6 +1939,39 @@ class ViewContainer {
|
|
|
2030
1939
|
});
|
|
2031
1940
|
return fragment;
|
|
2032
1941
|
}
|
|
1942
|
+
handleContainerItemChange(record, parentElement) {
|
|
1943
|
+
// first insert
|
|
1944
|
+
if (this.elementRef.nativeElement.parentElement && this.elementRef.nativeElement.parentElement === parentElement) {
|
|
1945
|
+
const fragment = document.createDocumentFragment();
|
|
1946
|
+
fragment.append(...record.item.rootNodes);
|
|
1947
|
+
parentElement.insertBefore(fragment, this.elementRef.nativeElement);
|
|
1948
|
+
this.elementRef.nativeElement.remove();
|
|
1949
|
+
return;
|
|
1950
|
+
}
|
|
1951
|
+
// insert at start location
|
|
1952
|
+
if (record.currentIndex === 0) {
|
|
1953
|
+
const fragment = document.createDocumentFragment();
|
|
1954
|
+
fragment.append(...record.item.rootNodes);
|
|
1955
|
+
parentElement.prepend(fragment);
|
|
1956
|
+
}
|
|
1957
|
+
else {
|
|
1958
|
+
// insert afterend of previous component end
|
|
1959
|
+
let previousRootNode = this.getPreviousRootNode(record.currentIndex);
|
|
1960
|
+
if (previousRootNode) {
|
|
1961
|
+
record.item.rootNodes.forEach((rootNode) => {
|
|
1962
|
+
previousRootNode.insertAdjacentElement('afterend', rootNode);
|
|
1963
|
+
previousRootNode = rootNode;
|
|
1964
|
+
});
|
|
1965
|
+
}
|
|
1966
|
+
else {
|
|
1967
|
+
this.viewContext.editor.onError({
|
|
1968
|
+
code: SlateErrorCode.NotFoundPreviousRootNodeError,
|
|
1969
|
+
name: 'not found previous rootNode',
|
|
1970
|
+
nativeError: null
|
|
1971
|
+
});
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
2033
1975
|
}
|
|
2034
1976
|
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 });
|
|
2035
1977
|
ViewContainer.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.7", type: ViewContainer, inputs: { viewContext: "viewContext" }, ngImport: i0 });
|
|
@@ -2108,6 +2050,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
|
|
|
2108
2050
|
}] } });
|
|
2109
2051
|
|
|
2110
2052
|
class SlateDefaultLeafComponent extends BaseLeafComponent {
|
|
2053
|
+
onContextChange() {
|
|
2054
|
+
super.onContextChange();
|
|
2055
|
+
this.renderPlaceholder();
|
|
2056
|
+
}
|
|
2057
|
+
ngOnDestroy() {
|
|
2058
|
+
// Because the placeholder span is not in the current component, it is destroyed along with the current component
|
|
2059
|
+
this.destroyPlaceholder();
|
|
2060
|
+
}
|
|
2111
2061
|
}
|
|
2112
2062
|
SlateDefaultLeafComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: SlateDefaultLeafComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2113
2063
|
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: `<span slateString [context]="context" [viewContext]="viewContext"><span>`, isInline: true, components: [{ type: SlateStringComponent, selector: "span[slateString]", inputs: ["context"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
@@ -2596,6 +2546,7 @@ class SlateEditableComponent {
|
|
|
2596
2546
|
});
|
|
2597
2547
|
this.editor.children = normalize(value);
|
|
2598
2548
|
}
|
|
2549
|
+
this.initializeContext();
|
|
2599
2550
|
this.cdr.markForCheck();
|
|
2600
2551
|
}
|
|
2601
2552
|
}
|
|
@@ -2711,7 +2662,7 @@ class SlateEditableComponent {
|
|
|
2711
2662
|
// need exec after this.cdr.detectChanges() to render HTML
|
|
2712
2663
|
// need exec before this.toNativeSelection() to correct native selection
|
|
2713
2664
|
if (this.isComposing) {
|
|
2714
|
-
//
|
|
2665
|
+
// Composition input text be not rendered when user composition input with selection is expanded
|
|
2715
2666
|
// At this time, the following matching conditions are met, assign isComposing to false, and the status is wrong
|
|
2716
2667
|
// this time condition is true and isComposiing is assigned false
|
|
2717
2668
|
// Therefore, need to wait for the composition input text to be rendered before performing condition matching
|
|
@@ -2744,7 +2695,7 @@ class SlateEditableComponent {
|
|
|
2744
2695
|
this.context = {
|
|
2745
2696
|
parent: this.editor,
|
|
2746
2697
|
selection: this.editor.selection,
|
|
2747
|
-
decorations: this.
|
|
2698
|
+
decorations: this.generateDecorations(),
|
|
2748
2699
|
decorate: this.decorate,
|
|
2749
2700
|
readonly: this.readonly
|
|
2750
2701
|
};
|
|
@@ -2761,20 +2712,49 @@ class SlateEditableComponent {
|
|
|
2761
2712
|
};
|
|
2762
2713
|
}
|
|
2763
2714
|
detectContext() {
|
|
2715
|
+
const decorations = this.generateDecorations();
|
|
2764
2716
|
if (this.context.selection !== this.editor.selection ||
|
|
2765
2717
|
this.context.decorate !== this.decorate ||
|
|
2766
|
-
this.context.readonly !== this.readonly
|
|
2767
|
-
|
|
2768
|
-
const isSameDecorations = isDecoratorRangeListEqual(this.context.decorations, decorations);
|
|
2718
|
+
this.context.readonly !== this.readonly ||
|
|
2719
|
+
!isDecoratorRangeListEqual(this.context.decorations, decorations)) {
|
|
2769
2720
|
this.context = {
|
|
2770
2721
|
parent: this.editor,
|
|
2771
2722
|
selection: this.editor.selection,
|
|
2772
|
-
decorations:
|
|
2723
|
+
decorations: decorations,
|
|
2773
2724
|
decorate: this.decorate,
|
|
2774
2725
|
readonly: this.readonly
|
|
2775
2726
|
};
|
|
2776
2727
|
}
|
|
2777
2728
|
}
|
|
2729
|
+
composePlaceholderDecorate(editor) {
|
|
2730
|
+
if (this.placeholderDecorate) {
|
|
2731
|
+
return this.placeholderDecorate(editor) || [];
|
|
2732
|
+
}
|
|
2733
|
+
if (this.placeholder &&
|
|
2734
|
+
editor.children.length === 1 &&
|
|
2735
|
+
Array.from(Node.texts(editor)).length === 1 &&
|
|
2736
|
+
Node.string(editor) === '') {
|
|
2737
|
+
const start = Editor.start(editor, []);
|
|
2738
|
+
return [
|
|
2739
|
+
{
|
|
2740
|
+
placeholder: this.placeholder,
|
|
2741
|
+
anchor: start,
|
|
2742
|
+
focus: start,
|
|
2743
|
+
},
|
|
2744
|
+
];
|
|
2745
|
+
}
|
|
2746
|
+
else {
|
|
2747
|
+
return [];
|
|
2748
|
+
}
|
|
2749
|
+
}
|
|
2750
|
+
generateDecorations() {
|
|
2751
|
+
const decorations = this.decorate([this.editor, []]);
|
|
2752
|
+
const placeholderDecorations = this.isComposing
|
|
2753
|
+
? []
|
|
2754
|
+
: this.composePlaceholderDecorate(this.editor);
|
|
2755
|
+
decorations.push(...placeholderDecorations);
|
|
2756
|
+
return decorations;
|
|
2757
|
+
}
|
|
2778
2758
|
//#region event proxy
|
|
2779
2759
|
addEventListener(eventName, listener, target = this.elementRef.nativeElement) {
|
|
2780
2760
|
this.manualListeners.push(this.renderer2.listen(target, eventName, (event) => {
|
|
@@ -2993,6 +2973,8 @@ class SlateEditableComponent {
|
|
|
2993
2973
|
// so we need avoid repeat isnertText by isComposing === true,
|
|
2994
2974
|
this.isComposing = false;
|
|
2995
2975
|
}
|
|
2976
|
+
this.detectContext();
|
|
2977
|
+
this.cdr.detectChanges();
|
|
2996
2978
|
}
|
|
2997
2979
|
onDOMCompositionStart(event) {
|
|
2998
2980
|
const { selection } = this.editor;
|
|
@@ -3006,6 +2988,8 @@ class SlateEditableComponent {
|
|
|
3006
2988
|
if (hasEditableTarget(this.editor, event.target) && !this.isDOMEventHandled(event, this.compositionStart)) {
|
|
3007
2989
|
this.isComposing = true;
|
|
3008
2990
|
}
|
|
2991
|
+
this.detectContext();
|
|
2992
|
+
this.cdr.detectChanges();
|
|
3009
2993
|
}
|
|
3010
2994
|
onDOMCopy(event) {
|
|
3011
2995
|
const window = AngularEditor.getWindow(this.editor);
|
|
@@ -3275,6 +3259,25 @@ class SlateEditableComponent {
|
|
|
3275
3259
|
return;
|
|
3276
3260
|
}
|
|
3277
3261
|
}
|
|
3262
|
+
else {
|
|
3263
|
+
if (IS_CHROME || IS_SAFARI) {
|
|
3264
|
+
// COMPAT: Chrome and Safari support `beforeinput` event but do not fire
|
|
3265
|
+
// an event when deleting backwards in a selected void inline node
|
|
3266
|
+
if (selection &&
|
|
3267
|
+
(hotkeys.isDeleteBackward(nativeEvent) ||
|
|
3268
|
+
hotkeys.isDeleteForward(nativeEvent)) &&
|
|
3269
|
+
Range.isCollapsed(selection)) {
|
|
3270
|
+
const currentNode = Node.parent(editor, selection.anchor.path);
|
|
3271
|
+
if (Element.isElement(currentNode) &&
|
|
3272
|
+
Editor.isVoid(editor, currentNode) &&
|
|
3273
|
+
Editor.isInline(editor, currentNode)) {
|
|
3274
|
+
event.preventDefault();
|
|
3275
|
+
Editor.deleteBackward(editor, { unit: 'block' });
|
|
3276
|
+
return;
|
|
3277
|
+
}
|
|
3278
|
+
}
|
|
3279
|
+
}
|
|
3280
|
+
}
|
|
3278
3281
|
}
|
|
3279
3282
|
catch (error) {
|
|
3280
3283
|
this.editor.onError({ code: SlateErrorCode.OnDOMKeydownError, nativeError: error });
|
|
@@ -3309,7 +3312,7 @@ class SlateEditableComponent {
|
|
|
3309
3312
|
if (!Range.isCollapsed(this.editor.selection)) {
|
|
3310
3313
|
Editor.deleteFragment(this.editor);
|
|
3311
3314
|
}
|
|
3312
|
-
// just handle Non-IME input
|
|
3315
|
+
// just handle Non-IME input
|
|
3313
3316
|
if (!this.isComposing) {
|
|
3314
3317
|
Editor.insertText(this.editor, text);
|
|
3315
3318
|
}
|
|
@@ -3337,11 +3340,11 @@ class SlateEditableComponent {
|
|
|
3337
3340
|
}
|
|
3338
3341
|
}
|
|
3339
3342
|
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 });
|
|
3340
|
-
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: [{
|
|
3343
|
+
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: [{
|
|
3341
3344
|
provide: NG_VALUE_ACCESSOR,
|
|
3342
3345
|
useExisting: forwardRef(() => SlateEditableComponent),
|
|
3343
3346
|
multi: true
|
|
3344
|
-
}], 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\"
|
|
3347
|
+
}], 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 });
|
|
3345
3348
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: SlateEditableComponent, decorators: [{
|
|
3346
3349
|
type: Component,
|
|
3347
3350
|
args: [{
|
|
@@ -3372,12 +3375,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
|
|
|
3372
3375
|
type: Input
|
|
3373
3376
|
}], decorate: [{
|
|
3374
3377
|
type: Input
|
|
3378
|
+
}], placeholderDecorate: [{
|
|
3379
|
+
type: Input
|
|
3375
3380
|
}], isStrictDecorate: [{
|
|
3376
3381
|
type: Input
|
|
3377
3382
|
}], trackBy: [{
|
|
3378
3383
|
type: Input
|
|
3379
3384
|
}], readonly: [{
|
|
3380
3385
|
type: Input
|
|
3386
|
+
}], placeholder: [{
|
|
3387
|
+
type: Input
|
|
3381
3388
|
}], beforeInput: [{
|
|
3382
3389
|
type: Input
|
|
3383
3390
|
}], blur: [{
|