slate-angular 21.2.0 → 22.0.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.
@@ -13,13 +13,15 @@ import { CommonModule } from '@angular/common';
13
13
  const FAKE_LEFT_BLOCK_CARD_OFFSET = -1;
14
14
  const FAKE_RIGHT_BLOCK_CARD_OFFSET = -2;
15
15
  function hasBlockCardWithNode(node) {
16
- return node && (node.parentElement.hasAttribute('card-target') || (node instanceof HTMLElement && node.hasAttribute('card-target')));
16
+ return !!(node &&
17
+ (node.parentElement?.hasAttribute('card-target') || (node instanceof HTMLElement && node.hasAttribute('card-target'))));
17
18
  }
18
19
  function hasBlockCard(selection) {
19
- return hasBlockCardWithNode(selection?.anchorNode) || hasBlockCardWithNode(selection?.focusNode);
20
+ return hasBlockCardWithNode(selection?.anchorNode ?? null) || hasBlockCardWithNode(selection?.focusNode ?? null);
20
21
  }
21
22
  function getCardTargetAttribute(node) {
22
- return node.parentElement.attributes['card-target'] || (node instanceof HTMLElement && node.attributes['card-target']);
23
+ return (node.parentElement?.attributes?.['card-target'] ||
24
+ (node instanceof HTMLElement && node.attributes['card-target']));
23
25
  }
