mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
This commit is contained in:
parent
bdacf3915f
commit
6abfbd52e6
2 changed files with 19 additions and 1 deletions
|
|
@ -1075,6 +1075,14 @@ export const openMenuPanel = (options: {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
break;
|
break;
|
||||||
|
} else if (type === "av-view-switch") {
|
||||||
|
if (!target.querySelector(".b3-chip--primary")) {
|
||||||
|
options.blockElement.removeAttribute("data-render");
|
||||||
|
avRender(options.blockElement, options.protyle, undefined, target.parentElement.dataset.id);
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
break;
|
||||||
} else if (type === "av-view-edit") {
|
} else if (type === "av-view-edit") {
|
||||||
if (target.parentElement.querySelector(".b3-chip--primary")) {
|
if (target.parentElement.querySelector(".b3-chip--primary")) {
|
||||||
openViewMenu({
|
openViewMenu({
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,16 @@ export const bindViewEvent = (options: {
|
||||||
inputElement.dataset.value = inputElement.value;
|
inputElement.dataset.value = inputElement.value;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
inputElement.addEventListener("keydown", (event) => {
|
||||||
|
if (event.isComposing) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (event.key === "Enter") {
|
||||||
|
event.preventDefault();
|
||||||
|
inputElement.blur();
|
||||||
|
options.menuElement.parentElement.remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
inputElement.select();
|
inputElement.select();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -158,7 +168,7 @@ export const getSwitcherHTML = (views: IAVView[], viewId: string) => {
|
||||||
views.forEach((item) => {
|
views.forEach((item) => {
|
||||||
html += `<button draggable="true" class="b3-menu__item" data-id="${item.id}">
|
html += `<button draggable="true" class="b3-menu__item" data-id="${item.id}">
|
||||||
<svg class="b3-menu__icon fn__grab"><use xlink:href="#iconDrag"></use></svg>
|
<svg class="b3-menu__icon fn__grab"><use xlink:href="#iconDrag"></use></svg>
|
||||||
<div class="fn__flex-1">
|
<div class="fn__flex-1" data-type="av-view-switch">
|
||||||
<span class="b3-chip${item.id === viewId ? " b3-chip--primary" : ""}">
|
<span class="b3-chip${item.id === viewId ? " b3-chip--primary" : ""}">
|
||||||
${item.icon ? unicode2Emoji(item.icon, "icon", true) : '<svg class="icon"><use xlink:href="#iconTable"></use></svg>'}
|
${item.icon ? unicode2Emoji(item.icon, "icon", true) : '<svg class="icon"><use xlink:href="#iconTable"></use></svg>'}
|
||||||
<span class="fn__ellipsis">${item.name}</span>
|
<span class="fn__ellipsis">${item.name}</span>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue