mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-01 06:18:49 +01:00
This commit is contained in:
parent
fe6e88ea45
commit
bbd1333f93
6 changed files with 16 additions and 12 deletions
|
|
@ -6,10 +6,10 @@ import {Dialog} from "../dialog";
|
|||
import {isMobile} from "../util/functions";
|
||||
|
||||
export const AIActions = (elements: Element[], protyle: IProtyle) => {
|
||||
const ids: string[] = []
|
||||
const ids: string[] = [];
|
||||
elements.forEach(item => {
|
||||
ids.push(item.getAttribute("data-node-id"))
|
||||
})
|
||||
ids.push(item.getAttribute("data-node-id"));
|
||||
});
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
icon: "iconSparkles",
|
||||
label: window.siyuan.languages.ai,
|
||||
|
|
@ -136,4 +136,4 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
|
|||
}
|
||||
}]
|
||||
}).element);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -36,4 +36,4 @@ export const AIChat = (protyle:IProtyle) => {
|
|||
insertHTML(`${inputElement.value}${respContent}`, protyle, true);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import {Model} from "./Model";
|
|||
import {Editor} from "../editor";
|
||||
import {hasClosestByTag} from "../protyle/util/hasClosest";
|
||||
import {Constants} from "../constants";
|
||||
import {escapeHtml} from "../util/escape";
|
||||
import {escapeGreat, escapeHtml} from "../util/escape";
|
||||
import {unicode2Emoji} from "../emoji";
|
||||
import {fetchPost} from "../util/fetch";
|
||||
import {showTooltip} from "../dialog/tooltip";
|
||||
|
|
@ -63,9 +63,9 @@ export class Tab {
|
|||
id
|
||||
}, (response) => {
|
||||
if (!this.headElement.getAttribute("aria-label")) {
|
||||
showTooltip(escapeHtml(response.data), this.headElement);
|
||||
showTooltip(escapeGreat(response.data), this.headElement);
|
||||
}
|
||||
this.headElement.setAttribute("aria-label", escapeHtml(response.data));
|
||||
this.headElement.setAttribute("aria-label", escapeGreat(response.data));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -79,7 +79,7 @@ export class Tab {
|
|||
const tabElement = hasClosestByTag(event.target, "LI");
|
||||
if (tabElement) {
|
||||
event.dataTransfer.setData("text/html", tabElement.outerHTML);
|
||||
const modeJSON = {id:this.id};
|
||||
const modeJSON = {id: this.id};
|
||||
layoutToJSON(this, modeJSON);
|
||||
event.dataTransfer.setData(Constants.SIYUAN_DROP_TAB, JSON.stringify(modeJSON));
|
||||
event.dataTransfer.dropEffect = "move";
|
||||
|
|
|
|||
|
|
@ -969,9 +969,9 @@ const genImageWidthMenu = (label: string, assetElement: HTMLElement, imgElement:
|
|||
assetElement.style.width = "";
|
||||
assetElement.style.maxWidth = "";
|
||||
} else {
|
||||
assetElement.removeAttribute("style")
|
||||
assetElement.removeAttribute("style");
|
||||
}
|
||||
imgElement.removeAttribute("style")
|
||||
imgElement.removeAttribute("style");
|
||||
} else {
|
||||
assetElement.style.width = label;
|
||||
assetElement.style.maxWidth = "";
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ export const goForward = () => {
|
|||
export const goBack = () => {
|
||||
if (window.JSAndroid) {
|
||||
if (window.siyuan.menus.menu.element.classList.contains("b3-menu--fullscreen") && !window.siyuan.menus.menu.element.classList.contains("fn__none")) {
|
||||
window.siyuan.menus.menu.element.dispatchEvent(new CustomEvent("click", {detail: "back"}))
|
||||
window.siyuan.menus.menu.element.dispatchEvent(new CustomEvent("click", {detail: "back"}));
|
||||
return;
|
||||
} else if (window.siyuan.backStack.length < 1) {
|
||||
window.JSAndroid.returnDesktop();
|
||||
|
|
|
|||
|
|
@ -2,6 +2,10 @@ export const escapeHtml = (html: string) => {
|
|||
return html.replace(/&/g, "&").replace(/</g, "<");
|
||||
};
|
||||
|
||||
export const escapeGreat = (html: string) => {
|
||||
return html.replace(/</g, "<");
|
||||
};
|
||||
|
||||
export const escapeAttr = (html: string) => {
|
||||
return html.replace(/"/g, """).replace(/'/g, "'");
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue