Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
in Q2A Core by
My users complaint that

1. ckeditor is not running on android phones.

2. the textarea displayed is not taking line breaks (possibly because normally it would be html, entering <br /> works for line breaks)

you might want to use your android phone and check: http://www.gute-mathe-fragen.de/ask where you see only the textarea but ckeditor is not loaded.

That is why I want to have an automatic switch to the very basic text editor if an android phone (or mobile device) is detected.

How can this be done?
hi, i would also like to know your solution. did you solve it?

2 Answers

–1 vote
You can't do that as CKEditor will "spam" you text with HTML and that would be displayed in the textarea too...
0 votes
edited by

All right, I am dealing with the "removed line breaks" issue in the following, please see the comments!

Next I am posting a comment below this answer - it is the basic editor - using an Android Smartphone.

Now i am posting with a Samsung s3.

After each phrase a lune break.

For comments there is the basic editor.

Let's see if the line breaks survive and are displayef correctly.
edited by
The editor choice is in: *qa-page-question-post.php*
with: $editorname=isset($in['editor']) ? $in['editor'] : qa_opt('editor_for_as');

And also for questions and comments... see editor_for_qs and editor_for_cs!
edited by
Okay, I did the switch using:

        $editorname=isset($in['editor']) ? $in['editor'] : qa_opt('editor_for_as');
        // Basic editor for mobiles
        if( qa_is_mobile_probably() ) {
            $editorname = 'Basic Editor';

Tested it and ... still the same problem! Linebreaks get removed. Now I have no idea where the problem is! Why is it working here in q2a but not in http://www.klaustukai.lt/ ... I am loading another theme for mobiles. But how could the theme influence the line breaks? It's a riddle...
edited by
What is q2a doing? The format in the database is '' not 'html'. So my first thought that text gets saved as HTML and thus line-breaks disappear was wrong. It is saved as pure text but the linebreaks get lost somewhere.
** All right! Happy to say that I found out something important: When I choose "Basic Editor" for comments, and write text and line breaks by mobile phone, it works!!!

When I do the manual switch (as in my answer) it does not work. So obviously something is missing.