@@ -44,7 +44,7 @@ export default{
44
44
.forced-indent {width: 4em;}\
45
45
.CodeMirror {border: 1px solid #aaa; height: auto;}\
46
46
widget-code-input-signature {border-bottom: 0px solid #aaa;}\
47
- widget-code-input-docstring {border-top: 0px solid #aaa;}\
47
+ // widget-code-input-docstring {border-top: 0px solid #aaa;}\
48
48
.widget-code-input-body { border-top: 1px solid #aaa;}\
49
49
</style>' ;
50
50
@@ -59,9 +59,9 @@ export default{
59
59
'<textarea id="' +
60
60
theTextareaId +
61
61
'-signature" class="CodeMirror.widget-code-input-signature"></textarea>' +
62
- '<textarea id="' +
63
- theTextareaId +
64
- '-docstring" class="CodeMirror.widget-code-input-docstring"></textarea>' +
62
+ // '<textarea id="' +
63
+ // theTextareaId +
64
+ // '-docstring" class="CodeMirror.widget-code-input-docstring"></textarea>' +
65
65
'<textarea id="' +
66
66
theTextareaId +
67
67
'-body" class="CodeMirror.widget-code-input-body"></textarea>' ;
@@ -83,7 +83,7 @@ export default{
83
83
var guttercomp = new Compartment ; // allow dynamic changing of line numbers
84
84
85
85
var theme_compartment_sig = new Compartment ;
86
- var theme_compartment_doc = new Compartment ;
86
+ // var theme_compartment_doc = new Compartment;
87
87
var theme_compartment_body = new Compartment ;
88
88
89
89
@@ -116,30 +116,39 @@ export default{
116
116
117
117
mySignatureCodeMirror . dom . classList . add ( "widget-code-input-signature" )
118
118
119
- var myDocstringCodeMirror = editorFromTextArea ( document . getElementById ( theTextareaId + '-docstring' ) , [ lineNumbers ( ) , EditorState . readOnly . of ( true ) , EditorView . editorAttributes . of ( { class :"widget-code-input-docstring" } ) , gutter ( { class :"forced-indent" } ) , guttercomp . of ( lineNumbers ( ) ) ,
120
-
121
- history ( ) ,
122
- drawSelection ( ) ,
123
- dropCursor ( ) ,
124
- EditorState . allowMultipleSelections . of ( true ) ,
125
- syntaxHighlighting ( defaultHighlightStyle , { fallback : true } ) ,
126
- bracketMatching ( ) ,
127
- closeBrackets ( ) ,
128
- autocompletion ( ) ,
129
- rectangularSelection ( ) ,
130
- crosshairCursor ( ) ,
131
- keymap . of ( [
132
- ...closeBracketsKeymap ,
133
- ...defaultKeymap ,
134
- ...searchKeymap ,
135
- ...historyKeymap ,
136
- ...foldKeymap ,
137
- ...completionKeymap ,
138
- ...lintKeymap ,
139
- ] ) , python ( ) , indentUnit . of ( " " ) , theme_compartment_doc . of ( basicLight ) ] ) ;
140
-
141
-
142
- mySignatureCodeMirror . dom . classList . add ( "widget-code-input-signature" ) ; // add css for border to docstring element
119
+ //var myDocstringCodeMirror = editorFromTextArea(document.getElementById(theTextareaId + '-docstring'),
120
+ // [lineNumbers(),
121
+ // EditorState.readOnly.of(true),
122
+ // EditorView.editorAttributes.of({class:"widget-code-input-docstring"}),
123
+ // gutter({class:"forced-indent"}),
124
+ // guttercomp.of(lineNumbers()),
125
+ // history(),
126
+ // drawSelection(),
127
+ // dropCursor(),
128
+ // EditorState.allowMultipleSelections.of(true),
129
+ // syntaxHighlighting(defaultHighlightStyle, { fallback: true }),
130
+ // bracketMatching(),
131
+ // closeBrackets(),
132
+ // autocompletion(),
133
+ // rectangularSelection(),
134
+ // crosshairCursor(),
135
+ // keymap.of([
136
+ // ...closeBracketsKeymap,
137
+ // ...defaultKeymap,
138
+ // ...searchKeymap,
139
+ // ...historyKeymap,
140
+ // ...foldKeymap,
141
+ // ...completionKeymap,
142
+ // ...lintKeymap,
143
+ // ]),
144
+ // python(),
145
+ // indentUnit.of(" "),
146
+ // theme_compartment_doc.of(basicLight)
147
+ // ]
148
+ //);
149
+
150
+
151
+ //mySignatureCodeMirror.dom.classList.add("widget-code-input-signature"); // add css for border to docstring element
143
152
144
153
// event listener for changes to function body
145
154
@@ -206,14 +215,24 @@ function signatureValueChanged() {
206
215
function updateLineNumbers ( ) {
207
216
const linesSignature = mySignatureCodeMirror . state . doc . toString ( ) . split ( '\n' ) . length ;
208
217
209
- const docstring = myDocstringCodeMirror . state . doc . toString ( ) ;
210
- const linesDocstring = docstring == "" ? 0 : docstring . split ( '\n' ) . length ;
211
-
212
- // increment line numbers in docstring text area by the number of lines in the signature
213
- myDocstringCodeMirror . dispatch ( {
214
- effects : guttercomp . reconfigure (
215
- lineNumbers ( { formatNumber : n => linesDocstring == 0 ? "" : linesSignature + n } ) )
216
- } ) ;
218
+ const linesDocstring = 0 ;
219
+ //const docstring = myDocstringCodeMirror.state.doc.toString();
220
+ //const linesDocstring = docstring == "" ? 0 : docstring.split('\n').length;
221
+ //// changing css style seems to not work
222
+ ////const fixedHeightEditor = EditorView.theme({
223
+ //// "&": {height: "100px"},
224
+ //// ".cm-scroller": {overflow: "auto"}
225
+ //// })
226
+ ////var theme = new Compartment;
227
+ ////myDocstringCodeMirror.dispatch({
228
+ //// effects: theme.reconfigure(fixedHeightEditor)
229
+ //// });
230
+
231
+ //// increment line numbers in docstring text area by the number of lines in the signature
232
+ //myDocstringCodeMirror.dispatch({
233
+ // effects: guttercomp.reconfigure(
234
+ // lineNumbers({ formatNumber: n=> linesDocstring == 0 ? "" : linesSignature+n }))
235
+ //});
217
236
218
237
myBodyCodeMirror . dispatch ( {
219
238
effects : guttercomp . reconfigure (
@@ -228,11 +247,11 @@ function signatureValueChanged() {
228
247
229
248
const newDocstring = model . get ( 'docstring' ) ;
230
249
231
- if ( newDocstring !== myDocstringCodeMirror . state . doc . toString ( ) ) {
232
- myDocstringCodeMirror . dispatch ( {
233
- changes : { from : 0 , to : myDocstringCodeMirror . state . doc . length , insert : newDocstring }
234
- } )
235
- }
250
+ // if (newDocstring !== myDocstringCodeMirror.state.doc.toString()) {
251
+ // myDocstringCodeMirror.dispatch({
252
+ // changes: {from: 0, to: myDocstringCodeMirror.state.doc.length, insert: newDocstring}
253
+ // })
254
+ // }
236
255
updateLineNumbers ( ) ;
237
256
}
238
257
@@ -270,9 +289,9 @@ function bodyValueChanged() {
270
289
mySignatureCodeMirror . dispatch ( {
271
290
effects : theme_compartment_sig . reconfigure ( theme )
272
291
} )
273
- myDocstringCodeMirror . dispatch ( {
274
- effects : theme_compartment_doc . reconfigure ( theme )
275
- } )
292
+ // myDocstringCodeMirror.dispatch({
293
+ // effects: theme_compartment_doc.reconfigure(theme)
294
+ // })
276
295
myBodyCodeMirror . dispatch ( {
277
296
effects : theme_compartment_body . reconfigure ( theme )
278
297
} )
0 commit comments