mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-30 12:35:22 +08:00
1 parent
38004171cf
commit
e891600510
2 files changed
+18
-25
No files matched your search
@@ -2551,23 +2551,18 @@ button.outline-link:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.attachment-row {
|
.attachment-row {
|
||||||
display: flex;
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr) auto;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.attachment-row .attachment-item {
|
.attachment-row .attachment-item {
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
flex: 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.attachment-actions {
|
.attachment-actions {
|
||||||
flex: 0 0 60px;
|
flex-wrap: nowrap;
|
||||||
width: 60px;
|
|
||||||
border: 1px solid var(--line-strong);
|
|
||||||
background: #ffffff;
|
|
||||||
color: #1f2428;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.attachment-item {
|
.attachment-item {
|
||||||
|
|||||||
+15
-17
@@ -7346,25 +7346,23 @@ function renderAttachments() {
|
|||||||
item.addEventListener("click", () => downloadAttachment(attachment));
|
item.addEventListener("click", () => downloadAttachment(attachment));
|
||||||
row.append(item);
|
row.append(item);
|
||||||
if (state.editing) {
|
if (state.editing) {
|
||||||
const actions = document.createElement("select");
|
const actions = document.createElement("div");
|
||||||
actions.className = "small-button attachment-actions";
|
actions.className = "panel-actions attachment-actions";
|
||||||
actions.title = "附件操作";
|
actions.setAttribute("role", "group");
|
||||||
actions.setAttribute("aria-label", `${attachment.name} 操作`);
|
actions.setAttribute("aria-label", `${attachment.name} 操作`);
|
||||||
for (const [value, text] of [["", "操作"], ["rename", "改名"], ["replace", "替换"], ["delete", "删除"]]) {
|
for (const [action, text] of [["rename", "改名"], ["replace", "替换"], ["delete", "删除"]]) {
|
||||||
const option = document.createElement("option");
|
const button = document.createElement("button");
|
||||||
option.value = value;
|
button.type = "button";
|
||||||
option.textContent = text;
|
button.className = "small-button";
|
||||||
actions.append(option);
|
button.textContent = text;
|
||||||
|
button.title = `${text}附件`;
|
||||||
|
editorClick(button, async () => {
|
||||||
|
if (action === "delete") {
|
||||||
|
if (window.confirm(`删除附件“${attachment.name}”?`) && await changeDocument("ofdgoChangeAttachment", null, action, attachment.id, [], [])) setStatus("附件已删除");
|
||||||
|
} else openAttachmentDialog(action, attachment);
|
||||||
|
});
|
||||||
|
actions.append(button);
|
||||||
}
|
}
|
||||||
actions.addEventListener("change", async () => {
|
|
||||||
const action = actions.value;
|
|
||||||
actions.value = "";
|
|
||||||
if ((canvasEditor.nudge || canvasEditor.nudgeCommit) && !await canvasEditor.commitNudge()) return;
|
|
||||||
if (!await canvasEditor.commitText() || !await canvasEditor.commitCrop()) return;
|
|
||||||
if (action === "delete") {
|
|
||||||
if (window.confirm(`删除附件“${attachment.name}”?`) && await changeDocument("ofdgoChangeAttachment", null, action, attachment.id, [], [])) setStatus("附件已删除");
|
|
||||||
} else if (action) openAttachmentDialog(action, attachment);
|
|
||||||
});
|
|
||||||
row.append(actions);
|
row.append(actions);
|
||||||
}
|
}
|
||||||
el.attachmentList.append(row);
|
el.attachmentList.append(row);
|
||||||
|
|||||||
Reference in new issue
Block a user