slate-angular 1.7.1 → 1.7.3
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 +42 -2
- package/bundles/slate-angular.umd.js.map +1 -1
- package/components/leaf/default-leaf.component.d.ts +4 -1
- package/esm2015/components/leaf/default-leaf.component.js +11 -12
- package/esm2015/view/base.js +33 -1
- package/fesm2015/slate-angular.js +42 -10
- package/fesm2015/slate-angular.js.map +1 -1
- package/package.json +1 -1
- package/styles/index.scss +9 -4
- package/view/base.d.ts +3 -0
|
@@ -2177,6 +2177,38 @@
|
|
|
2177
2177
|
}
|
|
2178
2178
|
this.cdr.markForCheck();
|
|
2179
2179
|
};
|
|
2180
|
+
BaseLeafComponent.prototype.renderPlaceholder = function () {
|
|
2181
|
+
var _a, _b, _c;
|
|
2182
|
+
// issue-1: IME input was interrupted
|
|
2183
|
+
// issue-2: IME input focus jumping
|
|
2184
|
+
// Issue occurs when the placeholder node is removed (in leaf span)
|
|
2185
|
+
// So add a placeholder span to the block element root node
|
|
2186
|
+
if (this.context.leaf['placeholder']) {
|
|
2187
|
+
if (!this.placeholderElement) {
|
|
2188
|
+
this.placeholderElement = document.createElement('span');
|
|
2189
|
+
this.placeholderElement.innerText = this.context.leaf['placeholder'];
|
|
2190
|
+
this.placeholderElement.contentEditable = 'false';
|
|
2191
|
+
this.placeholderElement.setAttribute('data-slate-placeholder', 'true');
|
|
2192
|
+
(_a = this.nativeElement.closest('[data-slate-node="element"]')) === null || _a === void 0 ? void 0 : _a.classList.add('element-placeholder');
|
|
2193
|
+
(_b = this.nativeElement.closest('[data-slate-node="element"]')) === null || _b === void 0 ? void 0 : _b.appendChild(this.placeholderElement);
|
|
2194
|
+
}
|
|
2195
|
+
}
|
|
2196
|
+
else {
|
|
2197
|
+
if (this.placeholderElement) {
|
|
2198
|
+
this.placeholderElement.remove();
|
|
2199
|
+
this.placeholderElement = null;
|
|
2200
|
+
(_c = this.nativeElement.closest('[data-slate-node="element"]')) === null || _c === void 0 ? void 0 : _c.classList.remove('element-placeholder');
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
};
|
|
2204
|
+
BaseLeafComponent.prototype.destroyPlaceholder = function () {
|
|
2205
|
+
var _a, _b;
|
|
2206
|
+
if (this.placeholderElement) {
|
|
2207
|
+
this.placeholderElement.remove();
|
|
2208
|
+
this.placeholderElement = null;
|
|
2209
|
+
(_b = (_a = this.nativeElement) === null || _a === void 0 ? void 0 : _a.closest('[data-slate-node="element"]')) === null || _b === void 0 ? void 0 : _b.classList.remove('element-placeholder');
|
|
2210
|
+
}
|
|
2211
|
+
};
|
|
2180
2212
|
return BaseLeafComponent;
|
|
2181
2213
|
}(BaseComponent));
|
|
2182
2214
|
BaseLeafComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: BaseLeafComponent, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
@@ -2503,15 +2535,23 @@
|
|
|
2503
2535
|
function SlateDefaultLeafComponent() {
|
|
2504
2536
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
2505
2537
|
}
|
|
2538
|
+
SlateDefaultLeafComponent.prototype.onContextChange = function () {
|
|
2539
|
+
_super.prototype.onContextChange.call(this);
|
|
2540
|
+
this.renderPlaceholder();
|
|
2541
|
+
};
|
|
2542
|
+
SlateDefaultLeafComponent.prototype.ngOnDestroy = function () {
|
|
2543
|
+
// Because the placeholder span is not in the current component, it is destroyed along with the current component
|
|
2544
|
+
this.destroyPlaceholder();
|
|
2545
|
+
};
|
|
2506
2546
|
return SlateDefaultLeafComponent;
|
|
2507
2547
|
}(BaseLeafComponent));
|
|
2508
2548
|
SlateDefaultLeafComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: SlateDefaultLeafComponent, deps: null, target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
2509
|
-
SlateDefaultLeafComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: SlateDefaultLeafComponent, selector: "span[slateDefaultLeaf]", host: { attributes: { "data-slate-leaf": "true" } }, usesInheritance: true, ngImport: i0__namespace, template: "
|
|
2549
|
+
SlateDefaultLeafComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: SlateDefaultLeafComponent, selector: "span[slateDefaultLeaf]", host: { attributes: { "data-slate-leaf": "true" } }, usesInheritance: true, ngImport: i0__namespace, template: "<span slateString [context]=\"context\" [viewContext]=\"viewContext\"><span>", isInline: true, components: [{ type: SlateStringComponent, selector: "span[slateString]", inputs: ["context"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
2510
2550
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: SlateDefaultLeafComponent, decorators: [{
|
|
2511
2551
|
type: i0.Component,
|
|
2512
2552
|
args: [{
|
|
2513
2553
|
selector: 'span[slateDefaultLeaf]',
|
|
2514
|
-
template: "
|
|
2554
|
+
template: "<span slateString [context]=\"context\" [viewContext]=\"viewContext\"><span>",
|
|
2515
2555
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
2516
2556
|
host: {
|
|
2517
2557
|
'data-slate-leaf': 'true'
|