mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-07 08:01:47 +01:00
This commit is contained in:
parent
885bc90bdc
commit
68b3d157ac
2 changed files with 15 additions and 13 deletions
|
|
@ -770,7 +770,7 @@ export abstract class Constants {
|
|||
public static readonly SIYUAN_ASSETS_IMAGE: string[] = [".apng", ".ico", ".cur", ".jpg", ".jpe", ".jpeg", ".jfif", ".pjp", ".pjpeg", ".png", ".gif", ".webp", ".bmp", ".svg", ".avif", ".tiff", ".tif"];
|
||||
public static readonly SIYUAN_ASSETS_AUDIO: string[] = [".mp3", ".wav", ".ogg", ".m4a", ".aac", ".flac"];
|
||||
public static readonly SIYUAN_ASSETS_VIDEO: string[] = [".mov", ".weba", ".mkv", ".mp4", ".webm"];
|
||||
public static readonly SIYUAN_ASSETS_EXTS: string[] = [".pdf"].concat(Constants.SIYUAN_ASSETS_IMAGE).concat(Constants.SIYUAN_ASSETS_AUDIO).concat(Constants.SIYUAN_ASSETS_VIDEO);
|
||||
public static readonly SIYUAN_ASSETS_EXTS: string[] = [".pdf"].concat(Constants.SIYUAN_ASSETS_IMAGE, Constants.SIYUAN_ASSETS_AUDIO, Constants.SIYUAN_ASSETS_VIDEO);
|
||||
public static readonly SIYUAN_ASSETS_SEARCH: string[] = [".txt", ".md", ".markdown", ".docx", ".xlsx", ".pptx", ".pdf", ".json", ".log", ".sql", ".html", ".xml", ".java", ".h", ".c",
|
||||
".cpp", ".go", ".rs", ".swift", ".kt", ".py", ".php", ".js", ".css", ".ts", ".sh", ".bat", ".cmd", ".ini", ".yaml",
|
||||
".rst", ".adoc", ".textile", ".opml", ".org", ".wiki", ".epub", ".cs"];
|
||||
|
|
|
|||
|
|
@ -460,7 +460,7 @@ export const getRelationHTML = (data: IAV, cellElements?: HTMLElement[]) => {
|
|||
}
|
||||
};
|
||||
|
||||
export const setRelationCell = (protyle: IProtyle, nodeElement: HTMLElement, target: HTMLElement, cellElements: HTMLElement[]) => {
|
||||
export const setRelationCell = async (protyle: IProtyle, nodeElement: HTMLElement, target: HTMLElement, cellElements: HTMLElement[]) => {
|
||||
const menuElement = hasClosestByClassName(target, "b3-menu");
|
||||
if (!menuElement) {
|
||||
return;
|
||||
|
|
@ -537,12 +537,22 @@ draggable="true">${genSelectItemHTML({
|
|||
if (!separatorElement.nextElementSibling) {
|
||||
separatorElement.insertAdjacentHTML("afterend", genSelectItemHTML({type: "empty"}));
|
||||
}
|
||||
updateCellsValue(protyle, nodeElement, newValue, cellElements);
|
||||
} else {
|
||||
const blockID = target.querySelector(".popover__block").getAttribute("data-id");
|
||||
const content = target.querySelector("b").textContent;
|
||||
const rowId = Lute.NewNodeID();
|
||||
const bodyElement = hasClosestByClassName(cellElements[0], "av__body");
|
||||
transaction(protyle, [{
|
||||
newValue.blockIDs.push(rowId);
|
||||
newValue.contents.push({
|
||||
type: "block",
|
||||
block: {
|
||||
content
|
||||
},
|
||||
isDetached: true
|
||||
});
|
||||
const updateOptions = await updateCellsValue(protyle, nodeElement, newValue, cellElements, null, null, true);
|
||||
const doOperations: IOperation[] = [{
|
||||
action: "insertAttrViewBlock",
|
||||
ignoreDefaultFill: true,
|
||||
avID: menuElement.firstElementChild.getAttribute("data-av-id"),
|
||||
|
|
@ -558,15 +568,8 @@ draggable="true">${genSelectItemHTML({
|
|||
action: "doUpdateUpdated",
|
||||
id: blockID,
|
||||
data: dayjs().format("YYYYMMDDHHmmss"),
|
||||
}]);
|
||||
newValue.blockIDs.push(rowId);
|
||||
newValue.contents.push({
|
||||
type: "block",
|
||||
block: {
|
||||
content
|
||||
},
|
||||
isDetached: true
|
||||
});
|
||||
}];
|
||||
transaction(protyle, doOperations.concat(updateOptions.doOperations));
|
||||
separatorElement.insertAdjacentHTML("beforebegin", `<button data-row-id="${rowId}" data-position="west" data-type="setRelationCell"
|
||||
class="${target.className} ariaLabel" draggable="true">${genSelectItemHTML({
|
||||
type: "selected",
|
||||
|
|
@ -576,6 +579,5 @@ class="${target.className} ariaLabel" draggable="true">${genSelectItemHTML({
|
|||
})}</button>`);
|
||||
}
|
||||
}
|
||||
updateCellsValue(protyle, nodeElement, newValue, cellElements);
|
||||
updateCopyRelatedItems(menuElement);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue