Child pages
  • Using the Clipboard
Skip to end of metadata
Go to start of metadata

Ready for implementation


Story

I can use the clipboard to copy and paste items around. I can paste copied items multiple times and a previously copied item is replaced, if I copy a different item to the clipboard.

If I'm unsure where I could paste the current content of the clipboard, I can use a clipboard function to show me all supported locations in the currently showing view. I typically use the clipboard only within a view, rarely across views, but the more acquainted I get with different parts of Magnolia, the more I attempt to use the clipboard to transfer items between its workspaces.

Description of desired behavior

Any type of content can be copied to the clipboard and pasted in another location. The basic rule to understand the Magnolia clipboard is this: if the clipboard is there, you can copy items to it, replacing any item already in there. And you can paste the item or items in the clipboard, if its type is accepted by your currently selected item. This also means that the clipboard may actually missing for a specific view if it isn't properly supported.

However, content cannot be cut (copied and removed at the same time) and pasted later - this would lead to a number of confusing situations when copying across views, in particular if one attempted to cancel the operation. Instead, the clipboard concentrates on offering powerful copy&paste support only.

Also, when copying an item containing sub items, all the sub items are copied as well. Magnolia does not offer a way to only copy an item itself, ignoring all items it may contain. This is mainly to simplify and unify the way the clipboard works, but also describes how the "copy page" function currently works in Magnolia.

The challenge of implementing a clipboard in Magnolia is doing it right across multiple contexts with different types of items. In order to solve this, the clipboard has two main properties:

  • the clipboard is global and
  • it uses converters.

The clipboard is global

In Magnolia, the clipboard is truly global in that it works across all layers and views. If you thus e.g. copy a paragraph in the visual page editing layer, you can then paste that paragraph in structure editing in AdminCentral. While every interface might have their own clipboard controls, they all interact with the same, global clipboard.

A global clipboard is the only implementation not leading to confusing behavior. A per view or per layer implementation would either have to be flushed every time you change between views and layers or would have to remember the item copied last, both of which would result in behavior difficult for the user to understand and anticipate.

The clipboard offers converters

While the clipboard might typically be used to copy items within the same view (e.g. to copy pages within the same site structure), Magnolia's global clipboard is more powerful as it offers built-in converters. Converters allow the clipboard to convert an item to a different, usually lower-level item type. If you e.g. copy a page in the website workspace, then open a dialog containing a field requiring a URL, a paste action there could actually paste the URL of the copied page.

Similarity with drag'n'drop

Note that while converters may sound difficult to implement, drag and drop support in common application frameworks already offers a similar type of behavior for quite some time. If you attempt to drop a dragged item, the following happens:

  • the drag source knows the data formats it can offer the dragged item in
  • the drop target consults the drag source and matches the data formats offered with those it supports
  • the drop target chooses the data format, where most of the data and its structure are preserved

It might be worthwhile verifying if the two functions could leverage the same internal framework.

Using the clipboard

Please consult the usage summary for a full definition of mouse, touch and keyboard usage.

Preview of Paste operation

If a user right clicks or tap-and-holds the paste function, a tooltip will show the number and type of items currently in the clipboard (e.g. 5 videos or 3 items) - this behavior is actually required. Optionally, all items in the current view accepting a paste will be briefly highlighted in addition to this. This effect disappears again if the mouse button is released or the tap ends.

As this operation uses less common gestures, it is considered less easy to discover and thus a power user function.

Storyboard


  • No labels