@@ -12871,6 +12871,7 @@ function createIcon(options, enableTooltips) {
1287112871 }
1287212872 }
1287312873
12874+ el . tabIndex = - 1 ;
1287412875 el . className = options . className ;
1287512876 return el ;
1287612877}
@@ -13468,19 +13469,20 @@ function wordCount(data) {
1346813469 return count ;
1346913470}
1347013471
13471-
1347213472var toolbarBuiltInButtons = {
1347313473 "bold" : {
1347413474 name : "bold" ,
1347513475 action : toggleBold ,
1347613476 className : "fa fa-bold" ,
13477- title : "Bold (Ctrl+B)"
13477+ title : "Bold (Ctrl+B)" ,
13478+ default : true
1347813479 } ,
1347913480 "italic" : {
1348013481 name : "italic" ,
1348113482 action : toggleItalic ,
1348213483 className : "fa fa-italic" ,
13483- title : "Italic (Ctrl+I)"
13484+ title : "Italic (Ctrl+I)" ,
13485+ default : true
1348413486 } ,
1348513487 "strikethrough" : {
1348613488 name : "strikethrough" ,
@@ -13492,7 +13494,8 @@ var toolbarBuiltInButtons = {
1349213494 name : "heading" ,
1349313495 action : toggleHeadingSmaller ,
1349413496 className : "fa fa-header" ,
13495- title : "Heading (Ctrl+H)"
13497+ title : "Heading (Ctrl+H)" ,
13498+ default : true
1349613499 } ,
1349713500 "heading-smaller" : {
1349813501 name : "heading-smaller" ,
@@ -13524,6 +13527,9 @@ var toolbarBuiltInButtons = {
1352413527 className : "fa fa-header fa-header-x fa-header-3" ,
1352513528 title : "Small Heading"
1352613529 } ,
13530+ "separator-1" : {
13531+ name : "separator-1"
13532+ } ,
1352713533 "code" : {
1352813534 name : "code" ,
1352913535 action : toggleCodeBlock ,
@@ -13534,31 +13540,39 @@ var toolbarBuiltInButtons = {
1353413540 name : "quote" ,
1353513541 action : toggleBlockquote ,
1353613542 className : "fa fa-quote-left" ,
13537- title : "Quote (Ctrl+')"
13543+ title : "Quote (Ctrl+')" ,
13544+ default : true
1353813545 } ,
1353913546 "unordered-list" : {
1354013547 name : "unordered-list" ,
1354113548 action : toggleUnorderedList ,
1354213549 className : "fa fa-list-ul" ,
13543- title : "Generic List (Ctrl+L)"
13550+ title : "Generic List (Ctrl+L)" ,
13551+ default : true
1354413552 } ,
1354513553 "ordered-list" : {
1354613554 name : "ordered-list" ,
1354713555 action : toggleOrderedList ,
1354813556 className : "fa fa-list-ol" ,
13549- title : "Numbered List (Ctrl+Alt+L)"
13557+ title : "Numbered List (Ctrl+Alt+L)" ,
13558+ default : true
13559+ } ,
13560+ "separator-2" : {
13561+ name : "separator-2"
1355013562 } ,
1355113563 "link" : {
1355213564 name : "link" ,
1355313565 action : drawLink ,
1355413566 className : "fa fa-link" ,
13555- title : "Create Link (Ctrl+K)"
13567+ title : "Create Link (Ctrl+K)" ,
13568+ default : true
1355613569 } ,
1355713570 "image" : {
1355813571 name : "image" ,
1355913572 action : drawImage ,
1356013573 className : "fa fa-picture-o" ,
13561- title : "Insert Image (Ctrl+Alt+I)"
13574+ title : "Insert Image (Ctrl+Alt+I)" ,
13575+ default : true
1356213576 } ,
1356313577 "table" : {
1356413578 name : "table" ,
@@ -13572,29 +13586,36 @@ var toolbarBuiltInButtons = {
1357213586 className : "fa fa-minus" ,
1357313587 title : "Insert Horizontal Line"
1357413588 } ,
13589+ "separator-3" : {
13590+ name : "separator-3"
13591+ } ,
1357513592 "preview" : {
1357613593 name : "preview" ,
1357713594 action : togglePreview ,
1357813595 className : "fa fa-eye no-disable" ,
13579- title : "Toggle Preview (Ctrl+P)"
13596+ title : "Toggle Preview (Ctrl+P)" ,
13597+ default : true
1358013598 } ,
1358113599 "side-by-side" : {
1358213600 name : "side-by-side" ,
1358313601 action : toggleSideBySide ,
1358413602 className : "fa fa-columns no-disable no-mobile" ,
13585- title : "Toggle Side by Side (F9)"
13603+ title : "Toggle Side by Side (F9)" ,
13604+ default : true
1358613605 } ,
1358713606 "fullscreen" : {
1358813607 name : "fullscreen" ,
1358913608 action : toggleFullScreen ,
1359013609 className : "fa fa-arrows-alt no-disable no-mobile" ,
13591- title : "Toggle Fullscreen (F11)"
13610+ title : "Toggle Fullscreen (F11)" ,
13611+ default : true
1359213612 } ,
1359313613 "guide" : {
1359413614 name : "guide" ,
1359513615 action : "http://nextstepwebs.github.io/simplemde-markdown-editor/markdown-guide" ,
1359613616 className : "fa fa-question-circle" ,
13597- title : "Markdown Guide"
13617+ title : "Markdown Guide" ,
13618+ default : true
1359813619 }
1359913620} ;
1360013621
@@ -13659,10 +13680,28 @@ function SimpleMDE(options) {
1365913680 }
1366013681
1366113682
13662- // Handle toolbar and status bar
13663- if ( options . toolbar !== false )
13664- options . toolbar = options . toolbar || SimpleMDE . toolbar ;
13683+ // Handle toolbar
13684+ if ( options . toolbar === undefined ) {
13685+ // Initialize
13686+ options . toolbar = [ ] ;
13687+
13688+
13689+ // Loop over the built in buttons, to get the preferred order
13690+ for ( var key in toolbarBuiltInButtons ) {
13691+ if ( toolbarBuiltInButtons . hasOwnProperty ( key ) ) {
13692+ if ( key . indexOf ( "separator-" ) != - 1 ) {
13693+ options . toolbar . push ( "|" ) ;
13694+ }
13695+
13696+ if ( toolbarBuiltInButtons [ key ] . default === true || ( options . showIcons && options . showIcons . constructor === Array && options . showIcons . indexOf ( key ) != - 1 ) ) {
13697+ options . toolbar . push ( key ) ;
13698+ }
13699+ }
13700+ }
13701+ }
13702+
1366513703
13704+ // Handle status bar
1366613705 if ( ! options . hasOwnProperty ( "status" ) ) {
1366713706 options . status = [ "autosave" , "lines" , "words" , "cursor" ] ;
1366813707 }
@@ -13705,16 +13744,11 @@ function SimpleMDE(options) {
1370513744 // The codemirror component is only available after rendering
1370613745 // so, the setter for the initialValue can only run after
1370713746 // the element has been rendered
13708- if ( options . initialValue ) {
13747+ if ( options . initialValue && ( ! this . options . autosave || this . options . autosave . foundSavedValue !== true ) ) {
1370913748 this . value ( options . initialValue ) ;
1371013749 }
1371113750}
1371213751
13713- /**
13714- * Default toolbar elements.
13715- */
13716- SimpleMDE . toolbar = [ "bold" , "italic" , "heading" , "|" , "quote" , "unordered-list" , "ordered-list" , "|" , "link" , "image" , "|" , "preview" , "side-by-side" , "fullscreen" , "guide" ] ;
13717-
1371813752/**
1371913753 * Default markdown render.
1372013754 */
@@ -13850,8 +13884,10 @@ SimpleMDE.prototype.autosave = function() {
1385013884 }
1385113885
1385213886 if ( this . options . autosave . loaded !== true ) {
13853- if ( typeof localStorage . getItem ( "smde_" + this . options . autosave . uniqueId ) == "string" && localStorage . getItem ( "smde_" + this . options . autosave . uniqueId ) != "" )
13887+ if ( typeof localStorage . getItem ( "smde_" + this . options . autosave . uniqueId ) == "string" && localStorage . getItem ( "smde_" + this . options . autosave . uniqueId ) != "" ) {
1385413888 this . codemirror . setValue ( localStorage . getItem ( "smde_" + this . options . autosave . uniqueId ) ) ;
13889+ this . options . autosave . foundSavedValue = true ;
13890+ }
1385513891
1385613892 this . options . autosave . loaded = true ;
1385713893 }
0 commit comments