slate-angular 15.1.0-next.4 → 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 +9 -3
- package/esm2020/components/editable/editable.component.mjs +25 -19
- 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 +25 -19
- package/fesm2015/slate-angular.mjs.map +1 -1
- package/fesm2020/slate-angular.mjs +25 -19
- 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;
|
|
@@ -2697,7 +2697,7 @@ class SlateEditableComponent {
|
|
|
2697
2697
|
this.initializeViewContext();
|
|
2698
2698
|
this.initializeContext();
|
|
2699
2699
|
// remove unused DOM, just keep templateComponent instance
|
|
2700
|
-
|
|
2700
|
+
this.templateElementRef.nativeElement.remove();
|
|
2701
2701
|
// add browser class
|
|
2702
2702
|
let browserClass = IS_FIREFOX ? 'firefox' : IS_SAFARI ? 'safari' : '';
|
|
2703
2703
|
browserClass && this.elementRef.nativeElement.classList.add(browserClass);
|
|
@@ -2756,6 +2756,7 @@ class SlateEditableComponent {
|
|
|
2756
2756
|
this.addEventListener('blur', this.onDOMBlur.bind(this));
|
|
2757
2757
|
this.addEventListener('click', this.onDOMClick.bind(this));
|
|
2758
2758
|
this.addEventListener('compositionend', this.onDOMCompositionEnd.bind(this));
|
|
2759
|
+
this.addEventListener('compositionupdate', this.onDOMCompositionUpdate.bind(this));
|
|
2759
2760
|
this.addEventListener('compositionstart', this.onDOMCompositionStart.bind(this));
|
|
2760
2761
|
this.addEventListener('copy', this.onDOMCopy.bind(this));
|
|
2761
2762
|
this.addEventListener('cut', this.onDOMCut.bind(this));
|
|
@@ -3224,6 +3225,24 @@ class SlateEditableComponent {
|
|
|
3224
3225
|
}
|
|
3225
3226
|
}
|
|
3226
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
|
+
}
|
|
3227
3246
|
onDOMCompositionEnd(event) {
|
|
3228
3247
|
if (!event.data && !Range.isCollapsed(this.editor.selection)) {
|
|
3229
3248
|
Transforms.delete(this.editor);
|
|
@@ -3244,21 +3263,6 @@ class SlateEditableComponent {
|
|
|
3244
3263
|
this.detectContext();
|
|
3245
3264
|
this.cdr.detectChanges();
|
|
3246
3265
|
}
|
|
3247
|
-
onDOMCompositionStart(event) {
|
|
3248
|
-
const { selection } = this.editor;
|
|
3249
|
-
if (selection) {
|
|
3250
|
-
// solve the problem of cross node Chinese input
|
|
3251
|
-
if (Range.isExpanded(selection)) {
|
|
3252
|
-
Editor.deleteFragment(this.editor);
|
|
3253
|
-
this.forceFlush();
|
|
3254
|
-
}
|
|
3255
|
-
}
|
|
3256
|
-
if (hasEditableTarget(this.editor, event.target) && !this.isDOMEventHandled(event, this.compositionStart)) {
|
|
3257
|
-
this.isComposing = true;
|
|
3258
|
-
}
|
|
3259
|
-
this.detectContext();
|
|
3260
|
-
this.cdr.detectChanges();
|
|
3261
|
-
}
|
|
3262
3266
|
onDOMCopy(event) {
|
|
3263
3267
|
const window = AngularEditor.getWindow(this.editor);
|
|
3264
3268
|
const isOutsideSlate = !hasStringTarget(window.getSelection()) && isTargetInsideVoid(this.editor, event.target);
|
|
@@ -3632,7 +3636,7 @@ class SlateEditableComponent {
|
|
|
3632
3636
|
}
|
|
3633
3637
|
}
|
|
3634
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 });
|
|
3635
|
-
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: [
|
|
3636
3640
|
{
|
|
3637
3641
|
provide: NG_VALUE_ACCESSOR,
|
|
3638
3642
|
useExisting: forwardRef(() => SlateEditableComponent),
|
|
@@ -3685,6 +3689,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
3685
3689
|
type: Input
|
|
3686
3690
|
}], compositionEnd: [{
|
|
3687
3691
|
type: Input
|
|
3692
|
+
}], compositionUpdate: [{
|
|
3693
|
+
type: Input
|
|
3688
3694
|
}], compositionStart: [{
|
|
3689
3695
|
type: Input
|
|
3690
3696
|
}], copy: [{
|
|
@@ -3895,5 +3901,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
|
3895
3901
|
* Generated bundle index. Do not edit.
|
|
3896
3902
|
*/
|
|
3897
3903
|
|
|
3898
|
-
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, 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 };
|
|
3899
3905
|
//# sourceMappingURL=slate-angular.mjs.map
|