简体   繁体   中英

Why is Touch Ui FileUpload is rendered as button?

I need to migrate from Classic UI's html5smartfile xtype to Touch UI's fileupload resource type (/libs/granite/ui/components/coral/foundation/form/fileupload). But there are only a button after conversion ("Drop an asset" area is missing).

What should I do for granite component looked as it was before in Classic UI?

Classic 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"/>

Touch UI:

<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

In your 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"/>

In your 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>

This is based on the Core Components Image v2, which you probably should use:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM