2013-06-10 17:54:41 +00:00
Developer guide
===============
2013-09-03 15:00:12 +00:00
Getting started
---------------
2013-06-10 17:54:41 +00:00
2013-11-21 00:15:08 +00:00
### Pre-requisites
2013-06-12 22:58:58 +00:00
2013-09-03 15:00:12 +00:00
- [Git][1]
- [node.js/npm][2]
2014-09-06 12:48:38 +00:00
- [Gulp][3]
2013-09-03 15:00:12 +00:00
- [Bower][4]
2013-06-12 22:58:58 +00:00
2013-11-21 00:15:08 +00:00
### Before debugging
2013-09-03 15:00:12 +00:00
2013-09-15 23:14:58 +00:00
- Download development tools:
npm install
- Download dependencies:
2013-09-03 15:00:12 +00:00
bower install
2015-04-17 16:02:02 +00:00
- Serve **StackEdit** at `http://localhost/` :
2013-09-03 15:00:12 +00:00
2013-11-21 00:15:08 +00:00
(export PORT=80 & & node server.js)
2015-04-17 16:02:02 +00:00
If on Windows, use
(set PORT=80 & & node server.js)
2014-08-31 19:51:13 +00:00
- Run **StackEdit** in debug mode (no application cache, serve original files instead of minified):
2013-09-03 15:00:12 +00:00
2013-10-17 20:54:33 +00:00
http://localhost/?debug
2013-09-03 15:00:12 +00:00
2013-11-21 00:15:08 +00:00
### Add new dependencies
2013-09-03 15:00:12 +00:00
2013-11-21 00:15:08 +00:00
> **NOTE:** StackEdit uses [RequireJS][5] for asynchronous module definition ([AMD][6]).
2013-09-03 15:00:12 +00:00
2013-10-17 20:54:33 +00:00
- Install new dependencies using [Bower][7]:
2013-06-10 17:54:41 +00:00
2013-09-03 15:00:12 +00:00
bower install < library > --save
2013-06-10 17:54:41 +00:00
2013-10-17 20:54:33 +00:00
- Add the new dependency to [RequireJS][8] configuration file (`main.js`):
2013-06-10 17:54:41 +00:00
2014-08-31 19:51:13 +00:00
gulp bower-requirejs
2013-09-03 15:00:12 +00:00
2013-11-21 00:15:08 +00:00
### Build/minify
2013-09-03 15:00:12 +00:00
2014-08-31 19:51:13 +00:00
gulp
2013-11-21 00:15:08 +00:00
### Deploy
- on Heroku:
2014-01-13 20:25:45 +00:00
heroku create my-stackedit-instance
2013-11-21 00:15:08 +00:00
git push heroku master
- in a Docker container:
docker build -t my-stackedit-image .
docker run -p 3000 my-stackedit-image
2014-01-13 20:25:45 +00:00
> **NOTE:** OAuth authorizations work out of the box for address `http://localhost/` except for WordPress. To allow another address, you have to add specific keys at the end of `constants.js` and eventually to set up specific proxies with the corresponding key/secret pairs ([WordPress Proxy][9], [Tumblr Proxy][10] and [Gatekeeper][11]).
2013-09-03 15:00:12 +00:00
Architecture
------------
2013-11-23 18:59:55 +00:00
![Architecture diagram][12]
2013-11-21 00:15:08 +00:00
2013-11-24 01:35:54 +00:00
The modules are loaded by RequireJS in the following order:
2013-06-10 17:54:41 +00:00
2013-11-23 18:59:55 +00:00
1. The 3rd party libraries (jQuery, underscore.js...)
2014-01-13 20:25:45 +00:00
2. The `Extension` modules
3. The `eventMgr` module
2013-11-23 18:59:55 +00:00
4. The `core` module
2014-01-13 20:25:45 +00:00
5. The `fileMgr` module and the helpers modules
6. The `Provider` modules
2013-11-23 18:59:55 +00:00
7. The `publisher` and `synchronizer` modules
2013-11-24 01:35:54 +00:00
This is important to notice in order to avoid circular dependencies. For instance, if an `Extension` is declared with the `core` module as a dependency, RequireJS will inject `undefined` instead of the actual module.
2013-11-23 18:59:55 +00:00
2013-11-24 01:35:54 +00:00
Any module though can access any dependencies by implementing the proper [injection listener][13] provided by the `eventMgr` .
2013-06-12 22:58:58 +00:00
----------
2013-06-11 23:03:58 +00:00
### core
2013-06-10 17:54:41 +00:00
2013-06-11 23:03:58 +00:00
The `core` module is responsible for:
2013-06-10 17:54:41 +00:00
2013-11-21 00:15:08 +00:00
- creating the [UI Layout][14], the [ACE][15] editor and the [PageDown][16] editor,
2013-06-18 22:43:52 +00:00
- loading/saving the settings,
- running periodic tasks,
- detecting the user activity,
- checking the offline status.
2013-06-18 22:55:17 +00:00
**Attributes:**
2013-06-18 22:43:52 +00:00
2013-09-03 15:00:12 +00:00
- `isOffline` : indicates the offline status of the application.
2013-06-18 22:43:52 +00:00
2013-06-18 22:55:17 +00:00
**Methods:**
2013-06-18 22:43:52 +00:00
2013-09-03 15:00:12 +00:00
- `onReady(callback)` : sets a callback to be called when all modules have been loaded and the DOM is ready.
2013-11-23 18:59:55 +00:00
> **NOTE:** This is preferred over [jQuery's `.ready()`][17] because it ensures that all AMD modules are loaded by [RequireJS][18].
2013-06-18 22:43:52 +00:00
2013-09-03 15:00:12 +00:00
- `runPeriodically(callback)` : sets a callback to be called every second.
2013-06-18 22:43:52 +00:00
> **NOTE:** The callback will not run if the user is inactive or in StackEdit Viewer. User is considered inactive after 5 minutes of inactivity (mouse or keyboard).
2013-09-03 15:00:12 +00:00
- `setOffline()` : can be called by any other modules when a network timeout occurs for instance.
2013-06-18 22:55:17 +00:00
> **NOTE:** the offline status is also set by detecting the window `offline` event. `core.isOffline` is automatically set to `false` when the network is recovered.
2013-06-18 22:43:52 +00:00
2013-11-21 00:15:08 +00:00
- `initEditor(fileDesc)` : creates or refreshes the [PageDown][19] editor with a given [`FileDescriptor`][20] object.
2013-06-11 23:03:58 +00:00
2013-06-12 22:58:58 +00:00
----------
2013-06-11 23:03:58 +00:00
### fileMgr
The `fileMgr` module is responsible for:
2013-11-21 00:15:08 +00:00
- creating and deleting local files,
- switching from one file to another.
2013-06-16 23:12:13 +00:00
2013-09-03 15:00:12 +00:00
**Attributes:**
2013-11-21 00:15:08 +00:00
- `currentFile` : the [`FileDescriptor`][21] object that is currently edited.
2013-09-03 15:00:12 +00:00
**Methods:**
2013-11-21 00:15:08 +00:00
- `createFile(title, content)` : creates a [`FileDescriptor`][22] object, add it in the [`fileSystem`][23] map and returns it.
- `deleteFile(fileDesc)` : deletes a [`FileDescriptor`][24] object from the [`fileSystem`][25] map.
- `selectFile(fileDesc)` : selects a [`FileDescriptor`][26] object for editing.
2013-09-03 15:00:12 +00:00
2013-06-16 23:12:13 +00:00
#### FileDescriptor
The `FileDescriptor` class represents a local file. A `FileDescriptor` object has the following properties:
2013-11-21 00:15:08 +00:00
- `fileIndex` : the unique string index of the file in the file system.
- `title` : the title of the document.
- `content` : the content of the document.
- `syncLocations` : a map containing all the associated [`syncAttributes`][27] objects with their `syncIndex` as a key.
- `publishLocations` : a map containing all the associated [`publishAttributes`][28] objects with their `publishIndex` as a key.
2013-06-16 23:12:13 +00:00
And the following methods:
2013-11-21 00:15:08 +00:00
- `addSyncLocation(syncAttributes)` : associates a [`syncAttributes`][29] object with the file.
- `removeSyncLocation(syncAttributes)` : unassociates a [`syncAttributes`][30] object with the file.
- `addPublishLocation(publishAttributes)` : associates a [`publishAttributes`][31] object with the file.
- `removePublishLocation(publishAttributes)` : unassociates a [`publishAttributes`][32] object with the file.
2013-06-16 23:12:13 +00:00
#### fileSystem
2013-11-21 00:15:08 +00:00
The `fileSystem` module is a map containing all the [`FileDescriptor`][33] objects with their `fileIndex` as a key.
2013-06-11 23:03:58 +00:00
2013-06-12 22:58:58 +00:00
----------
2013-06-11 23:03:58 +00:00
### synchronizer
2013-06-10 17:54:41 +00:00
The `synchronizer` module is responsible for:
2013-11-21 00:15:08 +00:00
- creating a new local file from a sync location (import).
- creating a new sync location from a local file (export).
- running 2 ways synchronization (upload and download) for all sync locations.
2013-06-10 17:54:41 +00:00
2013-06-16 23:12:13 +00:00
#### synchronizer's providers
2013-11-21 00:15:08 +00:00
A [`provider`][34] module can be associated with the `synchronizer` module if it implements the following functions:
2013-06-16 23:12:13 +00:00
2013-11-21 00:15:08 +00:00
- `importFiles()` : downloads one or multiple files and create local files associated with the sync locations.
- `exportFile()` : uploads a local file to a new sync location.
- `syncDown()` : performs a download of all the changes operated on all sync locations.
- `syncUp()` : performs an upload of a change to a sync location.
2013-06-16 23:12:13 +00:00
#### syncAttributes
A `syncAttributes` object is an object that describes a sync location. Attributes differ from one provider to another except for the following:
2013-11-21 00:15:08 +00:00
- `syncIndex` : the unique string index of the publish location.
- `provider` : the [`provider`][35] module that handles the sync location.
2013-06-16 23:12:13 +00:00
2013-06-12 22:58:58 +00:00
----------
2013-06-11 23:03:58 +00:00
### publisher
2013-06-10 17:54:41 +00:00
The `publisher` module is responsible for:
2013-11-21 00:15:08 +00:00
- creating new publish locations,
- updating existing publish locations.
2013-06-10 17:54:41 +00:00
2013-06-11 23:03:58 +00:00
#### publisher's providers
2013-11-21 00:15:08 +00:00
A [`provider`][36] module can be associated with the `publisher` module if it implements the following functions:
2013-06-16 17:28:51 +00:00
2013-11-21 00:15:08 +00:00
- `newPublishAttributes()` : returns a new [`publishAttributes`][37] object in order to create a new publish location.
- `publish()` : performs publishing of one publish location.
2013-06-11 23:03:58 +00:00
2013-06-10 17:54:41 +00:00
#### publishAttributes
2013-06-16 23:12:13 +00:00
A `publishAttributes` object is an object that describes a publish location. Attributes differ from one provider to another except for the following:
2013-06-11 23:03:58 +00:00
2013-11-21 00:15:08 +00:00
- `publishIndex` : the unique string index of the publish location.
- `provider` : the [`provider`][38] module that handles the publish location.
2013-06-11 23:03:58 +00:00
- `format` : the publishing format for the publish location. It can be:
2013-11-21 00:15:08 +00:00
- `markdown` for Markdown format.
- `html` for HTML format.
- `template` for template format.
2013-06-11 23:03:58 +00:00
2013-06-16 17:28:51 +00:00
----------
2013-06-11 23:03:58 +00:00
2013-06-10 17:54:41 +00:00
2013-10-17 20:54:33 +00:00
### eventMgr
2013-06-10 17:54:41 +00:00
2013-11-24 01:35:54 +00:00
The `eventMgr` module is responsible for receiving and dispatching events. Below is the list of all events signatures.
2013-11-21 00:15:08 +00:00
2014-01-13 20:25:45 +00:00
Most events (those that are not triggered by the `eventMgr` module) can be triggered by calling methods of the same name in the `eventMgr` module. For example:
2013-11-21 00:15:08 +00:00
2013-11-24 01:35:54 +00:00
```js
eventMgr.onMessage('StackEdit is awesome!');
```
2014-01-13 20:25:45 +00:00
The method `addListener(eventName, callback)` of the `eventMgr` module can be used to listen to these events (except those that can only be handled by `Extension` modules). For example:
2013-11-24 01:35:54 +00:00
```js
eventMgr.addListener('onMessage', function(message) {
alert(message);
});
```
2014-01-13 20:25:45 +00:00
`Extension` modules have the possibility to listen to those events by implementing methods of the same name. For example:
2013-11-24 01:35:54 +00:00
```js
2014-01-13 20:25:45 +00:00
myExtension.onMessage = function(message) {
2013-11-24 01:35:54 +00:00
alert(message);
};
```
----------
#### Core events
2013-11-21 00:15:08 +00:00
- **`onReady()`**
All the modules are loaded and the DOM is ready.
> Triggered by the `core` module.
2013-11-24 01:35:54 +00:00
> This is preferred over [jQuery's `.ready()`][39] because it ensures that all modules have been loaded by RequireJS.
2013-11-21 00:15:08 +00:00
- **`onMessage(message)`**
A message destined to the user has been produced.
- `message` : the text string of the message.
- **`onError(error)`**
An error has been thrown.
- `error` : an error object or a string.
- **`onOfflineChanged(isOffline)`**
The off-line status has changed.
- `isOffline` : the off-line status.
> Triggered by the `core` module.
- **`onUserActive()`**
The user has just moved the mouse or pressed the keyboard.
> Triggered by the `core` module.
2013-11-23 18:59:55 +00:00
- **`onAsyncRunning(isRunning)`**
2013-11-21 00:15:08 +00:00
Some asynchronous tasks have just started or stopped.
- `isRunning` : true if started, false if stopped.
2013-11-23 18:59:55 +00:00
> Triggered by the `AsyncTask` module.
2013-11-21 00:15:08 +00:00
- **`onPeriodicRun()`**
A hook that is called periodically (every 1 second if user is active).
> Triggered by the `core` module.
- **`onLoadSettings()`**
2014-01-13 20:25:45 +00:00
A hook that is called when the settings dialog has to be refreshed. Every `Extension` module that has configuration inputs in the settings dialog has to implement a listener for this event.
2013-11-21 00:15:08 +00:00
2014-01-13 20:25:45 +00:00
> Triggered by the `core` module. Only `Extension` modules can handle this event.
2013-11-21 00:15:08 +00:00
- **`onSaveSettings(newConfig, event)`**
2014-01-13 20:25:45 +00:00
A hook that is called when the settings dialog has to be validated. Every `Extension` module that has configuration inputs in the settings dialog has to implement a listener for this event.
2013-11-21 00:15:08 +00:00
- `newConfig` : the new configuration object, deduced from the settings dialog inputs.
- `event` : the submit event object. `stopPropagation` has to be called in case of an error when parsing settings dialog inputs.
2014-01-13 20:25:45 +00:00
> Triggered by the `core` module. Only `Extension` modules can handle this event.
2013-11-21 00:15:08 +00:00
- **`onInit()`**
A hook allowing enabled extensions to initialize.
2014-01-13 20:25:45 +00:00
> Triggered by the `eventMgr` module. Only `Extension` modules can handle this event.
2013-11-23 18:59:55 +00:00
> This event is triggered before `onReady` event and just after the `config` and `enabled` extensions properties have been set by the `eventMgr`.
2013-11-21 00:15:08 +00:00
2013-11-24 01:35:54 +00:00
----------
2014-01-13 20:25:45 +00:00
#### Module injection events
2013-11-21 00:15:08 +00:00
- **`onFileMgrCreated(fileMgr)`**
The `fileMgr` module has been created.
- `fileMgr` : the `fileMgr` module.
> Triggered by the `fileMgr` module.
- **`onSynchronizerCreated(synchronizer)`**
The `synchronizer` module has been created.
- `synchronizer` : the `synchronizer` module.
> Triggered by the `synchronizer` module.
- **`onPublisherCreated(publisher)`**
The `publisher` module has been created.
- `publisher` : the `publisher` module.
> Triggered by the `publisher` module.
- **`onEventMgrCreated()`**
The `eventMgr` module has been created.
- `eventMgr` : the `eventMgr` module.
> Triggered by the `eventMgr` module.
2013-11-24 01:35:54 +00:00
----------
2014-01-13 20:25:45 +00:00
#### file operation events
2013-11-21 00:15:08 +00:00
- **`onFileCreated(fileDesc)`**
A [`FileDescriptor`][41] object has been created.
- `fileDesc` : the [`FileDescriptor`][42] object.
> Triggered by the `fileMgr` module.
- **`onFileDeleted(fileDesc)`**
A [`FileDescriptor`][43] object has been removed from the `fileSystem` module.
- `fileDesc` : the [`FileDescriptor`][44] object.
> Triggered by the `fileMgr` module.
- **`onFileSelected(fileDesc)`**
A [`FileDescriptor`][45] object has been selected.
- `fileDesc` : the [`FileDescriptor`][46] object.
> Triggered by the `fileMgr` module. This event is triggered before `onFileClosed` (if another document is open) and `onFileOpen` events.
- **`onFileClosed(fileDesc)`**
The current [`FileDescriptor`][47] object is about to be detached from the editor.
- `fileDesc` : the [`FileDescriptor`][48] object.
> Triggered by the `fileMgr` module. This event is triggered after `onFileSelected` event and before `onFileClosed` event.
- **`onFileOpen(fileDesc)`**
The selected [`FileDescriptor`][49] object has been attached to the editor.
- `fileDesc` : the [`FileDescriptor`][50] object.
> Triggered by the `fileMgr` module. This event is triggered after `onFileSelected` and `onFileClosed` (if another document is open) events.
- **`onContentChanged(fileDesc)`**
The content of a [`FileDescriptor`][51] object has been modified.
2013-11-23 18:59:55 +00:00
- `fileDesc` : the [`FileDescriptor`][52] object.
2013-11-21 00:15:08 +00:00
2013-11-23 18:59:55 +00:00
- **`onTitleChanged(fileDesc)`**
The content of a [`FileDescriptor`][53] object has been modified.
- `fileDesc` : the [`FileDescriptor`][54] object.
- **`onFoldersChanged()`**
2013-11-21 00:15:08 +00:00
2013-11-23 18:59:55 +00:00
The folders structure has changed.
2013-11-24 01:35:54 +00:00
----------
2013-11-23 18:59:55 +00:00
#### Sync events
2013-11-24 01:35:54 +00:00
- **`onSyncRunning(isRunning)`**
2013-11-23 18:59:55 +00:00
A synchronization job has just started or stopped.
- `isRunning` : true if started, false if stopped.
2013-11-21 00:15:08 +00:00
2013-11-23 18:59:55 +00:00
> Triggered by the `synchronizer` module.
2013-11-24 01:35:54 +00:00
> A synchronization job is the action to download and upload all detected changes for all sync locations of all documents.
2013-11-21 00:15:08 +00:00
2013-11-23 18:59:55 +00:00
- **`onSyncSuccess()`**
2013-11-21 00:15:08 +00:00
2013-11-23 18:59:55 +00:00
A synchronization job has successfully finished.
> Triggered by the `synchronizer` module.
2013-11-24 01:35:54 +00:00
> A synchronization job is the action to download and upload all detected changes for all sync locations of all documents.
2013-11-23 18:59:55 +00:00
- **`onSyncImportSuccess(fileDescList, provider)`**
The import of documents has successfully finished.
- `fileDescList` : the list of [`FileDescriptor`][55] objects that have been created.
- `provider` : the [`provider`][56] module that handled the import.
> Triggered by the [`provider`][57] module that handled the import.
2013-11-24 01:35:54 +00:00
> An import is the action to download multiple files and to create, for each, one [`FileDescriptor`][55] objects with one sync location.
2013-11-23 18:59:55 +00:00
- **`onSyncExportSuccess(fileDesc, syncAttributes)`**
The export of one document has successfully finished.
- `fileDesc` : the [`FileDescriptor`][58] object that has been exported.
2013-11-24 01:35:54 +00:00
- `syncAttributes` : the descriptor object of the new sync location.
2013-11-23 18:59:55 +00:00
> Triggered by the `synchronizer` module.
2013-11-24 01:35:54 +00:00
> An export is the action to upload one file and to create one new sync location associated with one existing `FileDescriptor`][55] object.
2013-11-23 18:59:55 +00:00
- **`onSyncRemoved(fileDesc, syncAttributes)`**
A sync location has been removed from a [`FileDescriptor`][59] object.
- `fileDesc` : the [`FileDescriptor`][60] object.
- `syncAttributes` : the descriptor object of the removed sync location.
2013-11-21 00:15:08 +00:00
2013-11-24 01:35:54 +00:00
----------
2013-11-23 18:59:55 +00:00
#### Publish events
2013-11-21 00:15:08 +00:00
2013-11-24 01:35:54 +00:00
- **`onPublishRunning(isRunning)`**
2013-11-21 00:15:08 +00:00
2013-11-24 01:35:54 +00:00
A document publication job has just started or stopped.
- `isRunning` : true if started, false if stopped.
> Triggered by the `publisher` module.
> A publication job is the action to upload changes on multiple publish locations associated with one `FileDescriptor`][55] object.
- **`onPublishSuccess(fileDesc)`**
A document publication job has successfully finished.
- `fileDesc` : the [`FileDescriptor`][60] object that has been published.
> Triggered by the `publisher` module.
> A publication job is the action to upload changes on multiple publish locations associated with one `FileDescriptor`][55] object.
- **`onNewPublishSuccess(fileDesc, publishAttributes)`**
A new publish location has been successfully created.
- `fileDesc` : the [`FileDescriptor`][60] object that has been published.
- `publishAttributes` : the descriptor object of the new publish location.
> Triggered by the `publisher` module.
- **`onPublishRemoved(fileDesc, publishAttributes)`**
A publish location has been removed from a [`FileDescriptor`][59] object.
- `fileDesc` : the [`FileDescriptor`][60] object.
- `publishAttributes` : the descriptor object of the removed publish location.
> Triggered by the `publisher` module.
----------
2014-01-13 20:25:45 +00:00
#### UI Layout events
2013-11-24 01:35:54 +00:00
- **`onLayoutConfigure(layoutConfig)`**
The layout is about to be configured.
- `layoutConfig` : the configuration object of the UI Layout library.
> Triggered by the `core` module.
- **`onLayoutCreated(layout)`**
The layout has just been created.
- `layout` : the layout object of the UI Layout library.
> Triggered by the `core` module.
- **`onLayoutResize(paneName)`**
One pane of the layout has been resized.
- `paneName` : the name of the resized layout pane.
> Triggered by the `core` module.
2013-11-23 18:59:55 +00:00
- **`onCreateButton()`**
2013-11-24 01:35:54 +00:00
Allows extensions to add their own buttons in the navigation bar. Implemented listeners have to return an HTML button element. For example:
2014-01-13 20:25:45 +00:00
myExtension.onCreateButton = function() {
2013-11-24 01:35:54 +00:00
var button = $('< button class = "btn btn-success" > < i class = "icon-rocket" > < / i > < / button > ');
button.click(function() {
eventMgr.onMessage('Booom!');
});
return button[0];
};
2014-01-13 20:25:45 +00:00
> Triggered by the `eventMgr` module. Only `Extension` modules can handle this event.
2013-11-24 01:35:54 +00:00
2013-11-23 18:59:55 +00:00
- **`onCreateEditorButton()`**
2013-11-24 01:35:54 +00:00
Allows extensions to add their own buttons in the side bar. Implemented listeners have to return an HTML button element. See `onCreateButton` for a concrete example.
2014-01-13 20:25:45 +00:00
> Triggered by the `eventMgr` module. Only `Extension` modules can handle this event.
2013-11-24 01:35:54 +00:00
2013-11-23 18:59:55 +00:00
- **`onCreatePreviewButton()`**
2013-11-21 00:15:08 +00:00
2013-11-24 01:35:54 +00:00
Allows extensions to add their own buttons over the preview. Implemented listeners have to return an HTML button element. See `onCreateButton` for a concrete example.
2014-01-13 20:25:45 +00:00
> Triggered by the `eventMgr` module. Only `Extension` modules can handle this event.
2013-11-24 01:35:54 +00:00
----------
2014-01-13 20:25:45 +00:00
#### PageDown events
2013-11-24 01:35:54 +00:00
- **`onPagedownConfigure(editor)`**
The Pagedown editor is about to be created.
- `editor` : the Pagedown editor object before `run` has been called.
> Triggered by the `core` module.
- **`onAsyncPreview(callback)`**
Called after Pagedown's synchronous rendering to trigger extra asynchronous rendering (such as MathJax). Implemented listeners have to call the callback parameter after processing in order other `onAsyncPreview` listeners to run.
- `callback` : the callback to call at the end of the asynchronous processing.
2014-01-13 20:25:45 +00:00
> Triggered by the `eventMgr` module. Only `Extension` modules can handle this event.
2013-11-24 01:35:54 +00:00
- **`onPreviewFinished(html)`**
Called after every `onAsyncPreview` listeners have been called.
- `html` : the finally rendered HTML.
- **`onSectionsCreated(sectionList)`**
The Markdown has been split into sections before rendering.
- `sectionList` : the list of section objects. Each section object contains:
- `text` : the markdown substring contained in the section.
- `textWithDelimiter` : the text with an added delimiter.
> Triggered by the `markdownSectionParser` extension.
- **`onMarkdownTrim(offset)`**
The Markdown has been left trimmed by a certain number of character.
- `offset` : the number of characters that have been removed.
> Triggered by the `yamlFrontMatterParser` extension.
----------
2013-11-21 00:15:08 +00:00
2014-01-13 20:25:45 +00:00
#### ACE events
2013-11-21 00:15:08 +00:00
2013-11-24 01:35:54 +00:00
- **`onAceCreated(aceEditor)`**
2013-05-29 21:45:40 +00:00
2013-11-24 01:35:54 +00:00
The ACE editor has just been created.
- `aceEditor` : the ACE editor object.
> Triggered by the `core` module.
2013-05-29 22:10:25 +00:00
2013-05-29 20:01:33 +00:00
2013-10-17 20:54:33 +00:00
> Written with [StackEdit](https://stackedit.io/).
2013-05-29 20:01:33 +00:00
2013-09-03 15:00:12 +00:00
[1]: http://git-scm.com/
[2]: http://nodejs.org/
2014-09-06 12:48:38 +00:00
[3]: http://gulpjs.com/
2013-09-03 15:00:12 +00:00
[4]: http://bower.io/
2013-10-17 20:54:33 +00:00
[5]: http://requirejs.org/ "RequireJS"
[6]: http://en.wikipedia.org/wiki/Asynchronous_module_definition "Asynchronous module definition"
[7]: http://bower.io/
[8]: http://requirejs.org/ "RequireJS"
2013-11-21 00:15:08 +00:00
[9]: https://github.com/benweet/stackedit-wordpress-proxy
[10]: https://github.com/benweet/stackedit-tumblr-proxy
[11]: https://github.com/prose/gatekeeper
2013-11-23 18:59:55 +00:00
[12]: https://lh6.googleusercontent.com/-sr6zRtyaoUk/Un5qSakOzPI/AAAAAAAAFC0/oI5If5fI9Gw/s0/StackEdit%252520architecture%252520-%252520New%252520Page%252520%2525283%252529.png "StackEdit architecture"
[13]: #module -injection
2013-11-21 00:15:08 +00:00
[14]: http://layout.jquery-dev.net/ "UI Layout"
[15]: http://ace.c9.io
[16]: https://code.google.com/p/pagedown/ "PageDown"
[17]: http://api.jquery.com/ready/
[18]: http://requirejs.org/ "RequireJS"
[19]: https://code.google.com/p/pagedown/ "PageDown"
2013-10-17 20:54:33 +00:00
[20]: #filedescriptor
2013-11-21 00:15:08 +00:00
[21]: #filedescriptor
2013-10-17 20:54:33 +00:00
[22]: #filedescriptor
2013-11-21 00:15:08 +00:00
[23]: #filesystem
[24]: #filedescriptor
[25]: #filesystem
[26]: #filedescriptor
[27]: #syncattributes
2013-10-17 20:54:33 +00:00
[28]: #publishattributes
2013-11-21 00:15:08 +00:00
[29]: #syncattributes
[30]: #syncattributes
[31]: #publishattributes
[32]: #publishattributes
[33]: #filedescriptor
[34]: #provider
[35]: #provider
[36]: #provider
[37]: #publishattributes
[38]: #provider
[39]: http://api.jquery.com/ready/
[40]: http://requirejs.org/ "RequireJS"
[41]: #filedescriptor
[42]: #filedescriptor
[43]: #filedescriptor
[44]: #filedescriptor
[45]: #filedescriptor
[46]: #filedescriptor
[47]: #filedescriptor
[48]: #filedescriptor
[49]: #filedescriptor
[50]: #filedescriptor
[51]: #filedescriptor
2013-11-23 18:59:55 +00:00
[52]: #filedescriptor
[53]: #filedescriptor
[54]: #filedescriptor
[55]: #filedescriptor
[56]: #provider
[57]: #provider
[58]: #filedescriptor
[59]: #filedescriptor
2014-09-06 12:48:38 +00:00
[60]: #filedescriptor