Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Handle Duplicate clauseId from Copy/Paste #134

Closed
irmerk opened this issue Sep 3, 2019 · 1 comment
Closed

Handle Duplicate clauseId from Copy/Paste #134

irmerk opened this issue Sep 3, 2019 · 1 comment

Comments

@irmerk
Copy link
Member

irmerk commented Sep 3, 2019

Linked Isues:

- MDE 88

- TSv2 82


Is your feature request related to a problem? Please describe.
Incorporate any clause specific logic here from markdown-editor Issue 88

Currently, a uuidv4 is assigned to each clause template added into the markdown of the contract. Copying and pasting should recognize that as already existing and create a new uuidv4

Describe the solution you'd like
Possibly register multiple onPaste handlers on the underlying Slate editor. These are likely chained by the call to next(). Test what happens on paste of HTML which contains an existing clause <div>.

When a clause template is pasted, TSv2 should check to see if a clause template exists in the pasted text. If so, check if that clause template is already in the contract. If so, assign a new uuidv4 to this clause template.

Describe alternatives you've considered
A good starting point should be SlateJS's onPaste plugin
Already in the code here

Additional context
N/A

@irmerk irmerk added this to the 0.1.0 milestone Sep 3, 2019
@irmerk irmerk self-assigned this Sep 3, 2019
@irmerk irmerk added this to To do in Template Studio V2 via automation Sep 3, 2019
@irmerk irmerk added this to Issue (Triaged) in Full Contract Support via automation Sep 3, 2019
@irmerk
Copy link
Member Author

irmerk commented Sep 4, 2019

Further issues should consider:

  • Handling different transfer.type situations

    • Editor instance (Slate) to another editor instance (Slate)
    • Raw HTML (Chrome to VSCode to Chrome)
    • Editor instance (Slate) to Google Docs and back (recognize <clause> formatting)
  • Ensure onPaste handlers are not doubling up work for any transfer.type cases

    • @accordproject/cicero-ui/src/plugins/ClausePlugin
    • @accordproject/markdown-editor/src/SlateAsInputEditor
  • What fragment.type results when copying pasting from one editor to another instance of an editor?

    • fragment as a transfer.type is a Slate DOM block fragment, not HTML anymore, so copying and pasting from the same editor into itself should be a fragment
    • However, copying pasting from one editor to another instance of an editor may result in HTML or fragment, needs experimentation
  • Preserve formatting, if H1 in HTML, we should be preserving the formatting

    • Slate has a mechanism for mapping from HTML tags to Slate blocks here

@irmerk irmerk added the Hacktoberfest by DigitalOcean and DEV label Sep 13, 2019
@irmerk irmerk added this to To do in Hacktoberfest 2019 via automation Sep 13, 2019
@irmerk irmerk moved this from Open Issues to In Progress Issues in Hacktoberfest 2019 Oct 4, 2019
@irmerk irmerk removed this from In Progress Issues in Hacktoberfest 2019 Oct 30, 2019
@irmerk irmerk added this to Triage in Cicero UI v1.0 via automation Nov 13, 2019
@irmerk irmerk moved this from Triage to Priority: High in Cicero UI v1.0 Nov 13, 2019
@irmerk irmerk closed this as completed Nov 19, 2019
Template Studio V2 automation moved this from To do to Finished Issues Nov 19, 2019
Full Contract Support automation moved this from Issue (Triaged) to Finished Issue Nov 19, 2019
Cicero UI v1.0 automation moved this from Priority: High to Finished Issues Nov 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
Full Contract Support
  
Finished Issue
Cicero UI v1.0
  
Finished Issues
Template Studio V2
  
Finished Issues
Development

No branches or pull requests

2 participants