Просмотр исходного кода

:art: https://github.com/siyuan-note/siyuan/issues/9888

Vanessa 1 год назад
Родитель
Сommit
504d3f6155
2 измененных файлов с 3 добавлено и 3 удалено
  1. 2 2
      app/src/protyle/render/av/col.ts
  2. 1 1
      app/src/protyle/render/av/relation.ts

+ 2 - 2
app/src/protyle/render/av/col.ts

@@ -335,13 +335,13 @@ export const bindEditEvent = (options: {
         });
         });
         const goSearchElement = options.menuElement.querySelector('[data-type="goSearchAV"]') as HTMLElement;
         const goSearchElement = options.menuElement.querySelector('[data-type="goSearchAV"]') as HTMLElement;
         const oldValue = JSON.parse(goSearchElement.getAttribute("data-old-value"))
         const oldValue = JSON.parse(goSearchElement.getAttribute("data-old-value"))
-        const inputElement =  options.menuElement.querySelector('[data-type="colName"]') as HTMLInputElement
+        const inputElement = options.menuElement.querySelector('[data-type="colName"]') as HTMLInputElement
         inputElement.addEventListener("input", () => {
         inputElement.addEventListener("input", () => {
             toggleUpdateRelationBtn(options.menuElement, avID);
             toggleUpdateRelationBtn(options.menuElement, avID);
         })
         })
         if (oldValue.avID) {
         if (oldValue.avID) {
             fetchPost("/api/av/getAttributeView", {id: oldValue.avID}, (response) => {
             fetchPost("/api/av/getAttributeView", {id: oldValue.avID}, (response) => {
-                goSearchElement.querySelector(".b3-menu__accelerator").textContent = response.data.av.name || window.siyuan.languages.title;
+                goSearchElement.querySelector(".b3-menu__accelerator").textContent = oldValue.avID === avID ? window.siyuan.languages.thisDatabase : (response.data.av.name || window.siyuan.languages.title)
                 response.data.av.keyValues.find((item: { key: { id: string, name: string } }) => {
                 response.data.av.keyValues.find((item: { key: { id: string, name: string } }) => {
                     if (item.key.id === oldValue.backKeyID) {
                     if (item.key.id === oldValue.backKeyID) {
                         inputElement.setAttribute("data-old-value", item.key.name || window.siyuan.languages.title);
                         inputElement.setAttribute("data-old-value", item.key.name || window.siyuan.languages.title);

+ 1 - 1
app/src/protyle/render/av/relation.ts

@@ -123,7 +123,7 @@ export const toggleUpdateRelationBtn = (menuItemsElement: HTMLElement, avId: str
     const btnElement = inputItemElement.nextElementSibling;
     const btnElement = inputItemElement.nextElementSibling;
     const oldValue = JSON.parse(searchElement.dataset.oldValue);
     const oldValue = JSON.parse(searchElement.dataset.oldValue);
     if (oldValue.avID) {
     if (oldValue.avID) {
-        if (searchElement.dataset.avId !== avId) {
+        if (searchElement.dataset.avId !== avId || (searchElement.dataset.avId === avId && oldValue.avID !== avId)) {
             switchItemElement.classList.remove("fn__none");
             switchItemElement.classList.remove("fn__none");
             if (switchElement.checked) {
             if (switchElement.checked) {
                 inputItemElement.classList.remove("fn__none");
                 inputItemElement.classList.remove("fn__none");