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

feat(ClausePlugin): handle paste functionality with clauses - I134 #136

Merged
merged 5 commits into from
Sep 4, 2019
Merged

feat(ClausePlugin): handle paste functionality with clauses - I134 #136

merged 5 commits into from
Sep 4, 2019

Conversation

irmerk
Copy link
Member

@irmerk irmerk commented Sep 4, 2019

Issue #134

Create new uuid for a clause that was copy/pasted in conjunction with this PR in markdown-editor

Changes

  • On a paste event, we take the Document on the event and make it mutable in order to change the clauseid to a uuid and revert everything to immutable
  • Abstracted clause specific logic out of @accordproject/markdown-editor

Flags

  • 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
  • Further work is needed in the redux store of TSv2, showcased here where the new uuid's placed onto the clauses are not represented in the store, and moreover the extra pasted clause does not appear at all:

DOM:
Screen Shot 2019-08-30 at 3 32 49 PM
Store:
Screen Shot 2019-08-30 at 3 33 08 PM

Related Issues

Signed-off-by: irmerk <jolenelanglinais@gmail.com>
@irmerk irmerk added this to the 0.1.0 milestone Sep 4, 2019
@irmerk irmerk self-assigned this Sep 4, 2019
@irmerk irmerk added this to In Progress PR in Template Studio V2 via automation Sep 4, 2019
@irmerk irmerk added this to In Progress PR in Full Contract Support via automation Sep 4, 2019
DianaLease
DianaLease previously approved these changes Sep 4, 2019
Copy link
Member

@DianaLease DianaLease left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Can we move those "flags" into an issue to keep track of?

Signed-off-by: irmerk <jolenelanglinais@gmail.com>
Signed-off-by: irmerk <jolenelanglinais@gmail.com>
…cicero-ui into irmerk/i134/clause-paste

Signed-off-by: irmerk <jolenelanglinais@gmail.com>
@irmerk
Copy link
Member Author

irmerk commented Sep 4, 2019

LGTM. Can we move those "flags" into an issue to keep track of?

Absolutely, yes I will be breaking these all into issues.

@irmerk irmerk merged commit c94971a into accordproject:master Sep 4, 2019
Template Studio V2 automation moved this from In Progress PR to Finished PR Sep 4, 2019
Full Contract Support automation moved this from In Progress PR to Finished PR Sep 4, 2019
@irmerk irmerk deleted the irmerk/i134/clause-paste branch September 4, 2019 19:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Full Contract Support
  
Finished PR
Template Studio V2
  
Finished PR
Development

Successfully merging this pull request may close these issues.

None yet

2 participants