slate-angular 16.1.0-next.6 → 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/components/string/default-string.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 +3 -2
- package/esm2022/utils/throttle.mjs +1 -1
- package/esm2022/view/base.mjs +33 -11
- package/esm2022/view/container.mjs +1 -1
- package/esm2022/view/context-change.mjs +13 -0
- 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 +106 -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 +2 -1
- package/view/base.d.ts +7 -2
- package/view/{before-context-change.d.ts → context-change.d.ts} +4 -0
- 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
- package/esm2022/view/before-context-change.mjs +0 -7
|
@@ -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
|
|
@@ -1734,6 +1733,12 @@ function hasBeforeContextChange(value) {
|
|
|
1734
1733
|
}
|
|
1735
1734
|
return false;
|
|
1736
1735
|
}
|
|
1736
|
+
function hasAfterContextChange(value) {
|
|
1737
|
+
if (value.afterContextChange) {
|
|
1738
|
+
return true;
|
|
1739
|
+
}
|
|
1740
|
+
return false;
|
|
1741
|
+
}
|
|
1737
1742
|
|
|
1738
1743
|
class SlateBlockCard {
|
|
1739
1744
|
get nativeElement() {
|
|
@@ -1807,14 +1812,20 @@ function updateContext(view, newContext, viewContext) {
|
|
|
1807
1812
|
view.detectChanges();
|
|
1808
1813
|
}
|
|
1809
1814
|
}
|
|
1810
|
-
function mount(views, blockCards, outletElement) {
|
|
1815
|
+
function mount(views, blockCards, outletParent, outletElement) {
|
|
1811
1816
|
if (views.length > 0) {
|
|
1812
|
-
const
|
|
1817
|
+
const fragment = document.createDocumentFragment();
|
|
1813
1818
|
views.forEach((view, index) => {
|
|
1814
1819
|
const blockCard = blockCards ? blockCards[index] : undefined;
|
|
1815
|
-
|
|
1820
|
+
fragment.append(...getRootNodes(view, blockCard));
|
|
1816
1821
|
});
|
|
1817
|
-
outletElement
|
|
1822
|
+
if (outletElement) {
|
|
1823
|
+
outletParent.insertBefore(fragment, outletElement);
|
|
1824
|
+
outletElement.remove();
|
|
1825
|
+
}
|
|
1826
|
+
else {
|
|
1827
|
+
outletParent.prepend(fragment);
|
|
1828
|
+
}
|
|
1818
1829
|
}
|
|
1819
1830
|
}
|
|
1820
1831
|
function getRootNodes(ref, blockCard) {
|
|
@@ -1843,7 +1854,7 @@ function getRootNodes(ref, blockCard) {
|
|
|
1843
1854
|
return result;
|
|
1844
1855
|
}
|
|
1845
1856
|
}
|
|
1846
|
-
function mountOnItemChange(index, item, views, blockCards,
|
|
1857
|
+
function mountOnItemChange(index, item, views, blockCards, outletParent, firstRootNode, viewContext) {
|
|
1847
1858
|
const view = views[index];
|
|
1848
1859
|
let rootNodes = getRootNodes(view);
|
|
1849
1860
|
if (blockCards) {
|
|
@@ -1854,7 +1865,14 @@ function mountOnItemChange(index, item, views, blockCards, outletElement, viewCo
|
|
|
1854
1865
|
}
|
|
1855
1866
|
}
|
|
1856
1867
|
if (index === 0) {
|
|
1857
|
-
|
|
1868
|
+
if (firstRootNode) {
|
|
1869
|
+
rootNodes.forEach(rootNode => {
|
|
1870
|
+
firstRootNode.insertAdjacentElement('beforebegin', rootNode);
|
|
1871
|
+
});
|
|
1872
|
+
}
|
|
1873
|
+
else {
|
|
1874
|
+
outletParent.prepend(...rootNodes);
|
|
1875
|
+
}
|
|
1858
1876
|
}
|
|
1859
1877
|
else {
|
|
1860
1878
|
const previousView = views[index - 1];
|
|
@@ -1869,9 +1887,10 @@ function mountOnItemChange(index, item, views, blockCards, outletElement, viewCo
|
|
|
1869
1887
|
}
|
|
1870
1888
|
|
|
1871
1889
|
class ListRender {
|
|
1872
|
-
constructor(viewContext, viewContainerRef, getOutletElement) {
|
|
1890
|
+
constructor(viewContext, viewContainerRef, getOutletParent, getOutletElement) {
|
|
1873
1891
|
this.viewContext = viewContext;
|
|
1874
1892
|
this.viewContainerRef = viewContainerRef;
|
|
1893
|
+
this.getOutletParent = getOutletParent;
|
|
1875
1894
|
this.getOutletElement = getOutletElement;
|
|
1876
1895
|
this.views = [];
|
|
1877
1896
|
this.blockCards = [];
|
|
@@ -1895,7 +1914,7 @@ class ListRender {
|
|
|
1895
1914
|
this.viewTypes.push(viewType);
|
|
1896
1915
|
this.blockCards.push(blockCard);
|
|
1897
1916
|
});
|
|
1898
|
-
mount(this.views, this.blockCards, this.getOutletElement());
|
|
1917
|
+
mount(this.views, this.blockCards, this.getOutletParent(), this.getOutletElement());
|
|
1899
1918
|
const newDiffers = this.viewContainerRef.injector.get(IterableDiffers);
|
|
1900
1919
|
this.differ = newDiffers.find(children).create(trackBy$1(this.viewContext));
|
|
1901
1920
|
this.differ.diff(children);
|
|
@@ -1905,10 +1924,11 @@ class ListRender {
|
|
|
1905
1924
|
this.initialize(children, parent, childrenContext);
|
|
1906
1925
|
return;
|
|
1907
1926
|
}
|
|
1908
|
-
const
|
|
1927
|
+
const outletParent = this.getOutletParent();
|
|
1909
1928
|
const diffResult = this.differ.diff(children);
|
|
1910
1929
|
const parentPath = AngularEditor.findPath(this.viewContext.editor, parent);
|
|
1911
1930
|
if (diffResult) {
|
|
1931
|
+
let firstRootNode = getRootNodes(this.views[0], this.blockCards[0])[0];
|
|
1912
1932
|
const newContexts = [];
|
|
1913
1933
|
const newViewTypes = [];
|
|
1914
1934
|
const newViews = [];
|
|
@@ -1927,7 +1947,7 @@ class ListRender {
|
|
|
1927
1947
|
newContexts.push(context);
|
|
1928
1948
|
newViews.push(view);
|
|
1929
1949
|
newBlockCards.push(blockCard);
|
|
1930
|
-
mountOnItemChange(record.currentIndex, record.item, newViews, newBlockCards,
|
|
1950
|
+
mountOnItemChange(record.currentIndex, record.item, newViews, newBlockCards, outletParent, firstRootNode, this.viewContext);
|
|
1931
1951
|
}
|
|
1932
1952
|
else {
|
|
1933
1953
|
const previousView = this.views[record.previousIndex];
|
|
@@ -1958,7 +1978,7 @@ class ListRender {
|
|
|
1958
1978
|
newBlockCards.push(blockCard);
|
|
1959
1979
|
}
|
|
1960
1980
|
});
|
|
1961
|
-
diffResult.forEachOperation(
|
|
1981
|
+
diffResult.forEachOperation(record => {
|
|
1962
1982
|
// removed
|
|
1963
1983
|
if (record.currentIndex === null) {
|
|
1964
1984
|
const view = this.views[record.previousIndex];
|
|
@@ -1968,7 +1988,7 @@ class ListRender {
|
|
|
1968
1988
|
}
|
|
1969
1989
|
// moved
|
|
1970
1990
|
if (record.previousIndex !== null && record.currentIndex !== null) {
|
|
1971
|
-
mountOnItemChange(record.currentIndex, record.item, newViews, newBlockCards,
|
|
1991
|
+
mountOnItemChange(record.currentIndex, record.item, newViews, newBlockCards, outletParent, firstRootNode, this.viewContext);
|
|
1972
1992
|
// Solve the block-card DOMElement loss when moving nodes
|
|
1973
1993
|
newBlockCards[record.currentIndex]?.instance.append();
|
|
1974
1994
|
}
|
|
@@ -2112,9 +2132,10 @@ function memoizedTextContext(prev, next) {
|
|
|
2112
2132
|
}
|
|
2113
2133
|
|
|
2114
2134
|
class LeavesRender {
|
|
2115
|
-
constructor(viewContext, viewContainerRef, getOutletElement) {
|
|
2135
|
+
constructor(viewContext, viewContainerRef, getOutletParent, getOutletElement) {
|
|
2116
2136
|
this.viewContext = viewContext;
|
|
2117
2137
|
this.viewContainerRef = viewContainerRef;
|
|
2138
|
+
this.getOutletParent = getOutletParent;
|
|
2118
2139
|
this.getOutletElement = getOutletElement;
|
|
2119
2140
|
this.views = [];
|
|
2120
2141
|
this.contexts = [];
|
|
@@ -2132,16 +2153,17 @@ class LeavesRender {
|
|
|
2132
2153
|
this.contexts.push(context);
|
|
2133
2154
|
this.viewTypes.push(viewType);
|
|
2134
2155
|
});
|
|
2135
|
-
mount(this.views, null, this.getOutletElement());
|
|
2156
|
+
mount(this.views, null, this.getOutletParent(), this.getOutletElement());
|
|
2136
2157
|
const newDiffers = this.viewContainerRef.injector.get(IterableDiffers);
|
|
2137
2158
|
this.differ = newDiffers.find(this.leaves).create(trackBy(this.viewContext));
|
|
2138
2159
|
this.differ.diff(this.leaves);
|
|
2139
2160
|
}
|
|
2140
2161
|
update(context) {
|
|
2141
2162
|
const { leaves, contexts } = this.getLeaves(context);
|
|
2142
|
-
const
|
|
2163
|
+
const outletParent = this.getOutletParent();
|
|
2143
2164
|
const diffResult = this.differ.diff(leaves);
|
|
2144
2165
|
if (diffResult) {
|
|
2166
|
+
let firstRootNode = getRootNodes(this.views[0])[0];
|
|
2145
2167
|
const newContexts = [];
|
|
2146
2168
|
const newViewTypes = [];
|
|
2147
2169
|
const newViews = [];
|
|
@@ -2154,7 +2176,7 @@ class LeavesRender {
|
|
|
2154
2176
|
view = createEmbeddedViewOrComponent(viewType, context, this.viewContext, this.viewContainerRef);
|
|
2155
2177
|
newContexts.push(context);
|
|
2156
2178
|
newViews.push(view);
|
|
2157
|
-
mountOnItemChange(record.currentIndex, record.item, newViews, null,
|
|
2179
|
+
mountOnItemChange(record.currentIndex, record.item, newViews, null, outletParent, firstRootNode, this.viewContext);
|
|
2158
2180
|
}
|
|
2159
2181
|
else {
|
|
2160
2182
|
const previousView = this.views[record.previousIndex];
|
|
@@ -2179,7 +2201,7 @@ class LeavesRender {
|
|
|
2179
2201
|
view.destroy();
|
|
2180
2202
|
});
|
|
2181
2203
|
diffResult.forEachMovedItem(record => {
|
|
2182
|
-
mountOnItemChange(record.currentIndex, record.item, newViews, null,
|
|
2204
|
+
mountOnItemChange(record.currentIndex, record.item, newViews, null, outletParent, firstRootNode, this.viewContext);
|
|
2183
2205
|
});
|
|
2184
2206
|
this.viewTypes = newViewTypes;
|
|
2185
2207
|
this.views = newViews;
|
|
@@ -2213,6 +2235,26 @@ function trackBy(viewContext) {
|
|
|
2213
2235
|
};
|
|
2214
2236
|
}
|
|
2215
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
|
+
|
|
2216
2258
|
/**
|
|
2217
2259
|
* base class for custom element component or text component
|
|
2218
2260
|
*/
|
|
@@ -2226,6 +2268,9 @@ class BaseComponent {
|
|
|
2226
2268
|
if (this.initialized) {
|
|
2227
2269
|
this.cdr.detectChanges();
|
|
2228
2270
|
}
|
|
2271
|
+
if (hasAfterContextChange(this)) {
|
|
2272
|
+
this.afterContextChange();
|
|
2273
|
+
}
|
|
2229
2274
|
}
|
|
2230
2275
|
get context() {
|
|
2231
2276
|
return this._context;
|
|
@@ -2324,9 +2369,15 @@ class BaseElementComponent extends BaseComponent {
|
|
|
2324
2369
|
constructor() {
|
|
2325
2370
|
super(...arguments);
|
|
2326
2371
|
this.viewContainerRef = inject(ViewContainerRef);
|
|
2327
|
-
this.
|
|
2372
|
+
this.getOutletParent = () => {
|
|
2328
2373
|
return this.elementRef.nativeElement;
|
|
2329
2374
|
};
|
|
2375
|
+
this.getOutletElement = () => {
|
|
2376
|
+
if (this.childrenOutletInstance) {
|
|
2377
|
+
return this.childrenOutletInstance.getNativeElement();
|
|
2378
|
+
}
|
|
2379
|
+
return null;
|
|
2380
|
+
};
|
|
2330
2381
|
}
|
|
2331
2382
|
get element() {
|
|
2332
2383
|
return this._context && this._context.element;
|
|
@@ -2354,7 +2405,7 @@ class BaseElementComponent extends BaseComponent {
|
|
|
2354
2405
|
this.nativeElement.setAttribute(key, this._context.attributes[key]);
|
|
2355
2406
|
}
|
|
2356
2407
|
this.initialized = true;
|
|
2357
|
-
this.listRender = new ListRender(this.viewContext, this.viewContainerRef, this.getOutletElement);
|
|
2408
|
+
this.listRender = new ListRender(this.viewContext, this.viewContainerRef, this.getOutletParent, this.getOutletElement);
|
|
2358
2409
|
this.listRender.initialize(this.children, this.element, this.childrenContext);
|
|
2359
2410
|
}
|
|
2360
2411
|
updateWeakMap() {
|
|
@@ -2388,11 +2439,14 @@ class BaseElementComponent extends BaseComponent {
|
|
|
2388
2439
|
};
|
|
2389
2440
|
}
|
|
2390
2441
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseElementComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2391
|
-
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 }); }
|
|
2392
2443
|
}
|
|
2393
2444
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseElementComponent, decorators: [{
|
|
2394
2445
|
type: Directive
|
|
2395
|
-
}]
|
|
2446
|
+
}], propDecorators: { childrenOutletInstance: [{
|
|
2447
|
+
type: ViewChild,
|
|
2448
|
+
args: [SlateChildrenOutlet, { static: true }]
|
|
2449
|
+
}] } });
|
|
2396
2450
|
/**
|
|
2397
2451
|
* base class for custom text component
|
|
2398
2452
|
*/
|
|
@@ -2400,16 +2454,22 @@ class BaseTextComponent extends BaseComponent {
|
|
|
2400
2454
|
constructor() {
|
|
2401
2455
|
super(...arguments);
|
|
2402
2456
|
this.viewContainerRef = inject(ViewContainerRef);
|
|
2403
|
-
this.
|
|
2457
|
+
this.getOutletParent = () => {
|
|
2404
2458
|
return this.elementRef.nativeElement;
|
|
2405
2459
|
};
|
|
2460
|
+
this.getOutletElement = () => {
|
|
2461
|
+
if (this.childrenOutletInstance) {
|
|
2462
|
+
return this.childrenOutletInstance.getNativeElement();
|
|
2463
|
+
}
|
|
2464
|
+
return null;
|
|
2465
|
+
};
|
|
2406
2466
|
}
|
|
2407
2467
|
get text() {
|
|
2408
2468
|
return this._context && this._context.text;
|
|
2409
2469
|
}
|
|
2410
2470
|
ngOnInit() {
|
|
2411
2471
|
this.initialized = true;
|
|
2412
|
-
this.leavesRender = new LeavesRender(this.viewContext, this.viewContainerRef, this.getOutletElement);
|
|
2472
|
+
this.leavesRender = new LeavesRender(this.viewContext, this.viewContainerRef, this.getOutletParent, this.getOutletElement);
|
|
2413
2473
|
this.leavesRender.initialize(this.context);
|
|
2414
2474
|
}
|
|
2415
2475
|
updateWeakMap() {
|
|
@@ -2429,11 +2489,14 @@ class BaseTextComponent extends BaseComponent {
|
|
|
2429
2489
|
this.leavesRender.update(this.context);
|
|
2430
2490
|
}
|
|
2431
2491
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseTextComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2432
|
-
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 }); }
|
|
2433
2493
|
}
|
|
2434
2494
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseTextComponent, decorators: [{
|
|
2435
2495
|
type: Directive
|
|
2436
|
-
}]
|
|
2496
|
+
}], propDecorators: { childrenOutletInstance: [{
|
|
2497
|
+
type: ViewChild,
|
|
2498
|
+
args: [SlateChildrenOutlet, { static: true }]
|
|
2499
|
+
}] } });
|
|
2437
2500
|
|
|
2438
2501
|
class SlateLeaves extends ViewContainer {
|
|
2439
2502
|
constructor() {
|
|
@@ -2871,7 +2934,7 @@ class SlateEditable {
|
|
|
2871
2934
|
this.dataSlateNode = 'value';
|
|
2872
2935
|
this.dataGramm = false;
|
|
2873
2936
|
this.viewContainerRef = inject(ViewContainerRef);
|
|
2874
|
-
this.
|
|
2937
|
+
this.getOutletParent = () => {
|
|
2875
2938
|
return this.elementRef.nativeElement;
|
|
2876
2939
|
};
|
|
2877
2940
|
}
|
|
@@ -2899,7 +2962,7 @@ class SlateEditable {
|
|
|
2899
2962
|
// add browser class
|
|
2900
2963
|
let browserClass = IS_FIREFOX ? 'firefox' : IS_SAFARI ? 'safari' : '';
|
|
2901
2964
|
browserClass && this.elementRef.nativeElement.classList.add(browserClass);
|
|
2902
|
-
this.listRender = new ListRender(this.viewContext, this.viewContainerRef, this.
|
|
2965
|
+
this.listRender = new ListRender(this.viewContext, this.viewContainerRef, this.getOutletParent, () => null);
|
|
2903
2966
|
}
|
|
2904
2967
|
ngOnChanges(simpleChanges) {
|
|
2905
2968
|
if (!this.initialized) {
|
|
@@ -3502,7 +3565,7 @@ class SlateEditable {
|
|
|
3502
3565
|
// that drops are allowed. Editable content is droppable by
|
|
3503
3566
|
// default, and calling `preventDefault` hides the cursor.
|
|
3504
3567
|
const node = AngularEditor.toSlateNode(this.editor, event.target);
|
|
3505
|
-
if (Editor.isVoid(this.editor, node)) {
|
|
3568
|
+
if (Element.isElement(node) && Editor.isVoid(this.editor, node)) {
|
|
3506
3569
|
event.preventDefault();
|
|
3507
3570
|
}
|
|
3508
3571
|
}
|
|
@@ -3511,7 +3574,7 @@ class SlateEditable {
|
|
|
3511
3574
|
if (!this.readonly && hasTarget(this.editor, event.target) && !this.isDOMEventHandled(event, this.dragStart)) {
|
|
3512
3575
|
const node = AngularEditor.toSlateNode(this.editor, event.target);
|
|
3513
3576
|
const path = AngularEditor.findPath(this.editor, node);
|
|
3514
|
-
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 }));
|
|
3515
3578
|
// If starting a drag on a void node, make sure it is selected
|
|
3516
3579
|
// so that it shows up in the selection's fragment.
|
|
3517
3580
|
if (voidMatch) {
|
|
@@ -4034,7 +4097,7 @@ const hasTarget = (editor, target) => {
|
|
|
4034
4097
|
*/
|
|
4035
4098
|
const isTargetInsideVoid = (editor, target) => {
|
|
4036
4099
|
const slateNode = hasTarget(editor, target) && AngularEditor.toSlateNode(editor, target);
|
|
4037
|
-
return Editor.isVoid(editor, slateNode);
|
|
4100
|
+
return Element.isElement(slateNode) && Editor.isVoid(editor, slateNode);
|
|
4038
4101
|
};
|
|
4039
4102
|
const hasStringTarget = (domSelection) => {
|
|
4040
4103
|
return ((domSelection.anchorNode.parentElement.hasAttribute('data-slate-string') ||
|
|
@@ -4090,12 +4153,8 @@ class SlateModule {
|
|
|
4090
4153
|
SlateBlockCard,
|
|
4091
4154
|
SlateLeaves,
|
|
4092
4155
|
SlateDefaultLeaf,
|
|
4093
|
-
SlateDefaultString
|
|
4094
|
-
SlateChildren,
|
|
4095
|
-
SlateElement,
|
|
4096
|
-
SlateLeaves,
|
|
4097
|
-
SlateString,
|
|
4098
|
-
SlateDefaultString] }); }
|
|
4156
|
+
SlateDefaultString,
|
|
4157
|
+
SlateChildrenOutlet], exports: [SlateEditable, SlateChildren, SlateChildrenOutlet, SlateElement, SlateLeaves, SlateString, SlateDefaultString] }); }
|
|
4099
4158
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateModule, providers: [
|
|
4100
4159
|
{
|
|
4101
4160
|
provide: SLATE_DEFAULT_ELEMENT_COMPONENT_TOKEN,
|
|
@@ -4119,16 +4178,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImpor
|
|
|
4119
4178
|
SlateBlockCard,
|
|
4120
4179
|
SlateLeaves,
|
|
4121
4180
|
SlateDefaultLeaf,
|
|
4122
|
-
SlateDefaultString
|
|
4123
|
-
|
|
4124
|
-
exports: [
|
|
4125
|
-
SlateEditable,
|
|
4126
|
-
SlateChildren,
|
|
4127
|
-
SlateElement,
|
|
4128
|
-
SlateLeaves,
|
|
4129
|
-
SlateString,
|
|
4130
|
-
SlateDefaultString
|
|
4181
|
+
SlateDefaultString,
|
|
4182
|
+
SlateChildrenOutlet
|
|
4131
4183
|
],
|
|
4184
|
+
exports: [SlateEditable, SlateChildren, SlateChildrenOutlet, SlateElement, SlateLeaves, SlateString, SlateDefaultString],
|
|
4132
4185
|
providers: [
|
|
4133
4186
|
{
|
|
4134
4187
|
provide: SLATE_DEFAULT_ELEMENT_COMPONENT_TOKEN,
|
|
@@ -4146,5 +4199,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImpor
|
|
|
4146
4199
|
* Generated bundle index. Do not edit.
|
|
4147
4200
|
*/
|
|
4148
4201
|
|
|
4149
|
-
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, 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 };
|
|
4150
4203
|
//# sourceMappingURL=slate-angular.mjs.map
|