| 1 |
// $Id: ckeditor-3.0.js,v 1.2.2.3 2009/10/22 22:32:09 twod Exp $ |
// $Id: ckeditor-3.0.js,v 1.2.2.4 2009/10/23 02:10:53 twod Exp $ |
| 2 |
(function($) { |
(function($) { |
| 3 |
|
|
| 4 |
Drupal.wysiwyg.editor.init.ckeditor = function(settings) { |
Drupal.wysiwyg.editor.init.ckeditor = function(settings) { |
| 36 |
CKEDITOR.config.customConfig = ''; |
CKEDITOR.config.customConfig = ''; |
| 37 |
|
|
| 38 |
settings.on = { |
settings.on = { |
|
// Event handlers. |
|
| 39 |
instanceReady: function(ev) { |
instanceReady: function(ev) { |
| 40 |
var editor = ev.editor; |
var editor = ev.editor; |
| 41 |
|
// Get a list of block, list and table tags from CKEditor's XHTML DTD. |
| 42 |
|
// @see http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Output_Formatting. |
| 43 |
var dtd = CKEDITOR.dtd; |
var dtd = CKEDITOR.dtd; |
| 44 |
var tags = CKEDITOR.tools.extend( {}, dtd.$block, dtd.$listItem, dtd.$tableContent ); |
var tags = CKEDITOR.tools.extend({}, dtd.$block, dtd.$listItem, dtd.$tableContent); |
| 45 |
|
// Set source formatting rules for each listed tag except <pre>. |
| 46 |
|
// Linebreaks can be inserted before or after opening and closing tags. |
| 47 |
if (settings.apply_source_formatting) { |
if (settings.apply_source_formatting) { |
| 48 |
// Mimic FCKeditor output. |
// Mimic FCKeditor output, by breaking lines between tags. |
| 49 |
for (var tag in tags) { |
for (var tag in tags) { |
| 50 |
if (tag == 'pre') { |
if (tag == 'pre') { |
| 51 |
continue; |
continue; |
| 61 |
} |
} |
| 62 |
else { |
else { |
| 63 |
// No indents or linebreaks; |
// No indents or linebreaks; |
| 64 |
for (var key in tags) { |
for (var tag in tags) { |
| 65 |
if (tag == 'pre') { |
if (tag == 'pre') { |
| 66 |
continue; |
continue; |
| 67 |
} |
} |
| 79 |
pluginsLoaded: function(ev) { |
pluginsLoaded: function(ev) { |
| 80 |
// Override the conversion methods to let Drupal plugins modify the data. |
// Override the conversion methods to let Drupal plugins modify the data. |
| 81 |
var editor = ev.editor; |
var editor = ev.editor; |
| 82 |
if (editor.dataProcessor) { |
if (editor.dataProcessor && Drupal.settings.wysiwyg.plugins[params.format]) { |
| 83 |
editor.dataProcessor.toHtml = CKEDITOR.tools.override(editor.dataProcessor.toHtml, function(originalToHtml) { |
editor.dataProcessor.toHtml = CKEDITOR.tools.override(editor.dataProcessor.toHtml, function(originalToHtml) { |
| 84 |
// Convert raw data for display in WYSIWYG mode. |
// Convert raw data for display in WYSIWYG mode. |
| 85 |
return function(data, fixForBody) { |
return function(data, fixForBody) { |