为什么Touch Ui FileUpload呈现为按钮?

时间:2019-05-17 07:56:58

标签: javascript aem sling aem-touch-ui

我需要从经典UI的html5smartfile xtype迁移到Touch UI的fileupload资源类型(/ libs / granite / ui / components / coral / foundation / form / fileupload)。但是转换后只有一个按钮(缺少“丢弃资产”区域)。

我应该如何处理经典UI中的花岗岩组件?

经典界面:

<file
    jcr:primaryType="cq:Widget"
    allowUpload="{Boolean}false"
    autoUploadDelay="1"
    ddAccept="application/pdf"
    ddGroups="[media]"
    fieldLabel="File"
    fileNameParameter="./fileName"
    fileReferenceParameter="./fileReference"
    mimeTypes="application/pdf"
    name="./file"
    sizeLimit="25"
    xtype="html5smartfile"/>

触摸界面:

<file
    jcr:primaryType="nt:unstructured"
    sling:resourceType="granite/ui/components/coral/foundation/form/fileupload"
    fieldLabel="File"
    fileNameParameter="./fileName"
    fileReferenceParameter="./fileReference"
    mimeTypes="[application/pdf]"
    multiple="{Boolean}false"
    name="./file"
    sizeLimit="{Long}25"/>

Classic UI render Touch UI render

1 个答案:

答案 0 :(得分:0)

在您的cq:dialog中:

<file
    jcr:primaryType="nt:unstructured"
    sling:resourceType="cq/gui/components/authoring/dialog/fileupload"
    autoStart="{Boolean}false"
    class="cq-droptarget"
    fileNameParameter="./fileName"
    fileReferenceParameter="./fileReference"
    mimeTypes="[image/gif,image/jpeg,image/png,image/webp,image/tiff,image/svg+xml]"
    multiple="{Boolean}false"
    name="./file"
    title="Upload Image Asset"
    uploadUrl="${suffix.path}"
    useHTML5="{Boolean}true"/>

在您的cq:editConfig中:

<cq:dropTargets jcr:primaryType="nt:unstructured">
    <image
        jcr:primaryType="cq:DropTargetConfig"
        accept="[image/gif,image/jpeg,image/png,image/webp,image/tiff,image/svg+xml]"
        groups="[media]"
        propertyName="./fileReference">
        <parameters
            jcr:primaryType="nt:unstructured"
            imageCrop=""
            imageMap=""
            imageRotate=""/>
    </image>
</cq:dropTargets>

这是基于Core Components Image v2的,您可能应该使用它: