@jetbrains/ring-ui 5.0.5 → 5.0.6

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.
@@ -5,5 +5,5 @@ declare module 'react-markdown/lib/complex-types' {
5
5
  language?: string;
6
6
  }
7
7
  }
8
- declare const MarkdownCode: ({ children, language, inline }: CodeProps) => JSX.Element;
8
+ declare const MarkdownCode: ({ children, language, inline, className }: CodeProps) => JSX.Element;
9
9
  export default MarkdownCode;
@@ -1,7 +1,14 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import Code from '../code/code';
4
- const MarkdownCode = ({ children, language, inline }) => (<Code language={language} code={children?.join('') || ''} inline={inline}/>);
4
+ const MarkdownCode = ({ children, language, inline, className }) => {
5
+ // Hack for updated react-markdown RG-2193
6
+ const lang = language ?? (className?.
7
+ split(' ').
8
+ find(name => name.startsWith('language-'))?.
9
+ replace('language-', ''));
10
+ return (<Code language={lang} className={className} code={children?.join('') || ''} inline={inline}/>);
11
+ };
5
12
  MarkdownCode.propTypes = {
6
13
  language: PropTypes.string,
7
14
  children: PropTypes.array.isRequired,
@@ -5,5 +5,5 @@ declare module 'react-markdown/lib/complex-types' {
5
5
  language?: string;
6
6
  }
7
7
  }
8
- declare const MarkdownCode: ({ children, language, inline }: CodeProps) => JSX.Element;
8
+ declare const MarkdownCode: ({ children, language, inline, className }: CodeProps) => JSX.Element;
9
9
  export default MarkdownCode;
@@ -1,3 +1,4 @@
1
+ import 'core-js/modules/es.string.replace.js';
1
2
  import React from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
  import Code from '../code/code.js';
@@ -10,13 +11,19 @@ import '../global/trivial-template-tag.js';
10
11
  import '../global/memoize.js';
11
12
 
12
13
  const MarkdownCode = _ref => {
14
+ var _className$split$find;
15
+
13
16
  let {
14
17
  children,
15
18
  language,
16
- inline
19
+ inline,
20
+ className
17
21
  } = _ref;
22
+ // Hack for updated react-markdown RG-2193
23
+ const lang = language !== null && language !== void 0 ? language : className === null || className === void 0 ? void 0 : (_className$split$find = className.split(' ').find(name => name.startsWith('language-'))) === null || _className$split$find === void 0 ? void 0 : _className$split$find.replace('language-', '');
18
24
  return /*#__PURE__*/React.createElement(Code, {
19
- language: language,
25
+ language: lang,
26
+ className: className,
20
27
  code: (children === null || children === void 0 ? void 0 : children.join('')) || '',
21
28
  inline: inline
22
29
  });
@@ -11,6 +11,7 @@ import trivialTemplateTag from '../global/trivial-template-tag.js';
11
11
  import MarkdownCode from './code.js';
12
12
  import MarkdownLink from './link.js';
13
13
  import MarkdownHeading from './heading.js';
14
+ import 'core-js/modules/es.string.replace.js';
14
15
  import '../code/code.js';
15
16
  import 'highlight.js/lib/core';
16
17
  import '../global/memoize.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "5.0.5",
3
+ "version": "5.0.6",
4
4
  "description": "JetBrains UI library",
5
5
  "author": "JetBrains",
6
6
  "license": "Apache-2.0",
@@ -253,5 +253,5 @@
253
253
  "node": ">=7.4",
254
254
  "npm": ">=6.0.0"
255
255
  },
256
- "gitHead": "af4f39149cf347f8823cca419680fd9b18437a1f"
256
+ "gitHead": "4b577abfab1d2bdfb299324d52b9e65117c8aa43"
257
257
  }