feat(workspace): office文件查看/编辑均univer在线+弹窗顶部下载按钮(2026-09-18用户要求)
- workspace_view.dspy(查看): docx从'需下载后查看'提示弹窗改为univer在线查看 (mode=view只读,无保存按钮)+顶部'⬇下载'按钮+只读提示文案 - workspace_open.dspy(编辑): 保留univer在线编辑,顶部加'⬇下载'按钮+保存引导文案 - 布局: VBox filler→工具行HBox+Iframe filler(高度链完整) - univer_url/file_url均沿用_fq_s双透传(session_id+pipeline_id) - 配套: univer-office前端main.ts mode=view不渲染浮动保存按钮(独立部署)
This commit is contained in:
parent
7a6185f937
commit
0438a9c4b5
@ -116,15 +116,31 @@ if ext in image_exts:
|
||||
]
|
||||
}
|
||||
|
||||
# 4. office 文档 → iframe 嵌入 univer-office 在线编辑
|
||||
# 4. office 文档 → iframe 嵌入 univer-office 在线编辑 + 顶部下载按钮
|
||||
# (2026-09-18 用户要求:查看和编辑都在线,另提供下载按钮)
|
||||
if ext in office_exts:
|
||||
univer_url = entire_url("/univer-office/") + "?file=" + quote(file_id) + _fq_s
|
||||
download_url_e = file_url + "&download=1"
|
||||
download_script_e = (
|
||||
"window.open(" + _json.dumps(download_url_e) + ",'_blank');"
|
||||
)
|
||||
return {
|
||||
"widgettype": "PopupWindow",
|
||||
"options": {"title": name + " (在线编辑)", "width": "85%", "height": "85%", "auto_open": True, "resizable": True},
|
||||
"subwidgets": [
|
||||
{"widgettype": "Iframe", "options": {"url": univer_url, "width": "100%", "height": "100%"}}
|
||||
]
|
||||
"subwidgets": [{
|
||||
"widgettype": "VBox",
|
||||
"options": {"css": "filler", "height": "100%", "width": "100%", "gap": "6px", "padding": "6px"},
|
||||
"subwidgets": [
|
||||
{"widgettype": "HBox",
|
||||
"options": {"width": "100%", "gap": "8px", "alignItems": "center"},
|
||||
"subwidgets": [
|
||||
{"widgettype": "Button", "options": {"label": "⬇ 下载", "css": "small"},
|
||||
"binds": [{"wid": "self", "event": "click", "actiontype": "script", "target": "self", "script": download_script_e}]},
|
||||
{"widgettype": "Text", "options": {"text": "编辑后点右上角「💾 保存」写回工作空间", "cfontsize": 0.8, "color": "#94a3b8"}},
|
||||
]},
|
||||
{"widgettype": "Iframe", "options": {"url": univer_url, "css": "filler", "width": "100%", "height": "100%"}},
|
||||
]
|
||||
}]
|
||||
}
|
||||
|
||||
# 5. pdf 等 → 下载后用本地应用打开
|
||||
|
||||
@ -139,6 +139,34 @@ if ext in image_exts:
|
||||
}]
|
||||
}
|
||||
|
||||
# office 文档(docx)→ univer-office 在线查看(mode=view 只读,不显示保存按钮)+ 下载按钮
|
||||
# (2026-09-18 用户要求:查看和编辑都在线,另提供下载按钮)
|
||||
office_exts = ['.docx']
|
||||
if ext in office_exts:
|
||||
univer_url = entire_url("/univer-office/") + "?file=" + quote(file_id) + "&mode=view" + _fq_s
|
||||
download_url_v = file_url + "&download=1"
|
||||
download_script_v = (
|
||||
"window.open(" + _json.dumps(download_url_v) + ",'_blank');"
|
||||
)
|
||||
return {
|
||||
"widgettype": "PopupWindow",
|
||||
"options": {"title": name + " (在线查看)", "width": "85%", "height": "85%", "auto_open": True, "resizable": True},
|
||||
"subwidgets": [{
|
||||
"widgettype": "VBox",
|
||||
"options": {"css": "filler", "height": "100%", "width": "100%", "gap": "6px", "padding": "6px"},
|
||||
"subwidgets": [
|
||||
{"widgettype": "HBox",
|
||||
"options": {"width": "100%", "gap": "8px", "alignItems": "center"},
|
||||
"subwidgets": [
|
||||
{"widgettype": "Button", "options": {"label": "⬇ 下载", "css": "small"},
|
||||
"binds": [{"wid": "self", "event": "click", "actiontype": "script", "target": "self", "script": download_script_v}]},
|
||||
{"widgettype": "Text", "options": {"text": "在线查看模式(只读);如需修改请用「编辑」", "cfontsize": 0.8, "color": "#94a3b8"}},
|
||||
]},
|
||||
{"widgettype": "Iframe", "options": {"url": univer_url, "css": "filler", "width": "100%", "height": "100%"}},
|
||||
]
|
||||
}]
|
||||
}
|
||||
|
||||
# 其他 → 下载查看
|
||||
download_url = file_url + "&download=1"
|
||||
download_script = (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user