 to update the hidden textarea
              editor.codemirror.on('change', () => {
                  textarea.value = editor.value();
              });
          });

          // Helper function to get CSRF token from cookies
          function getCookie(name) {
              let cookieValue = null;
              if (document.cookie && document.cookie !== '') {
                  const cookies = document.cookie.split(';');
                  for (let i = 0; i < cookies.length; i++) {
                      c