mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 16:40:13 +01:00
🚨
This commit is contained in:
parent
a8127fce8d
commit
32af26c519
6 changed files with 20 additions and 21 deletions
|
|
@ -61,10 +61,10 @@ const exitApp = (port, errorWindowId) => {
|
||||||
if (port.toString() === currentURL.port.toString()) {
|
if (port.toString() === currentURL.port.toString()) {
|
||||||
const hasMain = workspaces.find((workspaceItem) => {
|
const hasMain = workspaces.find((workspaceItem) => {
|
||||||
if (workspaceItem.browserWindow.id === item.id) {
|
if (workspaceItem.browserWindow.id === item.id) {
|
||||||
mainWindow = item
|
mainWindow = item;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
if (!hasMain) {
|
if (!hasMain) {
|
||||||
item.destroy();
|
item.destroy();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ const openFile = (options: IOpenFileOptions) => {
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
// https://github.com/siyuan-note/siyuan/issues/7491
|
// https://github.com/siyuan-note/siyuan/issues/7491
|
||||||
BrowserWindow.getAllWindows().find((item) => {
|
BrowserWindow.getAllWindows().find((item) => {
|
||||||
const json = getSearch("json", new URL(item.webContents.getURL()).search)
|
const json = getSearch("json", new URL(item.webContents.getURL()).search);
|
||||||
if (json) {
|
if (json) {
|
||||||
const jsonObj = JSON.parse(json);
|
const jsonObj = JSON.parse(json);
|
||||||
if ((jsonObj.children.rootId && jsonObj.children.rootId === options.rootID) ||
|
if ((jsonObj.children.rootId && jsonObj.children.rootId === options.rootID) ||
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import {closePanel} from "../util/closePanel";
|
|
||||||
import {fetchPost} from "../../util/fetch";
|
import {fetchPost} from "../../util/fetch";
|
||||||
import {setInlineStyle} from "../../util/assets";
|
import {setInlineStyle} from "../../util/assets";
|
||||||
import {genOptions} from "../../util/genOptions";
|
import {genOptions} from "../../util/genOptions";
|
||||||
|
|
|
||||||
|
|
@ -353,7 +353,7 @@ export class Background {
|
||||||
this.element.setAttribute("data-node-id", rootId);
|
this.element.setAttribute("data-node-id", rootId);
|
||||||
if (tags) {
|
if (tags) {
|
||||||
let html = "";
|
let html = "";
|
||||||
const colors = ['secondary', "primary", "info", "success", "warning", "error", ""];
|
const colors = ["secondary", "primary", "info", "success", "warning", "error", ""];
|
||||||
tags.split(",").forEach((item, index) => {
|
tags.split(",").forEach((item, index) => {
|
||||||
html += `<div class="b3-chip b3-chip--middle b3-chip--pointer b3-chip--${colors[index % 7]}" data-type="open-search">${item}<svg class="b3-chip__close" data-type="remove-tag"><use xlink:href="#iconCloseRound"></use></svg></div>`;
|
html += `<div class="b3-chip b3-chip--middle b3-chip--pointer b3-chip--${colors[index % 7]}" data-type="open-search">${item}<svg class="b3-chip__close" data-type="remove-tag"><use xlink:href="#iconCloseRound"></use></svg></div>`;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import {
|
||||||
} from "../util/selection";
|
} from "../util/selection";
|
||||||
import {
|
import {
|
||||||
hasClosestBlock,
|
hasClosestBlock,
|
||||||
hasClosestByAttribute, hasClosestByClassName,
|
hasClosestByAttribute,
|
||||||
hasClosestByMatchTag,
|
hasClosestByMatchTag,
|
||||||
hasTopClosestByAttribute
|
hasTopClosestByAttribute
|
||||||
} from "../util/hasClosest";
|
} from "../util/hasClosest";
|
||||||
|
|
@ -1007,7 +1007,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
selectElement.push(item);
|
selectElement.push(item);
|
||||||
});
|
});
|
||||||
if (selectElement.length === 0) {
|
if (selectElement.length === 0) {
|
||||||
selectElement.push(nodeElement)
|
selectElement.push(nodeElement);
|
||||||
}
|
}
|
||||||
quickMakeCard(selectElement);
|
quickMakeCard(selectElement);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import {Search} from "./index";
|
||||||
import {Wnd} from "../layout/Wnd";
|
import {Wnd} from "../layout/Wnd";
|
||||||
import {Constants} from "../constants";
|
import {Constants} from "../constants";
|
||||||
import {escapeAttr, escapeGreat, escapeHtml} from "../util/escape";
|
import {escapeAttr, escapeGreat, escapeHtml} from "../util/escape";
|
||||||
import {fetchPost, fetchSyncPost} from "../util/fetch";
|
import {fetchPost} from "../util/fetch";
|
||||||
import {openFileById} from "../editor/util";
|
import {openFileById} from "../editor/util";
|
||||||
import {showMessage} from "../dialog/message";
|
import {showMessage} from "../dialog/message";
|
||||||
import {reloadProtyle} from "../protyle/util/reload";
|
import {reloadProtyle} from "../protyle/util/reload";
|
||||||
|
|
@ -22,19 +22,19 @@ import {setStorageVal} from "../protyle/util/compatibility";
|
||||||
|
|
||||||
const appendCriteria = (element: HTMLElement, data: ISearchOption[]) => {
|
const appendCriteria = (element: HTMLElement, data: ISearchOption[]) => {
|
||||||
fetchPost("/api/storage/getCriteria", {}, (response) => {
|
fetchPost("/api/storage/getCriteria", {}, (response) => {
|
||||||
let html = '';
|
let html = "";
|
||||||
response.data.forEach((item: ISearchOption, index: number) => {
|
response.data.forEach((item: ISearchOption, index: number) => {
|
||||||
data.push(item);
|
data.push(item);
|
||||||
html += `<div data-type="set-criteria" class="b3-chip b3-chip--middle b3-chip--pointer b3-chip--${['secondary', "primary", "info", "success", "warning", "error", ""][index % 7]}">${escapeHtml(item.name)}<svg class="b3-chip__close" data-type="remove-criteria"><use xlink:href="#iconCloseRound"></use></svg></div>`
|
html += `<div data-type="set-criteria" class="b3-chip b3-chip--middle b3-chip--pointer b3-chip--${["secondary", "primary", "info", "success", "warning", "error", ""][index % 7]}">${escapeHtml(item.name)}<svg class="b3-chip__close" data-type="remove-criteria"><use xlink:href="#iconCloseRound"></use></svg></div>`;
|
||||||
})
|
});
|
||||||
element.innerHTML = html;
|
element.innerHTML = html;
|
||||||
if (html === "") {
|
if (html === "") {
|
||||||
element.classList.add("fn__none")
|
element.classList.add("fn__none");
|
||||||
} else {
|
} else {
|
||||||
element.classList.remove("fn__none")
|
element.classList.remove("fn__none");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
const saveKeyList = (type: "keys" | "replaceKeys", value: string) => {
|
const saveKeyList = (type: "keys" | "replaceKeys", value: string) => {
|
||||||
let list: string[] = window.siyuan.storage[Constants.LOCAL_SEARCHKEYS][type];
|
let list: string[] = window.siyuan.storage[Constants.LOCAL_SEARCHKEYS][type];
|
||||||
|
|
@ -193,7 +193,7 @@ export const genSearch = (config: ISearchOption, element: Element, closeCB?: ()
|
||||||
</div>
|
</div>
|
||||||
<div class="fn__loading fn__loading--top"><img width="120px" src="/stage/loading-pure.svg"></div>`;
|
<div class="fn__loading fn__loading--top"><img width="120px" src="/stage/loading-pure.svg"></div>`;
|
||||||
|
|
||||||
const criteriaData: ISearchOption[] = []
|
const criteriaData: ISearchOption[] = [];
|
||||||
appendCriteria(element.querySelector("#criteria"), criteriaData);
|
appendCriteria(element.querySelector("#criteria"), criteriaData);
|
||||||
const searchPanelElement = element.querySelector("#searchList");
|
const searchPanelElement = element.querySelector("#searchList");
|
||||||
const searchInputElement = element.querySelector("#searchInput") as HTMLInputElement;
|
const searchInputElement = element.querySelector("#searchInput") as HTMLInputElement;
|
||||||
|
|
@ -293,19 +293,19 @@ export const genSearch = (config: ISearchOption, element: Element, closeCB?: ()
|
||||||
updateConfig(element, item, config, edit);
|
updateConfig(element, item, config, edit);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
break;
|
break;
|
||||||
} else if (target.classList.contains("b3-chip__close") && target.getAttribute("data-type") === "remove-criteria") {
|
} else if (target.classList.contains("b3-chip__close") && target.getAttribute("data-type") === "remove-criteria") {
|
||||||
const name = target.parentElement.innerText.trim()
|
const name = target.parentElement.innerText.trim();
|
||||||
fetchPost("/api/storage/removeCriterion", {name});
|
fetchPost("/api/storage/removeCriterion", {name});
|
||||||
criteriaData.find((item, index) => {
|
criteriaData.find((item, index) => {
|
||||||
if (item.name === name) {
|
if (item.name === name) {
|
||||||
criteriaData.splice(index, 1);
|
criteriaData.splice(index, 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
if (target.parentElement.parentElement.childElementCount === 1) {
|
if (target.parentElement.parentElement.childElementCount === 1) {
|
||||||
target.parentElement.parentElement.classList.add("fn__none");
|
target.parentElement.parentElement.classList.add("fn__none");
|
||||||
target.parentElement.remove();
|
target.parentElement.remove();
|
||||||
|
|
@ -871,9 +871,9 @@ const addConfigMoreMenu = async (config: ISearchOption, edit: Protyle, element:
|
||||||
criteriaData.push(Object.assign({}, criterion));
|
criteriaData.push(Object.assign({}, criterion));
|
||||||
fetchPost("/api/storage/setCriterion", {criterion}, () => {
|
fetchPost("/api/storage/setCriterion", {criterion}, () => {
|
||||||
saveDialog.destroy();
|
saveDialog.destroy();
|
||||||
const criteriaElement = element.querySelector("#criteria")
|
const criteriaElement = element.querySelector("#criteria");
|
||||||
criteriaElement.classList.remove("fn__none");
|
criteriaElement.classList.remove("fn__none");
|
||||||
criteriaElement.insertAdjacentHTML("beforeend", `<div data-type="set-criteria" class="b3-chip b3-chip--middle b3-chip--pointer b3-chip--${['secondary', "primary", "info", "success", "warning", "error", ""][(criteriaElement.childElementCount) % 7]}">${criterion.name}<svg class="b3-chip__close" data-type="remove-criteria"><use xlink:href="#iconCloseRound"></use></svg></div>`)
|
criteriaElement.insertAdjacentHTML("beforeend", `<div data-type="set-criteria" class="b3-chip b3-chip--middle b3-chip--pointer b3-chip--${["secondary", "primary", "info", "success", "warning", "error", ""][(criteriaElement.childElementCount) % 7]}">${criterion.name}<svg class="b3-chip__close" data-type="remove-criteria"><use xlink:href="#iconCloseRound"></use></svg></div>`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -926,7 +926,7 @@ const updateConfig = (element: Element, item: ISearchOption, config: ISearchOpti
|
||||||
element.querySelector("#replaceHistoryBtn").parentElement.classList.add("fn__none");
|
element.querySelector("#replaceHistoryBtn").parentElement.classList.add("fn__none");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const searchPathInputElement = element.querySelector("#searchPathInput")
|
const searchPathInputElement = element.querySelector("#searchPathInput");
|
||||||
if (item.hPath) {
|
if (item.hPath) {
|
||||||
searchPathInputElement.innerHTML = `${escapeHtml(item.hPath)}<svg class="search__rmpath"><use xlink:href="#iconCloseRound"></use></svg>`;
|
searchPathInputElement.innerHTML = `${escapeHtml(item.hPath)}<svg class="search__rmpath"><use xlink:href="#iconCloseRound"></use></svg>`;
|
||||||
searchPathInputElement.setAttribute("title", item.hPath);
|
searchPathInputElement.setAttribute("title", item.hPath);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue