cheminfo / cheminfo/openchemlib-js

Copy/paste events

Open
#235 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
90
Forks
25
Avg merge
51m
Merged PRs (30d)
1

Description

https://github.com/cheminfo/openchemlib-js/pull/231#issuecomment-2407073573

How should we plan to implement `copy`/`paste` events.

On this PR I had to add some code in Java side, but the result was a bit hacky but use the clipboard events.
- skip `ctrl+c`/`ctrl+v` events
- a non-aware environment could trigger two same events (one from keyboard, another from clipboard events)

This implementation, which straddled the line between java and js, was unsatisfactory in my eyes.

---

I think we should on https://github.com/Actelion/openchemlib define a generic API for clipboard, compatible with browser [clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API) and [DataTransfer API](https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer).
It will be hard work, it will need to support async pattern (with callback, I think it will be the most simple we could do to be compatible with java and js)

With a generic clipboard api and clipboard events handling in java. The actual `IClipboardHandler` would need to change, but could have a single implementation in java, using an `IClipboard`.

---

Or an other solution could be to do full implementation of copy-paste events handling in JS side for this repository, and do not propagate copy-paste events from keyboard to java.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing PR #231 and its clipboard-related changes, then compare the proposed generic API with the browser Clipboard and DataTransfer APIs. The issue presents two alternative implementation directions, so completion requires choosing and agreeing on an approach before defining the clipboard event behavior and IClipboardHandler changes.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.