js: Convert static/js/rendered_markdown.js to ES6 module.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2021-02-10 07:46:29 -08:00
committed by Tim Abbott
parent 1d64e7a8eb
commit 6a6a91b977
2 changed files with 11 additions and 13 deletions

View File

@@ -18,7 +18,6 @@ import "../loading";
import "../vdom"; import "../vdom";
import "../keydown_util"; import "../keydown_util";
import "../rtl"; import "../rtl";
import "../rendered_markdown";
import "../fold_dict"; import "../fold_dict";
import "../scroll_util"; import "../scroll_util";
import "../components"; import "../components";

View File

@@ -1,14 +1,13 @@
"use strict"; import ClipboardJS from "clipboard";
import copy_code_button from "../templates/copy_code_button.hbs";
import view_code_in_playground from "../templates/view_code_in_playground.hbs";
import * as people from "./people";
import * as settings_config from "./settings_config";
const ClipboardJS = require("clipboard");
const {parseISO, isValid} = require("date-fns"); const {parseISO, isValid} = require("date-fns");
const copy_code_button = require("../templates/copy_code_button.hbs");
const view_code_in_playground = require("../templates/view_code_in_playground.hbs");
const people = require("./people");
const settings_config = require("./settings_config");
/* /*
rendered_markdown rendered_markdown
@@ -55,15 +54,15 @@ function get_user_group_id_for_mention_button(elem) {
} }
// Helper function to update a mentioned user's name. // Helper function to update a mentioned user's name.
exports.set_name_in_mention_element = function (element, name) { export function set_name_in_mention_element(element, name) {
if ($(element).hasClass("silent")) { if ($(element).hasClass("silent")) {
$(element).text(name); $(element).text(name);
} else { } else {
$(element).text("@" + name); $(element).text("@" + name);
} }
}; }
exports.update_elements = (content) => { export const update_elements = (content) => {
// Set the rtl class if the text has an rtl direction // Set the rtl class if the text has an rtl direction
if (rtl.get_direction(content.text()) === "rtl") { if (rtl.get_direction(content.text()) === "rtl") {
content.addClass("rtl"); content.addClass("rtl");
@@ -86,7 +85,7 @@ exports.update_elements = (content) => {
if (person !== undefined) { if (person !== undefined) {
// Note that person might be undefined in some // Note that person might be undefined in some
// unpleasant corner cases involving data import. // unpleasant corner cases involving data import.
exports.set_name_in_mention_element(this, person.full_name); set_name_in_mention_element(this, person.full_name);
} }
} }
}); });