Fixes and improvements

This commit is contained in:
benweet 2014-08-11 00:47:04 +01:00
parent 98128befe9
commit fd321284f5
10 changed files with 104 additions and 114 deletions

View File

@ -1,81 +1,82 @@
define([], function() { define([], function() {
var constants = {}; var constants = {};
constants.VERSION = "3.99.15"; constants.VERSION = "3.99.15";
constants.MAIN_URL = "https://stackedit.io/"; constants.MAIN_URL = "https://stackedit.io/";
constants.GOOGLE_ANALYTICS_ACCOUNT_ID = "UA-39556145-1"; constants.GOOGLE_ANALYTICS_ACCOUNT_ID = "UA-39556145-1";
constants.GOOGLE_API_KEY = "AIzaSyAeCU8CGcSkn0z9js6iocHuPBX4f_mMWkw"; constants.GOOGLE_API_KEY = "AIzaSyAeCU8CGcSkn0z9js6iocHuPBX4f_mMWkw";
constants.GOOGLE_DRIVE_APP_ID = "241271498917"; constants.GOOGLE_DRIVE_APP_ID = "241271498917";
constants.DROPBOX_APP_KEY = "lq6mwopab8wskas"; constants.DROPBOX_APP_KEY = "lq6mwopab8wskas";
constants.DROPBOX_APP_SECRET = "851fgnucpezy84t"; constants.DROPBOX_APP_SECRET = "851fgnucpezy84t";
constants.DROPBOX_RESTRICTED_APP_KEY = "sw0hlixhr8q1xk0"; constants.DROPBOX_RESTRICTED_APP_KEY = "sw0hlixhr8q1xk0";
constants.DROPBOX_RESTRICTED_APP_SECRET = "1r808p2xygs6lbg"; constants.DROPBOX_RESTRICTED_APP_SECRET = "1r808p2xygs6lbg";
constants.BITLY_ACCESS_TOKEN = "317e033bfd48cf31155a68a536b1860013b09c4c"; constants.BITLY_ACCESS_TOKEN = "317e033bfd48cf31155a68a536b1860013b09c4c";
constants.DEFAULT_FILE_TITLE = "Title"; constants.DEFAULT_FILE_TITLE = "Title";
constants.DEFAULT_FOLDER_NAME = "New folder"; constants.DEFAULT_FOLDER_NAME = "New folder";
constants.GDRIVE_DEFAULT_FILE_TITLE = "New Markdown document"; constants.GDRIVE_DEFAULT_FILE_TITLE = "New Markdown document";
constants.EDITOR_DEFAULT_PADDING = 35; constants.EDITOR_DEFAULT_PADDING = 35;
constants.CHECK_ONLINE_PERIOD = 120000; constants.CHECK_ONLINE_PERIOD = 120000;
constants.AJAX_TIMEOUT = 30000; constants.AJAX_TIMEOUT = 30000;
constants.ASYNC_TASK_DEFAULT_TIMEOUT = 60000; constants.ASYNC_TASK_DEFAULT_TIMEOUT = 60000;
constants.ASYNC_TASK_LONG_TIMEOUT = 180000; constants.ASYNC_TASK_LONG_TIMEOUT = 180000;
constants.USER_IDLE_THRESHOLD = 300000; constants.USER_IDLE_THRESHOLD = 300000;
constants.IMPORT_FILE_MAX_CONTENT_SIZE = 100000; constants.IMPORT_FILE_MAX_CONTENT_SIZE = 100000;
constants.IMPORT_IMG_MAX_CONTENT_SIZE = 10000000; constants.IMPORT_IMG_MAX_CONTENT_SIZE = 10000000;
constants.TEMPORARY_FILE_INDEX = "file.tempIndex"; constants.TEMPORARY_FILE_INDEX = "file.tempIndex";
constants.WELCOME_DOCUMENT_TITLE = "Welcome document"; constants.WELCOME_DOCUMENT_TITLE = "Welcome document";
constants.DOWNLOAD_PROXY_URL = "https://stackedit-download-proxy.herokuapp.com/"; constants.DOWNLOAD_PROXY_URL = "https://stackedit-download-proxy.herokuapp.com/";
constants.PICASA_PROXY_URL = "https://stackedit-picasa-proxy.herokuapp.com/"; constants.PICASA_PROXY_URL = "https://stackedit-picasa-proxy.herokuapp.com/";
constants.SSH_PROXY_URL = "https://stackedit-ssh-proxy.herokuapp.com/"; constants.SSH_PROXY_URL = "https://stackedit-ssh-proxy.herokuapp.com/";
constants.HTMLTOPDF_URL = "https://stackedit-htmltopdf.herokuapp.com/"; constants.HTMLTOPDF_URL = "https://stackedit-htmltopdf.herokuapp.com/";
// Site dependent // Site dependent
constants.BASE_URL = "http://localhost/"; constants.BASE_URL = "http://localhost/";
constants.GOOGLE_CLIENT_ID = '241271498917-lev37kef013q85avc91am1gccg5g8lrb.apps.googleusercontent.com'; constants.GOOGLE_CLIENT_ID = '241271498917-lev37kef013q85avc91am1gccg5g8lrb.apps.googleusercontent.com';
constants.GITHUB_CLIENT_ID = 'e47fef6055344579799d'; constants.GITHUB_CLIENT_ID = 'e47fef6055344579799d';
constants.GATEKEEPER_URL = "https://stackedit-gatekeeper-localhost.herokuapp.com/"; constants.GATEKEEPER_URL = "https://stackedit-gatekeeper-localhost.herokuapp.com/";
constants.TUMBLR_PROXY_URL = "https://stackedit-tumblr-proxy-local.herokuapp.com/"; constants.TUMBLR_PROXY_URL = "https://stackedit-tumblr-proxy-local.herokuapp.com/";
constants.WORDPRESS_CLIENT_ID = '23361'; constants.WORDPRESS_CLIENT_ID = '23361';
constants.WORDPRESS_PROXY_URL = "https://stackedit-io-wordpress-proxy.herokuapp.com/"; constants.WORDPRESS_PROXY_URL = "https://stackedit-io-wordpress-proxy.herokuapp.com/";
if(location.hostname.indexOf("stackedit.io") === 0) { if(location.hostname.indexOf("stackedit.io") === 0) {
constants.BASE_URL = constants.MAIN_URL; constants.BASE_URL = constants.MAIN_URL;
constants.GOOGLE_CLIENT_ID = '241271498917-t4t7d07qis7oc0ahaskbif3ft6tk63cd.apps.googleusercontent.com'; constants.GOOGLE_CLIENT_ID = '241271498917-t4t7d07qis7oc0ahaskbif3ft6tk63cd.apps.googleusercontent.com';
constants.GITHUB_CLIENT_ID = '710fc67886ab1ae8fee6'; constants.GITHUB_CLIENT_ID = '710fc67886ab1ae8fee6';
constants.GATEKEEPER_URL = "https://stackedit-io-gatekeeper.herokuapp.com/"; constants.GATEKEEPER_URL = "https://stackedit-io-gatekeeper.herokuapp.com/";
constants.TUMBLR_PROXY_URL = "https://stackedit-io-tumblr-proxy.herokuapp.com/"; constants.TUMBLR_PROXY_URL = "https://stackedit-io-tumblr-proxy.herokuapp.com/";
} }
else if(location.hostname.indexOf("benweet.github.io") === 0) { else if(location.hostname.indexOf("benweet.github.io") === 0) {
constants.BASE_URL = 'http://benweet.github.io/stackedit/'; constants.BASE_URL = 'http://benweet.github.io/stackedit/';
constants.GOOGLE_CLIENT_ID = '241271498917-jpto9lls9fqnem1e4h6ppds9uob8rpvu.apps.googleusercontent.com'; constants.GOOGLE_CLIENT_ID = '241271498917-jpto9lls9fqnem1e4h6ppds9uob8rpvu.apps.googleusercontent.com';
constants.GITHUB_CLIENT_ID = 'fa0d09514da8377ee32e'; constants.GITHUB_CLIENT_ID = 'fa0d09514da8377ee32e';
constants.GATEKEEPER_URL = "https://stackedit-gatekeeper.herokuapp.com/"; constants.GATEKEEPER_URL = "https://stackedit-gatekeeper.herokuapp.com/";
constants.TUMBLR_PROXY_URL = "https://stackedit-tumblr-proxy.herokuapp.com/"; constants.TUMBLR_PROXY_URL = "https://stackedit-tumblr-proxy.herokuapp.com/";
constants.WORDPRESS_CLIENT_ID = '3185'; constants.WORDPRESS_CLIENT_ID = '3185';
constants.WORDPRESS_PROXY_URL = "https://stackedit-wordpress-proxy.herokuapp.com/"; constants.WORDPRESS_PROXY_URL = "https://stackedit-wordpress-proxy.herokuapp.com/";
} }
else if(location.hostname.indexOf("stackedit-beta.herokuapp.com") === 0) { else if(location.hostname.indexOf("stackedit-beta.herokuapp.com") === 0) {
constants.BASE_URL = 'https://stackedit-beta.herokuapp.com/'; constants.BASE_URL = 'https://stackedit-beta.herokuapp.com/';
constants.GOOGLE_CLIENT_ID = '241271498917-9bbplknkt0ljv5gaudhoiogp13hd18be.apps.googleusercontent.com'; constants.GOOGLE_CLIENT_ID = '241271498917-9bbplknkt0ljv5gaudhoiogp13hd18be.apps.googleusercontent.com';
constants.GITHUB_CLIENT_ID = 'e9034ae191c3a8a1c5ed'; constants.GITHUB_CLIENT_ID = 'e9034ae191c3a8a1c5ed';
constants.GATEKEEPER_URL = "https://stackedit-beta-gatekeeper.herokuapp.com/"; constants.GATEKEEPER_URL = "https://stackedit-beta-gatekeeper.herokuapp.com/";
constants.TUMBLR_PROXY_URL = "https://stackedit-beta-tumblr-proxy.herokuapp.com/"; constants.TUMBLR_PROXY_URL = "https://stackedit-beta-tumblr-proxy.herokuapp.com/";
constants.WORDPRESS_CLIENT_ID = '34786'; constants.WORDPRESS_CLIENT_ID = '34786';
constants.WORDPRESS_PROXY_URL = "https://stackedit-beta-wordpress-proxy.herokuapp.com/"; constants.WORDPRESS_PROXY_URL = "https://stackedit-beta-wordpress-proxy.herokuapp.com/";
} }
else if(location.hostname.indexOf("benweet.insomnia247.nl") === 0) { else if(location.hostname.indexOf("benweet.insomnia247.nl") === 0) {
constants.BASE_URL = "http://benweet.insomnia247.nl/stackedit/"; constants.BASE_URL = "http://benweet.insomnia247.nl/stackedit/";
constants.GOOGLE_CLIENT_ID = '241271498917-52hae7a08hv7ltenv7km8h7lghno9sk3.apps.googleusercontent.com'; constants.GOOGLE_CLIENT_ID = '241271498917-52hae7a08hv7ltenv7km8h7lghno9sk3.apps.googleusercontent.com';
constants.GITHUB_CLIENT_ID = 'd2943d6074b2d9c4a830'; constants.GITHUB_CLIENT_ID = 'd2943d6074b2d9c4a830';
constants.GATEKEEPER_URL = "https://stackedit-gatekeeper-insomnia.herokuapp.com/"; constants.GATEKEEPER_URL = "https://stackedit-gatekeeper-insomnia.herokuapp.com/";
constants.TUMBLR_PROXY_URL = "https://stackedit-tumblr-proxy-beta.herokuapp.com/"; constants.TUMBLR_PROXY_URL = "https://stackedit-tumblr-proxy-beta.herokuapp.com/";
} }
constants.THEME_LIST = { constants.THEME_LIST = {
"default": "Default", "blue": "Blue",
"gray": "Gray", "default": "Default",
"night": "Night", "gray": "Gray",
"school": "School", "night": "Night",
}; "school": "School"
};
return constants; return constants;
}); });

