synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
43 lines (42 loc) • 1.2 kB
JavaScript
import { jsxs as t, jsx as s, Fragment as p } from "react/jsx-runtime";
import { Component as c, Fragment as h } from "react";
class u extends c {
constructor(e) {
super(e), this.renderBookmarks = this.renderBookmarks.bind(this);
}
/**
* Returns bookmarks
*
* @returns JSX for the embedded bookmarks in the markdown passed in as a prop
* @memberof Bookmarks
*/
renderBookmarks() {
const e = String(this.props.footnotes), a = /Synapse widget><\/span>(.*)</g;
let n;
const o = [];
for (; n = a.exec(e); )
o.push(n[1]);
return o.map((m, r) => {
const k = r < o.length - 1;
return /* @__PURE__ */ t(h, { children: [
/* @__PURE__ */ t("button", { className: "SRC-markdown-bookmark", id: `bookmark${r}`, children: [
"[",
r + 1,
"]"
] }),
/* @__PURE__ */ s("span", { dangerouslySetInnerHTML: { __html: m } }),
k && /* @__PURE__ */ s("br", {})
] }, r);
});
}
render() {
return /* @__PURE__ */ t(p, { children: [
/* @__PURE__ */ s("hr", {}),
this.renderBookmarks()
] });
}
}
export {
u as default
};
//# sourceMappingURL=Bookmarks.js.map