slate-angular 15.1.0-next.3 → 15.1.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/editable/editable.component.d.ts +10 -3
- package/esm2020/components/editable/editable.component.mjs +26 -20
- package/esm2020/components/string/default-string.component.mjs +8 -2
- package/esm2020/plugins/angular-editor.mjs +2 -2
- package/esm2020/view/base.mjs +1 -1
- package/esm2020/view/context.mjs +1 -1
- package/fesm2015/slate-angular.mjs +33 -20
- package/fesm2015/slate-angular.mjs.map +1 -1
- package/fesm2020/slate-angular.mjs +32 -20
- package/fesm2020/slate-angular.mjs.map +1 -1
- package/package.json +1 -1
- package/plugins/angular-editor.d.ts +2 -2
- package/view/base.d.ts +4 -4
- package/view/context.d.ts +2 -2
|
@@ -807,7 +807,7 @@ const AngularEditor = {
|
|
|
807
807
|
getCardCursorNode(editor, blockCardNode, options) {
|
|
808
808
|
const blockCardElement = AngularEditor.toDOMNode(editor, blockCardNode);
|
|
809
809
|
const cardCenter = blockCardElement.parentElement;
|
|
810
|
-
return options.direction === 'left' ? cardCenter.previousElementSibling : cardCenter.nextElementSibling;
|
|
810
|
+
return options.direction === 'left' ? cardCenter.previousElementSibling.firstChild : cardCenter.nextElementSibling.firstChild;
|
|
811
811
|
},
|
|
812
812
|
toSlateCardEntry(editor, node) {
|
|
813
813
|
const element = node.parentElement.closest('.slate-block-card')?.querySelector('[card-target="card-center"]').firstElementChild;
|
|
@@ -2102,7 +2102,13 @@ class SlateDefaultStringComponent extends BaseComponent {
|
|
|
2102
2102
|
beforeContextChange(value) {
|
|
2103
2103
|
if (this.context) {
|
|
2104
2104
|
if (this.context.type === 'lineBreakEmptyString') {
|
|
2105
|
-
|
|
2105
|
+
if (value.type === 'string') {
|
|
2106
|
+
this.removeLineBreakEmptyStringDOM();
|
|
2107
|
+
}
|
|
2108
|
+
else {
|
|
2109
|
+
this.textNode?.remove();
|
|
2110
|
+
this.brNode?.remove();
|
|
2111
|
+
}
|
|
2106
2112
|
}
|
|
2107
2113
|
if (this.context.type === 'string') {
|
|
2108
2114
|
if (value.type === 'lineBreakEmptyString') {
|
|
@@ -2691,7 +2697,7 @@ class SlateEditableComponent {
|
|
|
2691
2697
|
this.initializeViewContext();
|
|
2692
2698
|
this.initializeContext();
|
|
2693
2699
|
// remove unused DOM, just keep templateComponent instance
|
|
2694
|
-
|
|
2700
|
+
this.templateElementRef.nativeElement.remove();
|
|
2695
2701
|
// add browser class
|
|
2696
2702
|
let browserClass = IS_FIREFOX ? 'firefox' : IS_SAFARI ? 'safari' : '';
|
|
2697
2703
|
browserClass && this.elementRef.nativeElement.classList.add(browserClass);
|
|
@@ -2750,6 +2756,7 @@ class SlateEditableComponent {
|
|
|
2750
2756
|
this.addEventListener('blur', this.onDOMBlur.bind(this));
|
|
2751
2757
|
this.addEventListener('click', this.onDOMClick.bind(this));
|
|
2752
2758
|
this.addEventListener('compositionend', this.onDOMCompositionEnd.bind(this));
|
|
2759
|
+
this.addEventListener('compositionupdate', this.onDOMCompositionUpdate.bind(this));
|
|
2753
2760
|
this.addEventListener('compositionstart', this.onDOMCompositionStart.bind(this));
|
|
2754
2761
|
this.addEventListener('copy', this.onDOMCopy.bind(this));
|
|
2755
2762
|
this.addEventListener('cut', this.onDOMCut.bind(this));
|
|
@@ -3218,6 +3225,24 @@ class SlateEditableComponent {
|
|
|
3218
3225
|
}
|
|
3219
3226
|
}
|
|
3220
3227
|
}
|
|
3228
|
+
onDOMCompositionStart(event) {
|
|
3229
|
+
const { selection } = this.editor;
|
|
3230
|
+
if (selection) {
|
|
3231
|
+
// solve the problem of cross node Chinese input
|
|
3232
|
+
if (Range.isExpanded(selection)) {
|
|
3233
|
+
Editor.deleteFragment(this.editor);
|
|
3234
|
+
this.forceFlush();
|
|
3235
|
+
}
|
|
3236
|
+
}
|
|
3237
|
+
if (hasEditableTarget(this.editor, event.target) && !this.isDOMEventHandled(event, this.compositionStart)) {
|
|
3238
|
+
this.isComposing = true;
|
|
3239
|
+
}
|
|
3240
|
+
this.detectContext();
|
|
3241
|
+
this.cdr.detectChanges();
|
|
3242
|
+
}
|
|
3243
|
+
onDOMCompositionUpdate(event) {
|
|
3244
|
+
this.isDOMEventHandled(event, this.compositionUpdate);
|
|
3245
|
+
}
|
|
3221
3246
|
onDOMCompositionEnd(event) {
|
|
3222
3247
|
if (!event.data && !Range.isCollapsed(this.editor.selection)) {
|
|
3223
3248
|
Transforms.delete(this.editor);
|
|
@@ -3238,21 +3263,6 @@ class SlateEditableComponent {
|
|
|
3238
3263
|
this.detectContext();
|
|
3239
3264
|
this.cdr.detectChanges();
|
|
3240
3265
|
}
|
|
3241
|
-
onDOMCompositionStart(event) {
|
|
3242
|
-
const { selection } = this.editor;
|
|
3243
|
-
if (selection) {
|
|
3244
|
-
// solve the problem of cross node Chinese input
|
|
3245
|
-
if (Range.isExpanded(selection)) {
|
|
3246
|
-
Editor.deleteFragment(this.editor);
|
|
3247
|
-
this.forceFlush();
|
|
3248
|
-
}
|
|
3249
|
-
}
|
|
3250
|
-
if (hasEditableTarget(this.editor, event.target) && !this.isDOMEventHandled(event, this.compositionStart)) {
|
|
3251
|
-
this.isComposing = true;
|
|
3252
|
-
}
|
|
3253
|
-
this.detectContext();
|
|
3254
|
-
this.cdr.detectChanges();
|
|
3255
|
-
}
|
|
3256
3266
|
onDOMCopy(event) {
|
|
3257
3267
|
const window = AngularEditor.getWindow(this.editor);
|
|
3258
3268
|
const isOutsideSlate = !hasStringTarget(window.getSelection()) && isTargetInsideVoid(this.editor, event.target);
|
|
@@ -3626,7 +3636,7 @@ class SlateEditableComponent {
|
|
|
3626
3636
|
}
|
|
3627
3637
|
}
|
|
3628
3638
|
SlateEditableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: SlateEditableComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
|
|
3629
|
-
SlateEditableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: SlateEditableComponent, 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", 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: [
|
|
3639
|
+
SlateEditableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: SlateEditableComponent, 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: [
|
|
3630
3640
|
{
|
|
3631
3641
|
provide: NG_VALUE_ACCESSOR,
|
|
3632
3642
|
useExisting: forwardRef(() => SlateEditableComponent),
|
|
@@ -3679,6 +3689,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
3679
3689
|
type: Input
|
|
3680
3690
|
}], compositionEnd: [{
|
|
3681
3691
|
type: Input
|
|
3692
|
+
}], compositionUpdate: [{
|
|
3693
|
+
type: Input
|
|
3682
3694
|
}], compositionStart: [{
|
|
3683
3695
|
type: Input
|
|
3684
3696
|
}], copy: [{
|
|
@@ -3889,5 +3901,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
3889
3901
|
* Generated bundle index. Do not edit.
|
|
3890
3902
|
*/
|
|
3891
3903
|
|
|
3892
|
-
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, SlateChildrenComponent, SlateDefaultStringComponent, SlateEditableComponent, SlateElementComponent, SlateErrorCode, SlateLeavesComponent, SlateModule, SlateStringComponent, check, getCardTargetAttribute, getClipboardData, getDefaultView, getEditableChild, getEditableChildAndIndex, getPlainText, getSlateFragmentAttribute, hasBeforeContextChange, hasBlockCard, hasBlockCardWithNode, hasShadowRoot, hotkeys, isCardCenterByTargetAttr, isCardLeft, isCardLeftByTargetAttr, isCardRightByTargetAttr, isComponentType, isDOMComment, isDOMElement, isDOMNode, isDOMSelection, isDOMText, isDecoratorRangeListEqual, isPlainTextOnlyPaste, isTemplateRef, isValid, normalize, normalizeDOMPoint, shallowCompare, withAngular };
|
|
3904
|
+
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, SlateChildrenComponent, SlateDefaultStringComponent, SlateEditableComponent, SlateElementComponent, SlateErrorCode, SlateLeavesComponent, SlateModule, SlateStringComponent, 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 };
|
|
3893
3905
|
//# sourceMappingURL=slate-angular.mjs.map
|