-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: make ICopyable generic and update clipboard APIs #7348
feat: make ICopyable generic and update clipboard APIs #7348
Conversation
U extends ICopyData, | ||
T extends ICopyable<U> & IHasWorkspace, | ||
>(toDuplicate: T): T | null { | ||
deprecation.warn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would rather not add the deprecation warning until you've fixed the internal usages, but since this is going into a feature branch and not directly into the release i won't stop you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a draft PR fixing all internal usages :D #7352
The basics
npm run format
andnpm run lint
The details
Resolves
Fixes #7337
Proposed Changes
ICopyable
interface to be generic.clipboard
APIs to take in data instead of being stateful.paste
public. Everything else remains internal.Reason for Changes
Test Coverage
Now that the methods aren't stateful anymore, I could test the API boundary between the clipboard and pasters :D
Documentation
N/A
Additional Information
N/A
Deprecations
Blockly.clipboard.copy
andBlockly.clipboard.duplicate
have both been deprecated. These were marked@internal
so if you are conforming to Blockly's API, you should not be accessing them anyway.Blockly.clipboard.copy
can be replaced with callingtoCopyData
on the element you want to copy.Blockly.clipboard.duplicate
can be replaced by callingBlockly.clipboard.paste(myElement.toCopyData(), myWorkspace)
.