mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 01:20:12 +01:00
🚨
This commit is contained in:
parent
e0ebc536d5
commit
5781bb6356
3 changed files with 13 additions and 13 deletions
|
|
@ -15,7 +15,7 @@ export const keymap = {
|
||||||
let html = "";
|
let html = "";
|
||||||
Object.keys(keymap).forEach(key => {
|
Object.keys(keymap).forEach(key => {
|
||||||
if (window.siyuan.languages[key]) {
|
if (window.siyuan.languages[key]) {
|
||||||
const keyValue = updateHotkeyTip(keymap[key].custom)
|
const keyValue = updateHotkeyTip(keymap[key].custom);
|
||||||
html += `<label class="b3-list-item b3-list-item--narrow b3-list-item--hide-action">
|
html += `<label class="b3-list-item b3-list-item--narrow b3-list-item--hide-action">
|
||||||
<span class="b3-list-item__text">${window.siyuan.languages[key]}</span>
|
<span class="b3-list-item__text">${window.siyuan.languages[key]}</span>
|
||||||
<span data-type="reset" class="b3-list-item__action b3-tooltips b3-tooltips__w" aria-label="${window.siyuan.languages.reset}">
|
<span data-type="reset" class="b3-list-item__action b3-tooltips b3-tooltips__w" aria-label="${window.siyuan.languages.reset}">
|
||||||
|
|
@ -340,9 +340,9 @@ export const keymap = {
|
||||||
});
|
});
|
||||||
item.addEventListener("blur", function () {
|
item.addEventListener("blur", function () {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.classList.add("fn__none")
|
this.classList.add("fn__none");
|
||||||
this.previousElementSibling.textContent = this.value
|
this.previousElementSibling.textContent = this.value;
|
||||||
this.previousElementSibling.classList.remove("fn__none")
|
this.previousElementSibling.classList.remove("fn__none");
|
||||||
}, Constants.TIMEOUT_INPUT); // 隐藏的话点击删除无法 target 会为 li
|
}, Constants.TIMEOUT_INPUT); // 隐藏的话点击删除无法 target 会为 li
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -294,7 +294,7 @@ const genAttr = (attrs: IObject, focusName = "bookmark", cb: (dialog: Dialog, rm
|
||||||
}
|
}
|
||||||
bindAttrInput(item, btnsElement[2]);
|
bindAttrInput(item, btnsElement[2]);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
export const openFileAttr = (attrs: IObject, id: string, focusName = "bookmark") => {
|
export const openFileAttr = (attrs: IObject, id: string, focusName = "bookmark") => {
|
||||||
genAttr(attrs, focusName, (dialog) => {
|
genAttr(attrs, focusName, (dialog) => {
|
||||||
|
|
@ -307,7 +307,7 @@ export const openFileAttr = (attrs: IObject, id: string, focusName = "bookmark")
|
||||||
if (item.tagName === "INPUT") {
|
if (item.tagName === "INPUT") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
name = "custom-" + (item.parentElement.querySelector(".b3-text-field") as HTMLInputElement).value
|
name = "custom-" + (item.parentElement.querySelector(".b3-text-field") as HTMLInputElement).value;
|
||||||
}
|
}
|
||||||
if (item.value.trim()) {
|
if (item.value.trim()) {
|
||||||
if (!/^[0-9a-zA-Z\-]*$/.test(name.replace("custom-", "")) || name === "custom-") {
|
if (!/^[0-9a-zA-Z\-]*$/.test(name.replace("custom-", "")) || name === "custom-") {
|
||||||
|
|
@ -359,7 +359,7 @@ export const openFileAttr = (attrs: IObject, id: string, focusName = "bookmark")
|
||||||
/// #endif
|
/// #endif
|
||||||
});
|
});
|
||||||
dialog.destroy();
|
dialog.destroy();
|
||||||
})
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const openAttr = (nodeElement: Element, protyle: IProtyle, focusName = "bookmark") => {
|
export const openAttr = (nodeElement: Element, protyle: IProtyle, focusName = "bookmark") => {
|
||||||
|
|
@ -378,7 +378,7 @@ export const openAttr = (nodeElement: Element, protyle: IProtyle, focusName = "b
|
||||||
if (item.tagName === "INPUT") {
|
if (item.tagName === "INPUT") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
name = "custom-" + (item.parentElement.querySelector(".b3-text-field") as HTMLInputElement).value
|
name = "custom-" + (item.parentElement.querySelector(".b3-text-field") as HTMLInputElement).value;
|
||||||
}
|
}
|
||||||
if (item.value.trim()) {
|
if (item.value.trim()) {
|
||||||
if (!/^[0-9a-zA-Z\-]*$/.test(name.replace("custom-", "")) || name === "custom-") {
|
if (!/^[0-9a-zA-Z\-]*$/.test(name.replace("custom-", "")) || name === "custom-") {
|
||||||
|
|
@ -432,7 +432,7 @@ export const openAttr = (nodeElement: Element, protyle: IProtyle, focusName = "b
|
||||||
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
|
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
|
||||||
updateTransaction(protyle, id, nodeElement.outerHTML, oldHTML);
|
updateTransaction(protyle, id, nodeElement.outerHTML, oldHTML);
|
||||||
dialog.destroy();
|
dialog.destroy();
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -428,10 +428,10 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, focus: b
|
||||||
if (operation.action === "updateAttrs") { // 调用接口才推送
|
if (operation.action === "updateAttrs") { // 调用接口才推送
|
||||||
const data = operation.data as any;
|
const data = operation.data as any;
|
||||||
const attrsResult: IObject = {};
|
const attrsResult: IObject = {};
|
||||||
let bookmarkHTML = ''
|
let bookmarkHTML = "";
|
||||||
let nameHTML = ''
|
let nameHTML = "";
|
||||||
let aliasHTML = ''
|
let aliasHTML = "";
|
||||||
let memoHTML = ''
|
let memoHTML = "";
|
||||||
Object.keys(data.new).forEach(key => {
|
Object.keys(data.new).forEach(key => {
|
||||||
attrsResult[key] = data.new[key];
|
attrsResult[key] = data.new[key];
|
||||||
const escapeHTML = Lute.EscapeHTMLStr(data.new[key]);
|
const escapeHTML = Lute.EscapeHTMLStr(data.new[key]);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue