Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/18578

Vanessa75a00d3b893b
diff --git a/app/src/protyle/wysiwyg/blockDragSelect.test.ts b/app/src/protyle/wysiwyg/blockDragSelect.test.ts
index 1c99de868f..ac84068588 100644
--- a/app/src/protyle/wysiwyg/blockDragSelect.test.ts
+++ b/app/src/protyle/wysiwyg/blockDragSelect.test.ts
@@ -133,6 +133,12 @@ describe("isBlockDragSelectTopReached", () => {
});
describe("resolveBlockDragSelectStart", () => {
+ it("keeps the fallback block after the selection start scrolls outside the viewport", () => {
+ const fallback = new TestElement("fallback", true);
+
+ assert.equal(resolve(new Map(), 0, 12, fallback), asElement(fallback));
+ });
+
it("keeps the parent block while the selection only covers its side", () => {
const parent = new TestElement("parent", true, true);
diff --git a/app/src/protyle/wysiwyg/blockDragSelect.ts b/app/src/protyle/wysiwyg/blockDragSelect.ts
index 2693d434a7..e15629ce17 100644
--- a/app/src/protyle/wysiwyg/blockDragSelect.ts
+++ b/app/src/protyle/wysiwyg/blockDragSelect.ts
@@ -62,7 +62,7 @@ const getDirectDescendantBlock = (containerBlock: Element, block: Element,
export const resolveBlockDragSelectStart = (options: TResolveDragSelectBlockOptions) => {
const firstPointElement = options.elementFromPoint(options.x, options.top);
if (!firstPointElement) {
- return false;
+ return options.fallbackBlock || false;
}
const firstBlock = options.getBlock(firstPointElement);
if (!options.isContainerSurface(firstPointElement)) {