mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 17:10:12 +01:00
This commit is contained in:
parent
1cf54c34a8
commit
e70caed46a
3 changed files with 32 additions and 12 deletions
|
|
@ -751,6 +751,7 @@ export const openMenu = (app: App, src: string, onlyMenu: boolean, showAccelerat
|
||||||
) {
|
) {
|
||||||
/// #if !MOBILE
|
/// #if !MOBILE
|
||||||
submenu.push({
|
submenu.push({
|
||||||
|
icon: "iconLayoutRight",
|
||||||
label: window.siyuan.languages.insertRight,
|
label: window.siyuan.languages.insertRight,
|
||||||
accelerator: showAccelerator ? "Click" : "",
|
accelerator: showAccelerator ? "Click" : "",
|
||||||
click() {
|
click() {
|
||||||
|
|
@ -780,6 +781,7 @@ export const openMenu = (app: App, src: string, onlyMenu: boolean, showAccelerat
|
||||||
}
|
}
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
submenu.push({
|
submenu.push({
|
||||||
|
icon: "iconFolder",
|
||||||
label: window.siyuan.languages.showInFolder,
|
label: window.siyuan.languages.showInFolder,
|
||||||
accelerator: showAccelerator ? "⌘Click" : "",
|
accelerator: showAccelerator ? "⌘Click" : "",
|
||||||
click: () => {
|
click: () => {
|
||||||
|
|
|
||||||
|
|
@ -666,7 +666,8 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
||||||
const titleElement = assetElement.querySelector(".protyle-action__title") as HTMLElement;
|
const titleElement = assetElement.querySelector(".protyle-action__title") as HTMLElement;
|
||||||
const html = nodeElement.outerHTML;
|
const html = nodeElement.outerHTML;
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label: `<div class="fn__hr--small"></div><textarea rows="1" class="b3-text-field fn__size200" placeholder="${window.siyuan.languages.imageURL}">${imgElement.getAttribute("src")}</textarea><div class="fn__hr--small"></div>`,
|
iconHTML: "",
|
||||||
|
label: `<textarea style="margin: 4px 0" rows="1" class="b3-text-field fn__size200" placeholder="${window.siyuan.languages.imageURL}">${imgElement.getAttribute("src")}</textarea>`,
|
||||||
bind(element) {
|
bind(element) {
|
||||||
element.querySelector("textarea").addEventListener("change", (event) => {
|
element.querySelector("textarea").addEventListener("change", (event) => {
|
||||||
const value = (event.target as HTMLInputElement).value.replace(/\n|\r\n|\r|\u2028|\u2029/g, "");
|
const value = (event.target as HTMLInputElement).value.replace(/\n|\r\n|\r|\u2028|\u2029/g, "");
|
||||||
|
|
@ -684,7 +685,8 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label: `<div class="fn__hr--small"></div><textarea rows="1" class="b3-text-field fn__size200" placeholder="${window.siyuan.languages.title}"></textarea><div class="fn__hr--small"></div>`,
|
iconHTML: "",
|
||||||
|
label: `<textarea style="margin: 4px 0" rows="1" class="b3-text-field fn__size200" placeholder="${window.siyuan.languages.title}"></textarea>`,
|
||||||
bind(element) {
|
bind(element) {
|
||||||
const inputElement = element.querySelector("textarea");
|
const inputElement = element.querySelector("textarea");
|
||||||
inputElement.value = titleElement.textContent;
|
inputElement.value = titleElement.textContent;
|
||||||
|
|
@ -698,7 +700,8 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label: `<div class="fn__hr--small"></div><textarea rows="1" class="b3-text-field fn__size200" placeholder="${window.siyuan.languages.tooltipText}"></textarea><div class="fn__hr--small"></div>`,
|
iconHTML: "",
|
||||||
|
label: `<textarea style="margin: 4px 0" rows="1" class="b3-text-field fn__size200" placeholder="${window.siyuan.languages.tooltipText}"></textarea>`,
|
||||||
bind(element) {
|
bind(element) {
|
||||||
element.querySelector("textarea").value = imgElement.getAttribute("alt") || "";
|
element.querySelector("textarea").value = imgElement.getAttribute("alt") || "";
|
||||||
}
|
}
|
||||||
|
|
@ -734,7 +737,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
iconHTML: Constants.ZWSP,
|
iconHTML: Constants.ZWSP,
|
||||||
label: `<div class="fn__hr--small"></div><textarea data-type="ocr" rows="1" class="b3-text-field fn__size200" placeholder="${window.siyuan.languages.ocrResult}"></textarea><div class="fn__hr--small"></div>`,
|
label: `<textarea data-type="ocr" style="margin: 4px 0" rows="1" class="b3-text-field fn__size200" placeholder="${window.siyuan.languages.ocrResult}"></textarea>`,
|
||||||
bind(element) {
|
bind(element) {
|
||||||
fetchPost("/api/asset/getImageOCRText", {
|
fetchPost("/api/asset/getImageOCRText", {
|
||||||
path: imgElement.getAttribute("src"),
|
path: imgElement.getAttribute("src"),
|
||||||
|
|
@ -876,7 +879,8 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
|
||||||
const html = nodeElement.outerHTML;
|
const html = nodeElement.outerHTML;
|
||||||
const linkAddress = linkElement.getAttribute("data-href");
|
const linkAddress = linkElement.getAttribute("data-href");
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label: `<div class="fn__hr--small"></div><textarea rows="1" style="width: ${isMobile() ? "200" : "360"}px" class="b3-text-field" placeholder="${window.siyuan.languages.link}"></textarea><div class="fn__hr--small"></div>`,
|
iconHTML: "",
|
||||||
|
label: `<textarea rows="1" style="margin:4px 0;width: ${isMobile() ? "200" : "360"}px" class="b3-text-field" placeholder="${window.siyuan.languages.link}"></textarea>`,
|
||||||
bind(element) {
|
bind(element) {
|
||||||
const inputElement = element.querySelector("textarea");
|
const inputElement = element.querySelector("textarea");
|
||||||
inputElement.value = Lute.UnEscapeHTMLStr(linkAddress) || "";
|
inputElement.value = Lute.UnEscapeHTMLStr(linkAddress) || "";
|
||||||
|
|
@ -896,7 +900,8 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label: `<div class="fn__hr--small"></div><textarea style="width: ${isMobile() ? "200" : "360"}px" rows="1" class="b3-text-field" placeholder="${window.siyuan.languages.anchor}"></textarea><div class="fn__hr--small"></div>`,
|
iconHTML: "",
|
||||||
|
label: `<textarea style="width: ${isMobile() ? "200" : "360"}px;margin: 4px 0;" rows="1" class="b3-text-field" placeholder="${window.siyuan.languages.anchor}"></textarea>`,
|
||||||
bind(element) {
|
bind(element) {
|
||||||
const inputElement = element.querySelector("textarea");
|
const inputElement = element.querySelector("textarea");
|
||||||
// https://github.com/siyuan-note/siyuan/issues/6798
|
// https://github.com/siyuan-note/siyuan/issues/6798
|
||||||
|
|
@ -938,7 +943,8 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label: `<div class="fn__hr--small"></div><textarea style="width: ${isMobile() ? "200" : "360"}px" rows="1" class="b3-text-field" placeholder="${window.siyuan.languages.title}"></textarea><div class="fn__hr--small"></div>`,
|
iconHTML: "",
|
||||||
|
label: `<textarea style="width: ${isMobile() ? "200" : "360"}px;margin: 4px 0;" rows="1" class="b3-text-field" placeholder="${window.siyuan.languages.title}"></textarea>`,
|
||||||
bind(element) {
|
bind(element) {
|
||||||
const inputElement = element.querySelector("textarea");
|
const inputElement = element.querySelector("textarea");
|
||||||
inputElement.value = Lute.UnEscapeHTMLStr(linkElement.getAttribute("data-title") || "");
|
inputElement.value = Lute.UnEscapeHTMLStr(linkElement.getAttribute("data-title") || "");
|
||||||
|
|
@ -1063,7 +1069,7 @@ export const tagMenu = (protyle: IProtyle, tagElement: HTMLElement) => {
|
||||||
const id = nodeElement.getAttribute("data-node-id");
|
const id = nodeElement.getAttribute("data-node-id");
|
||||||
let html = nodeElement.outerHTML;
|
let html = nodeElement.outerHTML;
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label: `<div class="fn__hr--small"></div><input class="b3-text-field fn__size200" placeholder="${window.siyuan.languages.tag}"><div class="fn__hr--small"></div>`,
|
label: `<input class="b3-text-field fn__size200" style="margin: 4px 0" placeholder="${window.siyuan.languages.tag}">`,
|
||||||
bind(element) {
|
bind(element) {
|
||||||
const inputElement = element.querySelector("input");
|
const inputElement = element.querySelector("input");
|
||||||
inputElement.value = tagElement.textContent.replace(Constants.ZWSP, "");
|
inputElement.value = tagElement.textContent.replace(Constants.ZWSP, "");
|
||||||
|
|
@ -1192,7 +1198,7 @@ export const iframeMenu = (protyle: IProtyle, nodeElement: Element) => {
|
||||||
let html = nodeElement.outerHTML;
|
let html = nodeElement.outerHTML;
|
||||||
const subMenus: IMenu[] = [{
|
const subMenus: IMenu[] = [{
|
||||||
iconHTML: "",
|
iconHTML: "",
|
||||||
label: `<div class="fn__hr--small"></div><textarea rows="1" class="b3-text-field fn__size200" placeholder="${window.siyuan.languages.link}">${iframeElement.getAttribute("src") || ""}</textarea><div class="fn__hr--small"></div>`,
|
label: `<textarea rows="1" class="b3-text-field fn__size200" placeholder="${window.siyuan.languages.link}" style="margin: 4px 0">${iframeElement.getAttribute("src") || ""}</textarea>`,
|
||||||
bind(element) {
|
bind(element) {
|
||||||
element.querySelector("textarea").addEventListener("change", (event) => {
|
element.querySelector("textarea").addEventListener("change", (event) => {
|
||||||
const value = (event.target as HTMLTextAreaElement).value.replace(/\n|\r\n|\r|\u2028|\u2029/g, "");
|
const value = (event.target as HTMLTextAreaElement).value.replace(/\n|\r\n|\r|\u2028|\u2029/g, "");
|
||||||
|
|
@ -1256,7 +1262,8 @@ export const videoMenu = (protyle: IProtyle, nodeElement: Element, type: string)
|
||||||
const videoElement = nodeElement.querySelector(type === "NodeVideo" ? "video" : "audio");
|
const videoElement = nodeElement.querySelector(type === "NodeVideo" ? "video" : "audio");
|
||||||
let html = nodeElement.outerHTML;
|
let html = nodeElement.outerHTML;
|
||||||
const subMenus: IMenu[] = [{
|
const subMenus: IMenu[] = [{
|
||||||
label: `<div class="fn__hr--small"></div><textarea rows="1" class="b3-text-field" placeholder="${window.siyuan.languages.link}">${videoElement.getAttribute("src")}</textarea><div class="fn__hr--small"></div>`,
|
iconHTML: "",
|
||||||
|
label: `<textarea rows="1" style="margin: 4px 0" class="b3-text-field" placeholder="${window.siyuan.languages.link}">${videoElement.getAttribute("src")}</textarea>`,
|
||||||
bind(element) {
|
bind(element) {
|
||||||
element.querySelector("textarea").addEventListener("change", (event) => {
|
element.querySelector("textarea").addEventListener("change", (event) => {
|
||||||
videoElement.setAttribute("src", (event.target as HTMLTextAreaElement).value.replace(/\n|\r\n|\r|\u2028|\u2029/g, ""));
|
videoElement.setAttribute("src", (event.target as HTMLTextAreaElement).value.replace(/\n|\r\n|\r|\u2028|\u2029/g, ""));
|
||||||
|
|
|
||||||
|
|
@ -471,16 +471,27 @@ export const setFilter = (options: {
|
||||||
<option ${"Ends with" === options.filter.operator ? "selected" : ""} value="Ends with">${window.siyuan.languages.filterOperatorEndsWith}</option>
|
<option ${"Ends with" === options.filter.operator ? "selected" : ""} value="Ends with">${window.siyuan.languages.filterOperatorEndsWith}</option>
|
||||||
<option ${"Is empty" === options.filter.operator ? "selected" : ""} value="Is empty">${window.siyuan.languages.filterOperatorIsEmpty}</option>
|
<option ${"Is empty" === options.filter.operator ? "selected" : ""} value="Is empty">${window.siyuan.languages.filterOperatorIsEmpty}</option>
|
||||||
<option ${"Is not empty" === options.filter.operator ? "selected" : ""} value="Is not empty">${window.siyuan.languages.filterOperatorIsNotEmpty}</option>
|
<option ${"Is not empty" === options.filter.operator ? "selected" : ""} value="Is not empty">${window.siyuan.languages.filterOperatorIsNotEmpty}</option>
|
||||||
|
`;
|
||||||
|
break;
|
||||||
|
case "number":
|
||||||
|
selectHTML = `<option ${"=" === options.filter.operator ? "selected" : ""} value="=">=</option>
|
||||||
|
<option ${"!=" === options.filter.operator ? "selected" : ""} value="!=">!=</option>
|
||||||
|
<option ${">" === options.filter.operator ? "selected" : ""} value=">">></option>
|
||||||
|
<option ${"<" === options.filter.operator ? "selected" : ""} value="<"><</option>
|
||||||
|
<option ${">=" === options.filter.operator ? "selected" : ""} value=">=">≥</option>
|
||||||
|
<option ${"<=" === options.filter.operator ? "selected" : ""} value="<=">≤</option>
|
||||||
|
<option ${"Is empty" === options.filter.operator ? "selected" : ""} value="Is empty">${window.siyuan.languages.filterOperatorIsEmpty}</option>
|
||||||
|
<option ${"Is not empty" === options.filter.operator ? "selected" : ""} value="Is not empty">${window.siyuan.languages.filterOperatorIsNotEmpty}</option>
|
||||||
`;
|
`;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
menu.addItem({
|
menu.addItem({
|
||||||
iconHTML: "",
|
iconHTML: "",
|
||||||
label: `<select class="b3-select fn__size200">${selectHTML}</select>`
|
label: `<select style="margin: 4px 0" class="b3-select fn__size200">${selectHTML}</select>`
|
||||||
});
|
});
|
||||||
menu.addItem({
|
menu.addItem({
|
||||||
iconHTML: "",
|
iconHTML: "",
|
||||||
label: `<input value="${options.filter.value[colType].content}" class="b3-text-field fn__size200">`
|
label: `<input style="margin: 4px 0" value="${options.filter.value[colType].content}" class="b3-text-field fn__size200">`
|
||||||
});
|
});
|
||||||
const textElement = (window.siyuan.menus.menu.element.querySelector(".b3-text-field") as HTMLInputElement);
|
const textElement = (window.siyuan.menus.menu.element.querySelector(".b3-text-field") as HTMLInputElement);
|
||||||
textElement.addEventListener("keydown", (event) => {
|
textElement.addEventListener("keydown", (event) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue