Skip to content

Commit fa322c0

Browse files
committed
refactor(Math): deprecate the Math extension
1 parent eb1983c commit fa322c0

5 files changed

Lines changed: 24 additions & 1 deletion

File tree

packages/editor/src/bundle/config/markup.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ export const mTabsItemData: MToolbarSingleItemData = {
276276
isEnable: enable,
277277
};
278278

279+
/** @deprecated Use mLatexInlineItemData from `@gravity-ui/markdown-editor-latex-extension` */
279280
export const mMathInlineItemData: ToolbarListButtonItemData<CodeEditor> = {
280281
id: ActionName.math_inline,
281282
title: i18n.bind(null, 'math_inline'),
@@ -284,6 +285,7 @@ export const mMathInlineItemData: ToolbarListButtonItemData<CodeEditor> = {
284285
isActive: inactive,
285286
isEnable: enable,
286287
};
288+
/** @deprecated Use mLatexBlockItemData from `@gravity-ui/markdown-editor-latex-extension` */
287289
export const mMathBlockItemData: ToolbarListButtonItemData<CodeEditor> = {
288290
id: ActionName.math_block,
289291
title: i18n.bind(null, 'math_block'),
@@ -347,6 +349,7 @@ export const mEmojiItemData: MToolbarSingleItemData = {
347349
isEnable: disable,
348350
};
349351

352+
/** @deprecated Use mLatexListItem from `@gravity-ui/markdown-editor-latex-extension` */
350353
export const mMathListItem: MToolbarListItemData = {
351354
id: 'math',
352355
type: ToolbarDataType.ListButton,
@@ -485,6 +488,7 @@ export const mCodeListConfig: MToolbarListButtonData = {
485488
data: [mCodeItemData, mCodeblockItemData],
486489
};
487490

491+
/** @deprecated Use mLatexListConfig from `@gravity-ui/markdown-editor-latex-extension` */
488492
export const mMathListConfig: MToolbarListButtonData = {
489493
icon: icons.functionInline,
490494
withArrow: true,

packages/editor/src/bundle/config/wysiwyg.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ export const wTabsItemData: WToolbarSingleItemData = {
231231
isActive: (e) => e.actions.toYfmTabs.isActive(),
232232
isEnable: (e) => e.actions.toYfmTabs.isEnable(),
233233
};
234+
/** @deprecated Use wLatexInlineItemData from `@gravity-ui/markdown-editor-latex-extension` */
234235
export const wMathInlineItemData: WToolbarSingleItemData = {
235236
id: ActionName.math_inline,
236237
type: ToolbarDataType.SingleButton,
@@ -241,6 +242,7 @@ export const wMathInlineItemData: WToolbarSingleItemData = {
241242
isActive: (e) => e.actions.addMathInline.isActive(),
242243
isEnable: (e) => e.actions.addMathInline.isEnable(),
243244
};
245+
/** @deprecated Use wLatexBlockItemData from `@gravity-ui/markdown-editor-latex-extension` */
244246
export const wMathBlockItemData: WToolbarSingleItemData = {
245247
id: ActionName.math_block,
246248
type: ToolbarDataType.SingleButton,
@@ -321,6 +323,7 @@ export const textContextItemData: SelectionContextItemData = {
321323
},
322324
};
323325

326+
/** @deprecated Use wLatexListItem from `@gravity-ui/markdown-editor-latex-extension` */
324327
export const wMathListItem: WToolbarListItemData = {
325328
id: 'math',
326329
type: ToolbarDataType.ListButton,
@@ -404,6 +407,7 @@ export const wCodeListConfig: WToolbarListButtonData = {
404407
title: i18n.bind(null, 'code'),
405408
data: [wCodeItemData, wCodeBlockItemData],
406409
};
410+
/** @deprecated Use wLatexListConfig from `@gravity-ui/markdown-editor-latex-extension` */
407411
export const wMathListConfig: WToolbarListButtonData = {
408412
icon: icons.functionInline,
409413
withArrow: true,

packages/editor/src/extensions/additional/Math/MathSpecs/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@ import {nodeTypeFactory} from 'src/utils/schema';
55

66
import {CLASSNAMES, MathNode, MathToken} from './const';
77

8-
export {MathNode} from './const';
8+
export {
9+
/** @deprecated Use LatexNodeName from `@gravity-ui/markdown-editor-latex-extension` */
10+
MathNode,
11+
};
12+
/** @deprecated Use LatexNodeType.Inline from `@gravity-ui/markdown-editor-latex-extension` */
913
export const mathIType = nodeTypeFactory(MathNode.Inline);
14+
/** @deprecated Use LatexNodeType.Block from `@gravity-ui/markdown-editor-latex-extension` */
1015
export const mathBType = nodeTypeFactory(MathNode.Block);
1116

17+
/** @deprecated Use LatexSpecsExtension from `@gravity-ui/markdown-editor-latex-extension` */
1218
export const MathSpecs: ExtensionAuto = (builder) => {
1319
builder.configureMd((md) => md.use(transform({bundle: false, validate: false}), {output: ''}));
1420

packages/editor/src/extensions/additional/Math/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ const mathITemplate = 'f(x)=';
3131

3232
// !!! YfmPreset/YfmSpecsPreset does not use or re-export the Math extension
3333

34+
/** @deprecated Use LatexExtensionOptions from `@gravity-ui/markdown-editor-latex-extension` */
3435
export type MathOptions = Pick<
3536
MathNodeViewOptions,
3637
'loadRuntimeScript' | 'sanitize' | 'katexOptions'
3738
>;
3839

40+
/** @deprecated Use LatexExtension from `@gravity-ui/markdown-editor-latex-extension` */
3941
export const Math: ExtensionAuto<MathOptions> = (builder, opts) => {
4042
builder.use(MathSpecs);
4143

packages/editor/src/modules/toolbars/items.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,35 +412,41 @@ export const tabsItemMarkup: ToolbarItemMarkup = {
412412
};
413413

414414
// ---- Math Inline ----
415+
/** @deprecated Use latexInlineItemView from `@gravity-ui/markdown-editor-latex-extension` */
415416
export const mathInlineItemView: ToolbarItemView = {
416417
type: ToolbarDataType.SingleButton,
417418
title: i18n.bind(null, 'math_inline'),
418419
icon: icons.functionInline,
419420
hint: () => `${i18nHint.bind(null, 'math_hint')()} ${i18nHint.bind(null, 'math_hint_katex')()}`,
420421
};
422+
/** @deprecated Use latexInlineItemWysiwyg from `@gravity-ui/markdown-editor-latex-extension` */
421423
export const mathInlineItemWysiwyg: ToolbarItemWysiwyg = {
422424
exec: (e) => e.actions.addMathInline.run(),
423425
isActive: (e) => e.actions.addMathInline.isActive(),
424426
isEnable: (e) => e.actions.addMathInline.isEnable(),
425427
};
428+
/** @deprecated Use latexInlineItemMarkup from `@gravity-ui/markdown-editor-latex-extension` */
426429
export const mathInlineItemMarkup: ToolbarItemMarkup = {
427430
exec: (e) => wrapToMathInline(e.cm),
428431
isActive: inactive,
429432
isEnable: enable,
430433
};
431434

432435
// ---- Math Block ----
436+
/** @deprecated Use latexBlockItemView from `@gravity-ui/markdown-editor-latex-extension` */
433437
export const mathBlockItemView: ToolbarItemView = {
434438
type: ToolbarDataType.SingleButton,
435439
title: i18n.bind(null, 'math_block'),
436440
icon: icons.functionBlock,
437441
hint: () => `${i18nHint.bind(null, 'math_hint')()} ${i18nHint.bind(null, 'math_hint_katex')()}`,
438442
};
443+
/** @deprecated Use latexBlockItemWysiwyg from `@gravity-ui/markdown-editor-latex-extension` */
439444
export const mathBlockItemWysiwyg: ToolbarItemWysiwyg = {
440445
exec: (e) => e.actions.toMathBlock.run(),
441446
isActive: (e) => e.actions.toMathBlock.isActive(),
442447
isEnable: (e) => e.actions.toMathBlock.isEnable(),
443448
};
449+
/** @deprecated Use latexBlockItemMarkup from `@gravity-ui/markdown-editor-latex-extension` */
444450
export const mathBlockItemMarkup: ToolbarItemMarkup = {
445451
exec: (e) => wrapToMathBlock(e.cm),
446452
isActive: inactive,
@@ -837,6 +843,7 @@ export const codeBlocksListItemView: ToolbarItemView<ToolbarDataType.ListButton>
837843
};
838844

839845
// ---- Math list ----
846+
/** @deprecated Use latexListItemView from `@gravity-ui/markdown-editor-latex-extension` */
840847
export const mathListItemView: ToolbarItemView<ToolbarDataType.ListButton> = {
841848
type: ToolbarDataType.ListButton,
842849
icon: icons.functionInline,

0 commit comments

Comments
 (0)