10671

How to insert text to editor programmatically in Joomla?

Question:

I am using joomla 1.7 and I am made a custom button (editor-xtd plugin) that I want to insert some string into the current editor content.

Like in the Readmore button. I have searched through the Readmore code and found :

$js = " function insertReadmore(editor) { var content = $getContent if (content.match(/<hr\s+id=(\"|')system-readmore(\"|')\s*\/*>/i)) { alert('$present'); return false; } else { jInsertEditorText('<hr id=\"system-readmore\" />', editor); } } ";

now when I try to call jInsertEditorText, I seem to get an error that's it's missing. some forum suggested I import mootools.js, but that didn't seem to do the trick.

Where can I find it or is there some other approach?

Answer1:

jInsertEditorText is defined by the editor, not in mootools. Try using TinyMCE editor or JCE, both support it fully.

Recommend

  • Google app script : Separating HTML and CSS
  • Android textview stackoverflow when using Hebrew
  • Why doesn't the following regex work when input through Spring
  • Retrieving Data in Java
  • Google Apps Script Web App: Can't separate out css and js code
  • Download Google Docs file from Google Drive with java
  • Can not cast IMAPInputStream to Multipart
  • New BFC “clearing” floating boxes
  • Howto take a glimpse into mscorlib?
  • doPostBack from C# with JavaScript
  • What is “PHP-standardized” version number strings?
  • Remove “\\n” from a string, but leave the actual linebreaks?
  • Generating random numbers directly inside a .htaccess file
  • passing a javascript variable to PHP with xmlhttprequest
  • How to create virtual printer with iOS Simulator?
  • Do I need to seed any random number generator before using EVP_PKEY_keygen of OpenSSL?
  • req.body is undefined - nodejs
  • Modifying destination and filename of gulp-svg-sprite
  • Importing jscolor library in angular 2
  • jquery mobile loadPage not working
  • jqPlot EnhancedLegendRenderer plugin does not toggle series for Pie charts
  • How to delete a row from a dynamic generate table using jquery?
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • Acquiring multiple attributes from .xml file in c#
  • using HTMLImports.whenReady not working in chrome
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • How to stop GridView from loading again when I press back button?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Authorize attributes not working in MVC 4
  • How can I remove ASP.NET Designer.cs files?
  • EntityFramework adding new object to nested object collection
  • costura.fody for a dll that references another dll
  • Binding checkboxes to object values in AngularJs
  • Observable and ngFor in Angular 2
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal
  • Net Present Value in Excel for Grouped Recurring CF
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?