jQuery submit events do not trigger the native submit event, and
therefore the TinyMCE submit listener is not called. This means that the
tinymce.triggerSave() function is not called, and the editor content is
not saved.
To work around this, if there is a form for the Node that the editor is
attached to, the jQuery submit event is listened to and the save event
called.
Unfortunately it is not possible to use a global jQuery submit listener
added to the document to save all editors on the page.
In some cases, this is too late because the bubbling process means that
a child node consumer may attempt to consume the data before the
delegated handler is called for the document.
The autosave is reset on form submission, but if that form submission
happens at the same time as a page reload, the connection and/or server
is slow, then the connection may be aborted before the session is
removed.
This commit changes the autosave reset to use the fetch() API with a
keepalive flag.
Unfortunately we do not have a formal endpoint for this in Moodle JS so
this is a hackier approach than I would like. MDL-76463 has been opened
to investigate this.
This commit also fixes a situation where the autosave content is re-sent
when the user has typed in the editor and their next action is to click
on the submit button. This is now blocked for that editor instance.
Bootstrap core's "reboot" sets a default text-align which is
incompatible with RTL languages.
Arguably this should be set in the Boost theme, but this is a fairly
large change which has potential to break things so I'm making it here
where we experience the issue for now.
TinyMCE uses a magic langstring only present in RTL languages which
makes it hard to automatically fetch from their strings.
Since it's the only magic string I can find a reference to (after
searching their codebase), I've elected to add this in the lang.php
serving layer. This allows us to use our own langstring instead of
re-declaring something that should be stored once across Moodle.
AMOS can only cope with string identifiers with a length < 100
characters. Our tooling for Tiny automatically generates string idents
based on the language string and these can end up longer.
This change modifies our generated idents to be capped at 90 characters.
Atto mixed vertical and horizontal alignment into a single selection,
which does not make any sense. It also used CSS classes in such a way
that those styles will break if/when Atto is removed.
This commit:
* removes the horizontal alignment from the dropdown - these are easily
achieved using the existing Tiny UI
* addresses a bug where existing styles (like horizontal alignment) were
not preserved when editing the image
* fixes a bug where the CSS selector was used instead of a CSS class
name
* recognises legacy TinyMCE class names and replaces these
* switches from using random class names to using Bootstrap class
utility classes for vertical alignment.
The Atto preview plugin does not support Moodle filters. This commit
disables it for now with the intent that in a future release we may
replace it with a Moodle version which applies our filters correctly.