Skip to content
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

[JENKINS-58240] - Plugins should be able to provide onBlur for codemirror textarea. #4046

Merged
merged 1 commit into from
Jun 28, 2019

Conversation

rudolfwalter
Copy link
Contributor

@rudolfwalter rudolfwalter commented May 27, 2019

Currently, plugins cannot cleanly provide a custom onBlur handler for their codemirror textareas, because it is being overridden in core. This has been the case since 4e48eaa, but it does not look like that side-effect has been intentional.

(Plugins could work around this in a hackish way, by adding })// at the end of their codemirror-config.)

Proposed changelog entries

  • RFE, internal: Allow plugins to provide onBlur() handlers for codemirror textarea controls

@daniel-beck
Copy link
Member

@rudolfwalter Could you point to a bug in a plugin as the result of this, or a plugin needing to implement this, to illustrate the benefits of this change?

@daniel-beck daniel-beck added the web-ui The PR includes WebUI changes which may need special expertise label May 29, 2019
@rudolfwalter
Copy link
Contributor Author

rudolfwalter commented May 30, 2019

Sure. I came across this while making jenkinsci/script-security-plugin#255. I added the workaround hack there, and could have left it at that, but thought it would be nicer to actually get it fixed in core so that the hack can be cleaned up later.
Also, I tried to be as backwards and forwards compatible with both changes as possible.

@varyvol
Copy link

varyvol commented Jun 4, 2019

@rudolfwalter my only concern: if a plugin has already implemented the workaround, would it still work properly if this is included?

@rudolfwalter
Copy link
Contributor Author

@varyvol It should, yes:

  • the plugin-provided part continues to be surrounded with ({ ... }) and processed with eval
  • after the eval we check if an onBlur has been provided, and only set it if it wasn't.

@rudolfwalter
Copy link
Contributor Author

I can only think of one regression that this could cause: in the case when a plugin provided a wrong onBlur, never noticing its error because its onBlur was being ignored; that error would surface after this change.

@varyvol
Copy link

varyvol commented Jun 5, 2019

@rudolfwalter I don't see that as a regression but as an error in the plugin, so it could even be positive. Thanks for the explanations!

@oleg-nenashev oleg-nenashev added needs-jira-issue A JIRA issue should be created for this PR. It is usually needed for the LTS backporting process ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback labels Jun 16, 2019
Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT, it will address the described issue. It would be great to have a JIRA ticket so that we can consider it for backporting

@oleg-nenashev
Copy link
Member

@oleg-nenashev oleg-nenashev changed the title Plugins should be able to provide onBlur for codemirror textarea. [JENKINS-58240] - Plugins should be able to provide onBlur for codemirror textarea. Jun 27, 2019
@oleg-nenashev
Copy link
Member

@rudolfwalter Thanks for the patch! I will get it merged once the CI rerun completes. If you want it to be backported to LTS, please comment in the JIRA ticket

@oleg-nenashev oleg-nenashev removed the needs-jira-issue A JIRA issue should be created for this PR. It is usually needed for the LTS backporting process label Jun 27, 2019
@oleg-nenashev oleg-nenashev merged commit 5926847 into jenkinsci:master Jun 28, 2019
jsoref pushed a commit to jsoref/jenkins that referenced this pull request Jul 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback web-ui The PR includes WebUI changes which may need special expertise
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants