Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix typecho#325

修正在标签输入时无法使用tab切换焦点
  • Loading branch information
joyqi committed Nov 7, 2014
1 parent cd971ea commit f062a78
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions admin/js/tokeninput.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ $.TokenList = function (input, url_or_data, settings) {
}
break;

case KEY.TAB:
// case KEY.TAB:
case KEY.ENTER:
case KEY.NUMPAD_ENTER:
case KEY.COMMA:
Expand Down Expand Up @@ -750,7 +750,7 @@ $.TokenList = function (input, url_or_data, settings) {
// Do a search and show the "searching" dropdown if the input is longer
// than settings.minChars
function do_search() {
var query = input_box.val().toLowerCase();
var val = input_box.val(), query = val.toLowerCase();

if(query && query.length) {
if(selected_token) {
Expand All @@ -762,7 +762,7 @@ $.TokenList = function (input, url_or_data, settings) {
clearTimeout(timeout);

timeout = setTimeout(function(){
run_search(query);
run_search(query, val);
}, settings.searchDelay);
} else {
hide_dropdown();
Expand All @@ -771,7 +771,7 @@ $.TokenList = function (input, url_or_data, settings) {
}

// Do the actual search
function run_search(query) {
function run_search(query, val) {
var cache_key = query + computeURL();
var cached_results = cache.get(cache_key);
if(cached_results) {
Expand Down Expand Up @@ -807,7 +807,7 @@ $.TokenList = function (input, url_or_data, settings) {
// Attach the success callback
ajax_params.success = function(results) {
if($.isFunction(settings.onResult)) {
results = settings.onResult.call(hidden_input, results, query);
results = settings.onResult.call(hidden_input, results, query, val);
}
cache.add(cache_key, settings.jsonContainer ? results[settings.jsonContainer] : results);

Expand All @@ -826,7 +826,7 @@ $.TokenList = function (input, url_or_data, settings) {
});

if($.isFunction(settings.onResult)) {
results = settings.onResult.call(hidden_input, results, query);
results = settings.onResult.call(hidden_input, results, query, val);
}
cache.add(cache_key, results);
populate_dropdown(query, results);
Expand Down
6 changes: 3 additions & 3 deletions admin/write-js.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
noResultsText : '<?php _e('此标签不存在, 按回车创建'); ?>',
prePopulate : tagsPre,

onResult : function (result, query) {
onResult : function (result, query, val) {
if (!query) {
return result;
}
Expand All @@ -88,8 +88,8 @@

if (!result[0] || result[0]['id'] != query) {
result.unshift({
id : query,
tags : query
id : val,
tags : val
});
}

Expand Down
6 changes: 3 additions & 3 deletions var/Widget/Archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -1832,11 +1832,11 @@ public function header($rule = NULL)
}
}

/** 插件支持 */
$this->pluginHandle()->header($header, $this);

/** 输出header */
echo $header;

/** 插件支持 */
$this->pluginHandle()->header($header, $this);
}

/**
Expand Down

0 comments on commit f062a78

Please sign in to comment.