Jahia Dev Forum > Simple text editor...

0 (0 Good)
0 (0 Bad)

Simple text editor for bigtext field

by  xvik »  2011/06/07 20:42

Hello,

Jahia by default loads FCK editor for bigText fields.
Is it possible to set simple text editor for bigText field?

I hope there should be simple parameter for cnd, e.g.
bigText text (simpletext)

  (xvik)

Number of messages  5
Registration date
0 (0 Good)
0 (0 Bad)

Re: Simple text editor for bigtext field

by  pap@commaro.com »  2011/06/07 20:42

 

Hello,

 

what you suggest should be possible only if you do some code changes in Jahia. As far as I know, there is no default "simpletext" selector implemented and the selectors can also not be extended by configuration.

 

But you could try a different approach. If simpletext editor needs to be the default editor for ALL bigtext fields in your site, then you could edit WEB-INF\etc\htmleditors\htmleditors_config.xml and simply change the order and the <rank> setting of the editors. The one with rank=1 should be the default one.

 

If you want to display the simpletext editor just for certain bigtext fields, you could solve it with an event-listener. For instance you could create a file called eventlistener.jsp and place it in the root folder of your templates.

 

The following example sets "simpletext" as default editor for all bigtext fields in containers with definition name: "web_templates_home_columnB_box_textContainer" . You can modify this check, so that it fits your needs.

<%@ page contentType="text/html" language="java" %>

<%@ page import="org.jahia.content.*" %>

<%@ page import="org.jahia.data.*" %>

<%@ page import="org.jahia.data.containers.*" %>

<%@ page import="org.jahia.data.events.*" %>

<%@ page import="org.jahia.data.fields.*" %>

<%@ page import="org.jahia.params.*" %>


<% 

   String eventName = (String) request.getAttribute("eventName");

   JahiaEvent jahiaEvent = (JahiaEvent) request.getAttribute("jahiaEvent");

   JahiaData jahiaData = jahiaEvent.getJahiaData() != null ? jahiaEvent.getJahiaData() : null;

   ProcessingContext jParams = jahiaEvent.getProcessingContext();

   

   if ("addContainerEngineAfterInit".equals(eventName) || "updateContainerEngineAfterInit".equals(eventName)) {

       JahiaContainer theContainer = (JahiaContainer)jahiaEvent.getObject();

       if ( "web_templates_home_columnB_box_textContainer".equals(theContainer.getDefinition().getName()) ) {

           jParams.setParameter("htmlEditor", "simpletext");

       }

   }

%>

Regards,

Benjamin

Benjamin Papez (pap@commaro.com)

Number of messages  220
Registration date
Contact
Share
Feedback

Get in touch

Whether you are a current user or if you are just evaluating Jahia, we are here to help.

Contact us

Share this page