未验证 提交 477b7d7a 编写于 作者: R Raihaan Shouhell 提交者: GitHub

[JENKINS-62433] Read-only system message (#4745)

* Read-only system message

* More robust js
Co-authored-by: Nres0nance <res0nance@users.noreply.github.com>
上级 fd6c1509
......@@ -40,7 +40,8 @@ THE SOFTWARE.
${it.rootDir}
</f:entry>
<f:entry title="${%System Message}" help="/help/system-config/systemMessage.html">
<f:textarea name="system_message" value="${it.systemMessage}"
<j:set var="readOnlyMode" value="${!h.hasPermission(app.MANAGE)}" />
<f:textarea name="system_message" value="${it.systemMessage}" disabled="${readOnlyMode?'true':null}" readonly="${readOnlyMode?'true':null}"
codemirror-mode="${app.markupFormatter.codeMirrorMode}" codemirror-config="${app.markupFormatter.codeMirrorConfig}" previewEndpoint="/markupFormatter/previewDescription"/>
</f:entry>
......
......@@ -48,7 +48,14 @@ Behaviour.specify("DIV.textarea-preview-container", 'textarea', 100, function (e
showPreview.onclick = function() {
// Several TEXTAREAs may exist if CodeMirror is enabled. The first one has reference to the CodeMirror object.
var textarea = e.parentNode.getElementsByTagName("TEXTAREA")[0];
var text = textarea.codemirrorObject ? textarea.codemirrorObject.getValue() : textarea.value;
var text = "";
//Textarea object will be null if the text area is disabled.
if (textarea == null) {
textarea = e.parentNode.getElementsByClassName("jenkins-readonly")[0];
text = textarea != null ? textarea.innerText : "";
} else {
text = textarea.codemirrorObject ? textarea.codemirrorObject.getValue() : textarea.value;
}
var render = function(txt) {
$(hidePreview).show();
$(previewDiv).show();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册