mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-30 21:38:48 +01:00
This commit is contained in:
parent
8eeb73d283
commit
6f39936bb0
1 changed files with 6 additions and 0 deletions
|
|
@ -207,6 +207,7 @@ export const fileAnnotationRefMenu = (protyle: IProtyle, refElement: HTMLElement
|
|||
<div class="b3-menu__label">${window.siyuan.languages.anchor}</div>
|
||||
<textarea rows="1" style="margin:4px 0;width: ${isMobile() ? "200" : "360"}px" class="b3-text-field"></textarea>`,
|
||||
bind(menuItemElement) {
|
||||
menuItemElement.style.maxWidth = "none";
|
||||
anchorElement = menuItemElement.querySelectorAll(".b3-text-field")[1] as HTMLInputElement;
|
||||
anchorElement.value = refElement.textContent;
|
||||
const inputEvent = () => {
|
||||
|
|
@ -880,6 +881,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
<div class="b3-menu__label">${window.siyuan.languages.tooltipText}</div>
|
||||
<textarea style="margin:4px 0;width: ${isMobile() ? "200" : "360"}px" rows="1" class="b3-text-field"></textarea>`,
|
||||
bind(element) {
|
||||
element.style.maxWidth = "none";
|
||||
const textElements = element.querySelectorAll("textarea");
|
||||
textElements[0].addEventListener("input", (event: InputEvent) => {
|
||||
if (event.isComposing) {
|
||||
|
|
@ -968,6 +970,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
type: "readonly",
|
||||
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) {
|
||||
element.style.maxWidth = "none";
|
||||
fetchPost("/api/asset/getImageOCRText", {
|
||||
path: imgElement.getAttribute("src"),
|
||||
force: false
|
||||
|
|
@ -1103,6 +1106,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
|
|||
<div class="b3-menu__label">${window.siyuan.languages.title}</div>
|
||||
<textarea style="width: ${isMobile() ? "200" : "360"}px;margin: 4px 0;" rows="1" class="b3-text-field"></textarea>`,
|
||||
bind(element) {
|
||||
element.style.maxWidth = "none";
|
||||
const inputElements = element.querySelectorAll("textarea");
|
||||
inputElements[0].value = Lute.UnEscapeHTMLStr(linkAddress) || "";
|
||||
inputElements[0].addEventListener("keydown", (event) => {
|
||||
|
|
@ -1419,6 +1423,7 @@ export const iframeMenu = (protyle: IProtyle, nodeElement: Element) => {
|
|||
type: "readonly",
|
||||
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) {
|
||||
element.style.maxWidth = "none";
|
||||
element.querySelector("textarea").addEventListener("change", (event) => {
|
||||
const value = (event.target as HTMLTextAreaElement).value.replace(/\n|\r\n|\r|\u2028|\u2029/g, "");
|
||||
const biliMatch = value.match(/(?:www\.|\/\/)bilibili\.com\/video\/(\w+)/);
|
||||
|
|
@ -1484,6 +1489,7 @@ export const videoMenu = (protyle: IProtyle, nodeElement: Element, type: string)
|
|||
type: "readonly",
|
||||
label: `<textarea rows="1" style="margin: 4px 0" class="b3-text-field" placeholder="${window.siyuan.languages.link}">${videoElement.getAttribute("src")}</textarea>`,
|
||||
bind(element) {
|
||||
element.style.maxWidth = "none";
|
||||
element.querySelector("textarea").addEventListener("change", (event) => {
|
||||
videoElement.setAttribute("src", (event.target as HTMLTextAreaElement).value.replace(/\n|\r\n|\r|\u2028|\u2029/g, ""));
|
||||
updateTransaction(protyle, id, nodeElement.outerHTML, html);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue