Skip to content

Repository files navigation

This gem/plugin provides for the installation and utilization of TinyMCE in Ruby on Rails applications of version 2.3.5 and onward.

TinyMCE is a WYSIWYG HTML editing component released under the GNU Lesser General Public License 2.1 (LGPL 2.1) by Moxiecode Systems (tinymce.moxiecode.com/).

Installing TinyMCE for Rails takes no more than a few minutes to install.

The recommended installation method for getting tiny_mce working in your application is to use the gem version. To do so, open the console and run:

[sudo] gem install tiny_mce

Then add this to config/environment.rb of your Rails application:

config.gem'tiny_mce'

Alternatively, you can install it as a plugin. To do so, open a console, and in the root of you Rails application, install the plugin by running one of the following (depending on the method you use to import plugins):

  • script/plugin install git://github.com/kete/tiny_mce.git

  • piston import git://github.com/kete/tiny_mce.git vendor/plugins/tiny_mce

  • git submodule add git://github.com/kete/tiny_mce.git vendor/plugins/tiny_mce

  • Download the latest files ( github.com/kete/tiny_mce/tarball/master ) and extract to vendor/plugins/tiny_mce

Add the following to the top of the controller of the page you want to add TinyMCE to.

uses_tiny_mce

Then append the following to the text area you want to transform into a TinyMCE editor. You can change the name of the class you want to use by editing the ‘editor_selector’ param in the controller code options.

:class=>"mceEditor"

Lastly, add the following line(s) to the <head> element of your application view:

<%= include_tiny_mce_if_needed %>

Now you’re all set! Start your server. The gem/plugin will automatically copy the sources to the public javascripts directory when the server is started.

There are several ways to configure the plugin to get the desirable effect you’re looking for. The following ways can be combined to create complex tiny mce setups

A load order is present so that you have finer grained control over what shows up where. The load order currently looks like this. The later ones receive more power, that is, the overwrite similar settings in previous configurations.

  1. The default tiny_mce plugin settings. Sets it to work on textareas with class of mceEditor, with the english advanced theme.

  2. config/tiny_mce.yml if present. You set your own options here, used across all editors on the site.

  3. uses_tiny_mce declaration. You set you own options here, used across all editors in the controller.

  4. include_tiny_mce_if_needed declaration. You set your own options here, used across all editors contained within that layout.

Below, I’ll cover how to use #2, and #3, which are the most likely ones you’ll want to use.

If you have a set of default options that is used throughout all editors in your application, you might want to make them global. You can do this by putting your settings into config/tiny_mce.yml. If the file exists, the tiny_mce plugin will parse the options in it first.

theme: advanced
plugins:
- table
- fullscreen

You can change the theme, order/choice of buttons, selectors Id, plugins, and many more by passing an :options hash to the uses_tiny_mce declaration.

The options hash can contain any number of settings available in lib/tiny_mce/valid_tinymce_options.yml (a copy of the settings available per version).

If an option is misspelled, invalid, or deprecated (no longer in TinyMCE), when you go to a page containing your editor, you will receive an Exception, which must be dealt with before continuing.

You can read about all these options at tinymce.moxiecode.com/documentation.php

uses_tiny_mce:options=> {
:theme=>'advanced',
:theme_advanced_resizing=>true,
:theme_advanced_resize_horizontal=>false,
:plugins=>%w{ table fullscreen }
}

If, like most applications, you only need the editor on the new, create, edit, and update pages, then tell the uses_tiny_mce declaration this, so it doesn’t load up all the files unnecessarily.

The declaration accepts any number of default parameters a normal controller filter would.

uses_tiny_mce:only=> [:new, :create, :edit, :update]

Sometimes, when you need complex arrays of data for plugins or such, the plugin helpers aren’t complex enough to do what you need. But you can always fall back to supplying your own options. You can this by passing a raw javascript (no <script> tags) to the uses_tiny_mce declaration. Consider the following example for the template plugin.

uses_tiny_mce:raw_options=>"template_templates : [ {
title : 'Editor Details',
src : 'editor_details.htm',
description : 'Adds Editors Name and Staff ID'
} ]"

TinyMCE has a range of convenience methods for loading TinyMCE. Besides the uses_tiny_mce shown above, they include:

using_tiny_mce?
Check whether the uses_tiny_mce declaration has been made in the current controller
raw_tiny_mce_init
Creates a string of javascript formed from the options declared to uses_tiny_mce (is not wrapped in a JS tag though, use tiny_mce_init for that)
tiny_mce_init
Creates a javascript tag formed from the options declared to uses_tiny_mce (executes whether uses_tiny_mce was declared or not)
tiny_mce_init_if_needed
Creates a javascript tag formed from the options declared to uses_tiny_mce (executes only when uses_tiny_mce has been declared)
include_tiny_mce_js
Includes the TinyMCE core javascript file, must be declared before tiny_mce_init (executes whether uses_tiny_mce was declared or not)
include_tiny_mce_js_if_needed
Includes the TinyMCE core javascript file, must be declared before tiny_mce_init (executes only when uses_tiny_mce has been declared)
include_tiny_mce_if_needed
Includes the TinyMCE core javascript file, and creates a string of javascript formed from the options declared to uses_tiny_mce (executes only when uses_tiny_mce has been declared)

See SPELLCHECKING_PLUGIN.rdoc . Note: Spell checking is not tested o regularly maintained. Use with caution.

github.com/kete/tiny_mce/tree/master/SPELLCHECKING_PLUGIN.rdoc

If you have a new language to add to this plugin you can generate it:

rake tiny_mce:new:lang LANG=lang

Will generate 4 copy “en” files:

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/langs/lang.js

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/themes/advanced/langs/lang.js

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/themes/advanced/langs/lang_dlg.js

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/themes/simple/langs/lang_dlg.js

Now you can make your won translation to the basic tinyMCE. Remember that if you use some tinyMCE plugin you have to make it manual.

Plugins allow you to insert or change files of the TinyMCE editor, such as installing TinyMCE Editor plugins.

There is an example plugin at github.com/kete/tiny_mce_plugin_example

A tiny_mce plugin is very simple. github.com/kete/tiny_mce_plugin_example/blob/master/lib/tiny_mce-paste.rb

It requires tiny_mce, installs the TinyMCE sources if they aren’t already, creates a subclass of TinyMCE::Plugin, and calls install on it.

TinyMCE::Plugin provides a default self.install method, which copies files from self.assets_path to the tiny_mce directory under public/javascripts

You can overwrite the install method to something more complex, like remove plugins, or swap plugins. Example:

classSwapPasteForPastePlus<TinyMCE::Plugindefself.installrequire'fileutils'FileUtils.rm(Rails.public.join('javascripts/tiny_mce/plugins/paste'))
FileUtils.cp_r(self.assets_path, Rails.public.join('javascripts/tiny_mce'))
endend

The plugin comes with a test suite that can be run once the plugin is installed in an application.

Change into the plugins directory and run ‘rake’ to start them.

Note: The tests require Rails 2.2 or higher, and are currently tested on Rails 2.3 (so problems in older versions may arise - please see “Reporting an Issue” if they do)

If you have a problem, please report it on the tiny_mce plugin ticket tracker (on Ligthouseapp)

kete.lighthouseapp.com/projects/14744-tiny_mce/tickets

Be sure to include Rails version, plugin version, and when possible, a sample application that can reproduce the problem. Upload it to one of the various file hosting sites and link to it in the ticket. Don’t include vendored rails or the tiny_mce plugin in the archive (if I know the versions, I’ll add these myself).

If you’ve added something, why not share it. Fork the repository (github.com/kete/tiny_mce), make the changes and send a pull request to the maintainers.

Changes with tests, and full documentation are preferred.

This plugin was created by Blake Watters <blake@near-time.com>

This plugin is currently maintained by Kieran Pilkington <kieran@katipo.co.nz>

Bundled TinyMCE version: 3.3.6

About

A Ruby on Rails plugin that allows easy implementation of the TinyMCE editor into your applications.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
GitHub - frederico/tiny_mce: A Ruby on Rails plugin that allows easy implementation of the TinyMCE editor into your applications. · GitHub
Skip to content

