Skip to content

Commit 6b17531

Browse files
author
minjk-bl
committed
Rollback deleted useFile checkbox to WordCloud
1 parent a2c1761 commit 6b17531

File tree

2 files changed

+35
-7
lines changed

2 files changed

+35
-7
lines changed

html/m_visualize/wordCloud.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@
1313
<div class="vp-tab-page-box vp-grid-border-box vp-scrollbar">
1414
<div class="vp-tab-page vp-grid-box" data-type="data">
1515
<label for="data" class="vp-bold">Data</label>
16-
<div>
17-
<input type="text" id="data" class="vp-input vp-state"/>
18-
<div id="vp_wcOpenFile" class="vp-file-browser-button" style="margin-left:0px;"></div>
16+
<div class="vp-grid-col-p50">
17+
<div>
18+
<input type="text" id="data" class="vp-input vp-state"/>
19+
<div id="vp_wcOpenFile" class="vp-file-browser-button"></div>
20+
</div>
21+
<label><input type="checkbox" id="useFile" class="vp-state"><span>Use file</span></label>
1922
</div>
2023

2124
<div class="vp-wc-file-option vp-grid-box">
@@ -51,6 +54,9 @@
5154
<div class="vp-wc-right-box">
5255
<div class="vp-bold">
5356
<span class="vp-wc-preview-title">Preview</span>
57+
<span id="previewRefresh" class="vp-cursor">
58+
<img src="/nbextensions/visualpython/img/refresh.svg"/>
59+
</span>
5460
</div>
5561
<div class="vp-wc-preview-box vp-grid-border-box">
5662
<div id="vp_wcPreview" class="vp-wc-preview-content vp-center"></div>

js/m_visualize/WordCloud.js

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ define([
6262

6363
that.state.useFile = true;
6464
$(that.wrapSelector('.vp-wc-file-option')).show();
65+
$(that.wrapSelector('#useFile')).prop('checked', true);
66+
$(that.wrapSelector('#useFile')).trigger('change');
6567

6668
// set text
6769
$(that.wrapSelector('#data')).val(path);
@@ -71,6 +73,16 @@ define([
7173
fileNavi.open();
7274
});
7375

76+
// use file
77+
$(this.wrapSelector('#useFile')).on('change', function() {
78+
let checked = $(this).prop('checked');
79+
if (checked) {
80+
$(that.wrapSelector('.vp-wc-file-option')).show();
81+
} else {
82+
$(that.wrapSelector('.vp-wc-file-option')).hide();
83+
}
84+
});
85+
7486
// change tab
7587
$(this.wrapSelector('.vp-tab-item')).on('click', function() {
7688
let type = $(this).data('type'); // data / wordcloud / plot
@@ -91,6 +103,11 @@ define([
91103
}
92104
evt.stopPropagation();
93105
});
106+
107+
// preview refresh
108+
$(this.wrapSelector('#previewRefresh')).on('click', function() {
109+
that.loadPreview();
110+
});
94111

95112
}
96113

@@ -157,12 +174,16 @@ define([
157174
pageThis: this,
158175
id: 'data',
159176
select: function() {
160-
that.state.useFile = false;
161-
$(that.wrapSelector('.vp-wc-file-option')).hide();
177+
// that.state.useFile = false;
178+
$(that.wrapSelector('#useFile')).prop('checked', false);
179+
$(that.wrapSelector('#useFile')).trigger('change');
180+
// $(that.wrapSelector('.vp-wc-file-option')).hide();
162181
},
163182
finish: function() {
164-
that.state.useFile = false;
165-
$(that.wrapSelector('.vp-wc-file-option')).hide();
183+
// that.state.useFile = false;
184+
$(that.wrapSelector('#useFile')).prop('checked', false);
185+
$(that.wrapSelector('#useFile')).trigger('change');
186+
// $(that.wrapSelector('.vp-wc-file-option')).hide();
166187
}
167188
});
168189
$(this.wrapSelector('#data')).replaceWith(dataSelector.toTagString());
@@ -201,6 +222,7 @@ define([
201222
suggestInput.addClass('vp-input vp-state');
202223
suggestInput.setSuggestList(function() { return encodingList; });
203224
suggestInput.setPlaceholder('encoding option');
225+
suggestInput.setValue(that.state.encoding);
204226
return suggestInput.toTagString();
205227
});
206228

0 commit comments

Comments
 (0)