// Author  Raivis Rampāns
// Created 01.04.2025
// Editor Raivis
// Modified 07.06.2025

document.addEventListener("DOMContentLoaded", function () {
    const confirmSaveAsButton = document.getElementById("confirmSaveAs");

    confirmSaveAsButton.addEventListener("click", function () {
        const fileName = document.getElementById("fileName").value.trim();
        const fileText = document.getElementById("notepad").innerHTML;

        if (fileName === "") {
            alert("Please enter a file name.");
            return;
        }

        // Aizpildām slēpto laukumu ar notepad saturu
        document.getElementById("fileText").value = fileText;

        // Iesniedzam formu
        document.getElementById("saveForm").submit();
    });
});