Compare commits

..

7 Commits

Author SHA1 Message Date
ashishj
619136d389 Updating to version to 9.1.6 2022-08-18 20:07:15 +02:00
Knut Sveidqvist
a89b6fd054 Merge branch 'master' into develop 2022-08-18 19:57:58 +02:00
Knut Sveidqvist
02fc68a3f6 Merge pull request #3330 from mermaid-js/3306_Fix_Gitgraph_Parsing_Issue
Fix for GitGraphs not working for Mermaid Live Editor
2022-08-18 19:43:17 +02:00
Ashish Jain
b65c67ec2c Merge pull request #3331 from mermaid-js/3308_allow_br_in_tooltips
#3308 Allowing br tags in tooltips
2022-08-18 19:16:23 +02:00
Knut Sveidqvist
1befbe08ff #3308 Allowing br tags in tooltips 2022-08-18 19:11:33 +02:00
Knut Sveidqvist
808bcb8022 Updated version for the docs 2022-08-11 20:34:26 +02:00
Knut Sveidqvist
af8a5cbbfa Version 9.1.5 2022-08-11 20:29:15 +02:00
7 changed files with 52 additions and 70 deletions

View File

@@ -15,6 +15,8 @@
/* font-size: 18px !important; */
width: 100%;
display: flex;
flex-direction: column;
margin-left: 20px;
}
h1 { color: grey;}
.mermaid2,.mermaid3 {
@@ -31,26 +33,30 @@
<div class="mermaid2" style="width: 50%;">
journey
title My working day
section Go to work
Make tea: 5: Me
Go upstairs: 3: Me
Do work: 1: Me, Cat
section Go home
Go downstairs: 5: Me
Sit down: 5: Mee
</div>
<div class="mermaid2" style="width: 50%;">
pie
accTitle: My Pie Chart Accessibility Title
accDescr: My Pie Chart Accessibility Description
flowchart LR
classDef aPID stroke:#4e4403,fill:#fdde29,color:#4e4403,rx:5px,ry:5px;
classDef crm stroke:#333333,fill:#DCDCDC,color:#333333,rx:5px,ry:5px;
classDef type stroke:#502604,fill:#FAB565,color:#502604,rx:20px,ry:20px;;
title Key elements in Product X
"Calcium" : 42.96
"Potassium" : 50.05
"Magnesium" : 10.01
"Iron" : 5
O0("Joe")
class O0 aPID;
O1("Person")
class O1 crm;
O0 -- has type -->O1["Person"]
O2("aat:300411314")
class O2 type;
click O2 function "Sorry the newline html tags are not being processed correctly<br/> So all of this appears on the <br/> same line."
O0 -- has type -->O2["Bug"]
click O0 function "Lots of great info about Joe<br>Lots of great info about Joe<br>burt<br>fred";
</div>
<div class="mermaid" style="width: 50%;">
classDiagram-v2
class Shape
link Shape "https://www.github.com" "This is a<br/>tooltip<br>for a link"
class Shape2
click Shape2 href "https://www.github.com" "This is a tooltip for a link"
</div>
<div class="mermaid2" style="width: 50%;">
gitGraph
@@ -217,7 +223,7 @@ class Class10 {
size()
}
</div>
<div class="mermaid" style="width: 100%;">
<div class="mermaid2" style="width: 100%;">
%%{init: {'config': {'wrap': true }}}%%
sequenceDiagram
participant A as Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be
@@ -297,47 +303,15 @@ flowchart TD
// console.error('Mermaid error: ', err);
};
mermaid.initialize({
// theme: 'dark',
// theme: 'forest',
// arrowMarkerAbsolute: true,
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
flowchart: {
nodeSpacing: 10,
curve: 'cardinal',
htmlLabels: true,
useMaxWidth: false,
// defaultRenderer: 'dagre-d3',
},
class: {
// defaultRenderer: 'dagre-d3',
htmlLabels: true,
},
sequence: {
// mirrorActors: false,'
wrap: false,
},
// gantt: { axisFormat: '%m/%d/%Y' },
// sequence: {
// actorFontFamily: 'courier',
// actorMargin: 50,
// showSequenceNumbers: false,
// // hideUnusedParticipants: true,
// // forceMenus: true,
// },
// // sequenceDiagram: { actorMargin: 300, forceMenus: false }, // deprecated
// fontFamily: '"times", sans-serif',
// fontFamily: 'courier',
state: {
nodeSpacing: 50,
rankSpacing: 50,
defaultRenderer: 'dagre-d3',
},
maxTextSize: 900000,
startOnLoad: true,
securityLevel: 'loose',
logLevel: 0,
fontSize: 18,
curve: 'cardinal',
// securityLevel: 'sandbox',
// themeVariables: {relationLabelColor: 'red'}
wrap: true,
flowchart: {
curve: 'basis',
useMaxWidth: false,
htmlLabels: true,
},
});
function callback() {
alert('It worked');

View File

@@ -18,7 +18,7 @@
<!-- <link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css"> -->
<link rel="stylesheet" href="theme.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css">
<script src="//cdn.jsdelivr.net/npm/mermaid@9.1.3/dist/mermaid.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/mermaid@9.1.6/dist/mermaid.min.js"></script>
<!-- <script src="http://localhost:9000/mermaid.js"></script> -->
<script>
// prettier-ignore

View File

@@ -1,6 +1,6 @@
{
"name": "mermaid",
"version": "9.1.4",
"version": "9.1.6",
"description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.",
"main": "dist/mermaid.core.js",
"module": "dist/mermaid.esm.min.mjs",
@@ -65,7 +65,7 @@
"dompurify": "2.3.10",
"graphlib": "^2.1.8",
"khroma": "^2.0.0",
"moment-mini": "^2.24.0",
"moment-mini": "2.24.0",
"stylis": "^4.0.10"
},
"devDependencies": {

View File

@@ -206,7 +206,9 @@ const setTooltip = function (ids, tooltip) {
}
});
};
export const getTooltip = function (id) {
return classes[id].tooltip;
};
/**
* Called by parser when a link is found. Adds the URL to the vertex data.
*
@@ -337,6 +339,7 @@ const setupToolTips = function (element) {
.text(el.attr('title'))
.style('left', window.scrollX + rect.left + (rect.right - rect.left) / 2 + 'px')
.style('top', window.scrollY + rect.top - 14 + document.body.scrollTop + 'px');
tooltipElem.html(tooltipElem.html().replace(/&lt;br\/&gt;/g, '<br/>'));
el.classed('hover', true);
})
.on('mouseout', function () {
@@ -378,6 +381,7 @@ export default {
setClickEvent,
setCssClass,
setLink,
getTooltip,
setTooltip,
lookUpDomId,
};

View File

@@ -29,8 +29,10 @@ let conf = {
* >} classes
* Object containing the vertices.
* @param {SVGGElement} g The graph that is to be drawn.
* @param _id
* @param diagObj
*/
export const addClasses = function (classes, g) {
export const addClasses = function (classes, g, _id, diagObj) {
// const svg = select(`[id="${svgId}"]`);
const keys = Object.keys(classes);
log.info('keys:', keys);
@@ -108,6 +110,7 @@ export const addClasses = function (classes, g) {
style: styles.style,
id: vertex.id,
domId: vertex.domId,
tooltip: diagObj.db.getTooltip(vertex.id) || '',
haveCallback: vertex.haveCallback,
link: vertex.link,
width: vertex.type === 'group' ? 500 : undefined,
@@ -319,7 +322,7 @@ export const draw = function (text, id, _version, diagObj) {
const relations = diagObj.db.getRelations();
log.info(relations);
addClasses(classes, g, id);
addClasses(classes, g, id, diagObj);
addRelations(relations, g);
// Add custom shapes

View File

@@ -409,6 +409,7 @@ const setupToolTips = function (element) {
.text(el.attr('title'))
.style('left', window.scrollX + rect.left + (rect.right - rect.left) / 2 + 'px')
.style('top', window.scrollY + rect.top - 14 + document.body.scrollTop + 'px');
tooltipElem.html(tooltipElem.html().replace(/&lt;br\/&gt;/g, '<br/>'));
el.classed('hover', true);
})
.on('mouseout', function () {

View File

@@ -8598,10 +8598,10 @@ module-deps-sortable@^5.0.3:
through2 "^2.0.0"
xtend "^4.0.0"
moment-mini@^2.24.0:
version "2.29.4"
resolved "https://registry.yarnpkg.com/moment-mini/-/moment-mini-2.29.4.tgz#cbbcdc58ce1b267506f28ea6668dbe060a32758f"
integrity sha512-uhXpYwHFeiTbY9KSgPPRoo1nt8OxNVdMVoTBYHfSEKeRkIkwGpO+gERmhuhBtzfaeOyTkykSrm2+noJBgqt3Hg==
moment-mini@2.24.0:
version "2.24.0"
resolved "https://registry.yarnpkg.com/moment-mini/-/moment-mini-2.24.0.tgz#fa68d98f7fe93ae65bf1262f6abb5fb6983d8d18"
integrity sha512-9ARkWHBs+6YJIvrIp0Ik5tyTTtP9PoV0Ssu2Ocq5y9v8+NOOpWiRshAp8c4rZVWTOe+157on/5G+zj5pwIQFEQ==
moment@^2.23.0:
version "2.29.4"