Repository files navigation

This gem/plugin provides for the installation and utilization of TinyMCE in Ruby on Rails applications of version 2.3.5 and onward.

TinyMCE is a WYSIWYG HTML editing component released under the GNU Lesser General Public License 2.1 (LGPL 2.1) by Moxiecode Systems (tinymce.moxiecode.com/).

Installing TinyMCE for Rails takes no more than a few minutes to install.

The recommended installation method for getting tiny_mce working in your application is to use the gem version. To do so, open the console and run:

[sudo] gem install tiny_mce

Then add this to config/environment.rb of your Rails application:

config.gem'tiny_mce'

Alternatively, you can install it as a plugin. To do so, open a console, and in the root of you Rails application, install the plugin by running one of the following (depending on the method you use to import plugins):

  • script/plugin install git://github.com/kete/tiny_mce.git

  • piston import git://github.com/kete/tiny_mce.git vendor/plugins/tiny_mce

  • git submodule add git://github.com/kete/tiny_mce.git vendor/plugins/tiny_mce

  • Download the latest files ( github.com/kete/tiny_mce/tarball/master ) and extract to vendor/plugins/tiny_mce

Add the following to the top of the controller of the page you want to add TinyMCE to.

uses_tiny_mce

Then append the following to the text area you want to transform into a TinyMCE editor. You can change the name of the class you want to use by editing the ‘editor_selector’ param in the controller code options.

:class=>"mceEditor"

Lastly, add the following line(s) to the <head> element of your application view:

<%= include_tiny_mce_if_needed %>

Now you’re all set! Start your server. The gem/plugin will automatically copy the sources to the public javascripts directory when the server is started.

There are several ways to configure the plugin to get the desirable effect you’re looking for. The following ways can be combined to create complex tiny mce setups

A load order is present so that you have finer grained control over what shows up where. The load order currently looks like this. The later ones receive more power, that is, the overwrite similar settings in previous configurations.

  1. The default tiny_mce plugin settings. Sets it to work on textareas with class of mceEditor, with the english advanced theme.

  2. config/tiny_mce.yml if present. You set your own options here, used across all editors on the site.

  3. uses_tiny_mce declaration. You set you own options here, used across all editors in the controller.

  4. include_tiny_mce_if_needed declaration. You set your own options here, used across all editors contained within that layout.

Below, I’ll cover how to use #2, and #3, which are the most likely ones you’ll want to use.

If you have a set of default options that is used throughout all editors in your application, you might want to make them global. You can do this by putting your settings into config/tiny_mce.yml. If the file exists, the tiny_mce plugin will parse the options in it first.

theme: advanced
plugins:
- table
- fullscreen

You can change the theme, order/choice of buttons, selectors Id, plugins, and many more by passing an :options hash to the uses_tiny_mce declaration.

The options hash can contain any number of settings available in lib/tiny_mce/valid_tinymce_options.yml (a copy of the settings available per version).

If an option is misspelled, invalid, or deprecated (no longer in TinyMCE), when you go to a page containing your editor, you will receive an Exception, which must be dealt with before continuing.

You can read about all these options at tinymce.moxiecode.com/documentation.php

uses_tiny_mce:options=> {
:theme=>'advanced',
:theme_advanced_resizing=>true,
:theme_advanced_resize_horizontal=>false,
:plugins=>%w{ table fullscreen }
}

If, like most applications, you only need the editor on the new, create, edit, and update pages, then tell the uses_tiny_mce declaration this, so it doesn’t load up all the files unnecessarily.

The declaration accepts any number of default parameters a normal controller filter would.

uses_tiny_mce:only=> [:new, :create, :edit, :update]

Sometimes, when you need complex arrays of data for plugins or such, the plugin helpers aren’t complex enough to do what you need. But you can always fall back to supplying your own options. You can this by passing a raw javascript (no <script> tags) to the uses_tiny_mce declaration. Consider the following example for the template plugin.

uses_tiny_mce:raw_options=>"template_templates : [ {
title : 'Editor Details',
src : 'editor_details.htm',
description : 'Adds Editors Name and Staff ID'
} ]"

TinyMCE has a range of convenience methods for loading TinyMCE. Besides the uses_tiny_mce shown above, they include:

using_tiny_mce?
Check whether the uses_tiny_mce declaration has been made in the current controller
raw_tiny_mce_init
Creates a string of javascript formed from the options declared to uses_tiny_mce (is not wrapped in a JS tag though, use tiny_mce_init for that)
tiny_mce_init
Creates a javascript tag formed from the options declared to uses_tiny_mce (executes whether uses_tiny_mce was declared or not)
tiny_mce_init_if_needed
Creates a javascript tag formed from the options declared to uses_tiny_mce (executes only when uses_tiny_mce has been declared)
include_tiny_mce_js
Includes the TinyMCE core javascript file, must be declared before tiny_mce_init (executes whether uses_tiny_mce was declared or not)
include_tiny_mce_js_if_needed
Includes the TinyMCE core javascript file, must be declared before tiny_mce_init (executes only when uses_tiny_mce has been declared)
include_tiny_mce_if_needed
Includes the TinyMCE core javascript file, and creates a string of javascript formed from the options declared to uses_tiny_mce (executes only when uses_tiny_mce has been declared)

See SPELLCHECKING_PLUGIN.rdoc . Note: Spell checking is not tested o regularly maintained. Use with caution.

github.com/kete/tiny_mce/tree/master/SPELLCHECKING_PLUGIN.rdoc

If you have a new language to add to this plugin you can generate it:

rake tiny_mce:new:lang LANG=lang

Will generate 4 copy “en” files:

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/langs/lang.js

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/themes/advanced/langs/lang.js

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/themes/advanced/langs/lang_dlg.js

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/themes/simple/langs/lang_dlg.js

Now you can make your won translation to the basic tinyMCE. Remember that if you use some tinyMCE plugin you have to make it manual.

Plugins allow you to insert or change files of the TinyMCE editor, such as installing TinyMCE Editor plugins.

There is an example plugin at github.com/kete/tiny_mce_plugin_example

A tiny_mce plugin is very simple. github.com/kete/tiny_mce_plugin_example/blob/master/lib/tiny_mce-paste.rb

It requires tiny_mce, installs the TinyMCE sources if they aren’t already, creates a subclass of TinyMCE::Plugin, and calls install on it.

TinyMCE::Plugin provides a default self.install method, which copies files from self.assets_path to the tiny_mce directory under public/javascripts

You can overwrite the install method to something more complex, like remove plugins, or swap plugins. Example:

classSwapPasteForPastePlus<TinyMCE::Plugindefself.installrequire'fileutils'FileUtils.rm(Rails.public.join('javascripts/tiny_mce/plugins/paste'))
FileUtils.cp_r(self.assets_path, Rails.public.join('javascripts/tiny_mce'))
endend

The plugin comes with a test suite that can be run once the plugin is installed in an application.

Change into the plugins directory and run ‘rake’ to start them.

Note: The tests require Rails 2.2 or higher, and are currently tested on Rails 2.3 (so problems in older versions may arise - please see “Reporting an Issue” if they do)

If you have a problem, please report it on the tiny_mce plugin ticket tracker (on Ligthouseapp)

kete.lighthouseapp.com/projects/14744-tiny_mce/tickets

Be sure to include Rails version, plugin version, and when possible, a sample application that can reproduce the problem. Upload it to one of the various file hosting sites and link to it in the ticket. Don’t include vendored rails or the tiny_mce plugin in the archive (if I know the versions, I’ll add these myself).

If you’ve added something, why not share it. Fork the repository (github.com/kete/tiny_mce), make the changes and send a pull request to the maintainers.

Changes with tests, and full documentation are preferred.

This plugin was created by Blake Watters <blake@near-time.com>

This plugin is currently maintained by Kieran Pilkington <kieran@katipo.co.nz>

Bundled TinyMCE version: 3.3.6

About

A Ruby on Rails plugin that allows easy implementation of the TinyMCE editor into your applications.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - frederico/tiny_mce: A Ruby on Rails plugin that allows easy implementation of the TinyMCE editor into your applications. · GitHub
Skip to content

