From 45a3f7e72189643ba619eb02748243d3def5ed76 Mon Sep 17 00:00:00 2001 From: Mike Sawka Date: Thu, 7 Mar 2024 12:04:17 -0800 Subject: [PATCH] add minimap linestate for codeedit to disable minimap (#402) --- src/plugins/code/code.tsx | 8 +++++++- wavesrv/pkg/cmdrunner/cmdrunner.go | 4 ++++ wavesrv/pkg/sstore/sstore.go | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/plugins/code/code.tsx b/src/plugins/code/code.tsx index bb37221a..542d90ef 100644 --- a/src/plugins/code/code.tsx +++ b/src/plugins/code/code.tsx @@ -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 (
{this.state.showReadonly &&
{"read-only"}
} diff --git a/wavesrv/pkg/cmdrunner/cmdrunner.go b/wavesrv/pkg/cmdrunner/cmdrunner.go index 1c44c74f..9291203a 100644 --- a/wavesrv/pkg/cmdrunner/cmdrunner.go +++ b/wavesrv/pkg/cmdrunner/cmdrunner.go @@ -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 diff --git a/wavesrv/pkg/sstore/sstore.go b/wavesrv/pkg/sstore/sstore.go index 1ae9f919..ba07baa4 100644 --- a/wavesrv/pkg/sstore/sstore.go +++ b/wavesrv/pkg/sstore/sstore.go @@ -67,6 +67,7 @@ const ( LineState_Template = "template" LineState_Mode = "mode" LineState_Lang = "lang" + LineState_Minimap = "minimap" ) const (