Feature #19963 » rtehtmlarea_feature_10339.patch
typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php (copie de travail) | ||
---|---|---|
// Conversion array: TYPO3 button names to htmlArea button names
|
||
var $convertToolbarForHtmlAreaArray = array (
|
||
'line' => 'InsertHorizontalRule',
|
||
'chMode' => 'HtmlMode',
|
||
'showhelp' => 'ShowHelp',
|
||
'textindicator' => 'TextIndicator',
|
||
'space' => 'space',
|
typo3/sysext/rtehtmlarea/ext_localconf.php (copie de travail) | ||
---|---|---|
// Initialize plugin registration array
|
||
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins'] = array();
|
||
// Status Bar configuration
|
||
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['StatusBar'] = array();
|
||
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['StatusBar']['objectReference'] = 'EXT:'.$_EXTKEY.'/extensions/StatusBar/class.tx_rtehtmlarea_statusbar.php:&tx_rtehtmlarea_statusbar';
|
||
// Editor Mode configuration
|
||
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['EditorMode'] = array();
|
||
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['EditorMode']['objectReference'] = 'EXT:'.$_EXTKEY.'/extensions/EditorMode/class.tx_rtehtmlarea_editormode.php:&tx_rtehtmlarea_editormode';
|
||
// Inline Elements configuration
|
||
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['DefaultInline'] = array();
|
||
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['plugins']['DefaultInline']['objectReference'] = 'EXT:'.$_EXTKEY.'/extensions/DefaultInline/class.tx_rtehtmlarea_defaultinline.php:&tx_rtehtmlarea_defaultinline';
|
typo3/sysext/rtehtmlarea/extensions/EditorMode/class.tx_rtehtmlarea_editormode.php (r?vision 0) | ||
---|---|---|
<?php
|
||
/***************************************************************
|
||
* Copyright notice
|
||
*
|
||
* (c) 2009 Stanislas Rolland <typo3(arobas)sjbr.ca>
|
||
* All rights reserved
|
||
*
|
||
* This script is part of the Typo3 project. The Typo3 project is
|
||
* free software; you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation; either version 2 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* The GNU General Public License can be found at
|
||
* http://www.gnu.org/copyleft/gpl.html.
|
||
*
|
||
* This script is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
*
|
||
* This copyright notice MUST APPEAR in all copies of the script!
|
||
***************************************************************/
|
||
/**
|
||
* EditorMode plugin for htmlArea RTE
|
||
*
|
||
* @author Stanislas Rolland <typo3(arobas)sjbr.ca>
|
||
*
|
||
* TYPO3 SVN ID: $Id: class.tx_rtehtmlarea_editormode.php $
|
||
*
|
||
*/
|
||
require_once(t3lib_extMgm::extPath('rtehtmlarea').'class.tx_rtehtmlareaapi.php');
|
||
class tx_rtehtmlarea_editormode extends tx_rtehtmlareaapi {
|
||
protected $extensionKey = 'rtehtmlarea'; // The key of the extension that is extending htmlArea RTE
|
||
protected $pluginName = 'EditorMode'; // The name of the plugin registered by the extension
|
||
protected $relativePathToLocallangFile = ''; // Path to this main locallang file of the extension relative to the extension dir.
|
||
protected $relativePathToSkin = 'extensions/EditorMode/skin/htmlarea.css'; // Path to the skin (css) file relative to the extension dir.
|
||
protected $htmlAreaRTE; // Reference to the invoking object
|
||
protected $thisConfig; // Reference to RTE PageTSConfig
|
||
protected $toolbar; // Reference to RTE toolbar array
|
||
protected $LOCAL_LANG; // Frontend language array
|
||
protected $pluginButtons = 'chMode';
|
||
protected $convertToolbarForHtmlAreaArray = array (
|
||
'chMode' => 'TextMode',
|
||
);
|
||
// Requiring itself so that it is always loaded.
|
||
protected $requiredPlugins = 'EditorMode';
|
||
|
||
public function main($parentObject) {
|
||
parent::main($parentObject);
|
||
// Do not disable this plugin even if the chMode button is disabled
|
||
$this->pluginAddsButtons = false;
|
||
return true;
|
||
}
|
||
}
|
||
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/extensions/HTMLEditor/class.tx_rtehtmlarea_editormode.php']) {
|
||
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/extensions/HTMLEditor/class.tx_rtehtmlarea_editormode.php']);
|
||
}
|
||
?>
|
typo3/sysext/rtehtmlarea/extensions/EditorMode/skin/htmlarea.css (r?vision 0) | ||
---|---|---|
/* Selectors for the EditorMode plugin of htmlArea RTE */
|
||
/* TYPO3 SVN ID: $Id: htmlarea.css 2862 2008-01-05 19:32:58Z stanrolland $ */
|
||
.htmlarea .toolbar .TextMode {
|
||
background-image:url("images/ed_html.gif");
|
||
}
|
typo3/sysext/rtehtmlarea/htmlarea/htmlarea-gecko.js (copie de travail) | ||
---|---|---|
if (navigator.productSub > 20071127) {
|
||
styleEvent = (ev.attrName == "style");
|
||
}
|
||
if (target == nestedObj && editor._editMode == "wysiwyg" && styleEvent && (target.style.display == "" || target.style.display == "block")) {
|
||
if (target == nestedObj && editor.getMode() == "wysiwyg" && styleEvent && (target.style.display == "" || target.style.display == "block")) {
|
||
// Check if all affected nested elements are displayed (style.display!='none'):
|
||
if (HTMLArea.allElementsAreDisplayed(editor.nested.sorted)) {
|
||
window.setTimeout(function() {
|
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js (copie de travail) | ||
---|---|---|
else this.config = config;
|
||
this._htmlArea = null;
|
||
this._textArea = textarea;
|
||
this._editMode = "wysiwyg";
|
||
if (typeof(this._textArea) == "string") {
|
||
this._textArea = HTMLArea.getElementById("textarea", this._textArea);
|
||
}
|
||
this.plugins = {};
|
||
this._timerToolbar = null;
|
||
this.doctype = '';
|
||
... | ... | |
this.btnList = {
|
||
InsertHorizontalRule: ["Horizontal Rule", "ed_hr.gif",false, function(editor) {editor.execCommand("InsertHorizontalRule");}],
|
||
HtmlMode: ["Toggle HTML Source", "ed_html.gif", true, function(editor) {editor.execCommand("HtmlMode");}],
|
||
SelectAll: ["SelectAll", "", true, function(editor) {editor.execCommand("SelectAll");}, null, true, false]
|
||
};
|
||
// Default hotkeys
|
||
... | ... | |
// get the textarea and hide it
|
||
var textarea = this._textArea;
|
||
if (typeof(textarea) == "string") {
|
||
textarea = HTMLArea.getElementById("textarea", textarea);
|
||
this._textArea = textarea;
|
||
}
|
||
textarea.style.display = "none";
|
||
// create the editor framework and insert the editor before the textarea
|
||
... | ... | |
HTMLArea.prototype.stylesLoaded = function() {
|
||
var doc = this._doc;
|
||
var docWellFormed = true;
|
||
// check if the stylesheets have been loaded
|
||
if (this._stylesLoadedTimer) window.clearTimeout(this._stylesLoadedTimer);
|
||
var stylesAreLoaded = true;
|
||
var errorText = '';
|
||
... | ... | |
}
|
||
HTMLArea._appendToLog("[HTMLArea::initIframe]: Stylesheets successfully loaded.");
|
||
if (!this.config.fullPage) {
|
||
doc.body.style.borderWidth = "0px";
|
||
doc.body.className = "htmlarea-content-body";
|
||
try {
|
||
doc.body.innerHTML = this._textArea.value;
|
||
} catch(e) {
|
||
HTMLArea._appendToLog("[HTMLArea::initIframe]: The HTML document is not well-formed.");
|
||
alert(HTMLArea.I18N.msg["HTML-document-not-well-formed"]);
|
||
docWellFormed = false;
|
||
}
|
||
}
|
||
doc.body.style.borderWidth = "0px";
|
||
doc.body.className = "htmlarea-content-body";
|
||
// Set contents editable
|
||
if (docWellFormed) {
|
||
if (HTMLArea.is_gecko && !HTMLArea.is_safari && !HTMLArea.is_opera && !this._initEditMode()) {
|
||
return false;
|
||
}
|
||
if (HTMLArea.is_ie || HTMLArea.is_safari) {
|
||
doc.body.contentEditable = true;
|
||
}
|
||
if (HTMLArea.is_opera || HTMLArea.is_safari) {
|
||
doc.designMode = "on";
|
||
if (this._doc.queryCommandEnabled("insertbronreturn")) this._doc.execCommand("insertbronreturn", false, this.config.disableEnterParagraphs);
|
||
if (this._doc.queryCommandEnabled("styleWithCSS")) this._doc.execCommand("styleWithCSS", false, this.config.useCSS);
|
||
}
|
||
this._editMode = "wysiwyg";
|
||
if (doc.body.contentEditable || doc.designMode == "on") HTMLArea._appendToLog("[HTMLArea::initIframe]: Design mode successfully set.");
|
||
} else {
|
||
this._editMode = "textmode";
|
||
this.setMode("docnotwellformedmode");
|
||
HTMLArea._appendToLog("[HTMLArea::initIframe]: Design mode could not be set.");
|
||
}
|
||
// Initialize editor mode
|
||
this.getPluginInstance("EditorMode").init();
|
||
// set editor number in iframe and document for retrieval in event handlers
|
||
doc._editorNo = this._editorNumber;
|
||
... | ... | |
if(!ev) var ev = window.event;
|
||
var form = (ev.target) ? ev.target : ev.srcElement;
|
||
var editor = RTEarea[form._editorNumber]["editor"];
|
||
editor.setHTML(editor._textArea.value);
|
||
editor.getPluginInstance("EditorMode").setHTML(editor._textArea.value);
|
||
editor.updateToolbar();
|
||
var a = form.__msh_prevOnReset;
|
||
// call previous reset methods if they were there.
|
||
... | ... | |
if (editor) {
|
||
RTEarea[editorNumber].editor = null;
|
||
// save the HTML content into the original textarea for submit, back/forward, etc.
|
||
editor._textArea.value = editor.getHTML();
|
||
editor._textArea.value = editor.getPluginInstance("EditorMode").getHTML();
|
||
// do final cleanup
|
||
HTMLArea.cleanup(editor);
|
||
}
|
||
... | ... | |
};
|
||
/*
|
||
* Switch editor mode; parameter can be "textmode" or "wysiwyg".
|
||
* If no parameter was passed, toggle between modes.
|
||
*/
|
||
HTMLArea.prototype.setMode = function(mode) {
|
||
if (typeof(mode) == "undefined") var mode = (this._editMode == "textmode") ? "wysiwyg" : "textmode";
|
||
switch (mode) {
|
||
case "textmode":
|
||
case "docnotwellformedmode":
|
||
this._textArea.value = this.getHTML();
|
||
this._iframe.style.display = "none";
|
||
this._textArea.style.display = "block";
|
||
this._editMode = "textmode";
|
||
break;
|
||
case "wysiwyg":
|
||
if(HTMLArea.is_gecko && !HTMLArea.is_safari && !HTMLArea.is_opera) this._doc.designMode = "off";
|
||
try {
|
||
if(!this.config.fullPage) this._doc.body.innerHTML = this.getHTML();
|
||
else this.setFullHTML(this.getHTML());
|
||
} catch(e) {
|
||
alert(HTMLArea.I18N.msg["HTML-document-not-well-formed"]);
|
||
break;
|
||
}
|
||
this._textArea.style.display = "none";
|
||
this._iframe.style.display = "block";
|
||
if (HTMLArea.is_gecko && !HTMLArea.is_safari && !HTMLArea.is_opera) this._doc.designMode = "on";
|
||
this._editMode = "wysiwyg";
|
||
//set gecko options (if we can... raises exception in Firefox 3)
|
||
if (HTMLArea.is_gecko) {
|
||
try {
|
||
if (this._doc.queryCommandEnabled("insertbronreturn")) this._doc.execCommand("insertbronreturn", false, this.config.disableEnterParagraphs);
|
||
if (this._doc.queryCommandEnabled("enableObjectResizing")) this._doc.execCommand("enableObjectResizing", false, !this.config.disableObjectResizing);
|
||
if (this._doc.queryCommandEnabled("enableInlineTableEditing")) this._doc.execCommand("enableInlineTableEditing", false, (this.config.buttons.table && this.config.buttons.table.enableHandles) ? true : false);
|
||
if (this._doc.queryCommandEnabled("styleWithCSS")) this._doc.execCommand("styleWithCSS", false, this.config.useCSS);
|
||
else if (this._doc.queryCommandEnabled("useCSS")) this._doc.execCommand("useCSS", false, !this.config.useCSS);
|
||
} catch(e) {}
|
||
}
|
||
break;
|
||
default:
|
||
return false;
|
||
}
|
||
if (mode !== "docnotwellformedmode") this.focusEditor();
|
||
for (var pluginId in this.plugins) {
|
||
if (this.plugins.hasOwnProperty(pluginId)) {
|
||
var pluginInstance = this.plugins[pluginId].instance;
|
||
if (typeof(pluginInstance.onMode) === "function") {
|
||
pluginInstance.onMode(mode);
|
||
}
|
||
}
|
||
}
|
||
};
|
||
/*
|
||
* Get editor mode
|
||
*/
|
||
HTMLArea.prototype.getMode = function() {
|
||
return this._editMode;
|
||
return this.getPluginInstance("EditorMode").getEditorMode();
|
||
};
|
||
/*
|
||
... | ... | |
* Focus the editor iframe document or the textarea.
|
||
*/
|
||
HTMLArea.prototype.focusEditor = function() {
|
||
switch (this._editMode) {
|
||
switch (this.getMode()) {
|
||
case "wysiwyg" :
|
||
try {
|
||
if (HTMLArea.is_safari) {
|
||
... | ... | |
}
|
||
}
|
||
break;
|
||
case "HtmlMode":
|
||
btn.state("active", text);
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
... | ... | |
HTMLArea.prototype.execCommand = function(cmdID, UI, param) {
|
||
this.focusEditor();
|
||
switch (cmdID) {
|
||
case "HtmlMode" :
|
||
this.setMode();
|
||
break;
|
||
default :
|
||
default:
|
||
try {
|
||
this._doc.execCommand(cmdID, UI, param);
|
||
} catch(e) {
|
||
... | ... | |
};
|
||
/*
|
||
* Retrieve the HTML
|
||
* Get the html content of the current editing mode
|
||
*/
|
||
HTMLArea.prototype.getHTML = function() {
|
||
switch (this._editMode) {
|
||
case "wysiwyg":
|
||
return HTMLArea.getHTML(this._doc.body, false, this);
|
||
case "textmode":
|
||
return this._textArea.value;
|
||
}
|
||
return false;
|
||
return this.getPluginInstance("EditorMode").getHTML();
|
||
};
|
||
/*
|
||
* Retrieve raw HTML
|
||
*/
|
||
HTMLArea.prototype.getInnerHTML = function() {
|
||
switch (this._editMode) {
|
||
case "wysiwyg":
|
||
return this._doc.body.innerHTML;
|
||
case "textmode":
|
||
return this._textArea.value;
|
||
}
|
||
return false;
|
||
};
|
||
/*
|
||
* Replace the HTML inside
|
||
*/
|
||
HTMLArea.prototype.setHTML = function(html) {
|
||
switch (this._editMode) {
|
||
case "wysiwyg":
|
||
this._doc.body.innerHTML = html;
|
||
break;
|
||
case "textmode":
|
||
this._textArea.value = html;
|
||
break;
|
||
}
|
||
return false;
|
||
};
|
||
/*
|
||
* Set the given doctype when config.fullPage is true
|
||
*/
|
||
HTMLArea.prototype.setDoctype = function(doctype) {
|
||
... | ... | |
},
|
||
/**
|
||
* Returns a current editor mode
|
||
*
|
||
* @return string editor mode
|
||
*/
|
||
getEditorMode : function() {
|
||
return this.getPluginInstance("EditorMode").getEditorMode();
|
||
},
|
||
/**
|
||
* Returns true if the button is enabled in the toolbar configuration
|
||
*
|
||
* @param string buttonId: identification of the button
|
typo3/sysext/rtehtmlarea/htmlarea/plugins/BlockElements/block-elements.js (copie de travail) | ||
---|---|---|
* This function gets called when the toolbar is updated
|
||
*/
|
||
onUpdateToolbar : function () {
|
||
if (this.editor.getMode() === "textmode" || !this.editor.isEditable()) {
|
||
if (this.getEditorMode() === "textmode" || !this.editor.isEditable()) {
|
||
return false;
|
||
}
|
||
var statusBarSelection = this.editor.getPluginInstance("StatusBar") ? this.editor.getPluginInstance("StatusBar").getSelection() : null;
|
typo3/sysext/rtehtmlarea/htmlarea/plugins/BlockStyle/block-style.js (copie de travail) | ||
---|---|---|
* This function gets called when the toolbar is being updated
|
||
*/
|
||
onUpdateToolbar : function() {
|
||
if (this.editor.getMode() === "wysiwyg") {
|
||
if (this.getEditorMode() === "wysiwyg") {
|
||
this.generate(this.editor, "BlockStyle");
|
||
}
|
||
},
|
||
... | ... | |
* This function gets called when the editor has changed its mode to "wysiwyg"
|
||
*/
|
||
onMode : function(mode) {
|
||
if (this.editor.getMode() === "wysiwyg") {
|
||
if (this.getEditorMode() === "wysiwyg") {
|
||
this.generate(this.editor, "BlockStyle");
|
||
}
|
||
},
|
||
... | ... | |
* Re-initiate the parsing of the style sheets, if not yet completed, and refresh our toolbar components
|
||
*/
|
||
generate : function(editor, dropDownId) {
|
||
if (this.cssLoaded && this.editor.getMode() === "wysiwyg" && this.editor.isEditable()) {
|
||
if (this.cssLoaded && this.getEditorMode() === "wysiwyg" && this.editor.isEditable()) {
|
||
this.updateValue(dropDownId);
|
||
} else {
|
||
if (this.cssTimeout) {
|
typo3/sysext/rtehtmlarea/htmlarea/plugins/CopyPaste/copy-paste.js (copie de travail) | ||
---|---|---|
* This function gets called when the toolbar is updated
|
||
*/
|
||
onUpdateToolbar : function () {
|
||
if (this.editor.getMode() === "wysiwyg" || this.editor.isEditable()) {
|
||
if (this.getEditorMode() === "wysiwyg" || this.editor.isEditable()) {
|
||
var buttonId = "Paste";
|
||
if (typeof(this.editor._toolbarObjects[buttonId]) !== "undefined") {
|
||
try {
|
typo3/sysext/rtehtmlarea/htmlarea/plugins/DefinitionList/definition-list.js (copie de travail) | ||
---|---|---|
* This function gets called when the toolbar is updated
|
||
*/
|
||
onUpdateToolbar : function () {
|
||
if (this.editor.getMode() === "textmode" || !this.editor.isEditable()) {
|
||
if (this.getEditorMode() === "textmode" || !this.editor.isEditable()) {
|
||
return false;
|
||
}
|
||
var statusBarSelection = this.editor.getPluginInstance("StatusBar") ? this.editor.getPluginInstance("StatusBar").getSelection() : null;
|
typo3/sysext/rtehtmlarea/htmlarea/plugins/EditorMode/editor-mode.js (r?vision 0) | ||
---|---|---|
/***************************************************************
|
||
* Copyright notice
|
||
*
|
||
* (c) 2009 Stanislas Rolland <typo3(arobas)sjbr.ca>
|
||
* All rights reserved
|
||
*
|
||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||
* free software; you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation; either version 2 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* The GNU General Public License can be found at
|
||
* http://www.gnu.org/copyleft/gpl.html.
|
||
* A copy is found in the textfile GPL.txt and important notices to the license
|
||
* from the author is found in LICENSE.txt distributed with these scripts.
|
||
*
|
||
*
|
||
* This script is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
*
|
||
*
|
||
* This copyright notice MUST APPEAR in all copies of the script!
|
||
***************************************************************/
|
||
/*
|
||
* EditorMode Plugin for TYPO3 htmlArea RTE
|
||
*
|
||
* TYPO3 SVN ID: $Id: editor-mode.js $
|
||
*/
|
||
EditorMode = HTMLArea.Plugin.extend({
|
||
constructor : function(editor, pluginName) {
|
||
this.base(editor, pluginName);
|
||
},
|
||
/*
|
||
* This function gets called by the class constructor
|
||
*/
|
||
configurePlugin : function (editor) {
|
||
/*
|
||
* Registering plugin "About" information
|
||
*/
|
||
var pluginInformation = {
|
||
version : "0.1",
|
||
developer : "Stanislas Rolland",
|
||
developerUrl : "http://www.sjbr.ca/",
|
||
copyrightOwner : "Stanislas Rolland",
|
||
sponsor : "SJBR",
|
||
sponsorUrl : "http://www.sjbr.ca/",
|
||
license : "GPL"
|
||
};
|
||
this.registerPluginInformation(pluginInformation);
|
||
/*
|
||
* Registering the buttons
|
||
*/
|
||
var buttonList = this.buttonList, buttonId;
|
||
for (var i = 0, n = buttonList.length; i < n; ++i) {
|
||
var button = buttonList[i];
|
||
buttonId = button[0];
|
||
var buttonConfiguration = {
|
||
id : buttonId,
|
||
tooltip : this.localize(buttonId + "-Tooltip"),
|
||
action : "onButtonPress",
|
||
context : button[1],
|
||
textMode : (buttonId == "TextMode")
|
||
};
|
||
this.registerButton(buttonConfiguration);
|
||
}
|
||
return true;
|
||
},
|
||
/* The list of buttons added by this plugin */
|
||
buttonList : [
|
||
["TextMode", null]
|
||
],
|
||
/*
|
||
* This function gets called during the editor generation and initializes the editor mode
|
||
*
|
||
* @return void
|
||
*/
|
||
init : function () {
|
||
var doc = this.editor._doc;
|
||
// Catch error if html content is invalid
|
||
var documentIsWellFormed = true;
|
||
try {
|
||
doc.body.innerHTML = this.editor._textArea.value;
|
||
} catch(e) {
|
||
this.appendToLog("init", "The HTML document is not well-formed.");
|
||
alert(this.localize("HTML-document-not-well-formed"));
|
||
documentIsWellFormed = false;
|
||
}
|
||
// Set contents editable
|
||
if (documentIsWellFormed) {
|
||
if (HTMLArea.is_gecko && !HTMLArea.is_safari && !HTMLArea.is_opera && !this.editor._initEditMode()) {
|
||
return false;
|
||
}
|
||
if (HTMLArea.is_ie || HTMLArea.is_safari) {
|
||
doc.body.contentEditable = true;
|
||
}
|
||
if (HTMLArea.is_opera || HTMLArea.is_safari) {
|
||
doc.designMode = "on";
|
||
this.setGeckoOptions();
|
||
}
|
||
this.editorMode = "wysiwyg";
|
||
if (doc.body.contentEditable || doc.designMode == "on") {
|
||
this.appendToLog("init", "Design mode successfully set.");
|
||
}
|
||
} else {
|
||
this.editorMode = "textmode";
|
||
this.setEditorMode("docnotwellformedmode");
|
||
this.appendToLog("init", "Design mode could not be set.");
|
||
}
|
||
},
|
||
/*
|
||
* This function gets called when the editor is generated
|
||
*
|
||
* @return void
|
||
*/
|
||
onGenerate : function () {
|
||
// Set some references
|
||
this.textArea = this.editor._textArea;
|
||
this.editorBody = this.editor._doc.body;
|
||
},
|
||
/*
|
||
* This function gets called when a button was pressed.
|
||
*
|
||
* @param object editor: the editor instance
|
||
* @param string id: the button id or the key
|
||
*
|
||
* @return boolean false if action is completed
|
||
*/
|
||
onButtonPress : function (editor, id, target) {
|
||
// Could be a button or its hotkey
|
||
var buttonId = this.translateHotKey(id);
|
||
buttonId = buttonId ? buttonId : id;
|
||
this.setEditorMode((this.getEditorMode() == buttonId.toLowerCase()) ? "wysiwyg" : buttonId.toLowerCase());
|
||
return false;
|
||
},
|
||
/*
|
||
* Switch editor mode
|
||
*
|
||
* @param string "textmode" or "wysiwyg"; if no parameter was passed, toggle between modes.
|
||
* @return void
|
||
*/
|
||
setEditorMode : function (mode) {
|
||
var editor = this.editor;
|
||
switch (mode) {
|
||
case "textmode":
|
||
case "docnotwellformedmode":
|
||
this.textArea.value = this.getHTML();
|
||
editor._iframe.style.display = "none";
|
||
this.textArea.style.display = "block";
|
||
this.editorMode = "textmode";
|
||
break;
|
||
case "wysiwyg":
|
||
if (HTMLArea.is_gecko && !HTMLArea.is_safari && !HTMLArea.is_opera) {
|
||
editor._doc.designMode = "off";
|
||
}
|
||
try {
|
||
this.editorBody.innerHTML = this.getHTML();
|
||
} catch(e) {
|
||
alert(HTMLArea.I18N.msg["HTML-document-not-well-formed"]);
|
||
break;
|
||
}
|
||
this.textArea.style.display = "none";
|
||
editor._iframe.style.display = "block";
|
||
if (HTMLArea.is_gecko && !HTMLArea.is_safari && !HTMLArea.is_opera) {
|
||
editor._doc.designMode = "on";
|
||
}
|
||
this.editorMode = "wysiwyg";
|
||
this.setGeckoOptions();
|
||
break;
|
||
case "htmlmode":
|
||
this.editorMode = "htmlmode";
|
||
break;
|
||
default:
|
||
return false;
|
||
}
|
||
if (mode !== "docnotwellformedmode") {
|
||
editor.focusEditor();
|
||
}
|
||
for (var pluginId in editor.plugins) {
|
||
if (editor.plugins.hasOwnProperty(pluginId)) {
|
||
var pluginInstance = this.getPluginInstance(pluginId);
|
||
if (typeof(pluginInstance.onMode) === "function") {
|
||
pluginInstance.onMode(mode);
|
||
}
|
||
}
|
||
}
|
||
},
|
||
/*
|
||
* Set gecko editing mode options (if we can... raises exception in Firefox 3)
|
||
*
|
||
* @return void
|
||
*/
|
||
setGeckoOptions : function () {
|
||
if (HTMLArea.is_gecko) {
|
||
var doc = this.editor._doc;
|
||
var config = this.editor.config;
|
||
try {
|
||
if (doc.queryCommandEnabled("insertbronreturn")) {
|
||
doc.execCommand("insertbronreturn", false, config.disableEnterParagraphs);
|
||
}
|
||
if (doc.queryCommandEnabled("styleWithCSS")) {
|
||
doc.execCommand("styleWithCSS", false, config.useCSS);
|
||
} else if (!HTMLArea.is_opera && !HTMLArea.is_safari && doc.queryCommandEnabled("useCSS")) {
|
||
doc.execCommand("useCSS", false, !config.useCSS);
|
||
}
|
||
if (!HTMLArea.is_opera && !HTMLArea.is_safari) {
|
||
if (doc.queryCommandEnabled("enableObjectResizing")) {
|
||
doc.execCommand("enableObjectResizing", false, !config.disableObjectResizing);
|
||
}
|
||
if (doc.queryCommandEnabled("enableInlineTableEditing")) {
|
||
doc.execCommand("enableInlineTableEditing", false, (config.buttons.table && config.buttons.table.enableHandles) ? true : false);
|
||
}
|
||
}
|
||
} catch(e) {}
|
||
}
|
||
},
|
||
/*
|
||
* Get editor mode
|
||
*
|
||
* @return string the current editor mode
|
||
*/
|
||
getEditorMode : function() {
|
||
return this.editorMode;
|
||
},
|
||
/*
|
||
* This function gets called when the toolbar is updated
|
||
*
|
||
* @return void
|
||
*/
|
||
onUpdateToolbar : function () {
|
||
var buttonList = this.buttonList, buttonId;
|
||
for (var i = 0, n = buttonList.length; i < n; ++i) {
|
||
buttonId = buttonList[i][0];
|
||
if (this.isButtonInToolbar(buttonId)) {
|
||
this.editor._toolbarObjects[buttonId].state("active", (this.getEditorMode() == buttonId.toLowerCase()));
|
||
}
|
||
}
|
||
},
|
||
/*
|
||
* Retrieve the HTML
|
||
* In the case of the wysiwyg mode, the html content is parsed
|
||
*
|
||
* @return string the textual html content from the current editing mode
|
||
*/
|
||
getHTML : function () {
|
||
switch (this.editorMode) {
|
||
case "wysiwyg":
|
||
return HTMLArea.getHTML(this.editorBody, false, this.editor);
|
||
case "textmode":
|
||
return this.textArea.value;
|
||
}
|
||
return "";
|
||
},
|
||
/*
|
||
* Retrieve raw HTML
|
||
*
|
||
* @return string the textual html content from the current editing mode
|
||
*/
|
||
getInnerHTML : function () {
|
||
switch (this.editorMode) {
|
||
case "wysiwyg":
|
||
return this.editorBody.innerHTML;
|
||
case "textmode":
|
||
return this.textArea.value;
|
||
}
|
||
return "";
|
||
},
|
||
/*
|
||
* Replace the HTML inside
|
||
*
|
||
* @param string html: the textual html
|
||
* @return boolean false
|
||
*/
|
||
setHTML : function (html) {
|
||
switch (this.editorMode) {
|
||
case "wysiwyg":
|
||
this.editorBody.innerHTML = html;
|
||
break;
|
||
case "textmode":
|
||
this.textArea.value = html;
|
||
break;
|
||
}
|
||
return false;
|
||
}
|
||
});
|
typo3/sysext/rtehtmlarea/htmlarea/plugins/EditorMode/locallang.xml (r?vision 0) | ||
---|---|---|
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||
<T3locallang>
|
||
<meta type="array">
|
||
<description>Labels for Editor Mode plugin of htmlArea RTE</description>
|
||
<type>module</type>
|
||
</meta>
|
||
<data type="array">
|
||
<languageKey index="default" type="array">
|
||
<label index="TextMode-Tooltip">Toggle text mode</label>
|
||
<label index="HTMLMode-Tooltip">Toggle HTML mode</label>
|
||
</languageKey>
|
||
</data>
|
||
<orig_hash type="array">
|
||
<languageKey index="default" type="array">
|
||
</languageKey>
|
||
</orig_hash>
|
||
<orig_text type="array">
|
||
<languageKey index="default" type="array">
|
||
</languageKey>
|
||
</orig_text>
|
||
</T3locallang>
|
typo3/sysext/rtehtmlarea/htmlarea/plugins/InlineElements/inline-elements.js (copie de travail) | ||
---|---|---|
*/
|
||
onUpdateToolbar : function () {
|
||
var editor = this.editor;
|
||
if (editor.getMode() === "wysiwyg" && editor.isEditable()) {
|
||
if (this.getEditorMode() === "wysiwyg" && editor.isEditable()) {
|
||
var id, activeButton;
|
||
var tagName = false, endPointsInSameBlock = true, fullNodeSelected = false;
|
||
var sel = editor._getSelection();
|
typo3/sysext/rtehtmlarea/htmlarea/plugins/Language/language.js (copie de travail) | ||
---|---|---|
* This function gets called when the toolbar is updated
|
||
*/
|
||
onUpdateToolbar : function () {
|
||
if (this.editor.getMode() === "wysiwyg" && this.editor.isEditable()) {
|
||
if (this.getEditorMode() === "wysiwyg" && this.editor.isEditable()) {
|
||
var selection = this.editor._getSelection();
|
||
var statusBarSelection = this.editor.getPluginInstance("StatusBar") ? this.editor.getPluginInstance("StatusBar").getSelection() : null;
|
||
var range = this.editor._createRange(selection);
|
typo3/sysext/rtehtmlarea/htmlarea/plugins/StatusBar/status-bar.js (copie de travail) | ||
---|---|---|
* Update the status bar
|
||
*/
|
||
onUpdateToolbar : function() {
|
||
if (this.editor.getMode() == "wysiwyg" && !this.noUpdate) {
|
||
if (this.getEditorMode() == "wysiwyg" && !this.noUpdate) {
|
||
var text,
|
||
language,
|
||
languageObject = this.editor.getPluginInstance("Language"),
|
typo3/sysext/rtehtmlarea/htmlarea/plugins/TableOperations/table-operations.js (copie de travail) | ||
---|---|---|
* This function gets called when the toolbar is being updated
|
||
*/
|
||
onUpdateToolbar : function() {
|
||
if (this.editor.getMode() === "wysiwyg" && this.editor.isEditable() && this.isButtonInToolbar("TO-toggle-borders")) {
|
||
if (this.getEditorMode() === "wysiwyg" && this.editor.isEditable() && this.isButtonInToolbar("TO-toggle-borders")) {
|
||
this.editor._toolbarObjects["TO-toggle-borders"].state("active", HTMLArea._hasClass(this.editor._doc.body, 'htmlarea-showtableborders'));
|
||
}
|
||
},
|
typo3/sysext/rtehtmlarea/htmlarea/plugins/TextStyle/text-style.js (copie de travail) | ||
---|---|---|
* This function gets called when the toolbar is being updated
|
||
*/
|
||
onUpdateToolbar : function() {
|
||
if (this.editor.getMode() === "wysiwyg" && this.editor.isEditable()) {
|
||
if (this.getEditorMode() === "wysiwyg" && this.editor.isEditable()) {
|
||
this.generate(this.editor, "TextStyle");
|
||
}
|
||
},
|
||
... | ... | |
*/
|
||
updateToolbar : function(dropDownId) {
|
||
var editor = this.editor;
|
||
if (this.editor.getMode() === "wysiwyg" && this.editor.isEditable()) {
|
||
if (this.getEditorMode() === "wysiwyg" && this.editor.isEditable()) {
|
||
var tagName = false, classNames = Array(), fullNodeSelected = false;
|
||
var selection = editor._getSelection();
|
||
var statusBarSelection = editor.getPluginInstance("StatusBar") ? editor.getPluginInstance("StatusBar").getSelection() : null;
|
typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Color/typo3color.js (copie de travail) | ||
---|---|---|
*/
|
||
onUpdateToolbar : function () {
|
||
var editor = this.editor;
|
||
if (editor.getMode() === "wysiwyg" && editor.isEditable()) {
|
||
if (this.getEditorMode() === "wysiwyg" && editor.isEditable()) {
|
||
var buttonId;
|
||
var statusBarSelection = editor.getPluginInstance("StatusBar") ? editor.getPluginInstance("StatusBar").getSelection() : null;
|
||
var parentElement = statusBarSelection ? statusBarSelection : editor.getParentElement();
|
typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3HtmlParser/typo3html-parser.js (copie de travail) | ||
---|---|---|
var bookmark = editor.getBookmark(editor._createRange(editor._getSelection()));
|
||
var content = {
|
||
editorNo : this.editorNumber,
|
||
content : editor._doc.body.innerHTML
|
||
content : this.getPluginInstance("EditorMode").getInnerHTML()
|
||
};
|
||
this.postData( this.parseHtmlModulePath,
|
||
content,
|
||
function(response) {
|
||
editor.setHTML(response);
|
||
editor.getPluginInstance("EditorMode").setHTML(response);
|
||
editor.selectRange(editor.moveToBookmark(bookmark));
|
||
}
|
||
);
|
typo3/sysext/rtehtmlarea/htmlarea/plugins/UndoRedo/undo-redo.js (copie de travail) | ||
---|---|---|
newSnapshot = true;
|
||
}
|
||
// Get the html text
|
||
var text = this.editor.getInnerHTML();
|
||
var text = this.getPluginInstance("EditorMode").getInnerHTML();
|
||
|
||
if (newSnapshot) {
|
||
// If previous slot contains the same text, a new one should not be used
|
||
... | ... | |
}
|
||
// Get the bookmarked html text and remove the bookmark
|
||
if (bookmark) {
|
||
bookmarkedText = this.editor.getInnerHTML();
|
||
bookmarkedText = this.getPluginInstance("EditorMode").getInnerHTML();
|
||
var range = this.editor.moveToBookmark(bookmark);
|
||
// Restore Firefox selection
|
||
if (HTMLArea.is_gecko && !HTMLArea.is_opera && !HTMLArea.is_safari) {
|
||
... | ... | |
}
|
||
}
|
||
return {
|
||
text : this.editor.getInnerHTML(),
|
||
text : this.getPluginInstance("EditorMode").getInnerHTML(),
|
||
bookmark : bookmark,
|
||
bookmarkedText : bookmarkedText
|
||
};
|
||
... | ... | |
setContent : function (undoPosition) {
|
||
var bookmark = this.undoQueue[undoPosition].bookmark;
|
||
if (bookmark) {
|
||
this.editor.setHTML(this.undoQueue[undoPosition].bookmarkedText);
|
||
this.getPluginInstance("EditorMode").setHTML(this.undoQueue[undoPosition].bookmarkedText);
|
||
this.editor.focusEditor();
|
||
this.editor.selectRange(this.editor.moveToBookmark(bookmark));
|
||
this.editor.scrollToCaret();
|
||
} else {
|
||
this.editor.setHTML(this.undoQueue[undoPosition].text);
|
||
this.getPluginInstance("EditorMode").setHTML(this.undoQueue[undoPosition].text);
|
||
}
|
||
},
|
||
|
typo3/sysext/rtehtmlarea/htmlarea/skins/default/htmlarea.css (copie de travail) | ||
---|---|---|
.htmlarea .toolbar .Acronym { background-image:url("images/Acronym/ed_acronym.gif"); }
|
||
.htmlarea .toolbar .RemoveFormat { background-image:url("images/RemoveFormat/ed_clean.gif"); }
|
||
.htmlarea .toolbar .SplitBlock {background-image:url("images/ed_splitblock.gif"); }
|
||
.htmlarea .toolbar .HtmlMode { background-image:url("images/ed_html.gif"); }
|
||
.htmlarea .toolbar .TextMode { background-image:url("images/ed_html.gif"); }
|
||
.htmlarea .toolbar .Copy, .htmlarea-context-menu .Copy { background-image:url("images/ed_copy.gif");}
|
||
.htmlarea .toolbar .Cut, .htmlarea-context-menu .Cut { background-image:url("images/ed_cut.gif");}
|
||
.htmlarea .toolbar .Paste, .htmlarea-context-menu .Paste { background-image:url("images/ed_paste.gif");}
|
typo3/sysext/t3skin/rtehtmlarea/htmlarea.css (copie de travail) | ||
---|---|---|
.htmlarea .toolbar .Acronym {background-image:url("images/Acronym/ed_acronym.gif"); }
|
||
.htmlarea .toolbar .RemoveFormat {background-image:url("images/RemoveFormat/ed_clean.gif"); }
|
||
.htmlarea .toolbar .SplitBlock {background-image:url("images/ed_splitblock.gif"); }
|
||
.htmlarea .toolbar .HtmlMode {background-image:url("images/ed_html.gif"); }
|
||
.htmlarea .toolbar .TextMode {background-image:url("images/ed_html.gif"); }
|
||
.htmlarea .toolbar .Copy, .htmlarea-context-menu .Copy {background-image:url("images/ed_copy.gif");}
|
||
.htmlarea .toolbar .Cut, .htmlarea-context-menu .Cut {background-image:url("images/ed_cut.gif");}
|
||
.htmlarea .toolbar .Paste, .htmlarea-context-menu .Paste {background-image:url("images/ed_paste.gif");}
|