Repository files navigation

This gem/plugin provides for the installation and utilization of TinyMCE in Ruby on Rails applications of version 2.3.5 and onward.

TinyMCE is a WYSIWYG HTML editing component released under the GNU Lesser General Public License 2.1 (LGPL 2.1) by Moxiecode Systems (tinymce.moxiecode.com/).

Installing TinyMCE for Rails takes no more than a few minutes to install.

The recommended installation method for getting tiny_mce working in your application is to use the gem version. To do so, open the console and run:

[sudo] gem install tiny_mce

Then add this to config/environment.rb of your Rails application:

config.gem'tiny_mce'

Alternatively, you can install it as a plugin. To do so, open a console, and in the root of you Rails application, install the plugin by running one of the following (depending on the method you use to import plugins):

  • script/plugin install git://github.com/kete/tiny_mce.git

  • piston import git://github.com/kete/tiny_mce.git vendor/plugins/tiny_mce

  • git submodule add git://github.com/kete/tiny_mce.git vendor/plugins/tiny_mce

  • Download the latest files ( github.com/kete/tiny_mce/tarball/master ) and extract to vendor/plugins/tiny_mce

Add the following to the top of the controller of the page you want to add TinyMCE to.

uses_tiny_mce

Then append the following to the text area you want to transform into a TinyMCE editor. You can change the name of the class you want to use by editing the ‘editor_selector’ param in the controller code options.

:class=>"mceEditor"

Lastly, add the following line(s) to the <head> element of your application view:

<%= include_tiny_mce_if_needed %>

Now you’re all set! Start your server. The gem/plugin will automatically copy the sources to the public javascripts directory when the server is started.

There are several ways to configure the plugin to get the desirable effect you’re looking for. The following ways can be combined to create complex tiny mce setups

A load order is present so that you have finer grained control over what shows up where. The load order currently looks like this. The later ones receive more power, that is, the overwrite similar settings in previous configurations.

  1. The default tiny_mce plugin settings. Sets it to work on textareas with class of mceEditor, with the english advanced theme.

  2. config/tiny_mce.yml if present. You set your own options here, used across all editors on the site.

  3. uses_tiny_mce declaration. You set you own options here, used across all editors in the controller.

  4. include_tiny_mce_if_needed declaration. You set your own options here, used across all editors contained within that layout.

Below, I’ll cover how to use #2, and #3, which are the most likely ones you’ll want to use.

If you have a set of default options that is used throughout all editors in your application, you might want to make them global. You can do this by putting your settings into config/tiny_mce.yml. If the file exists, the tiny_mce plugin will parse the options in it first.

theme: advanced
plugins:
- table
- fullscreen

You can change the theme, order/choice of buttons, selectors Id, plugins, and many more by passing an :options hash to the uses_tiny_mce declaration.

The options hash can contain any number of settings available in lib/tiny_mce/valid_tinymce_options.yml (a copy of the settings available per version).

If an option is misspelled, invalid, or deprecated (no longer in TinyMCE), when you go to a page containing your editor, you will receive an Exception, which must be dealt with before continuing.

You can read about all these options at tinymce.moxiecode.com/documentation.php

uses_tiny_mce:options=> {
:theme=>'advanced',
:theme_advanced_resizing=>true,
:theme_advanced_resize_horizontal=>false,
:plugins=>%w{ table fullscreen }
}

If, like most applications, you only need the editor on the new, create, edit, and update pages, then tell the uses_tiny_mce declaration this, so it doesn’t load up all the files unnecessarily.

The declaration accepts any number of default parameters a normal controller filter would.

uses_tiny_mce:only=> [:new, :create, :edit, :update]

Sometimes, when you need complex arrays of data for plugins or such, the plugin helpers aren’t complex enough to do what you need. But you can always fall back to supplying your own options. You can this by passing a raw javascript (no <script> tags) to the uses_tiny_mce declaration. Consider the following example for the template plugin.

uses_tiny_mce:raw_options=>"template_templates : [ {
title : 'Editor Details',
src : 'editor_details.htm',
description : 'Adds Editors Name and Staff ID'
} ]"

TinyMCE has a range of convenience methods for loading TinyMCE. Besides the uses_tiny_mce shown above, they include:

using_tiny_mce?
Check whether the uses_tiny_mce declaration has been made in the current controller
raw_tiny_mce_init
Creates a string of javascript formed from the options declared to uses_tiny_mce (is not wrapped in a JS tag though, use tiny_mce_init for that)
tiny_mce_init
Creates a javascript tag formed from the options declared to uses_tiny_mce (executes whether uses_tiny_mce was declared or not)
tiny_mce_init_if_needed
Creates a javascript tag formed from the options declared to uses_tiny_mce (executes only when uses_tiny_mce has been declared)
include_tiny_mce_js
Includes the TinyMCE core javascript file, must be declared before tiny_mce_init (executes whether uses_tiny_mce was declared or not)
include_tiny_mce_js_if_needed
Includes the TinyMCE core javascript file, must be declared before tiny_mce_init (executes only when uses_tiny_mce has been declared)
include_tiny_mce_if_needed
Includes the TinyMCE core javascript file, and creates a string of javascript formed from the options declared to uses_tiny_mce (executes only when uses_tiny_mce has been declared)

See SPELLCHECKING_PLUGIN.rdoc . Note: Spell checking is not tested o regularly maintained. Use with caution.

github.com/kete/tiny_mce/tree/master/SPELLCHECKING_PLUGIN.rdoc

If you have a new language to add to this plugin you can generate it:

rake tiny_mce:new:lang LANG=lang

Will generate 4 copy “en” files:

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/langs/lang.js

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/themes/advanced/langs/lang.js

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/themes/advanced/langs/lang_dlg.js

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/themes/simple/langs/lang_dlg.js

Now you can make your won translation to the basic tinyMCE. Remember that if you use some tinyMCE plugin you have to make it manual.

Plugins allow you to insert or change files of the TinyMCE editor, such as installing TinyMCE Editor plugins.

There is an example plugin at github.com/kete/tiny_mce_plugin_example

A tiny_mce plugin is very simple. github.com/kete/tiny_mce_plugin_example/blob/master/lib/tiny_mce-paste.rb

It requires tiny_mce, installs the TinyMCE sources if they aren’t already, creates a subclass of TinyMCE::Plugin, and calls install on it.

TinyMCE::Plugin provides a default self.install method, which copies files from self.assets_path to the tiny_mce directory under public/javascripts

You can overwrite the install method to something more complex, like remove plugins, or swap plugins. Example:

classSwapPasteForPastePlus<TinyMCE::Plugindefself.installrequire'fileutils'FileUtils.rm(Rails.public.join('javascripts/tiny_mce/plugins/paste'))
FileUtils.cp_r(self.assets_path, Rails.public.join('javascripts/tiny_mce'))
endend

The plugin comes with a test suite that can be run once the plugin is installed in an application.

Change into the plugins directory and run ‘rake’ to start them.

Note: The tests require Rails 2.2 or higher, and are currently tested on Rails 2.3 (so problems in older versions may arise - please see “Reporting an Issue” if they do)

If you have a problem, please report it on the tiny_mce plugin ticket tracker (on Ligthouseapp)

kete.lighthouseapp.com/projects/14744-tiny_mce/tickets

Be sure to include Rails version, plugin version, and when possible, a sample application that can reproduce the problem. Upload it to one of the various file hosting sites and link to it in the ticket. Don’t include vendored rails or the tiny_mce plugin in the archive (if I know the versions, I’ll add these myself).

If you’ve added something, why not share it. Fork the repository (github.com/kete/tiny_mce), make the changes and send a pull request to the maintainers.

Changes with tests, and full documentation are preferred.

This plugin was created by Blake Watters <blake@near-time.com>

This plugin is currently maintained by Kieran Pilkington <kieran@katipo.co.nz>

Bundled TinyMCE version: 3.3.6

About

A Ruby on Rails plugin that allows easy implementation of the TinyMCE editor into your applications.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - frederico/tiny_mce: A Ruby on Rails plugin that allows easy implementation of the TinyMCE editor into your applications. · GitHub
Skip to content

