{"id":15622435,"url":"https://github.com/spohlenz/tinymce-rails","last_synced_at":"2025-05-14T08:09:47.494Z","repository":{"id":39351751,"uuid":"2140555","full_name":"spohlenz/tinymce-rails","owner":"spohlenz","description":"Integration of TinyMCE with the Rails asset pipeline","archived":false,"fork":false,"pushed_at":"2025-04-10T22:50:13.000Z","size":31448,"stargazers_count":825,"open_issues_count":74,"forks_count":264,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-05-11T18:06:09.061Z","etag":null,"topics":["rails","ruby","tinymce"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spohlenz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-08-02T04:01:50.000Z","updated_at":"2025-05-07T07:23:20.000Z","dependencies_parsed_at":"2024-01-03T02:24:39.386Z","dependency_job_id":"e0e2c566-ba87-4d6b-85cb-47226e8f417f","html_url":"https://github.com/spohlenz/tinymce-rails","commit_stats":{"total_commits":450,"total_committers":26,"mean_commits":"17.307692307692307","dds":0.06666666666666665,"last_synced_commit":"3125aab7b8875167ea07dd25f6797e4dcb7008fa"},"previous_names":[],"tags_count":183,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spohlenz%2Ftinymce-rails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spohlenz%2Ftinymce-rails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spohlenz%2Ftinymce-rails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spohlenz%2Ftinymce-rails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spohlenz","download_url":"https://codeload.github.com/spohlenz/tinymce-rails/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254101559,"owners_count":22014908,"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":["rails","ruby","tinymce"],"created_at":"2024-10-03T09:53:59.735Z","updated_at":"2025-05-14T08:09:42.485Z","avatar_url":"https://github.com/spohlenz.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Gems"],"sub_categories":["Articles"],"readme":"Rails Integration for TinyMCE\n=============================\n\nThe `tinymce-rails` gem integrates the [TinyMCE](https://www.tiny.cloud/) editor with the Rails asset pipeline.\n\nThis gem is compatible with Rails 5.1 and higher.\n\nThis is the branch for **TinyMCE 7**.\u003cbr /\u003e\nPlease see alternate branches for [TinyMCE 6](https://github.com/spohlenz/tinymce-rails/tree/tinymce-6), [TinyMCE 5](https://github.com/spohlenz/tinymce-rails/tree/tinymce-5), [TinyMCE 4](https://github.com/spohlenz/tinymce-rails/tree/tinymce-4) \u0026 [TinyMCE 3.5.x](https://github.com/spohlenz/tinymce-rails/tree/tinymce-3).\n\n\u003e [!IMPORTANT]\n\u003e Please note that as of version 7, TinyMCE (and therefore this project) is now licensed under the GPL.\n\n[![Latest Gem Version](https://img.shields.io/gem/v/tinymce-rails)](https://rubygems.org/gems/tinymce-rails)\n[![Upstream Version](https://img.shields.io/npm/v/tinymce?label=upstream\u0026color=%23335dff)](https://www.tiny.cloud/docs/tinymce/latest/release-notes/)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/spohlenz/tinymce-rails/rspec.yml)](https://github.com/spohlenz/tinymce-rails/actions)\n\n\nInstructions\n------------\n\n**1. Add `tinymce-rails` to your Gemfile**\n\n```ruby\ngem 'tinymce-rails'\n```\n\nBe sure to add to the global group, not the `assets` group. Then run `bundle install`.\n\n\n**2. Create a `config/tinymce.yml` file with your global configuration options:**\n\n```yml\ntoolbar:\n  - styleselect | bold italic | undo redo\n  - image | link\nplugins:\n  - image\n  - link\n```\n\nThe Rails server no longer needs to be restarted when this file is updated in development mode.\n\nTo define multiple configuration sets, follow this syntax (a default configuration must be specified):\n\n```yml\ndefault: \u0026default\n  plugins:\n    - image\n    - link\n\nalternate:\n  \u003c\u003c: *default\n  toolbar: styleselect | bold italic | undo redo | table\n  plugins:\n    - table\n```\n\nSee the [TinyMCE 7 Documentation](https://www.tiny.cloud/docs/tinymce/7/) for a full list of configuration options.\n\n\n**3. Include the TinyMCE assets**\n\nUse *one* of the following options to include TinyMCE assets.\n\n(1) Add to your application.js (Sprockets only):\n\n```js\n//= require tinymce\n```\n\nor (2) add the script tag to your layout using the `tinymce_assets` helper:\n\n```erb\n\u003c%= tinymce_assets data: { turbo_track: \"reload\" } %\u003e\n#=\u003e \u003cscript type=\"text/javascript\" src=\"/assets/tinymce.js\" data-turbo-track=\"reload\"\u003e\n```\n\nWhen using Propshaft, the `tinymce_assets` helper adds multiple script tags including the pre-init code (available via the `tinymce_preinit` helper), as well as `tinymce/tinymce.js` and `tinymce/rails.js`. You may prefer to selectively include these manually depending on your requirements.\n\nFor Sprockets, these are bundled together into one script tag.\n\n\n**4. Initialize TinyMCE**\n\nFor each textarea that you want to use with TinyMCE, add the \"tinymce\" class and ensure it has a unique ID:\n\n```erb\n\u003c%= text_area_tag :content, \"\", class: \"tinymce\", rows: 40, cols: 120 %\u003e\n```\n\nor if you are using Rails' form builders:\n\n```erb\n\u003c%= f.text_area :content, class: \"tinymce\", rows: 40, cols: 120 %\u003e\n```\n\nThen invoke the `tinymce` helper to initialize TinyMCE:\n\n```erb\n\u003c%= tinymce %\u003e\n```\n\nCustom options can be passed to `tinymce` to override the global options specified in `config/tinymce.yml`:\n\n```erb\n\u003c%= tinymce theme: \"simple\", language: \"de\", plugins: [\"wordcount\", \"paste\"] %\u003e\n```\n\nAlternate configurations defined in 'config/tinymce.yml' can be used with:\n\n```erb\n\u003c%= tinymce :alternate %\u003e\n```\n\n\nLanguage Packs\n--------------\n\nSee the [tinymce-rails-langs](https://github.com/spohlenz/tinymce-rails-langs) gem for additional language packs for TinyMCE.\n\n\nManual Initialization\n---------------------\n\nUsing the `tinymce` helper and global configuration file is entirely optional. The `tinymce.init` JS function can be invoked manually if desired.\n\n```erb\n\u003c%= text_area_tag :editor, \"\", rows: 40, cols: 120 %\u003e\n\n\u003cscript type=\"text/javascript\"\u003e\n  tinymce.init({\n    selector: 'textarea.editor'\n  });\n\u003c/script\u003e\n```\n\n\nAsset Compilation\n-----------------\n\nSince TinyMCE loads most of its files dynamically, some workarounds are required to ensure that the TinyMCE asset files are accessible using non-digested filenames.\n\nAs of tinymce-rails 3.5.11, 4.1.10 and 4.2.1, two alternative asset installation methods are available, which can be changed by setting `config.tinymce.install` within your `config/application.rb` file. These methods are called when you run `rake asset:precompile` (via `Rake::Task#enhance`) after the regular application assets are compiled.\n\nThe default method (as of 4.5.2), `compile`, adds the TinyMCE paths to the Sprockets precompilation paths and then creates symlinks from the non-digested filenames to their digested versions.\n\n```ruby\nconfig.tinymce.install = :compile\n```\n\nIf you experience issues with the `compile` method, you may wish to use the `copy` method instead, which copies the TinyMCE assets directly into `public/assets` and appends the file information into the asset manifest. The `copy_no_preserve` method is also available of you do not wish to or cannot preserve file modes on your filesystem.\n\n```ruby\nconfig.tinymce.install = :copy\n```\n\nIf you are including TinyMCE via `application.js` or using the `tinymce_assets` helper, you do not need to manually add the scripts to the Sprockets precompile paths.\n\n\nCustom Plugins \u0026 Skins\n----------------------\n\nTo use custom plugins or skins, simply add the files to your asset load path so that they are locatable at a path beneath `tinymce/plugins/` or `tinymce/skins/`.\n\nFor example, a plugin called `mycustomplugin` could have its main JS file at `app/assets/javascripts/tinymce/plugins/mycustomplugin/plugin.js`.\n\nYou should also ensure that your custom paths are added to the asset precompile paths.\n\n\nUsing tinymce-rails as an Engine Dependency\n-------------------------------------------\n\nEnsure that you explicitly require `tinymce-rails` within your engine file. Including tinymce-rails as a dependency in your gemspec is not enough.\n\n\nUpdating\n--------\n\nWhen new versions of TinyMCE are released, simply update the `tinymce-rails` gem to the latest version. There is no need to run any extra rake tasks (apart from `rake assets:precompile`).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspohlenz%2Ftinymce-rails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspohlenz%2Ftinymce-rails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspohlenz%2Ftinymce-rails/lists"}