View File

@ -246,10 +246,10 @@ define([
// Selection dropdown menu actions // Selection dropdown menu actions
$(modalElt.querySelectorAll('.action-select-all')).click(function() { $(modalElt.querySelectorAll('.action-select-all')).click(function() {
$(documentListElt.querySelectorAll('input[type="checkbox"]')).prop('checked', true).change(); $(documentListElt.querySelectorAll('.folder input[type="checkbox"]')).prop('checked', true).change();
}); });
$(modalElt.querySelectorAll('.action-unselect-all')).click(function() { $(modalElt.querySelectorAll('.action-unselect-all')).click(function() {
$(documentListElt.querySelectorAll('input[type="checkbox"]')).prop('checked', false).change(); $(documentListElt.querySelectorAll('.folder input[type="checkbox"]')).prop('checked', false).change();
}); });
// Delete selection actions // Delete selection actions

View File

@ -231,11 +231,11 @@ define([
$('.extension-preview-buttons .table-of-contents').on('click', 'a', function(evt) { $('.extension-preview-buttons .table-of-contents').on('click', 'a', function(evt) {
evt.preventDefault(); evt.preventDefault();
var id = this.hash; var id = this.hash;
var anchorElt = previewElt.querySelector(id); var anchorElt = $(id);
if(!anchorElt) { if(!anchorElt.length) {
return; return;
} }
var previewScrollTop = anchorElt.getBoundingClientRect().top - previewElt.getBoundingClientRect().top + previewElt.scrollTop; var previewScrollTop = anchorElt[0].getBoundingClientRect().top - previewElt.getBoundingClientRect().top + previewElt.scrollTop;
previewElt.scrollTop = previewScrollTop; previewElt.scrollTop = previewScrollTop;
var editorScrollTop = getDestScrollTop(previewScrollTop, htmlSectionList, mdSectionList); var editorScrollTop = getDestScrollTop(previewScrollTop, htmlSectionList, mdSectionList);
editorElt.scrollTop = editorScrollTop; editorElt.scrollTop = editorScrollTop;

View File

@ -862,7 +862,7 @@
"<span class="file-title"></span>" can be shared using the following link(s): "<span class="file-title"></span>" can be shared using the following link(s):
</p> </p>
<div class="msg-share-list share-list hide"></div> <div class="msg-share-list share-list hide"></div>
<p class="msg-no-share hide"><b>No sharing link yet!</b> <p class="msg-no-share hide alert alert-danger"><b>No sharing link yet!</b>
</p> </p>
<p class="msg-no-share hide">To collaborate on this document, use <i class="icon-provider-gdrive"></i> <b>Google Drive</b> <p class="msg-no-share hide">To collaborate on this document, use <i class="icon-provider-gdrive"></i> <b>Google Drive</b>
or <i class="icon-provider-dropbox"></i> <b>Dropbox</b> synchronization from the <i class="icon-provider-stackedit"></i> menu. or <i class="icon-provider-dropbox"></i> <b>Dropbox</b> synchronization from the <i class="icon-provider-stackedit"></i> menu.
@ -1157,30 +1157,30 @@
</div> </div>
<div class="tab-pane" id="tabpane-settings-utils"> <div class="tab-pane" id="tabpane-settings-utils">
<div class="tab-pane-button-container"> <div class="tab-pane-button-container">
<a href="#" class="btn btn-block btn-primary action-welcome-file" <a href="#" class="btn btn-block btn-default action-welcome-file"
data-dismiss="modal"><i class="icon-help-circled"></i> data-dismiss="modal"><i class="icon-help-circled"></i>
Welcome document</a> <a href="#" Welcome document</a> <a href="#"
class="btn btn-block btn-primary action-welcome-tour" class="btn btn-block btn-default action-welcome-tour"
data-dismiss="modal"><i data-dismiss="modal"><i
class="icon-help-circled"></i> Welcome tour</a> class="icon-help-circled"></i> Welcome tour</a>
</div> </div>
<div class="tab-pane-button-container"> <div class="tab-pane-button-container">
<a href="#" <a href="#"
class="btn btn-block btn-primary action-import-docs-settings"><i class="btn btn-block btn-default action-import-docs-settings"><i
class="icon-cog-alt"></i> Import docs & settings</a> <a href="#" class="icon-cog-alt"></i> Import docs & settings</a> <a href="#"
class="btn btn-block btn-primary action-export-docs-settings" class="btn btn-block btn-default action-export-docs-settings"
data-dismiss="modal"><i class="icon-cog-alt"></i> data-dismiss="modal"><i class="icon-cog-alt"></i>
Export docs & settings</a> <input type="file" Export docs & settings</a> <input type="file"
id="input-file-import-docs-settings" class="hide"> id="input-file-import-docs-settings" class="hide">
</div> </div>
<div class="tab-pane-button-container"> <div class="tab-pane-button-container">
<a href="#" <a href="#"
class="btn btn-block btn-primary action-default-settings" class="btn btn-block btn-default action-default-settings"
data-dismiss="modal"><i class="icon-wrench"></i> data-dismiss="modal"><i class="icon-wrench"></i>
Load default settings</a> <a href="#" class="btn btn-block btn-primary" Load default settings</a> <a href="#" class="btn btn-block btn-default"
data-dismiss="modal" data-toggle="modal" data-dismiss="modal" data-toggle="modal"
data-target=".modal-app-reset"><i data-target=".modal-app-reset"><i
class="icon-fire"></i> Reset application</a> <a target="_blank" href="recovery.html" class="btn btn-block btn-primary"><i class="icon-fire"></i> Reset application</a> <a target="_blank" href="recovery.html" class="btn btn-block btn-default"><i
class="icon-medkit"></i> StackEdit recovery</a> class="icon-medkit"></i> StackEdit recovery</a>
</div> </div>
</div> </div>

View File

@ -2,8 +2,7 @@
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<img data-stackedit-src="logo-promo-128.png" width="316" <img height="64" data-stackedit-src="logo.svg" />
height="64" />
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="pull-right"> <div class="pull-right">
@ -40,23 +39,9 @@
</dd> </dd>
</dl> </dl>
<dl> <dl>
<dt>Credit:</dt> <dt>Sponsorship:</dt>
<dd> <dd>
<% _.each(libraries, function(url, name) { %> <a target="_blank" <a href="#" class="sponsorship-button"><img height="32" data-stackedit-src="button.svg" /></a>
href="<%= url %>"><%= name %></a><br /> <% }); %>
</dd>
</dl>
<dl>
<dt>Related projects:</dt>
<dd>
<% _.each(projects, function(url, name) { %> <a target="_blank"
href="<%= url %>"><%= name %></a><br /> <% }); %>
</dd>
</dl>
<dl>
<dt>Support StackEdit:</dt>
<dd>
<a target="_blank" href="https://www.gittip.com/stackedit/"><img class="btn-gittip" data-stackedit-src="gittip.png" /></a>
</dd> </dd>
</dl> </dl>
<p> <p>

View File

@ -10,7 +10,7 @@
<p> <p>
<b>AutoSync</b> feature automatically saves all documents to your <i <b>AutoSync</b> feature automatically saves all documents to your <i
class="icon-provider-<%= providerId %>"></i> class="icon-provider-<%= providerId %>"></i>
<code>Google Drive</code> <b>Google Drive</b>
account and keep them synchronized. account and keep them synchronized.
</p> </p>
<div class="form-horizontal"> <div class="form-horizontal">

View File

@ -10,7 +10,7 @@
<p> <p>
This will save "<span class="file-title"></span>" to your <i This will save "<span class="file-title"></span>" to your <i
class="icon-provider-<%= providerId %>"></i> class="icon-provider-<%= providerId %>"></i>
<code>Google Drive</code> <b>Google Drive</b>
account and keep it synchronized. account and keep it synchronized.
</p> </p>
<div class="collapse form-horizontal sync-export-<%= providerId %>-options-collapse"> <div class="collapse form-horizontal sync-export-<%= providerId %>-options-collapse">

View File

@ -620,6 +620,7 @@ define([
previewButtons.isOpen = true; previewButtons.isOpen = true;
previewButtons.x = previewButtonsOffset.x; previewButtons.x = previewButtonsOffset.x;
previewButtons.applyCss(); previewButtons.applyCss();
previewButtons.$elt.removeClass('closed');
} }
} }
@ -633,6 +634,7 @@ define([
previewButtons.isOpen = false; previewButtons.isOpen = false;
previewButtons.x = previewButtonsOffset.x + previewButtons.elt.offsetWidth + previewButtonsClosedOffset; previewButtons.x = previewButtonsOffset.x + previewButtons.elt.offsetWidth + previewButtonsClosedOffset;
previewButtons.applyCss(); previewButtons.applyCss();
previewButtons.$elt.addClass('closed');
} }
}, 3000); }, 3000);
} }

View File

@ -742,8 +742,9 @@
inputArea.focus(); inputArea.focus();
inputArea.selectionStart = stateObj.start; inputArea.selectionStart = stateObj.start;
inputArea.selectionEnd = stateObj.end; inputArea.selectionEnd = stateObj.end;
/*
inputArea.scrollTop = stateObj.scrollTop; inputArea.scrollTop = stateObj.scrollTop;
/*
} }
else if (doc.selection) { else if (doc.selection) {
@ -815,9 +816,11 @@
inputArea.value = stateObj.text; inputArea.value = stateObj.text;
} }
this.setInputAreaSelection(); this.setInputAreaSelection();
/*
setTimeout(function() { setTimeout(function() {
inputArea.scrollTop = stateObj.scrollTop; inputArea.scrollTop = stateObj.scrollTop;
}, 0); }, 0);
*/
}; };
// Gets a collection of HTML chunks from the inptut textarea. // Gets a collection of HTML chunks from the inptut textarea.
@ -1405,11 +1408,10 @@
if (!noCleanup) { if (!noCleanup) {
fixupInputArea(); fixupInputArea();
/*
if(!linkOrImage) { if(!linkOrImage) {
inputBox.dispatchEvent(new Event('keydown')); inputBox.adjustCursorPosition();
//inputBox.dispatchEvent(new Event('keydown'));
} }
*/
} }
} }

View File

@ -294,15 +294,15 @@ Prism.languages.md = (function() {
link: md.link, link: md.link,
imgref: md.imgref, imgref: md.imgref,
linkref: md.linkref, linkref: md.linkref,
url: urlPattern,
email: emailPattern,
strong: md.strong, strong: md.strong,
em: md.em, em: md.em,
strike: md.strike, strike: md.strike,
conflict: //g, conflict: //g,
comment: Prism.languages.markup.comment, comment: Prism.languages.markup.comment,
tag: Prism.languages.markup.tag, tag: Prism.languages.markup.tag,
entity: Prism.languages.markup.entity, entity: Prism.languages.markup.entity
url: urlPattern,
email: emailPattern
}; };
for(var c = 6; c >= 1; c--) { for(var c = 6; c >= 1; c--) {