slate-angular 21.1.0 → 22.0.0-next.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 });
@@ -2269,6 +2278,25 @@ class BlockCardRef {
2269
2278
  }
2270
2279
  }
2271
2280
 
2281
+ function hasBeforeContextChange(value) {
2282
+ if (value.beforeContextChange) {
2283
+ return true;
2284
+ }
2285
+ return false;
2286
+ }
2287
+ function hasAfterContextChange(value) {
2288
+ if (value.afterContextChange) {
2289
+ return true;
2290
+ }
2291
+ return false;
2292
+ }
2293
+ function hasBeforeDomMove(value) {
2294
+ if (value.instance?.beforeDomMove) {
2295
+ return true;
2296
+ }
2297
+ return false;
2298
+ }
2299
+
2272
2300
  function createEmbeddedViewOrComponentOrFlavour(viewType, context, viewContext, viewContainerRef) {
2273
2301
  if (isFlavourType(viewType)) {
2274
2302
  const flavourRef = new FlavourRef();
@@ -2297,6 +2325,7 @@ function createEmbeddedViewOrComponentOrFlavour(viewType, context, viewContext,
2297
2325
  componentRef.changeDetectorRef.detectChanges();
2298
2326
  return componentRef;
2299
2327
  }
2328
+ throw new Error('Invalid view type');
2300
2329
  }
2301
2330
  function updateContext(view, newContext, viewContext) {
2302
2331
  if (view instanceof FlavourRef) {
@@ -2317,7 +2346,7 @@ function mount(views, blockCards, outletParent, outletElement) {
2317
2346
  const fragment = document.createDocumentFragment();
2318
2347
  views.forEach((view, index) => {
2319
2348
  const blockCard = blockCards ? blockCards[index] : undefined;
2320
- fragment.append(...getRootNodes(view, blockCard));
2349
+ fragment.append(...getRootNodes(view, blockCard ?? undefined));
2321
2350
  });
2322
2351
  if (outletElement) {
2323
2352
  outletElement.parentElement.insertBefore(fragment, outletElement);
@@ -2360,6 +2389,9 @@ function getRootNodes(ref, blockCard) {
2360
2389
  }
2361
2390
  function mountOnItemChange(index, item, views, blockCards, outletParent, firstRootNode, viewContext) {
2362
2391
  const view = views[index];
2392
+ if (hasBeforeDomMove(view)) {
2393
+ view.instance.beforeDomMove('move');
2394
+ }
2363
2395
  let rootNodes = getRootNodes(view);
2364
2396
  if (blockCards) {
2365
2397
  const isBlockCard = viewContext.editor.isBlockCard(item);
@@ -2390,19 +2422,6 @@ function mountOnItemChange(index, item, views, blockCards, outletParent, firstRo
2390
2422
  }
2391
2423
  }
2392
2424
 
2393
- function hasBeforeContextChange(value) {
2394
- if (value.beforeContextChange) {
2395
- return true;
2396
- }
2397
- return false;
2398
- }
2399
- function hasAfterContextChange(value) {
2400
- if (value.afterContextChange) {
2401
- return true;
2402
- }
2403
- return false;
2404
- }
2405
-
2406
2425
  class BaseFlavour {
2407
2426
  constructor() {
2408
2427
  this.initialized = false;
@@ -2542,6 +2561,10 @@ class DefaultElementFlavour extends BaseElementFlavour {
2542
2561
  }
2543
2562
 
2544
2563
  class BaseLeafFlavour extends BaseFlavour {
2564
+ constructor() {
2565
+ super(...arguments);
2566
+ this.placeholderElement = null;
2567
+ }
2545
2568
  get text() {
2546
2569
  return this.context && this.context.text;
2547
2570
  }
@@ -2564,7 +2587,7 @@ class BaseLeafFlavour extends BaseFlavour {
2564
2587
  // issue-1: IME input was interrupted
2565
2588
  // issue-2: IME input focus jumping
2566
2589
  // Issue occurs when the span node of the placeholder is before the slateString span node
2567
- if (this.context.leaf['placeholder']) {
2590
+ if (this.context.leaf.placeholder) {
2568
2591
  if (!this.placeholderElement) {
2569
2592
  this.createPlaceholder();
2570
2593
  }
@@ -2576,7 +2599,7 @@ class BaseLeafFlavour extends BaseFlavour {
2576
2599
  }
2577
2600
  createPlaceholder() {
2578
2601
  const placeholderElement = document.createElement('span');
2579
- placeholderElement.innerText = this.context.leaf['placeholder'];
2602
+ placeholderElement.innerText = this.context.leaf.placeholder;
2580
2603
  placeholderElement.contentEditable = 'false';
2581
2604
  placeholderElement.setAttribute('data-slate-placeholder', 'true');
2582
2605
  this.placeholderElement = placeholderElement;
@@ -2594,8 +2617,8 @@ class BaseLeafFlavour extends BaseFlavour {
2594
2617
  });
2595
2618
  }
2596
2619
  updatePlaceholder() {
2597
- if (this.placeholderElement.innerText !== this.context.leaf['placeholder']) {
2598
- this.placeholderElement.innerText = this.context.leaf['placeholder'];
2620
+ if (this.placeholderElement.innerText !== this.context.leaf.placeholder) {
2621
+ this.placeholderElement.innerText = this.context.leaf.placeholder;
2599
2622
  }
2600
2623
  }
2601
2624
  destroyPlaceholder() {
@@ -2747,7 +2770,9 @@ const createCompatibleStringNode = (text) => {
2747
2770
  const updateCompatibleStringNode = (stringNode, text) => {
2748
2771
  const zeroWidthSpan = stringNode.querySelector('span');
2749
2772
  stringNode.textContent = text;
2750
- stringNode.appendChild(zeroWidthSpan);
2773
+ if (zeroWidthSpan) {
2774
+ stringNode.appendChild(zeroWidthSpan);
2775
+ }
2751
2776
  return stringNode;
2752
2777
  };
2753
2778
  const createLineBreakEmptyStringDOM = (elementStringLength) => {
@@ -3062,8 +3087,9 @@ class ListRender {
3062
3087
  const preRenderingElement = [...this.preRenderingHTMLElement];
3063
3088
  let previousRootNode = this.virtualTopHeightElement;
3064
3089
  preRenderingElement.forEach((rootNodes, index) => {
3065
- // const slateElement = this.children[index];
3066
- // if (slateElement && children.indexOf(slateElement) >= 0) {
3090
+ if (hasBeforeDomMove(this.views[index])) {
3091
+ this.views[index].instance.beforeDomMove('virtual-scroll');
3092
+ }
3067
3093
  rootNodes.forEach(rootNode => {
3068
3094
  setPreRenderingElementStyle(this.viewContext.editor, rootNode, true);
3069
3095
  previousRootNode.insertAdjacentElement('afterend', rootNode);
@@ -3072,16 +3098,6 @@ class ListRender {
3072
3098
  if (isDebug) {
3073
3099
  debugLog('log', 'preRenderingHTMLElement index: ', this.viewContext.editor.children.indexOf(this.children[index]), 'is clear true');
3074
3100
  }
3075
- // } else {
3076
- // if (isDebug) {
3077
- // debugLog(
3078
- // 'log',
3079
- // 'preRenderingHTMLElement index: ',
3080
- // this.viewContext.editor.children.indexOf(this.children[index]),
3081
- // 'do not clear since it would be removed soon'
3082
- // );
3083
- // }
3084
- // }
3085
3101
  });
3086
3102
  this.preRenderingHTMLElement = [];
3087
3103
  }
@@ -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,
@@ -5533,5 +5554,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImpor
5533
5554
  * Generated bundle index. Do not edit.
5534
5555
  */
5535
5556
 
5536
- export { AngularEditor, BaseComponent, BaseElementComponent, BaseElementFlavour, BaseFlavour, BaseLeafComponent, BaseLeafFlavour, BaseTextComponent, BaseTextFlavour, BlockCardRef, DEFAULT_ELEMENT_HEIGHT, DefaultTextFlavour, EDITOR_TO_AFTER_VIEW_INIT_QUEUE, EDITOR_TO_BUSINESS_TOP, EDITOR_TO_IS_FROM_SCROLL_TO, EDITOR_TO_ROOT_NODE_WIDTH, EDITOR_TO_VIEWPORT_HEIGHT, EDITOR_TO_VIRTUAL_SCROLL_CONFIG, EDITOR_TO_VIRTUAL_SCROLL_SELECTION, ELEMENT_KEY_TO_HEIGHTS, ELEMENT_TO_COMPONENT, FAKE_LEFT_BLOCK_CARD_OFFSET, FAKE_RIGHT_BLOCK_CARD_OFFSET, FlavourRef, HAS_BEFORE_INPUT_SUPPORT, IS_ANDROID, IS_APPLE, IS_CHROME, IS_CHROME_LEGACY, IS_EDGE_LEGACY, IS_FIREFOX, IS_FIREFOX_LEGACY, IS_IOS, IS_QQBROWSER, IS_SAFARI, IS_UC_MOBILE, IS_WECHATBROWSER, PLACEHOLDER_SYMBOL, SLATE_BLOCK_CARD_CLASS_NAME, SLATE_DEBUG_KEY, SLATE_DEBUG_KEY_SCROLL_TOP, SLATE_DEBUG_KEY_UPDATE, SlateBlockCard, SlateChildrenOutlet, SlateEditable, SlateErrorCode, SlateFragmentAttributeKey, SlateModule, VIRTUAL_BOTTOM_HEIGHT_CLASS_NAME, VIRTUAL_CENTER_OUTLET_CLASS_NAME, VIRTUAL_SCROLL_DEFAULT_BLOCK_HEIGHT, VIRTUAL_TOP_HEIGHT_CLASS_NAME, VoidTextFlavour, blobAsString, buildHTMLText, buildHeightsAndAccumulatedHeights, cacheHeightByElement, calcBusinessTop, calcHeightByElement, calculateAccumulatedTopHeight, check, clearMinHeightByElement, completeTable, createClipboardData, createText, createThrottleRAF, debugLog, defaultScrollSelectionIntoView, fallbackCopyText, getBlockCardByNativeElement, getBusinessTop, getCachedHeightByElement, getCardTargetAttribute, getClipboardData, getClipboardFromHTMLText, getContentHeight, getDataTransferClipboard, getDataTransferClipboardText, getNavigatorClipboard, getPlainText, getScrollContainer, getSelection, getSlateFragmentAttribute, getViewportHeight, getZeroTextNode, hasAfterContextChange, hasBeforeContextChange, hasBlockCard, hasBlockCardWithNode, hotkeys, isCardCenterByTargetAttr, isCardLeft, isCardLeftByTargetAttr, isCardRightByTargetAttr, isClipboardFile, isClipboardReadSupported, isClipboardWriteSupported, isClipboardWriteTextSupported, isComponentType, isDOMText, isDebug, isDebugScrollTop, isDebugUpdate, isDecoratorRangeListEqual, isFlavourType, isInvalidTable, isSelectionInsideVoid, isTemplateRef, isValid, isValidNumber, measureHeightByIndics, normalize, roundTo, scrollToElement, setClipboardData, setDataTransferClipboard, setDataTransferClipboardText, setMinHeightByElement, setNavigatorClipboard, shallowCompare, stripHtml, withAngular };
5557
+ export { AngularEditor, BaseComponent, BaseElementComponent, BaseElementFlavour, BaseFlavour, BaseLeafComponent, BaseLeafFlavour, BaseTextComponent, BaseTextFlavour, BlockCardRef, DEFAULT_ELEMENT_HEIGHT, DefaultTextFlavour, EDITOR_TO_AFTER_VIEW_INIT_QUEUE, EDITOR_TO_BUSINESS_TOP, EDITOR_TO_IS_FROM_SCROLL_TO, EDITOR_TO_ROOT_NODE_WIDTH, EDITOR_TO_VIEWPORT_HEIGHT, EDITOR_TO_VIRTUAL_SCROLL_CONFIG, EDITOR_TO_VIRTUAL_SCROLL_SELECTION, ELEMENT_KEY_TO_HEIGHTS, ELEMENT_TO_COMPONENT, FAKE_LEFT_BLOCK_CARD_OFFSET, FAKE_RIGHT_BLOCK_CARD_OFFSET, FlavourRef, HAS_BEFORE_INPUT_SUPPORT, IS_ANDROID, IS_APPLE, IS_CHROME, IS_CHROME_LEGACY, IS_EDGE_LEGACY, IS_FIREFOX, IS_FIREFOX_LEGACY, IS_IOS, IS_QQBROWSER, IS_SAFARI, IS_UC_MOBILE, IS_WECHATBROWSER, PLACEHOLDER_SYMBOL, SLATE_BLOCK_CARD_CLASS_NAME, SLATE_DEBUG_KEY, SLATE_DEBUG_KEY_SCROLL_TOP, SLATE_DEBUG_KEY_UPDATE, SlateBlockCard, SlateChildrenOutlet, SlateEditable, SlateErrorCode, SlateFragmentAttributeKey, SlateModule, VIRTUAL_BOTTOM_HEIGHT_CLASS_NAME, VIRTUAL_CENTER_OUTLET_CLASS_NAME, VIRTUAL_SCROLL_DEFAULT_BLOCK_HEIGHT, VIRTUAL_TOP_HEIGHT_CLASS_NAME, VoidTextFlavour, blobAsString, buildHTMLText, buildHeightsAndAccumulatedHeights, cacheHeightByElement, calcBusinessTop, calcHeightByElement, calculateAccumulatedTopHeight, check, clearMinHeightByElement, completeTable, createClipboardData, createText, createThrottleRAF, debugLog, defaultScrollSelectionIntoView, fallbackCopyText, getBlockCardByNativeElement, getBusinessTop, getCachedHeightByElement, getCardTargetAttribute, getClipboardData, getClipboardFromHTMLText, getContentHeight, getDataTransferClipboard, getDataTransferClipboardText, getNavigatorClipboard, getPlainText, getScrollContainer, getSelection, getSlateFragmentAttribute, getViewportHeight, getZeroTextNode, hasAfterContextChange, hasBeforeContextChange, hasBeforeDomMove, hasBlockCard, hasBlockCardWithNode, hotkeys, isCardCenterByTargetAttr, isCardLeft, isCardLeftByTargetAttr, isCardRightByTargetAttr, isClipboardFile, isClipboardReadSupported, isClipboardWriteSupported, isClipboardWriteTextSupported, isComponentType, isDOMText, isDebug, isDebugScrollTop, isDebugUpdate, isDecoratorRangeListEqual, isFlavourType, isInvalidTable, isSelectionInsideVoid, isTemplateRef, isValid, isValidNumber, measureHeightByIndics, normalize, roundTo, scrollToElement, setClipboardData, setDataTransferClipboard, setDataTransferClipboardText, setMinHeightByElement, setNavigatorClipboard, shallowCompare, stripHtml, withAngular };
5537
5558
  //# sourceMappingURL=slate-angular.mjs.map