add minimap linestate for codeedit to disable minimap (#402)

This commit is contained in:
Mike Sawka 2024-03-07 12:04:17 -08:00 committed by GitHub
parent a3d2b1a54c
commit 45a3f7e721
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 1 deletions

View File

@ -377,7 +377,14 @@ class SourceCodeRenderer extends React.Component<
fontFamily: GlobalModel.getTermFontFamily(),
readOnly: !this.getAllowEditing(),
};
let lineState = this.props.lineState;
let minimap = true;
if (this.state.showPreview) {
minimap = false;
} else if ("minimap" in lineState && !lineState["minimap"]) {
minimap = false;
}
if (!minimap) {
opts.minimap = { enabled: false };
}
return opts;
@ -385,7 +392,6 @@ class SourceCodeRenderer extends React.Component<
getCodeEditor = () => {
let theme = GlobalModel.isThemeDark() ? "wave-theme-dark" : "wave-theme-light";
console.log("monaco theme", theme);
return (
<div className="editor-wrap" style={{ maxHeight: this.state.editorHeight }}>
{this.state.showReadonly && <div className="readonly">{"read-only"}</div>}

View File

@ -89,6 +89,7 @@ const (
KwArgState = "state"
KwArgTemplate = "template"
KwArgLang = "lang"
KwArgMinimap = "minimap"
)
var ColorNames = []string{"yellow", "blue", "pink", "mint", "cyan", "violet", "orange", "green", "red", "white"}
@ -4759,6 +4760,9 @@ func CodeEditCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (scb
if langArg != "" {
lineState[sstore.LineState_Lang] = langArg
}
if _, ok := pk.Kwargs[KwArgMinimap]; ok {
lineState[sstore.LineState_Minimap] = resolveBool(pk.Kwargs[KwArgMinimap], false)
}
update, err := addLineForCmd(ctx, "/"+GetCmdStr(pk), true, ids, cmd, "code", lineState)
if err != nil {
// TODO tricky error since the command was a success, but we can't show the output

View File

@ -67,6 +67,7 @@ const (
LineState_Template = "template"
LineState_Mode = "mode"
LineState_Lang = "lang"
LineState_Minimap = "minimap"
)
const (