anschelburk / math_homework

Apache License 2.0
0 stars 0 forks source link

add the math keyboard hidden field workaround back #56

Closed bbelderbos closed 4 months ago

bbelderbos commented 4 months ago

It seems it was removed here: https://github.com/anschelburk/Math-Homework/pull/38/files#r1613607313

bbelderbos commented 4 months ago

specifically this commit: https://github.com/anschelburk/Math-Homework/pull/38/commits/abfeece6e6567a8ee76185fd1030a3000195c8fd

bbelderbos commented 4 months ago

hm only found the Django code there, here is the JS workaround we came up with for the math keyboard content to be 'synced over' to the hidden input field:

    <script>
       document.addEventListener("DOMContentLoaded", function() {
         const mathField = document.getElementById('mathfield_user_input');
         const hiddenInput = document.getElementById('math_input');

         mathField.addEventListener('input', function() {
           hiddenInput.value = mathField.getValue('latex');
         });
       });
     </script>

Found here: https://github.com/anschelburk/Math-Homework/pull/30/files

HTH Bob