Sfoglia il codice sorgente

Switch to global match for full browser support of escaped custom vars

AJ West 7 anni fa
parent
commit
6c95acc837
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      public/app/features/templating/custom_variable.ts

+ 1 - 1
public/app/features/templating/custom_variable.ts

@@ -39,7 +39,7 @@ export class CustomVariable implements Variable {
 
 
   updateOptions() {
   updateOptions() {
     // extract options in comma separated string (use backslash to escape wanted commas)
     // extract options in comma separated string (use backslash to escape wanted commas)
-    this.options = _.map(this.query.split(/(?<!\\),+/), text => {
+    this.options = _.map(this.query.match(/(?:\\,|[^,])+/g), text => {
       text = text.replace('\\,', ',');
       text = text.replace('\\,', ',');
       return { text: text.trim(), value: text.trim() };
       return { text: text.trim(), value: text.trim() };
     });
     });