mirror of https://github.com/zulip/zulip.git
widgetize: Move widget registration to new widgets module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
0c991d813f
commit
e48771993b
|
@ -143,6 +143,7 @@ import * as user_status from "./user_status";
|
||||||
import * as user_status_ui from "./user_status_ui";
|
import * as user_status_ui from "./user_status_ui";
|
||||||
import * as user_topic_popover from "./user_topic_popover";
|
import * as user_topic_popover from "./user_topic_popover";
|
||||||
import * as user_topics from "./user_topics";
|
import * as user_topics from "./user_topics";
|
||||||
|
import * as widgets from "./widgets";
|
||||||
|
|
||||||
// This is where most of our initialization takes place.
|
// This is where most of our initialization takes place.
|
||||||
// TODO: Organize it a lot better. In particular, move bigger
|
// TODO: Organize it a lot better. In particular, move bigger
|
||||||
|
@ -532,6 +533,7 @@ export function initialize_everything() {
|
||||||
}
|
}
|
||||||
|
|
||||||
i18n.initialize(i18n_params);
|
i18n.initialize(i18n_params);
|
||||||
|
widgets.initialize();
|
||||||
tippyjs.initialize();
|
tippyjs.initialize();
|
||||||
compose_tooltips.initialize();
|
compose_tooltips.initialize();
|
||||||
message_list_tooltips.initialize();
|
message_list_tooltips.initialize();
|
||||||
|
|
|
@ -3,16 +3,8 @@ import $ from "jquery";
|
||||||
import * as blueslip from "./blueslip";
|
import * as blueslip from "./blueslip";
|
||||||
import * as message_lists from "./message_lists";
|
import * as message_lists from "./message_lists";
|
||||||
import * as narrow_state from "./narrow_state";
|
import * as narrow_state from "./narrow_state";
|
||||||
import * as poll_widget from "./poll_widget";
|
|
||||||
import * as todo_widget from "./todo_widget";
|
|
||||||
import * as zform from "./zform";
|
|
||||||
|
|
||||||
const widgets = new Map([
|
|
||||||
["poll", poll_widget],
|
|
||||||
["todo", todo_widget],
|
|
||||||
["zform", zform],
|
|
||||||
]);
|
|
||||||
|
|
||||||
|
export const widgets = new Map();
|
||||||
export const widget_contents = new Map();
|
export const widget_contents = new Map();
|
||||||
|
|
||||||
export function clear_for_testing() {
|
export function clear_for_testing() {
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
import * as poll_widget from "./poll_widget";
|
||||||
|
import * as todo_widget from "./todo_widget";
|
||||||
|
import * as widgetize from "./widgetize";
|
||||||
|
import * as zform from "./zform";
|
||||||
|
|
||||||
|
export function initialize() {
|
||||||
|
widgetize.widgets.set("poll", poll_widget);
|
||||||
|
widgetize.widgets.set("todo", todo_widget);
|
||||||
|
widgetize.widgets.set("zform", zform);
|
||||||
|
}
|
|
@ -61,6 +61,9 @@ mock_esm("../src/poll_widget", fake_poll_widget);
|
||||||
set_global("document", "document-stub");
|
set_global("document", "document-stub");
|
||||||
|
|
||||||
const widgetize = zrequire("widgetize");
|
const widgetize = zrequire("widgetize");
|
||||||
|
const widgets = zrequire("widgets");
|
||||||
|
|
||||||
|
widgets.initialize();
|
||||||
|
|
||||||
function test(label, f) {
|
function test(label, f) {
|
||||||
run_test(label, ({override}) => {
|
run_test(label, ({override}) => {
|
||||||
|
|
Loading…
Reference in New Issue