{"id":19853000,"url":"https://github.com/ship-components/ship-components-texteditor","last_synced_at":"2025-10-11T20:32:23.436Z","repository":{"id":33995300,"uuid":"37748866","full_name":"ship-components/ship-components-texteditor","owner":"ship-components","description":"Rich Text Editor for React","archived":false,"fork":false,"pushed_at":"2020-12-02T04:23:14.000Z","size":730,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2025-10-01T11:34:52.402Z","etag":null,"topics":["babel","coverage","draft-js","javascript","javascript-library","jsx","loader","react","ship-components-texteditor","texteditor","webpack"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/ship-components-texteditor","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ship-components.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-19T22:26:51.000Z","updated_at":"2020-12-02T04:23:16.000Z","dependencies_parsed_at":"2022-07-13T22:43:05.123Z","dependency_job_id":null,"html_url":"https://github.com/ship-components/ship-components-texteditor","commit_stats":null,"previous_names":["isuttell/react-texteditor"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/ship-components/ship-components-texteditor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ship-components%2Fship-components-texteditor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ship-components%2Fship-components-texteditor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ship-components%2Fship-components-texteditor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ship-components%2Fship-components-texteditor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ship-components","download_url":"https://codeload.github.com/ship-components/ship-components-texteditor/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ship-components%2Fship-components-texteditor/sbom","scorecard":{"id":496474,"data":{"date":"2025-08-11","repo":{"name":"github.com/ship-components/ship-components-texteditor","commit":"974f7b944cdc6543fb4e1cc83ffafbbc41f51332"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.2,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":5,"reason":"Found 4/7 approved changesets -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 29 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T20:32:05.404Z","repository_id":33995300,"created_at":"2025-08-19T20:32:05.404Z","updated_at":"2025-08-19T20:32:05.404Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006108,"owners_count":26084026,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["babel","coverage","draft-js","javascript","javascript-library","jsx","loader","react","ship-components-texteditor","texteditor","webpack"],"created_at":"2024-11-12T14:05:09.599Z","updated_at":"2025-10-11T20:32:23.421Z","avatar_url":"https://github.com/ship-components.png","language":"JavaScript","readme":"# ship-components-texteditor\n[React](http://facebook.github.io/react/) rich text editor built on [draft-js](https://facebook.github.io/draft-js/). Exports a commonjs module that can be used with [webpack](http://webpack.github.io/). Source is in ES6 and is compiled down to ES5 using [Babel](https://babeljs.io/).\n\n[![npm](https://img.shields.io/npm/v/ship-components-texteditor.svg?maxAge=2592000)](https://www.npmjs.com/package/ship-components-texteditor)\n[![Build Status](http://img.shields.io/travis/ship-components/ship-components-texteditor/master.svg?style=flat)](https://travis-ci.org/ship-components/ship-components-texteditor)\n[![Coverage](http://img.shields.io/coveralls/ship-components/ship-components-texteditor.svg?style=flat)](https://coveralls.io/github/ship-components/ship-components-texteditor?branch=master)\n[![dependencies](https://img.shields.io/david/ship-components/ship-components-texteditor.svg?style=flat)](https://david-dm.org/ship-components/ship-components-texteditor)\n[![devDependencies](https://img.shields.io/david/dev/ship-components/ship-components-texteditor.svg?style=flat)](https://david-dm.org/ship-components/ship-components-texteditor?type=dev)\n\n## Usage\n\n### ES6/JSX (Recommended)\nThe component is written using ES6/JSX therefore Babel is recommended to use it. The below example is based on using [webpack](http://webpack.github.io/) and [babel-loader](https://github.com/babel/babel-loader).\n```js\nimport React from 'react';\nimport TextEditor from 'ship-components-texteditor';\n\nclass Examples extends React.Component {\n\n  constructor(props) {\n    super(props);\n    this.state ={\n      basic: '\u003cp\u003eThis is \u003cb\u003esome \u003c/b\u003e\u003cu\u003e\u003cb\u003esample\u003c/b\u003e\u003c/u\u003e \u003ci\u003e\u003cb\u003etext\u003c/b\u003e\u003c/i\u003e\u003c/p\u003e'\n    };\n\n    this.handleChange = this.handleChange.bind(this);\n  }\n\n  \u003c!-- Cause the text editor to update its internal state --\u003e\n  forceUpdateState() {\n    return this.refs.editor.forceUpdateState();\n  }\n\n  handleChange(key, event) {\n    this.setState({\n      [key]: event.target.value\n    });\n  }\n\n  render() {\n    return (\n      \u003cdiv\u003e\n        \u003ch1\u003e{'\u003cTextEditor /\u003e Examples'}\u003c/h1\u003e\n        \u003cdiv className='example-group'\u003e\n          \u003ch2\u003eBasic (HTML)\u003c/h2\u003e\n          \u003cTextEditor\n            ref='editor'\n            editable\n            type='html'\n            inlineStyles={new Immutable.Set(['BOLD', 'UNDERLINE', 'ITALIC'])}\n            onChange={this.handleChange.bind(this, 'basic')}\n            value={this.state.basic}\n          /\u003e\n        \u003c/div\u003e\n      \u003c/div\u003e\n    );\n  }\n}\n\n```\n\n#### Note (Using forceUpdateState)\nThe function needs to be called in order to update the TextEditor internal state. Add the following code to the parent class to update TextEditor when the text value is changed. You may also need to implement the onFocus and / or onBlur methods to prevent the TextEditor from updating the internal state while user is typing which will cause double typing or cursur jumps around.\n```js\nforceUpdateState() {\n    if (this.refs.editor \u0026\u0026 typeof this.refs.editor.forceUpdateState === 'function') {\n      this.refs.editor.forceUpdateState();\n    } else if (process.env.NODE_ENV !== 'production') {\n      console.warn('this.refs.editor.forceUpdateState is not a function');\n    }\n  }\n\n  ```\n\n## Examples and Development\nExamples can be found in the `examples/` folder. A development server can be run with:\n\n```shell\n$ npm install\n$ npm start\n```\n\nThis will live reload any changes you make and serve them at http://localhost:8080.\n\n### Webpack Configuration\nThis module is designed to be used with webpack but requires a few loaders if you are pulling the source into another project.\n\n```shell\n$ npm install webpack babel-loader css-loader style-loader postcss-loader extract-text-webpack-plugin postcss-nested postcss-color-hex-alpha postcss-color-function postcss-calc postcss-simple-vars autoprefixer --save-dev\n```\n\nBelow are is a sample of how to setup the loaders:\n\n```js\n/**\n * Relevant Webpack Configuration\n */\n{\n  [...]\n  module: {\n    loaders: [\n      // Setup support for ES6\n      {\n        test: /\\.(jsx?|es6)$/,\n        exclude: /node_modules/,\n        loader: 'babel'\n      },\n      // ES6/JSX for external ship-components modules\n      {\n        test: /\\.(jsx?|es6)$/,\n        include: [\n          /ship-components\\-.*\\/src/\n        ],\n        loader: 'babel'\n      },\n      // Loaded for fonts and images\n      {\n       test: /\\.(png|svg|jpeg|jpg|ttf|eot|woff)/,\n       loader: 'file?name=[path][name].[ext]'\n      },\n      // Setup support for CSS Modules\n      {\n        test: /\\.css$/,\n        loader: ExtractTextPlugin.extract('style-loader', 'css-loader?modules\u0026importLoaders=1\u0026localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader')\n      }\n    ]\n  },\n  plugins: [\n    // Extract the css and put it in one file. Path is relative to output path\n    new ExtractTextPlugin('../css/[name].css', { allChunks: true })\n  ],\n  // CSS Modules\n  postcss: [\n    require('postcss-nested'),\n    require('postcss-color-hex-alpha'),\n    require('postcss-color-function'),\n    require('postcss-calc'),\n    require('autoprefixer')\n  ],\n  [...]\n}\n```\n\n## Tests\n1. `npm install`\n2. `npm test`\n\n## History\n* 2.2.3 - Fixed errors in specific scenarios when replacing text with entities. Plus, minor linting fixes.\n* 2.2.2 - Fixed convert to text conversion when certain entities are present.\n* 2.2.1 - Reverted original example text, improved convert to text conversion.\n* 2.2.0 - Added support for custom entities (suggestion, mention, and hashtag)\n* 2.1.10 - Continued possible onChange loop bug fixes for 2.1.8 and 2.1.9\n* 2.1.9 - Fixes breaking bug in 2.1.8 happening when certain links in text are converted.\n* 2.1.8 - Optimized link recognizing to call the onChange callback only if neccessary.\n* 2.1.7 - Performance improvements, and fix for toolbar buttons not toggling without a selection.\n* 2.1.6 - Inline converted links can be edited via the link editing modal.\n* 2.1.5 - Adding links now works without requiring a selection, and malformatted URLs entered in link modal will be better parsed\n* 2.1.4 - Fixes the bug where editor loses focus when a toolbar button is clicked\n* 2.1.3 - Modals will not be not part of the texteditor render method\n* 2.1.2 - Added basic convert to hyperlink functionality\n* 2.0.0 - Upgrade to React 16\n* 1.0.2 - Update to use postcss-calc 6\n* 1.0.1 - Update to use latest draft-js and draft-convert (for React 16 compatibility)\n* 1.0.0 - Update to use prop-types (for React 16 compatibility)\n* 0.4.0 - Babel preset update\n* 0.3.4 - Added more unit tests\n* 0.3.3 - Adds the JSON loader to parse the json files (Bug fix).\n* 0.3.2 - Fixes the bug where adding line breaks (br tag) was getting removed.\n* 0.3.0 - Adds Tests, Travis CI and coverage\n* 0.2.4 - Adds an option to pass in a prop to only show inline style buttons or no buttons.\n* 0.2.3 - Added an option to remove HTML tags from string when passing prop type='text'\n* 0.2.2 - Renamed method to forceUpdateState to avoid name conflict\n* 0.2.1 - Fixed devDeps -\u003e deps issue\n* 0.2.0 - Switched to draft-js for core engine, added inline link support, added more styles\n* 0.1.0 - Initial\n\n## License\nThe MIT License (MIT)\n\nCopyright (c) 2016 SHIP\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fship-components%2Fship-components-texteditor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fship-components%2Fship-components-texteditor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fship-components%2Fship-components-texteditor/lists"}