File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Expand file tree Collapse file tree 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';
1919import { alertsService } from '../notifications' ;
2020import { Popover } from './PopOver.jsx' ;
2121import { SharePanel } from './SharePanel.jsx' ;
22+ import userService from '../services/user_service' ;
2223
2324const minCodeWrapSize = 33 ;
2425
@@ -775,6 +776,17 @@ export default class ContentWrap extends Component {
775776 }
776777 }
777778
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+
778790 toolboxUpdateToApp ( param ) {
779791 trackEvent ( 'ui' , 'code' , 'toolbox' ) ;
780792 const code = this . cm . js . getValue ( ) ;
@@ -863,7 +875,7 @@ export default class ContentWrap extends Component {
863875 { /* Inlet(scope.cm.js); */ }
864876 </ div >
865877 </ div >
866- < div label = "CSS" >
878+ < div label = "CSS" onBeforeActiviation = { this . onCSSActiviation . bind ( this ) } >
867879 < div
868880 data-code-wrap-id = "1"
869881 id = "cssCodeEl"
Original file line number Diff line number Diff line change @@ -18,6 +18,14 @@ class Tabs extends Component {
1818 } ;
1919 } ;
2020 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+
2129 await this . setState ( { activeTab : tab } ) ;
2230 this . props . onChange ( tab ) ;
2331 } ;
Original file line number Diff line number Diff line change @@ -1433,6 +1433,7 @@ BookLibService.Borrow(id) {
14331433 prefs = { this . state . prefs }
14341434 onEditorFocus = { this . editorFocusHandler . bind ( this ) }
14351435 onSplitUpdate = { this . splitUpdateHandler . bind ( this ) }
1436+ onProFeature = { this . proBtnClickHandler . bind ( this ) }
14361437 />
14371438 { this . isEmbed ? null : (
14381439 < Footer
You can’t perform that action at this time.
0 commit comments