Repository files navigation

This gem/plugin provides for the installation and utilization of TinyMCE in Ruby on Rails applications of version 2.3.5 and onward.

TinyMCE is a WYSIWYG HTML editing component released under the GNU Lesser General Public License 2.1 (LGPL 2.1) by Moxiecode Systems (tinymce.moxiecode.com/).

Installing TinyMCE for Rails takes no more than a few minutes to install.

The recommended installation method for getting tiny_mce working in your application is to use the gem version. To do so, open the console and run:

[sudo] gem install tiny_mce

Then add this to config/environment.rb of your Rails application:

config.gem'tiny_mce'

Alternatively, you can install it as a plugin. To do so, open a console, and in the root of you Rails application, install the plugin by running one of the following (depending on the method you use to import plugins):

  • script/plugin install git://github.com/kete/tiny_mce.git

  • piston import git://github.com/kete/tiny_mce.git vendor/plugins/tiny_mce

  • git submodule add git://github.com/kete/tiny_mce.git vendor/plugins/tiny_mce

  • Download the latest files ( github.com/kete/tiny_mce/tarball/master ) and extract to vendor/plugins/tiny_mce

Add the following to the top of the controller of the page you want to add TinyMCE to.

uses_tiny_mce

Then append the following to the text area you want to transform into a TinyMCE editor. You can change the name of the class you want to use by editing the ‘editor_selector’ param in the controller code options.

:class=>"mceEditor"

Lastly, add the following line(s) to the <head> element of your application view:

<%= include_tiny_mce_if_needed %>

Now you’re all set! Start your server. The gem/plugin will automatically copy the sources to the public javascripts directory when the server is started.

There are several ways to configure the plugin to get the desirable effect you’re looking for. The following ways can be combined to create complex tiny mce setups

A load order is present so that you have finer grained control over what shows up where. The load order currently looks like this. The later ones receive more power, that is, the overwrite similar settings in previous configurations.

  1. The default tiny_mce plugin settings. Sets it to work on textareas with class of mceEditor, with the english advanced theme.

  2. config/tiny_mce.yml if present. You set your own options here, used across all editors on the site.

  3. uses_tiny_mce declaration. You set you own options here, used across all editors in the controller.

  4. include_tiny_mce_if_needed declaration. You set your own options here, used across all editors contained within that layout.

Below, I’ll cover how to use #2, and #3, which are the most likely ones you’ll want to use.

If you have a set of default options that is used throughout all editors in your application, you might want to make them global. You can do this by putting your settings into config/tiny_mce.yml. If the file exists, the tiny_mce plugin will parse the options in it first.

theme: advanced
plugins:
- table
- fullscreen

You can change the theme, order/choice of buttons, selectors Id, plugins, and many more by passing an :options hash to the uses_tiny_mce declaration.

The options hash can contain any number of settings available in lib/tiny_mce/valid_tinymce_options.yml (a copy of the settings available per version).

If an option is misspelled, invalid, or deprecated (no longer in TinyMCE), when you go to a page containing your editor, you will receive an Exception, which must be dealt with before continuing.

You can read about all these options at tinymce.moxiecode.com/documentation.php

uses_tiny_mce:options=> {
:theme=>'advanced',
:theme_advanced_resizing=>true,
:theme_advanced_resize_horizontal=>false,
:plugins=>%w{ table fullscreen }
}

If, like most applications, you only need the editor on the new, create, edit, and update pages, then tell the uses_tiny_mce declaration this, so it doesn’t load up all the files unnecessarily.

The declaration accepts any number of default parameters a normal controller filter would.

uses_tiny_mce:only=> [:new, :create, :edit, :update]

Sometimes, when you need complex arrays of data for plugins or such, the plugin helpers aren’t complex enough to do what you need. But you can always fall back to supplying your own options. You can this by passing a raw javascript (no <script> tags) to the uses_tiny_mce declaration. Consider the following example for the template plugin.

uses_tiny_mce:raw_options=>"template_templates : [ {
title : 'Editor Details',
src : 'editor_details.htm',
description : 'Adds Editors Name and Staff ID'
} ]"

TinyMCE has a range of convenience methods for loading TinyMCE. Besides the uses_tiny_mce shown above, they include:

using_tiny_mce?
Check whether the uses_tiny_mce declaration has been made in the current controller
raw_tiny_mce_init
Creates a string of javascript formed from the options declared to uses_tiny_mce (is not wrapped in a JS tag though, use tiny_mce_init for that)
tiny_mce_init
Creates a javascript tag formed from the options declared to uses_tiny_mce (executes whether uses_tiny_mce was declared or not)
tiny_mce_init_if_needed
Creates a javascript tag formed from the options declared to uses_tiny_mce (executes only when uses_tiny_mce has been declared)
include_tiny_mce_js
Includes the TinyMCE core javascript file, must be declared before tiny_mce_init (executes whether uses_tiny_mce was declared or not)
include_tiny_mce_js_if_needed
Includes the TinyMCE core javascript file, must be declared before tiny_mce_init (executes only when uses_tiny_mce has been declared)
include_tiny_mce_if_needed
Includes the TinyMCE core javascript file, and creates a string of javascript formed from the options declared to uses_tiny_mce (executes only when uses_tiny_mce has been declared)

See SPELLCHECKING_PLUGIN.rdoc . Note: Spell checking is not tested o regularly maintained. Use with caution.

github.com/kete/tiny_mce/tree/master/SPELLCHECKING_PLUGIN.rdoc

If you have a new language to add to this plugin you can generate it:

rake tiny_mce:new:lang LANG=lang

Will generate 4 copy “en” files:

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/langs/lang.js

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/themes/advanced/langs/lang.js

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/themes/advanced/langs/lang_dlg.js

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/themes/simple/langs/lang_dlg.js

Now you can make your won translation to the basic tinyMCE. Remember that if you use some tinyMCE plugin you have to make it manual.

Plugins allow you to insert or change files of the TinyMCE editor, such as installing TinyMCE Editor plugins.

There is an example plugin at github.com/kete/tiny_mce_plugin_example

A tiny_mce plugin is very simple. github.com/kete/tiny_mce_plugin_example/blob/master/lib/tiny_mce-paste.rb

It requires tiny_mce, installs the TinyMCE sources if they aren’t already, creates a subclass of TinyMCE::Plugin, and calls install on it.

TinyMCE::Plugin provides a default self.install method, which copies files from self.assets_path to the tiny_mce directory under public/javascripts

You can overwrite the install method to something more complex, like remove plugins, or swap plugins. Example:

classSwapPasteForPastePlus<TinyMCE::Plugindefself.installrequire'fileutils'FileUtils.rm(Rails.public.join('javascripts/tiny_mce/plugins/paste'))
FileUtils.cp_r(self.assets_path, Rails.public.join('javascripts/tiny_mce'))
endend

The plugin comes with a test suite that can be run once the plugin is installed in an application.

Change into the plugins directory and run ‘rake’ to start them.

Note: The tests require Rails 2.2 or higher, and are currently tested on Rails 2.3 (so problems in older versions may arise - please see “Reporting an Issue” if they do)

If you have a problem, please report it on the tiny_mce plugin ticket tracker (on Ligthouseapp)

kete.lighthouseapp.com/projects/14744-tiny_mce/tickets

Be sure to include Rails version, plugin version, and when possible, a sample application that can reproduce the problem. Upload it to one of the various file hosting sites and link to it in the ticket. Don’t include vendored rails or the tiny_mce plugin in the archive (if I know the versions, I’ll add these myself).

If you’ve added something, why not share it. Fork the repository (github.com/kete/tiny_mce), make the changes and send a pull request to the maintainers.

Changes with tests, and full documentation are preferred.

This plugin was created by Blake Watters <blake@near-time.com>

This plugin is currently maintained by Kieran Pilkington <kieran@katipo.co.nz>

Bundled TinyMCE version: 3.3.6

About

A Ruby on Rails plugin that allows easy implementation of the TinyMCE editor into your applications.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' GitHub - frederico/tiny_mce: A Ruby on Rails plugin that allows easy implementation of the TinyMCE editor into your applications. · GitHub
Skip to content

