@ -350,7 +350,7 @@ function toggleCodeBlock(editor) {
var block _start , block _end , lineCount ;
if ( is _code === 'single' ) {
// similar to some Simple MDE _toggleBlock logic
// similar to some Easy MDE _toggleBlock logic
var start = line . text . slice ( 0 , cur _start . ch ) . replace ( '`' , '' ) ,
end = line . text . slice ( cur _start . ch ) . replace ( '`' , '' ) ;
cm . replaceRange ( start + end , {
@ -1315,9 +1315,9 @@ var blockStyles = {
} ;
/ * *
* Interface of Simple MDE.
* Interface of Easy MDE.
* /
function Simple MDE( options ) {
function Easy MDE( options ) {
// Handle options parameter
options = options || { } ;
@ -1358,7 +1358,7 @@ function SimpleMDE(options) {
this . element = options . element ;
} else if ( options . element === null ) {
// This means that the element option was specified, but no element was found
console . log ( ' Simple MDE: Error. No element was found.') ;
console . log ( ' Easy MDE: Error. No element was found.') ;
return ;
}
@ -1447,7 +1447,7 @@ function SimpleMDE(options) {
/ * *
* Default markdown render .
* /
Simple MDE. prototype . markdown = function ( text ) {
Easy MDE. prototype . markdown = function ( text ) {
if ( marked ) {
// Initialize
var markedOptions ;
@ -1490,7 +1490,7 @@ SimpleMDE.prototype.markdown = function (text) {
/ * *
* Render editor to the given element .
* /
Simple MDE. prototype . render = function ( el ) {
Easy MDE. prototype . render = function ( el ) {
if ( ! el ) {
el = this . element || document . getElementsByTagName ( 'textarea' ) [ 0 ] ;
}
@ -1613,18 +1613,18 @@ function isLocalStorageAvailable() {
return true ;
}
Simple MDE. prototype . autosave = function ( ) {
Easy MDE. prototype . autosave = function ( ) {
if ( isLocalStorageAvailable ( ) ) {
var simplemde = this ;
var easyMDE = this ;
if ( this . options . autosave . uniqueId == undefined || this . options . autosave . uniqueId == '' ) {
console . log ( ' Simple MDE: You must set a uniqueId to use the autosave feature') ;
console . log ( ' Easy MDE: You must set a uniqueId to use the autosave feature') ;
return ;
}
if ( simplemde. element . form != null && simplemde . element . form != undefined ) {
simplemde . element . form . addEventListener ( 'submit' , function ( ) {
localStorage . removeItem ( 'smde_' + simplemde . options . autosave . uniqueId ) ;
if ( easyMDE. element . form != null && easyMDE . element . form != undefined ) {
easyMDE . element . form . addEventListener ( 'submit' , function ( ) {
localStorage . removeItem ( 'smde_' + easyMDE . options . autosave . uniqueId ) ;
} ) ;
}
@ -1637,7 +1637,7 @@ SimpleMDE.prototype.autosave = function () {
this . options . autosave . loaded = true ;
}
localStorage . setItem ( 'smde_' + this . options . autosave . uniqueId , simplemde . value ( ) ) ;
localStorage . setItem ( 'smde_' + this . options . autosave . uniqueId , easyMDE . value ( ) ) ;
var el = document . getElementById ( 'autosaved' ) ;
if ( el != null && el != undefined && el != '' ) {
@ -1659,27 +1659,27 @@ SimpleMDE.prototype.autosave = function () {
}
this . autosaveTimeoutId = setTimeout ( function ( ) {
simplemde . autosave ( ) ;
easyMDE . autosave ( ) ;
} , this . options . autosave . delay || 10000 ) ;
} else {
console . log ( ' Simple MDE: localStorage not available, cannot autosave') ;
console . log ( ' Easy MDE: localStorage not available, cannot autosave') ;
}
} ;
Simple MDE. prototype . clearAutosavedValue = function ( ) {
Easy MDE. prototype . clearAutosavedValue = function ( ) {
if ( isLocalStorageAvailable ( ) ) {
if ( this . options . autosave == undefined || this . options . autosave . uniqueId == undefined || this . options . autosave . uniqueId == '' ) {
console . log ( ' Simple MDE: You must set a uniqueId to clear the autosave value') ;
console . log ( ' Easy MDE: You must set a uniqueId to clear the autosave value') ;
return ;
}
localStorage . removeItem ( 'smde_' + this . options . autosave . uniqueId ) ;
} else {
console . log ( ' Simple MDE: localStorage not available, cannot autosave') ;
console . log ( ' Easy MDE: localStorage not available, cannot autosave') ;
}
} ;
Simple MDE. prototype . createSideBySide = function ( ) {
Easy MDE. prototype . createSideBySide = function ( ) {
var cm = this . codemirror ;
var wrapper = cm . getWrapperElement ( ) ;
var preview = wrapper . nextSibling ;
@ -1721,7 +1721,7 @@ SimpleMDE.prototype.createSideBySide = function () {
return preview ;
} ;
Simple MDE. prototype . createToolbar = function ( items ) {
Easy MDE. prototype . createToolbar = function ( items ) {
items = items || this . options . toolbar ;
if ( ! items || items . length === 0 ) {
@ -1822,7 +1822,7 @@ SimpleMDE.prototype.createToolbar = function (items) {
return bar ;
} ;
Simple MDE. prototype . createStatusbar = function ( status ) {
Easy MDE. prototype . createStatusbar = function ( status ) {
// Initialize
status = status || this . options . status ;
var options = this . options ;
@ -1940,7 +1940,7 @@ SimpleMDE.prototype.createStatusbar = function (status) {
/ * *
* Get or set the text content .
* /
Simple MDE. prototype . value = function ( val ) {
Easy MDE. prototype . value = function ( val ) {
var cm = this . codemirror ;
if ( val === undefined ) {
return cm . getValue ( ) ;
@ -1959,100 +1959,100 @@ SimpleMDE.prototype.value = function (val) {
/ * *
* Bind static methods for exports .
* /
Simple MDE. toggleBold = toggleBold ;
Simple MDE. toggleItalic = toggleItalic ;
Simple MDE. toggleStrikethrough = toggleStrikethrough ;
Simple MDE. toggleBlockquote = toggleBlockquote ;
Simple MDE. toggleHeadingSmaller = toggleHeadingSmaller ;
Simple MDE. toggleHeadingBigger = toggleHeadingBigger ;
Simple MDE. toggleHeading1 = toggleHeading1 ;
Simple MDE. toggleHeading2 = toggleHeading2 ;
Simple MDE. toggleHeading3 = toggleHeading3 ;
Simple MDE. toggleCodeBlock = toggleCodeBlock ;
Simple MDE. toggleUnorderedList = toggleUnorderedList ;
Simple MDE. toggleOrderedList = toggleOrderedList ;
Simple MDE. cleanBlock = cleanBlock ;
Simple MDE. drawLink = drawLink ;
Simple MDE. drawImage = drawImage ;
Simple MDE. drawTable = drawTable ;
Simple MDE. drawHorizontalRule = drawHorizontalRule ;
Simple MDE. undo = undo ;
Simple MDE. redo = redo ;
Simple MDE. togglePreview = togglePreview ;
Simple MDE. toggleSideBySide = toggleSideBySide ;
Simple MDE. toggleFullScreen = toggleFullScreen ;
Easy MDE. toggleBold = toggleBold ;
Easy MDE. toggleItalic = toggleItalic ;
Easy MDE. toggleStrikethrough = toggleStrikethrough ;
Easy MDE. toggleBlockquote = toggleBlockquote ;
Easy MDE. toggleHeadingSmaller = toggleHeadingSmaller ;
Easy MDE. toggleHeadingBigger = toggleHeadingBigger ;
Easy MDE. toggleHeading1 = toggleHeading1 ;
Easy MDE. toggleHeading2 = toggleHeading2 ;
Easy MDE. toggleHeading3 = toggleHeading3 ;
Easy MDE. toggleCodeBlock = toggleCodeBlock ;
Easy MDE. toggleUnorderedList = toggleUnorderedList ;
Easy MDE. toggleOrderedList = toggleOrderedList ;
Easy MDE. cleanBlock = cleanBlock ;
Easy MDE. drawLink = drawLink ;
Easy MDE. drawImage = drawImage ;
Easy MDE. drawTable = drawTable ;
Easy MDE. drawHorizontalRule = drawHorizontalRule ;
Easy MDE. undo = undo ;
Easy MDE. redo = redo ;
Easy MDE. togglePreview = togglePreview ;
Easy MDE. toggleSideBySide = toggleSideBySide ;
Easy MDE. toggleFullScreen = toggleFullScreen ;
/ * *
* Bind instance methods for exports .
* /
Simple MDE. prototype . toggleBold = function ( ) {
Easy MDE. prototype . toggleBold = function ( ) {
toggleBold ( this ) ;
} ;
Simple MDE. prototype . toggleItalic = function ( ) {
Easy MDE. prototype . toggleItalic = function ( ) {
toggleItalic ( this ) ;
} ;
Simple MDE. prototype . toggleStrikethrough = function ( ) {
Easy MDE. prototype . toggleStrikethrough = function ( ) {
toggleStrikethrough ( this ) ;
} ;
Simple MDE. prototype . toggleBlockquote = function ( ) {
Easy MDE. prototype . toggleBlockquote = function ( ) {
toggleBlockquote ( this ) ;
} ;
Simple MDE. prototype . toggleHeadingSmaller = function ( ) {
Easy MDE. prototype . toggleHeadingSmaller = function ( ) {
toggleHeadingSmaller ( this ) ;
} ;
Simple MDE. prototype . toggleHeadingBigger = function ( ) {
Easy MDE. prototype . toggleHeadingBigger = function ( ) {
toggleHeadingBigger ( this ) ;
} ;
Simple MDE. prototype . toggleHeading1 = function ( ) {
Easy MDE. prototype . toggleHeading1 = function ( ) {
toggleHeading1 ( this ) ;
} ;
Simple MDE. prototype . toggleHeading2 = function ( ) {
Easy MDE. prototype . toggleHeading2 = function ( ) {
toggleHeading2 ( this ) ;
} ;
Simple MDE. prototype . toggleHeading3 = function ( ) {
Easy MDE. prototype . toggleHeading3 = function ( ) {
toggleHeading3 ( this ) ;
} ;
Simple MDE. prototype . toggleCodeBlock = function ( ) {
Easy MDE. prototype . toggleCodeBlock = function ( ) {
toggleCodeBlock ( this ) ;
} ;
Simple MDE. prototype . toggleUnorderedList = function ( ) {
Easy MDE. prototype . toggleUnorderedList = function ( ) {
toggleUnorderedList ( this ) ;
} ;
Simple MDE. prototype . toggleOrderedList = function ( ) {
Easy MDE. prototype . toggleOrderedList = function ( ) {
toggleOrderedList ( this ) ;
} ;
Simple MDE. prototype . cleanBlock = function ( ) {
Easy MDE. prototype . cleanBlock = function ( ) {
cleanBlock ( this ) ;
} ;
Simple MDE. prototype . drawLink = function ( ) {
Easy MDE. prototype . drawLink = function ( ) {
drawLink ( this ) ;
} ;
Simple MDE. prototype . drawImage = function ( ) {
Easy MDE. prototype . drawImage = function ( ) {
drawImage ( this ) ;
} ;
Simple MDE. prototype . drawTable = function ( ) {
Easy MDE. prototype . drawTable = function ( ) {
drawTable ( this ) ;
} ;
Simple MDE. prototype . drawHorizontalRule = function ( ) {
Easy MDE. prototype . drawHorizontalRule = function ( ) {
drawHorizontalRule ( this ) ;
} ;
Simple MDE. prototype . undo = function ( ) {
Easy MDE. prototype . undo = function ( ) {
undo ( this ) ;
} ;
Simple MDE. prototype . redo = function ( ) {
Easy MDE. prototype . redo = function ( ) {
redo ( this ) ;
} ;
Simple MDE. prototype . togglePreview = function ( ) {
Easy MDE. prototype . togglePreview = function ( ) {
togglePreview ( this ) ;
} ;
Simple MDE. prototype . toggleSideBySide = function ( ) {
Easy MDE. prototype . toggleSideBySide = function ( ) {
toggleSideBySide ( this ) ;
} ;
Simple MDE. prototype . toggleFullScreen = function ( ) {
Easy MDE. prototype . toggleFullScreen = function ( ) {
toggleFullScreen ( this ) ;
} ;
Simple MDE. prototype . isPreviewActive = function ( ) {
Easy MDE. prototype . isPreviewActive = function ( ) {
var cm = this . codemirror ;
var wrapper = cm . getWrapperElement ( ) ;
var preview = wrapper . lastChild ;
@ -2060,7 +2060,7 @@ SimpleMDE.prototype.isPreviewActive = function () {
return /editor-preview-active/ . test ( preview . className ) ;
} ;
Simple MDE. prototype . isSideBySideActive = function ( ) {
Easy MDE. prototype . isSideBySideActive = function ( ) {
var cm = this . codemirror ;
var wrapper = cm . getWrapperElement ( ) ;
var preview = wrapper . nextSibling ;
@ -2068,19 +2068,19 @@ SimpleMDE.prototype.isSideBySideActive = function () {
return /editor-preview-active-side/ . test ( preview . className ) ;
} ;
Simple MDE. prototype . isFullscreenActive = function ( ) {
Easy MDE. prototype . isFullscreenActive = function ( ) {
var cm = this . codemirror ;
return cm . getOption ( 'fullScreen' ) ;
} ;
Simple MDE. prototype . getState = function ( ) {
Easy MDE. prototype . getState = function ( ) {
var cm = this . codemirror ;
return getState ( cm ) ;
} ;
Simple MDE. prototype . toTextArea = function ( ) {
Easy MDE. prototype . toTextArea = function ( ) {
var cm = this . codemirror ;
var wrapper = cm . getWrapperElement ( ) ;
@ -2105,4 +2105,4 @@ SimpleMDE.prototype.toTextArea = function () {
}
} ;
module . exports = Simple MDE;
module . exports = Easy MDE;