mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-22 08:50:13 +02:00
#3074 Using regular title as a fallback for the accessibility title when no dedicated accessibility title is present
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
import { sanitizeText as _sanitizeText } from './diagrams/common/common';
|
||||
import { getConfig } from './config';
|
||||
let title = '';
|
||||
let diagramTitle = '';
|
||||
let description = '';
|
||||
const sanitizeText = (txt) => _sanitizeText(txt, getConfig());
|
||||
|
||||
export const clear = function () {
|
||||
title = '';
|
||||
description = '';
|
||||
diagramTitle = '';
|
||||
};
|
||||
|
||||
export const setAccTitle = function (txt) {
|
||||
@@ -14,7 +16,7 @@ export const setAccTitle = function (txt) {
|
||||
};
|
||||
|
||||
export const getAccTitle = function () {
|
||||
return title;
|
||||
return title || diagramTitle;
|
||||
};
|
||||
|
||||
export const setAccDescription = function (txt) {
|
||||
@@ -25,9 +27,19 @@ export const getAccDescription = function () {
|
||||
return description;
|
||||
};
|
||||
|
||||
export const setDiagramTitle = function (txt) {
|
||||
diagramTitle = sanitizeText(txt);
|
||||
};
|
||||
|
||||
export const getDiagramTitle = function () {
|
||||
return diagramTitle;
|
||||
};
|
||||
|
||||
export default {
|
||||
setAccTitle,
|
||||
getAccTitle,
|
||||
setDiagramTitle,
|
||||
getDiagramTitle: getDiagramTitle,
|
||||
getAccDescription,
|
||||
setAccDescription,
|
||||
clear,
|
||||
|
Reference in New Issue
Block a user