@@ -21,12 +21,12 @@ import { __ } from '@wordpress/i18n';
2121
2222/* global mkaz_code_syntax_languages, mkaz_code_syntax_default_lang, Prism */
2323
24- const edit = ( { attributes, className, setAttributes } ) => {
24+ const Edit = ( { attributes, className, setAttributes } ) => {
2525 useEffect ( ( ) => {
26- if ( ! attributes . language && mkaz_code_syntax_default_lang ) {
27- setAttributes ( { language : mkaz_code_syntax_default_lang } ) ;
26+ if ( ! attributes . datalang && mkaz_code_syntax_default_lang ) {
27+ setAttributes ( { datalang : mkaz_code_syntax_default_lang } ) ;
2828 }
29- } , [ attributes . language ] ) ;
29+ } , [ attributes . datalang ] ) ;
3030
3131 // Onload fetch color scheme option
3232 useEffect ( ( ) => {
@@ -61,7 +61,7 @@ const edit = ( { attributes, className, setAttributes } ) => {
6161 ] ;
6262
6363 const updateColorScheme = ( colorScheme ) => {
64- let path = '/mkaz/code-syntax/v1/set/color-scheme/' + colorScheme ;
64+ const path = '/mkaz/code-syntax/v1/set/color-scheme/' + colorScheme ;
6565 apiFetch ( { path } )
6666 . then ( ( ) => {
6767 setAttributes ( { colorScheme } ) ;
@@ -71,10 +71,6 @@ const edit = ( { attributes, className, setAttributes } ) => {
7171 } ) ;
7272 } ;
7373
74- let cls = '' ;
75- cls = attributes . language ? 'language-' + attributes . language : '' ;
76- cls = attributes . lineNumbers ? cls + ' line-numbers' : cls ;
77-
7874 // shared props for text areas
7975 const textAreaProps = {
8076 value : attributes . content || '' ,
@@ -96,7 +92,7 @@ const edit = ( { attributes, className, setAttributes } ) => {
9692 < PanelBody title = { __ ( 'Settings' ) } >
9793 < SelectControl
9894 label = { __ ( 'Language' ) }
99- value = { attributes . language }
95+ value = { attributes . datalang }
10096 options = { [
10197 {
10298 label : __ (
@@ -113,8 +109,8 @@ const edit = ( { attributes, className, setAttributes } ) => {
113109 } )
114110 )
115111 ) }
116- onChange = { ( language ) =>
117- setAttributes ( { language } )
112+ onChange = { ( datalang ) =>
113+ setAttributes ( { datalang } )
118114 }
119115 />
120116 < ToggleControl
@@ -204,11 +200,11 @@ const edit = ( { attributes, className, setAttributes } ) => {
204200
205201 { /* Language label, uses wp-block class to keep within editor bounds */ }
206202 < div className = "wp-block mkaz-code-syntax-block__lang_label" >
207- { mkaz_code_syntax_languages [ attributes . language ] }
203+ { mkaz_code_syntax_languages [ attributes . datalang ] }
208204 </ div >
209205 </ >
210206 </ >
211207 ) ;
212208} ;
213209
214- export default edit ;
210+ export default Edit ;
0 commit comments