chore(katex): fixed issues from merge

This commit is contained in:
NicolasNewman 2023-04-14 10:58:14 +09:00
parent f3b939e03a
commit f4cb6a1927
2 changed files with 28 additions and 12 deletions

View File

@ -63,14 +63,7 @@ export const addVertices = function (vert, g, svgId, root, doc, diagObj) {
if (evaluate(getConfig().flowchart.htmlLabels)) {
// TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
const node = {
label: vertexText
.replace(/fa[blrs]?:fa-[\w-]+/g, (s) => `<i class='${s.replace(':', ' ')}'></i>`)
.replace(/\$\$(.*)\$\$/g, (r, c) =>
katex
.renderToString(c, { throwOnError: true, displayMode: true, output: 'mathml' })
.replace(/\n/g, ' ')
.replace(/<annotation.*<\/annotation>/g, '')
),
label: vertexText,
};
vertexNode = addHtmlLabel(svg, node).node();
vertexNode.parentNode.removeChild(vertexNode);
@ -161,7 +154,7 @@ export const addVertices = function (vert, g, svgId, root, doc, diagObj) {
g.setNode(vertex.id, {
labelStyle: styles.labelStyle,
shape: _shape,
labelText: vertexText,
labelText,
labelType: vertex.labelType,
rx: radious,
ry: radious,
@ -329,7 +322,6 @@ export const addEdges = function (edges, g, diagObj) {
edgeData.arrowheadStyle = 'fill: #333';
edgeData.labelpos = 'c';
}
edgeData.labelType = edge.labelType;
edgeData.label = edge.text
.replace(common.lineBreakRegex, '\n')

28
pnpm-lock.yaml generated
View File

@ -150,6 +150,7 @@ importers:
jison: ^0.4.18
js-base64: ^3.7.2
jsdom: ^21.0.0
katex: ^0.15.2
khroma: ^2.0.0
lodash-es: ^4.17.21
micromatch: ^4.0.5
@ -182,6 +183,7 @@ importers:
dayjs: 1.11.7
dompurify: 2.4.5
elkjs: 0.8.2
katex: 0.15.6
khroma: 2.0.0
lodash-es: 4.17.21
non-layered-tidy-tree-layout: 2.0.2
@ -4065,7 +4067,7 @@ packages:
/axios/0.21.4_debug@4.3.2:
resolution: {integrity: sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==}
dependencies:
follow-redirects: 1.15.2_debug@4.3.4
follow-redirects: 1.15.2_debug@4.3.2
transitivePeerDependencies:
- debug
dev: true
@ -6646,6 +6648,28 @@ packages:
resolution: {integrity: sha512-XGozTsMPYkm+6b5QL3Z9wQcJjNYxp0CYn3U1gO7dwD6PAqU1SVWZxI9CCg3z+ml3YfqdPnrBehaBrnH2AGKbNA==}
dev: true
/follow-redirects/1.15.2:
resolution: {integrity: sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==}
engines: {node: '>=4.0'}
peerDependencies:
debug: '*'
peerDependenciesMeta:
debug:
optional: true
dev: true
/follow-redirects/1.15.2_debug@4.3.2:
resolution: {integrity: sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==}
engines: {node: '>=4.0'}
peerDependencies:
debug: '*'
peerDependenciesMeta:
debug:
optional: true
dependencies:
debug: 4.3.2
dev: true
/follow-redirects/1.15.2_debug@4.3.4:
resolution: {integrity: sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==}
engines: {node: '>=4.0'}
@ -7195,7 +7219,7 @@ packages:
engines: {node: '>=8.0.0'}
dependencies:
eventemitter3: 4.0.7
follow-redirects: 1.15.2_debug@4.3.4
follow-redirects: 1.15.2
requires-port: 1.0.0
transitivePeerDependencies:
- debug