markdown-editor-shell
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -14,3 +14,4 @@ /* | ||
previewButtonTitle: "Toggle Preview Mode", | ||
markdownToHtmlConvertor: function (markdown) { return markdown; } | ||
markdownToHtmlConvertor: function (markdown) { return markdown; }, | ||
window: window | ||
}; | ||
@@ -23,3 +24,4 @@ | ||
previewButtonTitle: opts.previewButtonTitle || defaultSettings.previewButtonTitle, | ||
markdownToHtmlConvertor: opts.markdownToHtmlConvertor || defaultSettings.markdownToHtmlConvertor | ||
markdownToHtmlConvertor: opts.markdownToHtmlConvertor || defaultSettings.markdownToHtmlConvertor, | ||
window: opts.window || defaultSettings.window | ||
}; | ||
@@ -30,3 +32,3 @@ | ||
if (typeof this.settings.container == 'string') { | ||
this._elements.editor = document.getElementById(this.settings.container); | ||
this._elements.editor = window.document.getElementById(this.settings.container); | ||
} | ||
@@ -43,3 +45,3 @@ else if (typeof this.settings.container == 'object') { | ||
// wrapper | ||
var wrapElement = document.createElement("div"); | ||
var wrapElement = window.document.createElement("div"); | ||
wrapElement.setAttribute("class", "markdown-editor-wrapper"); | ||
@@ -55,6 +57,6 @@ this._elements.wrapper = wrapElement; | ||
var rowElement = document.createElement("div"); | ||
var rowElement = window.document.createElement("div"); | ||
rowElement.setAttribute("class", "markdown-editor-row"); | ||
var previewElement = document.createElement("div"); | ||
var previewElement = window.document.createElement("div"); | ||
previewElement.setAttribute("class", "markdown-editor-preview"); | ||
@@ -81,3 +83,3 @@ this._elements.preview = previewElement; | ||
modeElements = wrapElement.querySelectorAll(".markdown-editor-modes label.btn"); | ||
var modeElements = wrapElement.querySelectorAll(".markdown-editor-modes label.btn"); | ||
for (var i = 0; i < modeElements.length; i++) { | ||
@@ -113,3 +115,3 @@ modeElements[i].addEventListener('click', function (e) { | ||
MarkdownEditorShell.prototype.enterFullscreen = function () { | ||
if (isFullscreenMode()) { | ||
if (this.isFullscreenMode()) { | ||
this.exitFullscreen(); | ||
@@ -135,2 +137,4 @@ } else { | ||
MarkdownEditorShell.prototype.exitFullscreen = function () { | ||
var document = this.settings.window.document; | ||
if (document.exitFullscreen) { | ||
@@ -150,2 +154,11 @@ document.exitFullscreen(); | ||
MarkdownEditorShell.prototype.isFullscreenMode = function() { | ||
var document = this.settings.window.document; | ||
return (document.fullscreenElement || | ||
document.webkitFullscreenElement || | ||
document.mozFullScreenElement || | ||
document.msFullscreenElement) ? true : false; | ||
} | ||
// private | ||
@@ -163,10 +176,3 @@ MarkdownEditorShell.prototype._updatePreview = function() { | ||
function isFullscreenMode() { | ||
return (document.fullscreenElement || | ||
document.webkitFullscreenElement || | ||
document.mozFullScreenElement || | ||
document.msFullscreenElement) ? true : false; | ||
} | ||
window.MarkdownEditorShell = MarkdownEditorShell; | ||
})(window); |
{ | ||
"name": "markdown-editor-shell", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Client-side markdown editor shell which compatible with any renderer engine.", | ||
"main": "js/markdown-editor-shell.js", | ||
"devDependencies": { | ||
"chai": "^1.10.0", | ||
"coveralls": "^2.10.0", | ||
"istanbul": "^0.3.5", | ||
"gulp": "^3.9.0", | ||
@@ -13,2 +13,4 @@ "gulp-bump": "^0.3.1", | ||
"gulp-karma": "0.0.4", | ||
"gulp-less": "^3.0.3", | ||
"gulp-minify-css": "^1.2.0", | ||
"gulp-rename": "^1.2.2", | ||
@@ -18,2 +20,3 @@ "gulp-sourcemaps": "^1.5.2", | ||
"gulp-uglify": "^1.2.0", | ||
"istanbul": "^0.3.5", | ||
"karma": "^0.12.31", | ||
@@ -27,3 +30,3 @@ "karma-chrome-launcher": "^0.1.8", | ||
"mocha-lcov-reporter": "^0.0.2", | ||
"chai": "^1.10.0" | ||
"sinon": "^1.15.4" | ||
}, | ||
@@ -51,6 +54,7 @@ "scripts": { | ||
"files": [ | ||
"js/*.js", | ||
"less/*.less", | ||
"LICENSE" | ||
"js/*.js", | ||
"less/*.less", | ||
"dist/*.*", | ||
"LICENSE" | ||
] | ||
} |
12088
139
22