PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.4.1
Block Animations, Motion & Scroll Effects – Ghost Kit v3.4.1
3.7.2 3.7.1 3.7.0 3.6.1 trunk 1.6.3 2.25.0 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.5.0 3.5.1 3.6.0
ghostkit / gutenberg / blocks / markdown / render.js

render.js in Block Animations, Motion & Scroll Effects – Ghost Kit 3.4.1, at gutenberg/blocks/markdown/render.js

42 lines 750 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import MarkdownIt from 'markdown-it';
2
3 import { RawHTML } from '@wordpress/element';
4 import { __ } from '@wordpress/i18n';
5
6 /**
7 * Module variables
8 */
9 const markdownConverter = new MarkdownIt();
10
11 /**
12 * MDRender Class.
13 *
14 * @param props
15 */
16 export default function MDRender(props) {
17 const { content, ...restProps } = props;
18
19 return (
20 <RawHTML
21 onClick={(e) => {
22 if (e.target.nodeName === 'A') {
23 if (
24 // eslint-disable-next-line no-alert
25 !window.confirm(
26 __(
27 'Are you sure you wish to leave this page?',
28 'ghostkit'
29 )
30 )
31 ) {
32 e.preventDefault();
33 }
34 }
35 }}
36 {...restProps}
37 >
38 {content && content.length ? markdownConverter.render(content) : ''}
39 </RawHTML>
40 );
41 }
42