This commit is contained in:
parent
b4f8b676d6
commit
fb220ae122
2 changed files with 5 additions and 6 deletions
|
@ -366,7 +366,7 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
|
|||
const actionElementId = actionElement.getAttribute("data-node-id");
|
||||
if (range.toString() !== "") {
|
||||
getContentByInlineHTML(range, (content) => {
|
||||
writeText(`((${actionElementId} "${Lute.EscapeHTMLStr(content.trim())}"))`);
|
||||
writeText(`((${actionElementId} "${content.trim()}"))`);
|
||||
});
|
||||
} else {
|
||||
fetchPost("/api/block/getRefText", {id: actionElementId}, (response) => {
|
||||
|
|
|
@ -997,7 +997,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
if (selectText !== "") {
|
||||
// 和复制块引用保持一致 https://github.com/siyuan-note/siyuan/issues/9093
|
||||
getContentByInlineHTML(range, (content) => {
|
||||
writeText(`${Lute.EscapeHTMLStr(content.trim())} ((${nodeElement.getAttribute("data-node-id")} "*"))`);
|
||||
writeText(`${content.trim()} ((${nodeElement.getAttribute("data-node-id")} "*"))`);
|
||||
});
|
||||
} else {
|
||||
nodeElement.setAttribute("data-reftext", "true");
|
||||
|
@ -1036,14 +1036,13 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
} else {
|
||||
getContentByInlineHTML(range, (content) => {
|
||||
const oldHTML = topElement.outerHTML;
|
||||
const name = Lute.EscapeHTMLStr(content.trim());
|
||||
const nameElement = topElement.lastElementChild.querySelector(".protyle-attr--name");
|
||||
if (nameElement) {
|
||||
nameElement.innerHTML = `<svg><use xlink:href="#iconN"></use></svg>${name}`;
|
||||
nameElement.innerHTML = `<svg><use xlink:href="#iconN"></use></svg>${content.trim()}`;
|
||||
} else {
|
||||
topElement.lastElementChild.insertAdjacentHTML("afterbegin", `<div class="protyle-attr--name"><svg><use xlink:href="#iconN"></use></svg>${name}</div>`);
|
||||
topElement.lastElementChild.insertAdjacentHTML("afterbegin", `<div class="protyle-attr--name"><svg><use xlink:href="#iconN"></use></svg>${content.trim()}</div>`);
|
||||
}
|
||||
topElement.setAttribute("name", name);
|
||||
topElement.setAttribute("name", content.trim());
|
||||
updateTransaction(protyle, topElement.getAttribute("data-node-id"), topElement.outerHTML, oldHTML);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue