Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I make a dilalog box pop up when trying to modify a page title in edit mode in Confluence?

Guillaume Pelette
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 3, 2022

Hi community,

I'm trying to make a dialog box appear whenever someone attemps to modify the title(input) of a page in edit mode in Confluence, in order to alert users that this will affect the published version of the page.

I've first looked into saving custom JS scripts and installing web resources in Scriptrunner, but this might not be the best option. I've since then tried to add custom HTML code from the administration panel, but somehow this doesn't seem to work and I keep getting error messages("RPC: request rejected (bad origin)").

Can you please help me find a straightforward and robust solution? here below is the code I've built so far:

<section id="title-change-warning-dialog" class="aui-dialog2 aui-dialog2-small aui-layer" role="dialog" aria-hidden="true">
<header class="aui-dialog2-header">
<h2 class="aui-dialog2-header-main">Beware</h2>
<a class="aui-dialog2-header-close">
<span class="aui-icon aui-icon-small aui-iconfont-close-dialog">Close</span>
</a>
</header>
<div class="aui-dialog2-content">
<p>Modifying the title of a page as a draft will also affect the published version</p>
</div>
<footer class="aui-dialog2-footer">
<div class="aui-dialog2-footer-actions">
<button id="dialog-submit-button" class="aui-button aui-button-primary">I understand.</button>
</div>
</footer>
</section>


<script>
let input = document.querySelector("input#content-title.text.pagetitle");
console.log(input);

input.addEventListener('change', (event) => {
console.log('Someone is trying to modify input value!');
AJS.dialog2("#title-change-warning-dialog").show();
}, { once: true });
</script>

 

Thanks in advance,

Guillaume

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events