BookStack icon indicating copy to clipboard operation
BookStack copied to clipboard

Feature Request: Option to require changelog & tags

Open TBK opened this issue 7 years ago • 3 comments

Describe the feature you'd like Option to force users to fill the changelog otherwise the save action can not be executed and the user will be prompted.

A likewise option and behaviour for tags.

Describe the benefits this feature would bring to BookStack users Ensure the quality of the revision log.

Additional context Changelog could be moved to the toolbox tab and also display the changelog history.

I have created a quick example of how it could look. image

TBK avatar Oct 07 '18 09:10 TBK

Oh this would be great for the absent minded contributors!

lithium-ap avatar Oct 09 '18 20:10 lithium-ap

Somewhat similar to #941

Abijeet avatar Nov 25 '18 03:11 Abijeet

I put together a simple snippet, for requiring changelog, for a BookStack support customer, so thought I'd share the customization here too. Just needs to be added to the "Custom HTML Head Content" customization setting:

<script type="module" >
    /**
     * The error message to display when the changelog input is empty on form submit.
     */
    const validationErrorMessage = 'A changelog entry is required before saving page changes';

    // First, we get the changelog input and check if it's in the current view.
    /** @type {HTMLTextAreaElement | null} */
    const changelogInput = document.querySelector('form[action*="/page/"] textarea[name="summary"]');
    if (changelogInput) {
        // If so, we get the parent page edit form and listen to submit events.
        const form = changelogInput.closest('form');
        form.addEventListener('submit', function (event) {
            // If the input is empty, we prevent the form from submitting and show an error.
            if (changelogInput.value.trim() === '') {
                event.preventDefault();
                window.$events.error(validationErrorMessage);
            }
        });
    }
</script>

ssddanbrown avatar Oct 23 '25 13:10 ssddanbrown