Khan / Khan/structured-blocks

Support copying/pasting blocks

Open
#14 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
11
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Depends upon #10. We should track the key commands and put the text in the keyboard. In an ideal world it'd probably work like this:

  • User selects a block (or blocks).
  • User triggers a copy event (Cmd + C, for example).
  • The actual code text is copied to the clipboard (can be used to paste into other contexts!).
  • If the user pastes code into the editor then we check:
    • We attempt to parse the pasted text and convert it into a block, giving an error if it doesn't work.
    • If there is a current selection we insert the block after the current selection. (Or maybe replace it?)
    • If there is no selection then we append the new blocks to the end of the editor.

It seems as if the best way to achieve this will be to have some sort of hidden textarea that is auto-focused and selected. Not sure how feasible this is.

Also, it's not clear how this interaction would work on a mobile device! We'd need some bit of UI to trigger this interaction.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the dependency on issue #10 and examining the editor's selection and keyboard interaction points. Define how copying, parsing pasted text, insertion or replacement, and mobile interaction should work before implementing. Done means blocks can be copied as code, pasted into the editor, and invalid pasted text reports an error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.