Skip to content

Commit ccdfd7c

Browse files
chancancodedavidtaylorhq
authored andcommitted
Provide a shim for parseBBCodeTag
1 parent a6c4c2a commit ccdfd7c

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

app/assets/javascripts/discourse/app/static/markdown-it/index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
11
import { htmlSafe } from "@ember/template";
2+
import { importSync } from "@embroider/macros";
3+
import loaderShim from "discourse-common/lib/loader-shim";
24
import DiscourseMarkdownIt from "discourse-markdown-it";
35
import loadPluginFeatures from "./features";
46
import MentionsParser from "./mentions-parser";
57
import buildOptions from "./options";
68

9+
// Shims the `parseBBCodeTag` utility function back to its old location. For
10+
// now, there is no deprecation with this as we don't have a new location for
11+
// them to import from (well, we do, but we don't want to expose the new code
12+
// to loader.js and we want to make sure the code is loaded lazily).
13+
//
14+
// TODO: find a new home for this – the code is rather small so we could just
15+
// throw it into the synchronous pretty-text package and call it good, but we
16+
// should probably look into why plugins are needing to call this utility in
17+
// the first place, and provide better infrastructure for registering bbcode
18+
// additions instead.
19+
loaderShim("pretty-text/engines/discourse-markdown/bbcode-block", () =>
20+
importSync("./parse-bbcode-tag")
21+
);
22+
723
function buildEngine(options) {
824
return DiscourseMarkdownIt.withCustomFeatures(
925
loadPluginFeatures()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { parseBBCodeTag } from "discourse-markdown-it/features/bbcode-block";

0 commit comments

Comments
 (0)