Repository files navigation

This gem/plugin provides for the installation and utilization of TinyMCE in Ruby on Rails applications of version 2.3.5 and onward.

TinyMCE is a WYSIWYG HTML editing component released under the GNU Lesser General Public License 2.1 (LGPL 2.1) by Moxiecode Systems (tinymce.moxiecode.com/).

Installing TinyMCE for Rails takes no more than a few minutes to install.

The recommended installation method for getting tiny_mce working in your application is to use the gem version. To do so, open the console and run:

[sudo] gem install tiny_mce

Then add this to config/environment.rb of your Rails application:

config.gem'tiny_mce'

Alternatively, you can install it as a plugin. To do so, open a console, and in the root of you Rails application, install the plugin by running one of the following (depending on the method you use to import plugins):

  • script/plugin install git://github.com/kete/tiny_mce.git

  • piston import git://github.com/kete/tiny_mce.git vendor/plugins/tiny_mce

  • git submodule add git://github.com/kete/tiny_mce.git vendor/plugins/tiny_mce

  • Download the latest files ( github.com/kete/tiny_mce/tarball/master ) and extract to vendor/plugins/tiny_mce

Add the following to the top of the controller of the page you want to add TinyMCE to.

uses_tiny_mce

Then append the following to the text area you want to transform into a TinyMCE editor. You can change the name of the class you want to use by editing the ‘editor_selector’ param in the controller code options.

:class=>"mceEditor"

Lastly, add the following line(s) to the <head> element of your application view:

<%= include_tiny_mce_if_needed %>

Now you’re all set! Start your server. The gem/plugin will automatically copy the sources to the public javascripts directory when the server is started.

There are several ways to configure the plugin to get the desirable effect you’re looking for. The following ways can be combined to create complex tiny mce setups

A load order is present so that you have finer grained control over what shows up where. The load order currently looks like this. The later ones receive more power, that is, the overwrite similar settings in previous configurations.

  1. The default tiny_mce plugin settings. Sets it to work on textareas with class of mceEditor, with the english advanced theme.

  2. config/tiny_mce.yml if present. You set your own options here, used across all editors on the site.

  3. uses_tiny_mce declaration. You set you own options here, used across all editors in the controller.

  4. include_tiny_mce_if_needed declaration. You set your own options here, used across all editors contained within that layout.

Below, I’ll cover how to use #2, and #3, which are the most likely ones you’ll want to use.

If you have a set of default options that is used throughout all editors in your application, you might want to make them global. You can do this by putting your settings into config/tiny_mce.yml. If the file exists, the tiny_mce plugin will parse the options in it first.

theme: advanced
plugins:
- table
- fullscreen

You can change the theme, order/choice of buttons, selectors Id, plugins, and many more by passing an :options hash to the uses_tiny_mce declaration.

The options hash can contain any number of settings available in lib/tiny_mce/valid_tinymce_options.yml (a copy of the settings available per version).

If an option is misspelled, invalid, or deprecated (no longer in TinyMCE), when you go to a page containing your editor, you will receive an Exception, which must be dealt with before continuing.

You can read about all these options at tinymce.moxiecode.com/documentation.php

uses_tiny_mce:options=> {
:theme=>'advanced',
:theme_advanced_resizing=>true,
:theme_advanced_resize_horizontal=>false,
:plugins=>%w{ table fullscreen }
}

If, like most applications, you only need the editor on the new, create, edit, and update pages, then tell the uses_tiny_mce declaration this, so it doesn’t load up all the files unnecessarily.

The declaration accepts any number of default parameters a normal controller filter would.

uses_tiny_mce:only=> [:new, :create, :edit, :update]

Sometimes, when you need complex arrays of data for plugins or such, the plugin helpers aren’t complex enough to do what you need. But you can always fall back to supplying your own options. You can this by passing a raw javascript (no <script> tags) to the uses_tiny_mce declaration. Consider the following example for the template plugin.

uses_tiny_mce:raw_options=>"template_templates : [ {
title : 'Editor Details',
src : 'editor_details.htm',
description : 'Adds Editors Name and Staff ID'
} ]"

TinyMCE has a range of convenience methods for loading TinyMCE. Besides the uses_tiny_mce shown above, they include:

using_tiny_mce?
Check whether the uses_tiny_mce declaration has been made in the current controller
raw_tiny_mce_init
Creates a string of javascript formed from the options declared to uses_tiny_mce (is not wrapped in a JS tag though, use tiny_mce_init for that)
tiny_mce_init
Creates a javascript tag formed from the options declared to uses_tiny_mce (executes whether uses_tiny_mce was declared or not)
tiny_mce_init_if_needed
Creates a javascript tag formed from the options declared to uses_tiny_mce (executes only when uses_tiny_mce has been declared)
include_tiny_mce_js
Includes the TinyMCE core javascript file, must be declared before tiny_mce_init (executes whether uses_tiny_mce was declared or not)
include_tiny_mce_js_if_needed
Includes the TinyMCE core javascript file, must be declared before tiny_mce_init (executes only when uses_tiny_mce has been declared)
include_tiny_mce_if_needed
Includes the TinyMCE core javascript file, and creates a string of javascript formed from the options declared to uses_tiny_mce (executes only when uses_tiny_mce has been declared)

See SPELLCHECKING_PLUGIN.rdoc . Note: Spell checking is not tested o regularly maintained. Use with caution.

github.com/kete/tiny_mce/tree/master/SPELLCHECKING_PLUGIN.rdoc

If you have a new language to add to this plugin you can generate it:

rake tiny_mce:new:lang LANG=lang

Will generate 4 copy “en” files:

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/langs/lang.js

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/themes/advanced/langs/lang.js

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/themes/advanced/langs/lang_dlg.js

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/themes/simple/langs/lang_dlg.js

Now you can make your won translation to the basic tinyMCE. Remember that if you use some tinyMCE plugin you have to make it manual.

Plugins allow you to insert or change files of the TinyMCE editor, such as installing TinyMCE Editor plugins.

There is an example plugin at github.com/kete/tiny_mce_plugin_example

A tiny_mce plugin is very simple. github.com/kete/tiny_mce_plugin_example/blob/master/lib/tiny_mce-paste.rb

It requires tiny_mce, installs the TinyMCE sources if they aren’t already, creates a subclass of TinyMCE::Plugin, and calls install on it.

TinyMCE::Plugin provides a default self.install method, which copies files from self.assets_path to the tiny_mce directory under public/javascripts

You can overwrite the install method to something more complex, like remove plugins, or swap plugins. Example:

classSwapPasteForPastePlus<TinyMCE::Plugindefself.installrequire'fileutils'FileUtils.rm(Rails.public.join('javascripts/tiny_mce/plugins/paste'))
FileUtils.cp_r(self.assets_path, Rails.public.join('javascripts/tiny_mce'))
endend

The plugin comes with a test suite that can be run once the plugin is installed in an application.

Change into the plugins directory and run ‘rake’ to start them.

Note: The tests require Rails 2.2 or higher, and are currently tested on Rails 2.3 (so problems in older versions may arise - please see “Reporting an Issue” if they do)

If you have a problem, please report it on the tiny_mce plugin ticket tracker (on Ligthouseapp)

kete.lighthouseapp.com/projects/14744-tiny_mce/tickets

Be sure to include Rails version, plugin version, and when possible, a sample application that can reproduce the problem. Upload it to one of the various file hosting sites and link to it in the ticket. Don’t include vendored rails or the tiny_mce plugin in the archive (if I know the versions, I’ll add these myself).

If you’ve added something, why not share it. Fork the repository (github.com/kete/tiny_mce), make the changes and send a pull request to the maintainers.

Changes with tests, and full documentation are preferred.

This plugin was created by Blake Watters <blake@near-time.com>

This plugin is currently maintained by Kieran Pilkington <kieran@katipo.co.nz>

Bundled TinyMCE version: 3.3.6

About

A Ruby on Rails plugin that allows easy implementation of the TinyMCE editor into your applications.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - frederico/tiny_mce: A Ruby on Rails plugin that allows easy implementation of the TinyMCE editor into your applications. · GitHub
Skip to content

