@@ -13,8 +13,7 @@ define([
1313 templateLoader : "addon.editor.templates" ,
1414 template : "file.html" ,
1515 events : {
16- "click .action-file-fullscreen" : "toggleFullscreen" ,
17- "click a[data-editormode]" : "changeEditorMode"
16+
1817 } ,
1918
2019 // Constructor
@@ -24,18 +23,12 @@ define([
2423 // Build editor
2524 this . editor = new EditorView ( ) ;
2625
27- // Bind editor mode changements
28- this . editor . on ( "change:mode" , this . modeChanged , this ) ;
29-
3026 // Bind editor sync state changements
3127 this . editor . on ( "sync:state" , function ( state ) {
3228 this . $ ( ".action-editor-state" ) . toggleClass ( "btn-danger" , ! state ) ;
3329 this . $ ( ".action-editor-state" ) . toggleClass ( "btn-success" , state ) ;
3430 } , this ) ;
3531
36- // Bind collaborators changements
37- this . editor . sync . on ( "participants:change" , this . updateParticipants , this ) ;
38-
3932 // Define file for code editor
4033 this . editor . sync . setFile ( this . model , {
4134 'sync' : this . options . edition
@@ -59,42 +52,6 @@ define([
5952 this . updateParticipants ( ) ;
6053
6154 return FileEditorView . __super__ . finish . apply ( this , arguments ) ;
62- } ,
63-
64- // (action) Toggle fullscreen
65- toggleFullscreen : function ( e ) {
66- e . preventDefault ( ) ;
67- this . $el . toggleClass ( "mode-fullscreen" ) ;
68- } ,
69-
70- // (action) change editor mode
71- changeEditorMode : function ( e ) {
72- e . preventDefault ( ) ;
73- var mode = $ ( e . currentTarget ) . data ( "editormode" ) ;
74- this . editor . setMode ( mode ) ;
75- } ,
76-
77- // (event) Mode changed
78- modeChanged : function ( ) {
79- var mode = this . editor . getMode ( ) ;
80- this . $ ( "a[data-editormode!='" + mode + "']" ) . removeClass ( "active" ) ;
81- this . $ ( "a[data-editormode='" + mode + "']" ) . addClass ( "active" ) ;
82- } ,
83-
84- // Update participants list
85- updateParticipants : function ( ) {
86- var $participants = this . $ ( ".file-participants" ) . empty ( ) ;
87- _ . each ( this . editor . sync . participants , function ( participant ) {
88- $ ( "<a>" , {
89- 'text' : participant . user . get ( "name" ) ,
90- 'href' : "#" ,
91- 'class' : "list-group-item" ,
92- 'css' : {
93- 'border-left-color' : participant . color
94- } ,
95- 'click' : function ( e ) { e . preventDefault ( ) ; }
96- } ) . appendTo ( $participants ) ;
97- } , this ) ;
9855 }
9956 } ) ;
10057
0 commit comments