1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 02:19:55 +00:00

Use the $tw.utls.parseStringArray function to break up a list.

This commit is contained in:
Matt Lauber 2015-11-13 08:04:13 -05:00
parent 46a3b2f261
commit 065b274b98

View File

@ -54,7 +54,7 @@ SelectWidget.prototype.handleChangeEvent = function(event) {
if(this.selectMultiple == false) {
var value = this.getSelectDomNode().value;
} else {
var value = this.getSelectValues();
var value = this.getSelectValues()
value = value.map(function(s) { return "[["+s+"]]"}).join(" ");
}
this.wiki.setText(this.selectTitle,this.selectField,this.selectIndex,value);
@ -89,7 +89,7 @@ SelectWidget.prototype.setSelectValue = function() {
if (this.selectMultiple) {
value = value === undefined ? "" : value;
var select = this.getSelectDomNode();
var values = Array.isArray(value) ? value : value.split(",");
var values = Array.isArray(value) ? value : $tw.utils.parseStringArray(value);
for(var i=0; i < select.children.length; i++){
if(values.indexOf(select.children[i].value) != -1) {
select.children[i].selected = true;