mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 01:20:12 +01:00
This commit is contained in:
parent
5f25b74e49
commit
8a8ac2f45d
2 changed files with 49 additions and 3 deletions
|
|
@ -3,7 +3,15 @@ import {hasClosestBlock, hasClosestByAttribute, hasClosestByClassName} from "../
|
||||||
import {transaction} from "../../wysiwyg/transaction";
|
import {transaction} from "../../wysiwyg/transaction";
|
||||||
import {openEditorTab} from "../../../menus/util";
|
import {openEditorTab} from "../../../menus/util";
|
||||||
import {copySubMenu} from "../../../menus/commonMenuItem";
|
import {copySubMenu} from "../../../menus/commonMenuItem";
|
||||||
import {getCellText, getTypeByCellElement, popTextCell, renderCell, renderCellAttr, updateHeaderCell} from "./cell";
|
import {
|
||||||
|
addDragFill,
|
||||||
|
getCellText,
|
||||||
|
getTypeByCellElement,
|
||||||
|
popTextCell,
|
||||||
|
renderCell,
|
||||||
|
renderCellAttr,
|
||||||
|
updateHeaderCell
|
||||||
|
} from "./cell";
|
||||||
import {getColIconByType, showColMenu} from "./col";
|
import {getColIconByType, showColMenu} from "./col";
|
||||||
import {deleteRow, insertRows, setPageSize, updateHeader} from "./row";
|
import {deleteRow, insertRows, setPageSize, updateHeader} from "./row";
|
||||||
import {emitOpenMenu} from "../../../plugin/EventBus";
|
import {emitOpenMenu} from "../../../plugin/EventBus";
|
||||||
|
|
@ -450,7 +458,11 @@ export const updateAttrViewCellAnimation = (cellElement: HTMLElement, value: IAV
|
||||||
if (headerValue) {
|
if (headerValue) {
|
||||||
updateHeaderCell(cellElement, headerValue);
|
updateHeaderCell(cellElement, headerValue);
|
||||||
} else {
|
} else {
|
||||||
|
const hasDragFill = cellElement.querySelector(".av__drag-fill");
|
||||||
cellElement.innerHTML = renderCell(value);
|
cellElement.innerHTML = renderCell(value);
|
||||||
|
if (hasDragFill) {
|
||||||
|
addDragFill(cellElement);
|
||||||
|
}
|
||||||
renderCellAttr(cellElement, value);
|
renderCellAttr(cellElement, value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import {hasClosestBlock, hasClosestByAttribute} from "../protyle/util/hasClosest
|
||||||
import {getContenteditableElement} from "../protyle/wysiwyg/getBlock";
|
import {getContenteditableElement} from "../protyle/wysiwyg/getBlock";
|
||||||
import {focusByOffset, focusByRange, getSelectionOffset} from "../protyle/util/selection";
|
import {focusByOffset, focusByRange, getSelectionOffset} from "../protyle/util/selection";
|
||||||
import {hideElements} from "../protyle/ui/hideElements";
|
import {hideElements} from "../protyle/ui/hideElements";
|
||||||
import {fetchSyncPost} from "./fetch";
|
import {fetchPost, fetchSyncPost} from "./fetch";
|
||||||
import {Constants} from "../constants";
|
import {Constants} from "../constants";
|
||||||
import {Wnd} from "../layout/Wnd";
|
import {Wnd} from "../layout/Wnd";
|
||||||
import {getInstanceById, getWndByLayout} from "../layout/util";
|
import {getInstanceById, getWndByLayout} from "../layout/util";
|
||||||
|
|
@ -14,6 +14,7 @@ import {showMessage} from "../dialog/message";
|
||||||
import {saveScroll} from "../protyle/scroll/saveScroll";
|
import {saveScroll} from "../protyle/scroll/saveScroll";
|
||||||
import {getAllModels} from "../layout/getAll";
|
import {getAllModels} from "../layout/getAll";
|
||||||
import {App} from "../index";
|
import {App} from "../index";
|
||||||
|
import {onGet} from "../protyle/util/onGet";
|
||||||
|
|
||||||
let forwardStack: IBackStack[] = [];
|
let forwardStack: IBackStack[] = [];
|
||||||
let previousIsBack = false;
|
let previousIsBack = false;
|
||||||
|
|
@ -143,7 +144,6 @@ const focusStack = async (app: App, stack: IBackStack) => {
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// 缩放
|
|
||||||
if (stack.protyle.element.parentElement) {
|
if (stack.protyle.element.parentElement) {
|
||||||
const response = await fetchSyncPost("/api/block/checkBlockExist", {id: stack.id});
|
const response = await fetchSyncPost("/api/block/checkBlockExist", {id: stack.id});
|
||||||
if (!response.data) {
|
if (!response.data) {
|
||||||
|
|
@ -153,6 +153,40 @@ const focusStack = async (app: App, stack: IBackStack) => {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// 动态加载导致内容移除 https://github.com/siyuan-note/siyuan/issues/10692
|
||||||
|
if (!blockElement && !stack.zoomId && !stack.protyle.scroll.element.classList.contains("fn__none")) {
|
||||||
|
fetchPost("/api/filetree/getDoc", {
|
||||||
|
id: stack.id,
|
||||||
|
mode: 3,
|
||||||
|
size: window.siyuan.config.editor.dynamicLoadBlocks,
|
||||||
|
}, getResponse => {
|
||||||
|
onGet({
|
||||||
|
data: getResponse,
|
||||||
|
protyle: stack.protyle,
|
||||||
|
action: [Constants.CB_GET_FOCUS],
|
||||||
|
afterCB() {
|
||||||
|
Array.from(stack.protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${stack.id}"]`)).find((item: HTMLElement) => {
|
||||||
|
if (!hasClosestByAttribute(item, "data-type", "NodeBlockQueryEmbed")) {
|
||||||
|
blockElement = item;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (!blockElement) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
getAllModels().outline.forEach(item => {
|
||||||
|
if (item.blockId === stack.protyle.block.rootID) {
|
||||||
|
item.setCurrent(blockElement);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
focusByOffset(getContenteditableElement(blockElement), stack.position.start, stack.position.end);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 缩放
|
||||||
zoomOut({
|
zoomOut({
|
||||||
protyle: stack.protyle,
|
protyle: stack.protyle,
|
||||||
id: stack.zoomId || stack.protyle.block.rootID,
|
id: stack.zoomId || stack.protyle.block.rootID,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue