slate-angular 21.0.0 → 21.2.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.
|
@@ -1128,7 +1128,8 @@ const buildHeightsAndAccumulatedHeights = (editor, visibleStates) => {
|
|
|
1128
1128
|
accumulatedHeights[0] = 0;
|
|
1129
1129
|
for (let i = 0; i < children.length; i++) {
|
|
1130
1130
|
const isVisible = visibleStates[i];
|
|
1131
|
-
|
|
1131
|
+
const isFloating = editor.isFloating(children[i]);
|
|
1132
|
+
let height = isVisible && !isFloating ? getCachedHeightByElement(editor, children[i]) : 0;
|
|
1132
1133
|
if (height === null) {
|
|
1133
1134
|
try {
|
|
1134
1135
|
height = editor.getRoughHeight(children[i]);
|
|
@@ -1873,6 +1874,7 @@ const withAngular = (editor, clipboardFormatKey = 'x-slate-fragment') => {
|
|
|
1873
1874
|
e.getRoughHeight = (element, defaultHeight) => {
|
|
1874
1875
|
return defaultHeight === undefined ? VIRTUAL_SCROLL_DEFAULT_BLOCK_HEIGHT : defaultHeight;
|
|
1875
1876
|
};
|
|
1877
|
+
e.isFloating = element => false;
|
|
1876
1878
|
return e;
|
|
1877
1879
|
};
|
|
1878
1880
|
|
|
@@ -2267,6 +2269,25 @@ class BlockCardRef {
|
|
|
2267
2269
|
}
|
|
2268
2270
|
}
|
|
2269
2271
|
|
|
2272
|
+
function hasBeforeContextChange(value) {
|
|
2273
|
+
if (value.beforeContextChange) {
|
|
2274
|
+
return true;
|
|
2275
|
+
}
|
|
2276
|
+
return false;
|
|
2277
|
+
}
|
|
2278
|
+
function hasAfterContextChange(value) {
|
|
2279
|
+
if (value.afterContextChange) {
|
|
2280
|
+
return true;
|
|
2281
|
+
}
|
|
2282
|
+
return false;
|
|
2283
|
+
}
|
|
2284
|
+
function hasBeforeDomMove(value) {
|
|
2285
|
+
if (value.instance?.beforeDomMove) {
|
|
2286
|
+
return true;
|
|
2287
|
+
}
|
|
2288
|
+
return false;
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2270
2291
|
function createEmbeddedViewOrComponentOrFlavour(viewType, context, viewContext, viewContainerRef) {
|
|
2271
2292
|
if (isFlavourType(viewType)) {
|
|
2272
2293
|
const flavourRef = new FlavourRef();
|
|
@@ -2358,6 +2379,9 @@ function getRootNodes(ref, blockCard) {
|
|
|
2358
2379
|
}
|
|
2359
2380
|
function mountOnItemChange(index, item, views, blockCards, outletParent, firstRootNode, viewContext) {
|
|
2360
2381
|
const view = views[index];
|
|
2382
|
+
if (hasBeforeDomMove(view)) {
|
|
2383
|
+
view.instance.beforeDomMove('move');
|
|
2384
|
+
}
|
|
2361
2385
|
let rootNodes = getRootNodes(view);
|
|
2362
2386
|
if (blockCards) {
|
|
2363
2387
|
const isBlockCard = viewContext.editor.isBlockCard(item);
|
|
@@ -2388,19 +2412,6 @@ function mountOnItemChange(index, item, views, blockCards, outletParent, firstRo
|
|
|
2388
2412
|
}
|
|
2389
2413
|
}
|
|
2390
2414
|
|
|
2391
|
-
function hasBeforeContextChange(value) {
|
|
2392
|
-
if (value.beforeContextChange) {
|
|
2393
|
-
return true;
|
|
2394
|
-
}
|
|
2395
|
-
return false;
|
|
2396
|
-
}
|
|
2397
|
-
function hasAfterContextChange(value) {
|
|
2398
|
-
if (value.afterContextChange) {
|
|
2399
|
-
return true;
|
|
2400
|
-
}
|
|
2401
|
-
return false;
|
|
2402
|
-
}
|
|
2403
|
-
|
|
2404
2415
|
class BaseFlavour {
|
|
2405
2416
|
constructor() {
|
|
2406
2417
|
this.initialized = false;
|
|
@@ -3060,8 +3071,9 @@ class ListRender {
|
|
|
3060
3071
|
const preRenderingElement = [...this.preRenderingHTMLElement];
|
|
3061
3072
|
let previousRootNode = this.virtualTopHeightElement;
|
|
3062
3073
|
preRenderingElement.forEach((rootNodes, index) => {
|
|
3063
|
-
|
|
3064
|
-
|
|
3074
|
+
if (hasBeforeDomMove(this.views[index])) {
|
|
3075
|
+
this.views[index].instance.beforeDomMove('virtual-scroll');
|
|
3076
|
+
}
|
|
3065
3077
|
rootNodes.forEach(rootNode => {
|
|
3066
3078
|
setPreRenderingElementStyle(this.viewContext.editor, rootNode, true);
|
|
3067
3079
|
previousRootNode.insertAdjacentElement('afterend', rootNode);
|
|
@@ -3070,16 +3082,6 @@ class ListRender {
|
|
|
3070
3082
|
if (isDebug) {
|
|
3071
3083
|
debugLog('log', 'preRenderingHTMLElement index: ', this.viewContext.editor.children.indexOf(this.children[index]), 'is clear true');
|
|
3072
3084
|
}
|
|
3073
|
-
// } else {
|
|
3074
|
-
// if (isDebug) {
|
|
3075
|
-
// debugLog(
|
|
3076
|
-
// 'log',
|
|
3077
|
-
// 'preRenderingHTMLElement index: ',
|
|
3078
|
-
// this.viewContext.editor.children.indexOf(this.children[index]),
|
|
3079
|
-
// 'do not clear since it would be removed soon'
|
|
3080
|
-
// );
|
|
3081
|
-
// }
|
|
3082
|
-
// }
|
|
3083
3085
|
});
|
|
3084
3086
|
this.preRenderingHTMLElement = [];
|
|
3085
3087
|
}
|
|
@@ -3212,6 +3214,13 @@ class ListRender {
|
|
|
3212
3214
|
rootNodes.forEach(rootNode => {
|
|
3213
3215
|
rootNode.setAttribute('debug-index', index.toString());
|
|
3214
3216
|
rootNode.setAttribute('debug-height', height?.toString());
|
|
3217
|
+
const isFloating = this.viewContext.editor.isFloating(children[i]);
|
|
3218
|
+
if (isFloating) {
|
|
3219
|
+
rootNode.setAttribute('debug-floating', 'true');
|
|
3220
|
+
}
|
|
3221
|
+
else {
|
|
3222
|
+
rootNode.removeAttribute('debug-floating');
|
|
3223
|
+
}
|
|
3215
3224
|
});
|
|
3216
3225
|
}
|
|
3217
3226
|
}
|
|
@@ -3837,6 +3846,18 @@ class SlateEditable {
|
|
|
3837
3846
|
inViewportChildren.push(...children);
|
|
3838
3847
|
inViewportIndics.push(...Array.from({ length: elementLength }, (_, i) => i));
|
|
3839
3848
|
}
|
|
3849
|
+
else {
|
|
3850
|
+
const lastIndex = inViewportIndics[inViewportIndics.length - 1];
|
|
3851
|
+
for (let i = lastIndex + 1; i < elementLength; i++) {
|
|
3852
|
+
if (this.editor.isFloating(children[i])) {
|
|
3853
|
+
inViewportChildren.push(children[i]);
|
|
3854
|
+
inViewportIndics.push(i);
|
|
3855
|
+
}
|
|
3856
|
+
else {
|
|
3857
|
+
break;
|
|
3858
|
+
}
|
|
3859
|
+
}
|
|
3860
|
+
}
|
|
3840
3861
|
const inViewportStartIndex = inViewportIndics[0];
|
|
3841
3862
|
const inViewportEndIndex = inViewportIndics[inViewportIndics.length - 1];
|
|
3842
3863
|
const top = accumulatedHeights[inViewportStartIndex];
|
|
@@ -5002,6 +5023,7 @@ class SlateEditable {
|
|
|
5002
5023
|
manualListener();
|
|
5003
5024
|
});
|
|
5004
5025
|
this.destroy$.complete();
|
|
5026
|
+
this.indicsOfNeedRemeasured$.complete();
|
|
5005
5027
|
EDITOR_TO_ON_CHANGE.delete(this.editor);
|
|
5006
5028
|
}
|
|
5007
5029
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SlateEditable, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
@@ -5511,5 +5533,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImpor
|
|
|
5511
5533
|
* Generated bundle index. Do not edit.
|
|
5512
5534
|
*/
|
|
5513
5535
|
|
|
5514
|
-
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 };
|
|
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, 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 };
|
|
5515
5537
|
//# sourceMappingURL=slate-angular.mjs.map
|