mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-03 11:20:16 +01:00
This commit is contained in:
parent
9aa9a67627
commit
96c5084af6
2 changed files with 23 additions and 9 deletions
|
|
@ -174,7 +174,7 @@ export const toggleUpdateRelationBtn = (menuItemsElement: HTMLElement, avId: str
|
|||
const switchElement = switchItemElement.querySelector(".b3-switch") as HTMLInputElement;
|
||||
const inputItemElement = switchItemElement.nextElementSibling;
|
||||
const btnElement = inputItemElement.nextElementSibling;
|
||||
const oldValue = JSON.parse(searchElement.dataset.oldValue) as IAVCellRelationValue;
|
||||
const oldValue = JSON.parse(searchElement.dataset.oldValue) as IAVColumnRelation;
|
||||
if (oldValue.avID) {
|
||||
const inputElement = inputItemElement.querySelector("input") as HTMLInputElement;
|
||||
if (resetData) {
|
||||
|
|
@ -323,7 +323,7 @@ ${html || genSelectItemHTML("empty")}`;
|
|||
};
|
||||
|
||||
export const getRelationHTML = (data: IAV, cellElements?: HTMLElement[]) => {
|
||||
let colRelationData: IAVCellRelationValue;
|
||||
let colRelationData: IAVColumnRelation;
|
||||
data.view.columns.find(item => {
|
||||
if (item.id === cellElements[0].dataset.colId) {
|
||||
colRelationData = item.relation;
|
||||
|
|
@ -358,7 +358,19 @@ export const setRelationCell = (protyle: IProtyle, nodeElement: HTMLElement, tar
|
|||
if (!nodeElement.contains(cellElements[0])) {
|
||||
cellElements[0] = nodeElement.querySelector(`.av__row[data-id="${rowElement.dataset.id}"] .av__cell[data-col-id="${cellElements[0].dataset.colId}"]`) as HTMLElement;
|
||||
}
|
||||
const newValue = genCellValueByElement("relation", cellElements[0]).relation;
|
||||
const newValue:IAVCellRelationValue = {blockIDs: [], contents: []};
|
||||
menuElement.querySelectorAll('[data-type="setRelationCell"]').forEach(item => {
|
||||
const id = item.getAttribute("data-id");
|
||||
newValue.blockIDs.push(id);
|
||||
newValue.contents.push({
|
||||
type: "block",
|
||||
block: {
|
||||
id,
|
||||
content: item.querySelector(".b3-menu__label").textContent
|
||||
},
|
||||
isDetached: !item.querySelector(".popover__block")
|
||||
});
|
||||
});
|
||||
if (target.classList.contains("b3-menu__item")) {
|
||||
const targetId = target.getAttribute("data-id");
|
||||
const separatorElement = menuElement.querySelector(".b3-menu__separator");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue