88 * Date : 2021. 11. 18
99 * Change Date :
1010 */
11-
11+
1212//============================================================================
1313// [CLASS] PopupComponent
1414//============================================================================
@@ -22,6 +22,8 @@ define([
2222 './Component' ,
2323 './DataSelector' ,
2424
25+
26+
2527 /** codemirror */
2628 'codemirror/lib/codemirror' ,
2729 'codemirror/mode/python/python' ,
@@ -146,7 +148,26 @@ define([
146148 }
147149 }
148150
149- // code view
151+ // // code view
152+ // if (this.config.codeview) {
153+ // if (!this.cmCodeview) {
154+ // // codemirror setting
155+ // let selector = this.wrapSelector('.vp-popup-codeview-box textarea');
156+ // let textarea = $(selector);
157+ // if (textarea && textarea.length > 0) {
158+ // this.cmCodeview = codemirror.fromTextArea(textarea[0], this.cmReadonlyConfig);
159+ // } else {
160+ // vpLog.display(VP_LOG_TYPE.ERROR, 'No text area to create codemirror. (selector: '+selector+')');
161+ // }
162+ // } else {
163+ // this.cmCodeview.refresh();
164+ // }
165+
166+
167+
168+ // 220919
169+ // 220912
170+ // code view + helpview
150171 if ( this . config . codeview ) {
151172 if ( ! this . cmCodeview ) {
152173 // codemirror setting
@@ -160,7 +181,23 @@ define([
160181 } else {
161182 this . cmCodeview . refresh ( ) ;
162183 }
163- }
184+ } else {
185+ if ( ! this . cmCodeview ) {
186+ // codemirror setting
187+ let selector = this . wrapSelector ( '.vp-popup-helpview-box textarea' ) ;
188+ let textarea = $ ( selector ) ;
189+ if ( textarea && textarea . length > 0 ) {
190+ this . cmCodeview = codemirror . fromTextArea ( textarea [ 0 ] , this . cmReadonlyConfig ) ;
191+ } else {
192+ vpLog . display ( VP_LOG_TYPE . ERROR , 'No text area to create codemirror. (selector: ' + selector + ')' ) ;
193+ }
194+ } else {
195+ this . cmCodeview . refresh ( ) ;
196+ }
197+
198+
199+
200+ }
164201 }
165202
166203 /**
@@ -346,6 +383,26 @@ define([
346383 $ ( this . wrapSelector ( '.vp-popup-button' ) ) . on ( 'click' , function ( evt ) {
347384 var btnType = $ ( this ) . data ( 'type' ) ;
348385 switch ( btnType ) {
386+
387+ // 220919
388+ case 'help' :
389+
390+ // $(".vp-popup-help").attr("title", "바뀐 후");
391+
392+ // if ($(that.wrapSelector('.vp-popup-run-detailbox')).is(':hidden')) {
393+ // $(".vp-popup-help").attr("title", "바뀐 후");
394+
395+ // } else {
396+ // $(".vp-popup-help").attr("title", "바뀐 후");
397+ // }
398+ if ( $ ( that . wrapSelector ( '.vp-popup-helpview-box' ) ) . is ( ':hidden' ) ) {
399+ that . openView ( 'help' ) ;
400+ } else {
401+ that . closeView ( 'help' ) ;
402+ }
403+ evt . stopPropagation ( ) ;
404+ break ;
405+
349406 case 'code' :
350407 if ( $ ( that . wrapSelector ( '.vp-popup-codeview-box' ) ) . is ( ':hidden' ) ) {
351408 that . openView ( 'code' ) ;
@@ -498,7 +555,7 @@ define([
498555
499556 let {
500557 installButton, importButton, packageButton,
501- codeview, dataview, runButton, footer,
558+ codeview, dataview, helpview , runButton, footer,
502559 sizeLevel, position
503560 } = this . config ;
504561
@@ -530,6 +587,11 @@ define([
530587 if ( ! dataview ) {
531588 $ ( this . wrapSelector ( '.vp-popup-button[data-type="data"]' ) ) . hide ( ) ;
532589 }
590+ // 220919
591+ if ( ! helpview ) {
592+ $ ( this . wrapSelector ( '.vp-popup-button[data-type="help"]' ) ) . hide ( ) ;
593+ }
594+
533595
534596 // run button
535597 if ( ! runButton ) {
@@ -627,6 +689,11 @@ define([
627689 /** Implementation needed */
628690 return '' ;
629691 }
692+
693+ generateHelp ( ) {
694+ /** Implementation needed */
695+ return '' ;
696+ }
630697
631698 load ( ) {
632699
@@ -900,7 +967,24 @@ define([
900967 that . cmCodeview . refresh ( ) ;
901968 } , 1 ) ;
902969 $ ( this . wrapSelector ( '.vp-popup-dataview-box' ) ) . hide ( ) ;
903- } else {
970+ } else if ( viewType == 'help' ) { // 220919
971+ this . saveState ( ) ;
972+ var code = this . generateHelp ( ) ;
973+ let codeText = '' ;
974+ if ( Array . isArray ( code ) ) {
975+ codeText = code . join ( '\n' ) ;
976+ } else {
977+ codeText = code ;
978+ }
979+ this . cmCodeview . setValue ( codeText ) ;
980+ this . cmCodeview . save ( ) ;
981+
982+ var that = this ;
983+ setTimeout ( function ( ) {
984+ that . cmCodeview . refresh ( ) ;
985+ } , 1 ) ;
986+ $ ( this . wrapSelector ( '.vp-popup-helpview-box' ) ) . hide ( ) ;
987+ } else {
904988 this . renderDataView ( ) ;
905989 $ ( this . wrapSelector ( '.vp-popup-codeview-box' ) ) . hide ( ) ;
906990 }
0 commit comments