inputEx Documentation
Back to homepage
inputEx Documentation
> RTEField.js
0.2.2
This is the source view for RTEField.js
(function() { var inputEx = YAHOO.inputEx, lang = YAHOO.lang; /** * @class Wrapper for the Rich Text Editor from YUI * @extends inputEx.Field * @constructor * @param {Object} options Added options: *
*
opts: the options to be added when calling the RTE constructor (see YUI RTE)
*
type: if == 'simple', the field will use the SimpleEditor. Any other value will use the Editor class.
*
*/ inputEx.RTEField = function(options) { inputEx.RTEField.superclass.constructor.call(this,options); }; lang.extend(inputEx.RTEField, inputEx.Field, /** * @scope inputEx.RTEField.prototype */ { /** * Set the default values of the options * @param {Object} options Options object (inputEx inputParams) as passed to the constructor */ setOptions: function(options) { inputEx.RTEField.superclass.setOptions.call(this, options); this.options.opts = options.opts || {}; this.options.type = options.type; }, /** * Render the field using the YUI Editor widget */ renderComponent: function() { if(!inputEx.RTEfieldsNumber) { inputEx.RTEfieldsNumber = 0; } var id = "inputEx-RTEField-"+inputEx.RTEfieldsNumber; var attributes = {id:id}; if(this.options.name) attributes.name = this.options.name; this.el = inputEx.cn('textarea', attributes); inputEx.RTEfieldsNumber += 1; this.fieldContainer.appendChild(this.el); //This is the default config var _def = { height: '300px', width: '580px', dompath: true }; //The options object var o = this.options.opts; //Walk it to set the new config object for (var i in o) { if (lang.hasOwnProperty(o, i)) { _def[i] = o[i]; } } //Check if options.type is present and set to simple, if it is use SimpleEditor instead of Editor var editorType = ((this.options.type && (this.options.type == 'simple')) ? YAHOO.widget.SimpleEditor : YAHOO.widget.Editor); //If this fails then the code is not loaded on the page if (editorType) { this.editor = new editorType(id, _def); this.editor.render(); } else { alert('Editor is not on the page'); } }, /** * Set the html content * @param {String} value The html string * @param {boolean} [sendUpdatedEvt] (optional) Wether this setValue should fire the updatedEvt or not (default is true, pass false to NOT send the event) */ setValue: function(value, sendUpdatedEvt) { if(this.editor) { var iframeId = this.el.id+"_editor"; // if editor iframe not rendered if (!YAHOO.util.Dom.get(iframeId)) { // put value in textarea : will be processed by this.editor._setInitialContent (clean html, etc...) this.el.value = value; } else { this.editor.setEditorHTML(value); } } if(sendUpdatedEvt !== false) { // fire update event this.fireUpdatedEvt(); } }, /** * Get the html string * @return {String} the html string */ getValue: function() { try { this.editor.saveHTML(); return this.el.value; } catch(ex) {} } }); /** * Register this class as "html" type */ inputEx.registerType("html", inputEx.RTEField); })();
Pages
Index
Getting Started
Overview
Markup structure
Migrate from 0.1.0
Field development
DOM functions
Internationalization
Visualization
Examples
Classes
(treeview)
inputEx
inputEx.AutoComplete
inputEx.BirthdateField
inputEx.CheckBox
inputEx.ColorField
inputEx.ColorField2
inputEx.CombineField
inputEx.DateField
inputEx.DatePickerField
inputEx.DateSplitField
inputEx.DateTimeField
inputEx.DSSelectField
inputEx.EmailField
inputEx.Field
inputEx.FileField
inputEx.Form
inputEx.formForMethod
inputEx.FrenchDate
inputEx.FrenchPhone
inputEx.generateServiceForm
inputEx.Group
inputEx.HiddenField
inputEx.ImagemapField
inputEx.InPlaceEdit
inputEx.IntegerField
inputEx.IPv4Field
inputEx.JsonSchema
inputEx.JsonSchema.Builder
inputEx.ListField
inputEx.MapField
inputEx.MenuField
inputEx.MultiAutoComplete
inputEx.MultiSelectField
inputEx.NumberField
inputEx.PairField
inputEx.PasswordField
inputEx.RadioButton
inputEx.RadioField
inputEx.RTEField
inputEx.SelectField
inputEx.SliderField
inputEx.StringField
inputEx.Textarea
inputEx.TimeField
inputEx.TreeField
inputEx.TypeField
inputEx.UneditableField
inputEx.UpperCaseField
inputEx.UrlField
inputEx.VectorField
inputEx.widget
inputEx.widget.DataTable
inputEx.widget.DDList
inputEx.widget.DDListItem
inputEx.widget.Dialog
inputEx.widget.InputExCellEditor
inputEx.widget.JsonTreeInspector
Files
AutoComplete.js
BirthdateField.js
CheckBox.js
ColorField.js
ColorField2.js
CombineField.js
DataTable-beta.js
DateField.js
DatePickerField.js
DateSplitField.js
DateTimeField.js
ddlist.js
Dialog-beta.js
DSSelectField.js
EmailField.js
Field.js
FileField-beta.js
Form.js
fr.js
FrenchDate.js
FrenchPhone.js
Group.js
HiddenField.js
ImagemapField.js
InPlaceEdit.js
inputex-loader.js
inputex-rpc.js
inputex.js
IntegerField.js
IPv4Field.js
it.js
json-schema.js
json-tree-inspector.js
ListField.js
MapField.js
MenuField.js
MultiAutoComplete.js
MultiSelectField.js
NumberField.js
PairField.js
PasswordField.js
RadioButton.js
RadioField.js
RTEField.js
SelectField.js
SliderField.js
StringField.js
Textarea.js
TimeField.js
TreeField.js
TypeField.js
UneditableField.js
UpperCaseField.js
UrlField.js
VectorField.js
Visus.js
Copyright (c) 2007-2009
Eric Abouaf
. All rights reserved.
Generated by
JsDoc Toolkit
2.0.0 on Wed, 04 Mar 2009 15:41:30 GMT using
neyricjslibs-template
.