Skip to content

Commit

Permalink
🎨 fix #11710
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Jun 15, 2024
1 parent effaa31 commit b8346b4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/src/protyle/render/av/openMenuPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ export const openMenuPanel = (options: {
avID,
data: oldData,
}]);
const oldScroll = menuElement.querySelector(".b3-menu__items").scrollTop;
if (options.cellElements) {
menuElement.innerHTML = getSelectHTML(data.view, options.cellElements);
bindSelectEvent(options.protyle, data, menuElement, options.cellElements, options.blockElement);
Expand All @@ -369,6 +370,7 @@ export const openMenuPanel = (options: {
});
bindEditEvent({protyle: options.protyle, data, menuElement, isCustomAttr, blockID});
}
menuElement.querySelector(".b3-menu__items").scrollTop = oldScroll;
return;
}
if (targetElement.getAttribute("data-type") === "setRelationCell") {
Expand Down
8 changes: 8 additions & 0 deletions app/src/protyle/render/av/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ export const setColOption = (protyle: IProtyle, data: IAV, target: HTMLElement,
return true;
}
});
const oldScroll = menuElement.querySelector(".b3-menu__items").scrollTop;
if (!cellElements) {
menuElement.innerHTML = getEditHTML({protyle, data, colId, isCustomAttr});
bindEditEvent({protyle, data, menuElement, isCustomAttr, blockID});
Expand All @@ -203,6 +204,7 @@ export const setColOption = (protyle: IProtyle, data: IAV, target: HTMLElement,
menuElement.innerHTML = getSelectHTML(data.view, cellElements);
bindSelectEvent(protyle, data, menuElement, cellElements, blockElement);
}
menuElement.querySelector(".b3-menu__items").scrollTop = oldScroll;
});
if (menu.isOpen) {
return;
Expand Down Expand Up @@ -251,6 +253,7 @@ export const setColOption = (protyle: IProtyle, data: IAV, target: HTMLElement,
return true;
}
});
const oldScroll = menuElement.querySelector(".b3-menu__items").scrollTop;
if (!cellElements) {
menuElement.innerHTML = getEditHTML({protyle, data, colId, isCustomAttr});
bindEditEvent({protyle, data, menuElement, isCustomAttr, blockID});
Expand All @@ -276,6 +279,7 @@ export const setColOption = (protyle: IProtyle, data: IAV, target: HTMLElement,
menuElement.innerHTML = getSelectHTML(data.view, cellElements);
bindSelectEvent(protyle, data, menuElement, cellElements, blockElement);
}
menuElement.querySelector(".b3-menu__items").scrollTop = oldScroll;
});
}
});
Expand Down Expand Up @@ -325,6 +329,7 @@ export const setColOption = (protyle: IProtyle, data: IAV, target: HTMLElement,
return true;
}
});
const oldScroll = menuElement.querySelector(".b3-menu__items").scrollTop;
if (!cellElements) {
menuElement.innerHTML = getEditHTML({protyle, data, colId, isCustomAttr});
bindEditEvent({protyle, data, menuElement, isCustomAttr, blockID});
Expand All @@ -351,6 +356,7 @@ export const setColOption = (protyle: IProtyle, data: IAV, target: HTMLElement,
menuElement.innerHTML = getSelectHTML(data.view, cellElements);
bindSelectEvent(protyle, data, menuElement, cellElements, blockElement);
}
menuElement.querySelector(".b3-menu__items").scrollTop = oldScroll;
name = inputElement.value;
color = (index + 1).toString();
return true;
Expand Down Expand Up @@ -528,9 +534,11 @@ export const addColOptionOrCell = (protyle: IProtyle, data: IAV, cellElements: H
if (colData.type === "select") {
menuElement.parentElement.remove();
} else {
const oldScroll = menuElement.querySelector(".b3-menu__items").scrollTop;
menuElement.innerHTML = getSelectHTML(data.view, cellElements);
bindSelectEvent(protyle, data, menuElement, cellElements, blockElement);
menuElement.querySelector("input").focus();
menuElement.querySelector(".b3-menu__items").scrollTop = oldScroll;
}
};

Expand Down

0 comments on commit b8346b4

Please sign in to comment.