2013-10-07 27 views
3

我正在開發一個自定義容器組件在Adobe CQ5.5,我想有一個自定義消息作爲佔位符,而不是默認的「拖動組件或資產在這裏」。cq:emptyText不工作在Adobe CQ5.5

我發現到現在爲止,我必須添加cq:emptyText =「我的自定義佔位符消息」。可能我錯過了一些東西,因爲這個屬性被完全忽略。這裏是我的組件的文件夾結構基金:

  • [clientlib]
  • .content.xml
  • _cq_editConfig.xml
  • dialog.xml
  • myContainer.jsp

根據Adobe's official tutorials和也this wonderful tutorial for building an Accordion container,cq:emptyText應該進入_cq_editConfig.xml文件:

<?xml version="1.0" encoding="UTF-8"?> 
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" 
    cq:actions="[edit]" 
    cq:dialogMode="floating" 
    cq:emptyText="Drag My Custom components here" 
    jcr:primaryType="cq:EditConfig"> 
    <cq:listeners 
     jcr:primaryType="cq:EditListenersConfig" 
     afteredit="REFRESH_PAGE"/> 
</jcr:root> 

不幸的是,即使包含cq:emptyText,我仍然看到默認的佔位符文本。

任何幫助將不勝感激!

謝謝!

Stan。


UPDATE:

託梅克的建議後,我仍然得到「拖放組件或資產在這裏」,而不是我的自定義消息,所以我仍然尋找一個答案。我的組件的文件結構現在看起來是這樣的: - [clientlib] - [新] ---- .content.xml ---- _cq_editConfig.xml - .content.xml - _cq_editConfig.xml - 對話.XML - tabContainer.jsp

.content.xml

<?xml version="1.0" encoding="UTF-8"?> 
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" 
    cq:isContainer="{Boolean}true" 
    jcr:primaryType="cq:Component" 
    jcr:title="Tab Container" 
    jcr:description="Container component for tab pages" 
    sling:resourceSuperType="foundation/components/parsys" 
    componentGroup="MyComponents"/> 

_cq_editConfig.xml

<?xml version="1.0" encoding="UTF-8"?> 
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" 
    cq:actions="[edit]" 
    cq:dialogMode="floating" 
    jcr:primaryType="cq:EditConfig"> 
    <cq:listeners 
     jcr:primaryType="cq:EditListenersConfig" 
     afteredit="REFRESH_PAGE"/> 
</jcr:root> 

新/ .content.xml

<?xml version="1.0" encoding="UTF-8"?> 
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" 
    jcr:primaryType="cq:Component" 
    jcr:title="New Paragraph" 
    sling:resourceType="foundation/components/parsys/new" 
    componentGroup=".hidden"/> 

新/ _cq_editConfig.xml

<?xml version="1.0" encoding="UTF-8"?> 
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" 
    cq:actions="[_clear,insert]" 
    cq:emptyText="Drag My Custom components here" 
    jcr:primaryType="cq:EditConfig" /> 

回答

2

該容器通常稱爲段落系統parsys。你應該有這樣的結構:

.content。XML

<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" 
    cq:isContainer="{Boolean}true" 
    jcr:primaryType="cq:Component" 
    jcr:title="Your title" 
    sling:resourceSuperType="foundation/components/parsys" /> 

新/ .content.xml

<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" 
    jcr:primaryType="cq:Component" 
    jcr:title="New Paragraph" 
    sling:resourceType="foundation/components/parsys/new" 
    componentGroup=".hidden"/> 

新/ _cq_editConfig.xml

<?xml version="1.0" encoding="UTF-8"?> 
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" 
    cq:actions="[_clear,insert]" 
    cq:emptyText="Drag My Custom components here" 
    jcr:primaryType="cq:EditConfig"/> 

所以,你需要創建new子目錄,以您的組件和應將該屬性添加到文件new/_cq_editConfig.xml

+0

感謝您的回覆Tomek。我做了你所建議的一切,但我仍然只看到默認的「在這裏拖動你的組件或資產」。有關更多信息,請參閱上面的更新,我無法將所有內容都放在此處。 – Stan

4

當你正在實施parsys,你需要以下結構,託梅克Rękawek建議:

.content.xml這裏的重要組成部分,是resourceSuperType

<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" 
    cq:isContainer="{Boolean}true" 
    jcr:primaryType="cq:Component" 
    jcr:title="Your title" 
    sling:resourceSuperType="foundation/components/parsys" /> 

new/.content.xml

<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" 
    jcr:primaryType="cq:Component" 
    jcr:title="New Paragraph" 
    sling:resourceType="foundation/components/parsys/new" 
    componentGroup=".hidden"/> 

新/ _cq_editConfig.xml這就是你想設置cq:emptyText屬性

<?xml version="1.0" encoding="UTF-8"?> 
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" 
    cq:actions="[_clear,insert]" 
    cq:emptyText="Drag My Custom components here" 
    jcr:primaryType="cq:EditConfig"/> 

在這一刻我沒有在組件上得到「拖到這裏我的自定義組件」文本佔位符。什麼做的把戲對我來說是與以下內容創建new/new.jsp

新/ new.jsp

<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" 
%><%@include file="/libs/foundation/global.jsp" 
%><%@ page session="false" import=" 
    com.day.cq.wcm.api.components.EditContext" %><% 

    editContext.getEditConfig().setEmpty(true); 
%> 

然後,我能看到空文本我new/_cq_editConfig.xml設置。我已經在CQ5.6上測試過了。

希望這會有所幫助。

+0

感謝您的回覆!我添加了new/new.jsp,但仍然沒有效果:-(。我在5.6.1上運行,這意味着可能有某個設置可能需要打開。我正在使用完全相同的文件 – Stan

+0

@stan,我正在運行5.6.1這個答案對我有效 – santiagozky

+0

正如我所說的,可能有其他的東西阻止我顯示文本並最終停止嘗試。 – Stan

相關問題