Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Changed: clipboard is now extended to be global

...

I can use the clipboard to copy or cut and then paste items around. I can paste copied or cut items multiple times and a previously copied or cut item is replaced, if I copy or cut an item againa 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 certainly only within a workspacethe 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

The basic clipboard function does not have to be explained in all detail - it is well known from applications such as Word or text editors. Content can be copied to the clipboard and pasted in another location, but it can also be cut - copied and removed - and pasted later. The challenge is to do this right across multiple views contexts with different types of items.

The clipboard

...

is global

In Magnolia, the clipboard is a workspace-level global function. As such, it is associated with a workspace and thus with the item set it showsworks across workspaces and the item sets they show. The clipboard also works across all item subsets and between all views of a workspace. Every workspace has its own toolbar with its own clipboard controls, but clipboards cannot they all use the same, global clipboard to interact with each other. The implications and semantics of performing an item copy operation across workspaces and thus domains are hard to understand and might even make no sense at all in some cases. By putting the clipboard inside the toolbar, it remains a function local to the workspace and works intuitively how you'd expect without guessing its meaning.

This also holds, if there's a semantically equivalent or similar item set in a different workspace. As an example, if you have a set of pages under "Website", but also a set of pages under "A-B testing", you can't copy a page from "Website" to "A-B testing".

Switching workspaces

If the user switches from one workspace to another, the contents of the clipboard are flushed, although the rest of the state of the workspace is preserved. This avoids the confusion caused when copying items in one space, then hitting paste in another and getting different content possibly copied hours ago. Flushing a clipboard when switching workspaces also enforces our view of the clipboard as a local tool with temporary character.

Restrictions to pasting items

.

I've iterated through numerous versions of clipboards, from clipboards anchored on item sets to workspaces to work areas. A global clipboard is a lot less confusing then a non-global one: you don't have to either flush the clipboard when switching contexts or deal with clipboards containing content you copied earlier. A global clipboard is also more powerful, as you can allow a workspace to e.g. only paste a string representation. Finally, the basic rule to understand a clipboard stays as simple as you know it from other applications: if the clipboard is there, you can use it, and you can paste an item in the clipboard, if its type is accepted by your currently selected item.

Additional characteristics

It is not required that every workspace shows the clipboard. It should actually only be shown (i.e. not shown with all buttons disabled), if a workspace can make use of it.

Because the clipboard is a global function, it does not offer a cut operation. It would be unclear how to cancel it, if you switch the context. 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. This provides a powerful means to work with item hierarchies. A workspace may not offer a way to only copy an item itself.

The clipboard offers converters

While the clipboard will typically be used to copy items within the same workspace or even the same view (e.g. to copy pages within the same site structure), Magnolia's global clipboard is more powerful, since 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, pasting the copied page pastes its URL. The global clipboard becomes an even more powerful tool to copy content from here to there.

Magnolia's global clipboard has the following characteristics:

  • any item may be copied
  • the clipboard may offer its item or items in a number of different item types by using converters
  • the selected item acting as the target of a paste operation usually only accepts one item type (e.g. a page)
  • the clipboard tries to satisfy the expected item type by leveraging its built-in converters

Similarity with drag'n'drop

Note that this somewhat similar to how drag and drop support is typically implemented:

  • any item may be dragged
  • the drag source knows the data formats it can offer the dragged items 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 is preserved

It might be worth while verifying if the two functions could leverage the same internal frameworkA paste operation must not be allowed, if the currently shown item subset does not support pasting an item type of at least one of the items in the clipboard. While the subset is only a filtered view and the paste might actually work, it is totally unclear what would happen and which item it would target.

Preview of paste operation

...