mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-15 06:19:24 +02:00
Merge branch 'develop' into 6637-add-new-participant-types-to-sequence-diagrams
This commit is contained in:
5
.changeset/six-planets-rescue.md
Normal file
5
.changeset/six-planets-rescue.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'mermaid': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: node border style for handdrawn shapes
|
2
.github/workflows/e2e-timings.yml
vendored
2
.github/workflows/e2e-timings.yml
vendored
@@ -58,7 +58,7 @@ jobs:
|
|||||||
echo "EOF" >> $GITHUB_OUTPUT
|
echo "EOF" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Commit and create pull request
|
- name: Commit and create pull request
|
||||||
uses: peter-evans/create-pull-request@07cbaebb4bfc9c5d7db426ea5a5f585df29dd0a0
|
uses: peter-evans/create-pull-request@1310d7dab503600742045e6fd4b84dda64352858
|
||||||
with:
|
with:
|
||||||
add-paths: |
|
add-paths: |
|
||||||
cypress/timings.json
|
cypress/timings.json
|
||||||
|
@@ -33,13 +33,13 @@ function setupDompurifyHooks() {
|
|||||||
const TEMPORARY_ATTRIBUTE = 'data-temp-href-target';
|
const TEMPORARY_ATTRIBUTE = 'data-temp-href-target';
|
||||||
|
|
||||||
DOMPurify.addHook('beforeSanitizeAttributes', (node) => {
|
DOMPurify.addHook('beforeSanitizeAttributes', (node) => {
|
||||||
if (node instanceof Element && node.tagName === 'A' && node.hasAttribute('target')) {
|
if (node.tagName === 'A' && node.hasAttribute('target')) {
|
||||||
node.setAttribute(TEMPORARY_ATTRIBUTE, node.getAttribute('target') ?? '');
|
node.setAttribute(TEMPORARY_ATTRIBUTE, node.getAttribute('target') ?? '');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
DOMPurify.addHook('afterSanitizeAttributes', (node) => {
|
DOMPurify.addHook('afterSanitizeAttributes', (node) => {
|
||||||
if (node instanceof Element && node.tagName === 'A' && node.hasAttribute(TEMPORARY_ATTRIBUTE)) {
|
if (node.tagName === 'A' && node.hasAttribute(TEMPORARY_ATTRIBUTE)) {
|
||||||
node.setAttribute('target', node.getAttribute(TEMPORARY_ATTRIBUTE) ?? '');
|
node.setAttribute('target', node.getAttribute(TEMPORARY_ATTRIBUTE) ?? '');
|
||||||
node.removeAttribute(TEMPORARY_ATTRIBUTE);
|
node.removeAttribute(TEMPORARY_ATTRIBUTE);
|
||||||
if (node.getAttribute('target') === '_blank') {
|
if (node.getAttribute('target') === '_blank') {
|
||||||
|
@@ -104,8 +104,23 @@ export const userNodeOverrides = (node: Node, options: any) => {
|
|||||||
seed: handDrawnSeed,
|
seed: handDrawnSeed,
|
||||||
strokeWidth: stylesMap.get('stroke-width')?.replace('px', '') || 1.3,
|
strokeWidth: stylesMap.get('stroke-width')?.replace('px', '') || 1.3,
|
||||||
fillLineDash: [0, 0],
|
fillLineDash: [0, 0],
|
||||||
|
strokeLineDash: getStrokeDashArray(stylesMap.get('stroke-dasharray')),
|
||||||
},
|
},
|
||||||
options
|
options
|
||||||
);
|
);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getStrokeDashArray = (strokeDasharrayStyle?: string) => {
|
||||||
|
if (!strokeDasharrayStyle) {
|
||||||
|
return [0, 0];
|
||||||
|
}
|
||||||
|
const dashArray = strokeDasharrayStyle.trim().split(/\s+/).map(Number);
|
||||||
|
if (dashArray.length === 1) {
|
||||||
|
const val = isNaN(dashArray[0]) ? 0 : dashArray[0];
|
||||||
|
return [val, val];
|
||||||
|
}
|
||||||
|
const first = isNaN(dashArray[0]) ? 0 : dashArray[0];
|
||||||
|
const second = isNaN(dashArray[1]) ? 0 : dashArray[1];
|
||||||
|
return [first, second];
|
||||||
|
};
|
||||||
|
Reference in New Issue
Block a user