slate-angular 19.2.0 → 19.3.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.
@@ -815,6 +815,27 @@ const getSelection = (root) => {
815
815
  }
816
816
  return document.getSelection();
817
817
  };
818
+ const getContentHeight = (element) => {
819
+ if (!element)
820
+ return 0;
821
+ const style = window.getComputedStyle(element);
822
+ const boxSizing = style.boxSizing;
823
+ const height = parseFloat(style.height) || 0;
824
+ const paddingTop = parseFloat(style.paddingTop) || 0;
825
+ const paddingBottom = parseFloat(style.paddingBottom) || 0;
826
+ const totalPadding = paddingTop + paddingBottom;
827
+ const borderTop = parseFloat(style.borderTopWidth) || 0;
828
+ const borderBottom = parseFloat(style.borderBottomWidth) || 0;
829
+ const totalBorder = borderTop + borderBottom;
830
+ let contentHeight;
831
+ if (boxSizing === 'border-box') {
832
+ contentHeight = height - totalPadding - totalBorder;
833
+ }
834
+ else {
835
+ contentHeight = height;
836
+ }
837
+ return Math.max(contentHeight, 0);
838
+ };
818
839
 
819
840
  const buildHTMLText = (wrapper, attach, data) => {
820
841
  const stringObj = JSON.stringify(data);
@@ -2164,6 +2185,14 @@ class BaseLeafComponent extends BaseComponent {
2164
2185
  this.placeholderElement = placeholderElement;
2165
2186
  this.nativeElement.classList.add('leaf-with-placeholder');
2166
2187
  this.nativeElement.appendChild(placeholderElement);
2188
+ setTimeout(() => {
2189
+ const editorElement = this.nativeElement.closest('.the-editor-typo');
2190
+ const editorContentHeight = getContentHeight(editorElement);
2191
+ // Not supported webkitLineClamp exceeds height hiding
2192
+ placeholderElement.style.maxHeight = `${editorContentHeight}px`;
2193
+ const lineClamp = Math.floor(editorContentHeight / this.nativeElement.offsetHeight);
2194
+ placeholderElement.style.webkitLineClamp = `${lineClamp}`;
2195
+ });
2167
2196
  }
2168
2197
  updatePlaceholder() {
2169
2198
  if (this.placeholderElement.innerText !== this.context.leaf['placeholder']) {
@@ -4069,5 +4098,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
4069
4098
  * Generated bundle index. Do not edit.
4070
4099
  */
4071
4100
 
4072
- export { AngularEditor, BaseComponent, BaseElementComponent, BaseLeafComponent, BaseTextComponent, EDITOR_TO_AFTER_VIEW_INIT_QUEUE, ELEMENT_TO_COMPONENT, FAKE_LEFT_BLOCK_CARD_OFFSET, FAKE_RIGHT_BLOCK_CARD_OFFSET, 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, SlateChildren, SlateChildrenOutlet, SlateDefaultString, SlateEditable, SlateElement, SlateErrorCode, SlateFragmentAttributeKey, SlateLeaves, SlateModule, SlateString, blobAsString, buildHTMLText, check, completeTable, createClipboardData, createThrottleRAF, defaultScrollSelectionIntoView, fallbackCopyText, getCardTargetAttribute, getClipboardData, getClipboardFromHTMLText, getDataTransferClipboard, getDataTransferClipboardText, getNavigatorClipboard, getPlainText, getSelection, getSlateFragmentAttribute, hasAfterContextChange, hasBeforeContextChange, hasBlockCard, hasBlockCardWithNode, hotkeys, isCardCenterByTargetAttr, isCardLeft, isCardLeftByTargetAttr, isCardRightByTargetAttr, isClipboardFile, isClipboardReadSupported, isClipboardWriteSupported, isClipboardWriteTextSupported, isComponentType, isDOMText, isDecoratorRangeListEqual, isEmpty, isInvalidTable, isTemplateRef, isValid, normalize, setClipboardData, setDataTransferClipboard, setDataTransferClipboardText, setNavigatorClipboard, shallowCompare, stripHtml, withAngular };
4101
+ export { AngularEditor, BaseComponent, BaseElementComponent, BaseLeafComponent, BaseTextComponent, EDITOR_TO_AFTER_VIEW_INIT_QUEUE, ELEMENT_TO_COMPONENT, FAKE_LEFT_BLOCK_CARD_OFFSET, FAKE_RIGHT_BLOCK_CARD_OFFSET, 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, SlateChildren, SlateChildrenOutlet, SlateDefaultString, SlateEditable, SlateElement, SlateErrorCode, SlateFragmentAttributeKey, SlateLeaves, SlateModule, SlateString, blobAsString, buildHTMLText, check, completeTable, createClipboardData, createThrottleRAF, defaultScrollSelectionIntoView, fallbackCopyText, getCardTargetAttribute, getClipboardData, getClipboardFromHTMLText, getContentHeight, getDataTransferClipboard, getDataTransferClipboardText, getNavigatorClipboard, getPlainText, getSelection, getSlateFragmentAttribute, hasAfterContextChange, hasBeforeContextChange, hasBlockCard, hasBlockCardWithNode, hotkeys, isCardCenterByTargetAttr, isCardLeft, isCardLeftByTargetAttr, isCardRightByTargetAttr, isClipboardFile, isClipboardReadSupported, isClipboardWriteSupported, isClipboardWriteTextSupported, isComponentType, isDOMText, isDecoratorRangeListEqual, isEmpty, isInvalidTable, isTemplateRef, isValid, normalize, setClipboardData, setDataTransferClipboard, setDataTransferClipboardText, setNavigatorClipboard, shallowCompare, stripHtml, withAngular };
4073
4102
  //# sourceMappingURL=slate-angular.mjs.map