File upload methods in Cristal

File upload in Cristal can start off from a few different points:

1 - Drag and Drop
2 - Slash Command
3 - Attachment list

These methods are also available on XS, and the basic mechanisms are the same, even if some of the details in implementation can vary.
We always start with the initial state of the document opened:

Drag and drop

The way this works is pretty standard with other apps and XS. The user chooses a file from his device, drag it to the point in the document in which the attachment should appear, and the uploading process is handled in the background.

When dragging the file into the document, a line should indicate the position of the drop

After dropping the file, the upload process should appear in its place. If possible, with an indicator (percentage or progress bar)

With the upload complete, the image should be rendered with default settings

If the file uploaded is not an image and does not have a preview, then a block should be shown in its place, with the name of the file, its icon (if available) and file size. This is important in documents that have references to files, and this needs to be shown in context with the content.

Slash command

This process is a little more involved, the user state its intentions by issuing the /upload or /attach or /image commands (final command to be defined).

As soon as the user selects the “Files” option, a block should appear above it. This is to ensure that the user can recover should the upload dialog disappears by mistake (a click away, for example).

The popover shown lists all files previously uploaded to the document and are available to be placed in the current position. Also, here we have the option to “Upload new file” via a button that should open the standard OS dialog for selection of files.

If the attachment chosen were previously uploaded, it will be shown in place immediately. If a new one was chosen, then the box for upload progress described above should appear.

By using the attachment list

This method will be used in case the attachment should be uploaded to the document file list but not shown in the document itself.

First, the user needs to get to the file list. The way to do this is being discussed in this thread, so be sure to check it out if you want to know more about our options for opening these panels. But basically this can be a sidebar on the right or a panel below the document (floating when not at the bottom of the scroll). Here we will be using the panel option.

After opening the file list the user can attach a new file by using the appropriate button.

This button should open the standard file select dialog from the OS.

After that, the upload block should appear, showing progress.

File uploaded to the list, but not shown in the document.

As you can see, these options for upload are a mix of features of the current XWiki and features from Notion like apps. Please, let me know what you think about these methods and fire away if you have other ideas!

Thank you very much for reading.

Thanks for working in this!

That’s how tiptap behaves so good.

Probably doable.

For the record, I’m working on the bases of the slash action. What’s missing for now is:

  • the notion of categories (e.g., “media”)
  • the icon display
  • the hint sentence below the action name

Would this panel be displayed both in view and edit modes?

Do you think we should allow uploading several files at once?

Sounds good.

Options 1 and 2 can be used only when editing, while option 3 could be used in both view mode and edit mode. I don’t know if you’ve already decided if the extradoc tabs are available in edit mode too or not (but in XS they are available now that we have inplace editing so I’d assume that it would be the case too for Cristal).

You haven’t mentioned any “insert image” toolbar action in edit mode? Is that voluntary? If so, how do users add an image inside a paragraph? (without using the wiki editor). AFAIK the slash action is only available in new blocks.


Yes that’s the idea. As Vincent pointed out, 3 could be used in view mode as well.

Yes, I might be wrong, but I don’t see any downsides from a design perspective.

Yes, that’s the case.

It was not voluntary, we will need an image button on the toolbar. The way this button could work is close to the slash command, opening the dropdown with a file list and the “Upload New File” button.

I agree, but in this case we need to define how the UI will handle the support for multiple file upload.

Ok, I’ll try to have something ready soon.