slate-angular 16.1.0-next.8 → 17.0.0-next.0
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.component.d.ts +6 -1
- package/components/descendant/descendant.component.d.ts +35 -0
- package/components/editable/editable.component.d.ts +5 -15
- package/components/leaf/leaf.component.d.ts +16 -0
- package/components/leaves/leaves.component.d.ts +14 -1
- package/components/string/default-string.component.d.ts +1 -1
- package/components/string/string.component.d.ts +0 -8
- package/esm2022/components/block-card/block-card.component.mjs +2 -2
- package/esm2022/components/children/children.component.mjs +33 -5
- package/esm2022/components/descendant/descendant.component.mjs +186 -0
- package/esm2022/components/editable/editable.component.mjs +38 -115
- package/esm2022/components/element/default-element.component.mjs +3 -3
- package/esm2022/components/element/element.component.mjs +3 -3
- package/esm2022/components/leaf/leaf.component.mjs +38 -0
- package/esm2022/components/leaves/leaves.component.mjs +50 -5
- package/esm2022/components/string/default-string.component.mjs +1 -1
- package/esm2022/components/string/string.component.mjs +6 -16
- package/esm2022/components/text/default-text.component.mjs +3 -3
- package/esm2022/components/text/void-text.component.mjs +3 -3
- package/esm2022/module.mjs +22 -7
- package/esm2022/plugins/angular-editor.mjs +6 -7
- package/esm2022/plugins/with-angular.mjs +4 -4
- package/esm2022/public-api.mjs +2 -3
- package/esm2022/utils/index.mjs +1 -2
- package/esm2022/view/base.mjs +17 -51
- package/esm2022/view/before-context-change.mjs +7 -0
- package/esm2022/view/container.mjs +82 -2
- package/esm2022/view/context.mjs +1 -1
- package/fesm2022/slate-angular.mjs +747 -1004
- package/fesm2022/slate-angular.mjs.map +1 -1
- package/module.d.ts +8 -7
- package/package.json +5 -5
- package/plugins/angular-editor.d.ts +1 -1
- package/public-api.d.ts +1 -2
- package/utils/index.d.ts +0 -1
- package/view/base.d.ts +4 -15
- package/view/{context-change.d.ts → before-context-change.d.ts} +0 -4
- package/view/container.d.ts +7 -3
- package/view/context.d.ts +1 -6
- package/components/children/children-outlet.component.d.ts +0 -9
- package/components/leaf/token.d.ts +0 -4
- package/components/text/token.d.ts +0 -5
- package/esm2022/components/children/children-outlet.component.mjs +0 -22
- package/esm2022/components/leaf/token.mjs +0 -3
- package/esm2022/components/text/token.mjs +0 -4
- package/esm2022/utils/throttle.mjs +0 -18
- package/esm2022/view/context-change.mjs +0 -13
- package/esm2022/view/render/leaves-render.mjs +0 -107
- package/esm2022/view/render/list-render.mjs +0 -253
- package/esm2022/view/render/utils.mjs +0 -117
- package/utils/throttle.d.ts +0 -2
- package/view/render/leaves-render.d.ts +0 -21
- package/view/render/list-render.d.ts +0 -32
- package/view/render/utils.d.ts +0 -11
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Editor, Range,
|
|
1
|
+
import { Editor, Range, Transforms, Path, Element, Text as Text$1, Node } from 'slate';
|
|
2
2
|
import { isKeyHotkey } from 'is-hotkey';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { TemplateRef, Component, ChangeDetectionStrategy, ViewChild, Directive, Input,
|
|
4
|
+
import { TemplateRef, Component, ChangeDetectionStrategy, ViewChild, Directive, Input, HostBinding, ViewChildren, InjectionToken, Inject, forwardRef, ElementRef, NgModule } from '@angular/core';
|
|
5
5
|
import { direction } from 'direction';
|
|
6
6
|
import scrollIntoView from 'scroll-into-view-if-needed';
|
|
7
7
|
import { Subject } from 'rxjs';
|
|
@@ -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 =>
|
|
418
|
+
match: 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 (
|
|
640
|
+
if (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, {
|
|
@@ -751,10 +751,9 @@ const AngularEditor = {
|
|
|
751
751
|
else if (voidNode) {
|
|
752
752
|
// For void nodes, the element with the offset key will be a cousin, not an
|
|
753
753
|
// ancestor, so find it by going down from the nearest void parent.
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
textNode = spacer;
|
|
754
|
+
leafNode = voidNode.querySelector('[data-slate-leaf]');
|
|
755
|
+
parentNode = voidNode.querySelector('[data-slate-length="0"]');
|
|
756
|
+
textNode = leafNode.closest('[data-slate-node="text"]');
|
|
758
757
|
domNode = leafNode;
|
|
759
758
|
offset = domNode.textContent.length;
|
|
760
759
|
}
|
|
@@ -1009,24 +1008,6 @@ function normalize(document) {
|
|
|
1009
1008
|
return document.filter(value => Element.isElement(value) && isValid(value));
|
|
1010
1009
|
}
|
|
1011
1010
|
|
|
1012
|
-
const createThrottleRAF = () => {
|
|
1013
|
-
let timerId = null;
|
|
1014
|
-
const throttleRAF = (fn) => {
|
|
1015
|
-
const scheduleFunc = () => {
|
|
1016
|
-
timerId = requestAnimationFrame(() => {
|
|
1017
|
-
timerId = null;
|
|
1018
|
-
fn();
|
|
1019
|
-
});
|
|
1020
|
-
};
|
|
1021
|
-
if (timerId !== null) {
|
|
1022
|
-
cancelAnimationFrame(timerId);
|
|
1023
|
-
timerId = null;
|
|
1024
|
-
}
|
|
1025
|
-
scheduleFunc();
|
|
1026
|
-
};
|
|
1027
|
-
return throttleRAF;
|
|
1028
|
-
};
|
|
1029
|
-
|
|
1030
1011
|
/**
|
|
1031
1012
|
* Utilities for single-line deletion
|
|
1032
1013
|
*/
|
|
@@ -1080,7 +1061,7 @@ const withAngular = (editor, clipboardFormatKey = 'x-slate-fragment') => {
|
|
|
1080
1061
|
}
|
|
1081
1062
|
if (editor.selection && Range.isCollapsed(editor.selection)) {
|
|
1082
1063
|
const parentBlockEntry = Editor.above(editor, {
|
|
1083
|
-
match: n =>
|
|
1064
|
+
match: n => Editor.isBlock(editor, n),
|
|
1084
1065
|
at: editor.selection
|
|
1085
1066
|
});
|
|
1086
1067
|
if (parentBlockEntry) {
|
|
@@ -1230,7 +1211,7 @@ const withAngular = (editor, clipboardFormatKey = 'x-slate-fragment') => {
|
|
|
1230
1211
|
}
|
|
1231
1212
|
else {
|
|
1232
1213
|
const node = Node.parent(editor, selection.anchor.path);
|
|
1233
|
-
if (
|
|
1214
|
+
if (Editor.isVoid(editor, node)) {
|
|
1234
1215
|
Transforms.delete(editor);
|
|
1235
1216
|
}
|
|
1236
1217
|
}
|
|
@@ -1682,64 +1663,6 @@ function restoreDom(editor, execute) {
|
|
|
1682
1663
|
}, 0);
|
|
1683
1664
|
}
|
|
1684
1665
|
|
|
1685
|
-
/**
|
|
1686
|
-
* @deprecated
|
|
1687
|
-
* the special container for angular template
|
|
1688
|
-
* Add the rootNodes of each child component to the parentElement
|
|
1689
|
-
* Remove useless DOM elements, eg: comment...
|
|
1690
|
-
*/
|
|
1691
|
-
class ViewContainer {
|
|
1692
|
-
constructor(elementRef, differs) {
|
|
1693
|
-
this.elementRef = elementRef;
|
|
1694
|
-
this.differs = differs;
|
|
1695
|
-
}
|
|
1696
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ViewContainer, deps: [{ token: i0.ElementRef }, { token: i0.IterableDiffers }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1697
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: ViewContainer, inputs: { viewContext: "viewContext" }, ngImport: i0 }); }
|
|
1698
|
-
}
|
|
1699
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ViewContainer, decorators: [{
|
|
1700
|
-
type: Directive
|
|
1701
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.IterableDiffers }]; }, propDecorators: { viewContext: [{
|
|
1702
|
-
type: Input
|
|
1703
|
-
}] } });
|
|
1704
|
-
|
|
1705
|
-
class SlateChildren extends ViewContainer {
|
|
1706
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateChildren, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1707
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: SlateChildren, isStandalone: true, selector: "slate-children", inputs: { children: "children", context: "context", viewContext: "viewContext" }, usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1708
|
-
}
|
|
1709
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateChildren, decorators: [{
|
|
1710
|
-
type: Component,
|
|
1711
|
-
args: [{
|
|
1712
|
-
selector: 'slate-children',
|
|
1713
|
-
template: ``,
|
|
1714
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1715
|
-
standalone: true
|
|
1716
|
-
}]
|
|
1717
|
-
}], propDecorators: { children: [{
|
|
1718
|
-
type: Input
|
|
1719
|
-
}], context: [{
|
|
1720
|
-
type: Input
|
|
1721
|
-
}], viewContext: [{
|
|
1722
|
-
type: Input
|
|
1723
|
-
}] } });
|
|
1724
|
-
|
|
1725
|
-
const SLATE_DEFAULT_ELEMENT_COMPONENT_TOKEN = new InjectionToken('slate-default-element-token');
|
|
1726
|
-
|
|
1727
|
-
const SLATE_DEFAULT_TEXT_COMPONENT_TOKEN = new InjectionToken('slate-default-text-token');
|
|
1728
|
-
const SLATE_DEFAULT_VOID_TEXT_COMPONENT_TOKEN = new InjectionToken('slate-default-void-text-token');
|
|
1729
|
-
|
|
1730
|
-
function hasBeforeContextChange(value) {
|
|
1731
|
-
if (value.beforeContextChange) {
|
|
1732
|
-
return true;
|
|
1733
|
-
}
|
|
1734
|
-
return false;
|
|
1735
|
-
}
|
|
1736
|
-
function hasAfterContextChange(value) {
|
|
1737
|
-
if (value.afterContextChange) {
|
|
1738
|
-
return true;
|
|
1739
|
-
}
|
|
1740
|
-
return false;
|
|
1741
|
-
}
|
|
1742
|
-
|
|
1743
1666
|
class SlateBlockCard {
|
|
1744
1667
|
get nativeElement() {
|
|
1745
1668
|
return this.elementRef.nativeElement;
|
|
@@ -1751,6 +1674,7 @@ class SlateBlockCard {
|
|
|
1751
1674
|
this.elementRef = elementRef;
|
|
1752
1675
|
}
|
|
1753
1676
|
ngOnInit() {
|
|
1677
|
+
this.append();
|
|
1754
1678
|
this.nativeElement.classList.add(`slate-block-card`);
|
|
1755
1679
|
}
|
|
1756
1680
|
append() {
|
|
@@ -1758,7 +1682,6 @@ class SlateBlockCard {
|
|
|
1758
1682
|
}
|
|
1759
1683
|
initializeCenter(rootNodes) {
|
|
1760
1684
|
this.centerRootNodes = rootNodes;
|
|
1761
|
-
this.append();
|
|
1762
1685
|
}
|
|
1763
1686
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateBlockCard, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1764
1687
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: SlateBlockCard, isStandalone: true, selector: "slate-block-card, [slateBlockCard]", viewQueries: [{ propertyName: "centerContianer", first: true, predicate: ["centerContianer"], descendants: true, static: true }], ngImport: i0, template: "<span card-target=\"card-left\" class=\"card-left\">{{ '\\uFEFF' }}</span>\n<div card-target=\"card-center\" #centerContianer></div>\n<span card-target=\"card-right\" class=\"card-right\">{{ '\\uFEFF' }}</span>\n" }); }
|
|
@@ -1771,523 +1694,144 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImpor
|
|
|
1771
1694
|
args: ['centerContianer', { static: true }]
|
|
1772
1695
|
}] } });
|
|
1773
1696
|
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
return embeddedViewRef;
|
|
1783
|
-
}
|
|
1784
|
-
if (isComponentType(viewType)) {
|
|
1785
|
-
const componentRef = viewContainerRef.createComponent(viewType, {
|
|
1786
|
-
injector: viewContainerRef.injector
|
|
1787
|
-
});
|
|
1788
|
-
componentRef.instance.viewContext = viewContext;
|
|
1789
|
-
componentRef.instance.context = context;
|
|
1790
|
-
componentRef.changeDetectorRef.detectChanges();
|
|
1791
|
-
return componentRef;
|
|
1792
|
-
}
|
|
1793
|
-
}
|
|
1794
|
-
function renderView(view) {
|
|
1795
|
-
if (view instanceof ComponentRef) {
|
|
1796
|
-
view.changeDetectorRef.detectChanges();
|
|
1797
|
-
}
|
|
1798
|
-
else {
|
|
1799
|
-
view.detectChanges();
|
|
1800
|
-
}
|
|
1801
|
-
}
|
|
1802
|
-
function updateContext(view, newContext, viewContext) {
|
|
1803
|
-
if (view instanceof ComponentRef) {
|
|
1804
|
-
view.instance.context = newContext;
|
|
1805
|
-
}
|
|
1806
|
-
else {
|
|
1807
|
-
const embeddedViewContext = {
|
|
1808
|
-
context: newContext,
|
|
1809
|
-
viewContext
|
|
1810
|
-
};
|
|
1811
|
-
view.context = embeddedViewContext;
|
|
1812
|
-
view.detectChanges();
|
|
1813
|
-
}
|
|
1814
|
-
}
|
|
1815
|
-
function mount(views, blockCards, outletParent, outletElement) {
|
|
1816
|
-
if (views.length > 0) {
|
|
1817
|
-
const fragment = document.createDocumentFragment();
|
|
1818
|
-
views.forEach((view, index) => {
|
|
1819
|
-
const blockCard = blockCards ? blockCards[index] : undefined;
|
|
1820
|
-
fragment.append(...getRootNodes(view, blockCard));
|
|
1821
|
-
});
|
|
1822
|
-
if (outletElement) {
|
|
1823
|
-
outletParent.insertBefore(fragment, outletElement);
|
|
1824
|
-
outletElement.remove();
|
|
1825
|
-
}
|
|
1826
|
-
else {
|
|
1827
|
-
outletParent.prepend(fragment);
|
|
1828
|
-
}
|
|
1829
|
-
}
|
|
1830
|
-
}
|
|
1831
|
-
function getRootNodes(ref, blockCard) {
|
|
1832
|
-
if (blockCard) {
|
|
1833
|
-
return [blockCard.instance.nativeElement];
|
|
1834
|
-
}
|
|
1835
|
-
if (ref instanceof ComponentRef) {
|
|
1836
|
-
ref.hostView.rootNodes.forEach(ele => {
|
|
1837
|
-
if (!(ele instanceof HTMLElement)) {
|
|
1838
|
-
ele.remove();
|
|
1839
|
-
}
|
|
1840
|
-
});
|
|
1841
|
-
return [ref.instance.nativeElement];
|
|
1842
|
-
}
|
|
1843
|
-
else {
|
|
1844
|
-
const result = [];
|
|
1845
|
-
ref.rootNodes.forEach(rootNode => {
|
|
1846
|
-
const isHTMLElement = rootNode instanceof HTMLElement;
|
|
1847
|
-
if (isHTMLElement && result.every(item => !item.contains(rootNode))) {
|
|
1848
|
-
result.push(rootNode);
|
|
1849
|
-
}
|
|
1850
|
-
if (!isHTMLElement) {
|
|
1851
|
-
rootNode.remove();
|
|
1852
|
-
}
|
|
1853
|
-
});
|
|
1854
|
-
return result;
|
|
1697
|
+
/**
|
|
1698
|
+
* Dynamically create/update components or templates
|
|
1699
|
+
* Provide rootNodes for the view container
|
|
1700
|
+
* If the dynamically created component uses onpush mode, then it must call markForCheck when setting the context
|
|
1701
|
+
*/
|
|
1702
|
+
class ViewContainerItem {
|
|
1703
|
+
get rootNodes() {
|
|
1704
|
+
return this.getRootNodes();
|
|
1855
1705
|
}
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
let rootNodes = getRootNodes(view);
|
|
1860
|
-
if (blockCards) {
|
|
1861
|
-
const isBlockCard = viewContext.editor.isBlockCard(item);
|
|
1862
|
-
if (isBlockCard) {
|
|
1863
|
-
const blockCard = blockCards[index];
|
|
1864
|
-
rootNodes = [blockCard.instance.nativeElement];
|
|
1865
|
-
}
|
|
1866
|
-
}
|
|
1867
|
-
if (index === 0) {
|
|
1868
|
-
if (firstRootNode) {
|
|
1869
|
-
rootNodes.forEach(rootNode => {
|
|
1870
|
-
firstRootNode.insertAdjacentElement('beforebegin', rootNode);
|
|
1871
|
-
});
|
|
1706
|
+
getRootNodes() {
|
|
1707
|
+
if (this.embeddedViewRef) {
|
|
1708
|
+
return this.embeddedViewRef.rootNodes.filter(rootNode => isDOMElement(rootNode));
|
|
1872
1709
|
}
|
|
1873
|
-
|
|
1874
|
-
|
|
1710
|
+
if (this.componentRef) {
|
|
1711
|
+
return [this.componentRef.instance.nativeElement];
|
|
1875
1712
|
}
|
|
1713
|
+
return [];
|
|
1876
1714
|
}
|
|
1877
|
-
|
|
1878
|
-
const previousView = views[index - 1];
|
|
1879
|
-
const blockCard = blockCards ? blockCards[index - 1] : null;
|
|
1880
|
-
const previousRootNodes = getRootNodes(previousView, blockCard);
|
|
1881
|
-
let previousRootNode = previousRootNodes[previousRootNodes.length - 1];
|
|
1882
|
-
rootNodes.forEach(rootNode => {
|
|
1883
|
-
previousRootNode.insertAdjacentElement('afterend', rootNode);
|
|
1884
|
-
previousRootNode = rootNode;
|
|
1885
|
-
});
|
|
1886
|
-
}
|
|
1887
|
-
}
|
|
1888
|
-
|
|
1889
|
-
class ListRender {
|
|
1890
|
-
constructor(viewContext, viewContainerRef, getOutletParent, getOutletElement) {
|
|
1891
|
-
this.viewContext = viewContext;
|
|
1715
|
+
constructor(viewContainerRef) {
|
|
1892
1716
|
this.viewContainerRef = viewContainerRef;
|
|
1893
|
-
this.getOutletParent = getOutletParent;
|
|
1894
|
-
this.getOutletElement = getOutletElement;
|
|
1895
|
-
this.views = [];
|
|
1896
|
-
this.blockCards = [];
|
|
1897
|
-
this.contexts = [];
|
|
1898
|
-
this.viewTypes = [];
|
|
1899
1717
|
this.initialized = false;
|
|
1900
1718
|
}
|
|
1901
|
-
|
|
1902
|
-
this.
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
children.forEach((descendant, index) => {
|
|
1906
|
-
NODE_TO_INDEX.set(descendant, index);
|
|
1907
|
-
NODE_TO_PARENT.set(descendant, parent);
|
|
1908
|
-
const context = getContext$1(index, descendant, parentPath, childrenContext, this.viewContext);
|
|
1909
|
-
const viewType = getViewType$1(descendant, parent, this.viewContext);
|
|
1910
|
-
const view = createEmbeddedViewOrComponent(viewType, context, this.viewContext, this.viewContainerRef);
|
|
1911
|
-
const blockCard = createBlockCard(descendant, view, this.viewContainerRef, this.viewContext);
|
|
1912
|
-
this.views.push(view);
|
|
1913
|
-
this.contexts.push(context);
|
|
1914
|
-
this.viewTypes.push(viewType);
|
|
1915
|
-
this.blockCards.push(blockCard);
|
|
1916
|
-
});
|
|
1917
|
-
mount(this.views, this.blockCards, this.getOutletParent(), this.getOutletElement());
|
|
1918
|
-
const newDiffers = this.viewContainerRef.injector.get(IterableDiffers);
|
|
1919
|
-
this.differ = newDiffers.find(children).create(trackBy$1(this.viewContext));
|
|
1920
|
-
this.differ.diff(children);
|
|
1921
|
-
}
|
|
1922
|
-
update(children, parent, childrenContext) {
|
|
1923
|
-
if (!this.initialized) {
|
|
1924
|
-
this.initialize(children, parent, childrenContext);
|
|
1925
|
-
return;
|
|
1926
|
-
}
|
|
1927
|
-
const outletParent = this.getOutletParent();
|
|
1928
|
-
const diffResult = this.differ.diff(children);
|
|
1929
|
-
const parentPath = AngularEditor.findPath(this.viewContext.editor, parent);
|
|
1930
|
-
if (diffResult) {
|
|
1931
|
-
let firstRootNode = getRootNodes(this.views[0], this.blockCards[0])[0];
|
|
1932
|
-
const newContexts = [];
|
|
1933
|
-
const newViewTypes = [];
|
|
1934
|
-
const newViews = [];
|
|
1935
|
-
const newBlockCards = [];
|
|
1936
|
-
diffResult.forEachItem(record => {
|
|
1937
|
-
NODE_TO_INDEX.set(record.item, record.currentIndex);
|
|
1938
|
-
NODE_TO_PARENT.set(record.item, parent);
|
|
1939
|
-
let context = getContext$1(record.currentIndex, record.item, parentPath, childrenContext, this.viewContext);
|
|
1940
|
-
const viewType = getViewType$1(record.item, parent, this.viewContext);
|
|
1941
|
-
newViewTypes.push(viewType);
|
|
1942
|
-
let view;
|
|
1943
|
-
let blockCard;
|
|
1944
|
-
if (record.previousIndex === null) {
|
|
1945
|
-
view = createEmbeddedViewOrComponent(viewType, context, this.viewContext, this.viewContainerRef);
|
|
1946
|
-
blockCard = createBlockCard(record.item, view, this.viewContainerRef, this.viewContext);
|
|
1947
|
-
newContexts.push(context);
|
|
1948
|
-
newViews.push(view);
|
|
1949
|
-
newBlockCards.push(blockCard);
|
|
1950
|
-
mountOnItemChange(record.currentIndex, record.item, newViews, newBlockCards, outletParent, firstRootNode, this.viewContext);
|
|
1951
|
-
}
|
|
1952
|
-
else {
|
|
1953
|
-
const previousView = this.views[record.previousIndex];
|
|
1954
|
-
const previousViewType = this.viewTypes[record.previousIndex];
|
|
1955
|
-
const previousContext = this.contexts[record.previousIndex];
|
|
1956
|
-
const previousBlockCard = this.blockCards[record.previousIndex];
|
|
1957
|
-
if (previousViewType !== viewType) {
|
|
1958
|
-
view = createEmbeddedViewOrComponent(viewType, context, this.viewContext, this.viewContainerRef);
|
|
1959
|
-
blockCard = createBlockCard(record.item, view, this.viewContainerRef, this.viewContext);
|
|
1960
|
-
const firstRootNode = getRootNodes(previousView, previousBlockCard)[0];
|
|
1961
|
-
const newRootNodes = getRootNodes(view, blockCard);
|
|
1962
|
-
firstRootNode.replaceWith(...newRootNodes);
|
|
1963
|
-
previousView.destroy();
|
|
1964
|
-
previousBlockCard?.destroy();
|
|
1965
|
-
}
|
|
1966
|
-
else {
|
|
1967
|
-
view = previousView;
|
|
1968
|
-
blockCard = previousBlockCard;
|
|
1969
|
-
if (memoizedContext(this.viewContext, record.item, previousContext, context)) {
|
|
1970
|
-
context = previousContext;
|
|
1971
|
-
}
|
|
1972
|
-
else {
|
|
1973
|
-
updateContext(previousView, context, this.viewContext);
|
|
1974
|
-
}
|
|
1975
|
-
}
|
|
1976
|
-
newContexts.push(context);
|
|
1977
|
-
newViews.push(view);
|
|
1978
|
-
newBlockCards.push(blockCard);
|
|
1979
|
-
}
|
|
1980
|
-
});
|
|
1981
|
-
diffResult.forEachOperation(record => {
|
|
1982
|
-
// removed
|
|
1983
|
-
if (record.currentIndex === null) {
|
|
1984
|
-
const view = this.views[record.previousIndex];
|
|
1985
|
-
const blockCard = this.blockCards[record.previousIndex];
|
|
1986
|
-
view.destroy();
|
|
1987
|
-
blockCard?.destroy();
|
|
1988
|
-
}
|
|
1989
|
-
// moved
|
|
1990
|
-
if (record.previousIndex !== null && record.currentIndex !== null) {
|
|
1991
|
-
mountOnItemChange(record.currentIndex, record.item, newViews, newBlockCards, outletParent, firstRootNode, this.viewContext);
|
|
1992
|
-
// Solve the block-card DOMElement loss when moving nodes
|
|
1993
|
-
newBlockCards[record.currentIndex]?.instance.append();
|
|
1994
|
-
}
|
|
1995
|
-
});
|
|
1996
|
-
this.viewTypes = newViewTypes;
|
|
1997
|
-
this.views = newViews;
|
|
1998
|
-
this.contexts = newContexts;
|
|
1999
|
-
this.children = children;
|
|
2000
|
-
this.blockCards = newBlockCards;
|
|
1719
|
+
destroyView() {
|
|
1720
|
+
if (this.embeddedViewRef) {
|
|
1721
|
+
this.embeddedViewRef.destroy();
|
|
1722
|
+
this.embeddedViewRef = null;
|
|
2001
1723
|
}
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
this.
|
|
2005
|
-
let context = getContext$1(index, child, parentPath, childrenContext, this.viewContext);
|
|
2006
|
-
const previousContext = this.contexts[index];
|
|
2007
|
-
if (memoizedContext(this.viewContext, child, previousContext, context)) {
|
|
2008
|
-
context = previousContext;
|
|
2009
|
-
}
|
|
2010
|
-
else {
|
|
2011
|
-
updateContext(this.views[index], context, this.viewContext);
|
|
2012
|
-
}
|
|
2013
|
-
newContexts.push(context);
|
|
2014
|
-
});
|
|
2015
|
-
this.contexts = newContexts;
|
|
1724
|
+
if (this.componentRef) {
|
|
1725
|
+
this.componentRef.destroy();
|
|
1726
|
+
this.componentRef = null;
|
|
2016
1727
|
}
|
|
2017
1728
|
}
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
const
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
'data-slate-node': 'element',
|
|
2030
|
-
'data-slate-key': key.id
|
|
2031
|
-
},
|
|
2032
|
-
decorate: childrenContext.decorate,
|
|
2033
|
-
readonly: childrenContext.readonly
|
|
2034
|
-
};
|
|
2035
|
-
if (isInline) {
|
|
2036
|
-
elementContext.attributes['data-slate-inline'] = true;
|
|
1729
|
+
createView() {
|
|
1730
|
+
this.initialized = true;
|
|
1731
|
+
this.viewType = this.getViewType();
|
|
1732
|
+
const context = this.getContext();
|
|
1733
|
+
if (isTemplateRef(this.viewType)) {
|
|
1734
|
+
this.embeddedViewContext = {
|
|
1735
|
+
context,
|
|
1736
|
+
viewContext: this.viewContext
|
|
1737
|
+
};
|
|
1738
|
+
const embeddedViewRef = this.viewContainerRef.createEmbeddedView(this.viewType, this.embeddedViewContext);
|
|
1739
|
+
this.embeddedViewRef = embeddedViewRef;
|
|
2037
1740
|
}
|
|
2038
|
-
if (
|
|
2039
|
-
|
|
2040
|
-
|
|
1741
|
+
if (isComponentType(this.viewType)) {
|
|
1742
|
+
const componentRef = this.viewContainerRef.createComponent(this.viewType);
|
|
1743
|
+
componentRef.instance.viewContext = this.viewContext;
|
|
1744
|
+
componentRef.instance.context = context;
|
|
1745
|
+
this.componentRef = componentRef;
|
|
2041
1746
|
}
|
|
2042
|
-
return elementContext;
|
|
2043
1747
|
}
|
|
2044
|
-
|
|
2045
|
-
const
|
|
2046
|
-
const
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
text: item
|
|
2052
|
-
};
|
|
2053
|
-
return textContext;
|
|
2054
|
-
}
|
|
2055
|
-
}
|
|
2056
|
-
function getCommonContext(index, item, parentPath, viewContext, childrenContext) {
|
|
2057
|
-
const p = parentPath.concat(index);
|
|
2058
|
-
try {
|
|
2059
|
-
const ds = childrenContext.decorate([item, p]);
|
|
2060
|
-
// [list-render] performance optimization: reduce the number of calls to the `Editor.range(viewContext.editor, p)` method
|
|
2061
|
-
if (childrenContext.selection || childrenContext.decorations.length > 0) {
|
|
2062
|
-
const range = Editor.range(viewContext.editor, p);
|
|
2063
|
-
const sel = childrenContext.selection && Range.intersection(range, childrenContext.selection);
|
|
2064
|
-
for (const dec of childrenContext.decorations) {
|
|
2065
|
-
const d = Range.intersection(dec, range);
|
|
2066
|
-
if (d) {
|
|
2067
|
-
ds.push(d);
|
|
1748
|
+
updateView() {
|
|
1749
|
+
const viewType = this.getViewType();
|
|
1750
|
+
const context = this.getContext();
|
|
1751
|
+
if (this.viewType === viewType) {
|
|
1752
|
+
if (this.componentRef) {
|
|
1753
|
+
if (this.memoizedContext(this.componentRef.instance.context, context)) {
|
|
1754
|
+
return;
|
|
2068
1755
|
}
|
|
1756
|
+
this.componentRef.instance.context = context;
|
|
1757
|
+
}
|
|
1758
|
+
if (this.embeddedViewRef) {
|
|
1759
|
+
if (this.memoizedContext(this.embeddedViewContext.context, context)) {
|
|
1760
|
+
return;
|
|
1761
|
+
}
|
|
1762
|
+
this.embeddedViewContext.context = context;
|
|
2069
1763
|
}
|
|
2070
|
-
return { selection: sel, decorations: ds };
|
|
2071
1764
|
}
|
|
2072
1765
|
else {
|
|
2073
|
-
|
|
1766
|
+
this.viewType = viewType;
|
|
1767
|
+
const firstRootNode = this.rootNodes[0];
|
|
1768
|
+
if (isTemplateRef(this.viewType)) {
|
|
1769
|
+
this.embeddedViewContext = {
|
|
1770
|
+
context,
|
|
1771
|
+
viewContext: this.viewContext
|
|
1772
|
+
};
|
|
1773
|
+
const embeddedViewRef = this.viewContainerRef.createEmbeddedView(this.viewType, this.embeddedViewContext);
|
|
1774
|
+
firstRootNode.replaceWith(...embeddedViewRef.rootNodes.filter(rootNode => isDOMElement(rootNode)));
|
|
1775
|
+
this.destroyView();
|
|
1776
|
+
this.embeddedViewRef = embeddedViewRef;
|
|
1777
|
+
}
|
|
1778
|
+
if (isComponentType(this.viewType)) {
|
|
1779
|
+
const componentRef = this.viewContainerRef.createComponent(this.viewType);
|
|
1780
|
+
componentRef.instance.viewContext = this.viewContext;
|
|
1781
|
+
componentRef.instance.context = context;
|
|
1782
|
+
firstRootNode.replaceWith(componentRef.instance.nativeElement);
|
|
1783
|
+
this.destroyView();
|
|
1784
|
+
this.componentRef = componentRef;
|
|
1785
|
+
}
|
|
2074
1786
|
}
|
|
2075
1787
|
}
|
|
2076
|
-
|
|
2077
|
-
this.
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
});
|
|
2081
|
-
return { selection: null, decorations: [] };
|
|
1788
|
+
appendBlockCardElement() {
|
|
1789
|
+
if (this.blockCardComponentRef) {
|
|
1790
|
+
this.blockCardComponentRef.instance.append();
|
|
1791
|
+
}
|
|
2082
1792
|
}
|
|
1793
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ViewContainerItem, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1794
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: ViewContainerItem, inputs: { viewContext: "viewContext" }, ngImport: i0 }); }
|
|
2083
1795
|
}
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
1796
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ViewContainerItem, decorators: [{
|
|
1797
|
+
type: Directive
|
|
1798
|
+
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; }, propDecorators: { viewContext: [{
|
|
1799
|
+
type: Input
|
|
1800
|
+
}] } });
|
|
1801
|
+
|
|
1802
|
+
function hasBeforeContextChange(value) {
|
|
1803
|
+
if (value.beforeContextChange) {
|
|
1804
|
+
return true;
|
|
2091
1805
|
}
|
|
1806
|
+
return false;
|
|
2092
1807
|
}
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
1808
|
+
|
|
1809
|
+
/**
|
|
1810
|
+
* base class for custom element component or text component
|
|
1811
|
+
*/
|
|
1812
|
+
class BaseComponent {
|
|
1813
|
+
set context(value) {
|
|
1814
|
+
if (hasBeforeContextChange(this)) {
|
|
1815
|
+
this.beforeContextChange(value);
|
|
1816
|
+
}
|
|
1817
|
+
this._context = value;
|
|
1818
|
+
this.onContextChange();
|
|
2102
1819
|
}
|
|
2103
|
-
|
|
2104
|
-
return
|
|
1820
|
+
get context() {
|
|
1821
|
+
return this._context;
|
|
2105
1822
|
}
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
return (index, node) => {
|
|
2109
|
-
return viewContext.trackBy(node) || AngularEditor.findKey(viewContext.editor, node);
|
|
2110
|
-
};
|
|
2111
|
-
}
|
|
2112
|
-
function memoizedContext(viewContext, descendant, prev, next) {
|
|
2113
|
-
if (Element.isElement(descendant)) {
|
|
2114
|
-
return memoizedElementContext(viewContext, prev, next);
|
|
1823
|
+
get editor() {
|
|
1824
|
+
return this.viewContext && this.viewContext.editor;
|
|
2115
1825
|
}
|
|
2116
|
-
|
|
2117
|
-
return
|
|
1826
|
+
get nativeElement() {
|
|
1827
|
+
return this.elementRef.nativeElement;
|
|
2118
1828
|
}
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
(prev.selection === next.selection || (!!prev.selection && !!next.selection && Range.equals(prev.selection, next.selection))));
|
|
2126
|
-
}
|
|
2127
|
-
function memoizedTextContext(prev, next) {
|
|
2128
|
-
return (next.parent === prev.parent &&
|
|
2129
|
-
next.isLast === prev.isLast &&
|
|
2130
|
-
next.text === prev.text &&
|
|
2131
|
-
isDecoratorRangeListEqual(next.decorations, prev.decorations));
|
|
2132
|
-
}
|
|
2133
|
-
|
|
2134
|
-
class LeavesRender {
|
|
2135
|
-
constructor(viewContext, viewContainerRef, getOutletParent, getOutletElement) {
|
|
2136
|
-
this.viewContext = viewContext;
|
|
2137
|
-
this.viewContainerRef = viewContainerRef;
|
|
2138
|
-
this.getOutletParent = getOutletParent;
|
|
2139
|
-
this.getOutletElement = getOutletElement;
|
|
2140
|
-
this.views = [];
|
|
2141
|
-
this.contexts = [];
|
|
2142
|
-
this.viewTypes = [];
|
|
2143
|
-
}
|
|
2144
|
-
initialize(context) {
|
|
2145
|
-
const { leaves, contexts } = this.getLeaves(context);
|
|
2146
|
-
this.leaves = leaves;
|
|
2147
|
-
this.contexts = contexts;
|
|
2148
|
-
this.leaves.forEach((leaf, index) => {
|
|
2149
|
-
const context = getContext(index, this.contexts);
|
|
2150
|
-
const viewType = getViewType(context, this.viewContext);
|
|
2151
|
-
const view = createEmbeddedViewOrComponent(viewType, context, this.viewContext, this.viewContainerRef);
|
|
2152
|
-
this.views.push(view);
|
|
2153
|
-
this.contexts.push(context);
|
|
2154
|
-
this.viewTypes.push(viewType);
|
|
2155
|
-
});
|
|
2156
|
-
mount(this.views, null, this.getOutletParent(), this.getOutletElement());
|
|
2157
|
-
const newDiffers = this.viewContainerRef.injector.get(IterableDiffers);
|
|
2158
|
-
this.differ = newDiffers.find(this.leaves).create(trackBy(this.viewContext));
|
|
2159
|
-
this.differ.diff(this.leaves);
|
|
2160
|
-
}
|
|
2161
|
-
update(context) {
|
|
2162
|
-
const { leaves, contexts } = this.getLeaves(context);
|
|
2163
|
-
const outletParent = this.getOutletParent();
|
|
2164
|
-
const diffResult = this.differ.diff(leaves);
|
|
2165
|
-
if (diffResult) {
|
|
2166
|
-
let firstRootNode = getRootNodes(this.views[0])[0];
|
|
2167
|
-
const newContexts = [];
|
|
2168
|
-
const newViewTypes = [];
|
|
2169
|
-
const newViews = [];
|
|
2170
|
-
diffResult.forEachItem(record => {
|
|
2171
|
-
let context = getContext(record.currentIndex, contexts);
|
|
2172
|
-
const viewType = getViewType(context, this.viewContext);
|
|
2173
|
-
newViewTypes.push(viewType);
|
|
2174
|
-
let view;
|
|
2175
|
-
if (record.previousIndex === null) {
|
|
2176
|
-
view = createEmbeddedViewOrComponent(viewType, context, this.viewContext, this.viewContainerRef);
|
|
2177
|
-
newContexts.push(context);
|
|
2178
|
-
newViews.push(view);
|
|
2179
|
-
mountOnItemChange(record.currentIndex, record.item, newViews, null, outletParent, firstRootNode, this.viewContext);
|
|
2180
|
-
}
|
|
2181
|
-
else {
|
|
2182
|
-
const previousView = this.views[record.previousIndex];
|
|
2183
|
-
const previousViewType = this.viewTypes[record.previousIndex];
|
|
2184
|
-
if (previousViewType !== viewType) {
|
|
2185
|
-
view = createEmbeddedViewOrComponent(viewType, context, this.viewContext, this.viewContainerRef);
|
|
2186
|
-
const firstRootNode = getRootNodes(previousView, null)[0];
|
|
2187
|
-
const newRootNodes = getRootNodes(view, null);
|
|
2188
|
-
firstRootNode.replaceWith(...newRootNodes);
|
|
2189
|
-
previousView.destroy();
|
|
2190
|
-
}
|
|
2191
|
-
else {
|
|
2192
|
-
view = previousView;
|
|
2193
|
-
updateContext(previousView, context, this.viewContext);
|
|
2194
|
-
}
|
|
2195
|
-
newContexts.push(context);
|
|
2196
|
-
newViews.push(view);
|
|
2197
|
-
}
|
|
2198
|
-
});
|
|
2199
|
-
diffResult.forEachRemovedItem(record => {
|
|
2200
|
-
const view = this.views[record.previousIndex];
|
|
2201
|
-
view.destroy();
|
|
2202
|
-
});
|
|
2203
|
-
diffResult.forEachMovedItem(record => {
|
|
2204
|
-
mountOnItemChange(record.currentIndex, record.item, newViews, null, outletParent, firstRootNode, this.viewContext);
|
|
2205
|
-
});
|
|
2206
|
-
this.viewTypes = newViewTypes;
|
|
2207
|
-
this.views = newViews;
|
|
2208
|
-
this.contexts = newContexts;
|
|
2209
|
-
this.leaves = leaves;
|
|
2210
|
-
}
|
|
2211
|
-
}
|
|
2212
|
-
getLeaves(context) {
|
|
2213
|
-
const leaves = Text$1.decorations(context.text, context.decorations);
|
|
2214
|
-
const contexts = leaves.map((leaf, index) => {
|
|
2215
|
-
return {
|
|
2216
|
-
leaf,
|
|
2217
|
-
text: context.text,
|
|
2218
|
-
parent: context.parent,
|
|
2219
|
-
index,
|
|
2220
|
-
isLast: context.isLast && index === leaves.length - 1
|
|
2221
|
-
};
|
|
2222
|
-
});
|
|
2223
|
-
return { leaves, contexts };
|
|
2224
|
-
}
|
|
2225
|
-
}
|
|
2226
|
-
function getContext(index, leafContexts) {
|
|
2227
|
-
return leafContexts[index];
|
|
2228
|
-
}
|
|
2229
|
-
function getViewType(leafContext, viewContext) {
|
|
2230
|
-
return (viewContext.renderLeaf && viewContext.renderLeaf(leafContext.leaf)) || viewContext.defaultLeaf;
|
|
2231
|
-
}
|
|
2232
|
-
function trackBy(viewContext) {
|
|
2233
|
-
return (index, node) => {
|
|
2234
|
-
return index;
|
|
2235
|
-
};
|
|
2236
|
-
}
|
|
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
|
-
|
|
2258
|
-
/**
|
|
2259
|
-
* base class for custom element component or text component
|
|
2260
|
-
*/
|
|
2261
|
-
class BaseComponent {
|
|
2262
|
-
set context(value) {
|
|
2263
|
-
if (hasBeforeContextChange(this)) {
|
|
2264
|
-
this.beforeContextChange(value);
|
|
2265
|
-
}
|
|
2266
|
-
this._context = value;
|
|
2267
|
-
this.onContextChange();
|
|
2268
|
-
if (this.initialized) {
|
|
2269
|
-
this.cdr.detectChanges();
|
|
2270
|
-
}
|
|
2271
|
-
if (hasAfterContextChange(this)) {
|
|
2272
|
-
this.afterContextChange();
|
|
2273
|
-
}
|
|
2274
|
-
}
|
|
2275
|
-
get context() {
|
|
2276
|
-
return this._context;
|
|
2277
|
-
}
|
|
2278
|
-
get editor() {
|
|
2279
|
-
return this.viewContext && this.viewContext.editor;
|
|
2280
|
-
}
|
|
2281
|
-
get nativeElement() {
|
|
2282
|
-
return this.elementRef.nativeElement;
|
|
2283
|
-
}
|
|
2284
|
-
constructor(elementRef, cdr) {
|
|
2285
|
-
this.elementRef = elementRef;
|
|
2286
|
-
this.cdr = cdr;
|
|
2287
|
-
this.initialized = false;
|
|
2288
|
-
}
|
|
2289
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2290
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: BaseComponent, inputs: { context: "context", viewContext: "viewContext" }, ngImport: i0 }); }
|
|
1829
|
+
constructor(elementRef, cdr) {
|
|
1830
|
+
this.elementRef = elementRef;
|
|
1831
|
+
this.cdr = cdr;
|
|
1832
|
+
}
|
|
1833
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1834
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: BaseComponent, inputs: { context: "context", viewContext: "viewContext" }, ngImport: i0 }); }
|
|
2291
1835
|
}
|
|
2292
1836
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseComponent, decorators: [{
|
|
2293
1837
|
type: Directive
|
|
@@ -2302,6 +1846,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImpor
|
|
|
2302
1846
|
class BaseLeafComponent extends BaseComponent {
|
|
2303
1847
|
constructor() {
|
|
2304
1848
|
super(...arguments);
|
|
1849
|
+
this.initialized = false;
|
|
2305
1850
|
this.isSlateLeaf = true;
|
|
2306
1851
|
}
|
|
2307
1852
|
get text() {
|
|
@@ -2317,6 +1862,7 @@ class BaseLeafComponent extends BaseComponent {
|
|
|
2317
1862
|
if (!this.initialized) {
|
|
2318
1863
|
return;
|
|
2319
1864
|
}
|
|
1865
|
+
this.cdr.markForCheck();
|
|
2320
1866
|
}
|
|
2321
1867
|
renderPlaceholder() {
|
|
2322
1868
|
// issue-1: IME input was interrupted
|
|
@@ -2368,16 +1914,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImpor
|
|
|
2368
1914
|
class BaseElementComponent extends BaseComponent {
|
|
2369
1915
|
constructor() {
|
|
2370
1916
|
super(...arguments);
|
|
2371
|
-
this.
|
|
2372
|
-
this.getOutletParent = () => {
|
|
2373
|
-
return this.elementRef.nativeElement;
|
|
2374
|
-
};
|
|
2375
|
-
this.getOutletElement = () => {
|
|
2376
|
-
if (this.childrenOutletInstance) {
|
|
2377
|
-
return this.childrenOutletInstance.getNativeElement();
|
|
2378
|
-
}
|
|
2379
|
-
return null;
|
|
2380
|
-
};
|
|
1917
|
+
this.initialized = false;
|
|
2381
1918
|
}
|
|
2382
1919
|
get element() {
|
|
2383
1920
|
return this._context && this._context.element;
|
|
@@ -2401,12 +1938,11 @@ class BaseElementComponent extends BaseComponent {
|
|
|
2401
1938
|
return this._context && this._context.readonly;
|
|
2402
1939
|
}
|
|
2403
1940
|
ngOnInit() {
|
|
1941
|
+
this.updateWeakMap();
|
|
2404
1942
|
for (const key in this._context.attributes) {
|
|
2405
1943
|
this.nativeElement.setAttribute(key, this._context.attributes[key]);
|
|
2406
1944
|
}
|
|
2407
1945
|
this.initialized = true;
|
|
2408
|
-
this.listRender = new ListRender(this.viewContext, this.viewContainerRef, this.getOutletParent, this.getOutletElement);
|
|
2409
|
-
this.listRender.initialize(this.children, this.element, this.childrenContext);
|
|
2410
1946
|
}
|
|
2411
1947
|
updateWeakMap() {
|
|
2412
1948
|
NODE_TO_ELEMENT.set(this.element, this.nativeElement);
|
|
@@ -2423,11 +1959,11 @@ class BaseElementComponent extends BaseComponent {
|
|
|
2423
1959
|
}
|
|
2424
1960
|
onContextChange() {
|
|
2425
1961
|
this.childrenContext = this.getChildrenContext();
|
|
2426
|
-
this.updateWeakMap();
|
|
2427
1962
|
if (!this.initialized) {
|
|
2428
1963
|
return;
|
|
2429
1964
|
}
|
|
2430
|
-
this.
|
|
1965
|
+
this.cdr.markForCheck();
|
|
1966
|
+
this.updateWeakMap();
|
|
2431
1967
|
}
|
|
2432
1968
|
getChildrenContext() {
|
|
2433
1969
|
return {
|
|
@@ -2439,38 +1975,25 @@ class BaseElementComponent extends BaseComponent {
|
|
|
2439
1975
|
};
|
|
2440
1976
|
}
|
|
2441
1977
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseElementComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2442
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: BaseElementComponent,
|
|
1978
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: BaseElementComponent, usesInheritance: true, ngImport: i0 }); }
|
|
2443
1979
|
}
|
|
2444
1980
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseElementComponent, decorators: [{
|
|
2445
1981
|
type: Directive
|
|
2446
|
-
}]
|
|
2447
|
-
type: ViewChild,
|
|
2448
|
-
args: [SlateChildrenOutlet, { static: true }]
|
|
2449
|
-
}] } });
|
|
1982
|
+
}] });
|
|
2450
1983
|
/**
|
|
2451
1984
|
* base class for custom text component
|
|
2452
1985
|
*/
|
|
2453
1986
|
class BaseTextComponent extends BaseComponent {
|
|
2454
1987
|
constructor() {
|
|
2455
1988
|
super(...arguments);
|
|
2456
|
-
this.
|
|
2457
|
-
this.getOutletParent = () => {
|
|
2458
|
-
return this.elementRef.nativeElement;
|
|
2459
|
-
};
|
|
2460
|
-
this.getOutletElement = () => {
|
|
2461
|
-
if (this.childrenOutletInstance) {
|
|
2462
|
-
return this.childrenOutletInstance.getNativeElement();
|
|
2463
|
-
}
|
|
2464
|
-
return null;
|
|
2465
|
-
};
|
|
1989
|
+
this.initialized = false;
|
|
2466
1990
|
}
|
|
2467
1991
|
get text() {
|
|
2468
1992
|
return this._context && this._context.text;
|
|
2469
1993
|
}
|
|
2470
1994
|
ngOnInit() {
|
|
1995
|
+
this.updateWeakMap();
|
|
2471
1996
|
this.initialized = true;
|
|
2472
|
-
this.leavesRender = new LeavesRender(this.viewContext, this.viewContainerRef, this.getOutletParent, this.getOutletElement);
|
|
2473
|
-
this.leavesRender.initialize(this.context);
|
|
2474
1997
|
}
|
|
2475
1998
|
updateWeakMap() {
|
|
2476
1999
|
ELEMENT_TO_NODE.set(this.nativeElement, this.text);
|
|
@@ -2482,209 +2005,115 @@ class BaseTextComponent extends BaseComponent {
|
|
|
2482
2005
|
}
|
|
2483
2006
|
}
|
|
2484
2007
|
onContextChange() {
|
|
2485
|
-
this.updateWeakMap();
|
|
2486
2008
|
if (!this.initialized) {
|
|
2487
2009
|
return;
|
|
2488
2010
|
}
|
|
2489
|
-
this.
|
|
2011
|
+
this.cdr.markForCheck();
|
|
2012
|
+
this.updateWeakMap();
|
|
2490
2013
|
}
|
|
2491
2014
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseTextComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2492
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: BaseTextComponent,
|
|
2015
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: BaseTextComponent, usesInheritance: true, ngImport: i0 }); }
|
|
2493
2016
|
}
|
|
2494
2017
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseTextComponent, decorators: [{
|
|
2495
2018
|
type: Directive
|
|
2496
|
-
}], propDecorators: { childrenOutletInstance: [{
|
|
2497
|
-
type: ViewChild,
|
|
2498
|
-
args: [SlateChildrenOutlet, { static: true }]
|
|
2499
|
-
}] } });
|
|
2500
|
-
|
|
2501
|
-
class SlateLeaves extends ViewContainer {
|
|
2502
|
-
constructor() {
|
|
2503
|
-
super(...arguments);
|
|
2504
|
-
this.initialized = false;
|
|
2505
|
-
}
|
|
2506
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateLeaves, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2507
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: SlateLeaves, isStandalone: true, selector: "slate-leaves", inputs: { context: "context" }, usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2508
|
-
}
|
|
2509
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateLeaves, decorators: [{
|
|
2510
|
-
type: Component,
|
|
2511
|
-
args: [{
|
|
2512
|
-
selector: 'slate-leaves',
|
|
2513
|
-
template: ``,
|
|
2514
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2515
|
-
standalone: true,
|
|
2516
|
-
imports: [NgFor]
|
|
2517
|
-
}]
|
|
2518
|
-
}], propDecorators: { context: [{
|
|
2519
|
-
type: Input
|
|
2520
|
-
}] } });
|
|
2521
|
-
|
|
2522
|
-
class SlateVoidText extends BaseTextComponent {
|
|
2523
|
-
ngOnInit() {
|
|
2524
|
-
this.isLeafBlock = AngularEditor.isLeafBlock(this.viewContext.editor, this.context.parent);
|
|
2525
|
-
super.ngOnInit();
|
|
2526
|
-
}
|
|
2527
|
-
ngOnChanges() {
|
|
2528
|
-
if (!this.initialized) {
|
|
2529
|
-
return;
|
|
2530
|
-
}
|
|
2531
|
-
this.isLeafBlock = AngularEditor.isLeafBlock(this.viewContext.editor, this.context.parent);
|
|
2532
|
-
}
|
|
2533
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateVoidText, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2534
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: SlateVoidText, isStandalone: true, selector: "span[slateVoidText]", host: { attributes: { "data-slate-spacer": "true", "data-slate-node": "text" }, properties: { "attr.contenteditable": "isLeafBlock" }, classAttribute: "slate-spacer" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2535
|
-
}
|
|
2536
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateVoidText, decorators: [{
|
|
2537
|
-
type: Component,
|
|
2538
|
-
args: [{
|
|
2539
|
-
selector: 'span[slateVoidText]',
|
|
2540
|
-
template: ``,
|
|
2541
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2542
|
-
host: {
|
|
2543
|
-
'[attr.contenteditable]': 'isLeafBlock',
|
|
2544
|
-
'data-slate-spacer': 'true',
|
|
2545
|
-
class: 'slate-spacer',
|
|
2546
|
-
'data-slate-node': 'text'
|
|
2547
|
-
},
|
|
2548
|
-
standalone: true,
|
|
2549
|
-
imports: [SlateLeaves]
|
|
2550
|
-
}]
|
|
2551
|
-
}] });
|
|
2552
|
-
|
|
2553
|
-
class SlateDefaultText extends BaseTextComponent {
|
|
2554
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateDefaultText, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2555
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: SlateDefaultText, isStandalone: true, selector: "span[slateDefaultText]", host: { attributes: { "data-slate-node": "text" } }, usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2556
|
-
}
|
|
2557
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateDefaultText, decorators: [{
|
|
2558
|
-
type: Component,
|
|
2559
|
-
args: [{
|
|
2560
|
-
selector: 'span[slateDefaultText]',
|
|
2561
|
-
template: ``,
|
|
2562
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2563
|
-
host: {
|
|
2564
|
-
'data-slate-node': 'text'
|
|
2565
|
-
},
|
|
2566
|
-
standalone: true,
|
|
2567
|
-
imports: [SlateLeaves]
|
|
2568
|
-
}]
|
|
2569
|
-
}] });
|
|
2570
|
-
|
|
2571
|
-
class SlateDefaultElement extends BaseElementComponent {
|
|
2572
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateDefaultElement, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2573
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: SlateDefaultElement, isStandalone: true, selector: "div[slateDefaultElement]", usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2574
|
-
}
|
|
2575
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateDefaultElement, decorators: [{
|
|
2576
|
-
type: Component,
|
|
2577
|
-
args: [{
|
|
2578
|
-
selector: 'div[slateDefaultElement]',
|
|
2579
|
-
template: ``,
|
|
2580
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2581
|
-
standalone: true,
|
|
2582
|
-
imports: [SlateChildren]
|
|
2583
|
-
}]
|
|
2584
2019
|
}] });
|
|
2585
2020
|
|
|
2586
2021
|
/**
|
|
2587
|
-
*
|
|
2588
|
-
*
|
|
2589
|
-
*
|
|
2022
|
+
* the special container for angular template
|
|
2023
|
+
* Add the rootNodes of each child component to the parentElement
|
|
2024
|
+
* Remove useless DOM elements, eg: comment...
|
|
2590
2025
|
*/
|
|
2591
|
-
class
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
getRootNodes() {
|
|
2596
|
-
if (this.embeddedViewRef) {
|
|
2597
|
-
return this.embeddedViewRef.rootNodes.filter(rootNode => isDOMElement(rootNode));
|
|
2598
|
-
}
|
|
2599
|
-
if (this.componentRef) {
|
|
2600
|
-
return [this.componentRef.instance.nativeElement];
|
|
2601
|
-
}
|
|
2602
|
-
return [];
|
|
2026
|
+
class ViewContainer {
|
|
2027
|
+
constructor(elementRef, differs) {
|
|
2028
|
+
this.elementRef = elementRef;
|
|
2029
|
+
this.differs = differs;
|
|
2603
2030
|
}
|
|
2604
|
-
|
|
2605
|
-
this.
|
|
2606
|
-
|
|
2031
|
+
ngAfterViewInit() {
|
|
2032
|
+
const differ = this.differs.find(this.childrenComponent).create((index, item) => {
|
|
2033
|
+
return item;
|
|
2034
|
+
});
|
|
2035
|
+
// first diff
|
|
2036
|
+
differ.diff(this.childrenComponent);
|
|
2037
|
+
const parentElement = this.elementRef.nativeElement.parentElement;
|
|
2038
|
+
if (this.childrenComponent.length > 0) {
|
|
2039
|
+
parentElement.insertBefore(this.createFragment(), this.elementRef.nativeElement);
|
|
2040
|
+
this.elementRef.nativeElement.remove();
|
|
2041
|
+
}
|
|
2042
|
+
this.childrenComponent.changes.subscribe(value => {
|
|
2043
|
+
const iterableChanges = differ.diff(this.childrenComponent);
|
|
2044
|
+
if (iterableChanges) {
|
|
2045
|
+
iterableChanges.forEachOperation((record, previousIndex, currentIndex) => {
|
|
2046
|
+
// removed
|
|
2047
|
+
if (currentIndex === null) {
|
|
2048
|
+
return;
|
|
2049
|
+
}
|
|
2050
|
+
// added or moved
|
|
2051
|
+
this.handleContainerItemChange(record, parentElement);
|
|
2052
|
+
});
|
|
2053
|
+
}
|
|
2054
|
+
});
|
|
2607
2055
|
}
|
|
2608
|
-
|
|
2609
|
-
if (
|
|
2610
|
-
|
|
2611
|
-
this.embeddedViewRef = null;
|
|
2612
|
-
}
|
|
2613
|
-
if (this.componentRef) {
|
|
2614
|
-
this.componentRef.destroy();
|
|
2615
|
-
this.componentRef = null;
|
|
2056
|
+
getPreviousRootNode(currentIndex) {
|
|
2057
|
+
if (currentIndex === 0) {
|
|
2058
|
+
return null;
|
|
2616
2059
|
}
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
const context = this.getContext();
|
|
2622
|
-
if (isTemplateRef(this.viewType)) {
|
|
2623
|
-
this.embeddedViewContext = {
|
|
2624
|
-
context,
|
|
2625
|
-
viewContext: this.viewContext
|
|
2626
|
-
};
|
|
2627
|
-
const embeddedViewRef = this.viewContainerRef.createEmbeddedView(this.viewType, this.embeddedViewContext);
|
|
2628
|
-
this.embeddedViewRef = embeddedViewRef;
|
|
2060
|
+
const previousComponent = this.childrenComponent.find((item, index) => index === currentIndex - 1);
|
|
2061
|
+
let previousRootNode = previousComponent.rootNodes[previousComponent.rootNodes.length - 1];
|
|
2062
|
+
if (previousRootNode) {
|
|
2063
|
+
return previousRootNode;
|
|
2629
2064
|
}
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
componentRef.instance.viewContext = this.viewContext;
|
|
2633
|
-
componentRef.instance.context = context;
|
|
2634
|
-
this.componentRef = componentRef;
|
|
2065
|
+
else {
|
|
2066
|
+
return this.getPreviousRootNode(currentIndex - 1);
|
|
2635
2067
|
}
|
|
2636
2068
|
}
|
|
2637
|
-
|
|
2638
|
-
const
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2069
|
+
createFragment() {
|
|
2070
|
+
const fragment = document.createDocumentFragment();
|
|
2071
|
+
this.childrenComponent.forEach((component, index) => {
|
|
2072
|
+
fragment.append(...component.rootNodes);
|
|
2073
|
+
});
|
|
2074
|
+
return fragment;
|
|
2075
|
+
}
|
|
2076
|
+
handleContainerItemChange(record, parentElement) {
|
|
2077
|
+
// first insert
|
|
2078
|
+
if (this.elementRef.nativeElement.parentElement && this.elementRef.nativeElement.parentElement === parentElement) {
|
|
2079
|
+
const fragment = document.createDocumentFragment();
|
|
2080
|
+
fragment.append(...record.item.rootNodes);
|
|
2081
|
+
parentElement.insertBefore(fragment, this.elementRef.nativeElement);
|
|
2082
|
+
this.elementRef.nativeElement.remove();
|
|
2083
|
+
return;
|
|
2084
|
+
}
|
|
2085
|
+
// insert at start location
|
|
2086
|
+
if (record.currentIndex === 0) {
|
|
2087
|
+
const fragment = document.createDocumentFragment();
|
|
2088
|
+
fragment.append(...record.item.rootNodes);
|
|
2089
|
+
parentElement.prepend(fragment);
|
|
2653
2090
|
}
|
|
2654
2091
|
else {
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
if (
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
};
|
|
2662
|
-
const embeddedViewRef = this.viewContainerRef.createEmbeddedView(this.viewType, this.embeddedViewContext);
|
|
2663
|
-
firstRootNode.replaceWith(...embeddedViewRef.rootNodes.filter(rootNode => isDOMElement(rootNode)));
|
|
2664
|
-
this.destroyView();
|
|
2665
|
-
this.embeddedViewRef = embeddedViewRef;
|
|
2092
|
+
// insert afterend of previous component end
|
|
2093
|
+
let previousRootNode = this.getPreviousRootNode(record.currentIndex);
|
|
2094
|
+
if (previousRootNode) {
|
|
2095
|
+
record.item.rootNodes.forEach(rootNode => {
|
|
2096
|
+
previousRootNode.insertAdjacentElement('afterend', rootNode);
|
|
2097
|
+
previousRootNode = rootNode;
|
|
2098
|
+
});
|
|
2666
2099
|
}
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
this.componentRef = componentRef;
|
|
2100
|
+
else {
|
|
2101
|
+
this.viewContext.editor.onError({
|
|
2102
|
+
code: SlateErrorCode.NotFoundPreviousRootNodeError,
|
|
2103
|
+
name: 'not found previous rootNode',
|
|
2104
|
+
nativeError: null
|
|
2105
|
+
});
|
|
2674
2106
|
}
|
|
2675
2107
|
}
|
|
2108
|
+
// Solve the block-card DOMElement loss when moving nodes
|
|
2109
|
+
record.item.appendBlockCardElement();
|
|
2676
2110
|
}
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
this.blockCardComponentRef.instance.append();
|
|
2680
|
-
}
|
|
2681
|
-
}
|
|
2682
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ViewContainerItem, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2683
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: ViewContainerItem, inputs: { viewContext: "viewContext" }, ngImport: i0 }); }
|
|
2111
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ViewContainer, deps: [{ token: i0.ElementRef }, { token: i0.IterableDiffers }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2112
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: ViewContainer, inputs: { viewContext: "viewContext" }, ngImport: i0 }); }
|
|
2684
2113
|
}
|
|
2685
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type:
|
|
2114
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ViewContainer, decorators: [{
|
|
2686
2115
|
type: Directive
|
|
2687
|
-
}], ctorParameters: function () { return [{ type: i0.
|
|
2116
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.IterableDiffers }]; }, propDecorators: { viewContext: [{
|
|
2688
2117
|
type: Input
|
|
2689
2118
|
}] } });
|
|
2690
2119
|
|
|
@@ -2739,162 +2168,516 @@ class SlateDefaultString extends BaseComponent {
|
|
|
2739
2168
|
this.nativeElement.setAttribute('data-slate-string', 'true');
|
|
2740
2169
|
this.updateStringDOM();
|
|
2741
2170
|
}
|
|
2742
|
-
updateStringDOM() {
|
|
2743
|
-
// Avoid breaking some browser default behaviors, such as spellCheck, android composition input state
|
|
2744
|
-
if (this.nativeElement.textContent !== this.context.text) {
|
|
2745
|
-
this.nativeElement.textContent = this.context.text;
|
|
2171
|
+
updateStringDOM() {
|
|
2172
|
+
// Avoid breaking some browser default behaviors, such as spellCheck, android composition input state
|
|
2173
|
+
if (this.nativeElement.textContent !== this.context.text) {
|
|
2174
|
+
this.nativeElement.textContent = this.context.text;
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2177
|
+
removeStringDOM() {
|
|
2178
|
+
this.nativeElement.removeAttribute('data-slate-string');
|
|
2179
|
+
this.nativeElement.textContent = '';
|
|
2180
|
+
}
|
|
2181
|
+
ngOnInit() {
|
|
2182
|
+
this.nativeElement.setAttribute('editable-text', '');
|
|
2183
|
+
}
|
|
2184
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateDefaultString, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2185
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: SlateDefaultString, isStandalone: true, selector: "span[slateDefaultString]", usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2186
|
+
}
|
|
2187
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateDefaultString, decorators: [{
|
|
2188
|
+
type: Component,
|
|
2189
|
+
args: [{
|
|
2190
|
+
selector: 'span[slateDefaultString]',
|
|
2191
|
+
template: '',
|
|
2192
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2193
|
+
standalone: true
|
|
2194
|
+
}]
|
|
2195
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; } });
|
|
2196
|
+
|
|
2197
|
+
class SlateString extends ViewContainerItem {
|
|
2198
|
+
constructor(elementRef, viewContainerRef) {
|
|
2199
|
+
super(viewContainerRef);
|
|
2200
|
+
this.elementRef = elementRef;
|
|
2201
|
+
this.viewContainerRef = viewContainerRef;
|
|
2202
|
+
}
|
|
2203
|
+
ngOnInit() {
|
|
2204
|
+
this.createView();
|
|
2205
|
+
}
|
|
2206
|
+
ngOnChanges() {
|
|
2207
|
+
if (!this.initialized) {
|
|
2208
|
+
return;
|
|
2209
|
+
}
|
|
2210
|
+
this.updateView();
|
|
2211
|
+
}
|
|
2212
|
+
ngAfterViewInit() {
|
|
2213
|
+
this.elementRef.nativeElement.remove();
|
|
2214
|
+
}
|
|
2215
|
+
// COMPAT: If this is the last text node in an empty block, render a zero-
|
|
2216
|
+
// width space that will convert into a line break when copying and pasting
|
|
2217
|
+
// to support expected plain text.
|
|
2218
|
+
isLineBreakEmptyString() {
|
|
2219
|
+
const path = AngularEditor.findPath(this.viewContext.editor, this.context.text);
|
|
2220
|
+
const parentPath = Path.parent(path);
|
|
2221
|
+
return (this.context.leaf.text === '' &&
|
|
2222
|
+
this.context.parent.children[this.context.parent.children.length - 1] === this.context.text &&
|
|
2223
|
+
!this.viewContext.editor.isInline(this.context.parent) &&
|
|
2224
|
+
Editor.string(this.viewContext.editor, parentPath) === '');
|
|
2225
|
+
}
|
|
2226
|
+
// COMPAT: If the text is empty, it's because it's on the edge of an inline
|
|
2227
|
+
// node, so we render a zero-width space so that the selection can be
|
|
2228
|
+
// inserted next to it still.
|
|
2229
|
+
isEmptyText() {
|
|
2230
|
+
return this.context.leaf.text === '';
|
|
2231
|
+
}
|
|
2232
|
+
// COMPAT: Browsers will collapse trailing new lines at the end of blocks,
|
|
2233
|
+
// so we need to add an extra trailing new lines to prevent that.
|
|
2234
|
+
isCompatibleString() {
|
|
2235
|
+
return this.context.isLast && this.context.leaf.text.slice(-1) === '\n';
|
|
2236
|
+
}
|
|
2237
|
+
// COMPAT: Render text inside void nodes with a zero-width space.
|
|
2238
|
+
// So the node can contain selection but the text is not visible.
|
|
2239
|
+
isVoid() {
|
|
2240
|
+
return this.viewContext.editor.isVoid(this.context.parent);
|
|
2241
|
+
}
|
|
2242
|
+
getViewType() {
|
|
2243
|
+
if (this.isVoid()) {
|
|
2244
|
+
return this.viewContext.templateComponent.voidStringTemplate;
|
|
2245
|
+
}
|
|
2246
|
+
if (this.isLineBreakEmptyString()) {
|
|
2247
|
+
return SlateDefaultString;
|
|
2248
|
+
}
|
|
2249
|
+
if (this.isEmptyText()) {
|
|
2250
|
+
return this.viewContext.templateComponent.emptyTextTemplate;
|
|
2251
|
+
}
|
|
2252
|
+
if (this.isCompatibleString()) {
|
|
2253
|
+
return this.viewContext.templateComponent.compatibleStringTemplate;
|
|
2254
|
+
}
|
|
2255
|
+
return SlateDefaultString;
|
|
2256
|
+
}
|
|
2257
|
+
getType() {
|
|
2258
|
+
if (this.isLineBreakEmptyString()) {
|
|
2259
|
+
return 'lineBreakEmptyString';
|
|
2260
|
+
}
|
|
2261
|
+
return 'string';
|
|
2262
|
+
}
|
|
2263
|
+
getContext() {
|
|
2264
|
+
const stringType = this.getType();
|
|
2265
|
+
return {
|
|
2266
|
+
text: this.context.leaf.text,
|
|
2267
|
+
elementStringLength: Node.string(this.context.parent).length,
|
|
2268
|
+
type: stringType
|
|
2269
|
+
};
|
|
2270
|
+
}
|
|
2271
|
+
memoizedContext(prev, next) {
|
|
2272
|
+
return false;
|
|
2273
|
+
}
|
|
2274
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateString, deps: [{ token: i0.ElementRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2275
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: SlateString, isStandalone: true, selector: "span[slateString]", inputs: { context: "context" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2276
|
+
}
|
|
2277
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateString, decorators: [{
|
|
2278
|
+
type: Component,
|
|
2279
|
+
args: [{
|
|
2280
|
+
selector: 'span[slateString]',
|
|
2281
|
+
template: '',
|
|
2282
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2283
|
+
standalone: true
|
|
2284
|
+
}]
|
|
2285
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { context: [{
|
|
2286
|
+
type: Input
|
|
2287
|
+
}] } });
|
|
2288
|
+
|
|
2289
|
+
class SlateDefaultLeaf extends BaseLeafComponent {
|
|
2290
|
+
onContextChange() {
|
|
2291
|
+
super.onContextChange();
|
|
2292
|
+
this.renderPlaceholder();
|
|
2293
|
+
}
|
|
2294
|
+
ngOnDestroy() {
|
|
2295
|
+
// Because the placeholder span is not in the current component, it is destroyed along with the current component
|
|
2296
|
+
this.destroyPlaceholder();
|
|
2297
|
+
}
|
|
2298
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateDefaultLeaf, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2299
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: SlateDefaultLeaf, isStandalone: true, selector: "span[slateDefaultLeaf]", host: { attributes: { "data-slate-leaf": "true" } }, usesInheritance: true, ngImport: i0, template: `<span slateString [context]="context" [viewContext]="viewContext"><span></span></span>`, isInline: true, dependencies: [{ kind: "component", type: SlateString, selector: "span[slateString]", inputs: ["context"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2300
|
+
}
|
|
2301
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateDefaultLeaf, decorators: [{
|
|
2302
|
+
type: Component,
|
|
2303
|
+
args: [{
|
|
2304
|
+
selector: 'span[slateDefaultLeaf]',
|
|
2305
|
+
template: `<span slateString [context]="context" [viewContext]="viewContext"><span></span></span>`,
|
|
2306
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2307
|
+
host: {
|
|
2308
|
+
'data-slate-leaf': 'true'
|
|
2309
|
+
},
|
|
2310
|
+
standalone: true,
|
|
2311
|
+
imports: [SlateString]
|
|
2312
|
+
}]
|
|
2313
|
+
}] });
|
|
2314
|
+
|
|
2315
|
+
class SlateLeaf extends ViewContainerItem {
|
|
2316
|
+
ngOnInit() {
|
|
2317
|
+
this.createView();
|
|
2318
|
+
}
|
|
2319
|
+
getContext() {
|
|
2320
|
+
return this.context;
|
|
2321
|
+
}
|
|
2322
|
+
getViewType() {
|
|
2323
|
+
return (this.viewContext.renderLeaf && this.viewContext.renderLeaf(this.context.leaf)) || SlateDefaultLeaf;
|
|
2324
|
+
}
|
|
2325
|
+
memoizedContext(prev, next) {
|
|
2326
|
+
return false;
|
|
2327
|
+
}
|
|
2328
|
+
ngOnChanges(simpleChanges) {
|
|
2329
|
+
if (!this.initialized) {
|
|
2330
|
+
return;
|
|
2331
|
+
}
|
|
2332
|
+
this.updateView();
|
|
2333
|
+
}
|
|
2334
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateLeaf, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2335
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: SlateLeaf, isStandalone: true, selector: "slate-leaf", inputs: { context: "context" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2336
|
+
}
|
|
2337
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateLeaf, decorators: [{
|
|
2338
|
+
type: Component,
|
|
2339
|
+
args: [{
|
|
2340
|
+
selector: 'slate-leaf',
|
|
2341
|
+
template: '',
|
|
2342
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2343
|
+
standalone: true
|
|
2344
|
+
}]
|
|
2345
|
+
}], propDecorators: { context: [{
|
|
2346
|
+
type: Input
|
|
2347
|
+
}] } });
|
|
2348
|
+
|
|
2349
|
+
class SlateLeaves extends ViewContainer {
|
|
2350
|
+
constructor() {
|
|
2351
|
+
super(...arguments);
|
|
2352
|
+
this.initialized = false;
|
|
2353
|
+
}
|
|
2354
|
+
ngOnInit() {
|
|
2355
|
+
this.leaves = Text$1.decorations(this.context.text, this.context.decorations);
|
|
2356
|
+
this.leafContexts = this.getLeafContexts();
|
|
2357
|
+
this.initialized = true;
|
|
2358
|
+
}
|
|
2359
|
+
getLeafContexts() {
|
|
2360
|
+
return this.leaves.map((leaf, index) => {
|
|
2361
|
+
return {
|
|
2362
|
+
leaf,
|
|
2363
|
+
text: this.context.text,
|
|
2364
|
+
parent: this.context.parent,
|
|
2365
|
+
index,
|
|
2366
|
+
isLast: this.context.isLast && index === this.leaves.length - 1
|
|
2367
|
+
};
|
|
2368
|
+
});
|
|
2369
|
+
}
|
|
2370
|
+
ngOnChanges(simpleChanges) {
|
|
2371
|
+
if (!this.initialized) {
|
|
2372
|
+
return;
|
|
2373
|
+
}
|
|
2374
|
+
const context = simpleChanges['context'];
|
|
2375
|
+
const previousValue = context.previousValue;
|
|
2376
|
+
const currentValue = context.currentValue;
|
|
2377
|
+
if (previousValue.text !== currentValue.text || !isDecoratorRangeListEqual(previousValue.decorations, currentValue.decorations)) {
|
|
2378
|
+
this.leaves = Text$1.decorations(this.context.text, this.context.decorations);
|
|
2379
|
+
}
|
|
2380
|
+
this.leafContexts = this.getLeafContexts();
|
|
2381
|
+
}
|
|
2382
|
+
trackBy(index, item) {
|
|
2383
|
+
return index;
|
|
2384
|
+
}
|
|
2385
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateLeaves, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2386
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: SlateLeaves, isStandalone: true, selector: "slate-leaves", inputs: { context: "context" }, viewQueries: [{ propertyName: "childrenComponent", predicate: SlateLeaf, descendants: true, read: SlateLeaf }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `<slate-leaf
|
|
2387
|
+
[context]="context"
|
|
2388
|
+
[viewContext]="viewContext"
|
|
2389
|
+
*ngFor="let context of leafContexts; trackBy: trackBy"
|
|
2390
|
+
></slate-leaf>`, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: SlateLeaf, selector: "slate-leaf", inputs: ["context"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2391
|
+
}
|
|
2392
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateLeaves, decorators: [{
|
|
2393
|
+
type: Component,
|
|
2394
|
+
args: [{
|
|
2395
|
+
selector: 'slate-leaves',
|
|
2396
|
+
template: `<slate-leaf
|
|
2397
|
+
[context]="context"
|
|
2398
|
+
[viewContext]="viewContext"
|
|
2399
|
+
*ngFor="let context of leafContexts; trackBy: trackBy"
|
|
2400
|
+
></slate-leaf>`,
|
|
2401
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2402
|
+
standalone: true,
|
|
2403
|
+
imports: [NgFor, SlateLeaf]
|
|
2404
|
+
}]
|
|
2405
|
+
}], propDecorators: { context: [{
|
|
2406
|
+
type: Input
|
|
2407
|
+
}], childrenComponent: [{
|
|
2408
|
+
type: ViewChildren,
|
|
2409
|
+
args: [SlateLeaf, { read: SlateLeaf }]
|
|
2410
|
+
}] } });
|
|
2411
|
+
|
|
2412
|
+
class SlateDefaultText extends BaseTextComponent {
|
|
2413
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateDefaultText, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2414
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: SlateDefaultText, isStandalone: true, selector: "span[slateDefaultText]", host: { attributes: { "data-slate-node": "text" } }, usesInheritance: true, ngImport: i0, template: `<slate-leaves [context]="context" [viewContext]="viewContext" [viewContext]="viewContext"></slate-leaves>`, isInline: true, dependencies: [{ kind: "component", type: SlateLeaves, selector: "slate-leaves", inputs: ["context"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2415
|
+
}
|
|
2416
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateDefaultText, decorators: [{
|
|
2417
|
+
type: Component,
|
|
2418
|
+
args: [{
|
|
2419
|
+
selector: 'span[slateDefaultText]',
|
|
2420
|
+
template: `<slate-leaves [context]="context" [viewContext]="viewContext" [viewContext]="viewContext"></slate-leaves>`,
|
|
2421
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2422
|
+
host: {
|
|
2423
|
+
'data-slate-node': 'text'
|
|
2424
|
+
},
|
|
2425
|
+
standalone: true,
|
|
2426
|
+
imports: [SlateLeaves]
|
|
2427
|
+
}]
|
|
2428
|
+
}] });
|
|
2429
|
+
|
|
2430
|
+
class SlateVoidText extends BaseTextComponent {
|
|
2431
|
+
ngOnInit() {
|
|
2432
|
+
this.isLeafBlock = AngularEditor.isLeafBlock(this.viewContext.editor, this.context.parent);
|
|
2433
|
+
super.ngOnInit();
|
|
2434
|
+
}
|
|
2435
|
+
ngOnChanges() {
|
|
2436
|
+
if (!this.initialized) {
|
|
2437
|
+
return;
|
|
2746
2438
|
}
|
|
2439
|
+
this.isLeafBlock = AngularEditor.isLeafBlock(this.viewContext.editor, this.context.parent);
|
|
2747
2440
|
}
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
this.nativeElement.textContent = '';
|
|
2751
|
-
}
|
|
2752
|
-
ngOnInit() {
|
|
2753
|
-
this.nativeElement.setAttribute('editable-text', '');
|
|
2754
|
-
}
|
|
2755
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateDefaultString, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2756
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: SlateDefaultString, isStandalone: true, selector: "span[slateDefaultString]", usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2441
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateVoidText, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2442
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: SlateVoidText, isStandalone: true, selector: "span[slateVoidText]", host: { attributes: { "data-slate-spacer": "true", "data-slate-node": "text" }, properties: { "attr.contenteditable": "isLeafBlock" }, classAttribute: "slate-spacer" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `<slate-leaves [context]="context" [viewContext]="viewContext" [viewContext]="viewContext"></slate-leaves>`, isInline: true, dependencies: [{ kind: "component", type: SlateLeaves, selector: "slate-leaves", inputs: ["context"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2757
2443
|
}
|
|
2758
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type:
|
|
2444
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateVoidText, decorators: [{
|
|
2759
2445
|
type: Component,
|
|
2760
2446
|
args: [{
|
|
2761
|
-
selector: 'span[
|
|
2762
|
-
template:
|
|
2447
|
+
selector: 'span[slateVoidText]',
|
|
2448
|
+
template: `<slate-leaves [context]="context" [viewContext]="viewContext" [viewContext]="viewContext"></slate-leaves>`,
|
|
2763
2449
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2764
|
-
|
|
2450
|
+
host: {
|
|
2451
|
+
'[attr.contenteditable]': 'isLeafBlock',
|
|
2452
|
+
'data-slate-spacer': 'true',
|
|
2453
|
+
class: 'slate-spacer',
|
|
2454
|
+
'data-slate-node': 'text'
|
|
2455
|
+
},
|
|
2456
|
+
standalone: true,
|
|
2457
|
+
imports: [SlateLeaves]
|
|
2765
2458
|
}]
|
|
2766
|
-
}]
|
|
2459
|
+
}] });
|
|
2767
2460
|
|
|
2768
|
-
|
|
2769
|
-
|
|
2461
|
+
const SLATE_DEFAULT_ELEMENT_COMPONENT_TOKEN = new InjectionToken('slate-default-element-token');
|
|
2462
|
+
|
|
2463
|
+
class SlateDescendant extends ViewContainerItem {
|
|
2464
|
+
get rootNodes() {
|
|
2465
|
+
if (this.blockCardComponentRef) {
|
|
2466
|
+
return [this.blockCardComponentRef.instance.nativeElement];
|
|
2467
|
+
}
|
|
2468
|
+
return super.getRootNodes();
|
|
2469
|
+
}
|
|
2470
|
+
get isBlockCard() {
|
|
2471
|
+
return this.viewContext.editor.isBlockCard(this.descendant);
|
|
2472
|
+
}
|
|
2473
|
+
constructor(viewContainerRef, defaultElementComponentType) {
|
|
2770
2474
|
super(viewContainerRef);
|
|
2771
|
-
this.elementRef = elementRef;
|
|
2772
2475
|
this.viewContainerRef = viewContainerRef;
|
|
2476
|
+
this.defaultElementComponentType = defaultElementComponentType;
|
|
2773
2477
|
}
|
|
2774
2478
|
ngOnInit() {
|
|
2479
|
+
NODE_TO_INDEX.set(this.descendant, this.index);
|
|
2480
|
+
NODE_TO_PARENT.set(this.descendant, this.context.parent);
|
|
2775
2481
|
this.createView();
|
|
2482
|
+
if (this.isBlockCard) {
|
|
2483
|
+
this.createBlockCard();
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2486
|
+
destroyView() {
|
|
2487
|
+
super.destroyView();
|
|
2488
|
+
this.destroyBlockCard();
|
|
2776
2489
|
}
|
|
2777
2490
|
ngOnChanges() {
|
|
2778
2491
|
if (!this.initialized) {
|
|
2779
2492
|
return;
|
|
2780
2493
|
}
|
|
2494
|
+
NODE_TO_INDEX.set(this.descendant, this.index);
|
|
2495
|
+
NODE_TO_PARENT.set(this.descendant, this.context.parent);
|
|
2781
2496
|
this.updateView();
|
|
2497
|
+
if (this.isBlockCard) {
|
|
2498
|
+
this.updateBlockCard();
|
|
2499
|
+
}
|
|
2782
2500
|
}
|
|
2783
|
-
|
|
2784
|
-
this.
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
// to support expected plain text.
|
|
2789
|
-
isLineBreakEmptyString() {
|
|
2790
|
-
return (this.context.leaf.text === '' &&
|
|
2791
|
-
this.context.parent.children[this.context.parent.children.length - 1] === this.context.text &&
|
|
2792
|
-
!this.viewContext.editor.isInline(this.context.parent) &&
|
|
2793
|
-
// [list-render] performance optimization: reduce the number of calls to the `Editor.string(editor, path)` method
|
|
2794
|
-
isEmpty(this.viewContext.editor, this.context.parent));
|
|
2795
|
-
}
|
|
2796
|
-
// COMPAT: If the text is empty, it's because it's on the edge of an inline
|
|
2797
|
-
// node, so we render a zero-width space so that the selection can be
|
|
2798
|
-
// inserted next to it still.
|
|
2799
|
-
isEmptyText() {
|
|
2800
|
-
return this.context.leaf.text === '';
|
|
2501
|
+
destroyBlockCard() {
|
|
2502
|
+
if (this.blockCardComponentRef) {
|
|
2503
|
+
this.blockCardComponentRef.destroy();
|
|
2504
|
+
this.blockCardComponentRef = null;
|
|
2505
|
+
}
|
|
2801
2506
|
}
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2507
|
+
createBlockCard() {
|
|
2508
|
+
const rootNodes = this.rootNodes;
|
|
2509
|
+
this.blockCardComponentRef = this.viewContainerRef.createComponent(SlateBlockCard);
|
|
2510
|
+
this.blockCardComponentRef.instance.initializeCenter(rootNodes);
|
|
2806
2511
|
}
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2512
|
+
updateBlockCard() {
|
|
2513
|
+
if (this.blockCardComponentRef) {
|
|
2514
|
+
return;
|
|
2515
|
+
}
|
|
2516
|
+
const rootNodes = this.rootNodes;
|
|
2517
|
+
this.createBlockCard();
|
|
2518
|
+
const firstRootNode = rootNodes[0];
|
|
2519
|
+
firstRootNode.replaceWith(this.blockCardComponentRef.instance.nativeElement);
|
|
2811
2520
|
}
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2521
|
+
getCommonContext() {
|
|
2522
|
+
const path = AngularEditor.findPath(this.viewContext.editor, this.context.parent);
|
|
2523
|
+
const p = path.concat(this.index);
|
|
2524
|
+
try {
|
|
2525
|
+
const range = Editor.range(this.viewContext.editor, p);
|
|
2526
|
+
const sel = this.context.selection && Range.intersection(range, this.context.selection);
|
|
2527
|
+
const ds = this.context.decorate([this.descendant, p]);
|
|
2528
|
+
for (const dec of this.context.decorations) {
|
|
2529
|
+
const d = Range.intersection(dec, range);
|
|
2530
|
+
if (d) {
|
|
2531
|
+
ds.push(d);
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
return { selection: sel, decorations: ds };
|
|
2815
2535
|
}
|
|
2816
|
-
|
|
2817
|
-
|
|
2536
|
+
catch (error) {
|
|
2537
|
+
this.viewContext.editor.onError({
|
|
2538
|
+
code: SlateErrorCode.GetStartPointError,
|
|
2539
|
+
nativeError: error
|
|
2540
|
+
});
|
|
2541
|
+
return { selection: null, decorations: [] };
|
|
2818
2542
|
}
|
|
2819
|
-
|
|
2820
|
-
|
|
2543
|
+
}
|
|
2544
|
+
getContext() {
|
|
2545
|
+
if (Element.isElement(this.descendant)) {
|
|
2546
|
+
const computedContext = this.getCommonContext();
|
|
2547
|
+
const key = AngularEditor.findKey(this.viewContext.editor, this.descendant);
|
|
2548
|
+
const isInline = this.viewContext.editor.isInline(this.descendant);
|
|
2549
|
+
const isVoid = this.viewContext.editor.isVoid(this.descendant);
|
|
2550
|
+
const elementContext = {
|
|
2551
|
+
element: this.descendant,
|
|
2552
|
+
...computedContext,
|
|
2553
|
+
attributes: {
|
|
2554
|
+
'data-slate-node': 'element',
|
|
2555
|
+
'data-slate-key': key.id
|
|
2556
|
+
},
|
|
2557
|
+
decorate: this.context.decorate,
|
|
2558
|
+
readonly: this.context.readonly
|
|
2559
|
+
};
|
|
2560
|
+
if (isInline) {
|
|
2561
|
+
elementContext.attributes['data-slate-inline'] = true;
|
|
2562
|
+
}
|
|
2563
|
+
if (isVoid) {
|
|
2564
|
+
elementContext.attributes['data-slate-void'] = true;
|
|
2565
|
+
elementContext.attributes.contenteditable = false;
|
|
2566
|
+
}
|
|
2567
|
+
return elementContext;
|
|
2821
2568
|
}
|
|
2822
|
-
|
|
2823
|
-
|
|
2569
|
+
else {
|
|
2570
|
+
const computedContext = this.getCommonContext();
|
|
2571
|
+
const isLeafBlock = AngularEditor.isLeafBlock(this.viewContext.editor, this.context.parent);
|
|
2572
|
+
const textContext = {
|
|
2573
|
+
decorations: computedContext.decorations,
|
|
2574
|
+
isLast: isLeafBlock && this.index === this.context.parent.children.length - 1,
|
|
2575
|
+
parent: this.context.parent,
|
|
2576
|
+
text: this.descendant
|
|
2577
|
+
};
|
|
2578
|
+
return textContext;
|
|
2824
2579
|
}
|
|
2825
|
-
return SlateDefaultString;
|
|
2826
2580
|
}
|
|
2827
|
-
|
|
2828
|
-
if (this.
|
|
2829
|
-
return
|
|
2581
|
+
getViewType() {
|
|
2582
|
+
if (Element.isElement(this.descendant)) {
|
|
2583
|
+
return (this.viewContext.renderElement && this.viewContext.renderElement(this.descendant)) || this.defaultElementComponentType;
|
|
2584
|
+
}
|
|
2585
|
+
else {
|
|
2586
|
+
const isVoid = this.viewContext.editor.isVoid(this.context.parent);
|
|
2587
|
+
return isVoid
|
|
2588
|
+
? SlateVoidText
|
|
2589
|
+
: (this.viewContext.renderText && this.viewContext.renderText(this.descendant)) || SlateDefaultText;
|
|
2830
2590
|
}
|
|
2831
|
-
return 'string';
|
|
2832
2591
|
}
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2592
|
+
memoizedElementContext(prev, next) {
|
|
2593
|
+
return (prev.element === next.element &&
|
|
2594
|
+
(!this.viewContext.isStrictDecorate || prev.decorate === next.decorate) &&
|
|
2595
|
+
prev.readonly === next.readonly &&
|
|
2596
|
+
isDecoratorRangeListEqual(prev.decorations, next.decorations) &&
|
|
2597
|
+
(prev.selection === next.selection || (!!prev.selection && !!next.selection && Range.equals(prev.selection, next.selection))));
|
|
2598
|
+
}
|
|
2599
|
+
memoizedTextContext(prev, next) {
|
|
2600
|
+
return (next.parent === prev.parent &&
|
|
2601
|
+
next.isLast === prev.isLast &&
|
|
2602
|
+
next.text === prev.text &&
|
|
2603
|
+
isDecoratorRangeListEqual(next.decorations, prev.decorations));
|
|
2840
2604
|
}
|
|
2841
2605
|
memoizedContext(prev, next) {
|
|
2842
|
-
|
|
2606
|
+
if (Element.isElement(this.descendant)) {
|
|
2607
|
+
return this.memoizedElementContext(prev, next);
|
|
2608
|
+
}
|
|
2609
|
+
else {
|
|
2610
|
+
return this.memoizedTextContext(prev, next);
|
|
2611
|
+
}
|
|
2843
2612
|
}
|
|
2844
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type:
|
|
2845
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type:
|
|
2613
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateDescendant, deps: [{ token: i0.ViewContainerRef }, { token: SLATE_DEFAULT_ELEMENT_COMPONENT_TOKEN }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2614
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: SlateDescendant, isStandalone: true, selector: "slate-descendant", inputs: { descendant: "descendant", context: "context", viewContext: "viewContext", index: "index" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2846
2615
|
}
|
|
2847
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type:
|
|
2616
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateDescendant, decorators: [{
|
|
2848
2617
|
type: Component,
|
|
2849
2618
|
args: [{
|
|
2850
|
-
selector: '
|
|
2619
|
+
selector: 'slate-descendant',
|
|
2851
2620
|
template: '',
|
|
2852
2621
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2853
2622
|
standalone: true
|
|
2854
2623
|
}]
|
|
2855
|
-
}], ctorParameters: function () { return [{ type: i0.
|
|
2624
|
+
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: undefined, decorators: [{
|
|
2625
|
+
type: Inject,
|
|
2626
|
+
args: [SLATE_DEFAULT_ELEMENT_COMPONENT_TOKEN]
|
|
2627
|
+
}] }]; }, propDecorators: { descendant: [{
|
|
2628
|
+
type: Input
|
|
2629
|
+
}], context: [{
|
|
2630
|
+
type: Input
|
|
2631
|
+
}], viewContext: [{
|
|
2632
|
+
type: Input
|
|
2633
|
+
}], index: [{
|
|
2856
2634
|
type: Input
|
|
2857
2635
|
}] } });
|
|
2858
|
-
/**
|
|
2859
|
-
* TODO: remove when bump slate
|
|
2860
|
-
* copy from slate
|
|
2861
|
-
* @param editor
|
|
2862
|
-
* @param element
|
|
2863
|
-
* @returns
|
|
2864
|
-
*/
|
|
2865
|
-
const isEmpty = (editor, element) => {
|
|
2866
|
-
const { children } = element;
|
|
2867
|
-
const [first] = children;
|
|
2868
|
-
return children.length === 0 || (children.length === 1 && Text$1.isText(first) && first.text === '' && !editor.isVoid(element));
|
|
2869
|
-
};
|
|
2870
2636
|
|
|
2871
|
-
class
|
|
2872
|
-
|
|
2873
|
-
super
|
|
2874
|
-
this.
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
// Because the placeholder span is not in the current component, it is destroyed along with the current component
|
|
2878
|
-
this.destroyPlaceholder();
|
|
2637
|
+
class SlateChildren extends ViewContainer {
|
|
2638
|
+
constructor() {
|
|
2639
|
+
super(...arguments);
|
|
2640
|
+
this.trackBy = (index, node) => {
|
|
2641
|
+
return this.viewContext.trackBy(node) || AngularEditor.findKey(this.viewContext.editor, node);
|
|
2642
|
+
};
|
|
2879
2643
|
}
|
|
2880
|
-
|
|
2881
|
-
static { this.ɵ
|
|
2644
|
+
ngOnInit() { }
|
|
2645
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateChildren, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2646
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: SlateChildren, isStandalone: true, selector: "slate-children", inputs: { children: "children", context: "context", viewContext: "viewContext" }, viewQueries: [{ propertyName: "childrenComponent", predicate: SlateDescendant, descendants: true, read: SlateDescendant }], usesInheritance: true, ngImport: i0, template: `<slate-descendant
|
|
2647
|
+
[descendant]="descendant"
|
|
2648
|
+
[context]="context"
|
|
2649
|
+
[viewContext]="viewContext"
|
|
2650
|
+
[viewContext]="viewContext"
|
|
2651
|
+
[index]="index"
|
|
2652
|
+
*ngFor="let descendant of children; let index = index; trackBy: trackBy"
|
|
2653
|
+
></slate-descendant>`, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: SlateDescendant, selector: "slate-descendant", inputs: ["descendant", "context", "viewContext", "index"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2882
2654
|
}
|
|
2883
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type:
|
|
2655
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateChildren, decorators: [{
|
|
2884
2656
|
type: Component,
|
|
2885
2657
|
args: [{
|
|
2886
|
-
selector: '
|
|
2887
|
-
template: `<
|
|
2658
|
+
selector: 'slate-children',
|
|
2659
|
+
template: `<slate-descendant
|
|
2660
|
+
[descendant]="descendant"
|
|
2661
|
+
[context]="context"
|
|
2662
|
+
[viewContext]="viewContext"
|
|
2663
|
+
[viewContext]="viewContext"
|
|
2664
|
+
[index]="index"
|
|
2665
|
+
*ngFor="let descendant of children; let index = index; trackBy: trackBy"
|
|
2666
|
+
></slate-descendant>`,
|
|
2888
2667
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2889
|
-
host: {
|
|
2890
|
-
'data-slate-leaf': 'true'
|
|
2891
|
-
},
|
|
2892
2668
|
standalone: true,
|
|
2893
|
-
imports: [
|
|
2669
|
+
imports: [NgFor, SlateDescendant]
|
|
2894
2670
|
}]
|
|
2895
|
-
}]
|
|
2896
|
-
|
|
2897
|
-
|
|
2671
|
+
}], propDecorators: { children: [{
|
|
2672
|
+
type: Input
|
|
2673
|
+
}], context: [{
|
|
2674
|
+
type: Input
|
|
2675
|
+
}], viewContext: [{
|
|
2676
|
+
type: Input
|
|
2677
|
+
}], childrenComponent: [{
|
|
2678
|
+
type: ViewChildren,
|
|
2679
|
+
args: [SlateDescendant, { read: SlateDescendant }]
|
|
2680
|
+
}] } });
|
|
2898
2681
|
|
|
2899
2682
|
// not correctly clipboardData on beforeinput
|
|
2900
2683
|
const forceOnDOMPaste = IS_SAFARI;
|
|
@@ -2902,16 +2685,12 @@ class SlateEditable {
|
|
|
2902
2685
|
get hasBeforeInputSupport() {
|
|
2903
2686
|
return HAS_BEFORE_INPUT_SUPPORT;
|
|
2904
2687
|
}
|
|
2905
|
-
constructor(elementRef, renderer2, cdr, ngZone, injector
|
|
2688
|
+
constructor(elementRef, renderer2, cdr, ngZone, injector) {
|
|
2906
2689
|
this.elementRef = elementRef;
|
|
2907
2690
|
this.renderer2 = renderer2;
|
|
2908
2691
|
this.cdr = cdr;
|
|
2909
2692
|
this.ngZone = ngZone;
|
|
2910
2693
|
this.injector = injector;
|
|
2911
|
-
this.defaultElement = defaultElement;
|
|
2912
|
-
this.defaultText = defaultText;
|
|
2913
|
-
this.defaultVoidText = defaultVoidText;
|
|
2914
|
-
this.defaultLeaf = defaultLeaf;
|
|
2915
2694
|
this.destroy$ = new Subject();
|
|
2916
2695
|
this.isComposing = false;
|
|
2917
2696
|
this.isDraggingInternally = false;
|
|
@@ -2933,10 +2712,6 @@ class SlateEditable {
|
|
|
2933
2712
|
this.dataSlateEditor = true;
|
|
2934
2713
|
this.dataSlateNode = 'value';
|
|
2935
2714
|
this.dataGramm = false;
|
|
2936
|
-
this.viewContainerRef = inject(ViewContainerRef);
|
|
2937
|
-
this.getOutletParent = () => {
|
|
2938
|
-
return this.elementRef.nativeElement;
|
|
2939
|
-
};
|
|
2940
2715
|
}
|
|
2941
2716
|
ngOnInit() {
|
|
2942
2717
|
this.editor.injector = this.injector;
|
|
@@ -2962,7 +2737,6 @@ class SlateEditable {
|
|
|
2962
2737
|
// add browser class
|
|
2963
2738
|
let browserClass = IS_FIREFOX ? 'firefox' : IS_SAFARI ? 'safari' : '';
|
|
2964
2739
|
browserClass && this.elementRef.nativeElement.classList.add(browserClass);
|
|
2965
|
-
this.listRender = new ListRender(this.viewContext, this.viewContainerRef, this.getOutletParent, () => null);
|
|
2966
2740
|
}
|
|
2967
2741
|
ngOnChanges(simpleChanges) {
|
|
2968
2742
|
if (!this.initialized) {
|
|
@@ -2970,16 +2744,16 @@ class SlateEditable {
|
|
|
2970
2744
|
}
|
|
2971
2745
|
const decorateChange = simpleChanges['decorate'];
|
|
2972
2746
|
if (decorateChange) {
|
|
2973
|
-
this.
|
|
2747
|
+
this.forceFlush();
|
|
2974
2748
|
}
|
|
2975
2749
|
const placeholderChange = simpleChanges['placeholder'];
|
|
2976
2750
|
if (placeholderChange) {
|
|
2977
|
-
this.
|
|
2751
|
+
this.detectContext();
|
|
2978
2752
|
}
|
|
2979
2753
|
const readonlyChange = simpleChanges['readonly'];
|
|
2980
2754
|
if (readonlyChange) {
|
|
2981
2755
|
IS_READONLY.set(this.editor, this.readonly);
|
|
2982
|
-
this.
|
|
2756
|
+
this.detectContext();
|
|
2983
2757
|
this.toSlateSelection();
|
|
2984
2758
|
}
|
|
2985
2759
|
}
|
|
@@ -3003,12 +2777,6 @@ class SlateEditable {
|
|
|
3003
2777
|
this.editor.children = normalize(value);
|
|
3004
2778
|
}
|
|
3005
2779
|
this.initializeContext();
|
|
3006
|
-
if (!this.listRender.initialized) {
|
|
3007
|
-
this.listRender.initialize(this.editor.children, this.editor, this.context);
|
|
3008
|
-
}
|
|
3009
|
-
else {
|
|
3010
|
-
this.listRender.update(this.editor.children, this.editor, this.context);
|
|
3011
|
-
}
|
|
3012
2780
|
this.cdr.markForCheck();
|
|
3013
2781
|
}
|
|
3014
2782
|
}
|
|
@@ -3118,14 +2886,14 @@ class SlateEditable {
|
|
|
3118
2886
|
}
|
|
3119
2887
|
}
|
|
3120
2888
|
onChange() {
|
|
3121
|
-
this.
|
|
2889
|
+
this.forceFlush();
|
|
3122
2890
|
this.onChangeCallback(this.editor.children);
|
|
3123
2891
|
}
|
|
3124
2892
|
ngAfterViewChecked() { }
|
|
3125
2893
|
ngDoCheck() { }
|
|
3126
|
-
|
|
3127
|
-
this.
|
|
3128
|
-
this.
|
|
2894
|
+
forceFlush() {
|
|
2895
|
+
this.detectContext();
|
|
2896
|
+
this.cdr.detectChanges();
|
|
3129
2897
|
// repair collaborative editing when Chinese input is interrupted by other users' cursors
|
|
3130
2898
|
// when the DOMElement where the selection is located is removed
|
|
3131
2899
|
// the compositionupdate and compositionend events will no longer be fired
|
|
@@ -3161,29 +2929,6 @@ class SlateEditable {
|
|
|
3161
2929
|
}
|
|
3162
2930
|
this.toNativeSelection();
|
|
3163
2931
|
}
|
|
3164
|
-
render() {
|
|
3165
|
-
const changed = this.updateContext();
|
|
3166
|
-
if (changed) {
|
|
3167
|
-
this.listRender.update(this.editor.children, this.editor, this.context);
|
|
3168
|
-
}
|
|
3169
|
-
}
|
|
3170
|
-
updateContext() {
|
|
3171
|
-
const decorations = this.generateDecorations();
|
|
3172
|
-
if (this.context.selection !== this.editor.selection ||
|
|
3173
|
-
this.context.decorate !== this.decorate ||
|
|
3174
|
-
this.context.readonly !== this.readonly ||
|
|
3175
|
-
!isDecoratorRangeListEqual(this.context.decorations, decorations)) {
|
|
3176
|
-
this.context = {
|
|
3177
|
-
parent: this.editor,
|
|
3178
|
-
selection: this.editor.selection,
|
|
3179
|
-
decorations: decorations,
|
|
3180
|
-
decorate: this.decorate,
|
|
3181
|
-
readonly: this.readonly
|
|
3182
|
-
};
|
|
3183
|
-
return true;
|
|
3184
|
-
}
|
|
3185
|
-
return false;
|
|
3186
|
-
}
|
|
3187
2932
|
initializeContext() {
|
|
3188
2933
|
this.context = {
|
|
3189
2934
|
parent: this.editor,
|
|
@@ -3201,13 +2946,24 @@ class SlateEditable {
|
|
|
3201
2946
|
renderText: this.renderText,
|
|
3202
2947
|
trackBy: this.trackBy,
|
|
3203
2948
|
isStrictDecorate: this.isStrictDecorate,
|
|
3204
|
-
templateComponent: this.templateComponent
|
|
3205
|
-
defaultElement: this.defaultElement,
|
|
3206
|
-
defaultText: this.defaultText,
|
|
3207
|
-
defaultVoidText: this.defaultVoidText,
|
|
3208
|
-
defaultLeaf: this.defaultLeaf
|
|
2949
|
+
templateComponent: this.templateComponent
|
|
3209
2950
|
};
|
|
3210
2951
|
}
|
|
2952
|
+
detectContext() {
|
|
2953
|
+
const decorations = this.generateDecorations();
|
|
2954
|
+
if (this.context.selection !== this.editor.selection ||
|
|
2955
|
+
this.context.decorate !== this.decorate ||
|
|
2956
|
+
this.context.readonly !== this.readonly ||
|
|
2957
|
+
!isDecoratorRangeListEqual(this.context.decorations, decorations)) {
|
|
2958
|
+
this.context = {
|
|
2959
|
+
parent: this.editor,
|
|
2960
|
+
selection: this.editor.selection,
|
|
2961
|
+
decorations: decorations,
|
|
2962
|
+
decorate: this.decorate,
|
|
2963
|
+
readonly: this.readonly
|
|
2964
|
+
};
|
|
2965
|
+
}
|
|
2966
|
+
}
|
|
3211
2967
|
composePlaceholderDecorate(editor) {
|
|
3212
2968
|
if (this.placeholderDecorate) {
|
|
3213
2969
|
return this.placeholderDecorate(editor) || [];
|
|
@@ -3511,13 +3267,14 @@ class SlateEditable {
|
|
|
3511
3267
|
// solve the problem of cross node Chinese input
|
|
3512
3268
|
if (Range.isExpanded(selection)) {
|
|
3513
3269
|
Editor.deleteFragment(this.editor);
|
|
3514
|
-
this.
|
|
3270
|
+
this.forceFlush();
|
|
3515
3271
|
}
|
|
3516
3272
|
}
|
|
3517
3273
|
if (hasEditableTarget(this.editor, event.target) && !this.isDOMEventHandled(event, this.compositionStart)) {
|
|
3518
3274
|
this.isComposing = true;
|
|
3519
3275
|
}
|
|
3520
|
-
this.
|
|
3276
|
+
this.detectContext();
|
|
3277
|
+
this.cdr.detectChanges();
|
|
3521
3278
|
}
|
|
3522
3279
|
onDOMCompositionUpdate(event) {
|
|
3523
3280
|
this.isDOMEventHandled(event, this.compositionUpdate);
|
|
@@ -3539,7 +3296,8 @@ class SlateEditable {
|
|
|
3539
3296
|
// so we need avoid repeat isnertText by isComposing === true,
|
|
3540
3297
|
this.isComposing = false;
|
|
3541
3298
|
}
|
|
3542
|
-
this.
|
|
3299
|
+
this.detectContext();
|
|
3300
|
+
this.cdr.detectChanges();
|
|
3543
3301
|
}
|
|
3544
3302
|
onDOMCopy(event) {
|
|
3545
3303
|
const window = AngularEditor.getWindow(this.editor);
|
|
@@ -3565,7 +3323,7 @@ class SlateEditable {
|
|
|
3565
3323
|
// that drops are allowed. Editable content is droppable by
|
|
3566
3324
|
// default, and calling `preventDefault` hides the cursor.
|
|
3567
3325
|
const node = AngularEditor.toSlateNode(this.editor, event.target);
|
|
3568
|
-
if (
|
|
3326
|
+
if (Editor.isVoid(this.editor, node)) {
|
|
3569
3327
|
event.preventDefault();
|
|
3570
3328
|
}
|
|
3571
3329
|
}
|
|
@@ -3574,7 +3332,7 @@ class SlateEditable {
|
|
|
3574
3332
|
if (!this.readonly && hasTarget(this.editor, event.target) && !this.isDOMEventHandled(event, this.dragStart)) {
|
|
3575
3333
|
const node = AngularEditor.toSlateNode(this.editor, event.target);
|
|
3576
3334
|
const path = AngularEditor.findPath(this.editor, node);
|
|
3577
|
-
const voidMatch =
|
|
3335
|
+
const voidMatch = Editor.isVoid(this.editor, node) || Editor.void(this.editor, { at: path, voids: true });
|
|
3578
3336
|
// If starting a drag on a void node, make sure it is selected
|
|
3579
3337
|
// so that it shows up in the selection's fragment.
|
|
3580
3338
|
if (voidMatch) {
|
|
@@ -3912,30 +3670,14 @@ class SlateEditable {
|
|
|
3912
3670
|
this.destroy$.complete();
|
|
3913
3671
|
EDITOR_TO_ON_CHANGE.delete(this.editor);
|
|
3914
3672
|
}
|
|
3915
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateEditable, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: i0.Injector }
|
|
3673
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateEditable, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3916
3674
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: SlateEditable, isStandalone: true, selector: "slate-editable", inputs: { editor: "editor", renderElement: "renderElement", renderLeaf: "renderLeaf", renderText: "renderText", decorate: "decorate", placeholderDecorate: "placeholderDecorate", scrollSelectionIntoView: "scrollSelectionIntoView", isStrictDecorate: "isStrictDecorate", trackBy: "trackBy", readonly: "readonly", placeholder: "placeholder", beforeInput: "beforeInput", blur: "blur", click: "click", compositionEnd: "compositionEnd", compositionUpdate: "compositionUpdate", 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: [
|
|
3917
3675
|
{
|
|
3918
3676
|
provide: NG_VALUE_ACCESSOR,
|
|
3919
3677
|
useExisting: forwardRef(() => SlateEditable),
|
|
3920
3678
|
multi: true
|
|
3921
|
-
},
|
|
3922
|
-
{
|
|
3923
|
-
provide: SLATE_DEFAULT_ELEMENT_COMPONENT_TOKEN,
|
|
3924
|
-
useValue: SlateDefaultElement
|
|
3925
|
-
},
|
|
3926
|
-
{
|
|
3927
|
-
provide: SLATE_DEFAULT_TEXT_COMPONENT_TOKEN,
|
|
3928
|
-
useValue: SlateDefaultText
|
|
3929
|
-
},
|
|
3930
|
-
{
|
|
3931
|
-
provide: SLATE_DEFAULT_VOID_TEXT_COMPONENT_TOKEN,
|
|
3932
|
-
useValue: SlateVoidText
|
|
3933
|
-
},
|
|
3934
|
-
{
|
|
3935
|
-
provide: SLATE_DEFAULT_LEAF_COMPONENT_TOKEN,
|
|
3936
|
-
useValue: SlateDefaultLeaf
|
|
3937
3679
|
}
|
|
3938
|
-
], 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-string-template #templateComponent></slate-string-template>\n", dependencies: [{ kind: "component", type: SlateStringTemplate, selector: "slate-string-template" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3680
|
+
], 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>\n", dependencies: [{ kind: "component", type: SlateChildren, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { kind: "component", type: SlateStringTemplate, selector: "slate-string-template" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3939
3681
|
}
|
|
3940
3682
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateEditable, decorators: [{
|
|
3941
3683
|
type: Component,
|
|
@@ -3951,37 +3693,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImpor
|
|
|
3951
3693
|
provide: NG_VALUE_ACCESSOR,
|
|
3952
3694
|
useExisting: forwardRef(() => SlateEditable),
|
|
3953
3695
|
multi: true
|
|
3954
|
-
},
|
|
3955
|
-
{
|
|
3956
|
-
provide: SLATE_DEFAULT_ELEMENT_COMPONENT_TOKEN,
|
|
3957
|
-
useValue: SlateDefaultElement
|
|
3958
|
-
},
|
|
3959
|
-
{
|
|
3960
|
-
provide: SLATE_DEFAULT_TEXT_COMPONENT_TOKEN,
|
|
3961
|
-
useValue: SlateDefaultText
|
|
3962
|
-
},
|
|
3963
|
-
{
|
|
3964
|
-
provide: SLATE_DEFAULT_VOID_TEXT_COMPONENT_TOKEN,
|
|
3965
|
-
useValue: SlateVoidText
|
|
3966
|
-
},
|
|
3967
|
-
{
|
|
3968
|
-
provide: SLATE_DEFAULT_LEAF_COMPONENT_TOKEN,
|
|
3969
|
-
useValue: SlateDefaultLeaf
|
|
3970
3696
|
}
|
|
3971
|
-
], standalone: true, imports: [SlateChildren, SlateStringTemplate], template: "<slate-string-template #templateComponent></slate-string-template>\n" }]
|
|
3972
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: i0.Injector },
|
|
3973
|
-
type: Inject,
|
|
3974
|
-
args: [SLATE_DEFAULT_ELEMENT_COMPONENT_TOKEN]
|
|
3975
|
-
}] }, { type: undefined, decorators: [{
|
|
3976
|
-
type: Inject,
|
|
3977
|
-
args: [SLATE_DEFAULT_TEXT_COMPONENT_TOKEN]
|
|
3978
|
-
}] }, { type: undefined, decorators: [{
|
|
3979
|
-
type: Inject,
|
|
3980
|
-
args: [SLATE_DEFAULT_VOID_TEXT_COMPONENT_TOKEN]
|
|
3981
|
-
}] }, { type: undefined, decorators: [{
|
|
3982
|
-
type: Inject,
|
|
3983
|
-
args: [SLATE_DEFAULT_LEAF_COMPONENT_TOKEN]
|
|
3984
|
-
}] }]; }, propDecorators: { editor: [{
|
|
3697
|
+
], standalone: true, imports: [SlateChildren, SlateStringTemplate], template: "<slate-children [children]=\"editor.children\" [context]=\"context\" [viewContext]=\"viewContext\"></slate-children>\n<slate-string-template #templateComponent></slate-string-template>\n" }]
|
|
3698
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: i0.Injector }]; }, propDecorators: { editor: [{
|
|
3985
3699
|
type: Input
|
|
3986
3700
|
}], renderElement: [{
|
|
3987
3701
|
type: Input
|
|
@@ -4097,7 +3811,7 @@ const hasTarget = (editor, target) => {
|
|
|
4097
3811
|
*/
|
|
4098
3812
|
const isTargetInsideVoid = (editor, target) => {
|
|
4099
3813
|
const slateNode = hasTarget(editor, target) && AngularEditor.toSlateNode(editor, target);
|
|
4100
|
-
return
|
|
3814
|
+
return Editor.isVoid(editor, slateNode);
|
|
4101
3815
|
};
|
|
4102
3816
|
const hasStringTarget = (domSelection) => {
|
|
4103
3817
|
return ((domSelection.anchorNode.parentElement.hasAttribute('data-slate-string') ||
|
|
@@ -4126,13 +3840,28 @@ const preventInsertFromComposition = (event, editor) => {
|
|
|
4126
3840
|
|
|
4127
3841
|
class SlateElement extends BaseElementComponent {
|
|
4128
3842
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateElement, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
4129
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: SlateElement, isStandalone: true, selector: "[slateElement]", usesInheritance: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3843
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: SlateElement, isStandalone: true, selector: "[slateElement]", usesInheritance: true, ngImport: i0, template: '<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children><ng-content></ng-content>', isInline: true, dependencies: [{ kind: "component", type: SlateChildren, selector: "slate-children", inputs: ["children", "context", "viewContext"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
4130
3844
|
}
|
|
4131
3845
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateElement, decorators: [{
|
|
4132
3846
|
type: Component,
|
|
4133
3847
|
args: [{
|
|
4134
3848
|
selector: '[slateElement]',
|
|
4135
|
-
template: '<ng-content></ng-content>',
|
|
3849
|
+
template: '<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children><ng-content></ng-content>',
|
|
3850
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3851
|
+
standalone: true,
|
|
3852
|
+
imports: [SlateChildren]
|
|
3853
|
+
}]
|
|
3854
|
+
}] });
|
|
3855
|
+
|
|
3856
|
+
class SlateDefaultElement extends BaseElementComponent {
|
|
3857
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateDefaultElement, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
3858
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: SlateDefaultElement, isStandalone: true, selector: "div[slateDefaultElement]", usesInheritance: true, ngImport: i0, template: `<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>`, isInline: true, dependencies: [{ kind: "component", type: SlateChildren, selector: "slate-children", inputs: ["children", "context", "viewContext"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3859
|
+
}
|
|
3860
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateDefaultElement, decorators: [{
|
|
3861
|
+
type: Component,
|
|
3862
|
+
args: [{
|
|
3863
|
+
selector: 'div[slateDefaultElement]',
|
|
3864
|
+
template: `<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>`,
|
|
4136
3865
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
4137
3866
|
standalone: true,
|
|
4138
3867
|
imports: [SlateChildren]
|
|
@@ -4149,12 +3878,18 @@ class SlateModule {
|
|
|
4149
3878
|
SlateDefaultText,
|
|
4150
3879
|
SlateString,
|
|
4151
3880
|
SlateStringTemplate,
|
|
3881
|
+
SlateDescendant,
|
|
4152
3882
|
SlateChildren,
|
|
4153
3883
|
SlateBlockCard,
|
|
3884
|
+
SlateLeaf,
|
|
4154
3885
|
SlateLeaves,
|
|
4155
3886
|
SlateDefaultLeaf,
|
|
4156
|
-
SlateDefaultString,
|
|
4157
|
-
|
|
3887
|
+
SlateDefaultString], exports: [SlateEditable,
|
|
3888
|
+
SlateChildren,
|
|
3889
|
+
SlateElement,
|
|
3890
|
+
SlateLeaves,
|
|
3891
|
+
SlateString,
|
|
3892
|
+
SlateDefaultString] }); }
|
|
4158
3893
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: SlateModule, providers: [
|
|
4159
3894
|
{
|
|
4160
3895
|
provide: SLATE_DEFAULT_ELEMENT_COMPONENT_TOKEN,
|
|
@@ -4174,14 +3909,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImpor
|
|
|
4174
3909
|
SlateDefaultText,
|
|
4175
3910
|
SlateString,
|
|
4176
3911
|
SlateStringTemplate,
|
|
3912
|
+
SlateDescendant,
|
|
4177
3913
|
SlateChildren,
|
|
4178
3914
|
SlateBlockCard,
|
|
3915
|
+
SlateLeaf,
|
|
4179
3916
|
SlateLeaves,
|
|
4180
3917
|
SlateDefaultLeaf,
|
|
4181
|
-
SlateDefaultString
|
|
4182
|
-
|
|
3918
|
+
SlateDefaultString
|
|
3919
|
+
],
|
|
3920
|
+
exports: [
|
|
3921
|
+
SlateEditable,
|
|
3922
|
+
SlateChildren,
|
|
3923
|
+
SlateElement,
|
|
3924
|
+
SlateLeaves,
|
|
3925
|
+
SlateString,
|
|
3926
|
+
SlateDefaultString
|
|
4183
3927
|
],
|
|
4184
|
-
exports: [SlateEditable, SlateChildren, SlateChildrenOutlet, SlateElement, SlateLeaves, SlateString, SlateDefaultString],
|
|
4185
3928
|
providers: [
|
|
4186
3929
|
{
|
|
4187
3930
|
provide: SLATE_DEFAULT_ELEMENT_COMPONENT_TOKEN,
|
|
@@ -4199,5 +3942,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImpor
|
|
|
4199
3942
|
* Generated bundle index. Do not edit.
|
|
4200
3943
|
*/
|
|
4201
3944
|
|
|
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,
|
|
3945
|
+
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, 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, isPlainTextOnlyPaste, isTemplateRef, isValid, normalize, normalizeDOMPoint, shallowCompare, withAngular };
|
|
4203
3946
|
//# sourceMappingURL=slate-angular.mjs.map
|