conditional-container icon indicating copy to clipboard operation
conditional-container copied to clipboard

Froala wysiwyg Uploading Image Issue

Open Slgoetz opened this issue 3 years ago • 2 comments

It seems that the Conditional Container removes the fields from the Nova Fields Collections so that ->availableFields() doesn't return them. When we try to upload an image we get a 404 since the field is non existent in the data. Is there another way to field the field, and is there a reason you're removing them from the Nova Field Collection?

Slgoetz avatar Oct 13 '20 19:10 Slgoetz

All fields within a conditional container get removed if the if() condition doesn't match, that how this package works, in order to make this work with froala perhaps we need to modify the availableFields() method from the HasConditionalContainer to identify this is a request targeting some specific field within a possibly deep nested conditional container field

milewski avatar Feb 24 '21 15:02 milewski

A workaround for this is checking the requestUri, in my case using the QuillJs field:

/**
 * Get the fields displayed by the resource.
 *
 * @param \Illuminate\Http\Request $request
 * @return array
 */
public function fields(Request $request)
{
    ...

    if ($request->getRequestUri() === '/nova-vendor/quilljs/modules/upload/content') {
        $data[] = Quilljs::make(__('validation.attributes.content'), 'content')
            ->withFiles()
    }

    return $data;
}

I use this with the BelongsToManyField as well:

if ($request->getRequestUri() === '/nova-vendor/belongs-to-many-field/modules/options/videos/name') {
    $data[] = BelongsToManyField::make(__('validation.attributes.videos'), 'videos', $this->videoResource());
}

manyasone avatar Mar 12 '21 14:03 manyasone