mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-28 11:49:37 +02:00
#2219 Moving check earlier in the chain for better effect
This commit is contained in:
@@ -65,7 +65,6 @@ const sanitizeMore = (text, config) => {
|
||||
|
||||
export const sanitizeText = (text, config) => {
|
||||
const txt = sanitizeMore(DOMPurify.sanitize(text), config);
|
||||
|
||||
return txt;
|
||||
};
|
||||
|
||||
|
@@ -71,6 +71,14 @@ export const detectInit = function (text, cnf) {
|
||||
let results = {};
|
||||
if (Array.isArray(inits)) {
|
||||
let args = inits.map((init) => init.args);
|
||||
Object.keys(args).forEach((argKey) => {
|
||||
Object.keys(args[argKey]).forEach((key) => {
|
||||
if (key.indexOf('__') === 0) {
|
||||
log.debug('sanitize deleting prototype option', args[key]);
|
||||
delete args[argKey][key];
|
||||
}
|
||||
});
|
||||
});
|
||||
results = assignWithDepth(results, [...args]);
|
||||
} else {
|
||||
results = inits.args;
|
||||
@@ -173,7 +181,6 @@ export const detectDirective = function (text, type = null) {
|
||||
*/
|
||||
export const detectType = function (text, cnf) {
|
||||
text = text.replace(directive, '').replace(anyComment, '\n');
|
||||
log.debug('Detecting diagram type based on the text ' + text);
|
||||
if (text.match(/^\s*sequenceDiagram/)) {
|
||||
return 'sequence';
|
||||
}
|
||||
|
Reference in New Issue
Block a user