From 592fcdfc82da7b60563e63f0d2879a3e64686754 Mon Sep 17 00:00:00 2001 From: smsochneg Date: Mon, 4 Sep 2023 17:30:19 +0200 Subject: [PATCH] fix: new attributes when creating tabs (#123) --- src/extensions/yfm/YfmTabs/actions.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/extensions/yfm/YfmTabs/actions.ts b/src/extensions/yfm/YfmTabs/actions.ts index 0b05bd54..7a045166 100644 --- a/src/extensions/yfm/YfmTabs/actions.ts +++ b/src/extensions/yfm/YfmTabs/actions.ts @@ -3,7 +3,7 @@ import type {Command} from 'prosemirror-state'; import {tabPanelType, tabsListType, tabsType, tabType} from '.'; import {pType} from '../../base/BaseSchema'; import {tabActiveClassname, tabPanelActiveClassname} from './const'; -import {TabAttrs, TabPanelAttrs} from './YfmTabsSpecs/const'; +import {TabAttrs, TabPanelAttrs, TabsAttrs} from './YfmTabsSpecs/const'; export const createYfmTabsCommand: Command = (state, dispatch) => { if (dispatch) { @@ -26,9 +26,15 @@ export const createYfmTabsCommand: Command = (state, dispatch) => { [TabAttrs.id]: tabId, [TabAttrs.class]: tabActiveClassname, [TabAttrs.ariaControls]: panelId, + [TabAttrs.dataDiplodocIsActive]: 'true', + [TabAttrs.dataDiplodocid]: tabId, + [TabAttrs.dataDiplodocKey]: tabId, }); - const tabs = yfmTabs.create(null, [yfmTabsList.create(null, [yfmTab]), yfmTabPanel]); + const tabs = yfmTabs.create({[TabsAttrs.dataDiplodocGroup]: generateID()}, [ + yfmTabsList.create(null, [yfmTab]), + yfmTabPanel, + ]); dispatch(state.tr.replaceSelectionWith(tabs).scrollIntoView()); }