@diplodoc/transform 4.74.0 → 4.74.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -79,12 +79,12 @@ export function createTooltipFactory(options: TooltipOptions = {}) {
79
79
  const show = (reference: HTMLElement, text: string) => {
80
80
  hide();
81
81
 
82
- const tooltip = createTooltipElement({text, className: additionalClassName});
82
+ const tooltip = createTooltipElement({className: additionalClassName});
83
83
  const update = updateTooltipPosition.bind(null, options, reference, tooltip);
84
84
 
85
85
  state.currentId = tooltip.id;
86
86
 
87
- attachTooltip(tooltip, reference);
87
+ attachTooltip(tooltip, reference, text);
88
88
 
89
89
  state.unsubscribe = subscribeToScroll(reference, update);
90
90
 
@@ -142,7 +142,7 @@ export function createTooltipFactory(options: TooltipOptions = {}) {
142
142
  }
143
143
 
144
144
  function createTooltipElement(options: TooltipElementOptions) {
145
- const {text, className} = options;
145
+ const {className} = options;
146
146
 
147
147
  const id = generateId();
148
148
  const tooltip = document.createElement('div');
@@ -150,15 +150,13 @@ function createTooltipElement(options: TooltipElementOptions) {
150
150
  tooltip.id = id;
151
151
  tooltip.className = className ? `${TOOLTIP_BASE_CLASS} ${className}` : TOOLTIP_BASE_CLASS;
152
152
 
153
- tooltip.setAttribute('role', 'tooltip');
153
+ tooltip.setAttribute('role', 'status');
154
154
  tooltip.setAttribute('aria-live', 'polite');
155
155
 
156
- tooltip.textContent = text;
157
-
158
156
  return tooltip;
159
157
  }
160
158
 
161
- function attachTooltip(tooltip: HTMLElement, reference: HTMLElement) {
159
+ function attachTooltip(tooltip: HTMLElement, reference: HTMLElement, text: string) {
162
160
  const container = document.querySelector(PAGE_CONTAINER_SELECTOR) || document.body;
163
161
  const ariaLive = reference.getAttribute('aria-live');
164
162
 
@@ -169,6 +167,8 @@ function attachTooltip(tooltip: HTMLElement, reference: HTMLElement) {
169
167
  }
170
168
 
171
169
  container.appendChild(tooltip);
170
+
171
+ tooltip.textContent = text;
172
172
  }
173
173
 
174
174
  function detachTooltip(tooltip: HTMLElement) {
@@ -46,7 +46,6 @@ export interface TooltipContext {
46
46
  }
47
47
 
48
48
  export interface TooltipElementOptions {
49
- text: string;
50
49
  className?: string;
51
50
  }
52
51
 
@@ -4,19 +4,13 @@ import {escapeHtml} from 'markdown-it/lib/common/utils';
4
4
 
5
5
  import {generateID as globalGenerateID} from '../utils';
6
6
 
7
- import {LANG_TOKEN_DESCRIPTION, LANG_TOKEN_LABEL} from './constant';
8
-
9
7
  const inlineCode: MarkdownItPluginCb = (md, options) => {
10
- const lang = options.lang;
11
8
  const generateID = options.generateID ?? globalGenerateID;
12
9
 
13
10
  md.renderer.rules.code_inline = function (tokens, idx) {
14
11
  const id = generateID('inline-code-id');
15
12
 
16
- const description = LANG_TOKEN_DESCRIPTION[lang] ?? LANG_TOKEN_DESCRIPTION.en;
17
- const label = LANG_TOKEN_LABEL[lang] ?? LANG_TOKEN_LABEL.en;
18
-
19
- return `<code class="yfm-clipboard-inline-code" role="button" aria-label="${label}" aria-description="${description}" tabindex='0' id="${id}">${escapeHtml(tokens[idx].content)}</code>`;
13
+ return `<code class="yfm-clipboard-inline-code" role="button" tabindex='0' id="${id}">${escapeHtml(tokens[idx].content)}</code>`;
20
14
  };
21
15
  };
22
16