Repository files navigation

This gem/plugin provides for the installation and utilization of TinyMCE in Ruby on Rails applications of version 2.3.5 and onward.

TinyMCE is a WYSIWYG HTML editing component released under the GNU Lesser General Public License 2.1 (LGPL 2.1) by Moxiecode Systems (tinymce.moxiecode.com/).

Installing TinyMCE for Rails takes no more than a few minutes to install.

The recommended installation method for getting tiny_mce working in your application is to use the gem version. To do so, open the console and run:

[sudo] gem install tiny_mce

Then add this to config/environment.rb of your Rails application:

config.gem'tiny_mce'

Alternatively, you can install it as a plugin. To do so, open a console, and in the root of you Rails application, install the plugin by running one of the following (depending on the method you use to import plugins):

  • script/plugin install git://github.com/kete/tiny_mce.git

  • piston import git://github.com/kete/tiny_mce.git vendor/plugins/tiny_mce

  • git submodule add git://github.com/kete/tiny_mce.git vendor/plugins/tiny_mce

  • Download the latest files ( github.com/kete/tiny_mce/tarball/master ) and extract to vendor/plugins/tiny_mce

Add the following to the top of the controller of the page you want to add TinyMCE to.

uses_tiny_mce

Then append the following to the text area you want to transform into a TinyMCE editor. You can change the name of the class you want to use by editing the ‘editor_selector’ param in the controller code options.

:class=>"mceEditor"

Lastly, add the following line(s) to the <head> element of your application view:

<%= include_tiny_mce_if_needed %>

Now you’re all set! Start your server. The gem/plugin will automatically copy the sources to the public javascripts directory when the server is started.

There are several ways to configure the plugin to get the desirable effect you’re looking for. The following ways can be combined to create complex tiny mce setups

A load order is present so that you have finer grained control over what shows up where. The load order currently looks like this. The later ones receive more power, that is, the overwrite similar settings in previous configurations.

  1. The default tiny_mce plugin settings. Sets it to work on textareas with class of mceEditor, with the english advanced theme.

  2. config/tiny_mce.yml if present. You set your own options here, used across all editors on the site.

  3. uses_tiny_mce declaration. You set you own options here, used across all editors in the controller.

  4. include_tiny_mce_if_needed declaration. You set your own options here, used across all editors contained within that layout.

Below, I’ll cover how to use #2, and #3, which are the most likely ones you’ll want to use.

If you have a set of default options that is used throughout all editors in your application, you might want to make them global. You can do this by putting your settings into config/tiny_mce.yml. If the file exists, the tiny_mce plugin will parse the options in it first.

theme: advanced
plugins:
- table
- fullscreen

You can change the theme, order/choice of buttons, selectors Id, plugins, and many more by passing an :options hash to the uses_tiny_mce declaration.

The options hash can contain any number of settings available in lib/tiny_mce/valid_tinymce_options.yml (a copy of the settings available per version).

If an option is misspelled, invalid, or deprecated (no longer in TinyMCE), when you go to a page containing your editor, you will receive an Exception, which must be dealt with before continuing.

You can read about all these options at tinymce.moxiecode.com/documentation.php

uses_tiny_mce:options=> {
:theme=>'advanced',
:theme_advanced_resizing=>true,
:theme_advanced_resize_horizontal=>false,
:plugins=>%w{ table fullscreen }
}

If, like most applications, you only need the editor on the new, create, edit, and update pages, then tell the uses_tiny_mce declaration this, so it doesn’t load up all the files unnecessarily.

The declaration accepts any number of default parameters a normal controller filter would.

uses_tiny_mce:only=> [:new, :create, :edit, :update]

Sometimes, when you need complex arrays of data for plugins or such, the plugin helpers aren’t complex enough to do what you need. But you can always fall back to supplying your own options. You can this by passing a raw javascript (no <script> tags) to the uses_tiny_mce declaration. Consider the following example for the template plugin.

uses_tiny_mce:raw_options=>"template_templates : [ {
title : 'Editor Details',
src : 'editor_details.htm',
description : 'Adds Editors Name and Staff ID'
} ]"

TinyMCE has a range of convenience methods for loading TinyMCE. Besides the uses_tiny_mce shown above, they include:

using_tiny_mce?
Check whether the uses_tiny_mce declaration has been made in the current controller
raw_tiny_mce_init
Creates a string of javascript formed from the options declared to uses_tiny_mce (is not wrapped in a JS tag though, use tiny_mce_init for that)
tiny_mce_init
Creates a javascript tag formed from the options declared to uses_tiny_mce (executes whether uses_tiny_mce was declared or not)
tiny_mce_init_if_needed
Creates a javascript tag formed from the options declared to uses_tiny_mce (executes only when uses_tiny_mce has been declared)
include_tiny_mce_js
Includes the TinyMCE core javascript file, must be declared before tiny_mce_init (executes whether uses_tiny_mce was declared or not)
include_tiny_mce_js_if_needed
Includes the TinyMCE core javascript file, must be declared before tiny_mce_init (executes only when uses_tiny_mce has been declared)
include_tiny_mce_if_needed
Includes the TinyMCE core javascript file, and creates a string of javascript formed from the options declared to uses_tiny_mce (executes only when uses_tiny_mce has been declared)

See SPELLCHECKING_PLUGIN.rdoc . Note: Spell checking is not tested o regularly maintained. Use with caution.

github.com/kete/tiny_mce/tree/master/SPELLCHECKING_PLUGIN.rdoc

If you have a new language to add to this plugin you can generate it:

rake tiny_mce:new:lang LANG=lang

Will generate 4 copy “en” files:

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/langs/lang.js

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/themes/advanced/langs/lang.js

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/themes/advanced/langs/lang_dlg.js

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/themes/simple/langs/lang_dlg.js

Now you can make your won translation to the basic tinyMCE. Remember that if you use some tinyMCE plugin you have to make it manual.

Plugins allow you to insert or change files of the TinyMCE editor, such as installing TinyMCE Editor plugins.

There is an example plugin at github.com/kete/tiny_mce_plugin_example

A tiny_mce plugin is very simple. github.com/kete/tiny_mce_plugin_example/blob/master/lib/tiny_mce-paste.rb

It requires tiny_mce, installs the TinyMCE sources if they aren’t already, creates a subclass of TinyMCE::Plugin, and calls install on it.

TinyMCE::Plugin provides a default self.install method, which copies files from self.assets_path to the tiny_mce directory under public/javascripts

You can overwrite the install method to something more complex, like remove plugins, or swap plugins. Example:

classSwapPasteForPastePlus<TinyMCE::Plugindefself.installrequire'fileutils'FileUtils.rm(Rails.public.join('javascripts/tiny_mce/plugins/paste'))
FileUtils.cp_r(self.assets_path, Rails.public.join('javascripts/tiny_mce'))
endend

The plugin comes with a test suite that can be run once the plugin is installed in an application.

Change into the plugins directory and run ‘rake’ to start them.

Note: The tests require Rails 2.2 or higher, and are currently tested on Rails 2.3 (so problems in older versions may arise - please see “Reporting an Issue” if they do)

If you have a problem, please report it on the tiny_mce plugin ticket tracker (on Ligthouseapp)

kete.lighthouseapp.com/projects/14744-tiny_mce/tickets

Be sure to include Rails version, plugin version, and when possible, a sample application that can reproduce the problem. Upload it to one of the various file hosting sites and link to it in the ticket. Don’t include vendored rails or the tiny_mce plugin in the archive (if I know the versions, I’ll add these myself).

If you’ve added something, why not share it. Fork the repository (github.com/kete/tiny_mce), make the changes and send a pull request to the maintainers.

Changes with tests, and full documentation are preferred.

This plugin was created by Blake Watters <blake@near-time.com>

This plugin is currently maintained by Kieran Pilkington <kieran@katipo.co.nz>

Bundled TinyMCE version: 3.3.6

About

A Ruby on Rails plugin that allows easy implementation of the TinyMCE editor into your applications.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - frederico/tiny_mce: A Ruby on Rails plugin that allows easy implementation of the TinyMCE editor into your applications. · GitHub
Skip to content

