slate-angular 15.0.0 → 15.1.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/block-card/block-card.component.d.ts +1 -1
- package/components/block-card/block-card.component.scss +3 -2
- package/components/children/children.component.d.ts +4 -4
- package/components/descendant/descendant.component.d.ts +5 -5
- package/components/element/default-element.component.token.d.ts +3 -3
- package/components/leaf/default-leaf.component.d.ts +2 -2
- package/components/leaf/leaf.component.d.ts +5 -5
- package/components/leaves/leaves.component.d.ts +4 -4
- package/components/string/default-string.component.d.ts +13 -0
- package/components/string/string.component.d.ts +2 -1
- package/components/string/template.component.d.ts +0 -1
- package/esm2020/components/block-card/block-card.component.mjs +5 -5
- package/esm2020/components/children/children.component.mjs +22 -19
- package/esm2020/components/descendant/descendant.component.mjs +19 -17
- package/esm2020/components/editable/editable.component.mjs +129 -48
- package/esm2020/components/element/default-element.component.mjs +1 -1
- package/esm2020/components/element/default-element.component.token.mjs +2 -2
- package/esm2020/components/element/element.component.mjs +1 -1
- package/esm2020/components/leaf/default-leaf.component.mjs +5 -5
- package/esm2020/components/leaf/leaf.component.mjs +6 -6
- package/esm2020/components/leaves/leaves.component.mjs +15 -13
- package/esm2020/components/string/default-string.component.mjs +31 -0
- package/esm2020/components/string/string.component.mjs +7 -3
- package/esm2020/components/string/template.component.mjs +8 -8
- package/esm2020/components/text/default-text.component.mjs +1 -1
- package/esm2020/components/text/void-text.component.mjs +3 -3
- package/esm2020/custom-event/BeforeInputEventPlugin.mjs +1 -1
- package/esm2020/custom-event/before-input-polyfill.mjs +2 -2
- package/esm2020/module.mjs +21 -6
- package/esm2020/plugins/angular-editor.mjs +33 -50
- package/esm2020/plugins/with-angular.mjs +11 -8
- package/esm2020/public-api.mjs +2 -1
- package/esm2020/types/error.mjs +1 -1
- package/esm2020/types/feature.mjs +1 -1
- package/esm2020/types/view.mjs +1 -1
- package/esm2020/utils/block-card.mjs +1 -1
- package/esm2020/utils/dom.mjs +4 -8
- package/esm2020/utils/environment.mjs +5 -9
- package/esm2020/utils/global-normalize.mjs +5 -8
- package/esm2020/utils/hotkeys.mjs +1 -1
- package/esm2020/utils/index.mjs +1 -1
- package/esm2020/utils/lines.mjs +1 -1
- package/esm2020/utils/range-list.mjs +1 -1
- package/esm2020/utils/restore-dom.mjs +33 -0
- package/esm2020/utils/view.mjs +2 -2
- package/esm2020/utils/weak-maps.mjs +1 -1
- package/esm2020/view/base.mjs +4 -4
- package/esm2020/view/before-context-change.mjs +1 -1
- package/esm2020/view/container-item.mjs +13 -7
- package/esm2020/view/container.mjs +5 -5
- package/esm2020/view/context.mjs +1 -1
- package/fesm2015/slate-angular.mjs +327 -181
- package/fesm2015/slate-angular.mjs.map +1 -1
- package/fesm2020/slate-angular.mjs +327 -182
- package/fesm2020/slate-angular.mjs.map +1 -1
- package/module.d.ts +3 -2
- package/package.json +1 -1
- package/plugins/angular-editor.d.ts +4 -4
- package/public-api.d.ts +1 -0
- package/styles/index.scss +3 -4
- package/types/error.d.ts +1 -1
- package/types/feature.d.ts +1 -1
- package/types/view.d.ts +1 -1
- package/utils/block-card.d.ts +1 -1
- package/utils/dom.d.ts +3 -3
- package/utils/global-normalize.d.ts +1 -1
- package/utils/restore-dom.d.ts +2 -0
- package/utils/view.d.ts +2 -2
- package/view/base.d.ts +4 -4
- package/view/container-item.d.ts +5 -5
- package/view/container.d.ts +3 -3
- package/view/context.d.ts +5 -5
package/module.d.ts
CHANGED
|
@@ -12,9 +12,10 @@ import * as i10 from "./components/block-card/block-card.component";
|
|
|
12
12
|
import * as i11 from "./components/leaf/leaf.component";
|
|
13
13
|
import * as i12 from "./components/leaves/leaves.component";
|
|
14
14
|
import * as i13 from "./components/leaf/default-leaf.component";
|
|
15
|
-
import * as i14 from "
|
|
15
|
+
import * as i14 from "./components/string/default-string.component";
|
|
16
|
+
import * as i15 from "@angular/common";
|
|
16
17
|
export declare class SlateModule {
|
|
17
18
|
static ɵfac: i0.ɵɵFactoryDeclaration<SlateModule, never>;
|
|
18
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<SlateModule, [typeof i1.SlateEditableComponent, typeof i2.SlateDefaultElementComponent, typeof i3.SlateElementComponent, typeof i4.SlateVoidTextComponent, typeof i5.SlateDefaultTextComponent, typeof i6.SlateStringComponent, typeof i7.SlateStringTemplateComponent, typeof i8.SlateDescendantComponent, typeof i9.SlateChildrenComponent, typeof i10.SlateBlockCardComponent, typeof i11.SlateLeafComponent, typeof i12.SlateLeavesComponent, typeof i13.SlateDefaultLeafComponent], [typeof
|
|
19
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<SlateModule, [typeof i1.SlateEditableComponent, typeof i2.SlateDefaultElementComponent, typeof i3.SlateElementComponent, typeof i4.SlateVoidTextComponent, typeof i5.SlateDefaultTextComponent, typeof i6.SlateStringComponent, typeof i7.SlateStringTemplateComponent, typeof i8.SlateDescendantComponent, typeof i9.SlateChildrenComponent, typeof i10.SlateBlockCardComponent, typeof i11.SlateLeafComponent, typeof i12.SlateLeavesComponent, typeof i13.SlateDefaultLeafComponent, typeof i14.SlateDefaultStringComponent], [typeof i15.CommonModule], [typeof i1.SlateEditableComponent, typeof i9.SlateChildrenComponent, typeof i3.SlateElementComponent, typeof i12.SlateLeavesComponent, typeof i6.SlateStringComponent, typeof i14.SlateDefaultStringComponent]>;
|
|
19
20
|
static ɵinj: i0.ɵɵInjectorDeclaration<SlateModule>;
|
|
20
21
|
}
|
package/package.json
CHANGED
|
@@ -76,8 +76,8 @@ export declare const AngularEditor: {
|
|
|
76
76
|
*/
|
|
77
77
|
insertData(editor: AngularEditor, data: DataTransfer): void;
|
|
78
78
|
/**
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
* Insert fragment data from a `DataTransfer` into the editor.
|
|
80
|
+
*/
|
|
81
81
|
insertFragmentData(editor: AngularEditor, data: DataTransfer): boolean;
|
|
82
82
|
/**
|
|
83
83
|
* Insert text data from a `DataTransfer` into the editor.
|
|
@@ -88,8 +88,8 @@ export declare const AngularEditor: {
|
|
|
88
88
|
*/
|
|
89
89
|
onKeydown(editor: AngularEditor, data: KeyboardEvent): void;
|
|
90
90
|
/**
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
* onClick hook.
|
|
92
|
+
*/
|
|
93
93
|
onClick(editor: AngularEditor, data: MouseEvent): void;
|
|
94
94
|
/**
|
|
95
95
|
* Sets data from the currently selected fragment on a `DataTransfer`.
|
package/public-api.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './plugins/with-angular';
|
|
|
3
3
|
export * from './components/editable/editable.component';
|
|
4
4
|
export * from './components/element/element.component';
|
|
5
5
|
export * from './components/string/string.component';
|
|
6
|
+
export * from './components/string/default-string.component';
|
|
6
7
|
export * from './components/children/children.component';
|
|
7
8
|
export * from './components/leaves/leaves.component';
|
|
8
9
|
export * from './module';
|
package/styles/index.scss
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
outline: none;
|
|
5
5
|
padding: 32px;
|
|
6
6
|
white-space: break-spaces;
|
|
7
|
-
& [contenteditable=
|
|
7
|
+
& [contenteditable='true'] {
|
|
8
8
|
outline: none;
|
|
9
9
|
}
|
|
10
10
|
& [data-slate-placeholder] {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
text-decoration: none;
|
|
19
19
|
top: 0;
|
|
20
20
|
}
|
|
21
|
-
& [data-slate-leaf=
|
|
21
|
+
& [data-slate-leaf='true'] {
|
|
22
22
|
&.leaf-with-placeholder {
|
|
23
23
|
position: relative;
|
|
24
24
|
display: inline-block;
|
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
.leaf-with-placeholder {
|
|
33
33
|
display: inline-flex !important;
|
|
34
34
|
}
|
|
35
|
-
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
37
|
|
|
@@ -41,4 +40,4 @@
|
|
|
41
40
|
color: transparent;
|
|
42
41
|
outline: none;
|
|
43
42
|
position: absolute;
|
|
44
|
-
}
|
|
43
|
+
}
|
package/types/error.d.ts
CHANGED
package/types/feature.d.ts
CHANGED
package/types/view.d.ts
CHANGED
package/utils/block-card.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DOMNode, DOMSelection } from
|
|
1
|
+
import { DOMNode, DOMSelection } from './dom';
|
|
2
2
|
export declare const FAKE_LEFT_BLOCK_CARD_OFFSET = -1;
|
|
3
3
|
export declare const FAKE_RIGHT_BLOCK_CARD_OFFSET = -2;
|
|
4
4
|
export declare function hasBlockCardWithNode(node: DOMNode): boolean;
|
package/utils/dom.d.ts
CHANGED
|
@@ -11,9 +11,9 @@ import DOMStaticRange = globalThis.StaticRange;
|
|
|
11
11
|
export { DOMNode, DOMComment, DOMElement, DOMText, DOMRange, DOMSelection, DOMStaticRange };
|
|
12
12
|
declare global {
|
|
13
13
|
interface Window {
|
|
14
|
-
Selection: typeof Selection['constructor'];
|
|
15
|
-
DataTransfer: typeof DataTransfer['constructor'];
|
|
16
|
-
Node: typeof Node['constructor'];
|
|
14
|
+
Selection: (typeof Selection)['constructor'];
|
|
15
|
+
DataTransfer: (typeof DataTransfer)['constructor'];
|
|
16
|
+
Node: (typeof Node)['constructor'];
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
export type DOMPoint = [Node, number];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Descendant, Element } from
|
|
1
|
+
import { Descendant, Element } from 'slate';
|
|
2
2
|
declare const isValid: (value: Descendant) => any;
|
|
3
3
|
declare const check: (document: Element[]) => boolean;
|
|
4
4
|
declare function normalize(document: Element[]): import("slate").BaseElement[];
|
package/utils/view.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TemplateRef } from
|
|
2
|
-
import { ComponentType, ViewType } from
|
|
1
|
+
import { TemplateRef } from '@angular/core';
|
|
2
|
+
import { ComponentType, ViewType } from '../types/view';
|
|
3
3
|
export declare function isTemplateRef<C>(value: ViewType): value is TemplateRef<C>;
|
|
4
4
|
export declare function isComponentType<T>(value: ViewType): value is ComponentType<T>;
|
package/view/base.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ChangeDetectorRef, ElementRef, OnDestroy, OnInit } from
|
|
2
|
-
import { AngularEditor } from
|
|
3
|
-
import { SlateViewContext, SlateElementContext, SlateTextContext, SlateLeafContext } from
|
|
1
|
+
import { ChangeDetectorRef, ElementRef, OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
import { AngularEditor } from '../plugins/angular-editor';
|
|
3
|
+
import { SlateViewContext, SlateElementContext, SlateTextContext, SlateLeafContext } from './context';
|
|
4
4
|
import { Descendant, Element, Range, Text } from 'slate';
|
|
5
|
-
import { SlateChildrenContext } from
|
|
5
|
+
import { SlateChildrenContext } from './context';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
/**
|
|
8
8
|
* base class for template
|
package/view/container-item.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ComponentRef, EmbeddedViewRef, ViewContainerRef } from
|
|
2
|
-
import { SlateBlockCardComponent } from
|
|
3
|
-
import { ViewType } from
|
|
4
|
-
import { BaseComponent, BaseEmbeddedView } from
|
|
5
|
-
import { SlateElementContext, SlateLeafContext, SlateStringContext, SlateTextContext, SlateViewContext } from
|
|
1
|
+
import { ComponentRef, EmbeddedViewRef, ViewContainerRef } from '@angular/core';
|
|
2
|
+
import { SlateBlockCardComponent } from '../components/block-card/block-card.component';
|
|
3
|
+
import { ViewType } from '../types/view';
|
|
4
|
+
import { BaseComponent, BaseEmbeddedView } from './base';
|
|
5
|
+
import { SlateElementContext, SlateLeafContext, SlateStringContext, SlateTextContext, SlateViewContext } from './context';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
/**
|
|
8
8
|
* Dynamically create/update components or templates
|
package/view/container.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AfterViewInit, ElementRef, IterableChangeRecord, IterableDiffers, QueryList } from
|
|
2
|
-
import { SlateViewContext } from
|
|
3
|
-
import { ViewContainerItem } from
|
|
1
|
+
import { AfterViewInit, ElementRef, IterableChangeRecord, IterableDiffers, QueryList } from '@angular/core';
|
|
2
|
+
import { SlateViewContext } from './context';
|
|
3
|
+
import { ViewContainerItem } from './container-item';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
/**
|
|
6
6
|
* the sepcial container for angular template
|
package/view/context.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { NodeEntry, Range, Element, Ancestor, Text } from
|
|
2
|
-
import { SlateStringTemplateComponent } from
|
|
3
|
-
import { AngularEditor } from
|
|
4
|
-
import { ViewType } from
|
|
1
|
+
import { NodeEntry, Range, Element, Ancestor, Text } from 'slate';
|
|
2
|
+
import { SlateStringTemplateComponent } from '../components/string/template.component';
|
|
3
|
+
import { AngularEditor } from '../plugins/angular-editor';
|
|
4
|
+
import { ViewType } from '../types/view';
|
|
5
5
|
export interface SlateViewContext<T extends AngularEditor = AngularEditor> {
|
|
6
6
|
editor: T;
|
|
7
7
|
templateComponent: SlateStringTemplateComponent;
|
|
@@ -43,7 +43,7 @@ export interface SlateElementAttributes {
|
|
|
43
43
|
'data-slate-node': 'element';
|
|
44
44
|
'data-slate-void'?: boolean;
|
|
45
45
|
'data-slate-inline'?: boolean;
|
|
46
|
-
|
|
46
|
+
contenteditable?: boolean;
|
|
47
47
|
'data-slate-key'?: string;
|
|
48
48
|
dir?: 'rtl';
|
|
49
49
|
}
|