小编sam*_*024的帖子

删除装饰标签aem

如何仅在 AEM 的预览/发布模式下轻松删除装饰标签?

我看过问答:AEM/CQ: Conditional CSS class on decoration tag

这会删除装饰但阻止我编辑组件,因为它也删除了编辑和设计模式下的装饰。需要什么条件才能仅删除预览/发布中的装饰标签?

我还看到可以将以下代码添加到我的 java-use 类的 activate 方法中:

if (!getWcmMode().isEdit() && !getWcmMode().isDesign()) {
           IncludeOptions.getOptions(getRequest(), true).setDecorationTagName("");
    }
Run Code Online (Sandbox Code Playgroud)

这将删除除一个装饰标签之外的所有标签,请参见下面的示例:

wcmmode=disabled 中的 HTML 没有激活方法中的上述代码:

<ul class="timeline">
    <div class="section timelineTag">
    <div class="section timelineTag">
    <div class="section timelineTag">
    <li class="clear"></li>
</ul>
Run Code Online (Sandbox Code Playgroud)

wcmmode=disabled 中的 HTML 在 activate 方法中使用上述代码:

<ul class="timeline">
    <div class="section timelineTag">
    <li class="event" href="#">
    <li class="event" href="#">
    <li class="clear"></li>
</ul>
Run Code Online (Sandbox Code Playgroud)

如何删除 ul 中的第一个装饰 DIV 标记,因为当我将指定的代码添加到 activate 方法时它不会消失?

根据此处的要求,详细查看相关组件(2015 年 7 月 5 日更新):

Java类

public class …
Run Code Online (Sandbox Code Playgroud)

aem sightly

5
推荐指数
1
解决办法
9553
查看次数

标签 统计

aem ×1

sightly ×1