#8260 Codemirror on mobile devices doesn't work

unreleased
open
nobody
None
General
nobody
2018-11-01
2018-11-01
Ingo
No

I love to write documentation on my Smart phone on the run. Currently this is not possible with Codemirror, as it doesn't handle a mobile Keyboard correctly.

  • spaces are not handled or doubled
  • some words are magically duplicated sonstiges,...

This affect all tools, as codemirror is widely used. Even this ticket is written in google keep and copied to the ticket ;)

A possibility to disable codemirror, or an automatic fallback to a plain textarea would be great. I personally don't use the toolbar at all, so I wouldn't miss that feature.

Related

Tickets: #8260

Discussion

  • Dave Brondsema

    Dave Brondsema - 2018-11-01

    Yea I've noticed that too, super annoying. Sometimes it worked for me though, so at the time I wasn't able to get a good idea of what the problem was.

    We should try upgrading SimpleMDE (a layer on top of CodeMirror). It hasn't been updated for a while, but there is a fork at https://github.com/Inscryb/inscryb-markdown-editor We could also try updating just the CodeMirror part (that might require doing a simplemde build ourselves, I think I did that in the past).

    Looking at CodeMirror bug reports, I've found https://github.com/codemirror/CodeMirror/issues/5245 which seems to describe the problem, and is still an open issue.

    So might be best to detect the browser somehow (that is always tricky) and do a plain textarea. It'd be unfortunate to lose the toolbar and syntax highlighting, but better than typing not working.

     
    • Ingo

      Ingo - 2018-11-01

      My current hack looks like that:

      class cmdummy
      {
          constructor(ref) {
          this.ref = ref;
          }
              getValue()
          {
          return this.ref.value;
          }
          setValue(val)
          {
          this.ref.value = val;
          }
          refresh()
          {
          }
          focus()
          {
          this.ref.focus();
          }
      }
      ...
      
      var mobile = (typeof window.orientation !== "undefined") ||
      (navigator.userAgent.indexOf('IEMobile') !== -1);
      
      ...
      
      if (mobile)
              {
              $textarea[0].classList.add("CodeMirror");
              $textarea[0].CodeMirror = new cmdummy($textarea[0]);
              return;
              }
      

      I used that, as some scripts, like those in the ticket tool expected to
      find the codemirror object.

      Dave Brondsema dave@brondsema.net schrieb am Do., 1. Nov. 2018, 16:00:

      Yea I've noticed that too, super annoying. Sometimes it worked for me
      though, so at the time I wasn't able to get a good idea of what the problem
      was.

      We should try upgrading SimpleMDE (a layer on top of CodeMirror). It
      hasn't been updated for a while, but there is a fork at
      https://github.com/Inscryb/inscryb-markdown-editor We could also try
      updating just the CodeMirror part (that might require doing a simplemde
      build ourselves, I think I did that in the past).

      Looking at CodeMirror bug reports, I've found
      https://github.com/codemirror/CodeMirror/issues/5245 which seems to
      describe the problem, and is still an open issue.

      So might be best to detect the browser somehow (that is always tricky) and
      do a plain textarea. It'd be unfortunate to lose the toolbar and syntax
      highlighting, but better than typing not working.


      Status: open
      Milestone: unreleased
      Created: Thu Nov 01, 2018 06:07 AM UTC by Ingo
      Last Updated: Thu Nov 01, 2018 06:07 AM UTC
      Owner: nobody

      I love to write documentation on my Smart phone on the run. Currently this
      is not possible with Codemirror, as it doesn't handle a mobile Keyboard
      correctly.

      • spaces are not handled or doubled
      • some words are magically duplicated sonstiges,...

      This affect all tools, as codemirror is widely used. Even this ticket is
      written in google keep and copied to the ticket ;)

      A possibility to disable codemirror, or an automatic fallback to a plain
      textarea would be great. I personally don't use the toolbar at all, so I
      wouldn't miss that feature.


      Sent from forge-allura.apache.org because you indicated interest in
      https://forge-allura.apache.org/p/allura/tickets/8260/

      To unsubscribe from further messages, please visit
      https://forge-allura.apache.org/auth/subscriptions/

       

      Related

      Tickets: #8260


Log in to post a comment.