Chuyển đến nội dung chính

[RICHTEXT] Prevent richtext to remove id attribute in a DIV

Issue:

Id attribute of Div tag is stripped in Rich text component. How do we handled this. Any help regarding this appreciated?


Solution 1 (before CQ5.6):

Setting property idAttribMode (on htmlRules -> serializer -> config) to "keep" should prevent removing the id attributes

Make:

1) Under /apps/<yourApplication>/<yourComponent>/dialog/items create htmlRules/serializer/config nodes of type nt:unstructured. So, will end up with /apps/<yourApplication>/<yourComponent>/dialog/items/htmlRules/serializer/config.
2) Under "config" node create idAttribMode property and set it to "keep".


It will be like:
<htmlRules jcr:primaryType="nt:unstructured">
.
.
.
<serializer jcr:primaryType="nt:unstructured">
<config
jcr:primaryType="nt:unstructured"
idAttribMode="keep"/>
</serializer>
.
.
.
</htmlRules>


Solution 2 (from CQ5.6):

Create a folder structure similar to "/libs/cq/ui/rte/core/HtmlSerializer.js"  in apps as "/apps/cq/ui/rte/core/HtmlSerializer.js". Make sure that the folder structure and node types are as same as in libs. Then set "idAttribMode" to "keep" in "_init" function of HtmlSerializer.js. It will work.


Solution 3:

If 2 above solutions don't work, you should use "htmleditor" instead of "richtext".

Ref: http://blogs.adobe.com/contentmanagement/tag/richtext/

Nhận xét

Bài đăng phổ biến từ blog này

How to custom CQ Login Module

In order to manage the login process in our project, we will use a custom CQ Login Module. We will admit the root URL of CQ instance is: http://localhost:4502/ . This value may change depending of your environment. The %CQ_HOME% variable we will mention refers to the CQ install path. It admits you have defined %CQ_HOME% as an environment variable. 1.         Update the repository definitions The login module must be referenced in the repository definitions. You have to edit the next file: %CQ_HOME%/crx-quickstart/repository/repository.xml Do a copy of repository.xml to repository.xml.original In repostiory.xml, replace  security  part of repository.xml with following: <Security appName="com.day.crx">         <SecurityManager class="com.day.crx.core.CRXSecurityManager"> <WorkspaceAccessManager class="org.apache.jackrabbit.core.security.simple.SimpleWorkspaceAccessManager"/>  ...

[DAM] Custom DAM management / Add 'Alt' into images

Issue: We need, for each asset to be able to edit the ‘alt’ text. The ‘alt’ text must be used on the site each time an asset is displayed. When displaying an asset, the mechanism is the following : -       Get the Locale from the request -       When getting the asset, get the associated Alt property corresponding to the locale. -       Populate the alt attribute with this value. Resolution: To achieve this, we can customize the DAM Asset Editor. The AssetEditor is the form used to input asset properties and metadata. Below is a screenshot of a customized form with four “alt” input (for four different locales). The DAM uses the following nodes to render Asset Editor forms: -       /libs/dam/content/asseteditors/formitems -       /libs/dam/content/asseteditors/images/formitems -      ...

[COMPONENT] What is the automatically generated div tag around a component used for / How to remove DIV tag is generated by CQ

Question: If a component is included for example by the <cq:include> tag, a div tag is added automatically around the component in the generated HTML. What is this div tag used for and is it possible to suppress the automatic creation of it? Resolution: Add the below code in to global.jsp, which you include for all the component jsp's. if (WCMMode.fromRequest(request) != WCMMode.EDIT && WCMMode.fromRequest(request) != WCMMode.DESIGN) {          IncludeOptions.getOptions(request, true).forceSameContext(Boolean.TRUE); } This will not generate any more extra <div> tags for any number of components you add. Reference: This div tag is used for the editing system of CQ5 (drawing the edit bars, rollover frames etc), the Designer system of CQ5 (set CSS class name, Designer CSS styling) and also for identifying the component in the client DOM. It's possible to suppress this generated div tag either...