? Pending

User tests: Successful: Unsuccessful:

avatar dgt41
dgt41
13 Mar 2017

Pull Request for Issue # .

Summary of Changes

Since #12561 Joomla has a set of (client side) methods to deal with the editors contents therefore creating javascript code for that is useless!

Always use the API

as explained in full in media/system/core.js:

// Only define the Joomla namespace if not defined.
Joomla = window.Joomla || {};

// Only define editors if not defined
Joomla.editors = Joomla.editors || {};

// An object to hold each editor instance on page, only define if not defined.
Joomla.editors.instances = Joomla.editors.instances || {
	/**
	 * *****************************************************************
	 * All Editors MUST register, per instance, the following callbacks:
	 * *****************************************************************
	 *
	 * getValue         Type  Function  Should return the complete data from the editor
	 *                                  Example: function () { return this.element.value; }
	 * setValue         Type  Function  Should replace the complete data of the editor
	 *                                  Example: function (text) { return this.element.value = text; }
	 * replaceSelection Type  Function  Should replace the selected text of the editor
	 *                                  If nothing selected, will insert the data at the cursor
	 *                                  Example: function (text) { return insertAtCursor(this.element, text); }
	 *
	 * USAGE (assuming that jform_articletext is the textarea id)
	 * {
	 *   To get the current editor value:
	 *      Joomla.editors.instances['jform_articletext'].getValue();
	 *   To set the current editor value:
	 *      Joomla.editors.instances['jform_articletext'].setValue('Joomla! rocks');
	 *   To replace(selection) or insert a value at  the current editor cursor:
	 *      replaceSelection: Joomla.editors.instances['jform_articletext'].replaceSelection('Joomla! rocks')
	 * }
	 *
	 * *********************************************************
	 * ANY INTERACTION WITH THE EDITORS SHOULD USE THE ABOVE API
	 * *********************************************************
	 *
	 * jInsertEditorText() @deprecated 4.0
	 */
	};

For further examples please check the XTD-buttons!

Testing Instructions

Code review

Documentation Changes Required

avatar dgt41 dgt41 - open - 13 Mar 2017
avatar dgt41 dgt41 - change - 13 Mar 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 13 Mar 2017
Category Libraries
avatar dgt41 dgt41 - change - 15 Apr 2017
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2017-04-15 15:54:31
Closed_By dgt41
Labels Added: ?
avatar dgt41 dgt41 - close - 15 Apr 2017

Add a Comment

Login with GitHub to post a comment