slate-angular 16.1.0-next.7 → 16.1.0-next.8
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/components/children/children-outlet.component.d.ts +9 -0
- package/components/editable/editable.component.d.ts +1 -1
- package/esm2022/components/children/children-outlet.component.mjs +22 -0
- package/esm2022/components/children/children.component.mjs +2 -4
- package/esm2022/components/editable/editable.component.mjs +6 -6
- package/esm2022/components/leaf/token.mjs +1 -1
- package/esm2022/components/string/default-string.component.mjs +1 -1
- package/esm2022/components/string/string.component.mjs +1 -1
- package/esm2022/components/text/token.mjs +1 -1
- package/esm2022/module.mjs +7 -16
- package/esm2022/plugins/angular-editor.mjs +3 -3
- package/esm2022/plugins/with-angular.mjs +4 -4
- package/esm2022/public-api.mjs +2 -1
- package/esm2022/utils/throttle.mjs +1 -1
- package/esm2022/view/base.mjs +29 -10
- package/esm2022/view/container.mjs +1 -1
- package/esm2022/view/render/leaves-render.mjs +8 -6
- package/esm2022/view/render/list-render.mjs +9 -7
- package/esm2022/view/render/utils.mjs +20 -7
- package/fesm2022/slate-angular.mjs +97 -53
- package/fesm2022/slate-angular.mjs.map +1 -1
- package/module.d.ts +2 -1
- package/package.json +5 -5
- package/plugins/angular-editor.d.ts +1 -1
- package/public-api.d.ts +1 -0
- package/view/base.d.ts +7 -2
- package/view/render/leaves-render.d.ts +2 -1
- package/view/render/list-render.d.ts +2 -1
- package/view/render/utils.d.ts +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Editor, Range, Transforms, Path,
|
|
1
|
+
import { Editor, Range, Element, Transforms, Path, Text as Text$1, Node } from 'slate';
|
|
2
2
|
import { isKeyHotkey } from 'is-hotkey';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
4
|
import { TemplateRef, Component, ChangeDetectionStrategy, ViewChild, Directive, Input, InjectionToken, ComponentRef, IterableDiffers, HostBinding, inject, ViewContainerRef, forwardRef, ElementRef, Inject, NgModule } from '@angular/core';
|
|
@@ -415,7 +415,7 @@ const AngularEditor = {
|
|
|
415
415
|
const [start, end] = Range.edges(selection);
|
|
416
416
|
const endBlock = Editor.above(editor, {
|
|
417
417
|
at: end,
|
|
418
|
-
match: node => Editor.isBlock(editor, node)
|
|
418
|
+
match: node => Element.isElement(node) && Editor.isBlock(editor, node)
|
|
419
419
|
});
|
|
420
420
|
return Editor.isStart(editor, end, endBlock[1]);
|
|
421
421
|
},
|
|
@@ -637,7 +637,7 @@ const AngularEditor = {
|
|
|
637
637
|
// If the drop target is inside a void node, move it into either the
|
|
638
638
|
// next or previous node, depending on which side the `x` and `y`
|
|
639
639
|
// coordinates are closest to.
|
|
640
|
-
if (Editor.isVoid(editor, node)) {
|
|
640
|
+
if (Element.isElement(node) && Editor.isVoid(editor, node)) {
|
|
641
641
|
const rect = target.getBoundingClientRect();
|
|
642
642
|
const isPrev = editor.isInline(node) ? x - rect.left < rect.left + rect.width - x : y - rect.top < rect.top + rect.height - y;
|
|
643
643
|
const edge = Editor.point(editor, path, {
|
|
@@ -1080,7 +1080,7 @@ const withAngular = (editor, clipboardFormatKey = 'x-slate-fragment') => {
|
|
|
1080
1080
|
}
|
|
1081
1081
|
if (editor.selection && Range.isCollapsed(editor.selection)) {
|
|
1082
1082
|
const parentBlockEntry = Editor.above(editor, {
|
|
1083
|
-
match: n => Editor.isBlock(editor, n),
|
|
1083
|
+
match: n => Element.isElement(n) && Editor.isBlock(editor, n),
|
|
1084
1084
|
at: editor.selection
|
|
1085
1085
|
});
|
|
1086
1086
|
if (parentBlockEntry) {
|
|
@@ -1230,7 +1230,7 @@ const withAngular = (editor, clipboardFormatKey = 'x-slate-fragment') => {
|
|
|
1230
1230
|
}
|
|
1231
1231
|
else {
|
|
1232
1232
|
const node = Node.parent(editor, selection.anchor.path);
|
|
1233
|
-
if (Editor.isVoid(editor, node)) {
|
|
1233
|
+
if (Element.isElement(node) && Editor.isVoid(editor, node)) {
|
|
1234
1234
|
Transforms.delete(editor);
|
|
1235
1235
|
}
|
|
1236
1236
|
}
|
|
@@ -1712,8 +1712,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImpor
|
|
|
1712
1712
|
selector: 'slate-children',
|
|
1713
1713
|
template: ``,
|
|
1714
1714
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1715
|
-
standalone: true
|
|
1716
|
-
imports: [NgFor]
|
|
1715
|
+
standalone: true
|
|
1717
1716
|
}]
|
|
1718
1717
|
}], propDecorators: { children: [{
|
|
1719
1718
|
type: Input
|
|
@@ -1813,14 +1812,20 @@ function updateContext(view, newContext, viewContext) {
|
|
|
1813
1812
|
view.detectChanges();
|
|
1814
1813
|
}
|
|
1815
1814
|
}
|
|
1816
|
-
function mount(views, blockCards, outletElement) {
|
|
1815
|
+
function mount(views, blockCards, outletParent, outletElement) {
|
|
1817
1816
|
if (views.length > 0) {
|
|
1818
|
-
const
|
|
1817
|
+
const fragment = document.createDocumentFragment();
|
|
1819
1818
|
views.forEach((view, index) => {
|
|
1820
1819
|
const blockCard = blockCards ? blockCards[index] : undefined;
|
|
1821
|
-
|
|
1820
|
+
fragment.append(...getRootNodes(view, blockCard));
|
|
1822
1821
|
});
|
|
1823
|
-
outletElement
|
|
1822
|
+
if (outletElement) {
|
|
1823
|
+
outletParent.insertBefore(fragment, outletElement);
|
|
1824
|
+
outletElement.remove();
|
|
1825
|
+
}
|
|
1826
|
+
else {
|
|
1827
|
+
outletParent.prepend(fragment);
|
|
1828
|
+
}
|
|
1824
1829
|
}
|
|
1825
1830
|
}
|
|
1826
1831
|
function getRootNodes(ref, blockCard) {
|
|
@@ -1849,7 +1854,7 @@ function getRootNodes(ref, blockCard) {
|
|
|
1849
1854
|
return result;
|
|
1850
1855
|
}
|
|
1851
1856
|
}
|
|
1852
|
-
function mountOnItemChange(index, item, views, blockCards,
|
|
1857
|
+
function mountOnItemChange(index, item, views, blockCards, outletParent, firstRootNode, viewContext) {
|
|
1853
1858
|
const view = views[index];
|
|
1854
1859
|
let rootNodes = getRootNodes(view);
|
|
1855
1860
|
if (blockCards) {
|
|
@@ -1860,7 +1865,14 @@ function mountOnItemChange(index, item, views, blockCards, outletElement, viewCo
|
|
|
1860
1865
|
}
|
|
1861
1866
|
}
|
|
1862
1867
|
if (index === 0) {
|
|
1863
|
-
|
|
1868
|
+
if (firstRootNode) {
|
|
1869
|
+
rootNodes.forEach(rootNode => {
|
|
1870
|
+
firstRootNode.insertAdjacentElement('beforebegin', rootNode);
|
|
1871
|
+
});
|
|
1872
|
+
}
|
|
1873
|
+
else {
|
|
1874
|
+
outletParent.prepend(...rootNodes);
|
|
1875
|
+
}
|
|
1864
1876
|
}
|
|
1865
1877
|
else {
|
|
1866
1878
|
const previousView = views[index - 1];
|
|
@@ -1875,9 +1887,10 @@ function mountOnItemChange(index, item, views, blockCards, outletElement, viewCo
|
|
|
1875
1887
|
}
|
|
1876
1888
|
|
|
1877
1889
|
class ListRender {
|
|
1878
|
-
constructor(viewContext, viewContainerRef, getOutletElement) {
|
|
1890
|
+
constructor(viewContext, viewContainerRef, getOutletParent, getOutletElement) {
|
|
1879
1891
|
this.viewContext = viewContext;
|
|
1880
1892
|
this.viewContainerRef = viewContainerRef;
|
|
1893
|
+
this.getOutletParent = getOutletParent;
|
|
1881
1894
|
this.getOutletElement = getOutletElement;
|
|
1882
1895
|
this.views = [];
|
|
1883
1896
|
this.blockCards = [];
|
|
@@ -1901,7 +1914,7 @@ class ListRender {
|
|
|
1901
1914
|
this.viewTypes.push(viewType);
|
|
1902
1915
|
this.blockCards.push(blockCard);
|
|
1903
1916
|
});
|
|
1904
|
-
mount(this.views, this.blockCards, this.getOutletElement());
|
|
1917
|
+
mount(this.views, this.blockCards, this.getOutletParent(), this.getOutletElement());
|
|
1905
1918
|
const newDiffers = this.viewContainerRef.injector.get(IterableDiffers);
|
|
1906
1919
|
this.differ = newDiffers.find(children).create(trackBy$1(this.viewContext));
|
|
1907
1920
|
this.differ.diff(children);
|
|
@@ -1911,10 +1924,11 @@ class ListRender {
|
|
|
1911
1924
|
this.initialize(children, parent, childrenContext);
|
|
1912
1925
|
return;
|
|
1913
1926
|
}
|
|
1914
|
-
const
|
|
1927
|
+
const outletParent = this.getOutletParent();
|
|
1915
1928
|
const diffResult = this.differ.diff(children);
|
|
1916
1929
|
const parentPath = AngularEditor.findPath(this.viewContext.editor, parent);
|
|
1917
1930
|
if (diffResult) {
|
|
1931
|
+
let firstRootNode = getRootNodes(this.views[0], this.blockCards[0])[0];
|
|
1918
1932
|
const newContexts = [];
|
|
1919
1933
|
const newViewTypes = [];
|
|
1920
1934
|
const newViews = [];
|
|
@@ -1933,7 +1947,7 @@ class ListRender {
|
|
|
1933
1947
|
newContexts.push(context);
|
|
1934
1948
|
newViews.push(view);
|
|
1935
1949
|
newBlockCards.push(blockCard);
|
|
1936
|
-
mountOnItemChange(record.currentIndex, record.item, newViews, newBlockCards,
|
|
1950
|
+
mountOnItemChange(record.currentIndex, record.item, newViews, newBlockCards, outletParent, firstRootNode, this.viewContext);
|
|
1937
1951
|
}
|
|
1938
1952
|
else {
|
|
1939
1953
|
const previousView = this.views[record.previousIndex];
|
|
@@ -1964,7 +1978,7 @@ class ListRender {
|
|
|
1964
1978
|
newBlockCards.push(blockCard);
|
|
1965
1979
|
}
|
|
1966
1980
|
});
|
|
1967
|
-
diffResult.forEachOperation(
|
|
1981
|
+
diffResult.forEachOperation(record => {
|
|
1968
1982
|
// removed
|
|
1969
1983
|
if (record.currentIndex === null) {
|
|
1970
1984
|
const view = this.views[record.previousIndex];
|
|
@@ -1974,7 +1988,7 @@ class ListRender {
|
|
|
1974
1988
|
}
|
|
1975
1989
|
// moved
|
|
1976
1990
|
if (record.previousIndex !== null && record.currentIndex !== null) {
|
|
1977
|
-
mountOnItemChange(record.currentIndex, record.item, newViews, newBlockCards,
|
|
1991
|
+
mountOnItemChange(record.currentIndex, record.item, newViews, newBlockCards, outletParent, firstRootNode, this.viewContext);
|
|
1978
1992
|
// Solve the block-card DOMElement loss when moving nodes
|
|
1979
1993
|
newBlockCards[record.currentIndex]?.instance.append();
|
|
1980
1994
|
}
|
|
@@ -2118,9 +2132,10 @@ function memoizedTextContext(prev, next) {
|
|
|
2118
2132
|
}
|
|
2119
2133
|
|
|
2120
2134
|
class LeavesRender {
|
|
2121
|
-
constructor(viewContext, viewContainerRef, getOutletElement) {
|
|
2135
|
+
constructor(viewContext, viewContainerRef, getOutletParent, getOutletElement) {
|
|
2122
2136
|
this.viewContext = viewContext;
|
|
2123
2137
|
this.viewContainerRef = viewContainerRef;
|
|
2138
|
+
this.getOutletParent = getOutletParent;
|
|
2124
2139
|
this.getOutletElement = getOutletElement;
|
|
2125
2140
|
this.views = [];
|
|
2126
2141
|
this.contexts = [];
|
|
@@ -2138,16 +2153,17 @@ class LeavesRender {
|
|
|
2138
2153
|
this.contexts.push(context);
|
|
2139
2154
|
this.viewTypes.push(viewType);
|
|
2140
2155
|
});
|
|
2141
|
-
mount(this.views, null, this.getOutletElement());
|
|
2156
|
+
mount(this.views, null, this.getOutletParent(), this.getOutletElement());
|
|
2142
2157
|
const newDiffers = this.viewContainerRef.injector.get(IterableDiffers);
|
|
2143
2158
|
this.differ = newDiffers.find(this.leaves).create(trackBy(this.viewContext));
|
|
2144
2159
|
this.differ.diff(this.leaves);
|
|
2145
2160
|
}
|
|
2146
2161
|
update(context) {
|
|
2147
2162
|
const { leaves, contexts } = this.getLeaves(context);
|
|
2148
|
-
const
|
|
2163
|
+
const outletParent = this.getOutletParent();
|
|
2149
2164
|
const diffResult = this.differ.diff(leaves);
|
|
2150
2165
|
if (diffResult) {
|
|
2166
|
+
let firstRootNode = getRootNodes(this.views[0])[0];
|
|
2151
2167
|
const newContexts = [];
|
|
2152
2168
|
const newViewTypes = [];
|
|
2153
2169
|
const newViews = [];
|
|
@@ -2160,7 +2176,7 @@ class LeavesRender {
|
|
|
2160
2176
|
view = createEmbeddedViewOrComponent(viewType, context, this.viewContext, this.viewContainerRef);
|
|
2161
2177
|
newContexts.push(context);
|
|
2162
2178
|
newViews.push(view);
|
|
2163
|
-
mountOnItemChange(record.currentIndex, record.item, newViews, null,
|
|
2179
|
+
mountOnItemChange(record.currentIndex, record.item, newViews, null, outletParent, firstRootNode, this.viewContext);
|
|
2164
2180
|
}
|
|
2165
2181
|
else {
|
|
2166
2182
|
const previousView = this.views[record.previousIndex];
|
|
@@ -2185,7 +2201,7 @@ class LeavesRender {
|
|
|
2185
2201
|
view.destroy();
|
|
2186
2202
|
});
|
|
2187
2203
|
diffResult.forEachMovedItem(record => {
|
|
2188
|
-
mountOnItemChange(record.currentIndex, record.item, newViews, null,
|
|
2204
|
+
mountOnItemChange(record.currentIndex, record.item, newViews, null, outletParent, firstRootNode, this.viewContext);
|
|
2189
2205
|
});
|
|
2190
2206
|
this.viewTypes = newViewTypes;
|
|
2191
2207
|
this.views = newViews;
|
|
@@ -2219,6 +2235,26 @@ function trackBy(viewContext) {
|
|
|
2219
2235
|
};
|
|
2220
2236
|
}
|
|
2221
2237
|
|
|
2238
|
+
class SlateChildrenOutlet {
|
|
2239
|
+
constructor(elementRef) {
|
|
2240
|
+
this.elementRef = elementRef;
|
|
2241
|
+
}
|
|
2242
|
+
getNativeElement() {
|
|
2243
|
+
return this.elementRef.nativeElement;
|
|
2244
|
+
}
|
|
2245
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateChildrenOutlet, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2246
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: SlateChildrenOutlet, isStandalone: true, selector: "slate-children-outlet", ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2247
|
+
}
|
|
2248
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateChildrenOutlet, decorators: [{
|
|
2249
|
+
type: Component,
|
|
2250
|
+
args: [{
|
|
2251
|
+
selector: 'slate-children-outlet',
|
|
2252
|
+
template: ``,
|
|
2253
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2254
|
+
standalone: true
|
|
2255
|
+
}]
|
|
2256
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
|
|
2257
|
+
|
|
2222
2258
|
/**
|
|
2223
2259
|
* base class for custom element component or text component
|
|
2224
2260
|
*/
|
|
@@ -2333,9 +2369,15 @@ class BaseElementComponent extends BaseComponent {
|
|
|
2333
2369
|
constructor() {
|
|
2334
2370
|
super(...arguments);
|
|
2335
2371
|
this.viewContainerRef = inject(ViewContainerRef);
|
|
2336
|
-
this.
|
|
2372
|
+
this.getOutletParent = () => {
|
|
2337
2373
|
return this.elementRef.nativeElement;
|
|
2338
2374
|
};
|
|
2375
|
+
this.getOutletElement = () => {
|
|
2376
|
+
if (this.childrenOutletInstance) {
|
|
2377
|
+
return this.childrenOutletInstance.getNativeElement();
|
|
2378
|
+
}
|
|
2379
|
+
return null;
|
|
2380
|
+
};
|
|
2339
2381
|
}
|
|
2340
2382
|
get element() {
|
|
2341
2383
|
return this._context && this._context.element;
|
|
@@ -2363,7 +2405,7 @@ class BaseElementComponent extends BaseComponent {
|
|
|
2363
2405
|
this.nativeElement.setAttribute(key, this._context.attributes[key]);
|
|
2364
2406
|
}
|
|
2365
2407
|
this.initialized = true;
|
|
2366
|
-
this.listRender = new ListRender(this.viewContext, this.viewContainerRef, this.getOutletElement);
|
|
2408
|
+
this.listRender = new ListRender(this.viewContext, this.viewContainerRef, this.getOutletParent, this.getOutletElement);
|
|
2367
2409
|
this.listRender.initialize(this.children, this.element, this.childrenContext);
|
|
2368
2410
|
}
|
|
2369
2411
|
updateWeakMap() {
|
|
@@ -2397,11 +2439,14 @@ class BaseElementComponent extends BaseComponent {
|
|
|
2397
2439
|
};
|
|
2398
2440
|
}
|
|
2399
2441
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseElementComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2400
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: BaseElementComponent, usesInheritance: true, ngImport: i0 }); }
|
|
2442
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: BaseElementComponent, viewQueries: [{ propertyName: "childrenOutletInstance", first: true, predicate: SlateChildrenOutlet, descendants: true, static: true }], usesInheritance: true, ngImport: i0 }); }
|
|
2401
2443
|
}
|
|
2402
2444
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseElementComponent, decorators: [{
|
|
2403
2445
|
type: Directive
|
|
2404
|
-
}]
|
|
2446
|
+
}], propDecorators: { childrenOutletInstance: [{
|
|
2447
|
+
type: ViewChild,
|
|
2448
|
+
args: [SlateChildrenOutlet, { static: true }]
|
|
2449
|
+
}] } });
|
|
2405
2450
|
/**
|
|
2406
2451
|
* base class for custom text component
|
|
2407
2452
|
*/
|
|
@@ -2409,16 +2454,22 @@ class BaseTextComponent extends BaseComponent {
|
|
|
2409
2454
|
constructor() {
|
|
2410
2455
|
super(...arguments);
|
|
2411
2456
|
this.viewContainerRef = inject(ViewContainerRef);
|
|
2412
|
-
this.
|
|
2457
|
+
this.getOutletParent = () => {
|
|
2413
2458
|
return this.elementRef.nativeElement;
|
|
2414
2459
|
};
|
|
2460
|
+
this.getOutletElement = () => {
|
|
2461
|
+
if (this.childrenOutletInstance) {
|
|
2462
|
+
return this.childrenOutletInstance.getNativeElement();
|
|
2463
|
+
}
|
|
2464
|
+
return null;
|
|
2465
|
+
};
|
|
2415
2466
|
}
|
|
2416
2467
|
get text() {
|
|
2417
2468
|
return this._context && this._context.text;
|
|
2418
2469
|
}
|
|
2419
2470
|
ngOnInit() {
|
|
2420
2471
|
this.initialized = true;
|
|
2421
|
-
this.leavesRender = new LeavesRender(this.viewContext, this.viewContainerRef, this.getOutletElement);
|
|
2472
|
+
this.leavesRender = new LeavesRender(this.viewContext, this.viewContainerRef, this.getOutletParent, this.getOutletElement);
|
|
2422
2473
|
this.leavesRender.initialize(this.context);
|
|
2423
2474
|
}
|
|
2424
2475
|
updateWeakMap() {
|
|
@@ -2438,11 +2489,14 @@ class BaseTextComponent extends BaseComponent {
|
|
|
2438
2489
|
this.leavesRender.update(this.context);
|
|
2439
2490
|
}
|
|
2440
2491
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseTextComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2441
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: BaseTextComponent, usesInheritance: true, ngImport: i0 }); }
|
|
2492
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: BaseTextComponent, viewQueries: [{ propertyName: "childrenOutletInstance", first: true, predicate: SlateChildrenOutlet, descendants: true, static: true }], usesInheritance: true, ngImport: i0 }); }
|
|
2442
2493
|
}
|
|
2443
2494
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseTextComponent, decorators: [{
|
|
2444
2495
|
type: Directive
|
|
2445
|
-
}]
|
|
2496
|
+
}], propDecorators: { childrenOutletInstance: [{
|
|
2497
|
+
type: ViewChild,
|
|
2498
|
+
args: [SlateChildrenOutlet, { static: true }]
|
|
2499
|
+
}] } });
|
|
2446
2500
|
|
|
2447
2501
|
class SlateLeaves extends ViewContainer {
|
|
2448
2502
|
constructor() {
|
|
@@ -2880,7 +2934,7 @@ class SlateEditable {
|
|
|
2880
2934
|
this.dataSlateNode = 'value';
|
|
2881
2935
|
this.dataGramm = false;
|
|
2882
2936
|
this.viewContainerRef = inject(ViewContainerRef);
|
|
2883
|
-
this.
|
|
2937
|
+
this.getOutletParent = () => {
|
|
2884
2938
|
return this.elementRef.nativeElement;
|
|
2885
2939
|
};
|
|
2886
2940
|
}
|
|
@@ -2908,7 +2962,7 @@ class SlateEditable {
|
|
|
2908
2962
|
// add browser class
|
|
2909
2963
|
let browserClass = IS_FIREFOX ? 'firefox' : IS_SAFARI ? 'safari' : '';
|
|
2910
2964
|
browserClass && this.elementRef.nativeElement.classList.add(browserClass);
|
|
2911
|
-
this.listRender = new ListRender(this.viewContext, this.viewContainerRef, this.
|
|
2965
|
+
this.listRender = new ListRender(this.viewContext, this.viewContainerRef, this.getOutletParent, () => null);
|
|
2912
2966
|
}
|
|
2913
2967
|
ngOnChanges(simpleChanges) {
|
|
2914
2968
|
if (!this.initialized) {
|
|
@@ -3511,7 +3565,7 @@ class SlateEditable {
|
|
|
3511
3565
|
// that drops are allowed. Editable content is droppable by
|
|
3512
3566
|
// default, and calling `preventDefault` hides the cursor.
|
|
3513
3567
|
const node = AngularEditor.toSlateNode(this.editor, event.target);
|
|
3514
|
-
if (Editor.isVoid(this.editor, node)) {
|
|
3568
|
+
if (Element.isElement(node) && Editor.isVoid(this.editor, node)) {
|
|
3515
3569
|
event.preventDefault();
|
|
3516
3570
|
}
|
|
3517
3571
|
}
|
|
@@ -3520,7 +3574,7 @@ class SlateEditable {
|
|
|
3520
3574
|
if (!this.readonly && hasTarget(this.editor, event.target) && !this.isDOMEventHandled(event, this.dragStart)) {
|
|
3521
3575
|
const node = AngularEditor.toSlateNode(this.editor, event.target);
|
|
3522
3576
|
const path = AngularEditor.findPath(this.editor, node);
|
|
3523
|
-
const voidMatch = Editor.isVoid(this.editor, node) || Editor.void(this.editor, { at: path, voids: true });
|
|
3577
|
+
const voidMatch = Element.isElement(node) && (Editor.isVoid(this.editor, node) || Editor.void(this.editor, { at: path, voids: true }));
|
|
3524
3578
|
// If starting a drag on a void node, make sure it is selected
|
|
3525
3579
|
// so that it shows up in the selection's fragment.
|
|
3526
3580
|
if (voidMatch) {
|
|
@@ -4043,7 +4097,7 @@ const hasTarget = (editor, target) => {
|
|
|
4043
4097
|
*/
|
|
4044
4098
|
const isTargetInsideVoid = (editor, target) => {
|
|
4045
4099
|
const slateNode = hasTarget(editor, target) && AngularEditor.toSlateNode(editor, target);
|
|
4046
|
-
return Editor.isVoid(editor, slateNode);
|
|
4100
|
+
return Element.isElement(slateNode) && Editor.isVoid(editor, slateNode);
|
|
4047
4101
|
};
|
|
4048
4102
|
const hasStringTarget = (domSelection) => {
|
|
4049
4103
|
return ((domSelection.anchorNode.parentElement.hasAttribute('data-slate-string') ||
|
|
@@ -4099,12 +4153,8 @@ class SlateModule {
|
|
|
4099
4153
|
SlateBlockCard,
|
|
4100
4154
|
SlateLeaves,
|
|
4101
4155
|
SlateDefaultLeaf,
|
|
4102
|
-
SlateDefaultString
|
|
4103
|
-
SlateChildren,
|
|
4104
|
-
SlateElement,
|
|
4105
|
-
SlateLeaves,
|
|
4106
|
-
SlateString,
|
|
4107
|
-
SlateDefaultString] }); }
|
|
4156
|
+
SlateDefaultString,
|
|
4157
|
+
SlateChildrenOutlet], exports: [SlateEditable, SlateChildren, SlateChildrenOutlet, SlateElement, SlateLeaves, SlateString, SlateDefaultString] }); }
|
|
4108
4158
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateModule, providers: [
|
|
4109
4159
|
{
|
|
4110
4160
|
provide: SLATE_DEFAULT_ELEMENT_COMPONENT_TOKEN,
|
|
@@ -4128,16 +4178,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImpor
|
|
|
4128
4178
|
SlateBlockCard,
|
|
4129
4179
|
SlateLeaves,
|
|
4130
4180
|
SlateDefaultLeaf,
|
|
4131
|
-
SlateDefaultString
|
|
4132
|
-
|
|
4133
|
-
exports: [
|
|
4134
|
-
SlateEditable,
|
|
4135
|
-
SlateChildren,
|
|
4136
|
-
SlateElement,
|
|
4137
|
-
SlateLeaves,
|
|
4138
|
-
SlateString,
|
|
4139
|
-
SlateDefaultString
|
|
4181
|
+
SlateDefaultString,
|
|
4182
|
+
SlateChildrenOutlet
|
|
4140
4183
|
],
|
|
4184
|
+
exports: [SlateEditable, SlateChildren, SlateChildrenOutlet, SlateElement, SlateLeaves, SlateString, SlateDefaultString],
|
|
4141
4185
|
providers: [
|
|
4142
4186
|
{
|
|
4143
4187
|
provide: SLATE_DEFAULT_ELEMENT_COMPONENT_TOKEN,
|
|
@@ -4155,5 +4199,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImpor
|
|
|
4155
4199
|
* Generated bundle index. Do not edit.
|
|
4156
4200
|
*/
|
|
4157
4201
|
|
|
4158
|
-
export { AngularEditor, BaseComponent, BaseElementComponent, BaseLeafComponent, BaseTextComponent, DOMComment, DOMElement, DOMNode, DOMRange, DOMSelection, DOMStaticRange, DOMText, EDITOR_TO_ELEMENT, EDITOR_TO_ON_CHANGE, EDITOR_TO_PLACEHOLDER, EDITOR_TO_WINDOW, ELEMENT_TO_COMPONENT, ELEMENT_TO_NODE, FAKE_LEFT_BLOCK_CARD_OFFSET, FAKE_RIGHT_BLOCK_CARD_OFFSET, HAS_BEFORE_INPUT_SUPPORT, IS_ANDROID, IS_APPLE, IS_CHROME, IS_CHROME_LEGACY, IS_CLICKING, IS_DRAGGING, IS_EDGE_LEGACY, IS_FIREFOX, IS_FIREFOX_LEGACY, IS_FOCUSED, IS_IOS, IS_QQBROWSER, IS_READONLY, IS_SAFARI, IS_UC_MOBILE, IS_WECHATBROWSER, KEY_TO_ELEMENT, Key, NODE_TO_ELEMENT, NODE_TO_INDEX, NODE_TO_KEY, NODE_TO_PARENT, PLACEHOLDER_SYMBOL, SlateChildren, SlateDefaultString, SlateEditable, SlateElement, SlateErrorCode, SlateLeaves, SlateModule, SlateString, check, createThrottleRAF, defaultScrollSelectionIntoView, getCardTargetAttribute, getClipboardData, getDefaultView, getEditableChild, getEditableChildAndIndex, getPlainText, getSlateFragmentAttribute, hasAfterContextChange, hasBeforeContextChange, hasBlockCard, hasBlockCardWithNode, hasEditableTarget, hasShadowRoot, hotkeys, isCardCenterByTargetAttr, isCardLeft, isCardLeftByTargetAttr, isCardRightByTargetAttr, isComponentType, isDOMComment, isDOMElement, isDOMNode, isDOMSelection, isDOMText, isDecoratorRangeListEqual, isEmpty, isPlainTextOnlyPaste, isTemplateRef, isValid, normalize, normalizeDOMPoint, shallowCompare, withAngular };
|
|
4202
|
+
export { AngularEditor, BaseComponent, BaseElementComponent, BaseLeafComponent, BaseTextComponent, DOMComment, DOMElement, DOMNode, DOMRange, DOMSelection, DOMStaticRange, DOMText, EDITOR_TO_ELEMENT, EDITOR_TO_ON_CHANGE, EDITOR_TO_PLACEHOLDER, EDITOR_TO_WINDOW, ELEMENT_TO_COMPONENT, ELEMENT_TO_NODE, FAKE_LEFT_BLOCK_CARD_OFFSET, FAKE_RIGHT_BLOCK_CARD_OFFSET, HAS_BEFORE_INPUT_SUPPORT, IS_ANDROID, IS_APPLE, IS_CHROME, IS_CHROME_LEGACY, IS_CLICKING, IS_DRAGGING, IS_EDGE_LEGACY, IS_FIREFOX, IS_FIREFOX_LEGACY, IS_FOCUSED, IS_IOS, IS_QQBROWSER, IS_READONLY, IS_SAFARI, IS_UC_MOBILE, IS_WECHATBROWSER, KEY_TO_ELEMENT, Key, NODE_TO_ELEMENT, NODE_TO_INDEX, NODE_TO_KEY, NODE_TO_PARENT, PLACEHOLDER_SYMBOL, SlateChildren, SlateChildrenOutlet, SlateDefaultString, SlateEditable, SlateElement, SlateErrorCode, SlateLeaves, SlateModule, SlateString, check, createThrottleRAF, defaultScrollSelectionIntoView, getCardTargetAttribute, getClipboardData, getDefaultView, getEditableChild, getEditableChildAndIndex, getPlainText, getSlateFragmentAttribute, hasAfterContextChange, hasBeforeContextChange, hasBlockCard, hasBlockCardWithNode, hasEditableTarget, hasShadowRoot, hotkeys, isCardCenterByTargetAttr, isCardLeft, isCardLeftByTargetAttr, isCardRightByTargetAttr, isComponentType, isDOMComment, isDOMElement, isDOMNode, isDOMSelection, isDOMText, isDecoratorRangeListEqual, isEmpty, isPlainTextOnlyPaste, isTemplateRef, isValid, normalize, normalizeDOMPoint, shallowCompare, withAngular };
|
|
4159
4203
|
//# sourceMappingURL=slate-angular.mjs.map
|