From d052702b6e4b736fe2ac67c8488f3ec1951096fb Mon Sep 17 00:00:00 2001 From: Elena Martynova Date: Thu, 11 Apr 2024 18:21:48 +0300 Subject: [PATCH] feat: add attribute to plugin root element (#135) --- src/plugins/Text/Text.tsx | 6 +++++- src/plugins/Title/Title.tsx | 3 ++- src/plugins/constants.ts | 1 + src/plugins/index.ts | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 src/plugins/constants.ts diff --git a/src/plugins/Text/Text.tsx b/src/plugins/Text/Text.tsx index 8ef7e2a..dc84575 100644 --- a/src/plugins/Text/Text.tsx +++ b/src/plugins/Text/Text.tsx @@ -5,6 +5,7 @@ import {Button, Loader} from '@gravity-ui/uikit'; import {i18n} from '../../i18n'; import {Plugin, PluginWidgetProps} from '../../typings'; import {cn} from '../../utils/cn'; +import {PLUGIN_ROOT_ATTR_NAME} from '../constants'; import './Text.scss'; @@ -107,7 +108,10 @@ export class PluginText extends React.PureComponent +
{this.withMarkdown ? (
{ const size = data.size ? data.size : false; const id = data.showInTOC && text ? encodeURIComponent(text) : undefined; return ( -
+
{text}
); diff --git a/src/plugins/constants.ts b/src/plugins/constants.ts new file mode 100644 index 0000000..85ff97f --- /dev/null +++ b/src/plugins/constants.ts @@ -0,0 +1 @@ +export const PLUGIN_ROOT_ATTR_NAME = 'data-plugin-root-el'; diff --git a/src/plugins/index.ts b/src/plugins/index.ts index d931ab5..6d692b2 100644 --- a/src/plugins/index.ts +++ b/src/plugins/index.ts @@ -1,2 +1,3 @@ export * from './Text'; export * from './Title'; +export * from './constants';