fix: TemplatingEditor paste action override current content#503
Open
AlekseyManetov wants to merge 1 commit into
Open
fix: TemplatingEditor paste action override current content#503AlekseyManetov wants to merge 1 commit into
TemplatingEditor paste action override current content#503AlekseyManetov wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a paste-handling bug where the generic FEEL paste handler (registered on a container) incorrectly intercepts paste events coming from CodeMirror-based templating editors, causing pasted content to overwrite the entire editor content instead of inserting at the cursor.
Changes:
- Update the FEEL paste handler to ignore non-
<input>paste targets (to avoid interfering with CodeMirror/contenteditable editors). - Add a regression test ensuring
FeelTemplatingEntrypaste does not overwrite existing content. - Extend the example app setup to include a
FeelTemplatingEntryto exercise templating behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/components/entries/FEEL/Feel.js |
Adjust paste handler target handling to avoid overriding CodeMirror paste behavior. |
test/spec/components/Feel.spec.js |
Add regression test for pasting into FeelTemplatingEntry (CodeMirror). |
test/spec/Example.spec.js |
Add a templating group using FeelTemplatingEntry in the demo setup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4c57d6a to
c18f36d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Related to camunda/camunda-modeler#5948
Proposed Changes
The bug was cause by wrong paste behavior in
FeelTemplatingEntry. ThepasteHandlerinFeel.jsis registered on a container<div>and catches paste events from all child elements via event bubbling. It accessesevent.target.valueandevent.target.selectionStart— properties that only exist on<input>elements.When
FeelTemplatingEntryrenders a CodeMirror editor (contenteditable<div>),event.target.valueis undefined. Since!undefinedevaluates to true, the handler always treats the field as empty, replaces the entire content with the pasted text, and callspreventDefault()— blocking CodeMirror's native paste.Before:
Screen.Recording.2026-05-29.at.15.59.04.mov
After:
Screen.Recording.2026-05-29.at.15.58.24.mov
Checklist
Ensure you provide everything we need to review your contribution:
Closes {LINK_TO_ISSUE}orRelated to {LINK_TO_ISSUE}@bpmn-io/srtool