Repository files navigation

This gem/plugin provides for the installation and utilization of TinyMCE in Ruby on Rails applications of version 2.3.5 and onward.

TinyMCE is a WYSIWYG HTML editing component released under the GNU Lesser General Public License 2.1 (LGPL 2.1) by Moxiecode Systems (tinymce.moxiecode.com/).

Installing TinyMCE for Rails takes no more than a few minutes to install.

The recommended installation method for getting tiny_mce working in your application is to use the gem version. To do so, open the console and run:

[sudo] gem install tiny_mce

Then add this to config/environment.rb of your Rails application:

config.gem'tiny_mce'

Alternatively, you can install it as a plugin. To do so, open a console, and in the root of you Rails application, install the plugin by running one of the following (depending on the method you use to import plugins):

  • script/plugin install git://github.com/kete/tiny_mce.git

  • piston import git://github.com/kete/tiny_mce.git vendor/plugins/tiny_mce

  • git submodule add git://github.com/kete/tiny_mce.git vendor/plugins/tiny_mce

  • Download the latest files ( github.com/kete/tiny_mce/tarball/master ) and extract to vendor/plugins/tiny_mce

Add the following to the top of the controller of the page you want to add TinyMCE to.

uses_tiny_mce

Then append the following to the text area you want to transform into a TinyMCE editor. You can change the name of the class you want to use by editing the ‘editor_selector’ param in the controller code options.

:class=>"mceEditor"

Lastly, add the following line(s) to the <head> element of your application view:

<%= include_tiny_mce_if_needed %>

Now you’re all set! Start your server. The gem/plugin will automatically copy the sources to the public javascripts directory when the server is started.

There are several ways to configure the plugin to get the desirable effect you’re looking for. The following ways can be combined to create complex tiny mce setups

A load order is present so that you have finer grained control over what shows up where. The load order currently looks like this. The later ones receive more power, that is, the overwrite similar settings in previous configurations.

  1. The default tiny_mce plugin settings. Sets it to work on textareas with class of mceEditor, with the english advanced theme.

  2. config/tiny_mce.yml if present. You set your own options here, used across all editors on the site.

  3. uses_tiny_mce declaration. You set you own options here, used across all editors in the controller.

  4. include_tiny_mce_if_needed declaration. You set your own options here, used across all editors contained within that layout.

Below, I’ll cover how to use #2, and #3, which are the most likely ones you’ll want to use.

If you have a set of default options that is used throughout all editors in your application, you might want to make them global. You can do this by putting your settings into config/tiny_mce.yml. If the file exists, the tiny_mce plugin will parse the options in it first.

theme: advanced
plugins:
- table
- fullscreen

You can change the theme, order/choice of buttons, selectors Id, plugins, and many more by passing an :options hash to the uses_tiny_mce declaration.

The options hash can contain any number of settings available in lib/tiny_mce/valid_tinymce_options.yml (a copy of the settings available per version).

If an option is misspelled, invalid, or deprecated (no longer in TinyMCE), when you go to a page containing your editor, you will receive an Exception, which must be dealt with before continuing.

You can read about all these options at tinymce.moxiecode.com/documentation.php

uses_tiny_mce:options=> {
:theme=>'advanced',
:theme_advanced_resizing=>true,
:theme_advanced_resize_horizontal=>false,
:plugins=>%w{ table fullscreen }
}

If, like most applications, you only need the editor on the new, create, edit, and update pages, then tell the uses_tiny_mce declaration this, so it doesn’t load up all the files unnecessarily.

The declaration accepts any number of default parameters a normal controller filter would.

uses_tiny_mce:only=> [:new, :create, :edit, :update]

Sometimes, when you need complex arrays of data for plugins or such, the plugin helpers aren’t complex enough to do what you need. But you can always fall back to supplying your own options. You can this by passing a raw javascript (no <script> tags) to the uses_tiny_mce declaration. Consider the following example for the template plugin.

uses_tiny_mce:raw_options=>"template_templates : [ {
title : 'Editor Details',
src : 'editor_details.htm',
description : 'Adds Editors Name and Staff ID'
} ]"

TinyMCE has a range of convenience methods for loading TinyMCE. Besides the uses_tiny_mce shown above, they include:

using_tiny_mce?
Check whether the uses_tiny_mce declaration has been made in the current controller
raw_tiny_mce_init
Creates a string of javascript formed from the options declared to uses_tiny_mce (is not wrapped in a JS tag though, use tiny_mce_init for that)
tiny_mce_init
Creates a javascript tag formed from the options declared to uses_tiny_mce (executes whether uses_tiny_mce was declared or not)
tiny_mce_init_if_needed
Creates a javascript tag formed from the options declared to uses_tiny_mce (executes only when uses_tiny_mce has been declared)
include_tiny_mce_js
Includes the TinyMCE core javascript file, must be declared before tiny_mce_init (executes whether uses_tiny_mce was declared or not)
include_tiny_mce_js_if_needed
Includes the TinyMCE core javascript file, must be declared before tiny_mce_init (executes only when uses_tiny_mce has been declared)
include_tiny_mce_if_needed
Includes the TinyMCE core javascript file, and creates a string of javascript formed from the options declared to uses_tiny_mce (executes only when uses_tiny_mce has been declared)

See SPELLCHECKING_PLUGIN.rdoc . Note: Spell checking is not tested o regularly maintained. Use with caution.

github.com/kete/tiny_mce/tree/master/SPELLCHECKING_PLUGIN.rdoc

If you have a new language to add to this plugin you can generate it:

rake tiny_mce:new:lang LANG=lang

Will generate 4 copy “en” files:

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/langs/lang.js

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/themes/advanced/langs/lang.js

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/themes/advanced/langs/lang_dlg.js

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/themes/simple/langs/lang_dlg.js

Now you can make your won translation to the basic tinyMCE. Remember that if you use some tinyMCE plugin you have to make it manual.

Plugins allow you to insert or change files of the TinyMCE editor, such as installing TinyMCE Editor plugins.

There is an example plugin at github.com/kete/tiny_mce_plugin_example

A tiny_mce plugin is very simple. github.com/kete/tiny_mce_plugin_example/blob/master/lib/tiny_mce-paste.rb

It requires tiny_mce, installs the TinyMCE sources if they aren’t already, creates a subclass of TinyMCE::Plugin, and calls install on it.

TinyMCE::Plugin provides a default self.install method, which copies files from self.assets_path to the tiny_mce directory under public/javascripts

You can overwrite the install method to something more complex, like remove plugins, or swap plugins. Example:

classSwapPasteForPastePlus<TinyMCE::Plugindefself.installrequire'fileutils'FileUtils.rm(Rails.public.join('javascripts/tiny_mce/plugins/paste'))
FileUtils.cp_r(self.assets_path, Rails.public.join('javascripts/tiny_mce'))
endend

The plugin comes with a test suite that can be run once the plugin is installed in an application.

Change into the plugins directory and run ‘rake’ to start them.

Note: The tests require Rails 2.2 or higher, and are currently tested on Rails 2.3 (so problems in older versions may arise - please see “Reporting an Issue” if they do)

If you have a problem, please report it on the tiny_mce plugin ticket tracker (on Ligthouseapp)

kete.lighthouseapp.com/projects/14744-tiny_mce/tickets

Be sure to include Rails version, plugin version, and when possible, a sample application that can reproduce the problem. Upload it to one of the various file hosting sites and link to it in the ticket. Don’t include vendored rails or the tiny_mce plugin in the archive (if I know the versions, I’ll add these myself).

If you’ve added something, why not share it. Fork the repository (github.com/kete/tiny_mce), make the changes and send a pull request to the maintainers.

Changes with tests, and full documentation are preferred.

This plugin was created by Blake Watters <blake@near-time.com>

This plugin is currently maintained by Kieran Pilkington <kieran@katipo.co.nz>

Bundled TinyMCE version: 3.3.6

About

A Ruby on Rails plugin that allows easy implementation of the TinyMCE editor into your applications.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); GitHub - frederico/tiny_mce: A Ruby on Rails plugin that allows easy implementation of the TinyMCE editor into your applications. · GitHub
Skip to content

