Beta release

This commit is contained in:
benweet 2014-04-27 21:10:30 +01:00
parent dcbd1c6ad5
commit 3c384739ee
12 changed files with 4505 additions and 6283 deletions

View File

@ -25,7 +25,7 @@ module.exports = function(grunt) {
'public/res-min/**/*.js'
]
},
client: ['public/**/*.js'],
client: ['public/**/*.js']
},
requirejs: {
compile: {
@ -40,7 +40,7 @@ module.exports = function(grunt) {
'css/css-builder',
'less/lessc-server',
'less/lessc'
],
]
}
}
},
@ -50,14 +50,14 @@ module.exports = function(grunt) {
js: {
space_before_conditional: false,
keep_array_indentation: true,
indentWithTabs: true,
indentWithTabs: true
}
}
},
less: {
compile: {
options: {
compress: true,
compress: true
},
files: [
{
@ -67,14 +67,14 @@ module.exports = function(grunt) {
'*.less'
],
dest: 'public/res-min/themes',
ext: '.css',
ext: '.css'
},
{
src: 'public/res/styles/base.less',
dest: 'public/res-min/themes/base.css',
dest: 'public/res-min/themes/base.css'
}
]
}
],
},
},
'string-replace': {
'constants': {
@ -86,7 +86,7 @@ module.exports = function(grunt) {
{
pattern: /constants\.VERSION = .*/,
replacement: 'constants.VERSION = "<%= pkg.version %>";'
},
}
]
}
},
@ -103,10 +103,10 @@ module.exports = function(grunt) {
{
pattern: /(#DynamicResourcesBegin\n)[\s\S]*(\n#DynamicResourcesEnd)/,
replacement: '$1<%= resources %>$2'
},
}
]
}
},
}
},
copy: {
resources: {
@ -137,7 +137,7 @@ module.exports = function(grunt) {
'require.js'
],
dest: 'public/res-min/'
},
}
]
}
},
@ -161,7 +161,7 @@ module.exports = function(grunt) {
],
pushTo: 'origin'
}
},
}
});
/***************************************************************************

View File

@ -1,5 +1,5 @@
CACHE MANIFEST
#Date Sun Apr 27 2014 13:44:57
#Date Sun Apr 27 2014 21:00:22
CACHE:
libs/MathJax/MathJax.js?config=TeX-AMS_HTML

File diff suppressed because one or more lines are too long

View File

@ -25,6 +25,7 @@ define([
"extensions/workingIndicator",
"extensions/notifications",
"extensions/markdownExtra",
"extensions/umlDiagrams",
"extensions/toc",
"extensions/mathJax",
"extensions/emailConverter",

View File

@ -9,11 +9,8 @@ define([
'google-code-prettify',
'highlightjs',
'crel',
'sequence-diagram',
'flow-chart',
'text!html/tooltipMarkdownExtraDiagrams.html',
'pagedown-extra'
], function($, _, utils, logger, Extension, markdownExtraSettingsBlockHTML, prettify, hljs, crel, sequenceDiagram, flowChart, tooltipMarkdownExtraDiagramsHTML) {
], function($, _, utils, logger, Extension, markdownExtraSettingsBlockHTML, prettify, hljs) {
var markdownExtra = new Extension("markdownExtra", "Markdown Extra", true);
markdownExtra.settingsBlock = markdownExtraSettingsBlockHTML;
@ -78,83 +75,15 @@ define([
var previewContentsElt;
markdownExtra.onReady = function() {
previewContentsElt = document.getElementById('preview-contents');
utils.createTooltip(".tooltip-markdown-extra-diagrams", tooltipMarkdownExtraDiagramsHTML);
};
var onAsyncPreview = function(cb) {
cb();
};
markdownExtra.onAsyncPreview = function(cb) {
onAsyncPreview(cb);
};
var extraOptions;
markdownExtra.onInit = function() {
var sequenceDiagramEltList, flowChartEltList;
extraOptions = {
extensions: markdownExtra.config.extensions
};
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);
}
if(markdownExtra.config.diagrams) {
extraOptions.highlighter = "prettify";
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);
});
});
};
}
};
markdownExtra.onPagedownConfigure = function(editor) {
var converter = editor.getConverter();
var extraOptions = {
extensions: markdownExtra.config.extensions,
highlighter: "prettify"
};
if(markdownExtra.config.intraword === true) {
var converterOptions = {
_DoItalicsAndBold: function(text) {
@ -173,7 +102,6 @@ define([
});
}
if(markdownExtra.config.highlighter == "highlight") {
extraOptions.highlighter = "prettify";
var previewContentsElt = document.getElementById('preview-contents');
editor.hooks.chain("onPreviewRefresh", function() {
_.each(previewContentsElt.querySelectorAll('.prettyprint > code'), function(elt) {
@ -183,7 +111,6 @@ define([
});
}
else if(markdownExtra.config.highlighter == "prettify") {
extraOptions.highlighter = "prettify";
editor.hooks.chain("onPreviewRefresh", prettify.prettyPrint);
}
Markdown.Extra.init(converter, extraOptions);

View File

@ -3,7 +3,7 @@ define([
"utils",
"classes/Extension",
"text!html/mathJaxSettingsBlock.html",
"mathjax",
"mathjax"
], function(utils, Extension, mathJaxSettingsBlockHTML) {
var mathJax = new Extension("mathJax", "MathJax", true);

View File

@ -0,0 +1,91 @@
define([
"jquery",
"underscore",
"utils",
"logger",
"classes/Extension",
"text!html/umlDiagramsSettingsBlock.html",
'crel',
'sequence-diagram',
'flow-chart'
], function($, _, utils, logger, Extension, umlDiagramsSettingsBlockHTML, crel, sequenceDiagram, flowChart) {
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);
});
});
};
};
return umlDiagrams;
});

View File

@ -1,23 +0,0 @@
You can create sequence diagrams like this:
<br />
<br />
```sequence<br />
Alice-&gt;Bob: Hello Bob, how are you?
Bob--&gt;Alice: I am good thanks!
```<br />
<a target="_blank" href="http://bramp.github.io/js-sequence-diagrams/">More info</a>
<br />
<br />
Or flow charts like this:
<br />
<br />
```flow<br />
st=&gt;start: Start<br />
e=&gt;end<br />
op=&gt;operation: My Operation<br />
cond=&gt;condition: Yes or No?<br />
st-&gt;op-&gt;cond<br />
cond(yes)-&gt;e<br />
cond(no)-&gt;op<br />
```<br />
<a target="_blank" href="http://adrai.github.io/flowchart.js/">More info</a>

View File

@ -0,0 +1,24 @@
<p>Creates UML diagrams from plain text description.</p>
<p>Sequence diagrams:</p>
<pre><div class="help-block pull-right"><a target="_blank" href="http://bramp.github.io/js-sequence-diagrams/">More info</a></div><code>```sequence
Alice->Bob: Hello Bob, how are you?
Bob-->Alice: I am good thanks!
```</code>
</pre>
<p>Flow charts:</p>
<pre><div class="help-block pull-right"><a target="_blank" href="http://adrai.github.io/flowchart.js/">More info</a></div><code>```flow
st=>start: Start
e=>end
op=>operation: My Operation
cond=>condition: Yes or No?
st->op->cond
cond(yes)->e
cond(no)->op
```</code>
</pre>
<blockquote>
<b>Note:</b> Markdown Extra extension has to be enabled with GFM fenced code blocks option.
</blockquote>

View File

@ -1,4 +1,5 @@
MathJax.Hub.Config({
skipStartupTypeset: true,
"HTML-CSS": {
preferredFont: "TeX",
availableFonts: [

View File

@ -0,0 +1,11 @@
// Hack to make js-sequence-diagram AMD friendly
define([
'text!bower-libs/js-sequence-diagrams/build/sequence-diagram-min.js',
'raphael',
'underscore'
], function(sequenceDiagramMinJS) {
/*jshint evil: true */
eval(sequenceDiagramMinJS);
return window.Diagram;
});

View File

@ -61,7 +61,7 @@ requirejs.config({
diff_match_patch_uncompressed: 'bower-libs/google-diff-match-patch-js/diff_match_patch_uncompressed',
jsondiffpatch: 'bower-libs/jsondiffpatch/build/bundle',
hammerjs: 'bower-libs/hammerjs/hammer',
'sequence-diagram': 'bower-libs/js-sequence-diagrams/build/sequence-diagram-min',
'sequence-diagram': 'libs/sequence-diagram',
raphael: 'bower-libs/raphael/raphael',
'flow-chart': 'bower-libs/flowchart/release/flowchart.amd-1.2.10.min',
flowchart: 'bower-libs/flowchart/release/flowchart-1.2.10.min'
@ -149,16 +149,9 @@ requirejs.config({
'pagedown-extra': [
'libs/Markdown.Converter'
],
'sequence-diagram': {
deps: [
'underscore',
'raphael'
],
exports: 'Diagram'
},
'flow-chart': [
'raphael'
],
]
}
});
@ -169,11 +162,13 @@ try {
localStorage.removeItem(test);
var obj = {};
Object.defineProperty(obj, 'prop', {
get: function() {},
set: function() {}
get: function() {
},
set: function() {
}
});
}
catch (e) {
catch(e) {
alert('Your browser is not supported, sorry!');
throw e;
}
@ -184,14 +179,24 @@ window.viewerMode = /(^| )viewer($| )/.test(document.body.className);
// Keep the theme in a global variable
window.theme = localStorage.themeV3 || 'default';
var themeModule = "less!themes/" + window.theme;
if (window.baseDir.indexOf('-min') !== -1) {
if(window.baseDir.indexOf('-min') !== -1) {
themeModule = "css!themes/" + window.theme;
}
// RequireJS entry point. By requiring synchronizer, publisher and
// media-importer, we are actually loading all the modules
require(["jquery", "rangy", "core", "eventMgr", "synchronizer", "publisher", "mediaImporter", "css", "rangy-cssclassapplier",
themeModule, ], function($, rangy, core, eventMgr) {
require([
"jquery",
"rangy",
"core",
"eventMgr",
"synchronizer",
"publisher",
"mediaImporter",
"css",
"rangy-cssclassapplier",
themeModule,
], function($, rangy, core, eventMgr) {
if(window.noStart) {
return;
@ -204,9 +209,9 @@ themeModule, ], function($, rangy, core, eventMgr) {
core.onReady();
// If browser has detected a new application cache.
if (window.applicationCache) {
if(window.applicationCache) {
window.applicationCache.addEventListener('updateready', function() {
if (window.applicationCache.status === window.applicationCache.UPDATEREADY) {
if(window.applicationCache.status === window.applicationCache.UPDATEREADY) {
window.applicationCache.swapCache();
eventMgr.onMessage('New version available!\nJust refresh the page to upgrade.');
}