'),k=0,l=i[1].length;l>k;k++){var m=a(h[i[1][k]](e,f));m.attr("data-name",i[1][k]),j.append(m)}b.append(j)}return d("note-air-popover",b.children())},k=a('
');return k.append(g()),k.append(i()),f.airMode&&k.append(j()),k},j=function(){return'
'},l=function(a,b){var c="note-shortcut-col col-xs-6 note-shortcut-",d=[];for(var e in b)b.hasOwnProperty(e)&&d.push('
'+b[e].kbd+'
'+b[e].text+"
");return'
'+d.join('
')+"
"},m=function(a){var b=[{kbd:"⌘ + B",text:a.font.bold},{kbd:"⌘ + I",text:a.font.italic},{kbd:"⌘ + U",text:a.font.underline},{kbd:"⌘ + \\",text:a.font.clear}];return l(a.shortcut.textFormatting,b)},n=function(a){var b=[{kbd:"⌘ + Z",text:a.history.undo},{kbd:"⌘ + ⇧ + Z",text:a.history.redo},{kbd:"⌘ + ]",text:a.paragraph.indent},{kbd:"⌘ + [",text:a.paragraph.outdent},{kbd:"⌘ + ENTER",text:a.hr.insert}];return l(a.shortcut.action,b)},o=function(a){var b=[{kbd:"⌘ + ⇧ + L",text:a.paragraph.left},{kbd:"⌘ + ⇧ + E",text:a.paragraph.center},{kbd:"⌘ + ⇧ + R",text:a.paragraph.right},{kbd:"⌘ + ⇧ + J",text:a.paragraph.justify},{kbd:"⌘ + ⇧ + NUM7",text:a.lists.ordered},{kbd:"⌘ + ⇧ + NUM8",text:a.lists.unordered}];return l(a.shortcut.paragraphFormatting,b)},p=function(a){var b=[{kbd:"⌘ + NUM0",text:a.style.normal},{kbd:"⌘ + NUM1",text:a.style.h1},{kbd:"⌘ + NUM2",text:a.style.h2},{kbd:"⌘ + NUM3",text:a.style.h3},{kbd:"⌘ + NUM4",text:a.style.h4},{kbd:"⌘ + NUM5",text:a.style.h5},{kbd:"⌘ + NUM6",text:a.style.h6}];return l(a.shortcut.documentStyle,b)},q=function(a,b){var c=b.extraKeys,d=[];for(var e in c)c.hasOwnProperty(e)&&d.push({kbd:e,text:c[e]});return l(a.shortcut.extraKeys,d)},r=function(a,b){var c='class="note-shortcut note-shortcut-col col-sm-6 col-xs-12"',d=["
"+n(a,b)+"
"+m(a,b)+"
","
"+p(a,b)+"
"+o(a,b)+"
"];return b.extraKeys&&d.push("
"+q(a,b)+"
"),'
'+d.join('
')+"
"},s=function(a){return a.replace(/⌘/g,"Ctrl").replace(/⇧/g,"Shift")},t={image:function(a,b){var c="";if(b.maximumImageFileSize){var d=Math.floor(Math.log(b.maximumImageFileSize)/Math.log(1024)),f=1*(b.maximumImageFileSize/Math.pow(1024,d)).toFixed(2)+" "+" KMGTP"[d]+"B";c="
"+a.image.maximumFileSize+" : "+f+" "}var g='
'+a.image.selectFromFiles+' '+c+'
'+a.image.url+'
',h='
'+a.image.insert+" ";return e("note-image-dialog",a.image.insert,g,h)},link:function(a,b){var c='
'+a.link.textToDisplay+'
'+a.link.url+'
'+(b.disableLinkTarget?"":'
'+a.link.openInNewWindow+"
"),d='
'+a.link.insert+" ";return e("note-link-dialog",a.link.insert,c,d)},help:function(a,b){var c='
'+a.shortcut.close+' '+a.shortcut.shortcuts+"
"+(f.isMac?r(a,b):s(r(a,b)))+'
Summernote 0.6.9 · Project · Issues
';return e("note-help-dialog","",c,"")}},u=function(b,c){var d="";return a.each(t,function(a,e){d+=e(b,c)}),'
'+d+"
"},v=function(){return'
'},w=function(a){return f.isMac&&(a=a.replace("CMD","⌘").replace("SHIFT","⇧")),a.replace("BACKSLASH","\\").replace("SLASH","/").replace("LEFTBRACKET","[").replace("RIGHTBRACKET","]")},x=function(b,c,d){var e=g.invertObject(c),f=b.find("button");f.each(function(b,c){var d=a(c),f=e[d.data("event")];f&&d.attr("title",function(a,b){return b+" ("+w(f)+")"})}).tooltip({container:"body",trigger:"hover",placement:d||"top"}).on("click",function(){a(this).tooltip("hide")})},y=function(b,c){var d=c.colors;b.find(".note-color-palette").each(function(){for(var b=a(this),c=b.attr("data-target-event"),e=[],f=0,g=d.length;g>f;f++){for(var h=d[f],i=[],j=0,k=h.length;k>j;j++){var l=h[j];i.push(['
'].join(""))}e.push('
'+i.join("")+"
")}b.html(e.join(""))})};this.createLayoutByAirMode=function(b,c){var d=c.langInfo,e=c.keyMap[f.isMac?"mac":"pc"],h=g.uniqueId();b.addClass("note-air-editor note-editable"),b.attr({id:"note-editor-"+h,contentEditable:!0});var k=document.body,l=a(i(d,c));l.addClass("note-air-layout"),l.attr("id","note-popover-"+h),l.appendTo(k),x(l,e),y(l,c);var m=a(j());m.addClass("note-air-layout"),m.attr("id","note-handle-"+h),m.appendTo(k);var n=a(u(d,c));n.addClass("note-air-layout"),n.attr("id","note-dialog-"+h),n.find("button.close, a.modal-close").click(function(){a(this).closest(".modal").modal("hide")}),n.appendTo(k)},this.createLayoutByFrame=function(b,c){var d=c.langInfo,e=a('
');c.width&&e.width(c.width),c.height>0&&a('
'+(c.disableResizeEditor?"":v())+"
").prependTo(e);var g=!b.is(":disabled"),l=a('
').prependTo(e);c.height&&l.height(c.height),c.direction&&l.attr("dir",c.direction);var m=b.attr("placeholder")||c.placeholder;m&&l.attr("data-placeholder",m),l.html(k.html(b)),a('
').prependTo(e);for(var n=a('
'),o=0,p=c.toolbar.length;p>o;o++){for(var q=c.toolbar[o][0],r=c.toolbar[o][1],s=a('
'),t=0,w=r.length;w>t;t++){var z=h[r[t]];if(a.isFunction(z)){var A=a(z(d,c));A.attr("data-name",r[t]),s.append(A)}}n.append(s)}n.prependTo(e);var B=c.keyMap[f.isMac?"mac":"pc"];y(n,c),x(n,B,"bottom");var C=a(i(d,c)).prependTo(e);y(C,c),x(C,B),a(j()).prependTo(e);var D=a(u(d,c)).prependTo(e);D.find("button.close, a.modal-close").click(function(){a(this).closest(".modal").modal("hide")}),a('
').prependTo(e),e.insertAfter(b),b.hide()},this.hasNoteEditor=function(a){return this.noteEditorFromHolder(a).length>0},this.noteEditorFromHolder=function(b){return b.hasClass("note-air-editor")?b:b.next().hasClass("note-editor")?b.next():a()},this.createLayout=function(a,b){b.airMode?this.createLayoutByAirMode(a,b):this.createLayoutByFrame(a,b)},this.layoutInfoFromHolder=function(a){var b=this.noteEditorFromHolder(a);if(b.length)return b.data("holder",a),k.buildLayoutInfo(b)},this.removeLayout=function(a,b,c){c.airMode?(a.removeClass("note-air-editor note-editable").removeAttr("id contentEditable"),b.popover().remove(),b.handle().remove(),b.dialog().remove()):(a.html(b.editable().html()),b.editor().remove(),a.show())},this.getTemplate=function(){return{button:b,iconButton:c,dialog:e}},this.addButtonInfo=function(a,b){h[a]=b},this.addDialogInfo=function(a,b){t[a]=b}};a.summernote=a.summernote||{},a.extend(a.summernote,m);var L=new K,M=new J;a.extend(a.summernote,{renderer:L,eventHandler:M,core:{agent:f,list:h,dom:k,range:l},pluginEvents:{},plugins:[]}),a.summernote.addPlugin=function(b){a.summernote.plugins.push(b),b.buttons&&a.each(b.buttons,function(a,b){L.addButtonInfo(a,b)}),b.dialogs&&a.each(b.dialogs,function(a,b){L.addDialogInfo(a,b)}),b.events&&a.each(b.events,function(b,c){a.summernote.pluginEvents[b]=c}),b.langs&&a.each(b.langs,function(b,c){a.summernote.lang[b]&&a.extend(a.summernote.lang[b],c)}),b.options&&a.extend(a.summernote.options,b.options)},a.fn.extend({summernote:function(){var b=a.type(h.head(arguments)),c="string"===b,d="object"===b,e=d?h.head(arguments):{};if(e=a.extend({},a.summernote.options,e),e.icons=a.extend({},a.summernote.options.icons,e.icons),e.langInfo=a.extend(!0,{},a.summernote.lang["en-US"],a.summernote.lang[e.lang]),!c&&d)for(var f=0,g=a.summernote.plugins.length;g>f;f++){var i=a.summernote.plugins[f];e.plugin[i.name]&&(a.summernote.plugins[f]=a.extend(!0,i,e.plugin[i.name]))}this.each(function(b,c){var d=a(c);if(!L.hasNoteEditor(d)){L.createLayout(d,e);var f=L.layoutInfoFromHolder(d);d.data("layoutInfo",f),M.attach(f,e),M.attachCustomEvent(f,e)}});var j=this.first();if(j.length){var k=L.layoutInfoFromHolder(j);if(c){var l=h.head(h.from(arguments)),m=h.tail(h.from(arguments)),n=[l,k.editable()].concat(m);return M.invoke.apply(M,n)}e.focus&&k.editable().focus()}return this},code:function(b){if(void 0===b){var c=this.first();if(!c.length)return;var d=L.layoutInfoFromHolder(c),e=d&&d.editable();if(e&&e.length){var f=M.invoke("codeview.isActivated",d);return M.invoke("codeview.sync",d),f?d.codable().val():d.editable().html()}return k.value(c)}return this.each(function(c,d){var e=L.layoutInfoFromHolder(a(d)),f=e&&e.editable();f&&f.html(b)}),this},destroy:function(){return this.each(function(b,c){var d=a(c);if(L.hasNoteEditor(d)){var e=L.layoutInfoFromHolder(d),f=e.editor().data("options");M.detach(e,f),L.removeLayout(d,e,f)}}),this}})});