Преглед на файлове

clean-up in ws-editor.js and re-enable panel resize

Benoît Hubert преди 8 години
родител
ревизия
481d0c1072
променени са 1 файла, в които са добавени 17 реда и са изтрити 61 реда
  1. 17 61
      js/ws-editor.js

+ 17 - 61
js/ws-editor.js

@@ -10,23 +10,20 @@ $(document).ready(function() {
   var $saveChanges   = $('#save-changes');
 
   var $revertEditor  = $('#revert-editor');
-  // var $panelLeft     = $('.panel-left');
+  var $panelLeft     = $('.panel-left');
   // var $panelRight    = $('.panel-right');
   // var $panelWrap     = $('.panel-container');
   var $tabItems      = $('#tabs li');
   var $detailsRepo   = $('#details-repo');
   var $detailsExmp   = $('#details-example');
-
   var $window        = $(window);
   var activeMode     = 'html';
 
-  // var currentHash; 
   var editor;
   var editorSession;
   var editorStorage = new LocalStorageDraft();
   // var saveTimeout1;
   // var saveTimeout2;
-  // var exampleList;
   var mapTypes = {
     html: 'html', js: 'javascript', css: 'css'
   }
@@ -46,13 +43,19 @@ $(document).ready(function() {
 
   });
 
-  // _ws.events.on('rendered:tabs', function() {
-  //   console.log('rebind editor tabs');
-  //   $tabItems = $('#tabs li');
-  //   bindEditorTabs();
-  // });
 
 
+  // /**
+  //  * Make the left panel resizable
+  //  */
+  $panelLeft.resizable({
+    handleSelector: ".splitter",
+    resizeHeight: false,
+    onDrag: function(e) {
+      $editor.width($panelLeft.width());
+    }
+  });
+
 
   function setDefaultEditorContent() {
     if(_ws.files.length > 0) {
@@ -86,6 +89,10 @@ $(document).ready(function() {
     // setActiveTab(mode);
   }
 
+
+  initEditor();
+
+
   _ws.makeView('tabs', {
     events: {
       'click li': onTabClicked
@@ -108,16 +115,6 @@ $(document).ready(function() {
       );
     }
   });
-      
-
-  /**
-   * File list tabs click handler
-   */
-  // function bindEditorTabs() {
-  //   $tabItems.click(onTabClicked);
-  // }
-
-  // bindEditorTabs();
 
 
   // /**
@@ -216,25 +213,7 @@ $(document).ready(function() {
   // }
 
 
-  // /**
-  //  * Build select option string
-  //  */
-  // function makeFileSelectOption(item) {
-  //   return '<option value="' + item.slug + '">' +
-  //       item.title +
-  //     '</option>'
-  // }
-
 
-  // /**
-  //  * Populate file selector from JSON list content
-  //  */
-  // function resetFileSelect(exampleList) {
-  //   $fileSelect.html(
-  //     '<option value="-">&mdash;</option>' +
-  //     exampleList.map(makeFileSelectOption)
-  //   );
-  // }
 
   // function loadExampleList() {
   //   rp.get('/list/jquery', 'json')
@@ -273,10 +252,6 @@ $(document).ready(function() {
   // }
 
 
-  // function navigateTo(path) {
-  //   history.pushState({}, 'pouet', path)
-  // }
-
   // function revertEditor() {
   //   editorStorage.reset();
   //   location.reload();
@@ -294,8 +269,6 @@ $(document).ready(function() {
   //   });
   // }
 
-  // setCurrentHash();
-
   // $fileSelect.change(function() {
   //   loadExample($(this).val());
   // });
@@ -304,33 +277,16 @@ $(document).ready(function() {
   // $.get('/menu', menu => $('#site-menu').html(menu), 'html');
   // loadExampleList();
 
-  initEditor();
-
 });
 
 
 
+
   // var $editorJs      = $('#editor-javascript');
   // var $editorHtml    = $('#editor-html');
   // var $editorCss     = $('#editor-css');
-
   // var $htmlContent   = $('#html-content');  // replaced by iframe
-
-
   // var $selectorNav   = $('#selector');
-  // var $fileSelect    = $('#file-select');
-
-
-  // /**
-  //  * Make the left panel resizable
-  //  */
-  // $panelLeft.resizable({
-  //   handleSelector: ".splitter",
-  //   resizeHeight: false,
-  //   onDrag: function(e) {
-  //     $editor.width($panelLeft.width());
-  //   }
-  // });
 
 
   // /**