diff --git a/css/jgrowl.css b/css/jgrowl.css index e3d253b3..c1aa4f75 100644 --- a/css/jgrowl.css +++ b/css/jgrowl.css @@ -60,7 +60,7 @@ div.jGrowl div.jGrowl-notification, div.jGrowl div.jGrowl-closer { } div.jGrowl div.jGrowl-notification { - min-height: 40px; + min-height: 70px; } div.jGrowl div.jGrowl-notification, diff --git a/js/core.js b/js/core.js index a0f4f84d..cf9eac53 100644 --- a/js/core.js +++ b/js/core.js @@ -157,8 +157,21 @@ define([ } } - // Create the layout + // Set the panels visibility var layout = undefined; + var menuPanelElt = undefined; + var documentPanelElt = undefined; + function setPanelVisibility(forceHide) { + if(forceHide === true || layout.state.north.isClosed) { + menuPanelElt.hide(); + documentPanelElt.hide(); + } else { + menuPanelElt.show(); + documentPanelElt.show(); + } + } + + // Create the layout function createLayout() { if(viewerMode === true) { return; @@ -175,7 +188,15 @@ define([ togglerLength_closed: 90, stateManagement__enabled: false, center__minWidth: 200, - center__minHeight: 200 + center__minHeight: 200, + onopen: function() { + setPanelVisibility(); + }, + onclose_start: function(paneName) { + if(paneName == 'north') { + setPanelVisibility(true); + } + }, }; eventMgr.onLayoutConfigure(layoutGlobalConfig); if(settings.layoutOrientation == "horizontal") { @@ -202,6 +223,7 @@ define([ $(".ui-layout-toggler-north").addClass("btn btn-info").append($("").addClass("caret")); $(".ui-layout-toggler-south").addClass("btn btn-info").append($("").addClass("caret")); $(".ui-layout-toggler-east").addClass("btn btn-info").append($("").addClass("caret")); + setPanelVisibility(); eventMgr.onLayoutCreated(layout); } @@ -391,7 +413,7 @@ define([ e.stopPropagation(); }); - var menuPanelElt = $('.menu-panel'); + menuPanelElt = $('.menu-panel'); var isMenuPanelShown = false; menuPanelElt.on('shown.bs.collapse', function() { isMenuPanelShown = true; @@ -406,7 +428,7 @@ define([ }); }); - var documentPanelElt = $('.document-panel'); + documentPanelElt = $('.document-panel'); var isDocumentPanelShown = false; documentPanelElt.on('shown.bs.collapse', function() { isDocumentPanelShown = true; diff --git a/js/extensions/documentSelector.js b/js/extensions/documentSelector.js index 5622d71c..1b23ce95 100644 --- a/js/extensions/documentSelector.js +++ b/js/extensions/documentSelector.js @@ -59,9 +59,14 @@ define([ } liMap = {}; - $(".file-selector li:not(.stick)").empty(); + var fileSelectorElt = $(".file-selector"); + fileSelectorElt.empty(); + var documentPanelSelectorElt = $(".document-panel > .panel-content > .list-group"); + documentPanelSelectorElt.empty(); _.chain(fileSystem).sortBy(sortFunction).each(function(fileDesc) { - var a = $('').html(composeTitle(fileDesc)).click(function() { + var a = $('').html(composeTitle(fileDesc)); + var documentPanelItemElt = a.clone().addClass('list-group-item'); + documentPanelItemElt.add(a).click(function() { if(!liMap[fileDesc.fileIndex].is(".disabled")) { fileMgr.selectFile(fileDesc); } @@ -73,8 +78,10 @@ define([ liMap[fileDesc.fileIndex] = li; if(fileDesc === selectFileDesc) { li.addClass("disabled"); + documentPanelItemElt.addClass("active"); } - $(".file-selector").append(li); + fileSelectorElt.append(li); + documentPanelSelectorElt.append(documentPanelItemElt); }); liArray = _.values(liMap); }; @@ -94,7 +101,7 @@ define([ // Filter for search input in file selector function filterFileSelector(filter) { - var liList = $(".file-selector li:not(.stick)"); + var liList = $(".file-selector > li"); liList.show(); if(filter) { var words = filter.toLowerCase().split(/\s+/); diff --git a/js/extensions/documentTitle.js b/js/extensions/documentTitle.js index 1b6d9c1a..c0a962f3 100644 --- a/js/extensions/documentTitle.js +++ b/js/extensions/documentTitle.js @@ -38,9 +38,9 @@ define([ var title = fileDesc.title; document.title = "StackEdit - " + title; - $("#file-title").html(composeTitle(fileDesc)); + $(".file-title-navbar").html(composeTitle(fileDesc)); $(".file-title").text(title); - $("#file-title-input").val(title); + $(".input-file-title").val(title); if(layout !== undefined) { // Use defer to make sure UI has been updated diff --git a/js/fileMgr.js b/js/fileMgr.js index 7b116661..14c48ce1 100644 --- a/js/fileMgr.js +++ b/js/fileMgr.js @@ -154,6 +154,8 @@ define([ fileMgr.selectFile(); + var fileTitleElt = $('.file-title-navbar'); + var fileTitleInputElt = $(".input-file-title"); $(".action-create-file").click(function() { var fileDesc = fileMgr.createFile(); fileMgr.selectFile(fileDesc); @@ -161,42 +163,42 @@ define([ if(wmdInput.setSelectionRange) { wmdInput.setSelectionRange(0, 0); } - $("#file-title").click(); + fileTitleElt.click(); }); $(".action-remove-file").click(function() { fileMgr.deleteFile(); }); - $("#file-title").click(function() { + fileTitleElt.click(function() { if(viewerMode === true) { return; } - $(this).hide(); - var fileTitleInput = $("#file-title-input").show(); + fileTitleElt.addClass('hide'); + var fileTitleInput = fileTitleInputElt.removeClass('hide'); _.defer(function() { fileTitleInput.focus().get(0).select(); }); }); - function applyTitle(input) { - input.hide(); - $("#file-title").show(); - var title = $.trim(input.val()); + function applyTitle() { + fileTitleInputElt.addClass('hide'); + fileTitleElt.removeClass('hide'); + var title = $.trim(fileTitleInputElt.val()); var fileDesc = fileMgr.currentFile; if(title && title != fileDesc.title) { fileDesc.title = title; eventMgr.onTitleChanged(fileDesc); } - input.val(fileDesc.title); + fileTitleInputElt.val(fileDesc.title); $("#wmd-input").focus(); } - $("#file-title-input").blur(function() { - applyTitle($(this)); + fileTitleInputElt.blur(function() { + applyTitle(); }).keyup(function(e) { if(e.keyCode == 13) { - applyTitle($(this)); + applyTitle(); } if(e.keyCode == 27) { - $(this).val(""); - applyTitle($(this)); + fileTitleInputElt.val(""); + applyTitle(); } }); $(".action-open-stackedit").click(function() { diff --git a/js/html/bodyIndex.html b/js/html/bodyIndex.html index 998587ed..c536c065 100644 --- a/js/html/bodyIndex.html +++ b/js/html/bodyIndex.html @@ -28,11 +28,13 @@ + @@ -41,20 +43,23 @@
- -