This commit is contained in:
parent
e9f7cc0d52
commit
7879c7a72a
2 changed files with 21 additions and 2 deletions
|
@ -14,7 +14,7 @@ import {escapeHtml} from "../util/escape";
|
|||
import {getWorkspaceName} from "../util/noRelyPCFunction";
|
||||
import {needSubscribe} from "../util/needSubscribe";
|
||||
import {redirectToCheckAuth, setNoteBook} from "../util/pathName";
|
||||
import {getAllModels} from "../layout/getAll";
|
||||
import {getAllEditor, getAllModels} from "../layout/getAll";
|
||||
import {reloadProtyle} from "../protyle/util/reload";
|
||||
import {Tab} from "../layout/Tab";
|
||||
import {setEmpty} from "../mobile/util/setEmpty";
|
||||
|
@ -144,6 +144,22 @@ export const reloadSync = (
|
|||
/// #endif
|
||||
};
|
||||
|
||||
export const setRefDynamicText = (data: {
|
||||
"blockID": string,
|
||||
"defBlockID": string,
|
||||
"refText": string,
|
||||
"rootID": string
|
||||
}) => {
|
||||
getAllEditor().forEach(item => {
|
||||
if (item.protyle.block.rootID === data.rootID) {
|
||||
const refElement = item.protyle.wysiwyg.element.querySelector(`[data-node-id="${data.blockID}"] span[data-type="block-ref"][data-subtype="d"][data-id="${data.defBlockID}"]`);
|
||||
if (refElement) {
|
||||
refElement.innerHTML = data.refText;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const lockScreen = (app: App) => {
|
||||
if (window.siyuan.config.readonly) {
|
||||
return;
|
||||
|
|
|
@ -17,7 +17,7 @@ import {
|
|||
progressBackgroundTask,
|
||||
progressLoading,
|
||||
progressStatus,
|
||||
reloadSync,
|
||||
reloadSync, setRefDynamicText,
|
||||
setTitle,
|
||||
transactionError
|
||||
} from "./dialog/processSystem";
|
||||
|
@ -61,6 +61,9 @@ export class App {
|
|||
});
|
||||
if (data) {
|
||||
switch (data.cmd) {
|
||||
case "setRefDynamicText":
|
||||
setRefDynamicText(data.data);
|
||||
break;
|
||||
case "reloadPlugin":
|
||||
reloadPlugin(this, data.data);
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue