slate-angular 1.7.0 → 1.7.1
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/bundles/slate-angular.umd.js +26 -20
- package/bundles/slate-angular.umd.js.map +1 -1
- package/components/editable/editable.component.d.ts +1 -0
- package/esm2015/components/editable/editable.component.js +26 -19
- package/esm2015/view/base.js +2 -2
- package/fesm2015/slate-angular.js +26 -19
- package/fesm2015/slate-angular.js.map +1 -1
- package/package.json +7 -7
|
@@ -2295,7 +2295,7 @@
|
|
|
2295
2295
|
}
|
|
2296
2296
|
Object.defineProperty(BaseTextComponent.prototype, "text", {
|
|
2297
2297
|
get: function () {
|
|
2298
|
-
return this._context.text;
|
|
2298
|
+
return this._context && this._context.text;
|
|
2299
2299
|
},
|
|
2300
2300
|
enumerable: false,
|
|
2301
2301
|
configurable: true
|
|
@@ -2938,7 +2938,6 @@
|
|
|
2938
2938
|
var forceOnDOMPaste = IS_SAFARI;
|
|
2939
2939
|
var SlateEditableComponent = /** @class */ (function () {
|
|
2940
2940
|
function SlateEditableComponent(elementRef, renderer2, cdr, ngZone, injector) {
|
|
2941
|
-
var _this = this;
|
|
2942
2941
|
this.elementRef = elementRef;
|
|
2943
2942
|
this.renderer2 = renderer2;
|
|
2944
2943
|
this.cdr = cdr;
|
|
@@ -2953,22 +2952,6 @@
|
|
|
2953
2952
|
this.onTouchedCallback = function () { };
|
|
2954
2953
|
this.onChangeCallback = function () { };
|
|
2955
2954
|
this.decorate = function () { return []; };
|
|
2956
|
-
this.placeholderDecorate = function (editor) {
|
|
2957
|
-
if (_this.placeholder &&
|
|
2958
|
-
editor.children.length === 1 &&
|
|
2959
|
-
Array.from(slate.Node.texts(editor)).length === 1 &&
|
|
2960
|
-
slate.Node.string(editor) === '') {
|
|
2961
|
-
var start = slate.Editor.start(editor, []);
|
|
2962
|
-
return [{
|
|
2963
|
-
placeholder: _this.placeholder,
|
|
2964
|
-
anchor: start,
|
|
2965
|
-
focus: start
|
|
2966
|
-
}];
|
|
2967
|
-
}
|
|
2968
|
-
else {
|
|
2969
|
-
return [];
|
|
2970
|
-
}
|
|
2971
|
-
};
|
|
2972
2955
|
this.isStrictDecorate = true;
|
|
2973
2956
|
this.trackBy = function () { return null; };
|
|
2974
2957
|
this.readonly = false;
|
|
@@ -3228,9 +3211,32 @@
|
|
|
3228
3211
|
};
|
|
3229
3212
|
}
|
|
3230
3213
|
};
|
|
3214
|
+
SlateEditableComponent.prototype.composePlaceholderDecorate = function (editor) {
|
|
3215
|
+
if (this.placeholderDecorate) {
|
|
3216
|
+
return this.placeholderDecorate(editor) || [];
|
|
3217
|
+
}
|
|
3218
|
+
if (this.placeholder &&
|
|
3219
|
+
editor.children.length === 1 &&
|
|
3220
|
+
Array.from(slate.Node.texts(editor)).length === 1 &&
|
|
3221
|
+
slate.Node.string(editor) === '') {
|
|
3222
|
+
var start = slate.Editor.start(editor, []);
|
|
3223
|
+
return [
|
|
3224
|
+
{
|
|
3225
|
+
placeholder: this.placeholder,
|
|
3226
|
+
anchor: start,
|
|
3227
|
+
focus: start,
|
|
3228
|
+
},
|
|
3229
|
+
];
|
|
3230
|
+
}
|
|
3231
|
+
else {
|
|
3232
|
+
return [];
|
|
3233
|
+
}
|
|
3234
|
+
};
|
|
3231
3235
|
SlateEditableComponent.prototype.generateDecorations = function () {
|
|
3232
3236
|
var decorations = this.decorate([this.editor, []]);
|
|
3233
|
-
var placeholderDecorations = this.isComposing
|
|
3237
|
+
var placeholderDecorations = this.isComposing
|
|
3238
|
+
? []
|
|
3239
|
+
: this.composePlaceholderDecorate(this.editor);
|
|
3234
3240
|
decorations.push.apply(decorations, __spreadArray([], __read(placeholderDecorations)));
|
|
3235
3241
|
return decorations;
|
|
3236
3242
|
};
|
|
@@ -3793,7 +3799,7 @@
|
|
|
3793
3799
|
if (!slate.Range.isCollapsed(this.editor.selection)) {
|
|
3794
3800
|
slate.Editor.deleteFragment(this.editor);
|
|
3795
3801
|
}
|
|
3796
|
-
// just handle Non-IME input
|
|
3802
|
+
// just handle Non-IME input
|
|
3797
3803
|
if (!this.isComposing) {
|
|
3798
3804
|
slate.Editor.insertText(this.editor, text);
|
|
3799
3805
|
}
|