Repository files navigation

This gem/plugin provides for the installation and utilization of TinyMCE in Ruby on Rails applications of version 2.3.5 and onward.

TinyMCE is a WYSIWYG HTML editing component released under the GNU Lesser General Public License 2.1 (LGPL 2.1) by Moxiecode Systems (tinymce.moxiecode.com/).

Installing TinyMCE for Rails takes no more than a few minutes to install.

The recommended installation method for getting tiny_mce working in your application is to use the gem version. To do so, open the console and run:

[sudo] gem install tiny_mce

Then add this to config/environment.rb of your Rails application:

config.gem'tiny_mce'

Alternatively, you can install it as a plugin. To do so, open a console, and in the root of you Rails application, install the plugin by running one of the following (depending on the method you use to import plugins):

  • script/plugin install git://github.com/kete/tiny_mce.git

  • piston import git://github.com/kete/tiny_mce.git vendor/plugins/tiny_mce

  • git submodule add git://github.com/kete/tiny_mce.git vendor/plugins/tiny_mce

  • Download the latest files ( github.com/kete/tiny_mce/tarball/master ) and extract to vendor/plugins/tiny_mce

Add the following to the top of the controller of the page you want to add TinyMCE to.

uses_tiny_mce

Then append the following to the text area you want to transform into a TinyMCE editor. You can change the name of the class you want to use by editing the ‘editor_selector’ param in the controller code options.

:class=>"mceEditor"

Lastly, add the following line(s) to the <head> element of your application view:

<%= include_tiny_mce_if_needed %>

Now you’re all set! Start your server. The gem/plugin will automatically copy the sources to the public javascripts directory when the server is started.

There are several ways to configure the plugin to get the desirable effect you’re looking for. The following ways can be combined to create complex tiny mce setups

A load order is present so that you have finer grained control over what shows up where. The load order currently looks like this. The later ones receive more power, that is, the overwrite similar settings in previous configurations.

  1. The default tiny_mce plugin settings. Sets it to work on textareas with class of mceEditor, with the english advanced theme.

  2. config/tiny_mce.yml if present. You set your own options here, used across all editors on the site.

  3. uses_tiny_mce declaration. You set you own options here, used across all editors in the controller.

  4. include_tiny_mce_if_needed declaration. You set your own options here, used across all editors contained within that layout.

Below, I’ll cover how to use #2, and #3, which are the most likely ones you’ll want to use.

If you have a set of default options that is used throughout all editors in your application, you might want to make them global. You can do this by putting your settings into config/tiny_mce.yml. If the file exists, the tiny_mce plugin will parse the options in it first.

theme: advanced
plugins:
- table
- fullscreen

You can change the theme, order/choice of buttons, selectors Id, plugins, and many more by passing an :options hash to the uses_tiny_mce declaration.

The options hash can contain any number of settings available in lib/tiny_mce/valid_tinymce_options.yml (a copy of the settings available per version).

If an option is misspelled, invalid, or deprecated (no longer in TinyMCE), when you go to a page containing your editor, you will receive an Exception, which must be dealt with before continuing.

You can read about all these options at tinymce.moxiecode.com/documentation.php

uses_tiny_mce:options=> {
:theme=>'advanced',
:theme_advanced_resizing=>true,
:theme_advanced_resize_horizontal=>false,
:plugins=>%w{ table fullscreen }
}

If, like most applications, you only need the editor on the new, create, edit, and update pages, then tell the uses_tiny_mce declaration this, so it doesn’t load up all the files unnecessarily.

The declaration accepts any number of default parameters a normal controller filter would.

uses_tiny_mce:only=> [:new, :create, :edit, :update]

Sometimes, when you need complex arrays of data for plugins or such, the plugin helpers aren’t complex enough to do what you need. But you can always fall back to supplying your own options. You can this by passing a raw javascript (no <script> tags) to the uses_tiny_mce declaration. Consider the following example for the template plugin.

uses_tiny_mce:raw_options=>"template_templates : [ {
title : 'Editor Details',
src : 'editor_details.htm',
description : 'Adds Editors Name and Staff ID'
} ]"

TinyMCE has a range of convenience methods for loading TinyMCE. Besides the uses_tiny_mce shown above, they include:

using_tiny_mce?
Check whether the uses_tiny_mce declaration has been made in the current controller
raw_tiny_mce_init
Creates a string of javascript formed from the options declared to uses_tiny_mce (is not wrapped in a JS tag though, use tiny_mce_init for that)
tiny_mce_init
Creates a javascript tag formed from the options declared to uses_tiny_mce (executes whether uses_tiny_mce was declared or not)
tiny_mce_init_if_needed
Creates a javascript tag formed from the options declared to uses_tiny_mce (executes only when uses_tiny_mce has been declared)
include_tiny_mce_js
Includes the TinyMCE core javascript file, must be declared before tiny_mce_init (executes whether uses_tiny_mce was declared or not)
include_tiny_mce_js_if_needed
Includes the TinyMCE core javascript file, must be declared before tiny_mce_init (executes only when uses_tiny_mce has been declared)
include_tiny_mce_if_needed
Includes the TinyMCE core javascript file, and creates a string of javascript formed from the options declared to uses_tiny_mce (executes only when uses_tiny_mce has been declared)

See SPELLCHECKING_PLUGIN.rdoc . Note: Spell checking is not tested o regularly maintained. Use with caution.

github.com/kete/tiny_mce/tree/master/SPELLCHECKING_PLUGIN.rdoc

If you have a new language to add to this plugin you can generate it:

rake tiny_mce:new:lang LANG=lang

Will generate 4 copy “en” files:

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/langs/lang.js

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/themes/advanced/langs/lang.js

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/themes/advanced/langs/lang_dlg.js

  • tiny_mce/lib/tiny_mce/assets/tiny_mce/themes/simple/langs/lang_dlg.js

Now you can make your won translation to the basic tinyMCE. Remember that if you use some tinyMCE plugin you have to make it manual.

Plugins allow you to insert or change files of the TinyMCE editor, such as installing TinyMCE Editor plugins.

There is an example plugin at github.com/kete/tiny_mce_plugin_example

A tiny_mce plugin is very simple. github.com/kete/tiny_mce_plugin_example/blob/master/lib/tiny_mce-paste.rb

It requires tiny_mce, installs the TinyMCE sources if they aren’t already, creates a subclass of TinyMCE::Plugin, and calls install on it.

TinyMCE::Plugin provides a default self.install method, which copies files from self.assets_path to the tiny_mce directory under public/javascripts

You can overwrite the install method to something more complex, like remove plugins, or swap plugins. Example:

classSwapPasteForPastePlus<TinyMCE::Plugindefself.installrequire'fileutils'FileUtils.rm(Rails.public.join('javascripts/tiny_mce/plugins/paste'))
FileUtils.cp_r(self.assets_path, Rails.public.join('javascripts/tiny_mce'))
endend

The plugin comes with a test suite that can be run once the plugin is installed in an application.

Change into the plugins directory and run ‘rake’ to start them.

Note: The tests require Rails 2.2 or higher, and are currently tested on Rails 2.3 (so problems in older versions may arise - please see “Reporting an Issue” if they do)

If you have a problem, please report it on the tiny_mce plugin ticket tracker (on Ligthouseapp)

kete.lighthouseapp.com/projects/14744-tiny_mce/tickets

Be sure to include Rails version, plugin version, and when possible, a sample application that can reproduce the problem. Upload it to one of the various file hosting sites and link to it in the ticket. Don’t include vendored rails or the tiny_mce plugin in the archive (if I know the versions, I’ll add these myself).

If you’ve added something, why not share it. Fork the repository (github.com/kete/tiny_mce), make the changes and send a pull request to the maintainers.

Changes with tests, and full documentation are preferred.

This plugin was created by Blake Watters <blake@near-time.com>

This plugin is currently maintained by Kieran Pilkington <kieran@katipo.co.nz>

Bundled TinyMCE version: 3.3.6

About

A Ruby on Rails plugin that allows easy implementation of the TinyMCE editor into your applications.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages