mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-14 10:35:11 +00:00
editor: move docs toggle from settings
This removes the docs toggle switch from the settings and adds a new docs toggle button to the editor. Fixes: https://github.com/pybricks/support/issues/778
This commit is contained in:
committed by
David Lechner
parent
55cf05d480
commit
cc20ab8c35
+14
-1
@@ -357,7 +357,8 @@ const Editor: React.VFC = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const [editor, setEditor] = useState<monaco.editor.IStandaloneCodeEditor>();
|
||||
const { toggleIsSettingShowDocsEnabled } = useSettingIsShowDocsEnabled();
|
||||
const { isSettingShowDocsEnabled, toggleIsSettingShowDocsEnabled } =
|
||||
useSettingIsShowDocsEnabled();
|
||||
const { isDarkMode } = useTernaryDarkMode();
|
||||
|
||||
const i18n = useI18n();
|
||||
@@ -486,6 +487,18 @@ const Editor: React.VFC = () => {
|
||||
<div className="pb-editor-monaco" ref={editorRef} />
|
||||
</ContextMenu2>
|
||||
</ResizeSensor2>
|
||||
<Button
|
||||
className="pb-editor-doc-button"
|
||||
minimal
|
||||
large
|
||||
icon="manual"
|
||||
title={
|
||||
isSettingShowDocsEnabled
|
||||
? i18n.translate('docs.hide')
|
||||
: i18n.translate('docs.show')
|
||||
}
|
||||
onClick={toggleIsSettingShowDocsEnabled}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -93,4 +93,11 @@
|
||||
color: bp.$pt-dark-text-color-muted;
|
||||
}
|
||||
}
|
||||
|
||||
&-doc-button {
|
||||
position: absolute;
|
||||
bottom: bp.$pt-grid-size;
|
||||
right: bp.$pt-grid-size;
|
||||
z-index: bp.$pt-z-index-overlay;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,5 +8,9 @@
|
||||
"undo": "Undo",
|
||||
"redo": "Redo",
|
||||
"closeFile": { "tooltip": "Close {fileName}" },
|
||||
"contextMenu": { "label": "Editor context menu" }
|
||||
"contextMenu": { "label": "Editor context menu" },
|
||||
"docs": {
|
||||
"show": "Show documentation",
|
||||
"hide": "Hide documentation"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user