Skip to content

Copy and Paste

Sebastian Rettig edited this page Apr 11, 2020 · 1 revision
  1. Copy & Paste is not done using the system clipboard but with a custom mechanism. That's why it won't work across sites.
  2. Copying content serializes the params and metadata into an object, which can be later pasted.
  3. Pasting doesn't do specific things in the backend at all. What it does is just add new content to the editor like it normally would.
  4. When a file reference is copied into the clipboard, the h5p editor client checks if the file is part of saved content. If it is, the file reference in the clipboard is be changed into an relative path like '../contentId/images/xxx.jpg'. This is the path that is used in params.
  5. The file reference from above is cloned when the user hits 'save'. The backend looks for paths with relative paths, clones these files and changes the paths.
  6. In order to get 4 working, the contentId must be passed correctly to the h5p editor client.