Adobe CQ Image Coponent fileName

最后都变了- 提交于 2019-12-25 04:48:33

问题


I created a new Adobe CQ 5.6.1 Project using the Maven archetype, then created a page component, and a cq:Page that uses that page component as the sling:resourceType. The page component has a

<cq:include path="par" resourceType="foundation/components/parsys" />

and the design for that par has the attribute

components="[/libs/foundation/components/image,/libs/foundation/components/download]"

Everything is fine, I can load the page, in the sidekick I see the Image and Download components and am able to drag them into the par.

The Problem

When I edit the Download component, I select a file from my file system which gets uploaded to the CRX into a file node. The parent of this file node gets a property called fileName which reflects the file name of the uploaded file.

When I edit the Image component, it behaves the same way by taking the file I selected from my file system and uploading it to a file node, however there is not fileName property set.

Looking at the dialog for each of those foundation components, I see they have a fileNameParameter, however in the case of the foundation/components/image that is just ignored. I need to persist the original upload fileName, how can I do this with foundation/components/image.


回答1:


I extended the html5smartimage xtype by putting this JS script into a clientlib

var MyAppLib = MyAppLib || {};

MyAppLib.NamedHtml5SmartImage = CQ.Ext.extend(CQ.html5.form.SmartImage, {

    constructor : function(config) {

        config = config || {};
        var defaults = {
            "transferFileName" : true
        };

        CQ.Util.applyDefaults(config, defaults);
        MyAppLib.NamedHtml5SmartImage.superclass.constructor.call(this, config);
    }
});

CQ.Ext.reg("namedhtml5smartimage", MyAppLib.NamedHtml5SmartImage);

and then created a new component based on foundation/components/image and unsed my xtype namedhtml5smartimage in place of the html5smartimage in the dialog tab configuration.



来源:https://stackoverflow.com/questions/27925547/adobe-cq-image-coponent-filename

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!