diff --git a/app/editor/menus/code.tsx b/app/editor/menus/code.tsx
index 548735e96..2a75eaab5 100644
--- a/app/editor/menus/code.tsx
+++ b/app/editor/menus/code.tsx
@@ -10,21 +10,21 @@ export default function codeMenuItems(
readOnly: boolean | undefined,
dictionary: Dictionary
): MenuItem[] {
- if (readOnly) {
- return [];
- }
const node = state.selection.$from.node();
return [
{
name: "copyToClipboard",
icon: ,
+ label: readOnly ? dictionary.copy : undefined,
tooltip: dictionary.copy,
},
{
name: "separator",
+ visible: !readOnly,
},
{
+ visible: !readOnly,
name: "code_block",
icon: ,
label: LANGUAGES[node.attrs.language ?? "none"],
diff --git a/shared/editor/nodes/CodeFence.ts b/shared/editor/nodes/CodeFence.ts
index 66cf84144..a93874be1 100644
--- a/shared/editor/nodes/CodeFence.ts
+++ b/shared/editor/nodes/CodeFence.ts
@@ -199,6 +199,10 @@ export default class CodeFence extends Node {
};
}
+ get allowInReadOnly() {
+ return true;
+ }
+
keys({ type, schema }: { type: NodeType; schema: Schema }) {
return {
"Shift-Ctrl-\\": toggleBlockType(type, schema.nodes.paragraph),