From 2b67fcdb22fdf1eb1a1850fbccb9f0e310953795 Mon Sep 17 00:00:00 2001 From: minjk-bl Date: Mon, 17 May 2021 18:00:06 +0900 Subject: [PATCH 1/3] #23 - cancel function update --- src/api_block/blockContainer.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/api_block/blockContainer.js b/src/api_block/blockContainer.js index 4988fd64..49fecbb1 100644 --- a/src/api_block/blockContainer.js +++ b/src/api_block/blockContainer.js @@ -285,6 +285,10 @@ define([ // re-render block header var codeLineStr = block.getNowCodeLine(); block.writeCode(codeLineStr); + this.resetBlockList(); + this.resetOptionPage(); + this.reRenderAllBlock_asc(); + } else { // blockList에 없으면, 삭제 block.deleteBlock_childBlockList(); @@ -349,6 +353,7 @@ define([ block.isModified = true; } else { $(VP_CLASS_PREFIX + 'vp-apiblock-option-new-to-save').css('display', 'none'); + block.isModified = false; } } } else { From 485fa88346793d47132c411d2c7ed28886cf3fc8 Mon Sep 17 00:00:00 2001 From: minjk-bl Date: Mon, 17 May 2021 18:01:37 +0900 Subject: [PATCH 2/3] #23 - remove library import menu(except matplotlib) --- data/libraries.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/data/libraries.xml b/data/libraries.xml index 4b39581e..574a765e 100644 --- a/data/libraries.xml +++ b/data/libraries.xml @@ -616,11 +616,11 @@ visualpython - numpy Numpy 패키지 라이브러리 - + visualpython - numpy - array creation @@ -1210,11 +1210,11 @@ 변수 조회해서 복사하는 화면 pandas/variables.js --> - + visualpython - pandas - plot From 8f625bca2a911a8e6551732217886003a5d28611 Mon Sep 17 00:00:00 2001 From: minjk-bl Date: Mon, 17 May 2021 18:02:44 +0900 Subject: [PATCH 3/3] #22 - Fixed subset preview bug. This closes #22 --- src/common/component/vpVarSelector.js | 12 +++-- src/common/vpSubsetEditor.js | 71 +++++++++++++++------------ 2 files changed, 48 insertions(+), 35 deletions(-) diff --git a/src/common/component/vpVarSelector.js b/src/common/component/vpVarSelector.js index 17c3936d..ba189f25 100644 --- a/src/common/component/vpVarSelector.js +++ b/src/common/component/vpVarSelector.js @@ -131,10 +131,14 @@ define([ // load using kernel var dataTypes = this.showOthers? []: this.dataTypes; kernelApi.searchVarList(dataTypes, function(result) { - var varList = JSON.parse(result); - that.state.varList = varList; - // render variable list - that.loadVariableList(varList); + try { + var varList = JSON.parse(result); + that.state.varList = varList; + // render variable list + that.loadVariableList(varList); + } catch (ex) { + console.log(ex); + } }); } diff --git a/src/common/vpSubsetEditor.js b/src/common/vpSubsetEditor.js index 3351d051..6244a41c 100644 --- a/src/common/vpSubsetEditor.js +++ b/src/common/vpSubsetEditor.js @@ -150,28 +150,6 @@ define([ this.bindEvent(); this.init(); - // set codemirror - this.codepreview = codemirror.fromTextArea($('#vp_previewCode')[0], { - mode: { - name: 'python', - version: 3, - singleLineStringErrors: false - }, // text-cell(markdown cell) set to 'htmlmixed' - height: '100%', - width: '100%', - indentUnit: 4, - matchBrackets: true, - readOnly:true, - autoRefresh: true, - // lineWrapping: false, // text-cell(markdown cell) set to true - // indentWithTabs: true, - theme: "ipython", - extraKeys: {"Enter": "newlineAndIndentContinueMarkdownList"}, - scrollbarStyle: "null" - }); - this.setPreview('# Code Preview'); - - // set readonly if (useInputVariable) { $(this.wrapSelector('.' + VP_DS_PANDAS_OBJECT)).attr('disabled', true); @@ -384,7 +362,7 @@ define([ * Wrap Selector for data selector popup with its uuid * @param {string} query */ - SubsetEditor.prototype.wrapSelector = function(query) { + SubsetEditor.prototype.wrapSelector = function(query = '') { return vpCommon.formatString('.{0}.{1} {2}', VP_DS, this.uuid, query); } @@ -1644,17 +1622,46 @@ define([ * open popup */ SubsetEditor.prototype.open = function() { + if (!this.codepreview) { + // var previewTextarea = $('#vp_previewCode')[0]; + var previewTextarea = $(this.wrapSelector('#vp_previewCode'))[0]; + // if (wrappedTextarea) { + // previewTextarea = wrappedTextarea; + // } + // set codemirror + this.codepreview = codemirror.fromTextArea(previewTextarea, { + mode: { + name: 'python', + version: 3, + singleLineStringErrors: false + }, // text-cell(markdown cell) set to 'htmlmixed' + height: '100%', + width: '100%', + indentUnit: 4, + matchBrackets: true, + readOnly:true, + autoRefresh: true, + // lineWrapping: false, // text-cell(markdown cell) set to true + // indentWithTabs: true, + theme: "ipython", + extraKeys: {"Enter": "newlineAndIndentContinueMarkdownList"}, + scrollbarStyle: "null" + }); + this.setPreview('# Code Preview'); + } + this.codepreview.refresh(); + // reload pandasObject on open this.loadVariables(); - $(vpCommon.formatString(".{0}.{1}", VP_DS, this.uuid)).show(); + $(this.wrapSelector()).show(); } /** * close popup */ SubsetEditor.prototype.close = function() { - $(vpCommon.formatString(".{0}.{1}", VP_DS, this.uuid)).hide(); + $(this.wrapSelector()).hide(); } SubsetEditor.prototype.hideButton = function() { @@ -1908,12 +1915,14 @@ define([ } SubsetEditor.prototype.setPreview = function(previewCodeStr) { - this.codepreview.setValue(previewCodeStr); - this.codepreview.save(); - var that = this; - setTimeout(function() { - that.codepreview.refresh(); - }, 1); + if (this.codepreview) { + this.codepreview.setValue(previewCodeStr); + this.codepreview.save(); + var that = this; + setTimeout(function() { + that.codepreview.refresh(); + }, 1); + } } return SubsetEditor