File tree 2 files changed +23
-0
lines changed 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,20 @@ const handleCopyLogEventAction = (
112
112
editor . trigger ( handleCopyLogEventAction . name , "editor.action.clipboardCopyAction" , null ) ;
113
113
} ;
114
114
115
+ /**
116
+ * Toggles the word wrap setting in the editor between "on" and "off".
117
+ *
118
+ * @param editor
119
+ */
120
+ const handleWordWrapAction = ( editor : monaco . editor . IStandaloneCodeEditor ) => {
121
+ const currentWordWrap = editor . getRawOptions ( ) . wordWrap ;
122
+ const newWordWrap = "on" === currentWordWrap ?
123
+ "off" :
124
+ "on" ;
125
+
126
+ editor . updateOptions ( { wordWrap : newWordWrap } ) ;
127
+ } ;
128
+
115
129
/**
116
130
* Renders a read-only editor for viewing logs.
117
131
*
@@ -156,6 +170,9 @@ const Editor = () => {
156
170
case ACTION_NAME . COPY_LOG_EVENT :
157
171
handleCopyLogEventAction ( editor , beginLineNumToLogEventNumRef . current ) ;
158
172
break ;
173
+ case ACTION_NAME . WORD_WRAP :
174
+ handleWordWrapAction ( editor ) ;
175
+ break ;
159
176
default :
160
177
break ;
161
178
}
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ enum ACTION_NAME {
13
13
PAGE_BOTTOM = "pageBottom" ,
14
14
RELOAD = "reload" ,
15
15
COPY_LOG_EVENT = "copyLogEvent" ,
16
+ WORD_WRAP = "wordWrap" ,
16
17
}
17
18
18
19
interface EditorAction {
@@ -70,6 +71,11 @@ const EDITOR_ACTIONS : EditorAction[] = [
70
71
keyBindings : [ monaco . KeyMod . CtrlCmd | monaco . KeyMod . Shift | monaco . KeyCode . KeyC ] ,
71
72
label : "Copy Log Event" ,
72
73
} ,
74
+ {
75
+ actionName : ACTION_NAME . WORD_WRAP ,
76
+ keyBindings : [ monaco . KeyMod . Alt | monaco . KeyCode . KeyZ ] ,
77
+ label : "Toggle word wrap" ,
78
+ } ,
73
79
] ;
74
80
75
81
type NavigationActionsMap = {
You can’t perform that action at this time.
0 commit comments