forked from visualpython/visualpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode_option.js
More file actions
63 lines (49 loc) · 2.18 KB
/
Copy pathnode_option.js
File metadata and controls
63 lines (49 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
define([
'jquery'
, 'codemirror/lib/codemirror'
, '../../constData.js'
, '../base/index.js'
], function ( $, codemirror,
constData, baseComponent ) {
const { STATE_codeLine } = constData;
const { MakeOptionContainer } = baseComponent;
var InitNodeBlockOption = function(thisBlock, optionPageSelector) {
var blockContainerThis = thisBlock.getBlockContainerThis();
/** node option 렌더링 */
var renderThisComponent = function() {
var nodeBlockOption = MakeOptionContainer(thisBlock);
thisBlock.writeCode(thisBlock.getState(STATE_codeLine));
var codeLineList = blockContainerThis.previewCode(thisBlock);
var nodePageDom = document.createElement('div');
$(nodePageDom).attr('class', 'vp-apiblock-nodepage');
var textareaDom = document.createElement('textarea');
$(textareaDom).val(codeLineList);
$(textareaDom).attr('id','vp_userCode');
$(textareaDom).attr('name','code');
$(textareaDom).attr('style','display: none');
// nodeBlockOption.append(`<p style='font-weight:700;'>Node</p>`)
$(nodePageDom).append(textareaDom);
nodeBlockOption.append(nodePageDom);
var codemirrorCode = codemirror.fromTextArea(textareaDom, {
mode: {
name: 'python',
version: 3,
singleLineStringErrors: false
}, // text-cell(markdown cell) set to 'htmlmixed'
indentUnit: 4,
matchBrackets: true,
readOnly:true,
autoRefresh: true,
lineWrapping: false, // text-cell(markdown cell) set to true
indentWithTabs: true,
theme: "ipython",
extraKeys: {"Enter": "newlineAndIndentContinueMarkdownList"}
});
$(optionPageSelector).append(nodeBlockOption);
codemirrorCode.setValue($(textareaDom).val());
return nodeBlockOption;
}
return renderThisComponent();
}
return InitNodeBlockOption;
});