Feat: support for customize copy and cut Embeddables to Clipboard #2067
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Before this PR, we always copy or cut an
Embeddable
with a empty text, making also more easy to getting back aEmbed
when the user paste it, but, this could be an issue for users that only want to get the plain text from aEmbed
. To fix this i add some classes to override this behavior.CopyCutService
andCopyCutServiceProvider
CopyCutService
is an interface that let us modify the behavior ofgetCopyCutAction
that let us return some text or an object that will be copied to theClipboard
.It looks like:
CopyCutServiceProvider
it's very similiar toClipboardServiceProvider
. Just provide an instance to be modified and used by any resource of the project.It looks like:
Note
By default
CopyCutServiceProvider
useDefaultCopyCutService
that just return an empty text.It looks like:
Example
If we have a
Embeddable
like:To detect this
Embed
, we just need to create a custom implementation ofCopyCutService
And after we just need to set this instance to the
CopyCutServiceProvider
:clideo_editor_e7cbeac8d41c4a6d8b55acd082b3cc3f.mp4
Related Issues
Related How to copy text from a custom widget #2050
Related toPlainText method from any Embeddable return text that cannot be used outside of the editor #2065
✨ New feature: Adds new functionality without breaking existing features.
🛠️ Bug fix: Resolves an issue without altering current behavior.
🧹 Code refactor: Code restructuring that does not affect behavior.
❌ Breaking change: Alters existing functionality and requires updates.
🧪 Tests: Adds new tests or modifies existing tests.
📝 Documentation: Updates or additions to documentation.
🗑️ Chore: Routine tasks, or maintenance.
✅ Build configuration change: Changes to build or deploy processes.