slate-angular 20.2.5 → 20.2.7
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/fesm2022/slate-angular.mjs +12 -5
- package/fesm2022/slate-angular.mjs.map +1 -1
- package/index.d.ts +3 -2
- package/package.json +1 -1
|
@@ -475,7 +475,7 @@ const HAS_BEFORE_INPUT_SUPPORT = !IS_CHROME_LEGACY &&
|
|
|
475
475
|
globalThis.InputEvent &&
|
|
476
476
|
// @ts-ignore The `getTargetRanges` property isn't recognized.
|
|
477
477
|
typeof globalThis.InputEvent.prototype.getTargetRanges === 'function';
|
|
478
|
-
const VIRTUAL_SCROLL_DEFAULT_BLOCK_HEIGHT =
|
|
478
|
+
const VIRTUAL_SCROLL_DEFAULT_BLOCK_HEIGHT = 32;
|
|
479
479
|
const SLATE_DEBUG_KEY = '__SLATE_DEBUG__';
|
|
480
480
|
const SLATE_DEBUG_KEY_SCROLL_TOP = '__SLATE_DEBUG_SCROLL_TOP__';
|
|
481
481
|
|
|
@@ -1454,6 +1454,7 @@ const isDebugScrollTop = localStorage.getItem(SLATE_DEBUG_KEY_SCROLL_TOP) === 't
|
|
|
1454
1454
|
const ELEMENT_KEY_TO_HEIGHTS = new WeakMap();
|
|
1455
1455
|
const EDITOR_TO_BUSINESS_TOP = new WeakMap();
|
|
1456
1456
|
const EDITOR_TO_ROOT_NODE_WIDTH = new WeakMap();
|
|
1457
|
+
const EDITOR_TO_IS_FROM_SCROLL_TO = new WeakMap();
|
|
1457
1458
|
const debugLog = (type, ...args) => {
|
|
1458
1459
|
const doc = document;
|
|
1459
1460
|
VirtualScrollDebugOverlay.log(doc, type, ...args);
|
|
@@ -1530,6 +1531,11 @@ const scrollToElement = (editor, element, scrollTo) => {
|
|
|
1530
1531
|
}
|
|
1531
1532
|
const { accumulatedHeights } = buildHeightsAndAccumulatedHeights(editor);
|
|
1532
1533
|
scrollTo((accumulatedHeights[anchorIndex] ?? 0) + getBusinessTop(editor));
|
|
1534
|
+
EDITOR_TO_IS_FROM_SCROLL_TO.set(editor, true);
|
|
1535
|
+
setTimeout(() => {
|
|
1536
|
+
console.log('scrollToElement: end scroll');
|
|
1537
|
+
EDITOR_TO_IS_FROM_SCROLL_TO.set(editor, false);
|
|
1538
|
+
}, 0);
|
|
1533
1539
|
};
|
|
1534
1540
|
|
|
1535
1541
|
const withAngular = (editor, clipboardFormatKey = 'x-slate-fragment') => {
|
|
@@ -3802,7 +3808,8 @@ class SlateEditable {
|
|
|
3802
3808
|
if (isDebug) {
|
|
3803
3809
|
debugLog('log', 'tryUpdateVirtualViewport');
|
|
3804
3810
|
}
|
|
3805
|
-
|
|
3811
|
+
const isFromScrollTo = EDITOR_TO_IS_FROM_SCROLL_TO.get(this.editor);
|
|
3812
|
+
if (this.inViewportIndics.length > 0 && !isFromScrollTo) {
|
|
3806
3813
|
const topHeight = this.getActualVirtualTopHeight();
|
|
3807
3814
|
const refreshVirtualTopHeight = calculateVirtualTopHeight(this.editor, this.inViewportIndics[0]);
|
|
3808
3815
|
if (topHeight !== refreshVirtualTopHeight) {
|
|
@@ -3820,7 +3827,7 @@ class SlateEditable {
|
|
|
3820
3827
|
}
|
|
3821
3828
|
let virtualView = this.calculateVirtualViewport();
|
|
3822
3829
|
let diff = this.diffVirtualViewport(virtualView);
|
|
3823
|
-
if (diff.isDifferent && diff.needRemoveOnTop) {
|
|
3830
|
+
if (diff.isDifferent && diff.needRemoveOnTop && !isFromScrollTo) {
|
|
3824
3831
|
const remeasureIndics = diff.changedIndexesOfTop;
|
|
3825
3832
|
const changed = measureHeightByIndics(this.editor, remeasureIndics);
|
|
3826
3833
|
if (changed) {
|
|
@@ -3833,7 +3840,7 @@ class SlateEditable {
|
|
|
3833
3840
|
if (this.listRender.initialized) {
|
|
3834
3841
|
const { preRenderingCount, childrenWithPreRendering, childrenWithPreRenderingIndics } = this.handlePreRendering();
|
|
3835
3842
|
this.listRender.update(childrenWithPreRendering, this.editor, this.context, preRenderingCount, childrenWithPreRenderingIndics);
|
|
3836
|
-
if (diff.needAddOnTop) {
|
|
3843
|
+
if (diff.needAddOnTop && !isFromScrollTo) {
|
|
3837
3844
|
const remeasureAddedIndics = diff.changedIndexesOfTop;
|
|
3838
3845
|
if (isDebug) {
|
|
3839
3846
|
debugLog('log', 'needAddOnTop to remeasure heights: ', remeasureAddedIndics);
|
|
@@ -5272,5 +5279,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
|
|
|
5272
5279
|
* Generated bundle index. Do not edit.
|
|
5273
5280
|
*/
|
|
5274
5281
|
|
|
5275
|
-
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_ROOT_NODE_WIDTH, 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_ENABLED_VIRTUAL_SCROLL, 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, SlateBlockCard, SlateChildrenOutlet, SlateEditable, SlateErrorCode, SlateFragmentAttributeKey, SlateModule, SlateString, VIRTUAL_SCROLL_DEFAULT_BLOCK_HEIGHT, VoidTextFlavour, blobAsString, buildHTMLText, buildHeightsAndAccumulatedHeights, calculateVirtualTopHeight, check, completeTable, createClipboardData, createText, createThrottleRAF, debugLog, defaultScrollSelectionIntoView, fallbackCopyText, getBlockCardByNativeElement, getBusinessTop, getCardTargetAttribute, getClipboardData, getClipboardFromHTMLText, getContentHeight, getDataTransferClipboard, getDataTransferClipboardText, getNavigatorClipboard, getPlainText, getRealHeightByElement, getSelection, getSlateFragmentAttribute, getZeroTextNode, hasAfterContextChange, hasBeforeContextChange, hasBlockCard, hasBlockCardWithNode, hotkeys, isCardCenterByTargetAttr, isCardLeft, isCardLeftByTargetAttr, isCardRightByTargetAttr, isClipboardFile, isClipboardReadSupported, isClipboardWriteSupported, isClipboardWriteTextSupported, isComponentType, isDOMText, isDebug, isDebugScrollTop, isDecoratorRangeListEqual, isFlavourType, isInvalidTable, isTemplateRef, isValid, measureHeightByElement, measureHeightByIndics, normalize, scrollToElement, setClipboardData, setDataTransferClipboard, setDataTransferClipboardText, setNavigatorClipboard, shallowCompare, stripHtml, withAngular };
|
|
5282
|
+
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_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_ENABLED_VIRTUAL_SCROLL, 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, SlateBlockCard, SlateChildrenOutlet, SlateEditable, SlateErrorCode, SlateFragmentAttributeKey, SlateModule, SlateString, VIRTUAL_SCROLL_DEFAULT_BLOCK_HEIGHT, VoidTextFlavour, blobAsString, buildHTMLText, buildHeightsAndAccumulatedHeights, calculateVirtualTopHeight, check, completeTable, createClipboardData, createText, createThrottleRAF, debugLog, defaultScrollSelectionIntoView, fallbackCopyText, getBlockCardByNativeElement, getBusinessTop, getCardTargetAttribute, getClipboardData, getClipboardFromHTMLText, getContentHeight, getDataTransferClipboard, getDataTransferClipboardText, getNavigatorClipboard, getPlainText, getRealHeightByElement, getSelection, getSlateFragmentAttribute, getZeroTextNode, hasAfterContextChange, hasBeforeContextChange, hasBlockCard, hasBlockCardWithNode, hotkeys, isCardCenterByTargetAttr, isCardLeft, isCardLeftByTargetAttr, isCardRightByTargetAttr, isClipboardFile, isClipboardReadSupported, isClipboardWriteSupported, isClipboardWriteTextSupported, isComponentType, isDOMText, isDebug, isDebugScrollTop, isDecoratorRangeListEqual, isFlavourType, isInvalidTable, isTemplateRef, isValid, measureHeightByElement, measureHeightByIndics, normalize, scrollToElement, setClipboardData, setDataTransferClipboard, setDataTransferClipboardText, setNavigatorClipboard, shallowCompare, stripHtml, withAngular };
|
|
5276
5283
|
//# sourceMappingURL=slate-angular.mjs.map
|