diff --git a/public/privacy_policy.html b/public/privacy_policy.html
index 6ba419fc..7acf782c 100644
--- a/public/privacy_policy.html
+++ b/public/privacy_policy.html
@@ -8,7 +8,7 @@
StackEdit — Privacy Policy
-
This Privacy Policy governs the manner in which StackEdit collects, uses, maintains and discloses information collected from users (each, a “User”) of the stackedit.io website (“Site”). This privacy policy applies to the Site and all products and services offered by StackEdit.
+
This Privacy Policy governs the manner in which StackEdit collects, uses, maintains and discloses information collected from users (each, a “User”) of the stackedit.io website (“Site”). This privacy policy applies to the Site and all products and services offered by StackEdit.
diff --git a/public/res/editor.js b/public/res/editor.js
index 67e9b783..454b4345 100644
--- a/public/res/editor.js
+++ b/public/res/editor.js
@@ -769,20 +769,18 @@ define([
});
var action = function(action, options) {
- options = options || {};
-
var textContent = getValue();
- var selectionStart = options.start || selectionMgr.selectionStart;
- var selectionEnd = options.end || selectionMgr.selectionEnd;
+ var min = Math.min(selectionMgr.selectionStart, selectionMgr.selectionEnd);
+ var max = Math.max(selectionMgr.selectionStart, selectionMgr.selectionEnd);
var state = {
- selectionStart: selectionStart,
- selectionEnd: selectionEnd,
- before: textContent.slice(0, selectionStart),
- after: textContent.slice(selectionEnd),
- selection: textContent.slice(selectionStart, selectionEnd)
+ selectionStart: min,
+ selectionEnd: max,
+ before: textContent.slice(0, min),
+ after: textContent.slice(max),
+ selection: textContent.slice(min, max)
};
- actions[action](state, options);
+ actions[action](state, options || {});
setValue(state.before + state.selection + state.after);
selectionMgr.setSelectionStartEnd(state.selectionStart, state.selectionEnd);
selectionMgr.updateSelectionRange();
diff --git a/public/res/extensions/umlDiagrams.js b/public/res/extensions/umlDiagrams.js
index 706de80a..177cc18f 100644
--- a/public/res/extensions/umlDiagrams.js
+++ b/public/res/extensions/umlDiagrams.js
@@ -13,78 +13,40 @@ define([
var umlDiagrams = new Extension("umlDiagrams", "UML Diagrams", true);
umlDiagrams.settingsBlock = umlDiagramsSettingsBlockHTML;
- var eventMgr;
- umlDiagrams.onEventMgrCreated = function(eventMgrParameter) {
- eventMgr = eventMgrParameter;
- };
-
- var previewContentsElt;
- umlDiagrams.onReady = function() {
- previewContentsElt = document.getElementById('preview-contents');
- };
-
- var onAsyncPreview = function(cb) {
- cb();
- };
- umlDiagrams.onAsyncPreview = function(cb) {
- onAsyncPreview(cb);
- };
-
- umlDiagrams.onInit = function() {
- var sequenceDiagramEltList, flowChartEltList;
- function doSequenceDiagram(cb) {
- if(sequenceDiagramEltList.length === 0) {
- return cb();
- }
- var sequenceDiagramElt = sequenceDiagramEltList.pop();
- try {
- var diagram = sequenceDiagram.parse(sequenceDiagramElt.textContent);
- var preElt = sequenceDiagramElt.parentNode;
- var containerElt = crel('div', {
- class: 'sequence-diagram'
- });
- preElt.parentNode.replaceChild(containerElt, preElt);
- diagram.drawSVG(containerElt, {
- theme: 'simple'
- });
- }
- catch(e) {
- }
- _.delay(doSequenceDiagram, 0, cb);
- }
-
- function doFlowChart(cb) {
- if(flowChartEltList.length === 0) {
- return cb();
- }
- var flowChartElt = flowChartEltList.pop();
- try {
- var chart = flowChart.parse(flowChartElt.textContent);
- var preElt = flowChartElt.parentNode;
- var containerElt = crel('div', {
- class: 'flow-chart'
- });
- preElt.parentNode.replaceChild(containerElt, preElt);
- chart.drawSVG(containerElt, {
- 'line-width': 2
- });
- }
- catch(e) {
- }
- _.delay(doFlowChart, 0, cb);
- }
-
- var afterDiagrams = onAsyncPreview;
- onAsyncPreview = function(cb) {
- sequenceDiagramEltList = Array.prototype.slice.call(previewContentsElt.querySelectorAll('.prettyprint > .language-sequence'));
- flowChartEltList = Array.prototype.slice.call(previewContentsElt.querySelectorAll('.prettyprint > .language-flow'));
- _.delay(doSequenceDiagram, 0, function() {
- _.delay(doFlowChart, 0, function() {
- afterDiagrams(cb);
- });
+ umlDiagrams.onPagedownConfigure = function(editor) {
+ var previewContentsElt = document.getElementById('preview-contents');
+ editor.hooks.chain("onPreviewRefresh", function() {
+ _.each(previewContentsElt.querySelectorAll('.prettyprint > .language-sequence'), function(elt) {
+ try {
+ var diagram = sequenceDiagram.parse(elt.textContent);
+ var preElt = elt.parentNode;
+ var containerElt = crel('div', {
+ class: 'sequence-diagram'
+ });
+ preElt.parentNode.replaceChild(containerElt, preElt);
+ diagram.drawSVG(containerElt, {
+ theme: 'simple'
+ });
+ }
+ catch(e) {
+ }
});
- };
-
+ _.each(previewContentsElt.querySelectorAll('.prettyprint > .language-flow'), function(elt) {
+ try {
+ var chart = flowChart.parse(elt.textContent);
+ var preElt = elt.parentNode;
+ var containerElt = crel('div', {
+ class: 'flow-chart'
+ });
+ preElt.parentNode.replaceChild(containerElt, preElt);
+ chart.drawSVG(containerElt, {
+ 'line-width': 2
+ });
+ }
+ catch(e) {
+ }
+ });
+ });
};
return umlDiagrams;
diff --git a/public/res/html/markdownExtraSettingsBlock.html b/public/res/html/markdownExtraSettingsBlock.html
index 2f0b502a..8a48551e 100644
--- a/public/res/html/markdownExtraSettingsBlock.html
+++ b/public/res/html/markdownExtraSettingsBlock.html
@@ -100,15 +100,6 @@
-