- {readOnlyLoading ? (
-
-
- 加载内容中...
-
- ) : readOnlyError ? (
-
-
-
加载失败
-
{readOnlyError}
-
- ) : script.script_type === 'notebook' && readOnlyContent && typeof readOnlyContent === 'object' ? (
- // Notebook 使用单元格渲染
-
- ) : (
- // Python 文件使用 Monaco Editor 显示
-
- )}
+ {/* 编辑器画布区域 - 始终渲染,保证 iframe 不重新加载 */}
+
+ {/* 只读模式内容 - 用 CSS 控制显示/隐藏 */}
+
+
+
+
+ 此文件已被锁定,您当前处于只读模式
+
+
+ {readOnlyLoading ? (
+
+
+ 加载内容中...
+
+ ) : readOnlyError ? (
+
+
+
加载失败
+
{readOnlyError}
+
+ ) : script.script_type === 'notebook' && readOnlyContent && typeof readOnlyContent === 'object' ? (
+
+ ) : (
+
+ )}
+
- ) : (
- // 正常编辑模式:原有的 iframe + Monaco 预览逻辑
-
0 ? 'is-embedded' : ''}`} style={sessionCache.size > 0 ? { position: 'relative', minHeight: '0', height: '100%' } : undefined}>
+
+ {/* 正常编辑模式 - 始终渲染,用 CSS 控制显示/隐藏 */}
+
0 ? 'is-embedded' : ''}`} style={{ display: isReadOnlyMode ? 'none' : 'block', position: 'relative', minHeight: '0', height: '100%' }}>
{/* 多 PythonEditor 实例:每个有 buffer 的 python tab 都挂载,仅 active 可见 */}
{pythonTabBuffers.map((tab) => {
const tabScript = scripts.find((s) => s.script_id === tab.scriptId);
@@ -711,9 +712,10 @@ export function ScriptWorkspace({
- ) : null):null}
+ ) : null
+ ) : null}
- )}
+
>
);
}
diff --git a/frontend/app/styles/platform.css b/frontend/app/styles/platform.css
index f70bca0..c9a471c 100644
--- a/frontend/app/styles/platform.css
+++ b/frontend/app/styles/platform.css
@@ -2080,7 +2080,8 @@ button {
align-items: center;
justify-content: center;
gap: 8px;
- padding: 10px 16px;
+ padding: 8px 16px;
+ margin-bottom: 6px;
background: #fff3cd;
border-bottom: 1px solid #e0e0e0;
color: #856404;
@@ -2151,7 +2152,7 @@ button {
}
.notebook-cell--markdown {
- padding: 14px 24px;
+ padding: 4px 24px;
}
.notebook-cell--code {