mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
This commit is contained in:
parent
0aa1e2c61f
commit
80c4d15cf6
3 changed files with 32 additions and 13 deletions
|
|
@ -104,6 +104,23 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&--remove {
|
||||||
|
color: var(--b3-card-error-color);
|
||||||
|
box-shadow: inset 0 0 0 .6px var(--b3-card-error-color);
|
||||||
|
background-color: transparent;
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&:focus {
|
||||||
|
background-color: var(--b3-card-error-background);
|
||||||
|
box-shadow: inset 0 0 0 1px var(--b3-card-error-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
background-color: var(--b3-card-error-background);
|
||||||
|
box-shadow: inset 0 0 0 1px var(--b3-card-error-color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&--white {
|
&--white {
|
||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
|
|
||||||
|
|
@ -859,17 +859,18 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
|
||||||
content: `<div class="b3-dialog__content">
|
content: `<div class="b3-dialog__content">
|
||||||
${window.siyuan.languages.confirmRemoveRelationField.replace("${x}", relResponse.data.av.name)}
|
${window.siyuan.languages.confirmRemoveRelationField.replace("${x}", relResponse.data.av.name)}
|
||||||
<div class="fn__hr--b"></div>
|
<div class="fn__hr--b"></div>
|
||||||
<button class="fn__block b3-button b3-button--error">${window.siyuan.languages.delete}</button>
|
<button class="fn__block b3-button b3-button--remove" data-action="delete">${window.siyuan.languages.delete}</button>
|
||||||
<div class="fn__hr"></div>
|
<div class="fn__hr"></div>
|
||||||
<button class="fn__block b3-button b3-button--warning">${window.siyuan.languages.removeButKeepRelationField}</button>
|
<button class="fn__block b3-button b3-button--remove" data-action="keep-relation">${window.siyuan.languages.removeButKeepRelationField}</button>
|
||||||
<div class="fn__hr"></div>
|
<div class="fn__hr"></div>
|
||||||
<button class="fn__block b3-button b3-button--info">${window.siyuan.languages.cancel}</button>
|
<button class="fn__block b3-button b3-button--cancel">${window.siyuan.languages.cancel}</button>
|
||||||
</div>`,
|
</div>`,
|
||||||
});
|
});
|
||||||
dialog.element.addEventListener("click", (event) => {
|
dialog.element.addEventListener("click", (event) => {
|
||||||
let target = event.target as HTMLElement;
|
let target = event.target as HTMLElement;
|
||||||
while (target && !target.isSameNode(dialog.element)) {
|
while (target && !target.isSameNode(dialog.element)) {
|
||||||
if (target.classList.contains("b3-button--error")) {
|
const action = target.getAttribute("data-action");
|
||||||
|
if (action === "delete") {
|
||||||
removeColByMenu({
|
removeColByMenu({
|
||||||
protyle,
|
protyle,
|
||||||
colId,
|
colId,
|
||||||
|
|
@ -883,7 +884,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
|
||||||
});
|
});
|
||||||
dialog.destroy();
|
dialog.destroy();
|
||||||
break;
|
break;
|
||||||
} else if (target.classList.contains("b3-button--warning")) {
|
} else if (action === "keep-relation") {
|
||||||
removeColByMenu({
|
removeColByMenu({
|
||||||
protyle,
|
protyle,
|
||||||
colId,
|
colId,
|
||||||
|
|
@ -897,7 +898,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
|
||||||
});
|
});
|
||||||
dialog.destroy();
|
dialog.destroy();
|
||||||
break;
|
break;
|
||||||
} else if (target.classList.contains("b3-button--info")) {
|
} else if (target.classList.contains("b3-button--cancel")) {
|
||||||
dialog.destroy();
|
dialog.destroy();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1099,17 +1099,18 @@ export const openMenuPanel = (options: {
|
||||||
content: `<div class="b3-dialog__content">
|
content: `<div class="b3-dialog__content">
|
||||||
${isTwoWay ? window.siyuan.languages.confirmRemoveRelationField.replace("${x}", menuElement.querySelector('.b3-menu__item[data-type="goSearchAV"] .b3-menu__accelerator').textContent) : window.siyuan.languages.removeCol.replace("${x}", menuElement.querySelector("input").value)}
|
${isTwoWay ? window.siyuan.languages.confirmRemoveRelationField.replace("${x}", menuElement.querySelector('.b3-menu__item[data-type="goSearchAV"] .b3-menu__accelerator').textContent) : window.siyuan.languages.removeCol.replace("${x}", menuElement.querySelector("input").value)}
|
||||||
<div class="fn__hr--b"></div>
|
<div class="fn__hr--b"></div>
|
||||||
<button class="fn__block b3-button b3-button--error">${window.siyuan.languages.delete}</button>
|
<button class="fn__block b3-button b3-button--remove" data-action="delete">${window.siyuan.languages.delete}</button>
|
||||||
<div class="fn__hr"></div>
|
<div class="fn__hr"></div>
|
||||||
<button class="fn__block b3-button b3-button--warning${isTwoWay ? "" : " fn__none"}">${window.siyuan.languages.removeButKeepRelationField}</button>
|
<button class="fn__block b3-button b3-button--remove${isTwoWay ? "" : " fn__none"}" data-action="keep-relation">${window.siyuan.languages.removeButKeepRelationField}</button>
|
||||||
<div class="fn__hr"></div>
|
<div class="fn__hr"></div>
|
||||||
<button class="fn__block b3-button b3-button--info">${window.siyuan.languages.cancel}</button>
|
<button class="fn__block b3-button b3-button--cancel">${window.siyuan.languages.cancel}</button>
|
||||||
</div>`,
|
</div>`,
|
||||||
});
|
});
|
||||||
dialog.element.addEventListener("click", (event) => {
|
dialog.element.addEventListener("click", (event) => {
|
||||||
let target = event.target as HTMLElement;
|
let target = event.target as HTMLElement;
|
||||||
while (target && !target.isSameNode(dialog.element)) {
|
while (target && !target.isSameNode(dialog.element)) {
|
||||||
if (target.classList.contains("b3-button--error")) {
|
const action = target.getAttribute("data-action");
|
||||||
|
if (action === "delete") {
|
||||||
removeCol({
|
removeCol({
|
||||||
protyle: options.protyle,
|
protyle: options.protyle,
|
||||||
data,
|
data,
|
||||||
|
|
@ -1124,7 +1125,7 @@ export const openMenuPanel = (options: {
|
||||||
});
|
});
|
||||||
dialog.destroy();
|
dialog.destroy();
|
||||||
break;
|
break;
|
||||||
} else if (target.classList.contains("b3-button--warning")) {
|
} else if (action === "keep-relation") {
|
||||||
removeCol({
|
removeCol({
|
||||||
protyle: options.protyle,
|
protyle: options.protyle,
|
||||||
data,
|
data,
|
||||||
|
|
@ -1139,7 +1140,7 @@ export const openMenuPanel = (options: {
|
||||||
});
|
});
|
||||||
dialog.destroy();
|
dialog.destroy();
|
||||||
break;
|
break;
|
||||||
} else if (target.classList.contains("b3-button--info")) {
|
} else if (target.classList.contains("b3-button--cancel")) {
|
||||||
dialog.destroy();
|
dialog.destroy();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue