💄 list

This commit is contained in:
Vanessa 2022-08-15 11:44:11 +08:00
parent 0fa8f1da06
commit ca9b55ded2
6 changed files with 19 additions and 19 deletions

View file

@ -75,9 +75,9 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
inputElement.addEventListener("keydown", (event) => {
if (event.key === "Enter" && !event.isComposing) {
window.siyuan.menus.menu.remove();
} else if (electronUndo(event)) {
return;
}
electronUndo(event);
});
}
}).element);
@ -231,7 +231,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
const rect = element.getBoundingClientRect();
window.siyuan.menus.menu.popup({
x: rect.left,
y: rect.top + 13,
y: rect.top + 26,
h: 26
});
window.siyuan.menus.menu.element.querySelector("input").select();
@ -645,14 +645,13 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
focusByRange(protyle.toolbar.range);
}
window.siyuan.menus.menu.remove();
return;
} else if (event.key === "Tab" && !event.isComposing) {
event.preventDefault();
event.stopPropagation();
element.nextElementSibling.querySelector("input").focus();
} else if (electronUndo(event)) {
return;
}
electronUndo(event);
});
}
}).element);
@ -688,7 +687,6 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
focusByRange(protyle.toolbar.range);
}
window.siyuan.menus.menu.remove();
return;
} else if (event.key === "Tab" && !event.isComposing) {
event.preventDefault();
event.stopPropagation();
@ -697,9 +695,9 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
} else {
element.nextElementSibling.querySelector("input").focus();
}
} else if (electronUndo(event)) {
return;
}
electronUndo(event);
});
}
}).element);
@ -729,14 +727,13 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
focusByRange(protyle.toolbar.range);
}
window.siyuan.menus.menu.remove();
return;
} else if (event.key === "Tab" && event.shiftKey && !event.isComposing) {
event.preventDefault();
event.stopPropagation();
element.previousElementSibling.querySelector("input").focus();
} else if (electronUndo(event)) {
return;
}
electronUndo(event);
});
}
}).element);
@ -779,7 +776,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
const rect = linkElement.getBoundingClientRect();
window.siyuan.menus.menu.popup({
x: rect.left,
y: rect.top + 13,
y: rect.top + 26,
h: 26
});
if (focusText || protyle.lute.IsValidLinkDest(linkAddress)) {

View file

@ -316,7 +316,7 @@ export const hintRef = (key: string, protyle: IProtyle, isQuick = false): IHintD
attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconM"></use></svg>&nbsp;${escapeHtml(item.memo)}</span>`;
}
if (attrHTML) {
attrHTML = `<div class="fn__flex b3-list-item__meta" style="line-height: 1">${attrHTML}</div>`;
attrHTML = `<div class="fn__flex b3-list-item__meta b3-list-item__showall">${attrHTML}</div>`;
}
let value = `<span data-type="block-ref" data-id="${item.id}" data-subtype="d">${item.name || item.refText}</span>`;
if (isQuick) {
@ -328,7 +328,7 @@ export const hintRef = (key: string, protyle: IProtyle, isQuick = false): IHintD
<svg class="b3-list-item__graphic popover__block" data-id="${item.id}"><use xlink:href="#${iconName}"></use></svg>
<span class="b3-list-item__text">${escapeHtml(item.content)}</span>
</div>
<div class="b3-list-item__meta">${item.hPath}</div>`,
<div class="b3-list-item__meta b3-list-item__showall" style="margin-bottom: 4px">${item.hPath}</div>`,
});
});
if (isQuick) {
@ -372,7 +372,7 @@ export const hintEmbed = (key: string, protyle: IProtyle): IHintData[] => {
attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconM"></use></svg>&nbsp;${escapeHtml(item.memo)}</span>`;
}
if (attrHTML) {
attrHTML = `<div class="fn__flex b3-list-item__meta" style="line-height: 1">${attrHTML}</div>`;
attrHTML = `<div class="fn__flex b3-list-item__meta b3-list-item__showall">${attrHTML}</div>`;
}
dataList.push({
value: `{{select * from blocks where id='${item.id}'}}`,
@ -380,7 +380,7 @@ export const hintEmbed = (key: string, protyle: IProtyle): IHintData[] => {
<svg class="b3-list-item__graphic popover__block" data-id="${item.id}"><use xlink:href="#${iconName}"></use></svg>
<span class="b3-list-item__text">${escapeHtml(item.content)}</span>
</div>
<div class="b3-list-item__meta">${item.hPath}</div>`,
<div class="b3-list-item__meta b3-list-item__showall" style="margin-bottom: 4px">${item.hPath}</div>`,
});
});
if (dataList.length === 0) {

View file

@ -306,14 +306,14 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;
attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconM"></use></svg>&nbsp;${escapeHtml(item.memo)}</span>`;
}
if (attrHTML) {
attrHTML = `<div class="fn__flex b3-list-item__meta" style="line-height: 1">${attrHTML}</div>`;
attrHTML = `<div class="fn__flex b3-list-item__meta b3-list-item__showall">${attrHTML}</div>`;
}
const blockRefHTML = `<span data-type="block-ref" data-id="${item.id}" data-subtype="s">${oldValue}</span>`;
searchHTML += `<button class="b3-list-item b3-list-item--two fn__block${index === 0 ? " b3-list-item--focus" : ""}" data-value="${encodeURIComponent(blockRefHTML)}">${attrHTML}<div class="b3-list-item__first">
<svg class="b3-list-item__graphic popover__block" data-id="${item.id}"><use xlink:href="#${iconName}"></use></svg>
<span class="b3-list-item__text">${escapeHtml(item.content)}</span>
</div>
<div class="b3-list-item__meta">${item.hPath}</div></button>`;
<div class="b3-list-item__meta b3-list-item__showall" style="margin-bottom: 4px">${item.hPath}</div></button>`;
});
if (searchHTML === "") {
searchHTML = `<button class="b3-list-item b3-list-item--two fn__block" data-value="">${window.siyuan.languages.emptyContent}</button>`;

View file

@ -867,7 +867,6 @@ export class Toolbar {
if (event.isComposing) {
return;
}
electronUndo(event);
if (event.key === "Escape" || matchHotKey("⌘↩", event)) {
this.subElement.classList.add("fn__none");
this.subElement.querySelector('[data-type="pin"]').classList.remove("block__icon--active");
@ -883,6 +882,8 @@ export class Toolbar {
// https://github.com/siyuan-note/siyuan/issues/5270
document.execCommand("insertText", false, "\t");
event.preventDefault();
} else if (electronUndo(event)) {
return;
}
});

View file

@ -96,13 +96,14 @@ export const electronUndo = (event: KeyboardEvent) => {
getCurrentWindow().webContents.undo();
event.preventDefault();
event.stopPropagation();
return;
return true;
}
if (matchHotKey(window.siyuan.config.keymap.editor.general.redo.custom, event)) {
getCurrentWindow().webContents.redo();
event.preventDefault();
event.stopPropagation();
return;
return true;
}
/// #endif
return false;
};

View file

@ -6,6 +6,7 @@ import {isMobile} from "./functions";
import {focusByRange} from "../protyle/util/selection";
import {hasClosestByClassName} from "../protyle/util/hasClosest";
import {unicode2Emoji} from "../emoji";
import {Constants} from "../constants";
export const addBaseURL = () => {
let baseURLElement = document.getElementById("baseURL");
@ -105,7 +106,7 @@ export const movePathTo = async (notebookId: string, path: string, focus = true)
return;
}
fileHTML += `<li class="b3-list-item${fileHTML === "" ? " b3-list-item--focus" : ""}" data-path="${item.path}" data-box="${item.box}">
${item.boxIcon ? ('<span class="b3-list-item__icon">' + unicode2Emoji(item.boxIcon) + "</span>") : ""}
<span class="b3-list-item__icon">${unicode2Emoji(item.boxIcon || Constants.SIYUAN_IMAGE_NOTE)}</span>
<span class="b3-list-item__showall">${escapeHtml(item.hPath)}</span>
</li>`;
});