File tree 3 files changed +22
-1
lines changed
3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import codeService from '../services/code_service';
19
19
import { alertsService } from '../notifications' ;
20
20
import { Popover } from './PopOver.jsx' ;
21
21
import { SharePanel } from './SharePanel.jsx' ;
22
+ import userService from '../services/user_service' ;
22
23
23
24
const minCodeWrapSize = 33 ;
24
25
@@ -775,6 +776,17 @@ export default class ContentWrap extends Component {
775
776
}
776
777
}
777
778
779
+
780
+ onCSSActiviation ( ) {
781
+ if ( ! window . user ) {
782
+ this . props . onLogin ( ) ;
783
+ } else if ( userService . isPro ( ) ) {
784
+ return true ;
785
+ } else {
786
+ this . props . onProFeature ( ) ;
787
+ }
788
+ }
789
+
778
790
toolboxUpdateToApp ( param ) {
779
791
trackEvent ( 'ui' , 'code' , 'toolbox' ) ;
780
792
const code = this . cm . js . getValue ( ) ;
@@ -863,7 +875,7 @@ export default class ContentWrap extends Component {
863
875
{ /* Inlet(scope.cm.js); */ }
864
876
</ div >
865
877
</ div >
866
- < div label = "CSS" >
878
+ < div label = "CSS" onBeforeActiviation = { this . onCSSActiviation . bind ( this ) } >
867
879
< div
868
880
data-code-wrap-id = "1"
869
881
id = "cssCodeEl"
Original file line number Diff line number Diff line change @@ -18,6 +18,14 @@ class Tabs extends Component {
18
18
} ;
19
19
} ;
20
20
onClickTabItem = async ( tab ) => {
21
+ const child = this . props . children . find ( c => c . props . label === tab ) ;
22
+ if ( child && child . props . onBeforeActiviation ) {
23
+ const result = child . props . onBeforeActiviation ( ) ;
24
+ if ( ! result ) {
25
+ return ;
26
+ }
27
+ }
28
+
21
29
await this . setState ( { activeTab : tab } ) ;
22
30
this . props . onChange ( tab ) ;
23
31
} ;
Original file line number Diff line number Diff line change @@ -1433,6 +1433,7 @@ BookLibService.Borrow(id) {
1433
1433
prefs = { this . state . prefs }
1434
1434
onEditorFocus = { this . editorFocusHandler . bind ( this ) }
1435
1435
onSplitUpdate = { this . splitUpdateHandler . bind ( this ) }
1436
+ onProFeature = { this . proBtnClickHandler . bind ( this ) }
1436
1437
/>
1437
1438
{ this . isEmbed ? null : (
1438
1439
< Footer
You can’t perform that action at this time.
0 commit comments