New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-trix

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-trix - npm Package Compare versions

Comparing version 0.3.1 to 0.4.1

dist/react-trix.map

299

dist/react-trix.js

@@ -1,289 +0,10 @@

(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("React"));
else if(typeof define === 'function' && define.amd)
define(["React"], factory);
else if(typeof exports === 'object')
exports["react-trix"] = factory(require("React"));
else
root["react-trix"] = factory(root["React"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_0__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "dist/";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_0__;
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var React = __webpack_require__(0);
var TrixEditor = (function (_super) {
__extends(TrixEditor, _super);
function TrixEditor(props) {
var _this = _super.call(this, props) || this;
_this.container = null;
_this.editor = null;
_this.d = null;
_this.id = _this.generateId();
_this.state = {
showMergeTags: false,
tags: []
};
return _this;
}
TrixEditor.prototype.generateId = function () {
var timestamp = Date.now();
var uniqueNumber = 0;
(function () {
if (timestamp <= uniqueNumber) {
timestamp = ++uniqueNumber;
}
else {
uniqueNumber = timestamp;
}
})();
return "T" + timestamp.toString();
};
TrixEditor.prototype.componentDidMount = function () {
var _this = this;
var props = this.props;
this.container = document.getElementById("editor-" + this.id);
if (this.container) {
this.container.addEventListener("trix-initialize", function () {
_this.editor = _this.container.editor;
if (!_this.editor) {
console.error("cannot find trix editor");
}
if (props.onEditorReady && typeof props.onEditorReady == "function") {
props.onEditorReady(_this.editor);
}
}, false);
this.container.addEventListener('trix-change', this.handleChange.bind(this), false);
if (props.uploadURL) {
this.container.addEventListener("trix-attachment-add", this.handleUpload.bind(this));
}
}
else {
console.error("editor not found");
}
};
TrixEditor.prototype.componentWillUnmount = function () {
this.container.removeEventListener("trix-initialize", this.handleChange);
this.container.removeEventListener("trix-change", this.handleChange);
if (this.props.uploadURL) {
this.container.removeEventListener("trix-attachment-add", this.handleUpload);
}
};
TrixEditor.prototype.handleChange = function (e) {
var props = this.props;
var state = this.state;
var text = e.target.innerText;
if (props.onChange) {
props.onChange(e.target.innerHTML, text);
}
var range = this.editor.getSelectedRange();
if (text && range[0] == range[1]) {
if (props.mergeTags) {
var lastChar = range[0] - 1;
if (lastChar >= 0 && lastChar < text.length) {
var trigger = text[lastChar];
for (var i = 0; i < props.mergeTags.length; i++) {
if (trigger == props.mergeTags[i].trigger) {
state.showMergeTags = true;
state.tags = props.mergeTags[i].tags;
this.setState(state);
break;
}
}
}
}
}
};
TrixEditor.prototype.handleUpload = function (e) {
var attachment = e.attachment;
if (attachment.file) {
return this.uploadAttachment(attachment);
}
};
TrixEditor.prototype.uploadAttachment = function (attachment) {
var file, form, xhr;
file = attachment.file;
form = new FormData();
if (this.props.uploadData) {
for (var k in this.props.uploadData) {
form[k] = this.props.uploadData[k];
}
}
form.append("Content-Type", file.type);
form.append("file", file);
xhr = new XMLHttpRequest();
xhr.open("POST", this.props.uploadURL, true);
xhr.upload.onprogress = function (event) {
var progress = event.loaded / event.total * 100;
return attachment.setUploadProgress(progress);
};
xhr.onload = function () {
var href, url;
if (xhr.status >= 200 && xhr.status < 300) {
url = href = xhr.responseText;
return attachment.setAttributes({
url: url,
href: href
});
}
};
return xhr.send(form);
};
TrixEditor.prototype.handleTagSelected = function (t, e) {
e.preventDefault();
var state = this.state;
state.showMergeTags = false;
this.setState(state);
this.editor.expandSelectionInDirection("backward");
this.editor.insertString(t.tag);
};
TrixEditor.prototype.renderTagSelector = function (tags) {
var _this = this;
if (!tags) {
return null;
}
var editorPosition = document.getElementById("trix-editor-top-level").getBoundingClientRect();
var rect = this.editor.getClientRectAtPosition(this.editor.getSelectedRange()[0]);
var boxStyle = {
"position": "absolute",
"top": rect.top + 25 - editorPosition.top,
"left": rect.left + 25 - editorPosition.left,
"width": "250px",
"boxSizing": "border-box",
"padding": 0,
"margin": ".2em 0 0",
"backgroundColor": "hsla(0,0%,100%,.9)",
"borderRadius": ".3em",
"background": "linear-gradient(to bottom right, white, hsla(0,0%,100%,.8))",
"border": "1px solid rgba(0,0,0,.3)",
"boxShadow": ".05em .2em .6em rgba(0,0,0,.2)",
"textShadow": "none"
};
var tagStyle = {
"display": "block",
"padding": ".2em .5em",
"cursor": "pointer"
};
return (React.createElement("div", { style: boxStyle, className: "react-trix-suggestions" }, tags.map(function (t) {
return React.createElement("a", { key: t.name, style: tagStyle, href: "#", onClick: _this.handleTagSelected.bind(_this, t) }, t.name);
})));
};
TrixEditor.prototype.render = function () {
var _this = this;
var state = this.state;
var props = this.props;
var attributes = {
"id": "editor-" + this.id,
"input": "input-" + this.id
};
if (props.autoFocus) {
attributes["autoFocus"] = props.autoFocus.toString();
}
if (props.placeholder) {
attributes["placeholder"] = props.placeholder;
}
var mergetags = null;
if (state.showMergeTags) {
mergetags = this.renderTagSelector(state.tags);
}
return (React.createElement("div", { id: "trix-editor-top-level", ref: function (d) { return _this.d = d; }, style: { "position": "relative" } },
React.createElement("trix-editor", attributes),
React.createElement("input", { type: "hidden", id: "input-" + this.id, value: this.props.value }),
mergetags));
};
return TrixEditor;
}(React.Component));
exports.TrixEditor = TrixEditor;
/***/ })
/******/ ]);
});
parcelRequire=function(e,r,n,t){var i="function"==typeof parcelRequire&&parcelRequire,o="function"==typeof require&&require;function u(n,t){if(!r[n]){if(!e[n]){var f="function"==typeof parcelRequire&&parcelRequire;if(!t&&f)return f(n,!0);if(i)return i(n,!0);if(o&&"string"==typeof n)return o(n);var c=new Error("Cannot find module '"+n+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[n][1][r]||r},p.cache={};var l=r[n]=new u.Module(n);e[n][0].call(l.exports,p,l,l.exports,this)}return r[n].exports;function p(e){return u(p.resolve(e))}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=r,u.parent=i,u.register=function(r,n){e[r]=[function(e,r){r.exports=n},{}]};for(var f=0;f<n.length;f++)u(n[f]);if(n.length){var c=u(n[n.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd?define(function(){return c}):t&&(this[t]=c)}return u}({"J4Nk":[function(require,module,exports) {
"use strict";var r=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,e=Object.prototype.propertyIsEnumerable;function n(r){if(null==r)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function o(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de","5"===Object.getOwnPropertyNames(r)[0])return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(r){return t[r]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(r){n[r]=r}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(o){return!1}}module.exports=o()?Object.assign:function(o,c){for(var a,i,s=n(o),f=1;f<arguments.length;f++){for(var u in a=Object(arguments[f]))t.call(a,u)&&(s[u]=a[u]);if(r){i=r(a);for(var b=0;b<i.length;b++)e.call(a,i[b])&&(s[i[b]]=a[i[b]])}}return s};
},{}],"awqi":[function(require,module,exports) {
"use strict";var e=require("object-assign"),r="function"==typeof Symbol&&Symbol.for,t=r?Symbol.for("react.element"):60103,n=r?Symbol.for("react.portal"):60106,o=r?Symbol.for("react.fragment"):60107,u=r?Symbol.for("react.strict_mode"):60108,l=r?Symbol.for("react.profiler"):60114,i=r?Symbol.for("react.provider"):60109,f=r?Symbol.for("react.context"):60110,c=r?Symbol.for("react.concurrent_mode"):60111,a=r?Symbol.for("react.forward_ref"):60112,p=r?Symbol.for("react.suspense"):60113,s=r?Symbol.for("react.memo"):60115,y=r?Symbol.for("react.lazy"):60116,d="function"==typeof Symbol&&Symbol.iterator;function v(e,r,t,n,o,u,l,i){if(!e){if(e=void 0,void 0===r)e=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[t,n,o,u,l,i],c=0;(e=Error(r.replace(/%s/g,function(){return f[c++]}))).name="Invariant Violation"}throw e.framesToPop=1,e}}function m(e){for(var r=arguments.length-1,t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=0;n<r;n++)t+="&args[]="+encodeURIComponent(arguments[n+1]);v(!1,"Minified React error #"+e+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",t)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b={};function _(e,r,t){this.props=e,this.context=r,this.refs=b,this.updater=t||h}function S(){}function $(e,r,t){this.props=e,this.context=r,this.refs=b,this.updater=t||h}_.prototype.isReactComponent={},_.prototype.setState=function(e,r){"object"!=typeof e&&"function"!=typeof e&&null!=e&&m("85"),this.updater.enqueueSetState(this,e,r,"setState")},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},S.prototype=_.prototype;var g=$.prototype=new S;g.constructor=$,e(g,_.prototype),g.isPureReactComponent=!0;var k={current:null,currentDispatcher:null},w=Object.prototype.hasOwnProperty,x={key:!0,ref:!0,__self:!0,__source:!0};function P(e,r,n){var o=void 0,u={},l=null,i=null;if(null!=r)for(o in void 0!==r.ref&&(i=r.ref),void 0!==r.key&&(l=""+r.key),r)w.call(r,o)&&!x.hasOwnProperty(o)&&(u[o]=r[o]);var f=arguments.length-2;if(1===f)u.children=n;else if(1<f){for(var c=Array(f),a=0;a<f;a++)c[a]=arguments[a+2];u.children=c}if(e&&e.defaultProps)for(o in f=e.defaultProps)void 0===u[o]&&(u[o]=f[o]);return{$$typeof:t,type:e,key:l,ref:i,props:u,_owner:k.current}}function j(e,r){return{$$typeof:t,type:e.type,key:r,ref:e.ref,props:e.props,_owner:e._owner}}function C(e){return"object"==typeof e&&null!==e&&e.$$typeof===t}function E(e){var r={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,function(e){return r[e]})}var R=/\/+/g,O=[];function A(e,r,t,n){if(O.length){var o=O.pop();return o.result=e,o.keyPrefix=r,o.func=t,o.context=n,o.count=0,o}return{result:e,keyPrefix:r,func:t,context:n,count:0}}function U(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>O.length&&O.push(e)}function q(e,r,o,u){var l=typeof e;"undefined"!==l&&"boolean"!==l||(e=null);var i=!1;if(null===e)i=!0;else switch(l){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case t:case n:i=!0}}if(i)return o(u,e,""===r?"."+I(e,0):r),1;if(i=0,r=""===r?".":r+":",Array.isArray(e))for(var f=0;f<e.length;f++){var c=r+I(l=e[f],f);i+=q(l,c,o,u)}else if(null===e||"object"!=typeof e?c=null:c="function"==typeof(c=d&&e[d]||e["@@iterator"])?c:null,"function"==typeof c)for(e=c.call(e),f=0;!(l=e.next()).done;)i+=q(l=l.value,c=r+I(l,f++),o,u);else"object"===l&&m("31","[object Object]"===(o=""+e)?"object with keys {"+Object.keys(e).join(", ")+"}":o,"");return i}function F(e,r,t){return null==e?0:q(e,"",r,t)}function I(e,r){return"object"==typeof e&&null!==e&&null!=e.key?E(e.key):r.toString(36)}function M(e,r){e.func.call(e.context,r,e.count++)}function T(e,r,t){var n=e.result,o=e.keyPrefix;e=e.func.call(e.context,r,e.count++),Array.isArray(e)?V(e,n,t,function(e){return e}):null!=e&&(C(e)&&(e=j(e,o+(!e.key||r&&r.key===e.key?"":(""+e.key).replace(R,"$&/")+"/")+t)),n.push(e))}function V(e,r,t,n,o){var u="";null!=t&&(u=(""+t).replace(R,"$&/")+"/"),F(e,T,r=A(r,u,n,o)),U(r)}var D={Children:{map:function(e,r,t){if(null==e)return e;var n=[];return V(e,n,null,r,t),n},forEach:function(e,r,t){if(null==e)return e;F(e,M,r=A(null,null,r,t)),U(r)},count:function(e){return F(e,function(){return null},null)},toArray:function(e){var r=[];return V(e,r,null,function(e){return e}),r},only:function(e){return C(e)||m("143"),e}},createRef:function(){return{current:null}},Component:_,PureComponent:$,createContext:function(e,r){return void 0===r&&(r=null),(e={$$typeof:f,_calculateChangedBits:r,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:i,_context:e},e.Consumer=e},forwardRef:function(e){return{$$typeof:a,render:e}},lazy:function(e){return{$$typeof:y,_ctor:e,_status:-1,_result:null}},memo:function(e,r){return{$$typeof:s,type:e,compare:void 0===r?null:r}},Fragment:o,StrictMode:u,Suspense:p,createElement:P,cloneElement:function(r,n,o){null==r&&m("267",r);var u=void 0,l=e({},r.props),i=r.key,f=r.ref,c=r._owner;if(null!=n){void 0!==n.ref&&(f=n.ref,c=k.current),void 0!==n.key&&(i=""+n.key);var a=void 0;for(u in r.type&&r.type.defaultProps&&(a=r.type.defaultProps),n)w.call(n,u)&&!x.hasOwnProperty(u)&&(l[u]=void 0===n[u]&&void 0!==a?a[u]:n[u])}if(1===(u=arguments.length-2))l.children=o;else if(1<u){a=Array(u);for(var p=0;p<u;p++)a[p]=arguments[p+2];l.children=a}return{$$typeof:t,type:r.type,key:i,ref:f,props:l,_owner:c}},createFactory:function(e){var r=P.bind(null,e);return r.type=e,r},isValidElement:C,version:"16.7.0",unstable_ConcurrentMode:c,unstable_Profiler:l,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:k,assign:e}},L={default:D},N=L&&D||L;module.exports=N.default||N;
},{"object-assign":"J4Nk"}],"1n8/":[function(require,module,exports) {
"use strict";module.exports=require("./cjs/react.production.min.js");
},{"./cjs/react.production.min.js":"awqi"}],"/kdL":[function(require,module,exports) {
"use strict";var t=this&&this.__extends||function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),e=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(exports,"__esModule",{value:!0});var n=e(require("react")),r=function(e){function r(t){var n=e.call(this,t)||this;return n.container=null,n.editor=null,n.d=null,n.id=n.generateId(),n.state={showMergeTags:!1,tags:[]},n}return t(r,e),r.prototype.generateId=function(){var t=Date.now(),e=0;return t<=e?t=++e:e=t,"T"+t.toString()},r.prototype.componentDidMount=function(){var t=this,e=this.props;this.container=document.getElementById("editor-"+this.id),this.container?(this.container.addEventListener("trix-initialize",function(){t.editor=t.container.editor,t.editor||console.error("cannot find trix editor"),e.onEditorReady&&"function"==typeof e.onEditorReady&&e.onEditorReady(t.editor)},!1),this.container.addEventListener("trix-change",this.handleChange.bind(this),!1),e.uploadURL&&this.container.addEventListener("trix-attachment-add",this.handleUpload.bind(this))):console.error("editor not found")},r.prototype.componentWillUnmount=function(){this.container.removeEventListener("trix-initialize",this.handleChange),this.container.removeEventListener("trix-change",this.handleChange),this.props.uploadURL&&this.container.removeEventListener("trix-attachment-add",this.handleUpload)},r.prototype.handleChange=function(t){var e=this.props,n=this.state,r=t.target.innerText;e.onChange&&e.onChange(t.target.innerHTML,r);var o=this.editor.getSelectedRange();if(r&&o[0]==o[1]&&e.mergeTags){var i=o[0]-1;if(i>=0&&i<r.length)for(var a=r[i],s=0;s<e.mergeTags.length;s++)if(a==e.mergeTags[s].trigger){n.showMergeTags=!0,n.tags=e.mergeTags[s].tags,this.setState(n);break}}},r.prototype.handleUpload=function(t){var e=t.attachment;if(e.file)return this.uploadAttachment(e)},r.prototype.uploadAttachment=function(t){var e,n,r;if(e=t.file,n=new FormData,this.props.uploadData)for(var o in this.props.uploadData)n[o]=this.props.uploadData[o];return n.append("Content-Type",e.type),n.append("file",e),(r=new XMLHttpRequest).open("POST",this.props.uploadURL,!0),r.upload.onprogress=function(e){var n=e.loaded/e.total*100;return t.setUploadProgress(n)},r.onload=function(){var e,n;if(r.status>=200&&r.status<300)return n=e=r.responseText,t.setAttributes({url:n,href:e})},r.send(n)},r.prototype.handleTagSelected=function(t,e){e.preventDefault();var n=this.state;n.showMergeTags=!1,this.setState(n),this.editor.expandSelectionInDirection("backward"),this.editor.insertString(t.tag)},r.prototype.renderTagSelector=function(t){var e=this;if(!t)return null;var r=document.getElementById("trix-editor-top-level").getBoundingClientRect(),o=this.editor.getClientRectAtPosition(this.editor.getSelectedRange()[0]),i={position:"absolute",top:o.top+25-r.top,left:o.left+25-r.left,width:"250px",boxSizing:"border-box",padding:0,margin:".2em 0 0",backgroundColor:"hsla(0,0%,100%,.9)",borderRadius:".3em",background:"linear-gradient(to bottom right, white, hsla(0,0%,100%,.8))",border:"1px solid rgba(0,0,0,.3)",boxShadow:".05em .2em .6em rgba(0,0,0,.2)",textShadow:"none"},a={display:"block",padding:".2em .5em",cursor:"pointer"};return n.createElement("div",{style:i,className:"react-trix-suggestions"},t.map(function(t){return n.createElement("a",{key:t.name,style:a,href:"#",onClick:e.handleTagSelected.bind(e,t)},t.name)}))},r.prototype.render=function(){var t=this,e=this.state,r=this.props,o={id:"editor-"+this.id,input:"input-"+this.id};r.autoFocus&&(o.autoFocus=r.autoFocus.toString()),r.placeholder&&(o.placeholder=r.placeholder);var i=null;return e.showMergeTags&&(i=this.renderTagSelector(e.tags)),n.createElement("div",{id:"trix-editor-top-level",ref:function(e){return t.d=e},style:{position:"relative"}},n.createElement("trix-editor",o),n.createElement("input",{type:"hidden",id:"input-"+this.id,value:this.props.value}),i)},r}(n.Component);exports.TrixEditor=r;
},{"react":"1n8/"}]},{},["/kdL"], null)
//# sourceMappingURL=/react-trix.map
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {

@@ -7,0 +10,0 @@ extendStatics(d, b);

{
"name": "react-trix",
"version": "0.3.1",
"version": "0.4.1",
"description": "React wrapper around Basecamp's Trix editor.",
"main": "main.js",
"scripts": {
"build": "npm run build:lib && NODE_ENV=production webpack --config webpack.prod.config.js",
"build": "npm run build:lib && parcel build src/react-trix.tsx",
"build:lib": "rm ./lib/* && tsc",
"prebuild": "rm -rf dist && mkdir dist",
"prepublish": "npm run build",
"postbuild": "NODE_ENV=production TARGET=minify webpack --config webpack.prod.config.js",
"postbuild": "parcel build src/react-trix.tsx",
"test": "./test.sh"

@@ -30,3 +30,3 @@ },

"name": "Dominic St-Pierre",
"email": "dominic@roadmap.space"
"email": "dominicstpierre@gmail.com"
},

@@ -39,24 +39,13 @@ "license": "MIT",

"dependencies": {
"trix": "^0.11.1"
"trix": "^1.0.0"
},
"devDependencies": {
"@types/chai": "^3.5.2",
"@types/enzyme": "^2.8.12",
"@types/mocha": "^2.2.48",
"@types/react": "^15.6.18",
"@types/react-dom": "^0.14.23",
"@types/sinon": "^1.16.36",
"chai": "^3.5.0",
"enzyme": "^2.9.1",
"http-server": "^0.9.0",
"jsdom": "^9.12.0",
"mocha": "^3.5.3",
"react": "^16.4.0",
"react-addons-test-utils": "^16.4.0",
"react-dom": "^16.4.0",
"sinon": "^2.4.1",
"source-map-loader": "^0.2.3",
"ts-loader": "^2.3.7",
"typescript": "^2.9.2",
"webpack": "^2.7.0"
"@types/react": "^16.7.22",
"@types/react-dom": "^16.0.11",
"parcel": "^1.11.0",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"source-map-loader": "^0.2.4",
"ts-loader": "^5.3.3",
"typescript": "^3.3.1"
},

@@ -63,0 +52,0 @@ "peerDependencies": {

@@ -20,2 +20,4 @@ # React Trix 0.3.1

#### Classic script tag
```html

@@ -25,3 +27,15 @@ <script src="https://rawgit.com/basecamp/trix/master/dist/trix.js"></script>

#### Or via npm
```bash
npm i trix
```
```jsx
import trix from 'trix'
```
If you're using npm version with SSR make sure to import trix on page level.
```jsx
import * as React from "react";

@@ -34,3 +48,3 @@ import { TrixEditor } from "react-trix";

// do editing programatically
editor.insertText("editor is ready");
editor.insertString("editor is ready");
}

@@ -43,3 +57,3 @@ handleChange(html, text) {

return (
<TrixEditor onChange={this.handleChange} onEditorReady={this.handleReady} />
<TrixEditor onChange={this.handleChange} onEditorReady={this.handleEditorReady} />
);

@@ -104,2 +118,1 @@ }

Contributions are welcome and appreciated.

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