Upgrade to Bootstrap 3

This commit is contained in:
benweet 2013-08-22 02:19:59 +02:00
parent 5d06c75e23
commit 109bce8e28
30 changed files with 267 additions and 432 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -13,11 +13,11 @@
height="200" height="200"
id="svg2" id="svg2"
version="1.1" version="1.1"
inkscape:version="0.48.4 r9939" inkscape:version="0.48.2 r9819"
sodipodi:docname="stackedit-promo.svg" sodipodi:docname="stackedit-promo.svg"
inkscape:export-filename="C:\Documents and Settings\g550003\Mes documents\Mes images\stackedit-promo.png" inkscape:export-filename="/Users/g550003/workspace/stackedit/img/stackedit-promo.png"
inkscape:export-xdpi="27" inkscape:export-xdpi="54"
inkscape:export-ydpi="27"> inkscape:export-ydpi="54">
<defs <defs
id="defs4" /> id="defs4" />
<sodipodi:namedview <sodipodi:namedview
@ -28,15 +28,15 @@
inkscape:pageopacity="0.0" inkscape:pageopacity="0.0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:zoom="0.70710678" inkscape:zoom="0.70710678"
inkscape:cx="615.19651" inkscape:cx="681.08785"
inkscape:cy="-117.83362" inkscape:cy="-71.421139"
inkscape:document-units="px" inkscape:document-units="px"
inkscape:current-layer="layer1" inkscape:current-layer="layer1"
showgrid="false" showgrid="false"
inkscape:window-width="1920" inkscape:window-width="1680"
inkscape:window-height="1143" inkscape:window-height="918"
inkscape:window-x="-4" inkscape:window-x="0"
inkscape:window-y="-4" inkscape:window-y="0"
inkscape:window-maximized="1"> inkscape:window-maximized="1">
<inkscape:grid <inkscape:grid
type="xygrid" type="xygrid"
@ -78,7 +78,7 @@
id="tspan2995">edit</tspan></tspan></text> id="tspan2995">edit</tspan></tspan></text>
<g <g
id="g3013" id="g3013"
transform="matrix(5.1237266,0,0,5.1237266,-369.65277,-4165.4739)"> transform="matrix(5.4895348,0,0,5.4895348,-409.28558,-4529.9871)">
<path <path
sodipodi:nodetypes="cccc" sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0" inkscape:connector-curvature="0"

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -162,27 +162,27 @@ define([
// Set the panels visibility // Set the panels visibility
var layout = undefined; var layout = undefined;
var menuPanelElt = undefined; var $menuPanelElt = undefined;
var documentPanelElt = undefined; var $documentPanelElt = undefined;
function setPanelVisibility(forceHide) { function setPanelVisibility(forceHide) {
if(forceHide === true || layout.state.north.isClosed) { if(forceHide === true || layout.state.north.isClosed) {
menuPanelElt.hide(); $menuPanelElt.hide();
documentPanelElt.hide(); $documentPanelElt.hide();
} }
else { else {
menuPanelElt.show(); $menuPanelElt.show();
documentPanelElt.show(); $documentPanelElt.show();
} }
} }
// Set the preview button visibility // Set the preview button visibility
var previewButtonsElt = undefined; var $previewButtonsElt = undefined;
function setPreviewButtonsVisibility(forceHide) { function setPreviewButtonsVisibility(forceHide) {
if(forceHide === true || layout.state.east.isClosed) { if(forceHide === true || layout.state.east.isClosed) {
previewButtonsElt.hide(); $previewButtonsElt.hide();
} }
else { else {
previewButtonsElt.show(); $previewButtonsElt.show();
} }
} }
@ -241,19 +241,19 @@ define([
}); });
$(".ui-layout-toggler-south").addClass("btn btn-info").html('<i class="icon-none"></i>'); $(".ui-layout-toggler-south").addClass("btn btn-info").html('<i class="icon-none"></i>');
$(".ui-layout-toggler-east").addClass("btn btn-info").html('<i class="icon-none"></i>'); $(".ui-layout-toggler-east").addClass("btn btn-info").html('<i class="icon-none"></i>');
var northTogglerElt = $(".ui-layout-toggler-north").addClass("btn btn-info").html('<i class="icon-none"></i>'); var $northTogglerElt = $(".ui-layout-toggler-north").addClass("btn btn-info").html('<i class="icon-none"></i>');
// We attach the preview buttons to the UI layout resizer in order to // We attach the preview buttons to the UI layout resizer in order to
// have fixed position // have fixed position
// We also move the north toggler to the east or south resizer as the // We also move the north toggler to the east or south resizer as the
// north resizer is very small // north resizer is very small
previewButtonsElt = $('<div class="extension-preview-buttons">'); $previewButtonsElt = $('<div class="extension-preview-buttons">');
if(settings.layoutOrientation == "horizontal") { if(settings.layoutOrientation == "horizontal") {
$('.ui-layout-resizer-north').append(previewButtonsElt); $('.ui-layout-resizer-north').append($previewButtonsElt);
$('.ui-layout-resizer-east').append(northTogglerElt); $('.ui-layout-resizer-east').append($northTogglerElt);
} }
else { else {
$('.ui-layout-resizer-south').append(previewButtonsElt).append(northTogglerElt); $('.ui-layout-resizer-south').append($previewButtonsElt).append($northTogglerElt);
} }
setPanelVisibility(); setPanelVisibility();
@ -282,7 +282,7 @@ define([
editor.refreshPreview(); editor.refreshPreview();
return; return;
} }
var previewContainerElt = $(".preview-container"); var $previewContainerElt = $(".preview-container");
// Store editor scrollTop on scroll event // Store editor scrollTop on scroll event
$editorElt.scroll(function() { $editorElt.scroll(function() {
@ -298,7 +298,7 @@ define([
} }
}); });
// Store preview scrollTop on scroll event // Store preview scrollTop on scroll event
previewContainerElt.scroll(function() { $previewContainerElt.scroll(function() {
if(documentContent !== undefined) { if(documentContent !== undefined) {
fileDesc.previewScrollTop = $(this).scrollTop(); fileDesc.previewScrollTop = $(this).scrollTop();
} }
@ -306,7 +306,7 @@ define([
// Create the converter and the editor // Create the converter and the editor
var converter = new Markdown.Converter(); var converter = new Markdown.Converter();
// Create MD sections for extensions // Parse MD sections for extensions
converter.hooks.chain("preConversion", function(text) { converter.hooks.chain("preConversion", function(text) {
eventMgr.previewStartTime = new Date(); eventMgr.previewStartTime = new Date();
var tmpText = text + "\n\n"; var tmpText = text + "\n\n";
@ -362,7 +362,7 @@ define([
if(documentContent === undefined) { if(documentContent === undefined) {
makePreview(); makePreview();
$editorElt.scrollTop(fileDesc.editorScrollTop); $editorElt.scrollTop(fileDesc.editorScrollTop);
previewContainerElt.scrollTop(fileDesc.previewScrollTop); $previewContainerElt.scrollTop(fileDesc.previewScrollTop);
} }
else { else {
debouncedMakePreview(); debouncedMakePreview();
@ -376,7 +376,7 @@ define([
return function() { return function() {
makePreview(); makePreview();
if(documentContent === undefined) { if(documentContent === undefined) {
previewContainerElt.scrollTop(fileDesc.previewScrollTop); $previewContainerElt.scrollTop(fileDesc.previewScrollTop);
} }
checkDocumentChanges(); checkDocumentChanges();
}; };
@ -391,22 +391,22 @@ define([
$(".wmd-button-row li").addClass("btn btn-success").css("left", 0).find("span").hide(); $(".wmd-button-row li").addClass("btn btn-success").css("left", 0).find("span").hide();
// Add customized buttons // Add customized buttons
var btnGroupElt = $('.wmd-button-group1'); var $btnGroupElt = $('.wmd-button-group1');
$("#wmd-bold-button").append($('<i class="icon-bold">')).appendTo(btnGroupElt); $("#wmd-bold-button").append($('<i class="icon-bold">')).appendTo($btnGroupElt);
$("#wmd-italic-button").append($('<i class="icon-italic">')).appendTo(btnGroupElt); $("#wmd-italic-button").append($('<i class="icon-italic">')).appendTo($btnGroupElt);
var btnGroupElt = $('.wmd-button-group2'); var $btnGroupElt = $('.wmd-button-group2');
$("#wmd-link-button").append($('<i class="icon-globe">')).appendTo(btnGroupElt); $("#wmd-link-button").append($('<i class="icon-globe">')).appendTo($btnGroupElt);
$("#wmd-quote-button").append($('<i class="icon-indent-right">')).appendTo(btnGroupElt); $("#wmd-quote-button").append($('<i class="icon-indent-right">')).appendTo($btnGroupElt);
$("#wmd-code-button").append($('<i class="icon-code">')).appendTo(btnGroupElt); $("#wmd-code-button").append($('<i class="icon-code">')).appendTo($btnGroupElt);
$("#wmd-image-button").append($('<i class="icon-picture">')).appendTo(btnGroupElt); $("#wmd-image-button").append($('<i class="icon-picture">')).appendTo($btnGroupElt);
var btnGroupElt = $('.wmd-button-group3'); var $btnGroupElt = $('.wmd-button-group3');
$("#wmd-olist-button").append($('<i class="icon-list-numbered">')).appendTo(btnGroupElt); $("#wmd-olist-button").append($('<i class="icon-list-numbered">')).appendTo($btnGroupElt);
$("#wmd-ulist-button").append($('<i class="icon-list-bullet">')).appendTo(btnGroupElt); $("#wmd-ulist-button").append($('<i class="icon-list-bullet">')).appendTo($btnGroupElt);
$("#wmd-heading-button").append($('<i class="icon-text-height">')).appendTo(btnGroupElt); $("#wmd-heading-button").append($('<i class="icon-text-height">')).appendTo($btnGroupElt);
$("#wmd-hr-button").append($('<i class="icon-ellipsis">')).appendTo(btnGroupElt); $("#wmd-hr-button").append($('<i class="icon-ellipsis">')).appendTo($btnGroupElt);
var btnGroupElt = $('.wmd-button-group4'); var $btnGroupElt = $('.wmd-button-group4');
$("#wmd-undo-button").append($('<i class="icon-reply">')).appendTo(btnGroupElt); $("#wmd-undo-button").append($('<i class="icon-reply">')).appendTo($btnGroupElt);
$("#wmd-redo-button").append($('<i class="icon-forward">')).appendTo(btnGroupElt); $("#wmd-redo-button").append($('<i class="icon-forward">')).appendTo($btnGroupElt);
eventMgr.onFileOpen(fileDesc); eventMgr.onFileOpen(fileDesc);
}; };
@ -431,10 +431,10 @@ define([
var isMenuPanelShown = false; var isMenuPanelShown = false;
core.onReady = function() { core.onReady = function() {
if(viewerMode === true) { if(viewerMode === true) {
$('body').html(bodyViewerHTML); document.body.innerHTML = bodyViewerHTML;
} }
else { else {
$('body').html(bodyIndexHTML); document.body.innerHTML = bodyIndexHTML;
} }
// listen to online/offline events // listen to online/offline events
@ -452,57 +452,57 @@ define([
e.stopPropagation(); e.stopPropagation();
}); });
menuPanelElt = $('.menu-panel').collapse({ $menuPanelElt = $('.menu-panel').collapse({
toggle: false toggle: false
}); });
var menuPanelBackdropElt = undefined; var menuPanelBackdropElt = undefined;
menuPanelElt.on('show.bs.collapse', function(e) { $menuPanelElt.on('show.bs.collapse', function(e) {
if(e.target === menuPanelElt[0]) { if(e.target === $menuPanelElt[0]) {
isMenuPanelShown = true; isMenuPanelShown = true;
menuPanelBackdropElt = utils.createBackdrop('collapse', '.menu-panel'); menuPanelBackdropElt = utils.createBackdrop('collapse', '.menu-panel');
menuPanelElt.addClass('move-to-front'); $menuPanelElt.addClass('move-to-front');
} }
else { else {
// Close all open sub-menus when one submenu opens // Close all open sub-menus when one submenu opens
menuPanelElt.find('.in').collapse('hide'); $menuPanelElt.find('.in').collapse('hide');
} }
}).on('hide.bs.collapse', function(e) { }).on('hide.bs.collapse', function(e) {
if(e.target === menuPanelElt[0]) { if(e.target === $menuPanelElt[0]) {
isMenuPanelShown = false; isMenuPanelShown = false;
menuPanelBackdropElt.remove(); menuPanelBackdropElt.remove();
menuPanelElt.removeClass('move-to-front'); $menuPanelElt.removeClass('move-to-front');
} }
}).on('hidden.bs.collapse', function(e) { }).on('hidden.bs.collapse', function(e) {
if(e.target === menuPanelElt[0]) { if(e.target === $menuPanelElt[0]) {
// Close all open sub-menus when menu panel is closed // Close all open sub-menus when menu panel is closed
menuPanelElt.find('.in').collapse('hide'); $menuPanelElt.find('.in').collapse('hide');
} }
}); });
documentPanelElt = $('.document-panel').collapse({ $documentPanelElt = $('.document-panel').collapse({
toggle: false toggle: false
}); });
var documentPanelBackdropElt = undefined; var documentPanelBackdropElt = undefined;
documentPanelElt.on('show.bs.collapse', function(e) { $documentPanelElt.on('show.bs.collapse', function(e) {
if(e.target === documentPanelElt[0]) { if(e.target === $documentPanelElt[0]) {
isDocumentPanelShown = true; isDocumentPanelShown = true;
documentPanelBackdropElt = utils.createBackdrop('collapse', '.document-panel'); documentPanelBackdropElt = utils.createBackdrop('collapse', '.document-panel');
documentPanelElt.addClass('move-to-front'); $documentPanelElt.addClass('move-to-front');
} }
else { else {
// Close all open sub-menus when one submenu opens // Close all open sub-menus when one submenu opens
documentPanelElt.find('.in').collapse('hide'); $documentPanelElt.find('.in').collapse('hide');
} }
}).on('hide.bs.collapse', function(e) { }).on('hide.bs.collapse', function(e) {
if(e.target === documentPanelElt[0]) { if(e.target === $documentPanelElt[0]) {
isDocumentPanelShown = false; isDocumentPanelShown = false;
documentPanelBackdropElt.remove(); documentPanelBackdropElt.remove();
documentPanelElt.removeClass('move-to-front'); $documentPanelElt.removeClass('move-to-front');
} }
}).on('hidden.bs.collapse', function(e) { }).on('hidden.bs.collapse', function(e) {
if(e.target === documentPanelElt[0]) { if(e.target === $documentPanelElt[0]) {
// Close all open sub-menus when menu panel is closed // Close all open sub-menus when menu panel is closed
documentPanelElt.find('.in').collapse('hide'); $documentPanelElt.find('.in').collapse('hide');
} }
}); });
@ -549,8 +549,8 @@ define([
var isModalShown = false; var isModalShown = false;
$('.modal').on('show.bs.modal', function() { $('.modal').on('show.bs.modal', function() {
// Close panel if open // Close panel if open
menuPanelElt.collapse('hide'); $menuPanelElt.collapse('hide');
documentPanelElt.collapse('hide'); $documentPanelElt.collapse('hide');
isModalShown = true; isModalShown = true;
}).on('shown.bs.modal', function() { }).on('shown.bs.modal', function() {
// Focus on the first input when modal opens // Focus on the first input when modal opens

View File

@ -8,6 +8,7 @@ define([
"text!html/settingsExtensionsAccordion.html", "text!html/settingsExtensionsAccordion.html",
"extensions/partialRendering", "extensions/partialRendering",
"extensions/userCustom", "extensions/userCustom",
"extensions/buttonMarkdownSyntax",
"extensions/googleAnalytics", "extensions/googleAnalytics",
"extensions/dialogAbout", "extensions/dialogAbout",
"extensions/dialogManagePublication", "extensions/dialogManagePublication",
@ -29,7 +30,6 @@ define([
"extensions/buttonShare", "extensions/buttonShare",
"extensions/buttonStat", "extensions/buttonStat",
"extensions/buttonHtmlCode", "extensions/buttonHtmlCode",
"extensions/buttonMarkdownSyntax",
"extensions/buttonViewer", "extensions/buttonViewer",
"libs/bootstrap/bootstrap", "libs/bootstrap/bootstrap",
"libs/jquery.waitforimages" "libs/jquery.waitforimages"
@ -177,7 +177,7 @@ define([
// The number of times we expect tryFinished to be called // The number of times we expect tryFinished to be called
var nbAsyncPreviewListener = onAsyncPreviewListenerList.length + 1; var nbAsyncPreviewListener = onAsyncPreviewListenerList.length + 1;
var previewContentsElt = undefined; var previewContentsElt = undefined;
var previewContentsJQElt = undefined; var $previewContentsElt = undefined;
eventMgr["onAsyncPreview"] = function() { eventMgr["onAsyncPreview"] = function() {
logger.log("onAsyncPreview"); logger.log("onAsyncPreview");
logger.log("Conversion time: " + (new Date() - eventMgr.previewStartTime)); logger.log("Conversion time: " + (new Date() - eventMgr.previewStartTime));
@ -196,7 +196,7 @@ define([
} }
} }
// We assume images are loading in the preview // We assume images are loading in the preview
previewContentsJQElt.waitForImages(tryFinished); $previewContentsElt.waitForImages(tryFinished);
_.each(onAsyncPreviewListenerList, function(asyncPreviewListener) { _.each(onAsyncPreviewListenerList, function(asyncPreviewListener) {
asyncPreviewListener(tryFinished); asyncPreviewListener(tryFinished);
}); });
@ -205,7 +205,7 @@ define([
var onReady = createEventHook("onReady"); var onReady = createEventHook("onReady");
eventMgr["onReady"] = function() { eventMgr["onReady"] = function() {
previewContentsElt = document.getElementById('preview-contents'); previewContentsElt = document.getElementById('preview-contents');
previewContentsJQElt = $(previewContentsElt); $previewContentsElt = $(previewContentsElt);
if(viewerMode === false) { if(viewerMode === false) {
// Create accordion in settings dialog // Create accordion in settings dialog
@ -256,13 +256,13 @@ define([
previewButtonsElt.appendChild(extensionPreviewButtonsFragment); previewButtonsElt.appendChild(extensionPreviewButtonsFragment);
// A bit of jQuery... // A bit of jQuery...
previewButtonsElt = $(previewButtonsElt); var $previewButtonsElt = $(previewButtonsElt);
var previewButtonsWidth = previewButtonsElt.width(); var previewButtonsWidth = $previewButtonsElt.width();
previewButtonsElt.find('.btn-group').each(function() { $previewButtonsElt.find('.btn-group').each(function() {
var btnGroupElt = $(this); var $btnGroupElt = $(this);
// Align dropdown to the left of the screen // Align dropdown to the left of the screen
btnGroupElt.find('.dropdown-menu').css({ $btnGroupElt.find('.dropdown-menu').css({
right: -previewButtonsWidth + btnGroupElt.width() + btnGroupElt.position().left right: -previewButtonsWidth + $btnGroupElt.width() + $btnGroupElt.position().left
}); });
}); });

View File

@ -58,7 +58,7 @@ define([
$("#input-html-code").each(function() { $("#input-html-code").each(function() {
if($(this).is(":hidden")) if($(this).is(":hidden"))
return; return;
$(this).get(0).select(); this.select();
}); });
}); });
}); });

View File

@ -34,8 +34,9 @@ define([
}; };
buttonPublish.onCreateButton = function() { buttonPublish.onCreateButton = function() {
button = $(buttonPublishHTML).click(function() { var $buttonPublishHTML = $(buttonPublishHTML);
if(!$(this).hasClass("disabled")) { button = $buttonPublishHTML.click(function() {
if(!$buttonPublishHTML.hasClass("disabled")) {
publisher.publish(); publisher.publish();
} }
}); });

View File

@ -6,7 +6,7 @@ define([
"text!html/buttonShareLocation.html", "text!html/buttonShareLocation.html",
], function($, _, Extension, buttonShareHTML, buttonShareLocationHTML) { ], function($, _, Extension, buttonShareHTML, buttonShareLocationHTML) {
var buttonShare = new Extension("buttonShare", 'Button "Share"', true); var buttonShare = new Extension("buttonShare", 'Button "Share"', true, true);
buttonShare.settingsBlock = '<p>Adds a "Share document" button in the navigation bar.</p>'; buttonShare.settingsBlock = '<p>Adds a "Share document" button in the navigation bar.</p>';
buttonShare.onCreateButton = function() { buttonShare.onCreateButton = function() {
@ -14,24 +14,23 @@ define([
}; };
var fileDesc = undefined; var fileDesc = undefined;
var linkListElt = undefined;
var $noLinkElt = undefined;
var refreshDocumentSharing = function(fileDescParameter) { var refreshDocumentSharing = function(fileDescParameter) {
if(fileDescParameter !== undefined && fileDescParameter !== fileDesc) { if(fileDescParameter !== undefined && fileDescParameter !== fileDesc) {
return; return;
} }
var linkList = $(".link-container .link-list").empty(); var linkListHtml = _.reduce(fileDesc.publishLocations, function(result, attributes) {
$(".link-container .no-link").show();
var attributesList = _.values(fileDesc.publishLocations);
_.each(attributesList, function(attributes) {
if(attributes.sharingLink) { if(attributes.sharingLink) {
var lineElement = $(_.template(buttonShareLocationHTML, { result += _.template(buttonShareLocationHTML, {
link: attributes.sharingLink link: attributes.sharingLink
})); });
linkList.append(lineElement);
$(".link-container .no-link").hide();
} }
}); return result;
}, '');
linkListElt.innerHTML = linkListHtml;
$noLinkElt.toggleClass('hide', linkListHtml.length !== 0);
}; };
buttonShare.onFileSelected = function(fileDescParameter) { buttonShare.onFileSelected = function(fileDescParameter) {
@ -41,6 +40,12 @@ define([
buttonShare.onNewPublishSuccess = refreshDocumentSharing; buttonShare.onNewPublishSuccess = refreshDocumentSharing;
buttonShare.onPublishRemoved = refreshDocumentSharing; buttonShare.onPublishRemoved = refreshDocumentSharing;
buttonShare.onReady = function() {
var linkContainerElt = document.querySelector('.link-container');
linkListElt = linkContainerElt.querySelector('.link-list');
$noLinkElt = $(linkContainerElt.querySelector('.no-link'));
};
return buttonShare; return buttonShare;

View File

@ -1,11 +1,11 @@
define([ define([
"jquery", "jquery",
"underscore", "underscore",
"crel",
"utils", "utils",
"classes/Extension", "classes/Extension",
"text!html/buttonSync.html",
"text!html/buttonSyncSettingsBlock.html", "text!html/buttonSyncSettingsBlock.html",
], function($, _, utils, Extension, buttonSyncHTML, buttonSyncSettingsBlockHTML) { ], function($, _, crel, utils, Extension, buttonSyncSettingsBlockHTML) {
var buttonSync = new Extension("buttonSync", 'Button "Synchronize"'); var buttonSync = new Extension("buttonSync", 'Button "Synchronize"');
buttonSync.settingsBlock = buttonSyncSettingsBlockHTML; buttonSync.settingsBlock = buttonSyncSettingsBlockHTML;
@ -26,19 +26,19 @@ define([
synchronizer = synchronizerParameter; synchronizer = synchronizerParameter;
}; };
var button = undefined; var $button = undefined;
var syncRunning = false; var syncRunning = false;
var isOffline = false; var isOffline = false;
// Enable/disable the button // Enable/disable the button
var updateButtonState = function() { var updateButtonState = function() {
if(button === undefined) { if($button === undefined) {
return; return;
} }
if(syncRunning === true || synchronizer.hasSync() === false || isOffline) { if(syncRunning === true || synchronizer.hasSync() === false || isOffline) {
button.addClass("disabled"); $button.addClass("disabled");
} }
else { else {
button.removeClass("disabled"); $button.removeClass("disabled");
} }
}; };
@ -54,12 +54,17 @@ define([
}; };
buttonSync.onCreateButton = function() { buttonSync.onCreateButton = function() {
button = $(buttonSyncHTML).click(function() { var button = crel('button', {
class: 'btn btn-success'
}, crel('i', {
class: 'icon-refresh'
}));
$button = $(button).click(function() {
if(!$(this).hasClass("disabled")) { if(!$(this).hasClass("disabled")) {
synchronizer.sync(); synchronizer.sync();
} }
}); });
return button[0]; return button;
}; };
buttonSync.onReady = updateButtonState; buttonSync.onReady = updateButtonState;

View File

@ -60,9 +60,9 @@ define([
selectedFolderList = []; selectedFolderList = [];
selectedDocumentList = []; selectedDocumentList = [];
_.each(documentListElt.querySelectorAll('input[type="checkbox"]:checked'), function(checkboxElt) { _.each(documentListElt.querySelectorAll('input[type="checkbox"]:checked'), function(checkboxElt) {
var parentElt = $(checkboxElt.parentNode.parentNode); var $parentElt = $(checkboxElt.parentNode.parentNode);
var folderDesc = folderList[parentElt.data('folderIndex')]; var folderDesc = folderList[$parentElt.data('folderIndex')];
var fileDesc = fileSystem[parentElt.data('fileIndex')]; var fileDesc = fileSystem[$parentElt.data('fileIndex')];
if(folderDesc !== undefined) { if(folderDesc !== undefined) {
selectedFolderList.push(folderDesc); selectedFolderList.push(folderDesc);
} }
@ -110,18 +110,18 @@ define([
eventMgr.onFoldersChanged(); eventMgr.onFoldersChanged();
} }
var liMoveElt = undefined; var $liMoveElt = undefined;
var liDeleteElt = undefined; var $liDeleteElt = undefined;
function doActiveButtons() { function doActiveButtons() {
doSelect(); doSelect();
liMoveElt.toggleClass('disabled', _.size(folderList) === 0 || _.size(selectedDocumentList) === 0); $liMoveElt.toggleClass('disabled', _.size(folderList) === 0 || _.size(selectedDocumentList) === 0);
liDeleteElt.toggleClass('disabled', _.size(selectedFolderList) === 0 && _.size(selectedDocumentList) === 0); $liDeleteElt.toggleClass('disabled', _.size(selectedFolderList) === 0 && _.size(selectedDocumentList) === 0);
} }
var orphanDocumentList = undefined; var orphanDocumentList = undefined;
var documentCountElt = undefined; var $documentCountElt = undefined;
var folderCountElt = undefined; var $folderCountElt = undefined;
var refreshManager = function() { var refreshManager = function() {
if(isVisible === false) { if(isVisible === false) {
return; return;
@ -130,8 +130,8 @@ define([
doActiveButtons(); doActiveButtons();
// Refresh file/folder counters // Refresh file/folder counters
documentCountElt.text(_.size(fileSystem)); $documentCountElt.text(_.size(fileSystem));
folderCountElt.text(_.size(folderList) + 1); $folderCountElt.text(_.size(folderList) + 1);
// List orphan documents // List orphan documents
orphanDocumentList = _.filter(fileSystem, function(fileDesc) { orphanDocumentList = _.filter(fileSystem, function(fileDesc) {
@ -183,12 +183,12 @@ define([
// Set delete event listeners // Set delete event listeners
_.each(documentListElt.querySelectorAll('.button-delete'), function(buttonElt) { _.each(documentListElt.querySelectorAll('.button-delete'), function(buttonElt) {
buttonElt = $(buttonElt); var $buttonElt = $(buttonElt);
buttonElt.click(function(e) { $buttonElt.click(function(e) {
e.stopPropagation(); e.stopPropagation();
var parentElt = buttonElt.parent(); var $parentElt = $buttonElt.parent();
var folderDesc = folderList[parentElt.data('folderIndex')]; var folderDesc = folderList[$parentElt.data('folderIndex')];
var fileDesc = fileSystem[parentElt.data('fileIndex')]; var fileDesc = fileSystem[$parentElt.data('fileIndex')];
selectedDocumentList = []; selectedDocumentList = [];
selectedFolderList = []; selectedFolderList = [];
if(folderDesc) { if(folderDesc) {
@ -204,28 +204,28 @@ define([
// Set rename event listeners // Set rename event listeners
_.each(documentListElt.querySelectorAll('.button-rename'), function(buttonElt) { _.each(documentListElt.querySelectorAll('.button-rename'), function(buttonElt) {
buttonElt = $(buttonElt); var $buttonElt = $(buttonElt);
buttonElt.click(function(e) { $buttonElt.click(function(e) {
e.stopPropagation(); e.stopPropagation();
var parentElt = buttonElt.parent(); var $parentElt = $buttonElt.parent();
var name = undefined; var name = undefined;
var folderDesc = folderList[parentElt.data('folderIndex')]; var folderDesc = folderList[$parentElt.data('folderIndex')];
var fileDesc = fileSystem[parentElt.data('fileIndex')]; var fileDesc = fileSystem[$parentElt.data('fileIndex')];
if(folderDesc) { if(folderDesc) {
name = folderDesc.name; name = folderDesc.name;
} }
else if(fileDesc) { else if(fileDesc) {
name = fileDesc.title; name = fileDesc.title;
} }
parentElt.find('.name').addClass('hide'); $parentElt.find('.name').addClass('hide');
parentElt.find('.input-rename').removeClass('hide').val(name)[0].select(); $parentElt.find('.input-rename').removeClass('hide').val(name)[0].select();
}); });
}); });
_.each(documentListElt.querySelectorAll('.input-rename'), function(inputElt) { _.each(documentListElt.querySelectorAll('.input-rename'), function(inputElt) {
inputElt = $(inputElt); var $inputElt = $(inputElt);
function rename() { function rename() {
var parentElt = inputElt.parent(); var parentElt = $inputElt.parent();
var name = $.trim(inputElt.val()); var name = $.trim($inputElt.val());
var folderDesc = folderList[parentElt.data('folderIndex')]; var folderDesc = folderList[parentElt.data('folderIndex')];
var fileDesc = fileSystem[parentElt.data('fileIndex')]; var fileDesc = fileSystem[parentElt.data('fileIndex')];
if(name && folderDesc && name != folderDesc.name) { if(name && folderDesc && name != folderDesc.name) {
@ -237,11 +237,11 @@ define([
eventMgr.onTitleChanged(fileDesc); eventMgr.onTitleChanged(fileDesc);
} }
else { else {
inputElt.addClass('hide'); $inputElt.addClass('hide');
parentElt.find('.name').removeClass('hide'); parentElt.find('.name').removeClass('hide');
} }
} }
inputElt.blur(function() { $inputElt.blur(function() {
rename(); rename();
}).keyup(function(e) { }).keyup(function(e) {
if(e.keyCode == 13) { if(e.keyCode == 13) {
@ -249,7 +249,7 @@ define([
e.stopPropagation(); e.stopPropagation();
} }
if(e.keyCode == 27) { if(e.keyCode == 27) {
inputElt.val(''); $inputElt.val('');
rename(); rename();
e.stopPropagation(); e.stopPropagation();
} }
@ -258,11 +258,11 @@ define([
// Set folder checkbox special behavior // Set folder checkbox special behavior
_.each(documentListElt.querySelectorAll('.folder .checkbox'), function(checkboxElt) { _.each(documentListElt.querySelectorAll('.folder .checkbox'), function(checkboxElt) {
checkboxElt = $(checkboxElt); var $checkboxElt = $(checkboxElt);
checkboxElt.click(function(e) { $checkboxElt.click(function(e) {
e.stopPropagation(); e.stopPropagation();
}).find('[type=checkbox]').change(function() { }).find('[type=checkbox]').change(function() {
var documentCheckboxElts = checkboxElt.parent().next().find('[type=checkbox]'); var documentCheckboxElts = $checkboxElt.parent().next().find('[type=checkbox]');
if(this.checked) { if(this.checked) {
documentCheckboxElts.prop('checked', true).prop('disabled', true); documentCheckboxElts.prop('checked', true).prop('disabled', true);
} }
@ -288,8 +288,8 @@ define([
documentManager.onReady = function() { documentManager.onReady = function() {
modalElt = document.querySelector('.modal-document-manager'); modalElt = document.querySelector('.modal-document-manager');
documentListElt = modalElt.querySelector('.list-group.document-list'); documentListElt = modalElt.querySelector('.list-group.document-list');
documentCountElt = $(modalElt.querySelectorAll('.document-count')); $documentCountElt = $(modalElt.querySelectorAll('.document-count'));
folderCountElt = $(modalElt.querySelectorAll('.folder-count')); $folderCountElt = $(modalElt.querySelectorAll('.folder-count'));
selectedDocumentListElt = modalElt.querySelector('.list-group.selected-document-list'); selectedDocumentListElt = modalElt.querySelector('.list-group.selected-document-list');
var selectFolderListElt = modalElt.querySelector('.list-group.select-folder-list'); var selectFolderListElt = modalElt.querySelector('.list-group.select-folder-list');
@ -332,15 +332,15 @@ define([
}); });
// Delete selection actions // Delete selection actions
var aDeleteElt = $(modalElt.querySelectorAll('.action-delete-items')).click(function() { var $aDeleteElt = $(modalElt.querySelectorAll('.action-delete-items')).click(function() {
if(liDeleteElt.hasClass('disabled')) { if($liDeleteElt.hasClass('disabled')) {
return; return;
} }
doSelect(); doSelect();
doDeleteConfirmation(); doDeleteConfirmation();
}); });
liDeleteElt = aDeleteElt.parent(); $liDeleteElt = $aDeleteElt.parent();
// Delete confirmation actions // Delete confirmation actions
$(modalElt.querySelectorAll('.action-delete-items-confirm')).click(function() { $(modalElt.querySelectorAll('.action-delete-items-confirm')).click(function() {
@ -351,8 +351,8 @@ define([
}); });
// Move selection actions // Move selection actions
var aMoveElt = $(modalElt.querySelectorAll('.action-move-items')).click(function() { var $aMoveElt = $(modalElt.querySelectorAll('.action-move-items')).click(function() {
if(liMoveElt.hasClass('disabled')) { if($liMoveElt.hasClass('disabled')) {
return; return;
} }
@ -396,7 +396,7 @@ define([
$(modalElt.querySelectorAll('.document-list')).addClass('hide'); $(modalElt.querySelectorAll('.document-list')).addClass('hide');
$(modalElt.querySelectorAll('.choose-folder, .select-folder-list')).removeClass('hide'); $(modalElt.querySelectorAll('.choose-folder, .select-folder-list')).removeClass('hide');
}); });
liMoveElt = aMoveElt.parent(); $liMoveElt = $aMoveElt.parent();
// Cancel button // Cancel button
$(modalElt.querySelectorAll('.action-cancel')).click(function() { $(modalElt.querySelectorAll('.action-cancel')).click(function() {

View File

@ -96,9 +96,9 @@ define([
// Add click listeners // Add click listeners
_.each(documentListElt.querySelectorAll('.file'), function(fileElt) { _.each(documentListElt.querySelectorAll('.file'), function(fileElt) {
fileElt = $(fileElt); var $fileElt = $(fileElt);
fileElt.click(function(e) { $fileElt.click(function(e) {
var fileDesc = fileSystem[fileElt.data('fileIndex')]; var fileDesc = fileSystem[$fileElt.data('fileIndex')];
if(fileDesc && fileDesc !== selectedFileDesc) { if(fileDesc && fileDesc !== selectedFileDesc) {
fileMgr.selectFile(fileDesc); fileMgr.selectFile(fileDesc);
} }

View File

@ -90,23 +90,6 @@ define([
documentSelector.onNewPublishSuccess = buildSelector; documentSelector.onNewPublishSuccess = buildSelector;
documentSelector.onPublishRemoved = buildSelector; documentSelector.onPublishRemoved = buildSelector;
// Filter for search input in file selector
function filterFileSelector(filter) {
var liList = $(".file-selector > li");
liList.show();
if(filter) {
var words = filter.toLowerCase().split(/\s+/);
liList.each(function() {
var fileTitle = $(this).text().toLowerCase();
if(_.some(words, function(word) {
return fileTitle.indexOf(word) === -1;
})) {
$(this).hide();
}
});
}
}
documentSelector.onReady = function() { documentSelector.onReady = function() {
$editorElt = $("#wmd-input"); $editorElt = $("#wmd-input");
@ -129,9 +112,9 @@ define([
}), dropdownElt)); }), dropdownElt));
var $dropdownElt = $(dropdownElt).dropdown(); var $dropdownElt = $(dropdownElt).dropdown();
var documentPanelTogglerElt = $('.document-panel .collapse-button'); var $documentPanelTogglerElt = $('.document-panel .collapse-button');
documentPanelTogglerElt.prop("title", _.template("<%= title %> <%= shortcutPrevious %> <%= shortcutNext %>", { $documentPanelTogglerElt.prop("title", _.template("<%= title %> <%= shortcutPrevious %> <%= shortcutNext %>", {
title: documentPanelTogglerElt.prop("title"), title: $documentPanelTogglerElt.prop("title"),
shortcutPrevious: documentSelector.config.shortcutPrevious, shortcutPrevious: documentSelector.config.shortcutPrevious,
shortcutNext: documentSelector.config.shortcutNext shortcutNext: documentSelector.config.shortcutNext
})); }));

View File

@ -15,9 +15,9 @@ define([
sectionList = sectionListParam; sectionList = sectionListParam;
}; };
var editorElt = undefined; var $editorElt = undefined;
var previewElt = undefined; var $previewElt = undefined;
var textareaElt = undefined; var $textareaElt = undefined;
var mdSectionList = []; var mdSectionList = [];
var htmlSectionList = []; var htmlSectionList = [];
function pxToFloat(px) { function pxToFloat(px) {
@ -30,16 +30,16 @@ define([
// Try to find Markdown sections by looking for titles // Try to find Markdown sections by looking for titles
mdSectionList = []; mdSectionList = [];
// It has to be the same width as wmd-input // It has to be the same width as wmd-input
textareaElt.width(editorElt.width()); $textareaElt.width($editorElt.width());
// Consider wmd-input top padding (will be used for 1st and last // Consider wmd-input top padding (will be used for 1st and last
// section) // section)
var padding = pxToFloat(editorElt.css('padding-top')); var padding = pxToFloat($editorElt.css('padding-top'));
var mdSectionOffset = 0; var mdSectionOffset = 0;
function addMdSection(sectionText) { function addMdSection(sectionText) {
var sectionHeight = padding; var sectionHeight = padding;
if(sectionText.length !== 0) { if(sectionText !== undefined) {
textareaElt.val(sectionText); $textareaElt.val(sectionText);
sectionHeight += textareaElt.prop('scrollHeight'); sectionHeight += $textareaElt.prop('scrollHeight');
} }
var newSectionOffset = mdSectionOffset + sectionHeight; var newSectionOffset = mdSectionOffset + sectionHeight;
mdSectionList.push({ mdSectionList.push({
@ -52,14 +52,18 @@ define([
} }
_.each(sectionList, function(sectionText, index) { _.each(sectionList, function(sectionText, index) {
if(index !== sectionList.length - 1) { if(index !== sectionList.length - 1) {
// Remove the last \n preceding the next title if(sectionText.length === 0) {
sectionText = sectionText.substring(0, sectionText.length - 1); sectionText = undefined;
}
else {
// Remove the last \n preceding the next title
sectionText = sectionText.substring(0, sectionText.length - 1);
}
} }
else { else {
// Last section // Last section
// Consider wmd-input bottom padding and exclude \n\n previously // Consider wmd-input bottom padding and keep last empty line
// added padding += pxToFloat($editorElt.css('padding-bottom'));
padding += pxToFloat(editorElt.css('padding-bottom'));
} }
addMdSection(sectionText); addMdSection(sectionText);
}); });
@ -67,12 +71,12 @@ define([
// Try to find corresponding sections in the preview // Try to find corresponding sections in the preview
htmlSectionList = []; htmlSectionList = [];
var htmlSectionOffset = 0; var htmlSectionOffset = 0;
var previewScrollTop = previewElt.scrollTop(); var previewScrollTop = $previewElt.scrollTop();
// Each title element is a section separator // Each title element is a section separator
previewElt.find(".preview-content > .wmd-title").each(function() { $previewElt.find(".preview-content > .wmd-title").each(function() {
var titleElt = $(this); var $titleElt = $(this);
// Consider div scroll position and header element top margin // Consider div scroll position and header element top margin
var newSectionOffset = titleElt.position().top + previewScrollTop + pxToFloat(titleElt.css('margin-top')); var newSectionOffset = $titleElt.position().top + previewScrollTop + pxToFloat($titleElt.css('margin-top'));
htmlSectionList.push({ htmlSectionList.push({
startOffset: htmlSectionOffset, startOffset: htmlSectionOffset,
endOffset: newSectionOffset, endOffset: newSectionOffset,
@ -81,7 +85,7 @@ define([
htmlSectionOffset = newSectionOffset; htmlSectionOffset = newSectionOffset;
}); });
// Last section // Last section
var scrollHeight = previewElt.prop('scrollHeight'); var scrollHeight = $previewElt.prop('scrollHeight');
htmlSectionList.push({ htmlSectionList.push({
startOffset: htmlSectionOffset, startOffset: htmlSectionOffset,
endOffset: scrollHeight, endOffset: scrollHeight,
@ -91,17 +95,17 @@ define([
// apply Scroll Link (-10 to have a gap > 9 px) // apply Scroll Link (-10 to have a gap > 9 px)
lastEditorScrollTop = -10; lastEditorScrollTop = -10;
lastPreviewScrollTop = -10; lastPreviewScrollTop = -10;
runScrollLink(); doScrollLink();
}, 500); }, 500);
var isScrollEditor = false; var isScrollEditor = false;
var isScrollPreview = false; var isScrollPreview = false;
var runScrollLink = _.debounce(function() { var doScrollLink = _.debounce(function() {
if(mdSectionList.length === 0 || mdSectionList.length !== htmlSectionList.length) { if(mdSectionList.length === 0 || mdSectionList.length !== htmlSectionList.length) {
return; return;
} }
var editorScrollTop = editorElt.scrollTop(); var editorScrollTop = $editorElt.scrollTop();
var previewScrollTop = previewElt.scrollTop(); var previewScrollTop = $previewElt.scrollTop();
function animate(srcScrollTop, srcSectionList, destElt, destSectionList, currentDestScrollTop, callback) { function animate(srcScrollTop, srcSectionList, destElt, destSectionList, currentDestScrollTop, callback) {
// Find the section corresponding to the offset // Find the section corresponding to the offset
var sectionIndex = undefined; var sectionIndex = undefined;
@ -121,7 +125,7 @@ define([
destElt.prop('scrollHeight') - destElt.outerHeight() destElt.prop('scrollHeight') - destElt.outerHeight()
]); ]);
if(Math.abs(destScrollTop - currentDestScrollTop) <= 9) { if(Math.abs(destScrollTop - currentDestScrollTop) <= 9) {
// Skip the animation in case it's not necessary // Skip the animation if diff is <= 9
callback(currentDestScrollTop); callback(currentDestScrollTop);
return; return;
} }
@ -136,7 +140,7 @@ define([
isScrollEditor = false; isScrollEditor = false;
// Animate the preview // Animate the preview
lastEditorScrollTop = editorScrollTop; lastEditorScrollTop = editorScrollTop;
animate(editorScrollTop, mdSectionList, previewElt, htmlSectionList, previewScrollTop, function(destScrollTop) { animate(editorScrollTop, mdSectionList, $previewElt, htmlSectionList, previewScrollTop, function(destScrollTop) {
lastPreviewScrollTop = destScrollTop; lastPreviewScrollTop = destScrollTop;
}); });
} }
@ -144,7 +148,7 @@ define([
isScrollPreview = false; isScrollPreview = false;
// Animate the editor // Animate the editor
lastPreviewScrollTop = previewScrollTop; lastPreviewScrollTop = previewScrollTop;
animate(previewScrollTop, htmlSectionList, editorElt, mdSectionList, editorScrollTop, function(destScrollTop) { animate(previewScrollTop, htmlSectionList, $editorElt, mdSectionList, editorScrollTop, function(destScrollTop) {
lastEditorScrollTop = destScrollTop; lastEditorScrollTop = destScrollTop;
}); });
} }
@ -157,39 +161,44 @@ define([
}; };
}; };
scrollLink.onLayoutCreated = function() { scrollLink.onReady = function() {
editorElt = $("#wmd-input"); $editorElt = $("#wmd-input");
previewElt = $(".preview-container"); $previewElt = $(".preview-container");
// This textarea is used to measure sections height // This textarea is used to measure sections height
textareaElt = $("#md-section-helper"); $textareaElt = $("#md-section-helper");
$(".preview-container").bind("keyup mouseup mousewheel", function() { $previewElt.bind("keyup mouseup mousewheel", function() {
isScrollPreview = true; isScrollPreview = true;
isScrollEditor = false; isScrollEditor = false;
runScrollLink(); doScrollLink();
}); });
$("#wmd-input").bind("keyup mouseup mousewheel", function() { $('.table-of-contents').click(function() {
isScrollPreview = true;
isScrollEditor = false;
doScrollLink();
});
$editorElt.bind("keyup mouseup mousewheel", function() {
isScrollEditor = true; isScrollEditor = true;
isScrollPreview = false; isScrollPreview = false;
runScrollLink(); doScrollLink();
}); });
}; };
var previewContentsElt = undefined; var $previewContentsElt = undefined;
scrollLink.onEditorConfigure = function(editor) { scrollLink.onEditorConfigure = function(editor) {
previewContentsElt = $("#preview-contents"); $previewContentsElt = $("#preview-contents");
editor.getConverter().hooks.chain("postConversion", function(text) { editor.getConverter().hooks.chain("postConversion", function(text) {
// To avoid losing scrolling position before elements are fully // To avoid losing scrolling position before elements are fully
// loaded // loaded
previewContentsElt.height(previewContentsElt.height()); $previewContentsElt.height($previewContentsElt.height());
return text; return text;
}); });
}; };
scrollLink.onPreviewFinished = function() { scrollLink.onPreviewFinished = function() {
// Now set the correct height // Now set the correct height
previewContentsElt.height("auto"); $previewContentsElt.height("auto");
isScrollEditor = true; isScrollEditor = true;
buildSections(); buildSections();
}; };

View File

@ -6,15 +6,16 @@ define([
var workingIndicator = new Extension("workingIndicator", "Working Indicator"); var workingIndicator = new Extension("workingIndicator", "Working Indicator");
var $bodyElt = undefined;
var $workingIndicatorElt = undefined;
workingIndicator.onAsyncRunning = function(isRunning) { workingIndicator.onAsyncRunning = function(isRunning) {
if(isRunning === false) { $bodyElt.toggleClass("working", isRunning);
$(".working-indicator").removeClass("show"); $workingIndicatorElt.toggleClass("show", isRunning);
$("body").removeClass("working"); };
}
else { workingIndicator.onReady = function() {
$(".working-indicator").addClass("show"); $bodyElt = $(document.body);
$("body").addClass("working"); $workingIndicatorElt = $(".working-indicator");
}
}; };
return workingIndicator; return workingIndicator;

View File

@ -41,14 +41,9 @@ define([
eventMgr.onFileSelected(fileDesc); eventMgr.onFileSelected(fileDesc);
// Hide the viewer pencil button // Hide the viewer pencil button
if(fileDesc.fileIndex == TEMPORARY_FILE_INDEX) { $(".action-edit-document").toggleClass("hide", fileDesc.fileIndex != TEMPORARY_FILE_INDEX);
$(".action-edit-document").removeClass("hide");
}
else {
$(".action-edit-document").addClass("hide");
}
} }
// Refresh the editor (even if it's the same file) // Refresh the editor (even if it's the same file)
core.initEditor(fileDesc); core.initEditor(fileDesc);
}; };
@ -160,8 +155,8 @@ define([
fileMgr.selectFile(); fileMgr.selectFile();
var fileTitleElt = $('.file-title-navbar'); var $fileTitleElt = $('.file-title-navbar');
var fileTitleInputElt = $(".input-file-title"); var $fileTitleInputElt = $(".input-file-title");
$(".action-create-file").click(function() { $(".action-create-file").click(function() {
var fileDesc = fileMgr.createFile(); var fileDesc = fileMgr.createFile();
fileMgr.selectFile(fileDesc); fileMgr.selectFile(fileDesc);
@ -169,41 +164,41 @@ define([
if(wmdInput.setSelectionRange) { if(wmdInput.setSelectionRange) {
wmdInput.setSelectionRange(0, 0); wmdInput.setSelectionRange(0, 0);
} }
fileTitleElt.click(); $fileTitleElt.click();
}); });
$(".action-remove-file").click(function() { $(".action-remove-file").click(function() {
fileMgr.deleteFile(); fileMgr.deleteFile();
}); });
fileTitleElt.click(function() { $fileTitleElt.click(function() {
if(viewerMode === true) { if(viewerMode === true) {
return; return;
} }
fileTitleElt.addClass('hide'); $fileTitleElt.addClass('hide');
var fileTitleInput = fileTitleInputElt.removeClass('hide'); var fileTitleInput = $fileTitleInputElt.removeClass('hide');
_.defer(function() { _.defer(function() {
fileTitleInput.focus().get(0).select(); fileTitleInput.focus().get(0).select();
}); });
}); });
function applyTitle() { function applyTitle() {
fileTitleInputElt.addClass('hide'); $fileTitleInputElt.addClass('hide');
fileTitleElt.removeClass('hide'); $fileTitleElt.removeClass('hide');
var title = $.trim(fileTitleInputElt.val()); var title = $.trim($fileTitleInputElt.val());
var fileDesc = fileMgr.currentFile; var fileDesc = fileMgr.currentFile;
if(title && title != fileDesc.title) { if(title && title != fileDesc.title) {
fileDesc.title = title; fileDesc.title = title;
eventMgr.onTitleChanged(fileDesc); eventMgr.onTitleChanged(fileDesc);
} }
fileTitleInputElt.val(fileDesc.title); $fileTitleInputElt.val(fileDesc.title);
$editorElt.focus(); $editorElt.focus();
} }
fileTitleInputElt.blur(function() { $fileTitleInputElt.blur(function() {
applyTitle(); applyTitle();
}).keyup(function(e) { }).keyup(function(e) {
if(e.keyCode == 13) { if(e.keyCode == 13) {
applyTitle(); applyTitle();
} }
if(e.keyCode == 27) { if(e.keyCode == 27) {
fileTitleInputElt.val(""); $fileTitleInputElt.val("");
applyTitle(); applyTitle();
} }
}); });

View File

@ -328,7 +328,7 @@
<p> <p>
Are you sure you want to delete "<span class="file-title"></span>"? Are you sure you want to delete "<span class="file-title"></span>"?
</p> </p>
<blockquote class="muted"> <blockquote>
<b>NOTE:</b> This will not delete the file on synchronized <b>NOTE:</b> This will not delete the file on synchronized
locations. locations.
</blockquote> </blockquote>
@ -445,7 +445,7 @@
</div> </div>
</div> </div>
</div> </div>
<blockquote class="muted"> <blockquote>
<b>NOTE:</b> <b>NOTE:</b>
<ul> <ul>
<li>You can move or rename the file afterwards within Google <li>You can move or rename the file afterwards within Google
@ -491,7 +491,7 @@
</div> </div>
</div> </div>
</div> </div>
<blockquote class="muted"> <blockquote>
<b>NOTE:</b> <b>NOTE:</b>
<ul> <ul>
<li>Dropbox file path does not depend on document title.</li> <li>Dropbox file path does not depend on document title.</li>
@ -526,11 +526,11 @@
following location(s): following location(s):
</p> </p>
<div class="msg-sync-list sync-list hide"></div> <div class="msg-sync-list sync-list hide"></div>
<blockquote class="msg-sync-list hide muted"> <blockquote class="msg-sync-list hide">
<b>NOTE:</b> Removing a synchronized location will not delete any <b>NOTE:</b> Removing a synchronized location will not delete any
file. file.
</blockquote> </blockquote>
<blockquote class="msg-no-sync hide muted"> <blockquote class="msg-no-sync hide">
"<span class="file-title"></span>" is not synchronized yet. <br /> "<span class="file-title"></span>" is not synchronized yet. <br />
<br /> <b>NOTE:</b> You can add synchronized locations by <br /> <b>NOTE:</b> You can add synchronized locations by
exporting your document using <i class="icon-provider-gdrive"></i> exporting your document using <i class="icon-provider-gdrive"></i>
@ -789,7 +789,7 @@
location(s): location(s):
</p> </p>
<div class="msg-publish-list publish-list hide"></div> <div class="msg-publish-list publish-list hide"></div>
<blockquote class="muted"> <blockquote>
<div class="msg-no-publish hide"> <div class="msg-no-publish hide">
"<span class="file-title"></span>" is not published yet. <br /> <br /> "<span class="file-title"></span>" is not published yet. <br /> <br />
</div> </div>
@ -968,7 +968,7 @@
<div class="modal-body"> <div class="modal-body">
<p>StackEdit has stopped because another instance was running in <p>StackEdit has stopped because another instance was running in
the same browser.</p> the same browser.</p>
<blockquote class="muted">If you want to reopen <blockquote>If you want to reopen
StackEdit, click on "Reload".</blockquote> StackEdit, click on "Reload".</blockquote>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
@ -989,7 +989,7 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p>This will delete all your local documents.</p> <p>This will delete all your local documents.</p>
<blockquote class="muted">Are you sure?</blockquote> <blockquote>Are you sure?</blockquote>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a href="#" class="btn btn-default" data-dismiss="modal">Cancel</a> <a href="#" class="btn btn-default" data-dismiss="modal">Cancel</a>

View File

@ -78,7 +78,7 @@
<div class="modal-body"> <div class="modal-body">
<p>StackEdit has stopped because another instance was running in <p>StackEdit has stopped because another instance was running in
the same browser.</p> the same browser.</p>
<blockquote class="muted">If you want to reopen <blockquote>If you want to reopen
StackEdit, click on "Reload".</blockquote> StackEdit, click on "Reload".</blockquote>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">

View File

@ -139,6 +139,6 @@ like `` `this` ``.
Violets are blue. Violets are blue.
</code></pre> </code></pre>
<p class="muted">Based on the <a target="_blank" href="https://github.com/fletcher/MultiMarkdown/blob/master/Documentation/Markdown%20Syntax.md">Markdown syntax guide</a>, by Fletcher T. Penney.</p> <p>Based on the <a target="_blank" href="https://github.com/fletcher/MultiMarkdown/blob/master/Documentation/Markdown%20Syntax.md">Markdown syntax guide</a>, by Fletcher T. Penney.</p>
</div> </div>
</div> </div>

View File

@ -3,13 +3,13 @@
<i class="icon-link"></i> <i class="icon-link"></i>
</button> </button>
<div class="dropdown-menu pull-right link-container"> <div class="dropdown-menu pull-right link-container">
<h3 class="muted">Sharing</h3> <h3>Sharing</h3>
<div class="link-list"></div> <div class="link-list"></div>
<p class="no-link">To share this document you need first to <a <p class="no-link">To share this document you need first to <a
href="#" class="action-publish-gist">publish it as a Gist</a> in href="#" class="action-publish-gist">publish it as a Gist</a> in
Markdown format. Markdown format.
</p> </p>
<blockquote class="muted"> <blockquote>
<b>NOTE:</b> You can open any URL within StackEdit using <a <b>NOTE:</b> You can open any URL within StackEdit using <a
href="viewer.html?url=https://raw.github.com/benweet/stackedit/master/README.md" href="viewer.html?url=https://raw.github.com/benweet/stackedit/master/README.md"
title="Sharing example">viewer.html?url=...</a> title="Sharing example">viewer.html?url=...</a>

View File

@ -1,5 +1,5 @@
<div class="input-group"> <div class="input-group">
<div class="input-group-btn"><a href="<%= link %>" class="btn btn-info" title="Sharing location"><i <a href="<%= link %>" class="input-group-addon" title="Sharing location"><i
class="icon-link"></i></a></div> <input class="col-lg-5 form-control" type="text" class="icon-link"></i></a> <input class="col-lg-5 form-control" type="text"
value="<%= link %>" readonly /> value="<%= link %>" readonly />
</div> </div>

View File

@ -1,3 +0,0 @@
<button class="btn btn-success" title="Synchronize all documents">
<i class="icon-refresh"></i>
</button>

View File

@ -5,7 +5,7 @@
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" <button type="button" class="close" data-dismiss="modal"
aria-hidden="true">&times;</button> aria-hidden="true">&times;</button>
<img src="img/stackedit-promo.png" /> <img src="img/stackedit-promo.png" width="240" height="60" />
</div> </div>
<div class="modal-body"> <div class="modal-body">
<dl> <dl>

View File

@ -1,5 +1,5 @@
<p>Renders modified sections only.</p> <p>Renders modified sections only.</p>
<blockquote class="muted"> <blockquote>
<b>NOTE:</b> Document sections are based on title elements (h1, h2...). Therefore if <b>NOTE:</b> Document sections are based on title elements (h1, h2...). Therefore if
your document does not contain any title, performance will not be increased. your document does not contain any title, performance will not be increased.
</blockquote> </blockquote>

View File

@ -1,5 +1,5 @@
<p>Binds together editor and preview scrollbars.</p> <p>Binds together editor and preview scrollbars.</p>
<blockquote class="muted"> <blockquote>
<b>NOTE:</b> The mapping between Markdown and HTML is based on the <b>NOTE:</b> The mapping between Markdown and HTML is based on the
position of the title elements (h1, h2...) in the page. Therefore if position of the title elements (h1, h2...) in the page. Therefore if
your document does not contain any title, the mapping will be linear and your document does not contain any title, the mapping will be linear and

View File

@ -323,7 +323,7 @@ define([
} }
// Binds model with textarea // Binds model with textarea
realtimeBinding = gapi.drive.realtime.databinding.bindString(string, $("#wmd-input")[0]); realtimeBinding = gapi.drive.realtime.databinding.bindString(string, document.getElementById("wmd-input"));
// Update content state according to collaborators changes // Update content state according to collaborators changes
if(remoteContentChanged === true) { if(remoteContentChanged === true) {

View File

@ -216,7 +216,7 @@ define([
// dialog // dialog
var publishPreferences = {}; var publishPreferences = {};
_.each(provider.publishPreferencesInputIds, function(inputId) { _.each(provider.publishPreferencesInputIds, function(inputId) {
publishPreferences[inputId] = $("#input-publish-" + inputId).val(); publishPreferences[inputId] = document.getElementById("input-publish-" + inputId).value;
}); });
publishPreferences.format = publishAttributes.format; publishPreferences.format = publishAttributes.format;
localStorage[provider.providerId + ".publishPreferences"] = JSON.stringify(publishPreferences); localStorage[provider.providerId + ".publishPreferences"] = JSON.stringify(publishPreferences);
@ -257,7 +257,7 @@ define([
// Save As menu items // Save As menu items
$(".action-download-md").click(function() { $(".action-download-md").click(function() {
var content = $("#wmd-input").val(); var content = document.getElementById("wmd-input").value;
var title = fileMgr.currentFile.title; var title = fileMgr.currentFile.title;
utils.saveAs(content, title + ".md"); utils.saveAs(content, title + ".md");
}); });

View File

@ -1,3 +1,7 @@
@import "main.less" @import "main.less"
@primary-bg: #d5dde3; @primary-bg: #d5dde3;
.navbar .working-indicator.show {
.img-retina('../../../../img/loader-blue-gray.gif', '../../../../img/loader-blue-gray2x.gif', 50px, 17px);
}

View File

@ -109,6 +109,7 @@ body {
.list-group-item { .list-group-item {
padding: 10px 15px; padding: 10px 15px;
margin: 0;
.list-group & { .list-group & {
border-radius: 0; border-radius: 0;
} }
@ -139,7 +140,7 @@ body {
background-color: @btn-primary-hover-bg; background-color: @btn-primary-hover-bg;
} }
.btn-success:hover { .btn-success:hover, .open .dropdown-toggle.btn-success {
color: @btn-success-color; color: @btn-success-color;
background-color: @bg-navbar-hover !important; // important to override .nav > li > a:hover background-color: @bg-navbar-hover !important; // important to override .nav > li > a:hover
} }
@ -279,13 +280,12 @@ body {
} }
.working-indicator { .working-indicator {
background-image: none !important; width: 50px;
width: 43px; height: 17px;
height: 11px;
background-position: 0 0; background-position: 0 0;
margin-top: 15px; margin-top: 12px;
&.show { &.show {
background-image: url("../../img/ajax-loader.gif") !important; .img-retina('../../../../img/loader-default.gif', '../../../../img/loader-default2x.gif', 50px, 17px);
} }
} }
} }
@ -898,6 +898,11 @@ div.dropdown-menu textarea {
.icon-trash { .icon-trash {
font-size: 95%; font-size: 95%;
margin-top: -2px;
}
.icon-folder {
margin-top: -2px;
} }
// Provider's icons (the colored ones) // Provider's icons (the colored ones)
@ -966,6 +971,7 @@ div.dropdown-menu textarea {
code, pre { code, pre {
font-family: Menlo, Consolas, "Courier New", monospace; font-family: Menlo, Consolas, "Courier New", monospace;
font-size: 12px !important;
} }
/* Definition list */ /* Definition list */

View File

@ -27,6 +27,7 @@
@modal-footer-border-color: @primary-bg; @modal-footer-border-color: @primary-bg;
@modal-content-separator-color: @primary-bg; @modal-content-separator-color: @primary-bg;
@nav-link-hover-bg: @primary-bg; @nav-link-hover-bg: @primary-bg;
@nav-tabs-link-hover-border-color: @primary-bg;
@list-group-hover-bg: @primary-bg; @list-group-hover-bg: @primary-bg;
@btn-default-hover-bg: fade(#fff, 8%); @btn-default-hover-bg: fade(#fff, 8%);
@btn-primary-hover-bg: lighten(@secondary-bg, 8%); @btn-primary-hover-bg: lighten(@secondary-bg, 8%);
@ -39,178 +40,6 @@
.box-shadow(~"inset 0 1px 1px rgba(255, 255, 255, 0), 0 0 8px rgba(255, 255, 255, 0.75)"); .box-shadow(~"inset 0 1px 1px rgba(255, 255, 255, 0), 0 0 8px rgba(255, 255, 255, 0.75)");
} }
.navbar .working-indicator.show {
/* .img-retina('../../../../img/loader-night.gif', '../../../../img/loader-night2x.gif', 50px, 17px);
input[readonly], select[readonly], textarea[readonly] { }
background-color: #fff;
}
blockquote {
border-color: #333;
}
#preview-contents {
color: #ccc;
}
#preview-contents blockquote {
border-color: #444;
}
.muted {
color: #aaa;
}
[class^="icon-"], [class*=" icon-"] {
background-image: url("../../img/glyphicons-halflings-white.png");
}
.navbar-inner .btn,
#extension-preview-buttons .btn {
background-color: #444;
}
#extension-preview-buttons .btn-group:hover .btn {
background-color: #333;
}
.navbar-inner .btn:hover,
.navbar-inner .btn:focus,
.navbar-inner .btn:active,
.navbar-inner .btn.active,
.btn-group.open .btn.dropdown-toggle,
#extension-preview-buttons .dropdown-menu,
#extension-preview-buttons .btn-group.open .btn,
#extension-preview-buttons .btn-group.open:hover .btn {
background-color: #444;
}
.btn:hover {
background-color: #333;
}
.btn:hover, .btn:focus {
color: #fff;
}
.btn-primary {
background-color: #444;
}
.btn-primary:hover {
background-color: #555;
}
.navbar-inner .btn.disabled,
.navbar-inner .btn.blocked,
.navbar-inner .btn[disabled] {
background-color: #444;
}
.navbar .nav > li > a {
color: #bbb;
}
.dropdown-menu {
border-color: #333 !important;
}
.dropdown-menu > li > a {
color: #aaa;
}
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus,
.dropdown-submenu:hover > a,
.dropdown-submenu:focus > a,
.dropdown-menu > .active > a,
.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus,
div.jGrowl div.jGrowl-notification {
background-color: #444;
}
.dropdown-menu .divider {
background-color: #111 !important;
border-color: #111 !important;
color: #555 !important;
}
.dropdown-menu:before {
border-bottom-color: #333 !important;
}
.navbar .nav > li > .dropdown-menu:after {
border-bottom-color: #111;
}
.dropdown-menu > .disabled > a,
.dropdown-menu > .disabled > a:hover,
.dropdown-menu > .disabled > a:focus {
color: #444;
}
.modal textarea:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="datetime"]:focus,
input[type="datetime-local"]:focus,
input[type="date"]:focus,
input[type="month"]:focus,
input[type="time"]:focus,
input[type="week"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="color"]:focus,
.uneditable-input:focus
{
background-color: #eee !important;
-webkit-box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0), 0 0 8px rgba(255, 255, 255, 1) !important;
-moz-box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0), 0 0 8px rgba(255, 255, 255, 1) !important;
box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0), 0 0 8px rgba(255, 255, 255, 1) !important;
}
.error {
background-color: #ffbca8 !important;
-webkit-box-shadow: inset 0 1px 1px rgba(255, 134, 97, 0), 0 0 8px rgba(255, 255, 255, 1) !important;
-moz-box-shadow: inset 0 1px 1px rgba(255, 134, 97, 0), 0 0 8px rgba(255, 255, 255, 1) !important;
box-shadow: inset 0 1px 1px rgba(255, 134, 97, 0), 0 0 8px rgba(255, 255, 255, 1) !important;
}
#modal-settings .accordion-group {
border-bottom-color: #222;
}
.nav-tabs > .active > a, .nav-tabs > .active > a:hover, .nav-tabs > .active > a:focus {
color: #fff;
background-color: #333;
border-color: #333;
}
.nav > li > a:hover,
.nav > li > a:focus {
background-color: #222;
}
.nav-tabs > li > a:hover,
.nav-tabs > li > a:focus {
border-color: #222 #222 #222;
}
.nav .dropdown-toggle .caret, .nav .dropdown-toggle:hover .caret, .nav .dropdown-toggle:focus .caret {
border-top-color: #888;
border-bottom-color: #888;
}
.working-indicator.show {
background-image: url("ajax-loader.gif") !important;
}
.viewer .navbar-inner {
background-color:rgba(80,80,80,0.75) !important;
}
*/

View File

@ -341,7 +341,7 @@ define([
// export dialog // export dialog
var exportPreferences = {}; var exportPreferences = {};
_.each(provider.exportPreferencesInputIds, function(inputId) { _.each(provider.exportPreferencesInputIds, function(inputId) {
exportPreferences[inputId] = $("#input-sync-export-" + inputId).val(); exportPreferences[inputId] = document.getElementById("input-sync-export-" + inputId).value;
}); });
localStorage[provider.providerId + ".exportPreferences"] = JSON.stringify(exportPreferences); localStorage[provider.providerId + ".exportPreferences"] = JSON.stringify(exportPreferences);
}); });