@lukeashford/aurelius 4.1.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +12 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3871,12 +3871,14 @@ var import_lucide_react11 = require("lucide-react");
|
|
|
3871
3871
|
var import_react55 = __toESM(require("react"));
|
|
3872
3872
|
var import_dompurify = __toESM(require("dompurify"));
|
|
3873
3873
|
var import_marked = require("marked");
|
|
3874
|
-
import_dompurify.default.addHook
|
|
3875
|
-
|
|
3876
|
-
node.
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
}
|
|
3874
|
+
if (typeof window !== "undefined" && typeof import_dompurify.default.addHook === "function") {
|
|
3875
|
+
import_dompurify.default.addHook("afterSanitizeAttributes", (node) => {
|
|
3876
|
+
if (node.tagName === "A") {
|
|
3877
|
+
node.setAttribute("target", "_blank");
|
|
3878
|
+
node.setAttribute("rel", "noopener noreferrer");
|
|
3879
|
+
}
|
|
3880
|
+
});
|
|
3881
|
+
}
|
|
3880
3882
|
var DEFAULT_SANITIZE_CONFIG = {
|
|
3881
3883
|
ALLOWED_TAGS: [
|
|
3882
3884
|
"h1",
|
|
@@ -3953,6 +3955,9 @@ function injectStreamingCursor(html, cursorClassName) {
|
|
|
3953
3955
|
CURSOR_BASE_CLASSES,
|
|
3954
3956
|
cursorClassName
|
|
3955
3957
|
)}" aria-hidden="true"></span>`;
|
|
3958
|
+
if (typeof DOMParser === "undefined") {
|
|
3959
|
+
return html + cursorHtml;
|
|
3960
|
+
}
|
|
3956
3961
|
const parser = new DOMParser();
|
|
3957
3962
|
const doc = parser.parseFromString(`<div>${html}</div>`, "text/html");
|
|
3958
3963
|
const container = doc.body.firstChild;
|
|
@@ -3989,7 +3994,7 @@ var MarkdownContent = import_react55.default.forwardRef(
|
|
|
3989
3994
|
} else {
|
|
3990
3995
|
htmlContent = content;
|
|
3991
3996
|
}
|
|
3992
|
-
const sanitized = htmlContent ? import_dompurify.default.sanitize(htmlContent, config) : "";
|
|
3997
|
+
const sanitized = htmlContent && typeof import_dompurify.default.sanitize === "function" ? import_dompurify.default.sanitize(htmlContent, config) : htmlContent || "";
|
|
3993
3998
|
if (isStreaming) {
|
|
3994
3999
|
return injectStreamingCursor(sanitized, cursorClassName);
|
|
3995
4000
|
}
|