24
26
  function isCardLeft(node) {
25
27
  const cardTarget = getCardTargetAttribute(node);
@@ -256,11 +258,13 @@ const customToSlateRange = (editor, domRange, options) => {
256
258
  if (anchorNode == null || focusNode == null || anchorOffset == null || focusOffset == null) {
257
259
  throw new Error(`Cannot resolve a Slate range from DOM range: ${domRange}`);
258
260
  }
259
- const anchor = DOMEditor.toSlatePoint(editor, [anchorNode, anchorOffset], { suppressThrow, exactMatch });
261
+ const anchor = DOMEditor.toSlatePoint(editor, [anchorNode, anchorOffset], { suppressThrow: !!suppressThrow, exactMatch: !!exactMatch });
260
262
  if (!anchor) {
261
263
  return null;
262
264
  }
263
- const focus = isCollapsed ? anchor : DOMEditor.toSlatePoint(editor, [focusNode, focusOffset], { suppressThrow, exactMatch });
265
+ const focus = isCollapsed
266
+ ? anchor
267
+ : DOMEditor.toSlatePoint(editor, [focusNode, focusOffset], { suppressThrow: !!suppressThrow, exactMatch: !!exactMatch });
264
268
  if (!focus) {
265
269
  return null;
266
270
  }
@@ -343,10 +347,15 @@ const CustomDOMEditor = {
343
347
  getCardCursorNode(editor, blockCardNode, options) {
344
348
  const blockCardElement = DOMEditor.toDOMNode(editor, blockCardNode);
345
349
  const cardCenter = blockCardElement.parentElement;
346
- return options.direction === 'left' ? cardCenter.previousElementSibling.firstChild : cardCenter.nextElementSibling.firstChild;
350
+ return options.direction === 'left'
351
+ ? cardCenter.previousElementSibling.firstChild
352
+ : cardCenter.nextElementSibling.firstChild;
347
353
  },
348
354
  toSlateCardEntry(editor, node) {
349
- const element = node.parentElement.closest('.slate-block-card')?.querySelector('[card-target="card-center"]').firstElementChild;
355
+ const element = node.parentElement
356
+ .closest('.slate-block-card')
357
+ ?.querySelector('[card-target="card-center"]')
358
+ .firstElementChild;
350
359
  const slateNode = DOMEditor.toSlateNode(editor, element);
351
360
  const path = DOMEditor.findPath(editor, slateNode);
352
361
  return [slateNode, path];
@@ -2246,7 +2255,7 @@ function restoreDom(editor, execute) {
2246
2255
  execute();
2247
2256
  });
2248
2257
  const disconnect = () => {
2249
- observer.disconnect();
2258
+ observer?.disconnect();
2250
2259
  observer = null;
2251
2260
  };
2252
2261
  observer.observe(editable, { subtree: true, childList: true, characterData: true, characterDataOldValue: true });
@@ -2316,6 +2325,7 @@ function createEmbeddedViewOrComponentOrFlavour(viewType, context, viewContext,
2316
2325
  componentRef.changeDetectorRef.detectChanges();
2317
2326
  return componentRef;
2318
2327
  }
2328
+ throw new Error('Invalid view type');
2319
2329
  }
2320
2330
  function updateContext(view, newContext, viewContext) {
2321
2331
  if (view instanceof FlavourRef) {
@@ -2336,7 +2346,7 @@ function mount(views, blockCards, outletParent, outletElement) {
2336
2346
  const fragment = document.createDocumentFragment();
2337
2347
  views.forEach((view, index) => {
2338
2348
  const blockCard = blockCards ? blockCards[index] : undefined;
2339
- fragment.append(...getRootNodes(view, blockCard));
2349
+ fragment.append(...getRootNodes(view, blockCard ?? undefined));
2340
2350
  });
2341
2351
  if (outletElement) {
2342
2352
  outletElement.parentElement.insertBefore(fragment, outletElement);
@@ -2551,6 +2561,10 @@ class DefaultElementFlavour extends BaseElementFlavour {
2551
2561
  }
2552
2562
 
2553
2563
  class BaseLeafFlavour extends BaseFlavour {
2564
+ constructor() {
2565
+ super(...arguments);
2566
+ this.placeholderElement = null;
2567
+ }
2554
2568
  get text() {
2555
2569
  return this.context && this.context.text;
2556
2570
  }
@@ -2573,7 +2587,7 @@ class BaseLeafFlavour extends BaseFlavour {
2573
2587
  // issue-1: IME input was interrupted
2574
2588
  // issue-2: IME input focus jumping
2575
2589
  // Issue occurs when the span node of the placeholder is before the slateString span node
2576
- if (this.context.leaf['placeholder']) {
2590
+ if (this.context.leaf.placeholder) {
2577
2591
  if (!this.placeholderElement) {
2578
2592
  this.createPlaceholder();
2579
2593
  }
@@ -2585,7 +2599,7 @@ class BaseLeafFlavour extends BaseFlavour {
2585
2599
  }
2586
2600
  createPlaceholder() {
2587
2601
  const placeholderElement = document.createElement('span');
2588
- placeholderElement.innerText = this.context.leaf['placeholder'];
2602
+ placeholderElement.innerText = this.context.leaf.placeholder;
2589
2603
  placeholderElement.contentEditable = 'false';
2590
2604
  placeholderElement.setAttribute('data-slate-placeholder', 'true');
2591
2605
  this.placeholderElement = placeholderElement;
@@ -2603,8 +2617,8 @@ class BaseLeafFlavour extends BaseFlavour {
2603
2617
  });
2604
2618
  }
2605
2619
  updatePlaceholder() {
2606
- if (this.placeholderElement.innerText !== this.context.leaf['placeholder']) {
2607
- this.placeholderElement.innerText = this.context.leaf['placeholder'];
2620
+ if (this.placeholderElement.innerText !== this.context.leaf.placeholder) {
2621
+ this.placeholderElement.innerText = this.context.leaf.placeholder;
2608
2622
  }
2609
2623
  }
2610
2624
  destroyPlaceholder() {
@@ -2756,7 +2770,9 @@ const createCompatibleStringNode = (text) => {
2756
2770
  const updateCompatibleStringNode = (stringNode, text) => {
2757
2771
  const zeroWidthSpan = stringNode.querySelector('span');
2758
2772
  stringNode.textContent = text;
2759
- stringNode.appendChild(zeroWidthSpan);
2773
+ if (zeroWidthSpan) {
2774
+ stringNode.appendChild(zeroWidthSpan);
2775
+ }
2760
2776
  return stringNode;
2761
2777
  };
2762
2778
  const createLineBreakEmptyStringDOM = (elementStringLength) => {
@@ -3402,6 +3418,7 @@ class SlateEditable {
3402
3418
  this.isUpdatingSelection = false;
3403
3419
  this.latestElement = null;
3404
3420
  this.manualListeners = [];
3421
+ this.initialized = false;
3405
3422
  this.onTouchedCallback = () => { };
3406
3423
  this.onChangeCallback = () => { };
3407
3424
  this.decorate = () => [];
@@ -4098,11 +4115,9 @@ class SlateEditable {
4098
4115
  // COMPAT: Since the DOM range has no concept of backwards/forwards
4099
4116
  // we need to check and do the right thing here.
4100
4117
  if (Range.isBackward(selection)) {
4101
- // eslint-disable-next-line max-len
4102
4118
  domSelection.setBaseAndExtent(newDomRange.endContainer, newDomRange.endOffset, newDomRange.startContainer, newDomRange.startOffset);
4103
4119
  }
4104
4120
  else {
4105
- // eslint-disable-next-line max-len
4106
4121
  domSelection.setBaseAndExtent(newDomRange.startContainer, newDomRange.startOffset, newDomRange.endContainer, newDomRange.endOffset);
4107
4122
  }
4108
4123
  }
@@ -4171,7 +4186,7 @@ class SlateEditable {
4171
4186
  let textContent = '';
4172
4187
  // skip decorate text
4173
4188
  textDOMNode.querySelectorAll('[editable-text]').forEach(stringDOMNode => {
4174
- let text = stringDOMNode.textContent;
4189
+ let text = stringDOMNode.textContent || '';
4175
4190
  const zeroChar = '\uFEFF';
4176
4191
  // remove zero with char
4177
4192
  if (text.startsWith(zeroChar)) {
@@ -4344,7 +4359,9 @@ class SlateEditable {
4344
4359
  return Transforms.deselect(this.editor);
4345
4360
  }
4346
4361
  const editorElement = EDITOR_TO_ELEMENT.get(this.editor);
4347
- const hasDomSelectionInEditor = editorElement.contains(domSelection.anchorNode) && editorElement.contains(domSelection.focusNode);
4362
+ const hasDomSelectionInEditor = !!editorElement &&
4363
+ editorElement.contains(domSelection.anchorNode) &&
4364
+ editorElement.contains(domSelection.focusNode);
4348
4365
  if (!hasDomSelectionInEditor) {
4349
4366
  Transforms.deselect(this.editor);
4350
4367
  return;
@@ -4627,7 +4644,7 @@ class SlateEditable {
4627
4644
  this.isDOMEventHandled(event, this.compositionUpdate);
4628
4645
  }
4629
4646
  onDOMCompositionEnd(event) {
4630
- if (!event.data && !Range.isCollapsed(this.editor.selection)) {
4647
+ if (!event.data && this.editor.selection && !Range.isCollapsed(this.editor.selection)) {
4631
4648
  Transforms.delete(this.editor);
4632
4649
  }
4633
4650
  if (AngularEditor.hasEditableTarget(this.editor, event.target) &&
@@ -4991,7 +5008,7 @@ class SlateEditable {
4991
5008
  event.nativeEvent.preventDefault();
4992
5009
  try {
4993
5010
  const text = event.data;
4994
- if (!Range.isCollapsed(this.editor.selection)) {
5011
+ if (this.editor.selection && !Range.isCollapsed(this.editor.selection)) {
4995
5012
  Editor.deleteFragment(this.editor);
4996
5013
  }
4997
5014
  // just handle Non-IME input
@@ -5026,8 +5043,8 @@ class SlateEditable {
5026
5043
  this.indicsOfNeedRemeasured$.complete();
5027
5044
  EDITOR_TO_ON_CHANGE.delete(this.editor);
5028
5045
  }
5029
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SlateEditable, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
5030
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: SlateEditable, isStandalone: true, 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", virtualScroll: "virtualScroll", 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: [
5046
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: SlateEditable, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
5047
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.4", type: SlateEditable, isStandalone: true, 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", virtualScroll: "virtualScroll", 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: [
5031
5048
  {
5032
5049
  provide: NG_VALUE_ACCESSOR,
5033
5050
  useExisting: forwardRef(() => SlateEditable),
@@ -5035,7 +5052,7 @@ class SlateEditable {
5035
5052
  }
5036
5053
  ], usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
5037
5054
  }
5038
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SlateEditable, decorators: [{
5055
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: SlateEditable, decorators: [{
5039
5056
  type: Component,
5040
5057
  args: [{
5041
5058
  selector: 'slate-editable',
@@ -5157,10 +5174,10 @@ const defaultScrollSelectionIntoView = (editor, domRange) => {
5157
5174
  const isTargetInsideVoid = (editor, target) => {
5158
5175
  let slateNode = null;
5159
5176
  try {
5160
- slateNode = AngularEditor.hasTarget(editor, target) && AngularEditor.toSlateNode(editor, target);
5177
+ slateNode = AngularEditor.hasTarget(editor, target) ? AngularEditor.toSlateNode(editor, target) : null;
5161
5178
  }
5162
5179
  catch (error) { }
5163
- return slateNode && Element.isElement(slateNode) && Editor.isVoid(editor, slateNode);
5180
+ return !!(slateNode && Element.isElement(slateNode) && Editor.isVoid(editor, slateNode));
5164
5181
  };
5165
5182
  const isSelectionInsideVoid = (editor) => {
5166
5183
  const selection = editor.selection;
@@ -5171,8 +5188,11 @@ const isSelectionInsideVoid = (editor) => {
5171
5188
  return false;
5172
5189
  };
5173
5190
  const hasStringTarget = (domSelection) => {
5174
- return ((domSelection.anchorNode.parentElement.hasAttribute('data-slate-string') ||
5175
- domSelection.anchorNode.parentElement.hasAttribute('data-slate-zero-width')) &&
5191
+ return (!!domSelection &&
5192
+ !!domSelection.anchorNode?.parentElement &&
5193
+ !!domSelection.focusNode?.parentElement &&
5194
+ (domSelection.anchorNode.parentElement.hasAttribute('data-slate-string') ||
5195
+ domSelection.anchorNode.parentElement.hasAttribute('data-slate-zero-width')) &&
5176
5196
  (domSelection.focusNode.parentElement.hasAttribute('data-slate-string') ||
5177
5197
  domSelection.focusNode.parentElement.hasAttribute('data-slate-zero-width')));
5178
5198
  };
@@ -5189,7 +5209,7 @@ const preventInsertFromComposition = (event, editor) => {
5189
5209
  const window = AngularEditor.getWindow(editor);
5190
5210
  const domSelection = window.getSelection();
5191
5211
  // ensure text node insert composition input text
5192
- if (insertText && domSelection.anchorNode instanceof Text && domSelection.anchorNode.textContent.endsWith(insertText)) {
5212
+ if (insertText && domSelection && domSelection.anchorNode instanceof Text && domSelection.anchorNode.textContent?.endsWith(insertText)) {
5193
5213
  const textNode = domSelection.anchorNode;
5194
5214
  textNode.splitText(textNode.length - insertText.length).remove();
5195
5215
  }
@@ -5202,10 +5222,10 @@ class SlateChildrenOutlet {
5202
5222
  getNativeElement() {
5203
5223
  return this.elementRef.nativeElement;
5204
5224
  }
5205
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SlateChildrenOutlet, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
5206
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: SlateChildrenOutlet, isStandalone: true, selector: "slate-children-outlet", ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
5225
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: SlateChildrenOutlet, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
5226
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.4", type: SlateChildrenOutlet, isStandalone: true, selector: "slate-children-outlet", ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
5207
5227
  }
5208
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SlateChildrenOutlet, decorators: [{
5228
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: SlateChildrenOutlet, decorators: [{
5209
5229
  type: Component,
5210
5230
  args: [{
5211
5231
  selector: 'slate-children-outlet',
@@ -5216,11 +5236,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImpor
5216
5236
  }] });
5217
5237
 
5218
5238
  class SlateModule {
5219
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SlateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
5220
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.2", ngImport: i0, type: SlateModule, imports: [CommonModule, SlateEditable, SlateChildrenOutlet], exports: [SlateEditable, SlateChildrenOutlet] }); }
5221
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SlateModule, imports: [CommonModule] }); }
5239
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: SlateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
5240
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.1.4", ngImport: i0, type: SlateModule, imports: [CommonModule, SlateEditable, SlateChildrenOutlet], exports: [SlateEditable, SlateChildrenOutlet] }); }
5241
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: SlateModule, imports: [CommonModule] }); }
5222
5242
  }
5223
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SlateModule, decorators: [{
5243
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: SlateModule, decorators: [{
5224
5244
  type: NgModule,
5225
5245
  args: [{
5226
5246
  imports: [CommonModule, SlateEditable, SlateChildrenOutlet],
@@ -5260,10 +5280,10 @@ class BaseComponent {
5260
5280
  get nativeElement() {
5261
5281
  return this.elementRef.nativeElement;
5262
5282
  }
5263
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: BaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
5264
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.2", type: BaseComponent, isStandalone: true, inputs: { context: "context", viewContext: "viewContext" }, ngImport: i0 }); }
5283
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: BaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
5284
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.4", type: BaseComponent, isStandalone: true, inputs: { context: "context", viewContext: "viewContext" }, ngImport: i0 }); }
5265
5285
  }
5266
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: BaseComponent, decorators: [{
5286
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: BaseComponent, decorators: [{
5267
5287
  type: Directive
5268
5288
  }], propDecorators: { context: [{
5269
5289
  type: Input
@@ -5375,10 +5395,10 @@ class BaseElementComponent extends BaseComponent {
5375
5395
  const height = Math.ceil(target.getBoundingClientRect().height) + parseFloat(computedStyle.marginTop) + parseFloat(computedStyle.marginBottom);
5376
5396
  return height;
5377
5397
  }
5378
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: BaseElementComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
5379
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.2", type: BaseElementComponent, isStandalone: true, viewQueries: [{ propertyName: "childrenOutletInstance", first: true, predicate: SlateChildrenOutlet, descendants: true, static: true }], usesInheritance: true, ngImport: i0 }); }
5398
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: BaseElementComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
5399
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.4", type: BaseElementComponent, isStandalone: true, viewQueries: [{ propertyName: "childrenOutletInstance", first: true, predicate: SlateChildrenOutlet, descendants: true, static: true }], usesInheritance: true, ngImport: i0 }); }
5380
5400
  }
5381
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: BaseElementComponent, decorators: [{
5401
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: BaseElementComponent, decorators: [{
5382
5402
  type: Directive
5383
5403
  }], propDecorators: { childrenOutletInstance: [{
5384
5404
  type: ViewChild,
@@ -5427,10 +5447,10 @@ class BaseTextComponent extends BaseComponent {
5427
5447
  }
5428
5448
  this.leavesRender.update(this.context);
5429
5449
  }
5430
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: BaseTextComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
5431
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.2", type: BaseTextComponent, isStandalone: true, viewQueries: [{ propertyName: "childrenOutletInstance", first: true, predicate: SlateChildrenOutlet, descendants: true, static: true }], usesInheritance: true, ngImport: i0 }); }
5450
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: BaseTextComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
5451
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.4", type: BaseTextComponent, isStandalone: true, viewQueries: [{ propertyName: "childrenOutletInstance", first: true, predicate: SlateChildrenOutlet, descendants: true, static: true }], usesInheritance: true, ngImport: i0 }); }
5432
5452
  }
5433
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: BaseTextComponent, decorators: [{
5453
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: BaseTextComponent, decorators: [{
5434
5454
  type: Directive
5435
5455
  }], propDecorators: { childrenOutletInstance: [{
5436
5456
  type: ViewChild,
@@ -5442,6 +5462,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImpor
5442
5462
  class BaseLeafComponent extends BaseComponent {
5443
5463
  constructor() {
5444
5464
  super(...arguments);
5465
+ this.placeholderElement = null;
5445
5466
  this.stringRender = null;
5446
5467
  this.isSlateLeaf = true;
5447
5468
  this.getOutletParent = () => {
@@ -5474,7 +5495,7 @@ class BaseLeafComponent extends BaseComponent {
5474
5495
  // issue-1: IME input was interrupted
5475
5496
  // issue-2: IME input focus jumping
5476
5497
  // Issue occurs when the span node of the placeholder is before the slateString span node
5477
- if (this.context.leaf['placeholder']) {
5498
+ if (this.context.leaf.placeholder) {
5478
5499
  if (!this.placeholderElement) {
5479
5500
  this.createPlaceholder();
5480
5501
  }
@@ -5486,7 +5507,7 @@ class BaseLeafComponent extends BaseComponent {
5486
5507
  }
5487
5508
  createPlaceholder() {
5488
5509
  const placeholderElement = document.createElement('span');
5489
- placeholderElement.innerText = this.context.leaf['placeholder'];
5510
+ placeholderElement.innerText = this.context.leaf.placeholder;
5490
5511
  placeholderElement.contentEditable = 'false';
5491
5512
  placeholderElement.setAttribute('data-slate-placeholder', 'true');
5492
5513
  this.placeholderElement = placeholderElement;
@@ -5504,8 +5525,8 @@ class BaseLeafComponent extends BaseComponent {
5504
5525
  });
5505
5526
  }
5506
5527
  updatePlaceholder() {
5507
- if (this.placeholderElement.innerText !== this.context.leaf['placeholder']) {
5508
- this.placeholderElement.innerText = this.context.leaf['placeholder'];
5528
+ if (this.placeholderElement.innerText !== this.context.leaf.placeholder) {
5529
+ this.placeholderElement.innerText = this.context.leaf.placeholder;
5509
5530
  }
5510
5531
  }
5511
5532
  destroyPlaceholder() {
@@ -5515,10 +5536,10 @@ class BaseLeafComponent extends BaseComponent {
5515
5536
  this.nativeElement.classList.remove('leaf-with-placeholder');
5516
5537
  }
5517
5538
  }
5518
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: BaseLeafComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
5519
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.2", type: BaseLeafComponent, isStandalone: true, host: { properties: { "attr.data-slate-leaf": "this.isSlateLeaf" } }, usesInheritance: true, ngImport: i0 }); }
5539
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: BaseLeafComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
5540
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.4", type: BaseLeafComponent, isStandalone: true, host: { properties: { "attr.data-slate-leaf": "this.isSlateLeaf" } }, usesInheritance: true, ngImport: i0 }); }
5520
5541
  }
5521
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: BaseLeafComponent, decorators: [{
5542
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: BaseLeafComponent, decorators: [{
5522
5543
  type: Directive
5523
5544
  }], propDecorators: { isSlateLeaf: [{
5524
5545
  type: HostBinding,