PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.1
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.1
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
learnpress / assets / src / apps / js / blocks / course-elements / course-instructor / edit.js

edit.js in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.4.1, at assets/src/apps/js/blocks/course-elements/course-instructor/edit.js

70 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { __ } from '@wordpress/i18n';
2 import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
3 import { PanelBody, ToggleControl } from '@wordpress/components';
4
5 export const edit = ( props ) => {
6 const blockProps = useBlockProps();
7 const { attributes, setAttributes, context } = props;
8 const { lpCourseData } = context;
9 const courseInstructor = lpCourseData?.instructor || '<strong>Instructor</strong>';
10 return (
11 <>
12 <InspectorControls>
13 <PanelBody title={ __( 'Settings', 'learnpress' ) }>
14 <ToggleControl
15 label={ __( "Show text 'by'", 'learnpress' ) }
16 checked={ props.attributes.showText ? true : false }
17 onChange={ ( value ) => {
18 props.setAttributes( {
19 showText: value ? true : false,
20 } );
21 } }
22 />
23 <ToggleControl
24 label={ __( 'Make the instructor a link', 'learnpress' ) }
25 checked={ props.attributes.isLink ? true : false }
26 onChange={ ( value ) => {
27 props.setAttributes( {
28 isLink: value ? true : false,
29 } );
30 } }
31 />
32 { props.attributes.isLink ? (
33 <ToggleControl
34 label={ __( 'Open is new tab', 'learnpress' ) }
35 checked={ props.attributes.target ? true : false }
36 onChange={ ( value ) => {
37 props.setAttributes( {
38 target: value ? true : false,
39 } );
40 } }
41 />
42 ) : (
43 ''
44 ) }
45 </PanelBody>
46 </InspectorControls>
47 <div { ...blockProps }>
48 <div className="is-layout-flex c-gap-4">
49 <label>{ props.attributes.showText ? 'by ' : '' }</label>
50 <div className="course-instructor">
51 { props.attributes.isLink ? (
52 <a
53 dangerouslySetInnerHTML={ {
54 __html: courseInstructor,
55 } }
56 ></a>
57 ) : (
58 <div
59 dangerouslySetInnerHTML={ {
60 __html: courseInstructor,
61 } }
62 ></div>
63 ) }
64 </div>
65 </div>
66 </div>
67 </>
68 );
69 };
70