{"id":13422165,"url":"https://github.com/RD17/react-trumbowyg","last_synced_at":"2025-03-15T10:31:43.562Z","repository":{"id":46179333,"uuid":"73309402","full_name":"RD17/react-trumbowyg","owner":"RD17","description":"React wrapper for lightweight WYSIWYG editor Trumbowyg","archived":false,"fork":false,"pushed_at":"2021-11-09T07:58:03.000Z","size":466,"stargazers_count":147,"open_issues_count":18,"forks_count":21,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-01-13T02:52:13.228Z","etag":null,"topics":["editorjs","react","react-components","trumbowyg","trumbowyg-wysiwyg"],"latest_commit_sha":null,"homepage":"","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/RD17.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":"2016-11-09T18:18:57.000Z","updated_at":"2025-01-06T15:39:40.000Z","dependencies_parsed_at":"2022-09-08T10:13:45.901Z","dependency_job_id":null,"html_url":"https://github.com/RD17/react-trumbowyg","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RD17%2Freact-trumbowyg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RD17%2Freact-trumbowyg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RD17%2Freact-trumbowyg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RD17%2Freact-trumbowyg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RD17","download_url":"https://codeload.github.com/RD17/react-trumbowyg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243512307,"owners_count":20302719,"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","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":["editorjs","react","react-components","trumbowyg","trumbowyg-wysiwyg"],"created_at":"2024-07-30T23:00:38.393Z","updated_at":"2025-03-15T10:31:43.133Z","avatar_url":"https://github.com/RD17.png","language":"JavaScript","funding_links":[],"categories":["UI Components","Demos","\u003csummary\u003eUI Components\u003c/summary\u003e"],"sub_categories":["Form Components"],"readme":"# React-Trumbowyg\n\n[![npm version](https://badge.fury.io/js/react-trumbowyg.svg)](https://badge.fury.io/js/react-trumbowyg)\n\nReact wrapper for [trumbowyg](https://alex-d.github.io/Trumbowyg/ \"trumbowyg\").\n\nIf you :heart: library, please star it and upvote it on [awesome-react-components](http://devarchy.com/react-components)\n\n![Demo](demo.gif)\n\n# Table of contents\n\n- [How do I add this to my project?](#how-do-i-add-this-to-my-project)\n- [Dependencies](#dependencies)\n- [Starter Guide](#starter-guide)\n- [Examples](#examples)\n- [Available Properties and Event Handlers](#available-properties-and-event-handlers)\n  - [Trumbowyg properties](#trumbowyg-properties)\n  - [Self properties](#self-properties)\n  - [Event handlers](#event-handlers)\n- [Plugins](#plugins)\n- [Contributors](#contributors)\n- [License](#license)\n\n# How do I add this to my project?\n\nInstall react-trumbowyg via npm:\n```\n\u003e npm i react-trumbowyg --save\n```\n\nor build from source:\n\n```\n\u003e npm install \u0026\u0026 npm build\n```\n\n# Dependencies\n\nReact-Trumbowyg depends on Trymbowyg only. \n\n# Starter Guide\n\nTrumbowyg requires some setup procedures before you can use it. \n\nFirst of all, you need to install jQuery  \n\n```\n\u003e npm i jquery --save\n``` \n\nIf you are using webpack or another build system you need to expose jQuery to window as global variable.\n\n__Webpack example:__\n  \n```\nnew webpack.ProvidePlugin({\n    $: \"jquery\",\n    jQuery: \"jquery\"\n}) \n```\n\nSecondly, you need to add Trymbowyg styles\n\n```\nimport 'react-trumbowyg/dist/trumbowyg.min.css'\n```\n\nFinally, import React-Trymbowyg component\n\n```\nimport Trumbowyg from 'react-trumbowyg'\n\n\u003cTrumbowyg id='react-trumbowyg'/\u003e\n```\n\nThat's it!\n\n# Examples\n\n* [examples-vanilla-js](https://github.com/RD17/react-trumbowyg/tree/master/examples-vanilla-js) - vanilla js example\n* [examples-es6](https://github.com/RD17/react-trumbowyg/tree/master/examples-es6) - example with Babel and Webpack\n\n# Available Properties and Event Handlers\n\nReact-Trumbowyg expose all properties of Trumbowyg, and adds self as well\n\n## Trumbowyg properties\n\n|                                           Trumbowyg Prop                                                                |    Default    |        Type         |\n|:------------------------------------------------------------------------------------------------------------------------|:--------------|:--------------------|\n| [id](#id)                                                                                                               |               | ```String```        |\n| [data](#data)                                                                                                           |               | ```String```        |\n| [placeholder](#placeholder)                                                                                             |               | ```String```        |\n| [buttons](https://alex-d.github.io/Trumbowyg/documentation.html#button-pane \"buttons\")                                  |               | ```Array\u003cString\u003e``` |\n| [semantic](https://alex-d.github.io/Trumbowyg/documentation.html#semantic \"semantic\")                                   | ```true```    | ```Bool```          |\n| [resetCss](https://alex-d.github.io/Trumbowyg/documentation.html#reset-css \"resetCss\")                                  | ```false```   | ```Bool```          |\n| [removeformatPasted](https://alex-d.github.io/Trumbowyg/documentation.html#remove-format-pasted \"removeformatPasted\")   | ```false```   | ```Bool```          |\n| [autogrow](https://alex-d.github.io/Trumbowyg/documentation.html#auto-adjust-height \"autogrow\")                         | ```false```   | ```Bool```          |\n| [disabled](https://alex-d.github.io/Trumbowyg/documentation.html#enable-disable-edition \"disabled\")                     | ```false```   | ```Bool```          |\n\n## Self properties\n\n * shouldUseSvgIcons:**boolean** - if true, displays SVG icons, else show only text. (Default: true)\n * svgIconsPath:**string** - path to SVG icons file. SVG file will be loaded with AJAX request. (Default: '') \n * shouldInjectSvgIcons: **boolean** - React-Trumbowyg can inject SVG icons to body, so you can avoid loading it. If this prop is false, you should specify the path to your own svg icons in ```svgIconsPath``` prop. (Default: true)\n\n## Event handlers\n * onFocus - Event handler when the focus is on editor\n * onBlur - Blur on editor \n * onInit - Editor is initialized\n * onChange - Change in editor\n * onResize - Resize the editor on autogrow\n * onPaste - Paste something in the editor\n * onOpenFullScreen - Switch to fullscreen mode\n * onCloseFullScreen - Leave editor's fullscreen mode\n * onClose - Close the editor\n\n# Plugins\n\nThanks @ashleydb, for such a nice example:\n\n\u003e It does work today. It may not look pretty, but it works. For example, I needed to add the tables plugin:\n\n```javascript\n\nimport React from 'react';\n\nimport Trumbowyg from 'react-trumbowyg';\n// ADD THIS LINE. ADJUST THE BEGINNING OF THE PATH AS NEEDED FOR YOUR PROJECT\nimport '../../node_modules/trumbowyg/dist/plugins/table/trumbowyg.table';\n\nexport default class MyComponent extends React.Component {\n    constructor(props) {\n        super(props);\n    }\n    render() {\n        return (\n            \u003cdiv\u003e\n                    \u003cTrumbowyg id='react-trumbowyg'\n                        buttons={\n                            [\n                                ['viewHTML'],\n                                ['formatting'],\n                                'btnGrp-semantic',\n                                ['link'],\n                                ['insertImage'],\n                                'btnGrp-justify',\n                                'btnGrp-lists',\n                                ['table'], // I ADDED THIS FOR THE TABLE PLUGIN BUTTON\n                                ['fullscreen']\n                            ]\n                        }\n                        data={this.props.someData}\n                        placeholder='Type your text!'\n                        onChange={this.props.someCallback}\n                        ref=\"trumbowyg\"\n                    /\u003e\n            \u003c/div\u003e\n        );\n    }\n}\n```\n\n# Example 1\n\nAdd an upload front-end allowing users to select an image, upload it with progress bar and then insert the uploaded image in the editor:\n\n```javascript\nimport React from 'react'\nimport Trumbowyg from 'react-trumbowyg'\nimport 'trumbowyg/dist/plugins/upload/trumbowyg.upload.min.js'\n\nexport default class MyComponent extends React.Component {\n\trender() {\n\t\treturn (\n\t\t\t\u003cdiv\u003e\n\t\t\t\t\u003cTrumbowyg\n\t\t\t\t\tid='react-trumbowyg'\n\t\t\t\t\tbuttons={\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t['upload']\n\t\t\t\t\t\t]\n\t\t\t\t\t}\n\t\t\t\t\tref=\"trumbowyg\"\n\t\t\t\t\tplugins={\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tupload: {\n\t\t\t\t\t\t\t\tserverPath: 'https://api.imgur.com/3/image',\n\t\t\t\t\t\t\t\tfileFieldName: 'image',\n\t\t\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t\t\t'Authorization': 'Client-ID ******'\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\turlPropertyName: 'data.link'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t/\u003e\n\t\t\t\u003c/div\u003e\n\t\t)\n\t}\n}\n```\n\n\n# Contributors\n* [Ilya P](http://sochix.ru) - Trumbowyg wrapper component\n* [Daniil Nazarov](https://github.com/eezzyybreezzyy) - examples \n\n## License\n\nThe MIT License\n\nCopyright (c) 2016 RD17 http://rdseventeen.com/\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRD17%2Freact-trumbowyg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRD17%2Freact-trumbowyg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRD17%2Freact-trumbowyg/lists"}