Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

medium-editor

Package Overview
Dependencies
Maintainers
2
Versions
125
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

medium-editor - npm Package Compare versions

Comparing version 2.1.0 to 2.1.2

spec/header-tags.spec.js

2

bower.json
{
"name": "medium-editor",
"version": "2.1.0",
"version": "2.1.2",
"homepage": "http://daviferreira.github.io/medium-editor/",

@@ -5,0 +5,0 @@ "authors": [

@@ -0,1 +1,13 @@

2.1.2 / 2015-01-30
==================
* Specify default npm registry (`http://registry.npmjs.org`)
2.1.1 / 2015-01-30
==================
* Adds support for newlines in placeholder attribute
* Adds support and documentation for new toolbar extensions
* Adds support for changing 'open in new window' label text
* Fixes bug where `nodeValue` could unexpectedly be null
* A couple of fixes to make tests a bit more reliable when run in the browser
2.1.0 / 2015-01-27

@@ -2,0 +14,0 @@ ==================

@@ -1,2 +0,2 @@

function MediumEditor(a,b){"use strict";return this.init(a,b)}"object"==typeof module?module.exports=MediumEditor:"function"==typeof define&&define.amd&&define(function(){"use strict";return MediumEditor}),function(a,b){"use strict";function c(a,b){var c;if(void 0===a)return b;for(c in b)b.hasOwnProperty(c)&&a.hasOwnProperty(c)===!1&&(a[c]=b[c]);return a}function d(a,b){var c,d,e,f,g=50,h=null,i=0;return b||0===b||(b=g),f=function(){i=m(),h=null,e=a.apply(c,d),h||(c=d=null)},function(){var g=m(),j=b-(g-i);return c=this,d=arguments,0>=j||j>b?(clearTimeout(h),h=null,i=g,e=a.apply(c,d),h||(c=d=null)):h||(h=setTimeout(f,j)),e}}function e(a,b){for(var c=b.parentNode;null!==c;){if(c===a)return!0;c=c.parentNode}return!1}function f(a,b,c){var d,e=!1,f=c.createNodeIterator(a,NodeFilter.SHOW_TEXT);for(d=f.nextNode();d;){if(d===b)e=!0;else if(e&&3===d.nodeType&&d.nodeValue.length>0)break;d=f.nextNode()}return d}function g(){var a,b,c,d=this.options.contentWindow.getSelection();if(d.getRangeAt&&d.rangeCount){for(c=[],a=0,b=d.rangeCount;b>a;a+=1)c.push(d.getRangeAt(a));return c}return null}function h(a){var b,c,d=this.options.contentWindow.getSelection();if(a)for(d.removeAllRanges(),b=0,c=a.length;c>b;b+=1)d.addRange(a[b])}function i(){var a=this.options.ownerDocument.getSelection().anchorNode,b=a&&3===a.nodeType?a.parentNode:a;return b}function j(){var a,b,c,d,e="";if(void 0!==this.options.contentWindow.getSelection){if(b=this.options.contentWindow.getSelection(),b.rangeCount){for(d=this.options.ownerDocument.createElement("div"),a=0,c=b.rangeCount;c>a;a+=1)d.appendChild(b.getRangeAt(a).cloneContents());e=d.innerHTML}}else void 0!==this.options.ownerDocument.selection&&"Text"===this.options.ownerDocument.selection.type&&(e=this.options.ownerDocument.selection.createRange().htmlText);return e}function k(a){return!(!a||1!==a.nodeType)}function l(b,c){var d,e,f,g,h,i;if(b.queryCommandSupported("insertHTML"))return b.execCommand("insertHTML",!1,c);if(d=a.getSelection(),d.getRangeAt&&d.rangeCount){for(e=d.getRangeAt(0),e.deleteContents(),f=b.createElement("div"),f.innerHTML=c,g=b.createDocumentFragment();f.firstChild;)h=f.firstChild,i=g.appendChild(h);e.insertNode(g),i&&(e=e.cloneRange(),e.setStartAfter(i),e.collapse(!0),d.removeAllRanges(),d.addRange(e))}}var m=Date.now||function(){return(new Date).getTime()};MediumEditor.prototype={defaults:{allowMultiParagraphSelection:!0,anchorInputPlaceholder:"Paste or type a link",anchorPreviewHideDelay:500,buttons:["bold","italic","underline","anchor","header1","header2","quote"],buttonLabels:!1,checkLinkFormat:!1,cleanPastedHTML:!1,delay:0,diffLeft:0,diffTop:-10,disableReturn:!1,disableDoubleReturn:!1,disableToolbar:!1,disableEditing:!1,disableAnchorForm:!1,disablePlaceholders:!1,elementsContainer:!1,standardizeSelectionStart:!1,contentWindow:a,ownerDocument:b,firstHeader:"h3",forcePlainText:!0,placeholder:"Type your text",secondHeader:"h4",targetBlank:!1,anchorTarget:!1,anchorButton:!1,anchorButtonClass:"btn",extensions:{},activeButtonClass:"medium-editor-button-active",firstButtonClass:"medium-editor-button-first",lastButtonClass:"medium-editor-button-last"},isIE:"Microsoft Internet Explorer"===navigator.appName||"Netscape"===navigator.appName&&null!==new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})").exec(navigator.userAgent),init:function(a,b){var d=1;if(this.options=c(b,this.defaults),this.setElementSelection(a),0!==this.elements.length){for(this.parentElements=["p","h1","h2","h3","h4","h5","h6","blockquote","pre"],this.options.elementsContainer||(this.options.elementsContainer=this.options.ownerDocument.body);this.options.elementsContainer.querySelector("#medium-editor-toolbar-"+d);)d+=1;return this.id=d,this.setup()}},setup:function(){this.events=[],this.isActive=!0,this.initThrottledMethods().initElements().bindSelect().bindPaste().setPlaceholders().bindElementActions().bindWindowActions().passInstance()},on:function(a,b,c,d){a.addEventListener(b,c,d),this.events.push([a,b,c,d])},off:function(a,b,c,d){var e,f=this.indexOfListener(a,b,c,d);-1!==f&&(e=this.events.splice(f,1)[0],e[0].removeEventListener(e[1],e[2],e[3]))},indexOfListener:function(a,b,c,d){var e,f,g;for(e=0,f=this.events.length;f>e;e+=1)if(g=this.events[e],g[0]===a&&g[1]===b&&g[2]===c&&g[3]===d)return e;return-1},delay:function(a){var b=this;setTimeout(function(){b.isActive&&a()},this.options.delay)},removeAllEvents:function(){for(var a=this.events.pop();a;)a[0].removeEventListener(a[1],a[2],a[3]),a=this.events.pop()},initThrottledMethods:function(){var a=this;return this.handleResize=d(function(){a.isActive&&a.positionToolbarIfShown()}),this.handleBlur=d(function(){a.isActive&&!a.keepToolbarAlive&&a.hideToolbarActions()}),this},initElements:function(){var a,b=!1;for(a=0;a<this.elements.length;a+=1)this.options.disableEditing||this.elements[a].getAttribute("data-disable-editing")||this.elements[a].setAttribute("contentEditable",!0),this.elements[a].getAttribute("data-placeholder")||this.elements[a].setAttribute("data-placeholder",this.options.placeholder),this.elements[a].setAttribute("data-medium-element",!0),this.elements[a].setAttribute("role","textbox"),this.elements[a].setAttribute("aria-multiline",!0),this.bindParagraphCreation(a),this.options.disableToolbar||this.elements[a].getAttribute("data-disable-toolbar")||(b=!0);return b&&this.initToolbar().bindButtons().bindAnchorForm().bindAnchorPreview(),this},setElementSelection:function(a){a||(a=[]),"string"==typeof a&&(a=this.options.ownerDocument.querySelectorAll(a)),k(a)&&(a=[a]),this.elements=Array.prototype.slice.apply(a)},bindBlur:function(){var a=this,b=function(b){b.target===a.toolbar||b.target===a.elements[0]||e(a.elements[0],b.target)||e(a.toolbar,b.target)||e(a.anchorPreview,b.target)||(a.options.disablePlaceholders||a.placeholderWrapper(b,a.elements[0]),a.handleBlur())};return this.on(this.options.ownerDocument.body,"click",b,!0),this.on(this.options.ownerDocument.body,"focus",b,!0),this},bindClick:function(a){var b=this;return this.on(this.elements[a],"click",function(){b.options.disablePlaceholders||this.classList.remove("medium-editor-placeholder"),b.options.staticToolbar&&b.setToolbarPosition()}),this},bindElementActions:function(){var a;for(a=0;a<this.elements.length;a+=1)this.options.disablePlaceholders||this.activatePlaceholder(this.elements[a]),this.bindReturn(a).bindTab(a).bindBlur(a).bindClick(a);return this},activatePlaceholder:function(a){a.querySelector("img")||a.querySelector("blockquote")||""!==a.textContent.replace(/^\s+|\s+$/g,"")||a.classList.add("medium-editor-placeholder")},placeholderWrapper:function(a,b){b=b||a.target,b.classList.remove("medium-editor-placeholder"),"keypress"!==a.type&&this.activatePlaceholder(b)},serialize:function(){var a,b,c={};for(a=0;a<this.elements.length;a+=1)b=""!==this.elements[a].id?this.elements[a].id:"element-"+a,c[b]={value:this.elements[a].innerHTML.trim()};return c},callExtensions:function(a){if(!(arguments.length<1)){var b,c,d=Array.prototype.slice.call(arguments,1);for(c in this.options.extensions)this.options.extensions.hasOwnProperty(c)&&(b=this.options.extensions[c],void 0!==b[a]&&b[a].apply(b,d))}},passInstance:function(){var a,b,c=this;for(b in c.options.extensions)c.options.extensions.hasOwnProperty(b)&&(a=c.options.extensions[b],a.parent&&(a.base=c));return c},bindParagraphCreation:function(a){var b=this;return this.on(this.elements[a],"keypress",function(a){var c,d;32===a.which&&(c=i.call(b),d=c.tagName.toLowerCase(),"a"===d&&b.options.ownerDocument.execCommand("unlink",!1,null))}),this.on(this.elements[a],"keyup",function(a){var c,d,e=i.call(b);e&&e.getAttribute("data-medium-element")&&0===e.children.length&&!b.options.disableReturn&&!e.getAttribute("data-disable-return")&&b.options.ownerDocument.execCommand("formatBlock",!1,"p"),13===a.which&&(e=i.call(b),c=e.tagName.toLowerCase(),d=b.getSelectionElement(),b.options.disableReturn||d.getAttribute("data-disable-return")||"li"===c||b.isListItemChild(e)||(a.shiftKey||b.options.ownerDocument.execCommand("formatBlock",!1,"p"),"a"===c&&b.options.ownerDocument.execCommand("unlink",!1,null)))}),this},isListItemChild:function(a){for(var b=a.parentNode,c=b.tagName.toLowerCase();-1===this.parentElements.indexOf(c)&&"div"!==c;){if("li"===c)return!0;if(b=b.parentNode,!b||!b.tagName)return!1;c=b.tagName.toLowerCase()}return!1},bindReturn:function(a){var b=this;return this.on(this.elements[a],"keypress",function(a){if(13===a.which)if(b.options.disableReturn||this.getAttribute("data-disable-return"))a.preventDefault();else if(b.options.disableDoubleReturn||this.getAttribute("data-disable-double-return")){var c=i.call(b);c&&"\n"===c.textContent&&a.preventDefault()}}),this},bindTab:function(a){var b=this;return this.on(this.elements[a],"keydown",function(a){if(9===a.which){var c=i.call(b).tagName.toLowerCase();"pre"===c&&(a.preventDefault(),b.options.ownerDocument.execCommand("insertHtml",null," ")),"li"===c&&(a.preventDefault(),a.shiftKey?b.options.ownerDocument.execCommand("outdent",a):b.options.ownerDocument.execCommand("indent",a))}}),this},buttonTemplate:function(a){var b=this.getButtonLabels(this.options.buttonLabels),c={bold:'<button class="medium-editor-action medium-editor-action-bold" data-action="bold" data-element="b" aria-label="bold">'+b.bold+"</button>",italic:'<button class="medium-editor-action medium-editor-action-italic" data-action="italic" data-element="i" aria-label="italic">'+b.italic+"</button>",underline:'<button class="medium-editor-action medium-editor-action-underline" data-action="underline" data-element="u" aria-label="underline">'+b.underline+"</button>",strikethrough:'<button class="medium-editor-action medium-editor-action-strikethrough" data-action="strikethrough" data-element="strike" aria-label="strike through">'+b.strikethrough+"</button>",superscript:'<button class="medium-editor-action medium-editor-action-superscript" data-action="superscript" data-element="sup" aria-label="superscript">'+b.superscript+"</button>",subscript:'<button class="medium-editor-action medium-editor-action-subscript" data-action="subscript" data-element="sub" aria-label="subscript">'+b.subscript+"</button>",anchor:'<button class="medium-editor-action medium-editor-action-anchor" data-action="anchor" data-element="a" aria-label="link">'+b.anchor+"</button>",image:'<button class="medium-editor-action medium-editor-action-image" data-action="image" data-element="img" aria-label="image">'+b.image+"</button>",header1:'<button class="medium-editor-action medium-editor-action-header1" data-action="append-'+this.options.firstHeader+'" data-element="'+this.options.firstHeader+'" aria-label="h1">'+b.header1+"</button>",header2:'<button class="medium-editor-action medium-editor-action-header2" data-action="append-'+this.options.secondHeader+'" data-element="'+this.options.secondHeader+' "aria-label="h2">'+b.header2+"</button>",quote:'<button class="medium-editor-action medium-editor-action-quote" data-action="append-blockquote" data-element="blockquote" aria-label="blockquote">'+b.quote+"</button>",orderedlist:'<button class="medium-editor-action medium-editor-action-orderedlist" data-action="insertorderedlist" data-element="ol" aria-label="ordered list">'+b.orderedlist+"</button>",unorderedlist:'<button class="medium-editor-action medium-editor-action-unorderedlist" data-action="insertunorderedlist" data-element="ul" aria-label="unordered list">'+b.unorderedlist+"</button>",pre:'<button class="medium-editor-action medium-editor-action-pre" data-action="append-pre" data-element="pre" aria-label="preformatted text">'+b.pre+"</button>",indent:'<button class="medium-editor-action medium-editor-action-indent" data-action="indent" data-element="ul" aria-label="indent">'+b.indent+"</button>",outdent:'<button class="medium-editor-action medium-editor-action-outdent" data-action="outdent" data-element="ul" aria-label="outdent">'+b.outdent+"</button>",justifyCenter:'<button class="medium-editor-action medium-editor-action-justifyCenter" data-action="justifyCenter" data-element="" aria-label="center justify">'+b.justifyCenter+"</button>",justifyFull:'<button class="medium-editor-action medium-editor-action-justifyFull" data-action="justifyFull" data-element="" aria-label="full justify">'+b.justifyFull+"</button>",justifyLeft:'<button class="medium-editor-action medium-editor-action-justifyLeft" data-action="justifyLeft" data-element="" aria-label="left justify">'+b.justifyLeft+"</button>",justifyRight:'<button class="medium-editor-action medium-editor-action-justifyRight" data-action="justifyRight" data-element="" aria-label="right justify">'+b.justifyRight+"</button>"};return c[a]||!1},getButtonLabels:function(a){var b,c,d={bold:"<b>B</b>",italic:"<b><i>I</i></b>",underline:"<b><u>U</u></b>",strikethrough:"<s>A</s>",superscript:"<b>x<sup>1</sup></b>",subscript:"<b>x<sub>1</sub></b>",anchor:"<b>#</b>",image:"<b>image</b>",header1:"<b>H1</b>",header2:"<b>H2</b>",quote:"<b>&ldquo;</b>",orderedlist:"<b>1.</b>",unorderedlist:"<b>&bull;</b>",pre:"<b>0101</b>",indent:"<b>&rarr;</b>",outdent:"<b>&larr;</b>",justifyCenter:"<b>C</b>",justifyFull:"<b>J</b>",justifyLeft:"<b>L</b>",justifyRight:"<b>R</b>"};if("fontawesome"===a?b={bold:'<i class="fa fa-bold"></i>',italic:'<i class="fa fa-italic"></i>',underline:'<i class="fa fa-underline"></i>',strikethrough:'<i class="fa fa-strikethrough"></i>',superscript:'<i class="fa fa-superscript"></i>',subscript:'<i class="fa fa-subscript"></i>',anchor:'<i class="fa fa-link"></i>',image:'<i class="fa fa-picture-o"></i>',quote:'<i class="fa fa-quote-right"></i>',orderedlist:'<i class="fa fa-list-ol"></i>',unorderedlist:'<i class="fa fa-list-ul"></i>',pre:'<i class="fa fa-code fa-lg"></i>',indent:'<i class="fa fa-indent"></i>',outdent:'<i class="fa fa-outdent"></i>',justifyCenter:'<i class="fa fa-align-center"></i>',justifyFull:'<i class="fa fa-align-justify"></i>',justifyLeft:'<i class="fa fa-align-left"></i>',justifyRight:'<i class="fa fa-align-right"></i>'}:"object"==typeof a&&(b=a),"object"==typeof b)for(c in b)b.hasOwnProperty(c)&&(d[c]=b[c]);return d},initToolbar:function(){return this.toolbar?this:(this.toolbar=this.createToolbar(),this.keepToolbarAlive=!1,this.toolbarActions=this.toolbar.querySelector(".medium-editor-toolbar-actions"),this.anchorPreview=this.createAnchorPreview(),this.options.disableAnchorForm||(this.anchorForm=this.toolbar.querySelector(".medium-editor-toolbar-form-anchor"),this.anchorInput=this.anchorForm.querySelector("input.medium-editor-toolbar-anchor-input"),this.anchorTarget=this.anchorForm.querySelector("input.medium-editor-toolbar-anchor-target"),this.anchorButton=this.anchorForm.querySelector("input.medium-editor-toolbar-anchor-button")),this)},createToolbar:function(){var a=this.options.ownerDocument.createElement("div");return a.id="medium-editor-toolbar-"+this.id,a.className="medium-editor-toolbar",a.className+=this.options.staticToolbar?" static-toolbar":" stalker-toolbar",a.appendChild(this.toolbarButtons()),this.options.disableAnchorForm||a.appendChild(this.toolbarFormAnchor()),this.options.elementsContainer.appendChild(a),a},toolbarButtons:function(){var a,b,c,d,e=this.options.buttons,f=this.options.ownerDocument.createElement("ul");for(f.id="medium-editor-toolbar-actions"+this.id,f.className="medium-editor-toolbar-actions clearfix",b=0;b<e.length;b+=1)this.options.extensions.hasOwnProperty(e[b])?(d=this.options.extensions[e[b]],c=void 0!==d.getButton?d.getButton(this):null):c=this.buttonTemplate(e[b]),c&&(a=this.options.ownerDocument.createElement("li"),k(c)?a.appendChild(c):a.innerHTML=c,f.appendChild(a));return f},toolbarFormAnchor:function(){var a=this.options.ownerDocument.createElement("div"),b=this.options.ownerDocument.createElement("input"),c=this.options.ownerDocument.createElement("label"),d=this.options.ownerDocument.createElement("input"),e=this.options.ownerDocument.createElement("label"),f=this.options.ownerDocument.createElement("input"),g=this.options.ownerDocument.createElement("a"),h=this.options.ownerDocument.createElement("a");return g.setAttribute("href","#"),g.className="medium-editor-toobar-anchor-close",g.innerHTML="&times;",h.setAttribute("href","#"),h.className="medium-editor-toobar-anchor-save",h.innerHTML="&#10003;",b.setAttribute("type","text"),b.className="medium-editor-toolbar-anchor-input",b.setAttribute("placeholder",this.options.anchorInputPlaceholder),d.setAttribute("type","checkbox"),d.className="medium-editor-toolbar-anchor-target",c.innerHTML="Open in New Window?",c.insertBefore(d,c.firstChild),f.setAttribute("type","checkbox"),f.className="medium-editor-toolbar-anchor-button",e.innerHTML="Button",e.insertBefore(f,e.firstChild),a.className="medium-editor-toolbar-form-anchor",a.id="medium-editor-toolbar-form-anchor-"+this.id,a.appendChild(b),a.appendChild(h),a.appendChild(g),this.options.anchorTarget&&a.appendChild(c),this.options.anchorButton&&a.appendChild(e),a},bindSelect:function(){var a,b=this;for(this.checkSelectionWrapper=function(a){return!b.options.disableAnchorForm&&a&&b.clickingIntoArchorForm(a)?!1:void b.checkSelection()},this.on(this.options.ownerDocument.documentElement,"mouseup",this.checkSelectionWrapper),a=0;a<this.elements.length;a+=1)this.on(this.elements[a],"keyup",this.checkSelectionWrapper),this.on(this.elements[a],"blur",this.checkSelectionWrapper),this.on(this.elements[a],"click",this.checkSelectionWrapper);return this},stopSelectionUpdates:function(){this.preventSelectionUpdates=!0},startSelectionUpdates:function(){this.preventSelectionUpdates=!1},checkSelection:function(){var a,b;return this.preventSelectionUpdates||this.keepToolbarAlive===!0||this.options.disableToolbar||(a=this.options.contentWindow.getSelection(),!this.options.updateOnEmptySelection&&""===a.toString().trim()||this.options.allowMultiParagraphSelection===!1&&this.hasMultiParagraphs()||this.selectionInContentEditableFalse()?this.options.staticToolbar?this.anchorForm&&"block"===this.anchorForm.style.display&&(this.setToolbarButtonStates(),this.showToolbarActions()):this.hideToolbarActions():(b=this.getSelectionElement(),!b||b.getAttribute("data-disable-toolbar")?this.options.staticToolbar||this.hideToolbarActions():this.checkSelectionElement(a,b))),this},clickingIntoArchorForm:function(a){var b=this;return a.type&&"blur"===a.type.toLowerCase()&&a.relatedTarget&&a.relatedTarget===b.anchorInput?!0:!1},hasMultiParagraphs:function(){var a=j.call(this).replace(/<[\S]+><\/[\S]+>/gim,""),b=a.match(/<(p|h[0-6]|blockquote)>([\s\S]*?)<\/(p|h[0-6]|blockquote)>/g);return b?b.length:0},checkSelectionElement:function(a,b){var c,d,e,g=0;if(this.selection=a,this.selectionRange=this.selection.getRangeAt(0),this.options.standardizeSelectionStart&&this.selectionRange.startOffset===this.selectionRange.startContainer.nodeValue.length&&(d=f(this.getSelectionElement(),this.selectionRange.startContainer,this.options.ownerDocument))){for(g=0;0===d.nodeValue.substr(g,1).trim().length;)g+=1;e=this.options.ownerDocument.createRange(),e.setStart(d,g),e.setEnd(this.selectionRange.endContainer,this.selectionRange.endOffset),this.selection.removeAllRanges(),this.selection.addRange(e),this.selectionRange=e}for(c=0;c<this.elements.length;c+=1)if(this.elements[c]===b)return void this.setToolbarButtonStates().setToolbarPosition().showToolbarActions();this.options.staticToolbar||this.hideToolbarActions()},findMatchingSelectionParent:function(a){var b,c,d=this.options.contentWindow.getSelection();if(0===d.rangeCount)return!1;b=d.getRangeAt(0),c=b.commonAncestorContainer;do{if(1===c.nodeType){if(a(c))return c;if(c.getAttribute("data-medium-element"))return!1}c=c.parentNode}while(c);return!1},getSelectionElement:function(){return this.findMatchingSelectionParent(function(a){return a.getAttribute("data-medium-element")})},selectionInContentEditableFalse:function(){return this.findMatchingSelectionParent(function(a){return a&&"#text"!==a.nodeName&&"false"===a.getAttribute("contenteditable")})},setToolbarPosition:function(){var a,b,c,d=this.options.ownerDocument.documentElement&&this.options.ownerDocument.documentElement.scrollTop||this.options.ownerDocument.body.scrollTop,e=this.elements[0],f=e.getBoundingClientRect(),g=f.top+d,h=50,i=this.options.contentWindow.getSelection(),j=this.options.diffLeft-this.toolbar.offsetWidth/2,k=this.toolbar.offsetWidth/2;return null===i.focusNode?this:(this.showToolbar(),this.options.staticToolbar?(this.options.stickyToolbar?d>g+this.elements[0].offsetHeight-this.toolbar.offsetHeight?this.toolbar.style.top=g+this.elements[0].offsetHeight+"px":d>g-this.toolbar.offsetHeight?(this.toolbar.classList.add("sticky-toolbar"),this.toolbar.style.top="0px"):(this.toolbar.classList.remove("sticky-toolbar"),this.toolbar.style.top=g-this.toolbar.offsetHeight+"px"):this.toolbar.style.top=g-this.toolbar.offsetHeight+"px",this.toolbar.style.left=f.left+"px"):i.isCollapsed||(a=i.getRangeAt(0),b=a.getBoundingClientRect(),c=(b.left+b.right)/2,b.top<h?(this.toolbar.classList.add("medium-toolbar-arrow-over"),this.toolbar.classList.remove("medium-toolbar-arrow-under"),this.toolbar.style.top=h+b.bottom-this.options.diffTop+this.options.contentWindow.pageYOffset-this.toolbar.offsetHeight+"px"):(this.toolbar.classList.add("medium-toolbar-arrow-under"),this.toolbar.classList.remove("medium-toolbar-arrow-over"),this.toolbar.style.top=b.top+this.options.diffTop+this.options.contentWindow.pageYOffset-this.toolbar.offsetHeight+"px"),this.toolbar.style.left=k>c?j+k+"px":this.options.contentWindow.innerWidth-c<k?this.options.contentWindow.innerWidth+j-k+"px":j+c+"px"),this.hideAnchorPreview(),this)},setToolbarButtonStates:function(){var a,b=this.toolbarActions.querySelectorAll("button");for(a=0;a<b.length;a+=1)b[a].classList.remove(this.options.activeButtonClass);return this.checkActiveButtons(),this},checkActiveButtons:function(){for(var a=Array.prototype.slice.call(this.elements),b=this.getSelectedParentElement();void 0!==b.tagName&&-1===this.parentElements.indexOf(b.tagName.toLowerCase)&&(this.activateButton(b.tagName.toLowerCase()),this.callExtensions("checkState",b),-1===a.indexOf(b));)b=b.parentNode},activateButton:function(a){var b=this.toolbar.querySelector('[data-element="'+a+'"]');null!==b&&-1===b.className.indexOf(this.options.activeButtonClass)&&(b.className+=" "+this.options.activeButtonClass)},bindButtons:function(){var a,b=this.toolbar.querySelectorAll("button"),c=this,d=function(a){a.preventDefault(),a.stopPropagation(),void 0===c.selection&&c.checkSelection(),this.className.indexOf(c.options.activeButtonClass)>-1?this.classList.remove(c.options.activeButtonClass):this.className+=" "+c.options.activeButtonClass,this.hasAttribute("data-action")&&c.execAction(this.getAttribute("data-action"),a)};for(a=0;a<b.length;a+=1)this.on(b[a],"click",d);return this.setFirstAndLastItems(b),this},setFirstAndLastItems:function(a){return a.length>0&&(a[0].className+=" "+this.options.firstButtonClass,a[a.length-1].className+=" "+this.options.lastButtonClass),this},execAction:function(a,b){a.indexOf("append-")>-1?(this.execFormatBlock(a.replace("append-","")),this.setToolbarPosition(),this.setToolbarButtonStates()):"anchor"===a?this.options.disableAnchorForm||this.triggerAnchorAction(b):"image"===a?this.options.ownerDocument.execCommand("insertImage",!1,this.options.contentWindow.getSelection()):(this.options.ownerDocument.execCommand(a,!1,null),this.setToolbarPosition())},rangeSelectsSingleNode:function(a){var b=a.startContainer;return b===a.endContainer&&b.hasChildNodes()&&a.endOffset===a.startOffset+1},getSelectedParentElement:function(){var a=null,b=this.selectionRange;return a=this.rangeSelectsSingleNode(b)?b.startContainer.childNodes[b.startOffset]:3===b.startContainer.nodeType?b.startContainer.parentNode:b.startContainer},triggerAnchorAction:function(){var a=this.getSelectedParentElement();return a.tagName&&"a"===a.tagName.toLowerCase()?this.options.ownerDocument.execCommand("unlink",!1,null):this.anchorForm&&("block"===this.anchorForm.style.display?this.showToolbarActions():this.showAnchorForm()),this},execFormatBlock:function(a){var b=this.getSelectionData(this.selection.anchorNode);if("blockquote"===a&&b.el&&"blockquote"===b.el.parentNode.tagName.toLowerCase())return this.options.ownerDocument.execCommand("outdent",!1,null);if(b.tagName===a&&(a="p"),this.isIE){if("blockquote"===a)return this.options.ownerDocument.execCommand("indent",!1,a);a="<"+a+">"}return this.options.ownerDocument.execCommand("formatBlock",!1,a)},getSelectionData:function(a){var b;for(a&&a.tagName&&(b=a.tagName.toLowerCase());a&&-1===this.parentElements.indexOf(b);)a=a.parentNode,a&&a.tagName&&(b=a.tagName.toLowerCase());return{el:a,tagName:b}},getFirstChild:function(a){for(var b=a.firstChild;null!==b&&1!==b.nodeType;)b=b.nextSibling;return b},isToolbarShown:function(){return this.toolbar&&this.toolbar.classList.contains("medium-editor-toolbar-active")},showToolbar:function(){this.toolbar&&!this.isToolbarShown()&&(this.toolbar.classList.add("medium-editor-toolbar-active"),this.onShowToolbar&&this.onShowToolbar())},hideToolbar:function(){this.isToolbarShown()&&(this.toolbar.classList.remove("medium-editor-toolbar-active"),this.onHideToolbar&&this.onHideToolbar())},hideToolbarActions:function(){this.keepToolbarAlive=!1,this.hideToolbar()},showToolbarActions:function(){var a=this;this.anchorForm&&(this.anchorForm.style.display="none"),this.toolbarActions.style.display="block",this.keepToolbarAlive=!1,this.delay(function(){a.showToolbar()})},saveSelection:function(){this.savedSelection=g.call(this)},restoreSelection:function(){h.call(this,this.savedSelection)},showAnchorForm:function(a){this.anchorForm&&(this.toolbarActions.style.display="none",this.saveSelection(),this.anchorForm.style.display="block",this.setToolbarPosition(),this.keepToolbarAlive=!0,this.anchorInput.focus(),this.anchorInput.value=a||"")},bindAnchorForm:function(){if(!this.anchorForm)return this;var a=this.anchorForm.querySelector("a.medium-editor-toobar-anchor-close"),b=this.anchorForm.querySelector("a.medium-editor-toobar-anchor-save"),c=this;return this.on(this.anchorForm,"click",function(a){a.stopPropagation(),c.keepToolbarAlive=!0}),this.on(this.anchorInput,"keyup",function(a){var b,d=null;13===a.keyCode?(a.preventDefault(),b=c.options.anchorTarget&&c.anchorTarget.checked?"_blank":"_self",c.options.anchorButton&&c.anchorButton.checked&&(d=c.options.anchorButtonClass),c.createLink(this,b,d)):27===a.keyCode&&(a.preventDefault(),c.showToolbarActions(),h.call(c,c.savedSelection))}),this.on(b,"click",function(a){var b,d=null;a.preventDefault(),b=c.options.anchorTarget&&c.anchorTarget.checked?"_blank":"_self",c.options.anchorButton&&c.anchorButton.checked&&(d=c.options.anchorButtonClass),c.createLink(c.anchorInput,b,d)},!0),this.on(this.anchorInput,"click",function(a){a.stopPropagation(),c.keepToolbarAlive=!0}),this.on(this.options.ownerDocument.body,"click",function(a){a.target===c.anchorForm||e(c.anchorForm,a.target)||e(c.toolbarActions,a.target)||(c.keepToolbarAlive=!1,c.checkSelection())},!0),this.on(this.options.ownerDocument.body,"focus",function(a){a.target===c.anchorForm||e(c.anchorForm,a.target)||e(c.toolbarActions,a.target)||(c.keepToolbarAlive=!1,c.checkSelection())},!0),this.on(a,"click",function(a){a.preventDefault(),c.showToolbarActions(),h.call(c,c.savedSelection)}),this},hideAnchorPreview:function(){this.anchorPreview.classList.remove("medium-editor-anchor-preview-active")},showAnchorPreview:function(a){if(this.anchorPreview.classList.contains("medium-editor-anchor-preview-active")||a.getAttribute("data-disable-preview"))return!0;var b,c,d=this,e=40,f=a.getBoundingClientRect(),g=(f.left+f.right)/2;return d.anchorPreview.querySelector("i").textContent=a.href,b=d.anchorPreview.offsetWidth/2,c=d.options.diffLeft-b,d.observeAnchorPreview(a),d.anchorPreview.classList.add("medium-toolbar-arrow-over"),d.anchorPreview.classList.remove("medium-toolbar-arrow-under"),d.anchorPreview.style.top=Math.round(e+f.bottom-d.options.diffTop+this.options.contentWindow.pageYOffset-d.anchorPreview.offsetHeight)+"px",d.anchorPreview.style.left=b>g?c+b+"px":this.options.contentWindow.innerWidth-g<b?this.options.contentWindow.innerWidth+c-b+"px":c+g+"px",this.anchorPreview&&!this.anchorPreview.classList.contains("medium-editor-anchor-preview-active")&&this.anchorPreview.classList.add("medium-editor-anchor-preview-active"),this},observeAnchorPreview:function(a){var b=this,c=(new Date).getTime(),d=!0,e=function(){c=(new Date).getTime(),d=!0},f=function(a){a.relatedTarget&&/anchor-preview/.test(a.relatedTarget.className)||(d=!1)},g=setInterval(function(){if(d)return!0;var h=(new Date).getTime()-c;h>b.options.anchorPreviewHideDelay&&(b.hideAnchorPreview(),clearInterval(g),b.off(b.anchorPreview,"mouseover",e),b.off(b.anchorPreview,"mouseout",f),b.off(a,"mouseover",e),b.off(a,"mouseout",f))},200);this.on(b.anchorPreview,"mouseover",e),this.on(b.anchorPreview,"mouseout",f),this.on(a,"mouseover",e),this.on(a,"mouseout",f)},createAnchorPreview:function(){var a=this,b=this.options.ownerDocument.createElement("div");return b.id="medium-editor-anchor-preview-"+this.id,b.className="medium-editor-anchor-preview",b.innerHTML=this.anchorPreviewTemplate(),this.options.elementsContainer.appendChild(b),this.on(b,"click",function(){a.anchorPreviewClickHandler()}),b},anchorPreviewTemplate:function(){return'<div class="medium-editor-toolbar-anchor-preview" id="medium-editor-toolbar-anchor-preview"> <i class="medium-editor-toolbar-anchor-preview-inner"></i></div>'},anchorPreviewClickHandler:function(){if(!this.options.disableAnchorForm&&this.activeAnchor){var a=this,b=this.options.ownerDocument.createRange(),c=this.options.contentWindow.getSelection();b.selectNodeContents(a.activeAnchor),c.removeAllRanges(),c.addRange(b),this.delay(function(){a.activeAnchor&&a.showAnchorForm(a.activeAnchor.href),a.keepToolbarAlive=!1})}this.hideAnchorPreview()},editorAnchorObserver:function(a){var b=this,c=!0,d=function(){c=!1,b.off(b.activeAnchor,"mouseout",d)};if(a.target&&"a"===a.target.tagName.toLowerCase()){if(!/href=["']\S+["']/.test(a.target.outerHTML)||/href=["']#\S+["']/.test(a.target.outerHTML))return!0;if(this.isToolbarShown())return!0;this.activeAnchor=a.target,this.on(this.activeAnchor,"mouseout",d),this.delay(function(){c&&b.showAnchorPreview(a.target)})}},bindAnchorPreview:function(){var a,b=this;for(this.editorAnchorObserverWrapper=function(a){b.editorAnchorObserver(a)},a=0;a<this.elements.length;a+=1)this.on(this.elements[a],"mouseover",this.editorAnchorObserverWrapper);return this},checkLinkFormat:function(a){var b=/^(https?|ftps?|rtmpt?):\/\/|mailto:/;return(b.test(a)?"":"http://")+a},setTargetBlank:function(a){var b;if(a=a||i.call(this),"a"===a.tagName.toLowerCase())a.target="_blank";else for(a=a.getElementsByTagName("a"),b=0;b<a.length;b+=1)a[b].target="_blank"},setButtonClass:function(a){var b,c,d=i.call(this),e=a.split(" ");if("a"===d.tagName.toLowerCase())for(c=0;c<e.length;c+=1)d.classList.add(e[c]);else for(d=d.getElementsByTagName("a"),b=0;b<d.length;b+=1)for(c=0;c<e.length;c+=1)d[b].classList.add(e[c])},createLink:function(a,b,c){var d,e;if(0===a.value.trim().length)return void this.hideToolbarActions();if(h.call(this,this.savedSelection),this.options.checkLinkFormat&&(a.value=this.checkLinkFormat(a.value)),this.options.ownerDocument.execCommand("createLink",!1,a.value),(this.options.targetBlank||"_blank"===b)&&this.setTargetBlank(),c&&this.setButtonClass(c),this.options.targetBlank||"_blank"===b||c)for(e=this.options.ownerDocument.createEvent("HTMLEvents"),e.initEvent("input",!0,!0,this.options.contentWindow),d=0;d<this.elements.length;d+=1)this.elements[d].dispatchEvent(e);this.checkSelection(),this.showToolbarActions(),a.value=""},positionToolbarIfShown:function(){this.isToolbarShown()&&this.setToolbarPosition()},bindWindowActions:function(){var a=this;return this.options.staticToolbar&&this.options.stickyToolbar&&this.on(this.options.contentWindow,"scroll",function(){a.positionToolbarIfShown()
},!0),this.on(this.options.contentWindow,"resize",function(){a.handleResize()}),this},activate:function(){this.isActive||this.setup()},deactivate:function(){var a;if(this.isActive){for(this.isActive=!1,void 0!==this.toolbar&&(this.options.elementsContainer.removeChild(this.anchorPreview),this.options.elementsContainer.removeChild(this.toolbar),delete this.toolbar,delete this.anchorPreview),a=0;a<this.elements.length;a+=1)this.elements[a].removeAttribute("contentEditable"),this.elements[a].removeAttribute("data-medium-element");this.removeAllEvents()}},htmlEntities:function(a){return String(a).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},bindPaste:function(){var a,b=this;for(this.pasteWrapper=function(a){var c,d,e="",f="text/html",g="text/plain";if(this.classList.remove("medium-editor-placeholder"),!b.options.forcePlainText&&!b.options.cleanPastedHTML)return this;if(b.options.contentWindow.clipboardData&&void 0===a.clipboardData&&(a.clipboardData=b.options.contentWindow.clipboardData,f="Text",g="Text"),a.clipboardData&&a.clipboardData.getData&&!a.defaultPrevented){if(a.preventDefault(),b.options.cleanPastedHTML&&a.clipboardData.getData(f))return b.cleanPaste(a.clipboardData.getData(f));if(b.options.disableReturn||this.getAttribute("data-disable-return"))e=b.htmlEntities(a.clipboardData.getData(g)),l(b.options.ownerDocument,e);else{for(c=a.clipboardData.getData(g).split(/[\r\n]/g),d=0;d<c.length;d+=1)""!==c[d]&&(e+=navigator.userAgent.match(/firefox/i)&&0===d?b.htmlEntities(c[d]):"<p>"+b.htmlEntities(c[d])+"</p>");l(b.options.ownerDocument,e)}}},a=0;a<this.elements.length;a+=1)this.on(this.elements[a],"paste",this.pasteWrapper);return this},setPlaceholders:function(){return!this.options.disablePlaceholders&&this.elements&&this.elements.length&&this.elements.forEach(function(a){this.activatePlaceholder(a),this.on(a,"blur",this.placeholderWrapper.bind(this)),this.on(a,"keypress",this.placeholderWrapper.bind(this))}.bind(this)),this},cleanPaste:function(a){var b,c,d,e=this.getSelectionElement(),f=/<p|<br|<div/.test(a),g=[[new RegExp(/<[^>]*docs-internal-guid[^>]*>/gi),""],[new RegExp(/<\/b>(<br[^>]*>)?$/gi),""],[new RegExp(/<span class="Apple-converted-space">\s+<\/span>/g)," "],[new RegExp(/<br class="Apple-interchange-newline">/g),"<br>"],[new RegExp(/<span[^>]*(font-style:italic;font-weight:bold|font-weight:bold;font-style:italic)[^>]*>/gi),'<span class="replace-with italic bold">'],[new RegExp(/<span[^>]*font-style:italic[^>]*>/gi),'<span class="replace-with italic">'],[new RegExp(/<span[^>]*font-weight:bold[^>]*>/gi),'<span class="replace-with bold">'],[new RegExp(/&lt;(\/?)(i|b|a)&gt;/gi),"<$1$2>"],[new RegExp(/&lt;a\s+href=(&quot;|&rdquo;|&ldquo;|“|”)([^&]+)(&quot;|&rdquo;|&ldquo;|“|”)&gt;/gi),'<a href="$2">']];for(b=0;b<g.length;b+=1)a=a.replace(g[b][0],g[b][1]);if(f)for(c=a.split("<br><br>"),this.pasteHTML("<p>"+c.join("</p><p>")+"</p>"),this.options.ownerDocument.execCommand("insertText",!1,"\n"),c=e.querySelectorAll("a,p,div,br"),b=0;b<c.length;b+=1)switch(d=c[b],d.tagName.toLowerCase()){case"a":this.options.targetBlank&&this.setTargetBlank(d);break;case"p":case"div":this.filterCommonBlocks(d);break;case"br":this.filterLineBreak(d)}else this.pasteHTML(a)},pasteHTML:function(a){var b,c,d,e,f=this.options.ownerDocument.createDocumentFragment();for(f.appendChild(this.options.ownerDocument.createElement("body")),e=f.querySelector("body"),e.innerHTML=a,this.cleanupSpans(e),b=e.querySelectorAll("*"),d=0;d<b.length;d+=1)c=b[d],c.removeAttribute("class"),c.removeAttribute("style"),c.removeAttribute("dir"),"meta"===c.tagName.toLowerCase()&&c.parentNode.removeChild(c);this.options.ownerDocument.execCommand("insertHTML",!1,e.innerHTML.replace(/&nbsp;/g," "))},isCommonBlock:function(a){return a&&("p"===a.tagName.toLowerCase()||"div"===a.tagName.toLowerCase())},filterCommonBlocks:function(a){/^\s*$/.test(a.textContent)&&a.parentNode.removeChild(a)},filterLineBreak:function(a){this.isCommonBlock(a.previousElementSibling)?a.parentNode.removeChild(a):!this.isCommonBlock(a.parentNode)||a.parentNode.firstChild!==a&&a.parentNode.lastChild!==a?1===a.parentNode.childElementCount&&this.removeWithParent(a):a.parentNode.removeChild(a)},removeWithParent:function(a){a&&a.parentNode&&(a.parentNode.parentNode&&1===a.parentNode.childElementCount?a.parentNode.parentNode.removeChild(a.parentNode):a.parentNode.removeChild(a.parentNode))},cleanupSpans:function(a){var b,c,d,e=a.querySelectorAll(".replace-with");for(b=0;b<e.length;b+=1)c=e[b],d=this.options.ownerDocument.createElement(c.classList.contains("bold")?"b":"i"),d.innerHTML=c.classList.contains("bold")&&c.classList.contains("italic")?"<i>"+c.innerHTML+"</i>":c.innerHTML,c.parentNode.replaceChild(d,c);for(e=a.querySelectorAll("span"),b=0;b<e.length;b+=1)c=e[b],/^\s*$/.test()?c.parentNode.removeChild(c):c.parentNode.replaceChild(this.options.ownerDocument.createTextNode(c.textContent),c)}}}(window,document);
function MediumEditor(a,b){"use strict";return this.init(a,b)}"object"==typeof module?module.exports=MediumEditor:"function"==typeof define&&define.amd&&define(function(){"use strict";return MediumEditor}),function(a,b){"use strict";function c(a,b){var c;if(void 0===a)return b;for(c in b)b.hasOwnProperty(c)&&a.hasOwnProperty(c)===!1&&(a[c]=b[c]);return a}function d(a,b){var c,d,e,f,g=50,h=null,i=0;return b||0===b||(b=g),f=function(){i=n(),h=null,e=a.apply(c,d),h||(c=d=null)},function(){var g=n(),j=b-(g-i);return c=this,d=arguments,0>=j||j>b?(clearTimeout(h),h=null,i=g,e=a.apply(c,d),h||(c=d=null)):h||(h=setTimeout(f,j)),e}}function e(a,b){for(var c=b.parentNode;null!==c;){if(c===a)return!0;c=c.parentNode}return!1}function f(a,b,c){var d,e=!1,f=c.createNodeIterator(a,NodeFilter.SHOW_TEXT);for(d=f.nextNode();d;){if(d===b)e=!0;else if(e&&3===d.nodeType&&d.nodeValue.length>0)break;d=f.nextNode()}return d}function g(){var a,b,c,d=this.options.contentWindow.getSelection();if(d.getRangeAt&&d.rangeCount){for(c=[],a=0,b=d.rangeCount;b>a;a+=1)c.push(d.getRangeAt(a));return c}return null}function h(a){var b,c,d=this.options.contentWindow.getSelection();if(a)for(d.removeAllRanges(),b=0,c=a.length;c>b;b+=1)d.addRange(a[b])}function i(){var a=this.options.ownerDocument.getSelection().anchorNode,b=a&&3===a.nodeType?a.parentNode:a;return b}function j(){var a,b,c,d,e="";if(void 0!==this.options.contentWindow.getSelection){if(b=this.options.contentWindow.getSelection(),b.rangeCount){for(d=this.options.ownerDocument.createElement("div"),a=0,c=b.rangeCount;c>a;a+=1)d.appendChild(b.getRangeAt(a).cloneContents());e=d.innerHTML}}else void 0!==this.options.ownerDocument.selection&&"Text"===this.options.ownerDocument.selection.type&&(e=this.options.ownerDocument.selection.createRange().htmlText);return e}function k(b,c){var d,e;return c||(c=a.getSelection().getRangeAt(0)),d=c.cloneRange(),e=c.cloneRange(),d.selectNodeContents(b),d.setEnd(c.endContainer,c.endOffset),e.selectNodeContents(b),e.setStart(c.endContainer,c.endOffset),{left:d.toString().length,right:e.toString().length}}function l(a){return!(!a||1!==a.nodeType)}function m(b,c){var d,e,f,g,h,i;if(b.queryCommandSupported("insertHTML"))return b.execCommand("insertHTML",!1,c);if(d=a.getSelection(),d.getRangeAt&&d.rangeCount){for(e=d.getRangeAt(0),e.deleteContents(),f=b.createElement("div"),f.innerHTML=c,g=b.createDocumentFragment();f.firstChild;)h=f.firstChild,i=g.appendChild(h);e.insertNode(g),i&&(e=e.cloneRange(),e.setStartAfter(i),e.collapse(!0),d.removeAllRanges(),d.addRange(e))}}var n=Date.now||function(){return(new Date).getTime()};MediumEditor.prototype={defaults:{allowMultiParagraphSelection:!0,anchorInputPlaceholder:"Paste or type a link",anchorInputCheckboxLabel:"Open in new window",anchorPreviewHideDelay:500,buttons:["bold","italic","underline","anchor","header1","header2","quote"],buttonLabels:!1,checkLinkFormat:!1,cleanPastedHTML:!1,delay:0,diffLeft:0,diffTop:-10,disableReturn:!1,disableDoubleReturn:!1,disableToolbar:!1,disableEditing:!1,disableAnchorForm:!1,disablePlaceholders:!1,elementsContainer:!1,standardizeSelectionStart:!1,contentWindow:a,ownerDocument:b,firstHeader:"h3",forcePlainText:!0,placeholder:"Type your text",secondHeader:"h4",targetBlank:!1,anchorTarget:!1,anchorButton:!1,anchorButtonClass:"btn",extensions:{},activeButtonClass:"medium-editor-button-active",firstButtonClass:"medium-editor-button-first",lastButtonClass:"medium-editor-button-last"},isIE:"Microsoft Internet Explorer"===navigator.appName||"Netscape"===navigator.appName&&null!==new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})").exec(navigator.userAgent),init:function(a,b){var d=1;if(this.options=c(b,this.defaults),this.setElementSelection(a),0!==this.elements.length){for(this.parentElements=["p","h1","h2","h3","h4","h5","h6","blockquote","pre"],this.options.elementsContainer||(this.options.elementsContainer=this.options.ownerDocument.body);this.options.elementsContainer.querySelector("#medium-editor-toolbar-"+d);)d+=1;return this.id=d,this.setup()}},setup:function(){this.events=[],this.isActive=!0,this.initThrottledMethods().initElements().bindSelect().bindPaste().setPlaceholders().bindElementActions().bindWindowActions()},on:function(a,b,c,d){a.addEventListener(b,c,d),this.events.push([a,b,c,d])},off:function(a,b,c,d){var e,f=this.indexOfListener(a,b,c,d);-1!==f&&(e=this.events.splice(f,1)[0],e[0].removeEventListener(e[1],e[2],e[3]))},indexOfListener:function(a,b,c,d){var e,f,g;for(e=0,f=this.events.length;f>e;e+=1)if(g=this.events[e],g[0]===a&&g[1]===b&&g[2]===c&&g[3]===d)return e;return-1},delay:function(a){var b=this;setTimeout(function(){b.isActive&&a()},this.options.delay)},removeAllEvents:function(){for(var a=this.events.pop();a;)a[0].removeEventListener(a[1],a[2],a[3]),a=this.events.pop()},initThrottledMethods:function(){var a=this;return this.handleResize=d(function(){a.isActive&&a.positionToolbarIfShown()}),this.handleBlur=d(function(){a.isActive&&!a.keepToolbarAlive&&a.hideToolbarActions()}),this},initElements:function(){var a,b=!1;for(a=0;a<this.elements.length;a+=1)this.options.disableEditing||this.elements[a].getAttribute("data-disable-editing")||this.elements[a].setAttribute("contentEditable",!0),this.elements[a].getAttribute("data-placeholder")||this.elements[a].setAttribute("data-placeholder",this.options.placeholder),this.elements[a].setAttribute("data-medium-element",!0),this.elements[a].setAttribute("role","textbox"),this.elements[a].setAttribute("aria-multiline",!0),this.bindParagraphCreation(a),this.options.disableToolbar||this.elements[a].getAttribute("data-disable-toolbar")||(b=!0);return b&&this.passInstance().callExtensions("init").initToolbar().bindButtons().bindAnchorForm().bindAnchorPreview(),this},setElementSelection:function(a){a||(a=[]),"string"==typeof a&&(a=this.options.ownerDocument.querySelectorAll(a)),l(a)&&(a=[a]),this.elements=Array.prototype.slice.apply(a)},bindBlur:function(){var a=this,b=function(b){b.target===a.toolbar||b.target===a.elements[0]||e(a.elements[0],b.target)||e(a.toolbar,b.target)||e(a.anchorPreview,b.target)||(a.options.disablePlaceholders||a.placeholderWrapper(b,a.elements[0]),a.handleBlur())};return this.on(this.options.ownerDocument.body,"click",b,!0),this.on(this.options.ownerDocument.body,"focus",b,!0),this},bindClick:function(a){var b=this;return this.on(this.elements[a],"click",function(){b.options.disablePlaceholders||this.classList.remove("medium-editor-placeholder"),b.options.staticToolbar&&b.setToolbarPosition()}),this},bindElementActions:function(){var a;for(a=0;a<this.elements.length;a+=1)this.options.disablePlaceholders||this.activatePlaceholder(this.elements[a]),this.bindReturn(a).bindKeydown(a).bindBlur(a).bindClick(a);return this},activatePlaceholder:function(a){a.querySelector("img")||a.querySelector("blockquote")||""!==a.textContent.replace(/^\s+|\s+$/g,"")||a.classList.add("medium-editor-placeholder")},placeholderWrapper:function(a,b){b=b||a.target,b.classList.remove("medium-editor-placeholder"),"keypress"!==a.type&&this.activatePlaceholder(b)},serialize:function(){var a,b,c={};for(a=0;a<this.elements.length;a+=1)b=""!==this.elements[a].id?this.elements[a].id:"element-"+a,c[b]={value:this.elements[a].innerHTML.trim()};return c},callExtensions:function(a){if(!(arguments.length<1)){var b,c,d=Array.prototype.slice.call(arguments,1);for(c in this.options.extensions)this.options.extensions.hasOwnProperty(c)&&(b=this.options.extensions[c],void 0!==b[a]&&b[a].apply(b,d));return this}},passInstance:function(){var a,b,c=this;for(b in c.options.extensions)c.options.extensions.hasOwnProperty(b)&&(a=c.options.extensions[b],a.parent&&(a.base=c));return c},bindParagraphCreation:function(a){var b=this;return this.on(this.elements[a],"keypress",function(a){var c,d;32===a.which&&(c=i.call(b),d=c.tagName.toLowerCase(),"a"===d&&b.options.ownerDocument.execCommand("unlink",!1,null))}),this.on(this.elements[a],"keyup",function(a){var c,d,e=i.call(b);e&&e.getAttribute("data-medium-element")&&0===e.children.length&&!b.options.disableReturn&&!e.getAttribute("data-disable-return")&&b.options.ownerDocument.execCommand("formatBlock",!1,"p"),13===a.which&&(e=i.call(b),c=e.tagName.toLowerCase(),d=b.getSelectionElement(),b.options.disableReturn||d.getAttribute("data-disable-return")||"li"===c||b.isListItemChild(e)||(a.shiftKey||/h\d/.test(c)||b.options.ownerDocument.execCommand("formatBlock",!1,"p"),"a"===c&&b.options.ownerDocument.execCommand("unlink",!1,null)))}),this},isListItemChild:function(a){for(var b=a.parentNode,c=b.tagName.toLowerCase();-1===this.parentElements.indexOf(c)&&"div"!==c;){if("li"===c)return!0;if(b=b.parentNode,!b||!b.tagName)return!1;c=b.tagName.toLowerCase()}return!1},bindReturn:function(a){var b=this;return this.on(this.elements[a],"keypress",function(a){if(13===a.which)if(b.options.disableReturn||this.getAttribute("data-disable-return"))a.preventDefault();else if(b.options.disableDoubleReturn||this.getAttribute("data-disable-double-return")){var c=i.call(b);c&&"\n"===c.textContent&&a.preventDefault()}}),this},bindKeydown:function(a){var b=this;return this.on(this.elements[a],"keydown",function(a){if(9===a.which){var c=i.call(b).tagName.toLowerCase();"pre"===c&&(a.preventDefault(),b.options.ownerDocument.execCommand("insertHtml",null," ")),"li"===c&&(a.preventDefault(),a.shiftKey?b.options.ownerDocument.execCommand("outdent",a):b.options.ownerDocument.execCommand("indent",a))}else(8===a.which||46===a.which||13===a.which)&&b.onBlockModifier(a)}),this},onBlockModifier:function(c){var d,e,f,g=i.call(this),h=g.tagName.toLowerCase(),j=/^(\s+|<br\/?>)?$/i,l=/h\d/i;(8===c.which||13===c.which)&&g.previousElementSibling&&l.test(h)&&0===k(g).left?8===c.which&&j.test(g.previousElementSibling.innerHTML)?(g.previousElementSibling.parentNode.removeChild(g.previousElementSibling),c.preventDefault()):13===c.which&&(f=this.options.ownerDocument.createElement("p"),f.innerHTML="<br>",g.previousElementSibling.parentNode.insertBefore(f,g),c.preventDefault()):46===c.which&&g.nextElementSibling&&g.previousElementSibling&&!l.test(h)&&j.test(g.innerHTML)&&l.test(g.nextElementSibling.tagName)&&(d=b.createRange(),e=a.getSelection(),d.setStart(g.nextElementSibling,0),d.collapse(!0),e.removeAllRanges(),e.addRange(d),g.previousElementSibling.parentNode.removeChild(g),c.preventDefault())},buttonTemplate:function(a){var b=this.getButtonLabels(this.options.buttonLabels),c={bold:'<button class="medium-editor-action medium-editor-action-bold" data-action="bold" data-element="b" aria-label="bold">'+b.bold+"</button>",italic:'<button class="medium-editor-action medium-editor-action-italic" data-action="italic" data-element="i" aria-label="italic">'+b.italic+"</button>",underline:'<button class="medium-editor-action medium-editor-action-underline" data-action="underline" data-element="u" aria-label="underline">'+b.underline+"</button>",strikethrough:'<button class="medium-editor-action medium-editor-action-strikethrough" data-action="strikethrough" data-element="strike" aria-label="strike through">'+b.strikethrough+"</button>",superscript:'<button class="medium-editor-action medium-editor-action-superscript" data-action="superscript" data-element="sup" aria-label="superscript">'+b.superscript+"</button>",subscript:'<button class="medium-editor-action medium-editor-action-subscript" data-action="subscript" data-element="sub" aria-label="subscript">'+b.subscript+"</button>",anchor:'<button class="medium-editor-action medium-editor-action-anchor" data-action="anchor" data-element="a" aria-label="link">'+b.anchor+"</button>",image:'<button class="medium-editor-action medium-editor-action-image" data-action="image" data-element="img" aria-label="image">'+b.image+"</button>",header1:'<button class="medium-editor-action medium-editor-action-header1" data-action="append-'+this.options.firstHeader+'" data-element="'+this.options.firstHeader+'" aria-label="h1">'+b.header1+"</button>",header2:'<button class="medium-editor-action medium-editor-action-header2" data-action="append-'+this.options.secondHeader+'" data-element="'+this.options.secondHeader+' "aria-label="h2">'+b.header2+"</button>",quote:'<button class="medium-editor-action medium-editor-action-quote" data-action="append-blockquote" data-element="blockquote" aria-label="blockquote">'+b.quote+"</button>",orderedlist:'<button class="medium-editor-action medium-editor-action-orderedlist" data-action="insertorderedlist" data-element="ol" aria-label="ordered list">'+b.orderedlist+"</button>",unorderedlist:'<button class="medium-editor-action medium-editor-action-unorderedlist" data-action="insertunorderedlist" data-element="ul" aria-label="unordered list">'+b.unorderedlist+"</button>",pre:'<button class="medium-editor-action medium-editor-action-pre" data-action="append-pre" data-element="pre" aria-label="preformatted text">'+b.pre+"</button>",indent:'<button class="medium-editor-action medium-editor-action-indent" data-action="indent" data-element="ul" aria-label="indent">'+b.indent+"</button>",outdent:'<button class="medium-editor-action medium-editor-action-outdent" data-action="outdent" data-element="ul" aria-label="outdent">'+b.outdent+"</button>",justifyCenter:'<button class="medium-editor-action medium-editor-action-justifyCenter" data-action="justifyCenter" data-element="" aria-label="center justify">'+b.justifyCenter+"</button>",justifyFull:'<button class="medium-editor-action medium-editor-action-justifyFull" data-action="justifyFull" data-element="" aria-label="full justify">'+b.justifyFull+"</button>",justifyLeft:'<button class="medium-editor-action medium-editor-action-justifyLeft" data-action="justifyLeft" data-element="" aria-label="left justify">'+b.justifyLeft+"</button>",justifyRight:'<button class="medium-editor-action medium-editor-action-justifyRight" data-action="justifyRight" data-element="" aria-label="right justify">'+b.justifyRight+"</button>"};return c[a]||!1},getButtonLabels:function(a){var b,c,d={bold:"<b>B</b>",italic:"<b><i>I</i></b>",underline:"<b><u>U</u></b>",strikethrough:"<s>A</s>",superscript:"<b>x<sup>1</sup></b>",subscript:"<b>x<sub>1</sub></b>",anchor:"<b>#</b>",image:"<b>image</b>",header1:"<b>H1</b>",header2:"<b>H2</b>",quote:"<b>&ldquo;</b>",orderedlist:"<b>1.</b>",unorderedlist:"<b>&bull;</b>",pre:"<b>0101</b>",indent:"<b>&rarr;</b>",outdent:"<b>&larr;</b>",justifyCenter:"<b>C</b>",justifyFull:"<b>J</b>",justifyLeft:"<b>L</b>",justifyRight:"<b>R</b>"};if("fontawesome"===a?b={bold:'<i class="fa fa-bold"></i>',italic:'<i class="fa fa-italic"></i>',underline:'<i class="fa fa-underline"></i>',strikethrough:'<i class="fa fa-strikethrough"></i>',superscript:'<i class="fa fa-superscript"></i>',subscript:'<i class="fa fa-subscript"></i>',anchor:'<i class="fa fa-link"></i>',image:'<i class="fa fa-picture-o"></i>',quote:'<i class="fa fa-quote-right"></i>',orderedlist:'<i class="fa fa-list-ol"></i>',unorderedlist:'<i class="fa fa-list-ul"></i>',pre:'<i class="fa fa-code fa-lg"></i>',indent:'<i class="fa fa-indent"></i>',outdent:'<i class="fa fa-outdent"></i>',justifyCenter:'<i class="fa fa-align-center"></i>',justifyFull:'<i class="fa fa-align-justify"></i>',justifyLeft:'<i class="fa fa-align-left"></i>',justifyRight:'<i class="fa fa-align-right"></i>'}:"object"==typeof a&&(b=a),"object"==typeof b)for(c in b)b.hasOwnProperty(c)&&(d[c]=b[c]);return d},initToolbar:function(){return this.toolbar?this:(this.toolbar=this.createToolbar(),this.addExtensionForms(),this.keepToolbarAlive=!1,this.toolbarActions=this.toolbar.querySelector(".medium-editor-toolbar-actions"),this.anchorPreview=this.createAnchorPreview(),this.options.disableAnchorForm||(this.anchorForm=this.toolbar.querySelector(".medium-editor-toolbar-form"),this.anchorInput=this.anchorForm.querySelector("input.medium-editor-toolbar-input"),this.anchorTarget=this.anchorForm.querySelector("input.medium-editor-toolbar-anchor-target"),this.anchorButton=this.anchorForm.querySelector("input.medium-editor-toolbar-anchor-button")),this)},createToolbar:function(){var a=this.options.ownerDocument.createElement("div");return a.id="medium-editor-toolbar-"+this.id,a.className="medium-editor-toolbar",a.className+=this.options.staticToolbar?" static-toolbar":" stalker-toolbar",a.appendChild(this.toolbarButtons()),this.options.disableAnchorForm||a.appendChild(this.toolbarFormAnchor()),this.options.elementsContainer.appendChild(a),a},toolbarButtons:function(){var a,b,c,d,e=this.options.buttons,f=this.options.ownerDocument.createElement("ul");for(f.id="medium-editor-toolbar-actions"+this.id,f.className="medium-editor-toolbar-actions clearfix",b=0;b<e.length;b+=1)this.options.extensions.hasOwnProperty(e[b])?(d=this.options.extensions[e[b]],c=void 0!==d.getButton?d.getButton(this):null,d.hasForm&&c.setAttribute("data-form","medium-editor-toolbar-form-"+e[b]+"-"+this.id)):c=this.buttonTemplate(e[b]),c&&(a=this.options.ownerDocument.createElement("li"),l(c)?a.appendChild(c):a.innerHTML=c,f.appendChild(a));return f},addExtensionForms:function(){var a,b,c,d,e=this.options.extensions;for(b in e)e.hasOwnProperty(b)&&(a=e[b],a.hasForm&&(c=void 0!==a.getForm?a.getForm():null),c&&(d="medium-editor-toolbar-form-"+b+"-"+this.id,c.className="medium-editor-toolbar-form",c.id=d,a.getForm().id=d,this.toolbar.appendChild(c)))},toolbarFormAnchor:function(){var a=this.options.ownerDocument.createElement("div"),b=this.options.ownerDocument.createElement("input"),c=this.options.ownerDocument.createElement("label"),d=this.options.ownerDocument.createElement("input"),e=this.options.ownerDocument.createElement("label"),f=this.options.ownerDocument.createElement("input"),g=this.options.ownerDocument.createElement("a"),h=this.options.ownerDocument.createElement("a");return g.setAttribute("href","#"),g.className="medium-editor-toobar-close",g.innerHTML="&times;",h.setAttribute("href","#"),h.className="medium-editor-toobar-save",h.innerHTML="&#10003;",b.setAttribute("type","text"),b.className="medium-editor-toolbar-input",b.setAttribute("placeholder",this.options.anchorInputPlaceholder),d.setAttribute("type","checkbox"),d.className="medium-editor-toolbar-anchor-target",c.innerHTML=this.options.anchorInputCheckboxLabel,c.insertBefore(d,c.firstChild),f.setAttribute("type","checkbox"),f.className="medium-editor-toolbar-anchor-button",e.innerHTML="Button",e.insertBefore(f,e.firstChild),a.className="medium-editor-toolbar-form",a.id="medium-editor-toolbar-form-anchor-"+this.id,a.appendChild(b),a.appendChild(h),a.appendChild(g),this.options.anchorTarget&&a.appendChild(c),this.options.anchorButton&&a.appendChild(e),a},bindSelect:function(){var a,b=this;for(this.checkSelectionWrapper=function(a){return!b.options.disableAnchorForm&&a&&b.clickingIntoArchorForm(a)?!1:void b.checkSelection()},this.on(this.options.ownerDocument.documentElement,"mouseup",this.checkSelectionWrapper),a=0;a<this.elements.length;a+=1)this.on(this.elements[a],"keyup",this.checkSelectionWrapper),this.on(this.elements[a],"blur",this.checkSelectionWrapper),this.on(this.elements[a],"click",this.checkSelectionWrapper);return this},stopSelectionUpdates:function(){this.preventSelectionUpdates=!0},startSelectionUpdates:function(){this.preventSelectionUpdates=!1},checkSelection:function(){var a,b;return this.preventSelectionUpdates||this.keepToolbarAlive===!0||this.options.disableToolbar||(a=this.options.contentWindow.getSelection(),!this.options.updateOnEmptySelection&&""===a.toString().trim()||this.options.allowMultiParagraphSelection===!1&&this.hasMultiParagraphs()||this.selectionInContentEditableFalse()?this.options.staticToolbar?this.anchorForm&&"block"===this.anchorForm.style.display&&(this.setToolbarButtonStates(),this.showToolbarActions()):this.hideToolbarActions():(b=this.getSelectionElement(),!b||b.getAttribute("data-disable-toolbar")?this.options.staticToolbar||this.hideToolbarActions():this.checkSelectionElement(a,b))),this},clickingIntoArchorForm:function(a){var b=this;return a.type&&"blur"===a.type.toLowerCase()&&a.relatedTarget&&a.relatedTarget===b.anchorInput?!0:!1},hasMultiParagraphs:function(){var a=j.call(this).replace(/<[\S]+><\/[\S]+>/gim,""),b=a.match(/<(p|h[0-6]|blockquote)>([\s\S]*?)<\/(p|h[0-6]|blockquote)>/g);return b?b.length:0},checkSelectionElement:function(a,b){var c,d,e,g=0;if(this.selection=a,this.selectionRange=this.selection.getRangeAt(0),this.options.standardizeSelectionStart&&this.selectionRange.startOffset===this.selectionRange.startContainer.nodeValue.length&&(d=f(this.getSelectionElement(),this.selectionRange.startContainer,this.options.ownerDocument))){for(g=0;0===d.nodeValue.substr(g,1).trim().length;)g+=1;e=this.options.ownerDocument.createRange(),e.setStart(d,g),e.setEnd(this.selectionRange.endContainer,this.selectionRange.endOffset),this.selection.removeAllRanges(),this.selection.addRange(e),this.selectionRange=e}for(c=0;c<this.elements.length;c+=1)if(this.elements[c]===b)return void this.setToolbarButtonStates().setToolbarPosition().showToolbarActions();this.options.staticToolbar||this.hideToolbarActions()},findMatchingSelectionParent:function(a){var b,c,d=this.options.contentWindow.getSelection();if(0===d.rangeCount)return!1;b=d.getRangeAt(0),c=b.commonAncestorContainer;do{if(1===c.nodeType){if(a(c))return c;if(c.getAttribute("data-medium-element"))return!1}c=c.parentNode}while(c);return!1},getSelectionElement:function(){return this.findMatchingSelectionParent(function(a){return a.getAttribute("data-medium-element")})},selectionInContentEditableFalse:function(){return this.findMatchingSelectionParent(function(a){return a&&"#text"!==a.nodeName&&"false"===a.getAttribute("contenteditable")})},setToolbarPosition:function(){var a,b,c,d=this.options.ownerDocument.documentElement&&this.options.ownerDocument.documentElement.scrollTop||this.options.ownerDocument.body.scrollTop,e=this.elements[0],f=e.getBoundingClientRect(),g=f.top+d,h=50,i=this.options.contentWindow.getSelection(),j=this.options.diffLeft-this.toolbar.offsetWidth/2,k=this.toolbar.offsetWidth/2,l=f.left+f.width/2;return null===i.focusNode?this:(this.showToolbar(),this.options.staticToolbar?(this.options.stickyToolbar?d>g+this.elements[0].offsetHeight-this.toolbar.offsetHeight?this.toolbar.style.top=g+this.elements[0].offsetHeight+"px":d>g-this.toolbar.offsetHeight?(this.toolbar.classList.add("sticky-toolbar"),this.toolbar.style.top="0px"):(this.toolbar.classList.remove("sticky-toolbar"),this.toolbar.style.top=g-this.toolbar.offsetHeight+"px"):this.toolbar.style.top=g-this.toolbar.offsetHeight+"px",this.toolbar.style.left=this.options.toolbarAlign?"left"===this.options.toolbarAlign?f.left+"px":"center"===this.options.toolbarAlign?l-k+"px":f.right-this.toolbar.offsetWidth+"px":l-k+"px"):i.isCollapsed||(a=i.getRangeAt(0),b=a.getBoundingClientRect(),c=(b.left+b.right)/2,b.top<h?(this.toolbar.classList.add("medium-toolbar-arrow-over"),this.toolbar.classList.remove("medium-toolbar-arrow-under"),this.toolbar.style.top=h+b.bottom-this.options.diffTop+this.options.contentWindow.pageYOffset-this.toolbar.offsetHeight+"px"):(this.toolbar.classList.add("medium-toolbar-arrow-under"),this.toolbar.classList.remove("medium-toolbar-arrow-over"),this.toolbar.style.top=b.top+this.options.diffTop+this.options.contentWindow.pageYOffset-this.toolbar.offsetHeight+"px"),this.toolbar.style.left=k>c?j+k+"px":this.options.contentWindow.innerWidth-c<k?this.options.contentWindow.innerWidth+j-k+"px":j+c+"px"),this.hideAnchorPreview(),this)},setToolbarButtonStates:function(){var a,b=this.toolbarActions.querySelectorAll("button");for(a=0;a<b.length;a+=1)b[a].classList.remove(this.options.activeButtonClass);return this.checkActiveButtons(),this},checkActiveButtons:function(){for(var a=Array.prototype.slice.call(this.elements),b=this.getSelectedParentElement();void 0!==b.tagName&&-1===this.parentElements.indexOf(b.tagName.toLowerCase)&&(this.activateButton(b.tagName.toLowerCase()),this.callExtensions("checkState",b),-1===a.indexOf(b));)b=b.parentNode},activateButton:function(a){var b=this.toolbar.querySelector('[data-element="'+a+'"]');null!==b&&-1===b.className.indexOf(this.options.activeButtonClass)&&(b.className+=" "+this.options.activeButtonClass)},bindButtons:function(){var a,b=this.toolbar.querySelectorAll("button"),c=this,d=function(a){a.preventDefault(),a.stopPropagation(),void 0===c.selection&&c.checkSelection(),this.className.indexOf(c.options.activeButtonClass)>-1?this.classList.remove(c.options.activeButtonClass):this.className+=" "+c.options.activeButtonClass,this.hasAttribute("data-action")&&c.execAction(this.getAttribute("data-action"),a),this.hasAttribute("data-form")&&c.showForm(this.getAttribute("data-form"),a)};for(a=0;a<b.length;a+=1)this.on(b[a],"click",d);return this.setFirstAndLastItems(b),this},setFirstAndLastItems:function(a){return a.length>0&&(a[0].className+=" "+this.options.firstButtonClass,a[a.length-1].className+=" "+this.options.lastButtonClass),this},execAction:function(a,b){a.indexOf("append-")>-1?(this.execFormatBlock(a.replace("append-","")),this.setToolbarPosition(),this.setToolbarButtonStates()):"anchor"===a?this.options.disableAnchorForm||this.triggerAnchorAction(b):"image"===a?this.options.ownerDocument.execCommand("insertImage",!1,this.options.contentWindow.getSelection()):(this.options.ownerDocument.execCommand(a,!1,null),this.setToolbarPosition())},showForm:function(a){this.toolbarActions.style.display="none",this.saveSelection();var c=b.getElementById(a);c.style.display="block",this.setToolbarPosition(),this.keepToolbarAlive=!0},hideForm:function(a){var c=b.getElementById(a.id);c.style.display="none",this.showToolbarActions(),this.setToolbarPosition(),h.call(this,this.savedSelection)},rangeSelectsSingleNode:function(a){var b=a.startContainer;return b===a.endContainer&&b.hasChildNodes()&&a.endOffset===a.startOffset+1},getSelectedParentElement:function(){var a=null,b=this.selectionRange;return a=this.rangeSelectsSingleNode(b)?b.startContainer.childNodes[b.startOffset]:3===b.startContainer.nodeType?b.startContainer.parentNode:b.startContainer},triggerAnchorAction:function(){var a=this.getSelectedParentElement();return a.tagName&&"a"===a.tagName.toLowerCase()?this.options.ownerDocument.execCommand("unlink",!1,null):this.anchorForm&&("block"===this.anchorForm.style.display?this.showToolbarActions():this.showAnchorForm()),this},execFormatBlock:function(a){var b=this.getSelectionData(this.selection.anchorNode);if("blockquote"===a&&b.el&&"blockquote"===b.el.parentNode.tagName.toLowerCase())return this.options.ownerDocument.execCommand("outdent",!1,null);if(b.tagName===a&&(a="p"),this.isIE){if("blockquote"===a)return this.options.ownerDocument.execCommand("indent",!1,a);a="<"+a+">"}return this.options.ownerDocument.execCommand("formatBlock",!1,a)},getSelectionData:function(a){var b;for(a&&a.tagName&&(b=a.tagName.toLowerCase());a&&-1===this.parentElements.indexOf(b);)a=a.parentNode,a&&a.tagName&&(b=a.tagName.toLowerCase());return{el:a,tagName:b}},getFirstChild:function(a){for(var b=a.firstChild;null!==b&&1!==b.nodeType;)b=b.nextSibling;return b},isToolbarShown:function(){return this.toolbar&&this.toolbar.classList.contains("medium-editor-toolbar-active")},showToolbar:function(){this.toolbar&&!this.isToolbarShown()&&(this.toolbar.classList.add("medium-editor-toolbar-active"),this.onShowToolbar&&this.onShowToolbar())},hideToolbar:function(){this.isToolbarShown()&&(this.toolbar.classList.remove("medium-editor-toolbar-active"),this.onHideToolbar&&this.onHideToolbar())},hideToolbarActions:function(){this.keepToolbarAlive=!1,this.hideToolbar()},showToolbarActions:function(){var a=this;this.anchorForm&&(this.anchorForm.style.display="none"),this.toolbarActions.style.display="block",this.keepToolbarAlive=!1,this.delay(function(){a.showToolbar()})},saveSelection:function(){this.savedSelection=g.call(this)},restoreSelection:function(){h.call(this,this.savedSelection)},showAnchorForm:function(a){this.anchorForm&&(this.toolbarActions.style.display="none",this.saveSelection(),this.anchorForm.style.display="block",this.setToolbarPosition(),this.keepToolbarAlive=!0,this.anchorInput.focus(),this.anchorInput.value=a||"")},bindAnchorForm:function(){if(!this.anchorForm)return this;var a=this.anchorForm.querySelector("a.medium-editor-toobar-close"),b=this.anchorForm.querySelector("a.medium-editor-toobar-save"),c=this;return this.on(this.anchorForm,"click",function(a){a.stopPropagation(),c.keepToolbarAlive=!0}),this.on(this.anchorInput,"keyup",function(a){var b,d=null;13===a.keyCode?(a.preventDefault(),b=c.options.anchorTarget&&c.anchorTarget.checked?"_blank":"_self",c.options.anchorButton&&c.anchorButton.checked&&(d=c.options.anchorButtonClass),c.createLink(this,b,d)):27===a.keyCode&&(a.preventDefault(),c.showToolbarActions(),h.call(c,c.savedSelection))}),this.on(b,"click",function(a){var b,d=null;a.preventDefault(),b=c.options.anchorTarget&&c.anchorTarget.checked?"_blank":"_self",c.options.anchorButton&&c.anchorButton.checked&&(d=c.options.anchorButtonClass),c.createLink(c.anchorInput,b,d)},!0),this.on(this.anchorInput,"click",function(a){a.stopPropagation(),c.keepToolbarAlive=!0}),this.on(this.options.ownerDocument.body,"click",function(a){a.target===c.anchorForm||e(c.anchorForm,a.target)||e(c.toolbarActions,a.target)||(c.keepToolbarAlive=!1,c.checkSelection())},!0),this.on(this.options.ownerDocument.body,"focus",function(a){a.target===c.anchorForm||e(c.anchorForm,a.target)||e(c.toolbarActions,a.target)||(c.keepToolbarAlive=!1,c.checkSelection())},!0),this.on(a,"click",function(a){a.preventDefault(),c.showToolbarActions(),h.call(c,c.savedSelection)}),this},hideAnchorPreview:function(){this.anchorPreview.classList.remove("medium-editor-anchor-preview-active")},showAnchorPreview:function(a){if(this.anchorPreview.classList.contains("medium-editor-anchor-preview-active")||a.getAttribute("data-disable-preview"))return!0;var b,c,d=this,e=40,f=a.getBoundingClientRect(),g=(f.left+f.right)/2;return d.anchorPreview.querySelector("i").textContent=a.href,b=d.anchorPreview.offsetWidth/2,c=d.options.diffLeft-b,d.observeAnchorPreview(a),d.anchorPreview.classList.add("medium-toolbar-arrow-over"),d.anchorPreview.classList.remove("medium-toolbar-arrow-under"),d.anchorPreview.style.top=Math.round(e+f.bottom-d.options.diffTop+this.options.contentWindow.pageYOffset-d.anchorPreview.offsetHeight)+"px",d.anchorPreview.style.left=b>g?c+b+"px":this.options.contentWindow.innerWidth-g<b?this.options.contentWindow.innerWidth+c-b+"px":c+g+"px",this.anchorPreview&&!this.anchorPreview.classList.contains("medium-editor-anchor-preview-active")&&this.anchorPreview.classList.add("medium-editor-anchor-preview-active"),this},observeAnchorPreview:function(a){var b=this,c=(new Date).getTime(),d=!0,e=function(){c=(new Date).getTime(),d=!0},f=function(a){a.relatedTarget&&/anchor-preview/.test(a.relatedTarget.className)||(d=!1)},g=setInterval(function(){if(d)return!0;var h=(new Date).getTime()-c;h>b.options.anchorPreviewHideDelay&&(b.hideAnchorPreview(),clearInterval(g),b.off(b.anchorPreview,"mouseover",e),b.off(b.anchorPreview,"mouseout",f),b.off(a,"mouseover",e),b.off(a,"mouseout",f))},200);this.on(b.anchorPreview,"mouseover",e),this.on(b.anchorPreview,"mouseout",f),this.on(a,"mouseover",e),this.on(a,"mouseout",f)},createAnchorPreview:function(){var a=this,b=this.options.ownerDocument.createElement("div");return b.id="medium-editor-anchor-preview-"+this.id,b.className="medium-editor-anchor-preview",b.innerHTML=this.anchorPreviewTemplate(),this.options.elementsContainer.appendChild(b),this.on(b,"click",function(){a.anchorPreviewClickHandler()}),b},anchorPreviewTemplate:function(){return'<div class="medium-editor-toolbar-anchor-preview" id="medium-editor-toolbar-anchor-preview"> <i class="medium-editor-toolbar-anchor-preview-inner"></i></div>'},anchorPreviewClickHandler:function(){if(!this.options.disableAnchorForm&&this.activeAnchor){var a=this,b=this.options.ownerDocument.createRange(),c=this.options.contentWindow.getSelection();b.selectNodeContents(a.activeAnchor),c.removeAllRanges(),c.addRange(b),this.delay(function(){a.activeAnchor&&a.showAnchorForm(a.activeAnchor.href),a.keepToolbarAlive=!1
})}this.hideAnchorPreview()},editorAnchorObserver:function(a){var b=this,c=!0,d=function(){c=!1,b.off(b.activeAnchor,"mouseout",d)};if(a.target&&"a"===a.target.tagName.toLowerCase()){if(!/href=["']\S+["']/.test(a.target.outerHTML)||/href=["']#\S+["']/.test(a.target.outerHTML))return!0;if(this.isToolbarShown())return!0;this.activeAnchor=a.target,this.on(this.activeAnchor,"mouseout",d),this.delay(function(){c&&b.showAnchorPreview(a.target)})}},bindAnchorPreview:function(){var a,b=this;for(this.editorAnchorObserverWrapper=function(a){b.editorAnchorObserver(a)},a=0;a<this.elements.length;a+=1)this.on(this.elements[a],"mouseover",this.editorAnchorObserverWrapper);return this},checkLinkFormat:function(a){var b=/^(https?|ftps?|rtmpt?):\/\/|mailto:/;return(b.test(a)?"":"http://")+a},setTargetBlank:function(a){var b;if(a=a||i.call(this),"a"===a.tagName.toLowerCase())a.target="_blank";else for(a=a.getElementsByTagName("a"),b=0;b<a.length;b+=1)a[b].target="_blank"},setButtonClass:function(a){var b,c,d=i.call(this),e=a.split(" ");if("a"===d.tagName.toLowerCase())for(c=0;c<e.length;c+=1)d.classList.add(e[c]);else for(d=d.getElementsByTagName("a"),b=0;b<d.length;b+=1)for(c=0;c<e.length;c+=1)d[b].classList.add(e[c])},createLink:function(a,b,c){var d,e;if(0===a.value.trim().length)return void this.hideToolbarActions();if(h.call(this,this.savedSelection),this.options.checkLinkFormat&&(a.value=this.checkLinkFormat(a.value)),this.options.ownerDocument.execCommand("createLink",!1,a.value),(this.options.targetBlank||"_blank"===b)&&this.setTargetBlank(),c&&this.setButtonClass(c),this.options.targetBlank||"_blank"===b||c)for(e=this.options.ownerDocument.createEvent("HTMLEvents"),e.initEvent("input",!0,!0,this.options.contentWindow),d=0;d<this.elements.length;d+=1)this.elements[d].dispatchEvent(e);this.checkSelection(),this.showToolbarActions(),a.value=""},positionToolbarIfShown:function(){this.isToolbarShown()&&this.setToolbarPosition()},bindWindowActions:function(){var a=this;return this.options.staticToolbar&&this.options.stickyToolbar&&this.on(this.options.contentWindow,"scroll",function(){a.positionToolbarIfShown()},!0),this.on(this.options.contentWindow,"resize",function(){a.handleResize()}),this},activate:function(){this.isActive||this.setup()},deactivate:function(){var a;if(this.isActive){for(this.isActive=!1,void 0!==this.toolbar&&(this.options.elementsContainer.removeChild(this.anchorPreview),this.options.elementsContainer.removeChild(this.toolbar),delete this.toolbar,delete this.anchorPreview),a=0;a<this.elements.length;a+=1)this.elements[a].removeAttribute("contentEditable"),this.elements[a].removeAttribute("data-medium-element");this.removeAllEvents()}},htmlEntities:function(a){return String(a).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},bindPaste:function(){var a,b=this;for(this.pasteWrapper=function(a){var c,d,e="",f="text/html",g="text/plain";if(this.classList.remove("medium-editor-placeholder"),!b.options.forcePlainText&&!b.options.cleanPastedHTML)return this;if(b.options.contentWindow.clipboardData&&void 0===a.clipboardData&&(a.clipboardData=b.options.contentWindow.clipboardData,f="Text",g="Text"),a.clipboardData&&a.clipboardData.getData&&!a.defaultPrevented){if(a.preventDefault(),b.options.cleanPastedHTML&&a.clipboardData.getData(f))return b.cleanPaste(a.clipboardData.getData(f));if(b.options.disableReturn||this.getAttribute("data-disable-return"))e=b.htmlEntities(a.clipboardData.getData(g)),m(b.options.ownerDocument,e);else{for(c=a.clipboardData.getData(g).split(/[\r\n]/g),d=0;d<c.length;d+=1)""!==c[d]&&(e+=navigator.userAgent.match(/firefox/i)&&0===d?b.htmlEntities(c[d]):"<p>"+b.htmlEntities(c[d])+"</p>");m(b.options.ownerDocument,e)}}},a=0;a<this.elements.length;a+=1)this.on(this.elements[a],"paste",this.pasteWrapper);return this},setPlaceholders:function(){return!this.options.disablePlaceholders&&this.elements&&this.elements.length&&this.elements.forEach(function(a){this.activatePlaceholder(a),this.on(a,"blur",this.placeholderWrapper.bind(this)),this.on(a,"keypress",this.placeholderWrapper.bind(this))}.bind(this)),this},cleanPaste:function(a){var b,c,d,e=this.getSelectionElement(),f=/<p|<br|<div/.test(a),g=[[new RegExp(/<[^>]*docs-internal-guid[^>]*>/gi),""],[new RegExp(/<\/b>(<br[^>]*>)?$/gi),""],[new RegExp(/<span class="Apple-converted-space">\s+<\/span>/g)," "],[new RegExp(/<br class="Apple-interchange-newline">/g),"<br>"],[new RegExp(/<span[^>]*(font-style:italic;font-weight:bold|font-weight:bold;font-style:italic)[^>]*>/gi),'<span class="replace-with italic bold">'],[new RegExp(/<span[^>]*font-style:italic[^>]*>/gi),'<span class="replace-with italic">'],[new RegExp(/<span[^>]*font-weight:bold[^>]*>/gi),'<span class="replace-with bold">'],[new RegExp(/&lt;(\/?)(i|b|a)&gt;/gi),"<$1$2>"],[new RegExp(/&lt;a\s+href=(&quot;|&rdquo;|&ldquo;|“|”)([^&]+)(&quot;|&rdquo;|&ldquo;|“|”)&gt;/gi),'<a href="$2">']];for(b=0;b<g.length;b+=1)a=a.replace(g[b][0],g[b][1]);if(f)for(c=a.split("<br><br>"),this.pasteHTML("<p>"+c.join("</p><p>")+"</p>"),this.options.ownerDocument.execCommand("insertText",!1,"\n"),c=e.querySelectorAll("a,p,div,br"),b=0;b<c.length;b+=1)switch(d=c[b],d.tagName.toLowerCase()){case"a":this.options.targetBlank&&this.setTargetBlank(d);break;case"p":case"div":this.filterCommonBlocks(d);break;case"br":this.filterLineBreak(d)}else this.pasteHTML(a)},pasteHTML:function(a){var b,c,d,e,f=this.options.ownerDocument.createDocumentFragment();for(f.appendChild(this.options.ownerDocument.createElement("body")),e=f.querySelector("body"),e.innerHTML=a,this.cleanupSpans(e),b=e.querySelectorAll("*"),d=0;d<b.length;d+=1)c=b[d],c.removeAttribute("class"),c.removeAttribute("style"),c.removeAttribute("dir"),"meta"===c.tagName.toLowerCase()&&c.parentNode.removeChild(c);this.options.ownerDocument.execCommand("insertHTML",!1,e.innerHTML.replace(/&nbsp;/g," "))},isCommonBlock:function(a){return a&&("p"===a.tagName.toLowerCase()||"div"===a.tagName.toLowerCase())},filterCommonBlocks:function(a){/^\s*$/.test(a.textContent)&&a.parentNode.removeChild(a)},filterLineBreak:function(a){this.isCommonBlock(a.previousElementSibling)?a.parentNode.removeChild(a):!this.isCommonBlock(a.parentNode)||a.parentNode.firstChild!==a&&a.parentNode.lastChild!==a?1===a.parentNode.childElementCount&&this.removeWithParent(a):a.parentNode.removeChild(a)},removeWithParent:function(a){a&&a.parentNode&&(a.parentNode.parentNode&&1===a.parentNode.childElementCount?a.parentNode.parentNode.removeChild(a.parentNode):a.parentNode.removeChild(a.parentNode))},cleanupSpans:function(a){var b,c,d,e=a.querySelectorAll(".replace-with");for(b=0;b<e.length;b+=1)c=e[b],d=this.options.ownerDocument.createElement(c.classList.contains("bold")?"b":"i"),d.innerHTML=c.classList.contains("bold")&&c.classList.contains("italic")?"<i>"+c.innerHTML+"</i>":c.innerHTML,c.parentNode.replaceChild(d,c);for(e=a.querySelectorAll("span"),b=0;b<e.length;b+=1)c=e[b],/^\s*$/.test()?c.parentNode.removeChild(c):c.parentNode.replaceChild(this.options.ownerDocument.createTextNode(c.textContent),c)}}}(window,document);
{
"name": "medium-editor",
"version": "2.1.0",
"version": "2.1.2",
"author": "Davi Ferreira <hi@daviferreira.com>",

@@ -22,9 +22,12 @@ "description": "Medium.com WYSIWYG editor clone.",

],
"publishConfig": {
"registry": "http://registry.npmjs.org/"
},
"license": "THE BEER-WARE LICENSE",
"devDependencies": {
"grunt": "~0.4.5",
"grunt-autoprefixer": "~2.1.0",
"grunt-autoprefixer": "~2.2.0",
"grunt-contrib-uglify": "~0.7.0",
"grunt-contrib-jasmine": "~0.8.0",
"grunt-contrib-csslint": "~0.3.1",
"grunt-contrib-csslint": "~0.4.0",
"grunt-jslint": "~1.1.12",

@@ -31,0 +34,0 @@ "grunt-contrib-watch": "~0.6.1",

@@ -5,4 +5,2 @@ # MediumEditor

Since I always had problems with bloated editors and I loved the simplicity of medium.com solution I've tried to implement their WYSIWYG approach with this script.
MediumEditor has been written using vanilla JavaScript, no additional frameworks required.

@@ -28,4 +26,12 @@

First, you need to attach medium editor's stylesheet to your page:
### Installation
**Via bower:**
Run in your console: `bower install medium-editor`
**Manual installation:**
Download the [latest release](https://github.com/daviferreira/medium-editor/releases) and attach medium editor's stylesheets to your page:
```html

@@ -36,6 +42,11 @@ <link rel="stylesheet" href="css/medium-editor.css"> <!-- Core -->

The next step is to reference the editor's script and instantiate a new MediumEditor object:
The next step is to reference the editor's script
```html
<script src="js/medium-editor.js"></script>
```
### Usage
You can now instantiate a new MediumEditor object:
```html
<script>var editor = new MediumEditor('.editable');</script>

@@ -88,2 +99,3 @@ ```

* __stickyToolbar__: enable/disable the toolbar "sticking" to the medium-editor element when the page is being scrolled. Default: false
* __toolbarAlign__: `left`|`center`|`right` - Aligns the toolbar relative to the medium-editor element.
* __updateOnEmptySelection__: update the state of the toolbar buttons even when the selection is collapse (there is no selection, just a cursor). Default: false

@@ -95,2 +107,3 @@

* __anchorInputPlaceholder__: text to be shown as placeholder of the anchor input. Default: _Paste or type a link_
* __anchorInputCheckboxLabel__: text to be shown for the anchor new window target. Default: _Open in new window_
* __anchorPreviewHideDelay__: time in milliseconds to show the anchor tag preview after the mouse has left the anchor tag. Default: 500

@@ -170,9 +183,12 @@ * __checkLinkFormat__: enables/disables check for common URL protocols on anchor links. Default: false

An extension is an object that has essentially two functions `getButton` and `checkState`.
An extension is an object that has essentially three functions `getButton`, `getForm` and `checkState`.
* `getButton` is called when the editor is initialized and should return an element that is integrated into the toolbar.
Usually this will be a `<button>` element like the onces Medium Editor uses. All event handling on this button is
Usually this will be a `<button>` element like the ones Medium Editor uses. All event handling on this button is
_entirely up to you_ so you should either keep a reference or bind your eventhandlers before returning it. You can
also return a HTML-String that is then integrated into the toolbar also this is not really useful.
* `getForm` is called when the editor is initialized and should return an element that is integrated into the toolbar.
Usually this will be a `<div>` element that would contain some `input` elements. Handling the saving and canceling of the form is _entirely up to you_ so you should either keep a reference or bind your eventhandlers before returning it.
* `checkState` is called whenever a user selects some text in the area where the Medium Editor instance is running. It's

@@ -187,2 +203,4 @@ responsability is to toggle the current _state_ of the button. I.e. marking is a _on_ or _off_. Again the method on how

* `hasForm` add this property to your extension class constructor and set it to `true` to tell Medium Editor that your extension contains a form. Medium editor will handle opening the form for you on your extension's button click.
### Examples

@@ -260,2 +278,130 @@

A simple table example that uses the `hasForm` attribute:
```js
function Table(options) {
this.parent = true;
this.hasForm = true;
this.options = options;
}
Table.prototype.init = function() {
this.createButton();
this.createForm();
};
Table.prototype.createButton = function() {
this.button = document.createElement('button');
this.button.className = 'medium-editor-action';
this.button.textContent = 'T';
if(this.base.options.buttonLabels === 'fontawesome'){
this.button.innerHTML = '<i class="fa fa-table"></i>';
}
this.button.onclick = this.onClick.bind(this);
};
Table.prototype.createForm = function() {
this.form = document.createElement('div'),
this.close = document.createElement('a'),
this.save = document.createElement('a'),
this.columnInput = document.createElement('input'),
this.rowInput = document.createElement('input');
this.close.setAttribute('href', '#');
this.close.innerHTML = '&times;';
this.close.onclick = this.onClose.bind(this);
this.save.setAttribute('href', '#');
this.save.innerHTML = '&#10003;';
this.save.onclick = this.onSave.bind(this);
this.columnInput.setAttribute('type', 'text');
// Add the input CSS class for correct styling
this.columnInput.className = 'medium-editor-toolbar-input';
this.columnInput.setAttribute('placeholder', 'Column Count');
this.rowInput.setAttribute('type', 'text');
// Add the input CSS class for correct styling
this.rowInput.className = 'medium-editor-toolbar-input';
this.rowInput.setAttribute('placeholder', 'Row Count');
this.form.appendChild(this.columnInput);
this.form.appendChild(this.rowInput);
this.form.appendChild(this.save);
this.form.appendChild(this.close);
};
Table.prototype.getButton = function() {
return this.button;
};
Table.prototype.getForm = function() {
return this.form;
};
Table.prototype.onClick = function() {
this.columnInput.value = this.options.defaultColumns;
this.rowInput.value = this.options.defaultRows;
};
Table.prototype.onClose = function(e) {
e.preventDefault();
this.base.hideForm(this.form);
};
Table.prototype.onSave = function(e) {
e.preventDefault();
var columnCount = this.columnInput.value;
var rowCount = this.rowInput.value;
var table = this.createTable(columnCount, rowCount);
this.base.pasteHTML(table.innerHTML);
this.base.hideForm(this.form);
};
// Create the table element.
Table.prototype.createTable = function(cols, rows) {
var table = document.createElement('table'),
header = document.createElement('thead'),
headerRow = document.createElement('tr'),
body = document.createElement('tbody'),
wrap = document.createElement('div');
for (var h = 1; h <= cols; h++) {
var headerCol = document.createElement('th');
headerCol.innerHTML = '...';
headerRow.appendChild(headerCol);
}
header.appendChild(headerRow);
for (var r = 1; r <= rows; r++) {
var bodyRow = document.createElement('tr');
for (var c = 1; c <= this.options.defaultColumns; c++) {
var bodyCol = document.createElement('td');
bodyCol.innerHTML = '...';
bodyRow.appendChild(bodyCol);
}
body.appendChild(bodyRow);
}
table.appendChild(header);
table.appendChild(body);
wrap.appendChild(table);
return wrap;
};
// When creating your Medium Editor
var editor = new MediumEditor('.editable', {
buttons: ['table'],
extensions: {
'table': new Table({
defaultColumns: 3,
defaultRows: 2
}),
});
```
## Image Upload & embeds

@@ -262,0 +408,0 @@

@@ -141,3 +141,3 @@ /*global MediumEditor, describe, it, expect, spyOn,

input = editor.anchorForm.querySelector('input.medium-editor-toolbar-anchor-input');
input = editor.anchorForm.querySelector('input.medium-editor-toolbar-input');
input.value = 'test';

@@ -174,3 +174,3 @@

button = editor.toolbar.querySelector('[data-element="a"]');
cancel = editor.anchorForm.querySelector('a.medium-editor-toobar-anchor-close');
cancel = editor.anchorForm.querySelector('a.medium-editor-toobar-close');
fireEvent(button, 'click');

@@ -177,0 +177,0 @@ expect(editor.anchorForm.style.display).toBe('block');

@@ -68,3 +68,4 @@ /*global MediumEditor, describe, it, expect, spyOn,

expect(editor.elements.length).toEqual(nodeList.length);
expect(typeof editor.elements).not.toBe(typeof nodeList);
expect(typeof nodeList.forEach).toBe('undefined');
expect(typeof editor.elements.forEach).toBe('function');
editor.deactivate();

@@ -102,2 +103,3 @@

anchorInputPlaceholder: 'Paste or type a link',
anchorInputCheckboxLabel: 'Open in new window',
delay: 0,

@@ -142,2 +144,3 @@ diffLeft: 0,

anchorInputPlaceholder: 'test',
anchorInputCheckboxLabel: 'new window?',
diffLeft: 10,

@@ -144,0 +147,0 @@ diffTop: 5,

@@ -95,3 +95,3 @@ /*global MediumEditor, describe, it, expect, spyOn,

expect(editor.setToolbarButtonStates.calls.count()).toEqual(1);
expect(editor.setToolbarButtonStates).toHaveBeenCalled();
});

@@ -98,0 +98,0 @@ });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc