Skip to content

Commit

Permalink
Merge pull request #3829 from DanInProgress/fix/stylis-add-idselector
Browse files Browse the repository at this point in the history
Use stylis to prepend idSelector
  • Loading branch information
knsv committed Nov 29, 2022
2 parents b949da9 + 1f64302 commit 5e98e99
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions packages/mermaid/src/mermaidAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ const render = function (
);

const style1 = document.createElement('style');
style1.innerHTML = `${idSelector} ` + rules;
style1.innerHTML = rules;
svg.insertBefore(style1, firstChild);

// -------------------------------------------------------------------------------
Expand Down Expand Up @@ -706,7 +706,7 @@ const renderAsync = async function (
);

const style1 = document.createElement('style');
style1.innerHTML = `${idSelector} ` + rules;
style1.innerHTML = rules;
svg.insertBefore(style1, firstChild);

// -------------------------------------------------------------------------------
Expand Down
20 changes: 10 additions & 10 deletions packages/mermaid/src/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,48 +53,48 @@ const getStyles = (
} else {
log.warn(`No theme found for ${type}`);
}
return ` {
return ` & {
font-family: ${options.fontFamily};
font-size: ${options.fontSize};
fill: ${options.textColor}
}
/* Classes common for multiple diagrams */
.error-icon {
& .error-icon {
fill: ${options.errorBkgColor};
}
.error-text {
& .error-text {
fill: ${options.errorTextColor};
stroke: ${options.errorTextColor};
}
.edge-thickness-normal {
& .edge-thickness-normal {
stroke-width: 2px;
}
.edge-thickness-thick {
& .edge-thickness-thick {
stroke-width: 3.5px
}
.edge-pattern-solid {
& .edge-pattern-solid {
stroke-dasharray: 0;
}
.edge-pattern-dashed{
& .edge-pattern-dashed{
stroke-dasharray: 3;
}
.edge-pattern-dotted {
stroke-dasharray: 2;
}
.marker {
& .marker {
fill: ${options.lineColor};
stroke: ${options.lineColor};
}
.marker.cross {
& .marker.cross {
stroke: ${options.lineColor};
}
svg {
& svg {
font-family: ${options.fontFamily};
font-size: ${options.fontSize};
}
Expand Down

0 comments on commit 5e98e99

Please sign in to comment.