slate-angular 19.2.0 → 19.3.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.
|
@@ -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,16 @@ 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
|
+
if (editorContentHeight > 0) {
|
|
2192
|
+
// Not supported webkitLineClamp exceeds height hiding
|
|
2193
|
+
placeholderElement.style.maxHeight = `${editorContentHeight}px`;
|
|
2194
|
+
}
|
|
2195
|
+
const lineClamp = Math.floor(editorContentHeight / this.nativeElement.offsetHeight) || 0;
|
|
2196
|
+
placeholderElement.style.webkitLineClamp = `${Math.max(lineClamp, 1)}`;
|
|
2197
|
+
});
|
|
2167
2198
|
}
|
|
2168
2199
|
updatePlaceholder() {
|
|
2169
2200
|
if (this.placeholderElement.innerText !== this.context.leaf['placeholder']) {
|
|
@@ -4069,5 +4100,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
4069
4100
|
* Generated bundle index. Do not edit.
|
|
4070
4101
|
*/
|
|
4071
4102
|
|
|
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 };
|
|
4103
|
+
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
4104
|
//# sourceMappingURL=slate-angular.mjs.map
|