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

Hide preview button for 'EscapedMarkupFormatter' #9368

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion core/src/main/resources/lib/form/textarea.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ THE SOFTWARE.
<j:mute>${customizedFields.add(name)}</j:mute>
</j:if>
</f:possibleReadOnlyField>
<j:if test="${attrs.previewEndpoint!=null and !readOnlyMode}">

<j:if test="${attrs.previewEndpoint!=null and !readOnlyMode and app.markupFormatter.class.name != 'hudson.markup.EscapedMarkupFormatter'}">
Copy link
Member

@jtnord jtnord Jul 17, 2024

Choose a reason for hiding this comment

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

Am I missing something?
Nothing ties previews to markup formatters does it? if so nothing here says the preview needs to be done using only a the Jenkins MarkupFormatter.

Suggested change
<j:if test="${attrs.previewEndpoint!=null and !readOnlyMode and app.markupFormatter.class.name != 'hudson.markup.EscapedMarkupFormatter'}">
<j:if test="${attrs.previewEndpoint!=null and !readOnlyMode and (app.markupFormatter.class.name != 'hudson.markup.EscapedMarkupFormatter or attrs.previewEndpoint != '/markupFormatter/previewDescription')'}">

That is I could have a jenkins using the EscapedMarkupFormatter but I may have set the previewEndPoint to MyDescriptorImpl.preview(String)

Indeed, the test on line 111 does implies that I should be able to use this irrespective of any global markup formatter.

a completely contrived example could be where a user supplies some toml, and my descriptor takes that toml (per job) and merges it with some global toml to create the "end toml" which is then displayed to the user?

<div class="textarea-preview-container">
<j:if test="${attrs.previewEndpoint == '/markupFormatter/previewDescription'}">
${app.markupFormatter.descriptor.displayName}
Expand Down
Loading