Skip to content

Commit 50f4511

Browse files
author
minjk-bl
committed
Edit category exception, input selection on focus
1 parent 0d83b16 commit 50f4511

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

visualpython/js/com/component/PopupComponent.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ define([
8181
* Component
8282
*/
8383
class PopupComponent extends Component {
84-
constructor(state={ config: { id: 'popup', name: 'Popup title', path: 'path/file' }}, prop={}) {
84+
constructor(state={ config: { id: 'popup', name: 'Popup title', path: 'path/file', category: '' }}, prop={}) {
8585
// CHROME: FIXME: #site -> .notebook-vertical
8686
// super($('#site'), state, prop);
8787
super($(vpConfig.parentSelector), state, prop);
@@ -398,6 +398,11 @@ define([
398398
that._saveSingleState($(this)[0]);
399399
});
400400

401+
// click input box with selection
402+
$(document).on('focus', this.wrapSelector('input'), function() {
403+
$(this).select();
404+
});
405+
401406
// Click buttons
402407
$(this.wrapSelector('.vp-popup-button')).on('click', function(evt) {
403408
var btnType = $(this).data('type');
@@ -492,6 +497,7 @@ define([
492497

493498
_unbindEvent() {
494499
$(document).off('change', this.wrapSelector('.vp-state'));
500+
$(document).off('focus', this.wrapSelector('input'));
495501
}
496502

497503
_bindDraggable() {
@@ -544,7 +550,11 @@ define([
544550
this.$pageDom = $(popupComponentHtml.replaceAll('${vp_base}', com_Const.BASE_PATH));
545551
// set title
546552
// this.$pageDom.find('.vp-popup-title').text(this.category + ' > ' + this.name);
547-
this.$pageDom.find('.vp-popup-title').html(`<span class="vp-popup-category">${this.category} > </span><span>${this.name}</span>`);
553+
if (this.category && this.category !== '') {
554+
this.$pageDom.find('.vp-popup-title').html(`<span class="vp-popup-category">${this.category} > </span><span>${this.name}</span>`);
555+
} else {
556+
this.$pageDom.find('.vp-popup-title').html(`<span>${this.name}</span>`);
557+
}
548558
// set body
549559
let bodyTemplate = this.templateForBody();
550560
// CHROME: check url keyword and replace it
@@ -792,7 +802,9 @@ define([
792802
if (customKey && customKey != '') {
793803
// allow custom key until level 2
794804
let customKeys = customKey.split('.');
795-
if (customKeys.length == 2) {
805+
if (customKeys.length === 3) {
806+
this.state[customKeys[0]][customKeys[1]][customKeys[2]] = newValue;
807+
} else if (customKeys.length === 2) {
796808
this.state[customKeys[0]][customKeys[1]] = newValue;
797809
} else {
798810
this.state[customKey] = newValue;

0 commit comments

Comments
 (0)