solved tinyMCE on Mobile Devices

TiG
TiG
@tig
7 years ago
184 posts
We recognize jamroom dissuades using tinyMCE on mobile devices. However, we have a need to provide tinyMCE for mobile devices for creating / changing blog articles. Unfortunately it looks as though there is logic deep in the core (page.php as one example) that swaps 'editor' for 'textarea' for mobile devices.

 // If this is a mobile device, and we are asking for an editor, we use a text area instead
 if ($_field['type'] == 'editor' && jrCore_is_mobile_device()) {
        $_field['type'] = 'textarea';
 }

This is not code we will override (for obvious reasons). Anyone know of a technically prudent way to accomplish the goal of using tinyMCE as the editor for Blogs? An appropriate listener would do the trick.

Will keep looking, but thought I would raise the question in hopes of an easy method.


--
TiG

updated by @tig: 12/21/17 07:20:46PM
michael
@michael
7 years ago
7,715 posts
First thing that comes to mind is to not return TRUE for "is this a mobile device"

That looks doable by setting the 'jrcore_is_mobile_device' flag to "no"
jrCore_set_flag('jrcore_is_mobile_device', 'no');

and perhaps disable tablet detection as well:
jrCore_set_flag('jrcore_is_tablet_device', 'no');

One place to put this to make sure it always ran would be into the config.php file at:
/data/config/config.php

Add it to the bottom.

( Have tried it to check it works, but have not thought any further about the consequences of doing it. Expect that it would break the mobile menu system, possibly other things, not sure. )
TiG
TiG
@tig
7 years ago
184 posts
@michael

Okay so I could bracket the form generation logic only for blogs so that the function(s) thinks it is NOT on a mobile device (when it is). My task then is to find the tightest scope in which to make this happen.

I am not likely to do this, but your response is greatly helpful. Most of the time I ask questions just to avoid hours of research (on my part). That is what is so great about your forum, you guys are on the ball and are willing to share. Much appreciated!


--
TiG
michael
@michael
7 years ago
7,715 posts
I tried 'form_view' listener first, but that didn't work, so move it to an earlier listener 'module_view' and that kicks in effectively.

Here is the super simple module ( zip attached )
zip
xxMobileEditor.zip  •  1KB

TiG
TiG
@tig
7 years ago
184 posts
@michael

Thanks much for providing an unexpected solution.


--
TiG

Tags