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

tiny-editor

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tiny-editor - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

2

dist/bundle.js

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

!function(){"use strict";var p="beforeend",y="__toolbar-item",d=function(t,e,n,r){var a=document.createElement("select");a.dataset.commandId=t,a.className=y,a.title=e,a.addEventListener("change",function(e){return r(t,e.target.options[e.target.selectedIndex].value)});var i,o,l,d,c=!0,s=!1,u=void 0;try{for(var f,m=n[Symbol.iterator]();!(c=(f=m.next()).done);c=!0){var v=f.value;a.insertAdjacentElement(p,(i=v.value,o=v.text,l=v.selected,d=void 0,(d=document.createElement("option")).innerText=o,i&&d.setAttribute("value",i),l&&d.setAttribute("selected",l),d))}}catch(e){s=!0,u=e}finally{try{c||null==m.return||m.return()}finally{if(s)throw u}}return a},c=function(e,t,n,r){var a=document.createElement("button");return a.dataset.commandId=e,a.className=y,a.title=t,a.insertAdjacentElement(p,n),a.addEventListener("click",function(){return r(e)}),a},s=function(e){var t=document.createElement("i");return t.className=e,t},u="no",f=function(){var e=document.createElement("span");return e.className="__toolbar-separator",e},t=function(e,t){var n,r,a,i,o,l=document.createElement("div");return l.className="__toolbar",e.formatblock!==u&&l.insertAdjacentElement(p,d("formatblock","Styles",[{value:"h1",text:"Title 1"},{value:"h2",text:"Title 2"},{value:"h3",text:"Title 3"},{value:"h4",text:"Title 4"},{value:"h5",text:"Title 5"},{value:"h6",text:"Title 6"},{value:"p",text:"Paragraph",selected:!0},{value:"pre",text:"Preformatted"}],t)),e.fontname!==u&&l.insertAdjacentElement(p,d("fontname","Font",[{value:"serif",text:"Serif",selected:!0},{value:"sans-serif",text:"Sans Serif"},{value:"monospace",text:"Monospace"},{value:"cursive",text:"Cursive"},{value:"fantasy",text:"Fantasy"}],t)),e.bold!==u&&l.insertAdjacentElement(p,c("bold","Bold",s("fas fa-bold"),t)),e.italic!==u&&l.insertAdjacentElement(p,c("italic","Italic",s("fas fa-italic"),t)),e.underline!==u&&l.insertAdjacentElement(p,c("underline","Underline",s("fas fa-underline"),t)),e.forecolor!==u&&l.insertAdjacentElement(p,(n="forecolor",r="Text color",a="color",i=t,(o=document.createElement("input")).dataset.commandId=n,o.className=y,o.title=r,o.type=a,o.addEventListener("change",function(e){return i(n,e.target.value)}),o)),l.insertAdjacentElement(p,f()),e.justifyleft!==u&&l.insertAdjacentElement(p,c("justifyleft","Left align",s("fas fa-align-left"),t)),e.justifycenter!==u&&l.insertAdjacentElement(p,c("justifycenter","Center align",s("fas fa-align-center"),t)),e.justifyright!==u&&l.insertAdjacentElement(p,c("justifyright","Right align",s("fas fa-align-right"),t)),l.insertAdjacentElement(p,f()),e.insertorderedlist!==u&&l.insertAdjacentElement(p,c("insertorderedlist","Numbered list",s("fas fa-list-ol"),t)),e.insertunorderedlist!==u&&l.insertAdjacentElement(p,c("insertunorderedlist","Bulleted list",s("fas fa-list-ul"),t)),e.outdent!==u&&l.insertAdjacentElement(p,c("outdent","Decrease indent",s("fas fa-indent fa-flip-horizontal"),t)),e.indent!==u&&l.insertAdjacentElement(p,c("indent","Increase indent",s("fas fa-indent"),t)),l.insertAdjacentElement(p,f()),e.removeFormat!==u&&l.insertAdjacentElement(p,c("removeFormat","Clear formatting",s("fas fa-eraser"),t)),l},g=function(e,t){return e.find(function(e){return e.nodeName.toLowerCase()===t})},n=function(e,t,n){return e.find(function(e){return e.style[t]===n})},h={bold:function(e){return!!g(e,"b")},italic:function(e){return!!g(e,"i")},underline:function(e){return!!g(e,"u")},justifyleft:function(e){return!!n(e,"textAlign","left")},justifycenter:function(e){return!!n(e,"textAlign","center")},justifyright:function(e){return!!n(e,"textAlign","right")},insertorderedlist:function(e){return!!g(e,"ol")},insertunorderedlist:function(e){return!!g(e,"ul")},outdent:function(e){return!1},indent:function(e){return!1},removeFormat:function(e){return!1}};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===n&&r.firstChild?r.insertBefore(a,r.firstChild):r.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}(".__editor {\r\n background: #ffffff;\r\n border: solid 1px #e0e0e0;\r\n margin-top: 10px;\r\n overflow: scroll;\r\n padding: 10px;\r\n}\r\n\r\n.__editor:focus {\r\n outline: none;\r\n}\r\n\r\n.__toolbar {\r\n display: flex;\r\n flex-wrap: wrap;\r\n padding: 5px;\r\n}\r\n\r\n.__toolbar-item {\r\n background: #ffffff;\r\n border: 0;\r\n border-radius: 3px;\r\n cursor: pointer;\r\n margin-right: 7px;\r\n min-width: 30px;\r\n padding: 5px;\r\n}\r\n\r\n.__toolbar-item:hover,\r\n.__toolbar-item.active {\r\n background: #f0f0f0;\r\n}\r\n\r\n.__toolbar-separator {\r\n border-left: solid 1px #e0e0e0;\r\n margin-right: 7px;\r\n}\r\n\r\n.__toolbar-separator:last-child {\r\n display: none;\r\n}\r\n"),document.querySelectorAll("[data-tiny-editor]").forEach(function(n){n.setAttribute("contentEditable",!0),n.className="__editor",n.style.height=n.dataset.height||"400px";var p=t(n.dataset,function(e,t){document.execCommand(e,!1,t),n.focus()});n.insertAdjacentElement("beforebegin",p);var e=function(){for(var e=document.getSelection().anchorNode,t=[];e&&(!e.dataset||!e.dataset.hasOwnProperty("tinyEditor"));)1===e.nodeType&&t.push(e),e=e.parentNode;var n=p.querySelectorAll("button[data-command-id]"),r=!0,a=!1,i=void 0;try{for(var o,l=n[Symbol.iterator]();!(r=(o=l.next()).done);r=!0){var d=o.value,c=h[d.dataset.commandId](t);d.classList.toggle("active",c)}}catch(e){a=!0,i=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw i}}p.querySelector("select[data-command-id='formatblock']");var s=p.querySelector("select[data-command-id='fontname']");if(s){var u=g(t,"font"),f=u&&u.face?u.face:"serif";s.selectedIndex=Array.from(s.options).find(function(e){return e.value===f})}var m=p.querySelector("input[data-command-id='forecolor']");if(m){var v=g(t,"font");m.value=v&&v.color?v.color:"#000000"}};n.addEventListener("keydown",e),n.addEventListener("keyup",e),n.addEventListener("click",e),p.addEventListener("click",e)})}();
!function(){"use strict";var p="beforeend",y="__toolbar-item",d=function(t,e,n,r){var a=document.createElement("select");a.dataset.commandId=t,a.className=y,a.title=e,a.addEventListener("change",function(e){return r(t,e.target.options[e.target.selectedIndex].value)});var i,o,l,d,c=!0,s=!1,u=void 0;try{for(var f,m=n[Symbol.iterator]();!(c=(f=m.next()).done);c=!0){var v=f.value;a.insertAdjacentElement(p,(i=v.value,o=v.text,l=v.selected,d=void 0,(d=document.createElement("option")).innerText=o,i&&d.setAttribute("value",i),l&&d.setAttribute("selected",l),d))}}catch(e){s=!0,u=e}finally{try{c||null==m.return||m.return()}finally{if(s)throw u}}return a},c=function(e,t,n,r){var a=document.createElement("button");return a.dataset.commandId=e,a.className=y,a.title=t,a.insertAdjacentElement(p,n),a.addEventListener("click",function(){return r(e)}),a},s=function(e){var t=document.createElement("i");return t.className=e,t},u="no",f=function(){var e=document.createElement("span");return e.className="__toolbar-separator",e},t=function(e,t){var n,r,a,i,o,l=document.createElement("div");return l.className="__toolbar",e.formatblock!==u&&l.insertAdjacentElement(p,d("formatblock","Styles",[{value:"h1",text:"Title 1"},{value:"h2",text:"Title 2"},{value:"h3",text:"Title 3"},{value:"h4",text:"Title 4"},{value:"h5",text:"Title 5"},{value:"h6",text:"Title 6"},{value:"p",text:"Paragraph",selected:!0},{value:"pre",text:"Preformatted"}],t)),e.fontname!==u&&l.insertAdjacentElement(p,d("fontname","Font",[{value:"serif",text:"Serif",selected:!0},{value:"sans-serif",text:"Sans Serif"},{value:"monospace",text:"Monospace"},{value:"cursive",text:"Cursive"},{value:"fantasy",text:"Fantasy"}],t)),e.bold!==u&&l.insertAdjacentElement(p,c("bold","Bold",s("fas fa-bold"),t)),e.italic!==u&&l.insertAdjacentElement(p,c("italic","Italic",s("fas fa-italic"),t)),e.underline!==u&&l.insertAdjacentElement(p,c("underline","Underline",s("fas fa-underline"),t)),e.forecolor!==u&&l.insertAdjacentElement(p,(n="forecolor",r="Text color",a="color",i=t,(o=document.createElement("input")).dataset.commandId=n,o.className=y,o.title=r,o.type=a,o.addEventListener("change",function(e){return i(n,e.target.value)}),o)),l.insertAdjacentElement(p,f()),e.justifyleft!==u&&l.insertAdjacentElement(p,c("justifyleft","Left align",s("fas fa-align-left"),t)),e.justifycenter!==u&&l.insertAdjacentElement(p,c("justifycenter","Center align",s("fas fa-align-center"),t)),e.justifyright!==u&&l.insertAdjacentElement(p,c("justifyright","Right align",s("fas fa-align-right"),t)),l.insertAdjacentElement(p,f()),e.insertorderedlist!==u&&l.insertAdjacentElement(p,c("insertorderedlist","Numbered list",s("fas fa-list-ol"),t)),e.insertunorderedlist!==u&&l.insertAdjacentElement(p,c("insertunorderedlist","Bulleted list",s("fas fa-list-ul"),t)),e.outdent!==u&&l.insertAdjacentElement(p,c("outdent","Decrease indent",s("fas fa-indent fa-flip-horizontal"),t)),e.indent!==u&&l.insertAdjacentElement(p,c("indent","Increase indent",s("fas fa-indent"),t)),l.insertAdjacentElement(p,f()),e.removeFormat!==u&&l.insertAdjacentElement(p,c("removeFormat","Clear formatting",s("fas fa-eraser"),t)),l},g=function(e,t){return e.find(function(e){return e.nodeName.toLowerCase()===t})},n=function(e,t,n){return e.find(function(e){return e.style[t]===n})},h={bold:function(e){return!!g(e,"b")},italic:function(e){return!!g(e,"i")},underline:function(e){return!!g(e,"u")},justifyleft:function(e){return!!n(e,"textAlign","left")},justifycenter:function(e){return!!n(e,"textAlign","center")},justifyright:function(e){return!!n(e,"textAlign","right")},insertorderedlist:function(e){return!!g(e,"ol")},insertunorderedlist:function(e){return!!g(e,"ul")},outdent:function(e){return!1},indent:function(e){return!1},removeFormat:function(e){return!1}};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===n&&r.firstChild?r.insertBefore(a,r.firstChild):r.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}(".__editor {\r\n background: #ffffff;\r\n border: solid 1px #e0e0e0;\r\n margin-top: 10px;\r\n overflow: scroll;\r\n padding: 10px;\r\n}\r\n\r\n.__editor:focus {\r\n outline: none;\r\n}\r\n\r\n.__toolbar {\r\n display: flex;\r\n flex-wrap: wrap;\r\n padding: 5px;\r\n}\r\n\r\n.__toolbar-item {\r\n background: #ffffff;\r\n border: 0;\r\n border-radius: 3px;\r\n cursor: pointer;\r\n margin-right: 7px;\r\n min-width: 30px;\r\n padding: 5px;\r\n}\r\n\r\n.__toolbar-item:hover,\r\n.__toolbar-item.active {\r\n background: #f0f0f0;\r\n}\r\n\r\n.__toolbar-separator {\r\n border-left: solid 1px #e0e0e0;\r\n margin-right: 7px;\r\n}\r\n\r\n.__toolbar-separator:last-child {\r\n display: none;\r\n}\r\n"),document.querySelectorAll("[data-tiny-editor]").forEach(function(n){n.setAttribute("contentEditable",!0),n.className="__editor",n.style.height=n.dataset.height||"400px";var p=t(n.dataset,function(e,t){document.execCommand(e,!1,t),n.focus()});n.insertAdjacentElement("beforebegin",p);var e=function(){for(var e=document.getSelection().anchorNode,t=[];e&&(!e.dataset||!e.dataset.hasOwnProperty("tinyEditor"));)1===e.nodeType&&t.push(e),e=e.parentNode;var n=p.querySelectorAll("button[data-command-id]"),r=!0,a=!1,i=void 0;try{for(var o,l=n[Symbol.iterator]();!(r=(o=l.next()).done);r=!0){var d=o.value,c=h[d.dataset.commandId](t);d.classList.toggle("active",c)}}catch(e){a=!0,i=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw i}}p.querySelector("select[data-command-id='formatblock']");var s=p.querySelector("select[data-command-id='fontname']");if(s){var u=g(t,"font"),f=u&&u.face?u.face:"serif";s.selectedIndex=Array.from(s.options).find(function(e){return e.value===f}).index}var m=p.querySelector("input[data-command-id='forecolor']");if(m){var v=g(t,"font");m.value=v&&v.color?v.color:"#000000"}};n.addEventListener("keydown",e),n.addEventListener("keyup",e),n.addEventListener("click",e),p.addEventListener("click",e)})}();
//# sourceMappingURL=bundle.js.map
{
"name": "tiny-editor",
"version": "0.2.2",
"version": "0.2.3",
"description": "A tiny HTML rich text editor written in vanilla JavaScript",

@@ -5,0 +5,0 @@ "scripts": {

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