maths / moodle-qtype_stack

Stack question type for Moodle
GNU General Public License v3.0
142 stars 149 forks source link

Implement a STACK admin option to force use of plain text editor, regardless of users' editor preferences #1208

Closed sangwinc closed 2 weeks ago

sangwinc commented 5 months ago

TinyMCE is causing a lot of unpleasantness, messing up multilang content, LaTeX, JS etc. It is the default editor, and many new users do not know it's a problem. Indeed, why would they know and why would they expect anything other than flawless performance from the default editor!

Do we need an option at the STACK admin level to force use of plain text editor, regardless of users' editor preferences?

aharjula commented 5 months ago

Well, we would then need to have some alternative way for people to attach pictures/files to the questions, "plain text editor" does not support that and this is often a problem leading to people switching between editors during the start of authoring of a question. It might be a bit too much to have a system setting that basically removes that capability from the authors.

But yes, TinyMCE has really messed up plenty of old multilang content (in my world), even outside STACK questions and people really were not ready for that. Luckily the multilang2 filter is relatively easily available, at least that uses syntax that is not being cleaned away.

I would suggest a setting that has three modes:

  1. Respect the user editor setting always.
  2. Detect sensitive content, and override the setting and display warning messages to explain. Maybe some extra tools (like the dollar converter) at the same time, for example, a tool for converting those multilang spans to STACK own [[lang]]-blocks, which would be safe from TinyMCE and after the conversion step maybe the question is no longer sensitive and could probably then be opened with whatever editor is active.
  3. Always plain text i.e. no file attachments.

Could almost make the second mode the default...

christianp commented 5 months ago

What could you do to work with tinymce? Are you able to, instead of using plain-text tags for stuff you process, use HTML elements? Can you add buttons to the TinyMCE toolbar?

timhunt commented 5 months ago

I would not try to decide that in a STACK bubble. I would discuss that with knowledgeable people in the Moodle space. E.g. Andrew Lyons, who can be reached through https://moodledev.io/general/channels#developer-chat or a relevant forum thread (not sure if that is the most relevant thread).

anst-i commented 5 months ago

We've had an issue with TinyMCE since it strips our multilang tags outside of

tags as this is technically not valid HTML. For multilang purposes it's much nicer to have the multilang outside of the

tags, so I don't want to give it up on my "wrong code" (which ends up being correct code after multilang has done its thing). I have complained here, let's see where the discussion goes: https://tracker.moodle.org/browse/MDL-82239

Alternatively if the plain editor could use a monospace font, that would already be helpful.

sangwinc commented 5 months ago

I would not try to decide that in a STACK bubble. I would discuss that with knowledgeable people in the Moodle space. E.g. Andrew Lyons, who can be reached through https://moodledev.io/general/channels#developer-chat or a relevant forum thread (not sure if that is the most relevant thread).

Thanks Tim, yes, that's the correct approach of course in the first instance!

LukeLongworth commented 5 months ago

I have a suspicion that this sort of admin option forcing my colleagues to use a plain-text editor rather than our default editor (currently still Atto for us I think) would cause more headaches than it's worth. Many of my colleagues are unfamiliar with HTML formatting, and would get confused if they were moved away from a WYSIWYG editor unexpectedly.

I had a read of the Moodle issue raised by Andreas and I'm hopeful that this suggestion:

A discussion can be had about giving admins the ability to toggle off Tiny's verify_html settings (on by default). This would allow users to submit malformed HTML, but we could handle it in a couple of different ways:

  • Show a warning when malformed HTML is used
  • Don't show any warning and allow the malformed HTML

would work fine here (particularly the former option).

I have other complaints/wishes for the plain text editor (I want monospacing, tabbing and context aware highlights that don't edit my code!) but that feels beyond the scope of this discussion.

anst-i commented 5 months ago

Agree on all points. Maybe we as a STACK community could try to make a push towards a slightly more advanced plain editor? (Yes, I'm well aware how contradicting that sounds)

anst-i commented 4 months ago

Other users are also not happy about TinyMCE interfering with code: https://tracker.moodle.org/browse/MDL-80953

sangwinc commented 4 months ago

IT turns out this is a duplicate of issue #433 (from 2019) and we even started a solution in this branch https://github.com/maths/moodle-qtype_stack/tree/iss433

sangwinc commented 2 weeks ago

OK, I added a stern warning to the editor form.

https://github.com/maths/moodle-qtype_stack/blob/dev/edit_stack_form.php#L199

That might help...