This commit is contained in:
Vanessa 2023-04-28 22:13:55 +08:00
parent b7589e20a2
commit da24409e96
8 changed files with 29 additions and 26 deletions

View file

@ -66,5 +66,5 @@ export const newCardModel = (options: {
});
}
});
return custom
}
return custom;
};

View file

@ -21,7 +21,7 @@ export const genCardHTML = (options: {
blocks: ICard[],
isTab: boolean
}) => {
let iconsHTML:string
let iconsHTML:string;
/// #if MOBILE
iconsHTML=`<div class="toolbar toolbar--border">
<svg class="toolbar__icon"><use xlink:href="#iconRiffCard"></use></svg>

View file

@ -1,7 +1,7 @@
import {Tab} from "../layout/Tab";
import {Editor} from "./index";
import {Wnd} from "../layout/Wnd";
import {getDockByType, getInstanceById, getWndByLayout, pdfIsLoading, resizeTabs, setPanelFocus} from "../layout/util";
import {getDockByType, getInstanceById, getWndByLayout, pdfIsLoading, setPanelFocus} from "../layout/util";
import {getAllModels, getAllTabs} from "../layout/getAll";
import {highlightById, scrollCenter} from "../util/highlightById";
import {getDisplayName, pathPosix} from "../util/pathName";

View file

@ -35,7 +35,7 @@ import {getIdZoomInByPath} from "../util/pathName";
import {openHistory} from "../history/history";
import {Custom} from "./dock/Custom";
import {newCardModel} from "../card/newCardTab";
import {openRecentDocs} from "../business/openRecentDocs";
import { openRecentDocs } from "../business/openRecentDocs";
export const setPanelFocus = (element: Element) => {
if (element.classList.contains("layout__tab--active") || element.classList.contains("layout__wnd--active")) {
@ -799,6 +799,8 @@ export const newCenterEmptyTab = () => {
</div>
<div class="b3-label__text">${window.siyuan.languages.slogan}</div>
</div>
<h1>${window.siyuan.languages.noOpenFile}</h1>
<div class="fn__hr"></div>
<div class="fn__hr"></div>
<div class="b3-list-item" id="editorEmptySearch">
<svg class="b3-list-item__graphic"><use xlink:href="#iconSearch"></use></svg>
@ -836,7 +838,7 @@ export const newCenterEmptyTab = () => {
if (target.id === "editorEmptySearch") {
openSearch(window.siyuan.config.keymap.general.globalSearch.custom);
event.stopPropagation();
event.preventDefault()
event.preventDefault();
break;
} else if (target.id === "editorEmptyRecent") {
const openRecentDocsDialog = window.siyuan.dialogs.find(item => {
@ -850,32 +852,32 @@ export const newCenterEmptyTab = () => {
}
openRecentDocs();
event.stopPropagation();
event.preventDefault()
event.preventDefault();
break;
}else if (target.id === "editorEmptyHistory") {
openHistory();
event.stopPropagation();
event.preventDefault()
event.preventDefault();
break;
}else if (target.id === "editorEmptyFile") {
newFile(undefined, undefined, undefined, true);
event.stopPropagation();
event.preventDefault()
event.preventDefault();
break;
}else if (target.id === "editorEmptyNewNotebook") {
newNotebook();
event.stopPropagation();
event.preventDefault()
event.preventDefault();
break;
}else if (target.id === "editorEmptyHelp") {
mountHelp()
mountHelp();
event.stopPropagation();
event.preventDefault()
event.preventDefault();
break;
}
target = target.parentElement
target = target.parentElement;
}
})
});
}
});
};

View file

@ -14,7 +14,8 @@ export const setEmpty = () => {
if (emptyElement.innerHTML !== "") {
return;
}
emptyElement.innerHTML = `
emptyElement.innerHTML = `<h1 style="width: 200px">${window.siyuan.languages.noOpenFile}</h1>
<div class="fn__hr--b"></div>
<div id="emptySearch" class="b3-list-item">
<svg class="b3-list-item__graphic"><use xlink:href="#iconSearch"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.search}</span>
</div>
@ -39,17 +40,17 @@ export const setEmpty = () => {
if (target.id === "emptySearch") {
popSearch();
event.stopPropagation();
event.preventDefault()
event.preventDefault();
break;
} else if (target.id === "emptyRecent") {
getRecentDocs();
event.stopPropagation();
event.preventDefault()
event.preventDefault();
break;
} else if (target.id === "emptyHistory") {
openHistory();
event.stopPropagation();
event.preventDefault()
event.preventDefault();
break;
} else if (target.id === "emptyNewFile") {
if (window.siyuan.mobile.editor) {
@ -63,17 +64,17 @@ export const setEmpty = () => {
});
}
event.stopPropagation();
event.preventDefault()
event.preventDefault();
break;
} else if (target.id === "emptyNewNotebook") {
newNotebook();
event.stopPropagation();
event.preventDefault()
event.preventDefault();
break;
} else if (target.id === "emptyHelp") {
mountHelp();
event.stopPropagation();
event.preventDefault()
event.preventDefault();
break;
}
target = target.parentElement;

View file

@ -36,7 +36,7 @@ export const hintSlash = (key: string, protyle: IProtyle) => {
}, {
filter: ["引用块", "yinyong", "yy", "block reference"],
value: "((",
html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconRef"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.ref}</span><span class="b3-list-item__meta">((</span></div>`,
html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconRef"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.blockRef}</span><span class="b3-list-item__meta">((</span></div>`,
}, {
filter: ["嵌入块", "qianrukuai", "qrk", "embed block"],
value: "{{",
@ -323,7 +323,7 @@ export const hintRef = (key: string, protyle: IProtyle, isQuick = false): IHintD
let iconHTML;
if (item.type === "NodeDocument" && item.ial.icon){
iconHTML = unicode2Emoji(item.ial.icon, false, "b3-list-item__graphic popover__block", true);
iconHTML = iconHTML.replace('popover__block"', `popover__block" data-id="${item.id}"`)
iconHTML = iconHTML.replace('popover__block"', `popover__block" data-id="${item.id}"`);
} else {
iconHTML = `<svg class="b3-list-item__graphic popover__block" data-id="${item.id}"><use xlink:href="#${getIconByType(item.type)}"></use></svg>`;
}
@ -387,7 +387,7 @@ export const hintEmbed = (key: string, protyle: IProtyle): IHintData[] => {
let iconHTML;
if (item.type === "NodeDocument" && item.ial.icon){
iconHTML = unicode2Emoji(item.ial.icon, false, "b3-list-item__graphic popover__block", true);
iconHTML = iconHTML.replace('popover__block"', `popover__block" data-id="${item.id}"`)
iconHTML = iconHTML.replace('popover__block"', `popover__block" data-id="${item.id}"`);
} else {
iconHTML = `<svg class="b3-list-item__graphic popover__block" data-id="${item.id}"><use xlink:href="#${getIconByType(item.type)}"></use></svg>`;
}

View file

@ -340,7 +340,7 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;
let iconHTML;
if (item.type === "NodeDocument" && item.ial.icon) {
iconHTML = unicode2Emoji(item.ial.icon, false, "b3-list-item__graphic popover__block", true);
iconHTML = iconHTML.replace('popover__block"', `popover__block" data-id="${item.id}"`)
iconHTML = iconHTML.replace('popover__block"', `popover__block" data-id="${item.id}"`);
} else {
iconHTML = `<svg class="b3-list-item__graphic popover__block" data-id="${item.id}"><use xlink:href="#${getIconByType(item.type)}"></use></svg>`;
}

View file

@ -50,7 +50,7 @@ export const looseJsonParse = (text: string) => {
export const objEquals = (a: any, b: any): boolean => {
if (a === b) return true;
if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime();
if (!a || !b || (typeof a !== 'object' && typeof b !== 'object')) return a === b;
if (!a || !b || (typeof a !== "object" && typeof b !== "object")) return a === b;
if (a.prototype !== b.prototype) return false;
const keys = Object.keys(a);
if (keys.length !== Object.keys(b).length) return false;