tinymce heading plugin
This commit is contained in:
@@ -2,6 +2,11 @@
|
||||
theme_advanced_toolbar_location: top
|
||||
theme_advanced_toolbar_align: left
|
||||
theme_advanced_statusbar_location: bottom
|
||||
theme_advanced_buttons1_add_before:
|
||||
- h1
|
||||
- h2
|
||||
- h3
|
||||
- separator
|
||||
theme_advanced_buttons3_add:
|
||||
- tablecontrols
|
||||
- fullscreen
|
||||
@@ -9,3 +14,5 @@ plugins:
|
||||
- table
|
||||
- fullscreen
|
||||
- advimage
|
||||
- heading
|
||||
heading_clear_tag: p
|
||||
|
||||
59
vendor/assets/javascripts/tinymce/plugins/heading/README.md
vendored
Normal file
59
vendor/assets/javascripts/tinymce/plugins/heading/README.md
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
Plugin: Heading
|
||||
===============
|
||||
|
||||
Here is a Heading plugin for TinyMCE by WSL.RU
|
||||
This plugin adds H1-H6 buttons to TinyMCE.
|
||||
This plugin was developed by Andrey G and modified by ggoodd.
|
||||
Further modifications made by Merten van Gerven.
|
||||
|
||||
|
||||
Version History
|
||||
===============
|
||||
|
||||
### 1.4 by Merten van Gerven
|
||||
* refactored to reduce code duplication by using closures
|
||||
* changed button icons to fit the default theme.
|
||||
* fix for broken command execution (http://www.tinymce.com/forum/viewtopic.php?id=25260)
|
||||
|
||||
### 1.3
|
||||
* rewrited for TinyMCE 3.x
|
||||
- removed keyboard shortcuts (use Ctrl+1-6)
|
||||
|
||||
### 1.2 by ggoodd
|
||||
+ added keyboard shortcuts
|
||||
+ added heading_clear_tag option
|
||||
- removed language pack, advansed theme variables used instead
|
||||
|
||||
### 1.1 by ggoodd
|
||||
+ added buttons switching
|
||||
- removed NoHeading button
|
||||
|
||||
### 1.0 by Andrey G
|
||||
* initial version
|
||||
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
* clone this repository to your TinyMCE plugins directory and rename to 'heading'.
|
||||
* Add plugin to TinyMCE plugin option list.
|
||||
* Add heading buttons to button list.
|
||||
* Set heading_clear_tag option if you need. Default value is undefined.
|
||||
This option holds formating tag which is added on heading removal.
|
||||
|
||||
|
||||
Initialization Example
|
||||
======================
|
||||
|
||||
```js
|
||||
tinyMCE.init({
|
||||
|
||||
theme : "advanced",
|
||||
mode : "exact",
|
||||
|
||||
plugins : "heading",
|
||||
heading_clear_tag : "p",
|
||||
theme_advanced_buttons1_add_before : "h1,h2,h3,h4,h5,h6,separator",
|
||||
|
||||
});
|
||||
```
|
||||
63
vendor/assets/javascripts/tinymce/plugins/heading/editor_plugin.js
vendored
Normal file
63
vendor/assets/javascripts/tinymce/plugins/heading/editor_plugin.js
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
*
|
||||
* @author WSL.RU
|
||||
* @copyright Copyright (c) 2006-2009. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
(function(tinymce) {
|
||||
|
||||
/**
|
||||
* Add a new command to tiny MCE
|
||||
*/
|
||||
function addCommand(ed, url, headingNumber) {
|
||||
var headingTag = 'h' + headingNumber;
|
||||
|
||||
ed.addButton(headingTag, {
|
||||
title : ed.getLang('advanced.' + headingTag, headingTag) + ' (Ctrl+' + headingNumber + ')',
|
||||
image : url + '/img/' + headingTag + '.gif',
|
||||
cmd: 'mceHeading' + headingNumber
|
||||
});
|
||||
|
||||
ed.addCommand('mceHeading' + headingNumber, function() {
|
||||
var ct = ed.getParam("heading_clear_tag", false) ? ed.getParam("heading_clear_tag", "") : "";
|
||||
|
||||
if (ed.selection.getNode().nodeName.toLowerCase() != headingTag) {
|
||||
ct = headingTag;
|
||||
}
|
||||
|
||||
ed.execCommand('FormatBlock', false, ct)
|
||||
});
|
||||
|
||||
ed.onNodeChange.add( function(ed, cm, n) {
|
||||
cm.setActive(headingTag, n.nodeName.toLowerCase() == headingTag);
|
||||
});
|
||||
}
|
||||
|
||||
tinymce.create('tinymce.plugins.heading', {
|
||||
/**
|
||||
* Initialize the plugin
|
||||
*/
|
||||
init : function(ed, url) {
|
||||
for (var headingNumber = 1; headingNumber <= 6; headingNumber++) {
|
||||
addCommand(ed, url, headingNumber);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Plugin information
|
||||
*/
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Heading plugin',
|
||||
author : 'WSL.RU / Andrey G, ggoodd, Merten van Gerven',
|
||||
authorurl : 'http://wsl.ru',
|
||||
infourl : 'mailto:merten.vg@gmail.com',
|
||||
version : '1.4'
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
tinymce.PluginManager.add('heading', tinymce.plugins.heading);
|
||||
|
||||
})(tinymce);
|
||||
BIN
vendor/assets/javascripts/tinymce/plugins/heading/img/h1.gif
vendored
Normal file
BIN
vendor/assets/javascripts/tinymce/plugins/heading/img/h1.gif
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
vendor/assets/javascripts/tinymce/plugins/heading/img/h2.gif
vendored
Normal file
BIN
vendor/assets/javascripts/tinymce/plugins/heading/img/h2.gif
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
vendor/assets/javascripts/tinymce/plugins/heading/img/h3.gif
vendored
Normal file
BIN
vendor/assets/javascripts/tinymce/plugins/heading/img/h3.gif
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
vendor/assets/javascripts/tinymce/plugins/heading/img/h4.gif
vendored
Normal file
BIN
vendor/assets/javascripts/tinymce/plugins/heading/img/h4.gif
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
vendor/assets/javascripts/tinymce/plugins/heading/img/h5.gif
vendored
Normal file
BIN
vendor/assets/javascripts/tinymce/plugins/heading/img/h5.gif
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
vendor/assets/javascripts/tinymce/plugins/heading/img/h6.gif
vendored
Normal file
BIN
vendor/assets/javascripts/tinymce/plugins/heading/img/h6.gif
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
Reference in New Issue
Block a user