Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat: open links in help in new tabs (#2174)
ZhengXecc1f5845cb2
diff --git a/frontend/src/App.vue b/frontend/src/App.vueindex 902ada8aa2..273cb483a8 100644--- a/frontend/src/App.vue+++ b/frontend/src/App.vue@@ -31,7 +31,7 @@ import { isDev } from "./utils";import { BBNotificationItem } from "./bbkit/types";import KBarWrapper from "./components/KBar/KBarWrapper.vue";import BBModalStack from "./bbkit/BBModalStack.vue";-import HelpDrawer from "@/components/HelpDrawer.vue";+import HelpDrawer from "@/components/HelpDrawer";import { NConfigProvider, NDialogProvider } from "naive-ui";import { themeOverrides, dateLang, generalLang } from "../naive-ui.config";diff --git a/frontend/src/components/HelpDrawer.vue b/frontend/src/components/HelpDrawer/HelpDrawer.vuesimilarity index 92%rename from frontend/src/components/HelpDrawer.vuerename to frontend/src/components/HelpDrawer/HelpDrawer.vueindex 208da78c65..6cf6d32bc9 100644--- a/frontend/src/components/HelpDrawer.vue+++ b/frontend/src/components/HelpDrawer/HelpDrawer.vue@@ -21,6 +21,7 @@ import { storeToRefs } from "pinia";import { useLanguage } from "@/composables/useLanguage";import { useUIStateStore, useHelpStore } from "@/store";import Drawer from "@/components/Drawer.vue";+import { markdocConfig, DOMPurifyConfig } from "./config";interface State {frontmatter: Record<string, string>;@@ -50,14 +51,15 @@ export default defineComponent({);const markdown = await res.text();const ast: Node = Markdoc.parse(markdown);- const content = Markdoc.transform(ast) as Tag;+ const content = Markdoc.transform(ast, markdocConfig) as Tag;+content.attributes.class = "markdown-body"; // style help contentconst html: string = Markdoc.renderers.html(content);state.frontmatter = ast.attributes.frontmatter? (yaml.load(ast.attributes.frontmatter) as Record<string, string>): {};- state.html = DOMPurify.sanitize(html);+ state.html = DOMPurify.sanitize(html, DOMPurifyConfig);activate();} else {state.frontmatter = {};diff --git a/frontend/src/components/HelpDrawer/config.ts b/frontend/src/components/HelpDrawer/config.tsnew file mode 100644index 0000000000..72ed206af3--- /dev/null+++ b/frontend/src/components/HelpDrawer/config.ts@@ -0,0 +1,23 @@+import { Tag } from "@markdoc/markdoc";++export const markdocConfig = {+ nodes: {+ link: {+ render: "a",+ attributes: {+ href: { type: String, required: true },+ target: { type: String, default: "_blank" },+ },+ transform(node: any, config: any) {+ const attributes = node.transformAttributes(config);+ const children = node.transformChildren(config);+ Object.assign(attributes, { target: "_blank" });+ return new Tag("a", attributes, children);+ },+ },+ },+};++export const DOMPurifyConfig = {+ ADD_ATTR: ["target"],+};diff --git a/frontend/src/components/HelpDrawer/index.ts b/frontend/src/components/HelpDrawer/index.tsnew file mode 100644index 0000000000..e750fa3d9b--- /dev/null+++ b/frontend/src/components/HelpDrawer/index.ts@@ -0,0 +1,3 @@+import HelpDrawer from "./HelpDrawer.vue";++export default HelpDrawer;