Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(editor): range sync in lit portal (#11490)

Saul-Mironec306d9837087
diff --git a/blocksuite/framework/std/src/inline/range/range-binding.ts b/blocksuite/framework/std/src/inline/range/range-binding.ts
index e154031e95..22681e998b 100644
--- a/blocksuite/framework/std/src/inline/range/range-binding.ts
+++ b/blocksuite/framework/std/src/inline/range/range-binding.ts
@@ -2,6 +2,7 @@ import type { BaseSelection, BlockModel } from '@blocksuite/store';
import throttle from 'lodash-es/throttle';
import { TextSelection } from '../../selection/index.js';
+import { EditorHost } from '../../view/index.js';
import { isActiveInEditor } from './active.js';
import { RANGE_SYNC_EXCLUDE_ATTR } from './consts.js';
import type { RangeManager } from './range-manager.js';
@@ -191,6 +192,11 @@ export class RangeBinding {
return;
}
+ // From legacy render lit portal
+ if (range.commonAncestorContainer instanceof EditorHost) {
+ return;
+ }
+
// range is in a non-editable element
// ex. placeholder
const isRangeOutNotEditable =