index.js
1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
* LearnDash Block ld-question-description
*
* @since 4.0.0
* @package LearnDash
*/
import { __, _x, sprintf} from "@wordpress/i18n";
import { registerBlockType } from "@wordpress/blocks";
import { InnerBlocks } from "@wordpress/block-editor";
import { MdAssignment } from "react-icons/md";
/**
* LearnDash block functions
*/
import { ldlms_get_custom_label } from "../../../ldlms.js";
const block_key = "learndash/ld-question-description";
const block_title = __( "Question Notes", "learndash" );
const block_description = sprintf(
// translators: placeholder: Write a description for the Challenge Exam question.
_x(
"Write a description for the %s question.",
"placeholder: Write a description for the Challenge Exam question",
"learndash"
),
ldlms_get_custom_label( "exam" )
);
registerBlockType( block_key, {
title: block_title,
description: block_description,
icon: <MdAssignment />,
parent: [ "learndash/ld-exam-question" ],
category: "learndash-blocks",
supports: {
inserter: false,
html: false
},
edit: () => {
const template = [ [ "core/paragraph", {
placeholder: __(
"Add a Description or type '/' to choose a block (Optional)",
"learndash"
)
} ] ];
return (
<InnerBlocks
templateLock={ false }
template={ template }
/>
);
},
save: () => <InnerBlocks.Content />
} );