mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
add minimap linestate for codeedit to disable minimap (#402)
This commit is contained in:
parent
a3d2b1a54c
commit
45a3f7e721
@ -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>}
|
||||
|
@ -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
|
||||
|
@ -67,6 +67,7 @@ const (
|
||||
LineState_Template = "template"
|
||||
LineState_Mode = "mode"
|
||||
LineState_Lang = "lang"
|
||||
LineState_Minimap = "minimap"
|
||||
)
|
||||
|
||||
const (
|
||||
|
Loading…
Reference in New Issue
Block a user