Solving problems with CKEditor in 9.0.1FP1 and/or FP2


// Java code to define a map containing some configuration strings for the Dojo stuff
package org.openntf.xsp.dojo;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import com.ibm.xsp.context.DojoLibrary;
public class Config implements Serializable {
	private static final long serialVersionUID = -5429830701050906773L;
	private final Map<String, String> config;
	public Config() {
		this.config = new HashMap<String, String>();
		DojoLibrary dojolib = com.ibm.xsp.context.DojoLibraryFactory.getDefaultLibrary();
		
		// get the current version of Dojo
		config.put("version", dojolib.getVersion().toString());
		// get the keyword for setting toolbar options
		config.put("toolbartype", dojolib.getVersion().toString().indexOf("1.9") == -1 ? "toolbarType" : "toolbar");
		// to be extended...
	}
	public Map<String, String> getConfig() {
		return config;
	}
}
<!-- faces-config.xml -->
<managed-bean>
		<managed-bean-name>dojo</managed-bean-name>
		<managed-bean-class>org.openntf.xsp.dojo.Config
		</managed-bean-class>
		<managed-bean-scope>view</managed-bean-scope>
</managed-bean>
<!-- example using the Richtext control -->
<xp:inputRichText id="inputRichText1"
					value="#{sessionScope.editor}">
					<xp:this.dojoAttributes>
						<xp:dojoAttribute name="extraPlugins"
							value="autogrow">
						</xp:dojoAttribute>
						<xp:dojoAttribute value="Full">
							<xp:this.name><![CDATA[#{javascript:dojo.config.get("toolbartype")}]]></xp:this.name>
			</xp:dojoAttribute>
	</xp:this.dojoAttributes>
</xp:inputRichText>
All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.
No comments yetLogin first to comment...