mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 14:31:12 +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 {
|
||||
display: flex;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.attachment-row .attachment-item {
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.attachment-actions {
|
||||
flex: 0 0 60px;
|
||||
width: 60px;
|
||||
border: 1px solid var(--line-strong);
|
||||
background: #ffffff;
|
||||
color: #1f2428;
|
||||
cursor: pointer;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
.attachment-item {
|
||||
|
||||
+15
-17
@@ -7346,25 +7346,23 @@ function renderAttachments() {
|
||||
item.addEventListener("click", () => downloadAttachment(attachment));
|
||||
row.append(item);
|
||||
if (state.editing) {
|
||||
const actions = document.createElement("select");
|
||||
actions.className = "small-button attachment-actions";
|
||||
actions.title = "附件操作";
|
||||
const actions = document.createElement("div");
|
||||
actions.className = "panel-actions attachment-actions";
|
||||
actions.setAttribute("role", "group");
|
||||
actions.setAttribute("aria-label", `${attachment.name} 操作`);
|
||||
for (const [value, text] of [["", "操作"], ["rename", "改名"], ["replace", "替换"], ["delete", "删除"]]) {
|
||||
const option = document.createElement("option");
|
||||
option.value = value;
|
||||
option.textContent = text;
|
||||
actions.append(option);
|
||||
for (const [action, text] of [["rename", "改名"], ["replace", "替换"], ["delete", "删除"]]) {
|
||||
const button = document.createElement("button");
|
||||
button.type = "button";
|
||||
button.className = "small-button";
|
||||
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);
|
||||
}
|
||||
el.attachmentList.append(row);
|
||||
|
||||
Reference in new issue
Block a user