mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 16:10:12 +01:00
This commit is contained in:
parent
875b5099ce
commit
4b56408095
4 changed files with 29 additions and 5 deletions
|
|
@ -25,6 +25,7 @@ import {App} from "../index";
|
|||
import {saveScroll} from "../protyle/scroll/saveScroll";
|
||||
import {isInAndroid, isInHarmony, isInIOS, setStorageVal} from "../protyle/util/compatibility";
|
||||
import {Plugin} from "../plugin";
|
||||
import {blockRender} from "../protyle/render/blockRender";
|
||||
|
||||
const updateTitle = (rootID: string, tab: Tab, protyle?: IProtyle) => {
|
||||
fetchPost("/api/block/getDocInfo", {
|
||||
|
|
@ -156,14 +157,28 @@ export const setRefDynamicText = (data: {
|
|||
"refText": string,
|
||||
"rootID": string
|
||||
}) => {
|
||||
getAllEditor().forEach(item => {
|
||||
getAllEditor().forEach(editor => {
|
||||
// 不能对比 rootId,否则嵌入块中的锚文本无法更新
|
||||
item.protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${data.blockID}"] span[data-type~="block-ref"][data-subtype="d"][data-id="${data.defBlockID}"]`).forEach(item => {
|
||||
editor.protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${data.blockID}"] span[data-type~="block-ref"][data-subtype="d"][data-id="${data.defBlockID}"]`).forEach(item => {
|
||||
item.innerHTML = data.refText;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const reloadEmbedBlock = (data: {
|
||||
"embedBlockID": string,
|
||||
"rootID": string
|
||||
}) => {
|
||||
getAllEditor().forEach(editor => {
|
||||
if (editor.protyle.block.rootID === data.rootID) {
|
||||
editor.protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${data.embedBlockID}"]`).forEach(item => {
|
||||
item.removeAttribute("data-render");
|
||||
blockRender(editor.protyle, item);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const setDefRefCount = (data: {
|
||||
"blockID": string,
|
||||
"refCount": number,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue