Fixed discussion merge

This commit is contained in:
benweet 2014-04-21 16:36:22 +01:00
parent fd6d2db25f
commit 88bfbf14be
17 changed files with 158 additions and 221 deletions

1
.gitignore vendored
View File

@ -2,4 +2,5 @@
.settings .settings
node_modules node_modules
Thumbs.db Thumbs.db
.DS_Store
public/res/bower-libs public/res/bower-libs

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
Welcome to StackEdit! {#welcome} Welcome to StackEdit! {#welcome}
===================== ====================
Hello, I am your first Markdown document within **StackEdit**[^stackedit]. Don't delete me, I can be helpful. I can be recovered anyway in the `Utils` tab of the <i class="icon-cog"></i> `Settings` dialog. Hello, I am your first Markdown document within **StackEdit**[^stackedit]. Don't delete me, I can be helpful. I can be recovered anyway in the `Utils` tab of the <i class="icon-cog"></i> `Settings` dialog.
@ -8,23 +8,23 @@ Hello, I am your first Markdown document within **StackEdit**[^stackedit]. Don't
Documents Documents
--------- --------------
**StackEdit** stores your documents in your browser, which means all your documents are automatically saved locally and are accessible **offline!** **StackEdit** stores your documents in your browser, which means all your documents are automatically saved locally and are accessible **offline!**
> **NOTE:** > **Note:**
>
> - StackEdit is accessible offline after the application has been loaded for the first time. > - StackEdit is accessible offline after the application has been loaded for the first time.
> - Your local documents are not shared between different browsers or computers. > - Your local documents are not shared between different browsers or computers.
> - Clearing your browser's data may **delete all your local documents!** Make sure your documents are backed up using **Google Drive** or **Dropbox** synchronization (see [<i class="icon-share"></i> Synchronization](#synchronization) section). > - Clearing your browser's data may **delete all your local documents!** Make sure your documents are backed up using **Google Drive** or **Dropbox** synchronization (see [<i class="icon-refresh"></i> Synchronization](#synchronization) section).
#### <i class="icon-file"></i> Create a document #### <i class="icon-file"></i> Create a document
You can create a new document by clicking the <i class="icon-file"></i> button in the navigation bar. It will switch from the current document to the new one. The document panel is accessible using <i class="icon-folder-open"></i> button in the navigation bar. You can create a new document by clicking the <i class="icon-file"></i> `New document` sub-menu in the document panel.
#### <i class="icon-folder-open"></i> Switch to another document #### <i class="icon-folder-open"></i> Switch to another document
You can list all your local documents and switch from one to another by clicking the <i class="icon-folder-open"></i> button in the navigation bar. All your local documents are listed in the document panel. You can switch from one to another by clicking a document in the document panel or you can also use <kbd>Ctrl+[</kbd> and <kbd>Ctrl+]</kbd> to toggle documents by most recently used.
#### <i class="icon-pencil"></i> Rename a document #### <i class="icon-pencil"></i> Rename a document
@ -32,88 +32,86 @@ You can rename the current document by clicking the document title in the naviga
#### <i class="icon-trash"></i> Delete a document #### <i class="icon-trash"></i> Delete a document
You can delete the current document by clicking the <i class="icon-trash"></i> button in the navigation bar. You can delete the current document by clicking the <i class="icon-trash"></i> `Delete document` sub-menu in the document panel.
#### <i class="icon-hdd"></i> Save a document #### <i class="icon-hdd"></i> Export a document
You can save the current document to a file using the <i class="icon-hdd"></i> `Save as...` sub-menu from the <i class="icon-provider-stackedit"></i> menu. You can save the current document to a file using the <i class="icon-hdd"></i> `Export to disk` sub-menu from the <i class="icon-provider-stackedit"></i> menu panel.
> **Tip:** See [<i class="icon-share"></i> Publish a document](#publish-a-document) section for a description of the different output formats. > **Tip:** See [<i class="icon-upload"></i> Publish a document](#publish-a-document) section for a description of the different output formats.
---------- ----------
Synchronization Synchronization
--------------- --------------------
**StackEdit** can be combined with **Google Drive** and **Dropbox** to have your documents centralized in the *Cloud*. The synchronization mechanism will take care of uploading your modifications or downloading the latest version of your documents. **StackEdit** can be combined with <i class="icon-provider-gdrive"></i> **Google Drive** and <i class="icon-provider-dropbox"></i> **Dropbox** to have your documents centralized in the *Cloud*. The synchronization mechanism will take care of uploading your modifications or downloading the latest version of your documents.
> **NOTE:** > **Note:**
>
> - Full access to **Google Drive** or **Dropbox** is required to be able to import any document in StackEdit. > - Full access to **Google Drive** or **Dropbox** is required to be able to import any document in StackEdit. Permission restrictions can be configured in the settings.
> - Imported documents are downloaded in your browser and are not transmitted to a server. > - Imported documents are downloaded in your browser and are not transmitted to a server.
> - If you experience problems exporting documents to Google Drive, check and optionally disable browser extensions, such as Disconnect. > - If you experience problems saving your documents on Google Drive, check and optionally disable browser extensions, such as Disconnect.
#### <i class="icon-download"></i> Import a document #### <i class="icon-refresh"></i> Open a document
You can import a document from the *Cloud* by going to the <i class="icon-provider-gdrive"></i> `Google Drive` or the <i class="icon-provider-dropbox"></i> `Dropbox` sub-menu and by clicking `Import from...`. Once imported, your document will be automatically synchronized with the **Google Drive** / **Dropbox** file. You can open a document from <i class="icon-provider-gdrive"></i> **Google Drive** or the <i class="icon-provider-dropbox"></i> **Dropbox** by opening the <i class="icon-refresh"></i> `Synchronize` sub-menu and by clicking `Open from...`. Once opened, any modification in your document will be automatically synchronized with the **Google Drive** / **Dropbox** file.
#### <i class="icon-upload"></i> Export a document #### <i class="icon-refresh"></i> Save a document
You can export any document by going to the <i class="icon-provider-gdrive"></i> `Google Drive` or the <i class="icon-provider-dropbox"></i> `Dropbox` sub-menu and by clicking `Export to...`. Even if your document is already synchronized with **Google Drive** or **Dropbox**, you can export it to a another location. **StackEdit** can synchronize one document with multiple locations. You can save any document by opening the <i class="icon-refresh"></i> `Synchronize` sub-menu and by clicking `Save on...`. Even if your document is already synchronized with **Google Drive** or **Dropbox**, you can export it to a another location. **StackEdit** can synchronize one document with multiple locations.
> **Tip:** Using **Google Drive**, you can create collaborative documents to work in real time with other users. Just check the box `Create a real time collaborative document` in the dialog options when exporting to Google Drive.
#### <i class="icon-refresh"></i> Synchronize a document #### <i class="icon-refresh"></i> Synchronize a document
Once your document is linked to a **Google Drive** or a **Dropbox** file, **StackEdit** will periodically (every 3 minutes) synchronize it by downloading/uploading any modification. Any conflict will be detected, and a local copy of your document will be created as a backup if necessary. Once your document is linked to a <i class="icon-provider-gdrive"></i> **Google Drive** or a <i class="icon-provider-dropbox"></i> **Dropbox** file, **StackEdit** will periodically (every 3 minutes) synchronize it by downloading/uploading any modification. Any conflict will be detected, and a local copy of your document will be created as a backup if necessary.
If you just have modified your document and you want to force the synchronization, click the <i class="icon-refresh"></i> button in the navigation bar. If you just have modified your document and you want to force the synchronization, click the <i class="icon-refresh"></i> button in the navigation bar.
> **NOTE:** The <i class="icon-refresh"></i> button is disabled when you have no document to synchronize. > **Note:** The <i class="icon-refresh"></i> button is disabled when you have no document to synchronize.
#### <i class="icon-refresh"></i> Manage document synchronization #### <i class="icon-refresh"></i> Manage document synchronization
Since one document can be synchronized with multiple locations, you can list and manage synchronized locations by clicking <i class="icon-refresh"></i> `Manage synchronization` in the <i class="icon-provider-stackedit"></i> menu. This will open a dialog box allowing you to add or remove synchronization links that are associated to your document. Since one document can be synchronized with multiple locations, you can list and manage synchronized locations by clicking <i class="icon-refresh"></i> `Manage synchronization` in the <i class="icon-refresh"></i> `Synchronize` sub-menu. This will let you remove synchronization locations that are associated to your document.
> **NOTE:** If you delete the file from **Google Drive** or from **Dropbox**, the document will no longer be synchronized with that location. > **Note:** If you delete the file from **Google Drive** or from **Dropbox**, the document will no longer be synchronized with that location.
---------- ----------
Publication Publication
----------- --------------
Once you are happy with your document, you can publish it on different websites directly from **StackEdit**. As for now, **StackEdit** can publish on **Blogger**, **Dropbox**, **Gist**, **GitHub**, **Google Drive**, **Tumblr**, **WordPress** and on any SSH server. Once you are happy with your document, you can publish it on different websites directly from **StackEdit**. As for now, **StackEdit** can publish on **Blogger**, **Dropbox**, **Gist**, **GitHub**, **Google Drive**, **Tumblr**, **WordPress** and on any SSH server.
#### <i class="icon-share"></i> Publish a document #### <i class="icon-upload"></i> Publish a document
You can publish your document by going to the <i class="icon-share"></i> `Publish on` sub-menu and by choosing a website. In the dialog box, you can choose the publication format: You can publish your document by opening the <i class="icon-upload"></i> `Publish` sub-menu and by choosing a website. In the dialog box, you can choose the publication format:
- Markdown, to publish the Markdown text on a website that can interpret it (**GitHub** for instance), - Markdown, to publish the Markdown text on a website that can interpret it (**GitHub** for example),
- HTML, to publish the document converted into HTML (on a blog for instance), - HTML, to publish the document converted into HTML (on a blog for example),
- Template, to have a full control of the output. - Template, to have a full control of the output.
> **NOTE:** The default template is a simple webpage wrapping your document in HTML format. You can customize it in the `Services` tab of the <i class="icon-cog"></i> `Settings` dialog. > **Note:** The default template is a simple webpage wrapping your document in HTML format. You can customize it in the `Advanced` tab of the <i class="icon-cog"></i> `Settings` dialog.
#### <i class="icon-share"></i> Update a publication #### <i class="icon-upload"></i> Update a publication
After publishing, **StackEdit** will keep your document linked to that publish location so that you can update it easily. Once you have modified your document and you want to update your publication, click on the <i class="icon-share"></i> button in the navigation bar. After publishing, **StackEdit** will keep your document linked to that publication which makes it easy for you to update it. Once you have modified your document and you want to update your publication, click on the <i class="icon-upload"></i> button in the navigation bar.
> **NOTE:** The <i class="icon-share"></i> button is disabled when the document has not been published yet. > **Note:** The <i class="icon-upload"></i> button is disabled when your document has not been published yet.
#### <i class="icon-share"></i> Manage document publication #### <i class="icon-upload"></i> Manage document publication
Since one document can be published on multiple locations, you can list and manage publish locations by clicking <i class="icon-share"></i> `Manage publication` in the <i class="icon-provider-stackedit"></i> menu. This will open a dialog box allowing you to remove publication links that are associated to your document. Since one document can be published on multiple locations, you can list and manage publish locations by clicking <i class="icon-upload"></i> `Manage publication` in the <i class="icon-provider-stackedit"></i> menu. This will let you remove publication locations that are associated to your document.
> **NOTE:** In some cases, if the file has been removed from the website or the blog, the document will no longer be published on that location. > **Note:** In some cases, if the file has been removed from the website or the blog, the document will no longer be published on that location.
---------- ----------
Markdown Extra Markdown Extra
-------------- --------------------
**StackEdit** supports **Markdown Extra**, which extends **Markdown** syntax with some nice features. **StackEdit** supports **Markdown Extra**, which extends **Markdown** syntax with some nice features.
@ -124,19 +122,19 @@ Markdown Extra
**Markdown Extra** has a special syntax for tables: **Markdown Extra** has a special syntax for tables:
Item | Value Item | Value
--------- | ----- --- | ---
Computer | 1600 USD Computer | $1600
Phone | 12 USD Phone | $12
Pipe | 1 USD Pipe | $1
You can specify column alignment with one or two colons: You can specify column alignment with one or two colons:
| Item | Value | Qty | | Item | Value | Qty |
| :-------- | --------:| :--: | | :--- | ---: | :---: |
| Computer | 1600 USD | 5 | | Computer | $1600 | 5 |
| Phone | 12 USD | 12 | | Phone | $12 | 12 |
| Pipe | 1 USD | 234 | | Pipe | $1 | 234 |
### Definition Lists ### Definition Lists
@ -180,11 +178,11 @@ You can create footnotes like this[^footnote].
SmartyPants converts ASCII punctuation characters into "smart" typographic punctuation HTML entities. For example: SmartyPants converts ASCII punctuation characters into "smart" typographic punctuation HTML entities. For example:
| | ASCII | HTML | | | ASCII | HTML |
------------------|------------------------------------------|------------------------------------- ---|---|---
| Single backticks | `'Isn't this fun?'` | &#8216;Isn&#8217;t this fun?&#8217; | | Single backticks | `'Isn't this fun?'` | 'Isn't this fun?' |
| Quotes | `"Isn't this fun?"` | &#8220;Isn&#8217;t this fun?&#8221; | | Quotes | `"Isn't this fun?"` | "Isn't this fun?" |
| Dashes | `-- is an en-dash and --- is an em-dash` | &#8211; is an en-dash and &#8212; is an em-dash | | Dashes | `-- is en-dash, --- is em-dash` | -- is en-dash, --- is em-dash |
### Table of contents ### Table of contents
@ -194,31 +192,24 @@ You can insert a table of contents using the marker `[TOC]`:
[TOC] [TOC]
### Comments
Usually, comments in Markdown are just standard HTML comments. <!-- like this -->
**StackEdit** extends HTML comments in order to produce useful, highlighted comments in the preview but not in your exported documents. <!--- This is very useful for collecting feedback in a collaborative document. -->
### MathJax ### MathJax
You can render *LaTeX* mathematical expressions using **MathJax**, as on [math.stackexchange.com][1]: You can render *LaTeX* mathematical expressions using **MathJax**, as on [math.stackexchange.com][1]:
The *Gamma function* satisfying $\Gamma(n) = (n-1)!\quad\forall The *Gamma function* satisfying $\Gamma(n) = (n-1)!\quad\forall n\in\mathbb N$ is via the Euler integral
n\in\mathbb N$ is via the Euler integral
$$ $$
\Gamma(z) = \int_0^\infty t^{z-1}e^{-t}dt\,. \Gamma(z) = \int_0^\infty t^{z-1}e^{-t}dt\,.
$$ $$
> **Tip:** Make sure you include MathJax into your publications to render mathematical expression correctly. Your page/template should include something like: > **Tip:** Make sure you include **MathJax** into your publications to render mathematical expression correctly. Your page/template should include something like:
``` ```
<script type="text/javascript" src="https://stackedit.io/libs/MathJax/MathJax.js?config=TeX-AMS_HTML"></script> <script type="text/javascript" src="https://stackedit.io/libs/MathJax/MathJax.js?config=TeX-AMS_HTML"></script>
``` ```
> **NOTE:** You can find more information: > **NOTE:** You can find more information:
>
> - about **Markdown** syntax [here][2], > - about **Markdown** syntax [here][2],
> - about **Markdown Extra** extension [here][3], > - about **Markdown Extra** extension [here][3],
> - about **LaTeX** mathematical expressions [here][4], > - about **LaTeX** mathematical expressions [here][4],
@ -235,4 +226,4 @@ $$
[3]: https://github.com/jmcmanus/pagedown-extra "Pagedown Extra" [3]: https://github.com/jmcmanus/pagedown-extra "Pagedown Extra"
[4]: http://meta.math.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference [4]: http://meta.math.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference
[5]: https://code.google.com/p/google-code-prettify/ [5]: https://code.google.com/p/google-code-prettify/
[6]: http://highlightjs.org/ [6]: http://highlightjs.org/

View File

@ -504,6 +504,8 @@ define([
if(contentElt.lastChild === trailingLfNode && trailingLfNode.textContent.slice(-1) == '\n') { if(contentElt.lastChild === trailingLfNode && trailingLfNode.textContent.slice(-1) == '\n') {
newTextContent = newTextContent.slice(0, -1); newTextContent = newTextContent.slice(0, -1);
} }
newTextContent = newTextContent.replace(/\r\n/g, '\n'); // DOS to Unix
newTextContent = newTextContent.replace(/\r/g, '\n'); // Mac to Unix
if(fileChanged === false) { if(fileChanged === false) {
if(newTextContent == textContent) { if(newTextContent == textContent) {
@ -533,6 +535,7 @@ define([
} }
else { else {
textContent = newTextContent; textContent = newTextContent;
fileDesc.content = textContent;
selectionMgr.setSelectionStartEnd(fileDesc.editorStart, fileDesc.editorEnd); selectionMgr.setSelectionStartEnd(fileDesc.editorStart, fileDesc.editorEnd);
selectionMgr.saveSelectionState(); selectionMgr.saveSelectionState();
eventMgr.onFileOpen(fileDesc, textContent); eventMgr.onFileOpen(fileDesc, textContent);

View File

@ -19,23 +19,12 @@ define([
var fileDesc; var fileDesc;
var syncListElt; var syncListElt;
var $msgSyncListElt;
var $msgNoSyncElt;
var $showAlreadySynchronizedElt; var $showAlreadySynchronizedElt;
var refreshDialog = function(fileDescParameter) { var refreshDialog = function(fileDescParameter) {
if(fileDescParameter !== undefined && fileDescParameter !== fileDesc) { if(fileDescParameter !== undefined && fileDescParameter !== fileDesc) {
return; return;
} }
if(_.size(fileDesc.syncLocations) > 0) {
$msgSyncListElt.removeClass("hide");
$msgNoSyncElt.addClass("hide");
}
else {
$msgSyncListElt.addClass("hide");
$msgNoSyncElt.removeClass("hide");
}
$showAlreadySynchronizedElt.toggleClass("hide", _.size(fileDesc.syncLocations) === 0); $showAlreadySynchronizedElt.toggleClass("hide", _.size(fileDesc.syncLocations) === 0);
var syncListHtml = _.reduce(fileDesc.syncLocations, function(result, syncAttributes) { var syncListHtml = _.reduce(fileDesc.syncLocations, function(result, syncAttributes) {
@ -67,8 +56,6 @@ define([
dialogManageSynchronization.onReady = function() { dialogManageSynchronization.onReady = function() {
var modalElt = document.querySelector(".modal-manage-sync"); var modalElt = document.querySelector(".modal-manage-sync");
syncListElt = modalElt.querySelector(".sync-list"); syncListElt = modalElt.querySelector(".sync-list");
$msgSyncListElt = $(modalElt.querySelectorAll(".msg-sync-list"));
$msgNoSyncElt = $(modalElt.querySelectorAll(".msg-no-sync"));
$showAlreadySynchronizedElt = $(document.querySelectorAll(".show-already-synchronized")); $showAlreadySynchronizedElt = $(document.querySelectorAll(".show-already-synchronized"));
}; };

View File

@ -105,7 +105,7 @@ define([
'https://www.googleapis.com/auth/blogger' 'https://www.googleapis.com/auth/blogger'
], ],
picasa: [ picasa: [
'https://picasaweb.google.com/data/' 'https://www.googleapis.com/auth/photos'
] ]
}; };
function authenticate(task, permission, accountId) { function authenticate(task, permission, accountId) {

View File

@ -140,6 +140,10 @@
</div> </div>
<div class="list-group"> <div class="list-group">
<a data-toggle="modal"
data-target=".modal-import-harddrive-markdown"
class="list-group-item action-reset-input" href="#"><i
class="icon-hdd"></i> Import from disk</a>
<a href="#" data-toggle="collapse" data-target=".collapse-save-as" <a href="#" data-toggle="collapse" data-target=".collapse-save-as"
class="list-group-item"><i class="icon-hdd"></i> Export to disk</a> class="list-group-item"><i class="icon-hdd"></i> Export to disk</a>
<div class="sub-menu collapse collapse-save-as clearfix"> <div class="sub-menu collapse collapse-save-as clearfix">
@ -155,10 +159,6 @@
</ul> </ul>
</div> </div>
<a data-toggle="modal"
data-target=".modal-import-harddrive-markdown"
class="list-group-item action-reset-input" href="#"><i
class="icon-hdd"></i> Import from disk</a>
<a data-toggle="modal" data-target=".modal-import-url" <a data-toggle="modal" data-target=".modal-import-url"
class="list-group-item action-reset-input" href="#"><i class="list-group-item action-reset-input" href="#"><i
class="icon-globe"></i> Import from URL</a> class="icon-globe"></i> Import from URL</a>
@ -551,24 +551,15 @@
<h2 class="modal-title">Synchronization</h2> <h2 class="modal-title">Synchronization</h2>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p class="msg-sync-list hide"> <p>
"<span class="file-title"></span>" is synchronized with the "<span class="file-title"></span>" is synchronized with the
following location(s): following location(s):
</p> </p>
<div class="msg-sync-list sync-list hide"></div> <div class="sync-list"></div>
<blockquote class="msg-sync-list hide"> <blockquote>
<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>
<p class="msg-no-sync hide">"<span class="file-title"></span>" is not synchronized yet.</p>
<blockquote class="msg-no-sync hide">
<b>Tip:</b> You can add synchronized locations by
exporting your document using <i class="icon-provider-gdrive"></i>
<code>Google Drive</code>
or <i class="icon-provider-dropbox"></i>
<code>Dropbox</code>
sub-menu.
</blockquote>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a href="#" class="btn btn-primary" data-dismiss="modal">Close</a> <a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>
@ -875,8 +866,8 @@
"<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">To collaborate on this document, use <i class="icon-provider-gdrive"></i> <code>Google Drive</code> <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> <code>Dropbox</code> 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.
</p> </p>
<p class="msg-no-share hide">To share a frozen version of this document within StackEdit, just <a <p class="msg-no-share hide">To share a frozen version of this document within StackEdit, just <a
href="#" class="action-publish-gist" data-dismiss="modal">publish it as a Gist</a> in href="#" class="action-publish-gist" data-dismiss="modal">publish it as a Gist</a> in

View File

@ -46,8 +46,22 @@ define([
this.$elt = $(this.elt); this.$elt = $(this.elt);
} }
var laterCssTimeoutId; var transitionEndTimeoutId;
var laterCssQueue = []; var transitionEndCallbacks = [];
function onTransitionEnd(evt) {
if(!evt ||
evt.target === wrapperL1.elt ||
evt.target === wrapperL2.elt ||
evt.target === previewPanel.elt
) {
transitionEndCallbacks.forEach(function(callback) {
callback();
});
endAnimation();
transitionEndCallbacks.length !== 0 && onResize();
transitionEndCallbacks = [];
}
}
DomObject.prototype.applyCss = function() { DomObject.prototype.applyCss = function() {
// Top/left/Bottom/Right // Top/left/Bottom/Right
@ -67,7 +81,7 @@ define([
// Width (deferred when animate if new width is smaller) // Width (deferred when animate if new width is smaller)
if(animate && this.width < this.oldWidth) { if(animate && this.width < this.oldWidth) {
laterCssQueue.push(_.bind(function() { transitionEndCallbacks.push(_.bind(function() {
this.elt.style.width = this.width + 'px'; this.elt.style.width = this.width + 'px';
}, this)); }, this));
} }
@ -78,7 +92,7 @@ define([
// Height (deferred when animate if new height is smaller) // Height (deferred when animate if new height is smaller)
if(animate && this.height < this.oldHeight) { if(animate && this.height < this.oldHeight) {
laterCssQueue.push(_.bind(function() { transitionEndCallbacks.push(_.bind(function() {
this.elt.style.height = this.height + 'px'; this.elt.style.height = this.height + 'px';
}, this)); }, this));
} }
@ -87,15 +101,9 @@ define([
} }
this.oldHeight = this.height; this.oldHeight = this.height;
clearTimeout(laterCssTimeoutId); // Just in case transitionEnd event doesn't happen
laterCssTimeoutId = setTimeout(function() { clearTimeout(transitionEndTimeoutId);
laterCssQueue.forEach(function(callback) { animate && (transitionEndTimeoutId = setTimeout(onTransitionEnd, 800));
callback();
});
endAnimation();
laterCssQueue.length !== 0 && onResize();
laterCssQueue = [];
}, 350);
}; };
DomObject.prototype.createToggler = function(backdrop) { DomObject.prototype.createToggler = function(backdrop) {
@ -114,7 +122,7 @@ define([
}, this)); }, this));
this.$elt.addClass('bring-to-front'); this.$elt.addClass('bring-to-front');
} }
laterCssQueue.push(_.bind(function() { transitionEndCallbacks.push(_.bind(function() {
if(--pushedEvents === 0) { if(--pushedEvents === 0) {
this.isOpen && this.$elt.trigger('shown.layout.toggle'); this.isOpen && this.$elt.trigger('shown.layout.toggle');
} }
@ -124,7 +132,7 @@ define([
this.$elt.trigger('hide.layout.toggle'); this.$elt.trigger('hide.layout.toggle');
backdropElt && backdropElt.removeBackdrop(); backdropElt && backdropElt.removeBackdrop();
backdropElt = undefined; backdropElt = undefined;
laterCssQueue.push(_.bind(function() { transitionEndCallbacks.push(_.bind(function() {
if(--pushedEvents === 0) { if(--pushedEvents === 0) {
!this.isOpen && this.$elt.removeClass('panel-open bring-to-front').trigger('hidden.layout.toggle'); !this.isOpen && this.$elt.removeClass('panel-open bring-to-front').trigger('hidden.layout.toggle');
} }
@ -387,6 +395,7 @@ define([
}); });
wrapperL1.$elt.toggleClass('layout-vertical', isVertical); wrapperL1.$elt.toggleClass('layout-vertical', isVertical);
wrapperL1.$elt.on("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend", onTransitionEnd);
navbar.isOpen = true; navbar.isOpen = true;
navbar.createToggler(); navbar.createToggler();
@ -412,6 +421,11 @@ define([
// Hide panels when clicking on a non collapse element // Hide panels when clicking on a non collapse element
documentPanel.$elt.on('click', 'a[data-toggle!=collapse]', _.bind(documentPanel.toggle, documentPanel, false)); documentPanel.$elt.on('click', 'a[data-toggle!=collapse]', _.bind(documentPanel.toggle, documentPanel, false));
// Focus on editor when document panel is closed
documentPanel.$elt.on('hidden.layout.toggle', function() {
editor.elt.focus();
});
menuPanel.isOpen = false; menuPanel.isOpen = false;
if(!window.viewerMode) { if(!window.viewerMode) {
menuPanel.createToggler(true); menuPanel.createToggler(true);
@ -425,6 +439,11 @@ define([
menuPanel.$elt.find('.in').collapse('hide'); menuPanel.$elt.find('.in').collapse('hide');
}); });
// Focus on editor when menu panel is closed
menuPanel.$elt.on('hidden.layout.toggle', function() {
editor.elt.focus();
});
// Gesture // Gesture
previewResizer.initHammer(true); previewResizer.initHammer(true);
/* /*
@ -509,7 +528,7 @@ define([
}; };
eventMgr.addListener('onReady', function() { eventMgr.addListener('onReady', function() {
previewButtons.width = previewButtons.elt.offsetWidth; var previewButtonsWidth = previewButtons.elt.offsetWidth;
function openPreviewButtons() { function openPreviewButtons() {
clearTimeout(closeTimeoutId); clearTimeout(closeTimeoutId);
previewButtons.x = 0; previewButtons.x = 0;
@ -521,7 +540,7 @@ define([
clearTimeout(closeTimeoutId); clearTimeout(closeTimeoutId);
closeTimeoutId = setTimeout(function() { closeTimeoutId = setTimeout(function() {
if(!dropdownOpen) { if(!dropdownOpen) {
previewButtons.x = previewButtons.width; previewButtons.x = previewButtonsWidth;
previewButtons.applyCss(); previewButtons.applyCss();
} }
}, 3000); }, 3000);
@ -542,7 +561,7 @@ define([
$btnGroupElt.click(function() { $btnGroupElt.click(function() {
// 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: -previewButtons.width + $btnGroupElt.width() + $btnGroupElt.position().left right: -previewButtonsWidth + $btnGroupElt.width() + $btnGroupElt.position().left
}); });
$btnGroupElt.find('.markdown-syntax, .table-of-contents').css({ $btnGroupElt.find('.markdown-syntax, .table-of-contents').css({
'maxHeight': wrapperL3.height - 180 'maxHeight': wrapperL3.height - 180

View File

@ -176,7 +176,7 @@ define([
callback(error); callback(error);
return; return;
} }
function merge() { function mergeChange() {
if(changes.length === 0) { if(changes.length === 0) {
storage[PROVIDER_DROPBOX + ".lastChangeId"] = newChangeId; storage[PROVIDER_DROPBOX + ".lastChangeId"] = newChangeId;
return callback(); return callback();
@ -206,9 +206,9 @@ define([
syncAttributes.contentCRC = remoteCRC.contentCRC; syncAttributes.contentCRC = remoteCRC.contentCRC;
syncAttributes.discussionListCRC = remoteCRC.discussionListCRC; syncAttributes.discussionListCRC = remoteCRC.discussionListCRC;
utils.storeAttributes(syncAttributes); utils.storeAttributes(syncAttributes);
setTimeout(merge, 5); setTimeout(mergeChange, 5);
} }
setTimeout(merge, 5); setTimeout(mergeChange, 5);
}); });
}); });
}; };

View File

@ -148,7 +148,7 @@ define([
return; return;
} }
syncAttributes.etag = result.etag; syncAttributes.etag = result.etag;
// Remove this deprecated flag if exist // Remove this deprecated flag if any
delete syncAttributes.isRealtime; delete syncAttributes.isRealtime;
if(merge === true) { if(merge === true) {
// Need to store the whole content for merge // Need to store the whole content for merge
@ -196,7 +196,7 @@ define([
callback(error); callback(error);
return; return;
} }
function merge() { function mergeChange() {
if(changes.length === 0) { if(changes.length === 0) {
storage[accountId + ".gdrive.lastChangeId"] = newChangeId; storage[accountId + ".gdrive.lastChangeId"] = newChangeId;
return callback(); return callback();
@ -230,9 +230,9 @@ define([
syncAttributes.titleCRC = remoteCRC.titleCRC; syncAttributes.titleCRC = remoteCRC.titleCRC;
syncAttributes.discussionListCRC = remoteCRC.discussionListCRC; syncAttributes.discussionListCRC = remoteCRC.discussionListCRC;
utils.storeAttributes(syncAttributes); utils.storeAttributes(syncAttributes);
setTimeout(merge, 5); setTimeout(mergeChange, 5);
} }
setTimeout(merge, 5); setTimeout(mergeChange, 5);
}); });
}); });
}; };

View File

@ -217,6 +217,8 @@ define([
localStorage.removeItem('focusMode'); localStorage.removeItem('focusMode');
localStorage.removeItem('mode'); localStorage.removeItem('mode');
localStorage.removeItem('gdrive.state'); localStorage.removeItem('gdrive.state');
localStorage.removeItem('google.picasa0.permissions');
localStorage.removeItem('google.picasa0.userId');
if(_.has(localStorage, 'settings')) { if(_.has(localStorage, 'settings')) {
settings = JSON.parse(localStorage.settings); settings = JSON.parse(localStorage.settings);
delete settings.shortcuts; delete settings.shortcuts;

View File

@ -69,47 +69,8 @@
src: local('Source Code Pro Bold'), local('SourceCodePro-Bold'), url("../font/SourceCodePro-Bold-webfont.woff") format('woff'); src: local('Source Code Pro Bold'), local('SourceCodePro-Bold'), url("../font/SourceCodePro-Bold-webfont.woff") format('woff');
} }
@font-face {
font-family: 'Inconsolata';
font-style: normal;
font-weight: 400;
src: local('Inconsolata'), url("../font/Inconsolata-Regular-webfont.woff") format('woff');
}
@font-face {
font-family: 'Inconsolata';
font-style: normal;
font-weight: 700;
src: local('Inconsolata Bold'), local('Inconsolata-Bold'), url("../font/Inconsolata-Bold-webfont.woff") format('woff');
}
@font-face {
font-family: 'Anonymous Pro';
font-style: normal;
font-weight: 400;
src: local('Anonymous Pro'), local('AnonymousPro'), url("../font/AnonymousPro-Regular-webfont.woff") format('woff');
}
@font-face {
font-family: 'Anonymous Pro';
font-style: normal;
font-weight: 700;
src: local('Anonymous Pro Bold'), local('AnonymousPro-Bold'), url("../font/AnonymousPro-Bold-webfont.woff") format('woff');
}
@font-face {
font-family: 'Anonymous Pro';
font-style: italic;
font-weight: 400;
src: local('Anonymous Pro Italic'), local('AnonymousPro-Italic'), url("../font/AnonymousPro-Italic-webfont.woff") format('woff');
}
@font-face {
font-family: 'Anonymous Pro';
font-style: italic;
font-weight: 700;
src: local('Anonymous Pro Bold Italic'), local('AnonymousPro-BoldItalic'), url("../font/AnonymousPro-BoldItalic-webfont.woff") format('woff');
}
@font-family-sans-serif: "Source Sans Pro", sans-serif; @font-family-sans-serif: "Source Sans Pro", sans-serif;
@font-family-monospace: "Source Code Pro", monospace; @font-family-monospace: "Source Code Pro", monospace;
@font-family-monospace-letter-spacing: -0.02em;
// Copied from Bootstrap in order to have correct urls // Copied from Bootstrap in order to have correct urls
.img-retina(@file-1x; @file-2x; @width-1x; @height-1x) { .img-retina(@file-1x; @file-2x; @width-1x; @height-1x) {
@ -163,8 +124,7 @@ hr {
code, pre { code, pre {
font-family: @font-family-monospace; font-family: @font-family-monospace;
letter-spacing: @font-family-monospace-letter-spacing; font-size: 0.9em;
font-size: 0.9em;
} }
pre, pre.prettyprint { pre, pre.prettyprint {
@ -248,7 +208,7 @@ kbd {
padding: 0.1em 0.6em; padding: 0.1em 0.6em;
border: 1px solid @kbd-border-color; border: 1px solid @kbd-border-color;
.box-shadow(0 1px 0px @kbd-border-color); .box-shadow(0 1px 0px @kbd-border-color);
font-size: 11px; font-size: 0.7em;
font-family: Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
background-color: @kbd-bg-color; background-color: @kbd-bg-color;
color: @kbd-color; color: @kbd-color;

View File

@ -1020,58 +1020,6 @@ a {
} }
.ui-layout-resizer {
overflow: visible !important;
font-size: 14px !important;
.btn {
float: none;
}
.ui-layout-toggler {
i {
font-size: 22px;
}
&.ui-layout-toggler-east {
line-height: 55px;
&.ui-layout-toggler-east-open i:before {
content: '\e87e';
}
&.ui-layout-toggler-east-closed i:before {
content: '\e87d';
}
}
&.ui-layout-toggler-south {
&.ui-layout-toggler-south-open i:before {
content: '\e880';
}
&.ui-layout-toggler-south-closed i:before {
content: '\e87f';
}
}
&.ui-layout-toggler-north {
left: 0 !important;
line-height: 0;
i {
font-size: 16px;
height: 10.5px;
overflow: hidden;
}
}
}
&.ui-layout-resizer-east .ui-layout-toggler-north {
width: @resizer-size !important;
height: 60px !important;
}
&.ui-layout-resizer-south .ui-layout-toggler-north {
height: @resizer-size !important;
}
}
.ui-layout-resizer-north {
background-color: @navbar-default-bg;
border-bottom: 1px solid @primary-border-color;
}
/***************************** /*****************************
* Editor * Editor
*****************************/ *****************************/
@ -1612,3 +1560,38 @@ div.jGrowl {
.box-shadow(none); .box-shadow(none);
} }
} }
/**************************************
* Only show preview pane to printer
**************************************/
@media print {
html, body {
overflow: visible !important;
}
.layout-wrapper-l1 > *,
.layout-wrapper-l2 > *,
.layout-wrapper-l3 > *,
.preview-panel > * {
display: none !important;
}
.layout-wrapper-l1,
.layout-wrapper-l2,
.layout-wrapper-l3,
.preview-panel,
.preview-container {
display: block !important;
position: static !important;
overflow: visible !important;
width: auto !important;
height: auto !important;
.translate(0, 0) !important;
}
#preview-contents {
padding: 0 50px !important;
}
}