mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-22 00:40:22 +02:00
Add id as css scope
This commit is contained in:
@@ -42,7 +42,8 @@
|
|||||||
"graphlibrary": "^2.2.0",
|
"graphlibrary": "^2.2.0",
|
||||||
"he": "^1.1.1",
|
"he": "^1.1.1",
|
||||||
"lodash": "^4.17.5",
|
"lodash": "^4.17.5",
|
||||||
"moment": "^2.21.0"
|
"moment": "^2.21.0",
|
||||||
|
"scope-css": "^1.0.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-core": "^6.26.0",
|
"babel-core": "^6.26.0",
|
||||||
|
@@ -12,6 +12,7 @@
|
|||||||
* somewhere in the page or something completely different.
|
* somewhere in the page or something completely different.
|
||||||
*/
|
*/
|
||||||
import * as d3 from 'd3'
|
import * as d3 from 'd3'
|
||||||
|
import scope from 'scope-css'
|
||||||
|
|
||||||
import { logger, setLogLevel } from './logger'
|
import { logger, setLogLevel } from './logger'
|
||||||
import graph from './diagrams/flowchart/graphDb'
|
import graph from './diagrams/flowchart/graphDb'
|
||||||
@@ -438,7 +439,7 @@ const render = function (id, txt, cb, container) {
|
|||||||
// insert inline style into svg
|
// insert inline style into svg
|
||||||
const svg = element.firstChild
|
const svg = element.firstChild
|
||||||
const s = document.createElement('style')
|
const s = document.createElement('style')
|
||||||
s.innerHTML = themes[config.theme] || defaultTheme
|
s.innerHTML = scope(themes[config.theme] || defaultTheme, `#${id}`)
|
||||||
svg.insertBefore(s, svg.firstChild)
|
svg.insertBefore(s, svg.firstChild)
|
||||||
|
|
||||||
d3.select('#d' + id).selectAll('foreignobject div').attr('xmlns', 'http://www.w3.org/1999/xhtml')
|
d3.select('#d' + id).selectAll('foreignobject div').attr('xmlns', 'http://www.w3.org/1999/xhtml')
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
.mermaid {
|
|
||||||
@import 'flow';
|
@import 'flow';
|
||||||
@import 'sequenceDiagram';
|
@import 'sequenceDiagram';
|
||||||
@import 'gantt';
|
@import 'gantt';
|
||||||
@@ -23,4 +22,3 @@
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@@ -7135,6 +7135,10 @@ schema-utils@^0.4.2:
|
|||||||
ajv "^6.1.0"
|
ajv "^6.1.0"
|
||||||
ajv-keywords "^3.1.0"
|
ajv-keywords "^3.1.0"
|
||||||
|
|
||||||
|
scope-css@^1.0.5:
|
||||||
|
version "1.0.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/scope-css/-/scope-css-1.0.5.tgz#9a40a959231ecf683dbef3dedae6a26ab091e1fd"
|
||||||
|
|
||||||
scoped-regex@^1.0.0:
|
scoped-regex@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/scoped-regex/-/scoped-regex-1.0.0.tgz#a346bb1acd4207ae70bd7c0c7ca9e566b6baddb8"
|
resolved "https://registry.yarnpkg.com/scoped-regex/-/scoped-regex-1.0.0.tgz#a346bb1acd4207ae70bd7c0c7ca9e566b6baddb8"
|
||||||
|
Reference in New Issue
Block a user