mirror of https://github.com/zulip/zulip.git
js: Convert static/js/search_pill_widget.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
1a8422b152
commit
2a49ce1b6c
|
@ -147,7 +147,6 @@
|
|||
"page_params": false,
|
||||
"pointer": false,
|
||||
"realm_night_logo": false,
|
||||
"search_pill_widget": false,
|
||||
"settings_profile_fields": false,
|
||||
"stream_list": false,
|
||||
"StripeCheckout": false,
|
||||
|
|
|
@ -45,7 +45,7 @@ rewiremock("../../static/js/typing_events").with(typing_events);
|
|||
const ui_util = {__esModule: true};
|
||||
rewiremock("../../static/js/ui_util").with(ui_util);
|
||||
const unread_ops = set_global("unread_ops", {});
|
||||
set_global("search_pill_widget", {
|
||||
rewiremock("../../static/js/search_pill_widget").with({
|
||||
widget: {
|
||||
clear() {
|
||||
return true;
|
||||
|
|
|
@ -26,7 +26,7 @@ rewiremock("../../static/js/ui_util").with({
|
|||
place_caret_at_end: noop,
|
||||
});
|
||||
const narrow = set_global("narrow", {});
|
||||
set_global("search_pill_widget", {
|
||||
rewiremock("../../static/js/search_pill_widget").with({
|
||||
widget: {
|
||||
getByID: () => true,
|
||||
},
|
||||
|
|
|
@ -113,7 +113,6 @@ rewiremock.enable();
|
|||
|
||||
const util = zrequire("util");
|
||||
|
||||
zrequire("search_pill_widget");
|
||||
zrequire("unread");
|
||||
const upload = zrequire("upload");
|
||||
const compose = zrequire("compose");
|
||||
|
|
|
@ -38,7 +38,6 @@ import "../dropdown_list_widget";
|
|||
import "../settings_profile_fields";
|
||||
import "../settings";
|
||||
import "../ui_init";
|
||||
import "../search_pill_widget";
|
||||
import "../desktop_integration";
|
||||
|
||||
// Import styles
|
||||
|
|
|
@ -19,7 +19,6 @@ declare let message_list: any;
|
|||
declare let narrow: any;
|
||||
declare let page_params: any;
|
||||
declare let pointer: any;
|
||||
declare let search_pill_widget: any;
|
||||
declare let settings_profile_fields: any;
|
||||
declare let stream_list: any;
|
||||
declare let subs: any;
|
||||
|
|
|
@ -20,6 +20,7 @@ const recent_topics = require("./recent_topics");
|
|||
const resize = require("./resize");
|
||||
const search = require("./search");
|
||||
const search_pill = require("./search_pill");
|
||||
const search_pill_widget = require("./search_pill_widget");
|
||||
const stream_data = require("./stream_data");
|
||||
const stream_topic_history = require("./stream_topic_history");
|
||||
const top_left_corner = require("./top_left_corner");
|
||||
|
|
|
@ -2,6 +2,7 @@ import {Filter} from "./filter";
|
|||
import * as message_view_header from "./message_view_header";
|
||||
import * as narrow_state from "./narrow_state";
|
||||
import * as search_pill from "./search_pill";
|
||||
import * as search_pill_widget from "./search_pill_widget";
|
||||
import * as search_suggestion from "./search_suggestion";
|
||||
import * as ui_util from "./ui_util";
|
||||
|
||||
|
|
|
@ -1,22 +1,20 @@
|
|||
"use strict";
|
||||
import * as hashchange from "./hashchange";
|
||||
import * as search_pill from "./search_pill";
|
||||
|
||||
const hashchange = require("./hashchange");
|
||||
const search_pill = require("./search_pill");
|
||||
export let widget;
|
||||
|
||||
exports.initialize = function () {
|
||||
export function initialize() {
|
||||
if (!page_params.search_pills_enabled) {
|
||||
return;
|
||||
}
|
||||
const container = $("#search_arrows");
|
||||
exports.widget = search_pill.create_pills(container);
|
||||
widget = search_pill.create_pills(container);
|
||||
|
||||
exports.widget.onPillRemove(() => {
|
||||
if (exports.widget.items().length === 0) {
|
||||
widget.onPillRemove(() => {
|
||||
if (widget.items().length === 0) {
|
||||
hashchange.go_to_location("");
|
||||
}
|
||||
});
|
||||
|
||||
exports.widget.createPillonPaste(() => false);
|
||||
};
|
||||
|
||||
window.search_pill_widget = exports;
|
||||
widget.createPillonPaste(() => false);
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ import * as resize from "./resize";
|
|||
import * as rows from "./rows";
|
||||
import * as scroll_bar from "./scroll_bar";
|
||||
import * as search from "./search";
|
||||
import * as search_pill_widget from "./search_pill_widget";
|
||||
import * as sent_messages from "./sent_messages";
|
||||
import * as server_events from "./server_events";
|
||||
import * as settings_panel_menu from "./settings_panel_menu";
|
||||
|
|
Loading…
Reference in New Issue