Socket
Socket
Sign inDemoInstall

@toast-ui/react-editor

Package Overview
Dependencies
31
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

2

CODE_OF_CONDUCT.md

@@ -33,3 +33,3 @@ Contributor Covenant Code of Conduct

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at dl_javascript@nhnent.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at dl_javascript@nhn.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

@@ -36,0 +36,0 @@ Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

@@ -88,5 +88,5 @@ # Contributing to TOAST UI

## Code of Conduct
This project and everyone participating in it is governed by the [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to dl_javascript@nhnent.com.
This project and everyone participating in it is governed by the [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to dl_javascript@nhn.com.
> This Guide is base on [atom contributing guide](https://github.com/atom/atom/blob/master/CONTRIBUTING.md), [CocoaPods](http://guides.cocoapods.org/contributing/contribute-to-cocoapods.html) and [ESLint](http://eslint.org/docs/developer-guide/contributing/pull-requests)
[demo]:http://ui.toast.com/tui-chart

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

module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t){e.exports=require("react")},function(e,t){e.exports=require("tui-editor")},function(e,t){e.exports=require("tui-editor/dist/tui-editor-Viewer")},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n.n(r),i=n(1),u=n.n(i);function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var y=function(e){function t(){var e,n,r,i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var u=arguments.length,f=new Array(u),l=0;l<u;l++)f[l]=arguments[l];return r=this,n=!(i=(e=a(t)).call.apply(e,[this].concat(f)))||"object"!==c(i)&&"function"!=typeof i?s(r):i,p(s(s(n)),"rootEl",o.a.createRef()),p(s(s(n)),"editorInst",null),n}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}(t,o.a.Component),n=t,(r=[{key:"getRootElement",value:function(){return this.rootEl.current}},{key:"getInstance",value:function(){return this.editorInst}},{key:"bindEventHandlers",value:function(){var e=this;Object.keys(this.props).filter(function(e){return/on[A-Z][a-zA-Z]+/.test(e)}).forEach(function(t){var n=t[2].toLowerCase()+t.slice(3);e.editorInst.on(n,e.props[t])})}},{key:"componentDidMount",value:function(){this.editorInst=new u.a(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){p(e,t,n[t])})}return e}({el:this.rootEl.current},this.props)),this.bindEventHandlers()}},{key:"shouldComponentUpdate",value:function(e){var t=this.getInstance(),n=e.height,r=e.previewStyle;return this.props.height!==n&&t.height(n),this.props.previewStyle!==r&&t.changePreviewStyle(r),!1}},{key:"render",value:function(){return o.a.createElement("div",{ref:this.rootEl})}}])&&f(n.prototype,r),i&&f(n,i),t}(),b=n(2),v=n.n(b);function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function O(e,t){return(O=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function w(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var j=function(e){function t(){var e,n,r,i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var u=arguments.length,c=new Array(u),f=0;f<u;f++)c[f]=arguments[f];return r=this,n=!(i=(e=m(t)).call.apply(e,[this].concat(c)))||"object"!==h(i)&&"function"!=typeof i?w(r):i,g(w(w(n)),"rootEl",o.a.createRef()),g(w(w(n)),"viewerInst",null),n}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&O(e,t)}(t,o.a.Component),n=t,(r=[{key:"getRootElement",value:function(){return this.rootEl.current}},{key:"getInstance",value:function(){return this.viewerInst}},{key:"bindEventHandlers",value:function(){var e=this;Object.keys(this.props).filter(function(e){return/on[A-Z][a-zA-Z]+/.test(e)}).forEach(function(t){var n=t[2].toLowerCase()+t.slice(3);e.viewerInst.on(n,e.props[t])})}},{key:"componentDidMount",value:function(){this.viewerInst=new v.a(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){g(e,t,n[t])})}return e}({el:this.rootEl.current},this.props)),this.bindEventHandlers()}},{key:"shouldComponentUpdate",value:function(e){var t=this.props.initialValue,n=e.initialValue;return t!==n&&this.getInstance().setValue(n),!1}},{key:"render",value:function(){return o.a.createElement("div",{ref:this.rootEl})}}])&&d(n.prototype,r),i&&d(n,i),t}();n.d(t,"Editor",function(){return y}),n.d(t,"Viewer",function(){return j})}]);
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t){e.exports=require("react")},function(e,t){e.exports=require("tui-editor")},function(e,t){e.exports=require("tui-editor/dist/tui-editor-Viewer")},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n.n(r),i=n(1),u=n.n(i);function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var y=function(e){function t(){var e,n,r,i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var u=arguments.length,f=new Array(u),l=0;l<u;l++)f[l]=arguments[l];return r=this,n=!(i=(e=a(t)).call.apply(e,[this].concat(f)))||"object"!==c(i)&&"function"!=typeof i?s(r):i,p(s(s(n)),"rootEl",o.a.createRef()),p(s(s(n)),"editorInst",null),n}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}(t,o.a.Component),n=t,(r=[{key:"getRootElement",value:function(){return this.rootEl.current}},{key:"getInstance",value:function(){return this.editorInst}},{key:"bindEventHandlers",value:function(e,t){var n=this;Object.keys(e).filter(function(e){return/on[A-Z][a-zA-Z]+/.test(e)}).forEach(function(r){var o=r[2].toLowerCase()+r.slice(3);t&&t[r]!==e[r]&&n.editorInst.off(o),n.editorInst.on(o,e[r])})}},{key:"componentDidMount",value:function(){this.editorInst=new u.a(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){p(e,t,n[t])})}return e}({el:this.rootEl.current},this.props)),this.bindEventHandlers(this.props)}},{key:"shouldComponentUpdate",value:function(e){var t=this.getInstance(),n=e.height,r=e.previewStyle;return this.props.height!==n&&t.height(n),this.props.previewStyle!==r&&t.changePreviewStyle(r),this.bindEventHandlers(e,this.props),!1}},{key:"render",value:function(){return o.a.createElement("div",{ref:this.rootEl})}}])&&f(n.prototype,r),i&&f(n,i),t}(),b=n(2),h=n.n(b);function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function O(e,t){return(O=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function w(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var j=function(e){function t(){var e,n,r,i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var u=arguments.length,c=new Array(u),f=0;f<u;f++)c[f]=arguments[f];return r=this,n=!(i=(e=m(t)).call.apply(e,[this].concat(c)))||"object"!==v(i)&&"function"!=typeof i?w(r):i,g(w(w(n)),"rootEl",o.a.createRef()),g(w(w(n)),"viewerInst",null),n}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&O(e,t)}(t,o.a.Component),n=t,(r=[{key:"getRootElement",value:function(){return this.rootEl.current}},{key:"getInstance",value:function(){return this.viewerInst}},{key:"bindEventHandlers",value:function(e,t){var n=this;Object.keys(this.props).filter(function(e){return/on[A-Z][a-zA-Z]+/.test(e)}).forEach(function(r){var o=r[2].toLowerCase()+r.slice(3);t&&t[r]!==e[r]&&n.viewerInst.off(o),n.viewerInst.on(o,e[r])})}},{key:"componentDidMount",value:function(){this.viewerInst=new h.a(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){g(e,t,n[t])})}return e}({el:this.rootEl.current},this.props)),this.bindEventHandlers(this.props)}},{key:"shouldComponentUpdate",value:function(e){var t=this.props.initialValue,n=e.initialValue;return t!==n&&this.getInstance().setValue(n),this.bindEventHandlers(e,this.props),!1}},{key:"render",value:function(){return o.a.createElement("div",{ref:this.rootEl})}}])&&d(n.prototype,r),i&&d(n,i),t}();n.d(t,"Editor",function(){return y}),n.d(t,"Viewer",function(){return j})}]);
{
"name": "@toast-ui/react-editor",
"version": "1.0.0",
"description": "Toat UI Editor for React",
"version": "1.0.1",
"description": "TOAST UI Editor for React",
"main": "dist/toastui-react-editor.js",

@@ -12,6 +12,6 @@ "scripts": {

},
"homepage": "https://github.com/nhnent/toast-ui.react-editor",
"bugs": "https://github.com/nhnent/toast-ui.react-editor/issues",
"author": "NHN Ent. FE Development Lab <dl_javascript@nhnent.com>",
"repository": "https://github.com/nhnent/toast-ui.react-editor.git",
"homepage": "https://github.com/nhn/toast-ui.react-editor",
"bugs": "https://github.com/nhn/toast-ui.react-editor/issues",
"author": "NHN. FE Development Lab <dl_javascript@nhn.com>",
"repository": "https://github.com/nhn/toast-ui.react-editor.git",
"license": "MIT",

@@ -18,0 +18,0 @@ "browserslist": "last 2 versions, ie 9",

# TOAST UI Editor for React
> This is a React component wrapping [TOAST UI Editor](https://github.com/nhnent/tui.editor).
> This is a React component wrapping [TOAST UI Editor](https://github.com/nhn/tui.editor).
[![github version](https://img.shields.io/github/release/nhnent/toast-ui.react-editor.svg)](https://github.com/nhnent/toast-ui.react-editor/releases/latest)
[![github version](https://img.shields.io/github/release/nhn/toast-ui.react-editor.svg)](https://github.com/nhn/toast-ui.react-editor/releases/latest)
[![npm version](https://img.shields.io/npm/v/@toast-ui/react-editor.svg)](https://www.npmjs.com/package/@toast-ui/react-editor)
[![license](https://img.shields.io/github/license/nhnent/toast-ui.react-editor.svg)](https://github.com/nhnent/toast-ui.react-editor/blob/master/LICENSE)
[![PRs welcome](https://img.shields.io/badge/PRs-welcome-ff69b4.svg)](https://github.com/nhnent/toast-ui.react-editor/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
[![code with hearth by NHN Entertainment](https://img.shields.io/badge/%3C%2F%3E%20with%20%E2%99%A5%20by-NHN%20Entertainment-ff1414.svg)](https://github.com/nhnent)
[![license](https://img.shields.io/github/license/nhn/toast-ui.react-editor.svg)](https://github.com/nhn/toast-ui.react-editor/blob/master/LICENSE)
[![PRs welcome](https://img.shields.io/badge/PRs-welcome-ff69b4.svg)](https://github.com/nhn/toast-ui.react-editor/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
[![code with hearth by NHN](https://img.shields.io/badge/%3C%2F%3E%20with%20%E2%99%A5%20by-NHN-ff1414.svg)](https://github.com/nhn)

@@ -62,3 +62,3 @@ ## 🚩 Table of Contents

import 'tui-editor/dist/tui-editor-contents.min.css';
import Editor from '@toast-ui/react-editor'
import { Editor } from '@toast-ui/react-editor'
```

@@ -77,3 +77,3 @@

[All the options of the TOAST UI Editor](https://nhnent.github.io/tui.editor/api/latest/ToastUIEditor.html#ToastUIEditor) are supported in the form of props.
[All the options of the TOAST UI Editor](https://nhn.github.io/tui.editor/api/latest/ToastUIEditor.html#ToastUIEditor) are supported in the form of props.

@@ -108,3 +108,3 @@ ```js

For using [instance methods of TOAST UI Editor](https://nhnent.github.io/tui.editor/api/latest/ToastUIEditor.html#.defineExtension), first thing to do is creating Refs of wrapper component using [`createRef()`](https://reactjs.org/docs/refs-and-the-dom.html#creating-refs). But the wrapper component does not provide a way to call instance methods of TOAST UI Editor directly. Instead, you can call `getInstance()` method of the wrapper component to get the instance, and call the methods on it.
For using [instance methods of TOAST UI Editor](https://nhn.github.io/tui.editor/api/latest/ToastUIEditor.html#.defineExtension), first thing to do is creating Refs of wrapper component using [`createRef()`](https://reactjs.org/docs/refs-and-the-dom.html#creating-refs). But the wrapper component does not provide a way to call instance methods of TOAST UI Editor directly. Instead, you can call `getInstance()` method of the wrapper component to get the instance, and call the methods on it.

@@ -166,7 +166,7 @@ ```js

### Events
[All the events of TOAST UI Editor](https://nhnent.github.io/tui.editor/api/latest/ToastUIEditor.html#focus) are supported in the form of `on[EventName]` props. The first letter of each event name should be capitalized. For example, for using `focus` event you can use `onFocus` prop like the example below.
[All the events of TOAST UI Editor](https://nhn.github.io/tui.editor/api/latest/ToastUIEditor.html#focus) are supported in the form of `on[EventName]` props. The first letter of each event name should be capitalized. For example, for using `focus` event you can use `onFocus` prop like the example below.
```js
class MyComponent extends React.Component {
handleFoucs = () => {
handleFocus = () => {
console.log('focus!!');

@@ -184,3 +184,3 @@ }

ref={this.editorRef}
onFocus={this.handleFoucs}
onFocus={this.handleFocus}
/>

@@ -221,7 +221,7 @@ );

## 💬 Contributing
* [Code of Conduct](https://github.com/nhnent/toast-ui.react-editor/blob/master/CODE_OF_CONDUCT.md)
* [Contributing guideline](https://github.com/nhnent/toast-ui.react-editor/blob/master/CONTRIBUTING.md)
* [Commit convention](https://github.com/nhnent/toast-ui.react-editor/blob/master/docs/COMMIT_MESSAGE_CONVENTION.md)
* [Code of Conduct](https://github.com/nhn/toast-ui.react-editor/blob/master/CODE_OF_CONDUCT.md)
* [Contributing guideline](https://github.com/nhn/toast-ui.react-editor/blob/master/CONTRIBUTING.md)
* [Commit convention](https://github.com/nhn/toast-ui.react-editor/blob/master/docs/COMMIT_MESSAGE_CONVENTION.md)
## 📜 License
This software is licensed under the [MIT](./LICENSE) © [NHN Ent.](https://github.com/nhnent)
This software is licensed under the [MIT](./LICENSE) © [NHN.](https://github.com/nhn)

@@ -16,8 +16,12 @@ import React from 'react';

bindEventHandlers() {
Object.keys(this.props)
bindEventHandlers(props, prevProps) {
Object.keys(props)
.filter((key) => /on[A-Z][a-zA-Z]+/.test(key))
.forEach((key) => {
const eventName = key[2].toLowerCase() + key.slice(3);
this.editorInst.on(eventName, this.props[key]);
// For <Editor onFocus={condition ? onFocus1 : onFocus2} />
if(prevProps && prevProps[key] !== props[key]) {
this.editorInst.off(eventName);
}
this.editorInst.on(eventName, props[key]);
});

@@ -32,3 +36,3 @@ }

this.bindEventHandlers();
this.bindEventHandlers(this.props);
}

@@ -48,2 +52,4 @@

this.bindEventHandlers(nextProps, this.props);
return false;

@@ -50,0 +56,0 @@ }

@@ -17,3 +17,3 @@ import React from 'react';

bindEventHandlers() {
bindEventHandlers(props, prevProps) {
Object.keys(this.props)

@@ -23,3 +23,7 @@ .filter((key) => /on[A-Z][a-zA-Z]+/.test(key))

const eventName = key[2].toLowerCase() + key.slice(3);
this.viewerInst.on(eventName, this.props[key]);
// For <Viewer onFocus={condition ? onFocus1 : onFocus2} />
if(prevProps && prevProps[key] !== props[key]) {
this.viewerInst.off(eventName);
}
this.viewerInst.on(eventName, props[key]);
});

@@ -34,3 +38,3 @@ }

this.bindEventHandlers();
this.bindEventHandlers(this.props);
}

@@ -46,2 +50,4 @@

this.bindEventHandlers(nextProps, this.props);
return false;

@@ -48,0 +54,0 @@ }

@@ -25,3 +25,3 @@ export const basicViewerDummy = {

'',
'[link](https://nhnent.github.io/tui.editor/)',
'[link](https://nhn.github.io/tui.editor/)',
'> block quote',

@@ -28,0 +28,0 @@ '---',

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc