Vanessa 2025-01-13 12:47:28 +08:00
parent 5a9bb84641
commit a635bcbafd
15 changed files with 63 additions and 64 deletions

View file

@ -346,7 +346,7 @@ export class Title {
}
this.element.querySelector(".protyle-attr").innerHTML = nodeAttrHTML;
if (response.data.refCount !== 0) {
this.element.querySelector(".protyle-attr").insertAdjacentHTML("beforeend", `<div class="protyle-attr--refcount popover__block" data-defids='${JSON.stringify([protyle.block.rootID])}' data-id='${JSON.stringify(response.data.refIDs)}'>${response.data.refCount}</div>`);
this.element.querySelector(".protyle-attr").insertAdjacentHTML("beforeend", `<div class="protyle-attr--refcount popover__block">${response.data.refCount}</div>`);
}
// 存在设置新建文档名模板,不能使用 Untitled 进行判断https://ld246.com/article/1649301009888
if (this.editElement && new Date().getTime() - dayjs(response.data.id.split("-")[0]).toDate().getTime() < 2000) {

View file

@ -233,7 +233,7 @@ export const getLocalStorage = (cb: () => void) => {
dark: "dark",
annoColor: "var(--b3-pdf-background1)"
};
defaultStorage[Constants.LOCAL_LAYOUTS] = []; // {name: "", layout:{}, time: number, filespaths: filesPath[]}
defaultStorage[Constants.LOCAL_LAYOUTS] = []; // {name: "", layout:{}, time: number, filespaths: IFilesPath[]}
defaultStorage[Constants.LOCAL_AI] = []; // {name: "", memo: ""}
defaultStorage[Constants.LOCAL_PLUGIN_DOCKS] = {}; // { pluginName: {dockId: IPluginDockTab}}
defaultStorage[Constants.LOCAL_PLUGINTOPUNPIN] = [];
@ -284,7 +284,7 @@ export const getLocalStorage = (cb: () => void) => {
currentTab: "emoji"
};
defaultStorage[Constants.LOCAL_FONTSTYLES] = [];
defaultStorage[Constants.LOCAL_FILESPATHS] = []; // filesPath[]
defaultStorage[Constants.LOCAL_FILESPATHS] = []; // IFilesPath[]
defaultStorage[Constants.LOCAL_SEARCHDATA] = {
page: 1,
sort: 0,

View file

@ -233,12 +233,12 @@ const setHTML = (options: {
protyle.block.id = protyle.block.rootID;
protyle.wysiwyg.element.setAttribute("data-doc-type", "NodeDocument");
}
if (protyle.options.defId) {
protyle.wysiwyg.element.querySelectorAll(`[data-id="${protyle.options.defId}"]`).forEach(item => {
protyle.options.defIds?.forEach(item => {
protyle.wysiwyg.element.querySelectorAll(`[data-id="${item}"]`).forEach(item => {
item.classList.add("def--mark");
});
protyle.options.defId = undefined;
}
});
protyle.options.defIds = [];
if (options.action.includes(Constants.CB_GET_APPEND) || options.action.includes(Constants.CB_GET_BEFORE)) {
protyle.app.plugins.forEach(item => {
item.eventBus.emit("loaded-protyle-dynamic", {

View file

@ -2436,7 +2436,7 @@ export class WYSIWYG {
app: protyle.app,
targetElement: embedItemElement,
isBacklink: false,
nodeIds: [embedId],
refDefs: [{refID: embedId}]
}));
}
/// #endif

View file

@ -1775,7 +1775,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
app: protyle.app,
isBacklink: false,
targetElement: refElement,
nodeIds: [id],
refDefs: [{refID: id}]
}));
event.preventDefault();
event.stopPropagation();