This commit is contained in:
parent
2040665457
commit
0ae04cf5e6
13 changed files with 55 additions and 13 deletions
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"removeAV": "Aus der Datenbank entfernen",
|
||||
"empty": "Leer",
|
||||
"newRowInRelation": "Erstellen Sie einen neuen Eintrag in ${x} <b class='ft__on-surface'>${y}</b>",
|
||||
"copyKeyContent": "Primärschlüsseltext kopieren",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"removeAV": "Remove from database",
|
||||
"empty": "Empty",
|
||||
"newRowInRelation": "Create a new entry in ${x} <b class='ft__on-surface'>${y}</b>",
|
||||
"copyKeyContent": "Copy primary key text",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"removeAV": "Eliminar de la base de datos",
|
||||
"empty": "Vacío",
|
||||
"newRowInRelation": "Crear una nueva entrada en ${x} <b class='ft__on-surface'>${y}</b>",
|
||||
"copyKeyContent": "Copiar texto de la clave principal",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"removeAV": "Supprimer de la base de données",
|
||||
"empty": "Vide",
|
||||
"newRowInRelation": "Créer une nouvelle entrée dans ${x} <b class='ft__on-surface'>${y}</b>",
|
||||
"copyKeyContent": "Copier le texte de la clé principale",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"removeAV": "הסר ממסד הנתונים",
|
||||
"empty": "ריק",
|
||||
"newRowInRelation": "צור ערך חדש ב-${x} <b class='ft__on-surface'>${y}</b>",
|
||||
"copyKeyContent": "העתק טקסט מפתח ראשי",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"removeAV": "Rimuovi dal database",
|
||||
"empty": "Vuoto",
|
||||
"newRowInRelation": "Crea una nuova voce in ${x} <b class='ft__on-surface'>${y}</b>",
|
||||
"copyKeyContent": "Copia il testo della chiave primaria",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"removeAV": "データベースから削除",
|
||||
"empty": "空白",
|
||||
"newRowInRelation": "${x} に新しい項目を作成 <b class='ft__on-surface'>${y}</b>",
|
||||
"copyKeyContent": "主キーのテキストをコピー",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"removeAV": "Usuń z bazy danych",
|
||||
"empty": "Pusty",
|
||||
"newRowInRelation": "Utwórz nowy wpis w ${x} <b class='ft__on-surface'>${y}</b>",
|
||||
"copyKeyContent": "Skopiuj tekst klucza głównego",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"removeAV": "Удалить из базы данных",
|
||||
"empty": "Пусто",
|
||||
"newRowInRelation": "Создать новую запись в ${x} <b class='ft__on-surface'>${y}</b>",
|
||||
"copyKeyContent": "Скопировать текст основного ключа",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"removeAV": "從資料庫中移除",
|
||||
"empty": "空白",
|
||||
"newRowInRelation": "在 ${x} 中新建條目 <b class='ft__on-surface'>${y}</b>",
|
||||
"copyKeyContent": "複製主鍵文本",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"removeAV": "从数据库中移除",
|
||||
"empty": "空白",
|
||||
"newRowInRelation": "在 ${x} 中新建条目 <b class='ft__on-surface'>${y}</b>",
|
||||
"copyKeyContent": "复制主键文本",
|
||||
|
|
|
@ -25,15 +25,21 @@
|
|||
}
|
||||
|
||||
&__avheader {
|
||||
border-bottom: 1px solid var(--b3-border-color);
|
||||
padding: 8px;
|
||||
color: var(--b3-protyle-inline-blockref-color);
|
||||
opacity: .86;
|
||||
transition: var(--b3-transition);
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
padding: 0 8px 0 32px;
|
||||
align-items: center;
|
||||
min-height: 42px;
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
.block__logo {
|
||||
color: var(--b3-protyle-inline-blockref-color);
|
||||
opacity: .86;
|
||||
transition: var(--b3-transition);
|
||||
flex: 1;
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import {previewImage} from "../../preview/image";
|
|||
import {webUtils} from "electron";
|
||||
/// #endif
|
||||
import {isBrowser} from "../../../util/functions";
|
||||
import {Constants} from "../../../constants";
|
||||
|
||||
const genAVRollupHTML = (value: IAVCellValue) => {
|
||||
let html = "";
|
||||
|
@ -179,10 +180,12 @@ export const renderAVAttribute = (element: HTMLElement, id: string, protyle: IPr
|
|||
avID: string
|
||||
avName: string
|
||||
}) => {
|
||||
let innerHTML = `<div class="custom-attr__avheader block__logo popover__block" data-id='${JSON.stringify(table.blockIDs)}'>
|
||||
<div class="fn__flex-1"></div>
|
||||
<svg class="block__logoicon"><use xlink:href="#iconDatabase"></use></svg><span>${table.avName || window.siyuan.languages.database}</span>
|
||||
<div class="fn__flex-1"></div>
|
||||
let innerHTML = `<div class="custom-attr__avheader">
|
||||
<div class="block__logo popover__block" data-id='${JSON.stringify(table.blockIDs)}'>
|
||||
<svg class="block__logoicon"><use xlink:href="#iconDatabase"></use></svg><span>${table.avName || window.siyuan.languages.database}</span>
|
||||
</div>
|
||||
<span class="fn__space"></span>
|
||||
<span data-type="remove" class="block__icon block__icon--show b3-tooltips__w b3-tooltips" aria-label="${window.siyuan.languages.removeAV}"><svg><use xlink:href="#iconTrashcan"></use></svg></span>
|
||||
</div>`;
|
||||
table.keyValues?.forEach(item => {
|
||||
innerHTML += `<div class="block__icons av__row" data-id="${id}" data-col-id="${item.key.id}">
|
||||
|
@ -199,7 +202,7 @@ class="fn__flex-1 fn__flex${["url", "text", "number", "email", "phone"].includes
|
|||
});
|
||||
innerHTML += `<div class="fn__hr"></div>
|
||||
<button data-type="addColumn" class="b3-button b3-button--cancel"><svg><use xlink:href="#iconAdd"></use></svg>${window.siyuan.languages.newCol}</button>
|
||||
<div class="fn__hr--b"></div>`;
|
||||
<div class="fn__hr--b"></div><div class="fn__hr--b"></div>`;
|
||||
html += `<div data-av-id="${table.avID}" data-node-id="${id}" data-type="NodeAttributeView">${innerHTML}</div>`;
|
||||
|
||||
if (element.innerHTML) {
|
||||
|
@ -346,6 +349,28 @@ class="fn__flex-1 fn__flex${["url", "text", "number", "email", "phone"].includes
|
|||
}
|
||||
});
|
||||
element.addEventListener("click", (event) => {
|
||||
const removeElement = hasClosestByAttribute(event.target as HTMLElement, "data-type", "remove")
|
||||
if (removeElement) {
|
||||
const blockElement = hasClosestBlock(removeElement)
|
||||
if (blockElement) {
|
||||
transaction(protyle, [{
|
||||
action: "removeAttrViewBlock",
|
||||
srcIDs: [id],
|
||||
avID: blockElement.dataset.avId,
|
||||
}]);
|
||||
blockElement.remove();
|
||||
if (!element.innerHTML) {
|
||||
window.siyuan.dialogs.find(item => {
|
||||
if (item.element.getAttribute("data-key") === Constants.DIALOG_ATTR) {
|
||||
item.destroy();
|
||||
return true;
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
event.stopPropagation();
|
||||
return;
|
||||
}
|
||||
openEdit(protyle, element, event);
|
||||
});
|
||||
element.addEventListener("contextmenu", (event) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue