mirror of
https://github.com/zulip/zulip.git
synced 2025-11-08 16:01:58 +00:00
js: Convert static/js/search_pill.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
e16687af83
commit
8a6fdb662a
@@ -228,7 +228,6 @@
|
|||||||
"scroll_bar": false,
|
"scroll_bar": false,
|
||||||
"scroll_util": false,
|
"scroll_util": false,
|
||||||
"search": false,
|
"search": false,
|
||||||
"search_pill": false,
|
|
||||||
"search_pill_widget": false,
|
"search_pill_widget": false,
|
||||||
"search_suggestion": false,
|
"search_suggestion": false,
|
||||||
"sent_messages": false,
|
"sent_messages": false,
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ zrequire("FetchStatus", "js/fetch_status");
|
|||||||
zrequire("MessageListData", "js/message_list_data");
|
zrequire("MessageListData", "js/message_list_data");
|
||||||
zrequire("unread");
|
zrequire("unread");
|
||||||
const narrow = zrequire("narrow");
|
const narrow = zrequire("narrow");
|
||||||
zrequire("search_pill");
|
|
||||||
|
|
||||||
const channel = set_global("channel", {});
|
const channel = set_global("channel", {});
|
||||||
set_global("compose", {});
|
set_global("compose", {});
|
||||||
|
|||||||
@@ -153,7 +153,6 @@ import "../emoji_picker";
|
|||||||
import "../compose_ui";
|
import "../compose_ui";
|
||||||
import "../panels";
|
import "../panels";
|
||||||
import "../recent_topics";
|
import "../recent_topics";
|
||||||
import "../search_pill";
|
|
||||||
import "../search_pill_widget";
|
import "../search_pill_widget";
|
||||||
import "../stream_ui_updates";
|
import "../stream_ui_updates";
|
||||||
import "../spoilers";
|
import "../spoilers";
|
||||||
|
|||||||
1
static/js/global.d.ts
vendored
1
static/js/global.d.ts
vendored
@@ -96,7 +96,6 @@ declare let rtl: any;
|
|||||||
declare let scroll_bar: any;
|
declare let scroll_bar: any;
|
||||||
declare let scroll_util: any;
|
declare let scroll_util: any;
|
||||||
declare let search: any;
|
declare let search: any;
|
||||||
declare let search_pill: any;
|
|
||||||
declare let search_pill_widget: any;
|
declare let search_pill_widget: any;
|
||||||
declare let search_suggestion: any;
|
declare let search_suggestion: any;
|
||||||
declare let sent_messages: any;
|
declare let sent_messages: any;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const people = require("./people");
|
const people = require("./people");
|
||||||
|
const search_pill = require("./search_pill");
|
||||||
const topic_generator = require("./topic_generator");
|
const topic_generator = require("./topic_generator");
|
||||||
const util = require("./util");
|
const util = require("./util");
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
const search_pill = require("./search_pill");
|
||||||
|
|
||||||
// Exported for unit testing
|
// Exported for unit testing
|
||||||
exports.is_using_input_method = false;
|
exports.is_using_input_method = false;
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,26 @@
|
|||||||
"use strict";
|
export function create_item_from_search_string(search_string) {
|
||||||
|
|
||||||
exports.create_item_from_search_string = function (search_string) {
|
|
||||||
const operator = Filter.parse(search_string);
|
const operator = Filter.parse(search_string);
|
||||||
const description = Filter.describe(operator);
|
const description = Filter.describe(operator);
|
||||||
return {
|
return {
|
||||||
display_value: search_string,
|
display_value: search_string,
|
||||||
description,
|
description,
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
exports.get_search_string_from_item = function (item) {
|
export function get_search_string_from_item(item) {
|
||||||
return item.display_value;
|
return item.display_value;
|
||||||
};
|
}
|
||||||
|
|
||||||
exports.create_pills = function (pill_container) {
|
export function create_pills(pill_container) {
|
||||||
const pills = input_pill.create({
|
const pills = input_pill.create({
|
||||||
container: pill_container,
|
container: pill_container,
|
||||||
create_item_from_text: exports.create_item_from_search_string,
|
create_item_from_text: create_item_from_search_string,
|
||||||
get_text_from_item: exports.get_search_string_from_item,
|
get_text_from_item: get_search_string_from_item,
|
||||||
});
|
});
|
||||||
return pills;
|
return pills;
|
||||||
};
|
}
|
||||||
|
|
||||||
exports.append_search_string = function (search_string, pill_widget) {
|
export function append_search_string(search_string, pill_widget) {
|
||||||
const operators = Filter.parse(search_string);
|
const operators = Filter.parse(search_string);
|
||||||
for (const operator of operators) {
|
for (const operator of operators) {
|
||||||
const input = Filter.unparse([operator]);
|
const input = Filter.unparse([operator]);
|
||||||
@@ -31,12 +29,10 @@ exports.append_search_string = function (search_string, pill_widget) {
|
|||||||
if (pill_widget.clear_text !== undefined) {
|
if (pill_widget.clear_text !== undefined) {
|
||||||
pill_widget.clear_text();
|
pill_widget.clear_text();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
exports.get_search_string_for_current_filter = function (pill_widget) {
|
export function get_search_string_for_current_filter(pill_widget) {
|
||||||
const items = pill_widget.items();
|
const items = pill_widget.items();
|
||||||
const search_strings = items.map((item) => item.display_value);
|
const search_strings = items.map((item) => item.display_value);
|
||||||
return search_strings.join(" ");
|
return search_strings.join(" ");
|
||||||
};
|
}
|
||||||
|
|
||||||
window.search_pill = exports;
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
const search_pill = require("./search_pill");
|
||||||
|
|
||||||
exports.initialize = function () {
|
exports.initialize = function () {
|
||||||
if (!page_params.search_pills_enabled) {
|
if (!page_params.search_pills_enabled) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user