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
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.