Changelog
0.78.1 2022-08-12
#1570 Multichar symbols (using onMulticharSymbol
) would not always be
recognized, for example when following a binary operator.
#1576 regression in 0.78.0: crash when entering Unicode characters with no special mapping, e.g. "°".
Changelog
0.78.0 2022-08-11
The way errors are reported has changed.
Previously a math-error
event would be dispatched (or the onError
listener
would be invoked). This made it difficult to find out when an error no longer
applied.
font-not-found
: If the fonts fail to load, a class of
ML__fonts-did-not-load
is added to the document's body.invalid-keybinding
: A message is output to the console if a keybinding
includes a combination of keys which cannot be performed with the current
keyboard layoutmf.errors
, an array of LatexSyntaxError
. This property can
be consulted for example during the handler for a change
event.Inline shortcuts now only apply in math mode. The mode
property of
InlineShortcutDefinition
has been removed.
Internal: introduction of GlobalContext
to encapsulate information necessary
to parse and render: macro definitions, registers, definition of commands and
some optional settings. A mathfield is a GlobalContext
, but it is also used
when rendering static LaTeX.
The symbol used to indicate a placeholder (i.e. \placeholder{}
) can now be
customized with mf.setOptions({ placeholderSymbol: '?' })
.
Some symbols that work pretty well:
U+25A0
BLACK SQUARE
U+25A2
WHITE SQUARE WITH ROUNDED CORNERS
U+2B1A
DOTTED SQUARE
The following CSS variables can be used to control the appearance of the selection:
--selection-background-color-focused
--selection-background-color
--selection-color-focused
--selection-color
--caret-color
Spacing commands (e.g. \,
) now serialize a space when using the ascii-math
format
#1572 Keyboard events (keyup
, keydown
, keypress
) are now fired more
consistently. They can be intercepted by calling preventDefault()
during the
capture phase.
fractionNavigationOrder
to "denominator-numerator"
.paste
event and
doing a preventDefault()
on itclick
event is now dispatched when a click occurs
inside the mathfield.<header>
of the documentkeydown
events are now propagated for non-printable keys.skipBoundary
property) was skipped
when moving forwardChangelog
0.77.0 2022-07-05
moveToNextPlaceholder
(equivalent to Tab key on physical keyboard) to
commit
(equivalent to Return on physical keyboard). Pressing this key
(or the Return key on a physical keyboard) triggers a change
event.makeSharedVirtualKeyboard()
if clicking directly on the virtual
keyboard toggle of a mathfield that is not focused, the keyboard would be
displayed with options that did not match the mathfield (it would have the
wrong custom keyboard for example).blur()
on a <math-field>
element resulted in
document.activeElement
still being set to the mathfield.Changelog
0.76.1 2022-06-29
Changelog
0.76.0 2022-06-28
\colorbox
command, use \ensuremath
when
necessary to indicate that the content is math, rather than a mode shift
command#1335 Added support for the beforeinput
and input
events from [Input
Events Level 1] (https://www.w3.org/TR/input-events-1/).
While an input
event was dispatched before, it did not conform to the
InputEvent
interface. The input
event now includes an inputType
property
detailing what caused the event to be dispatched, and in some cases a data
property.
The beforeinput
event is dispatched before the content of the mathfield is
modified and is a cancelable event.
A pair of beforeinput
and input
events are also dispatched when content is
deleted, with an appropriate inputType
value.
An input
event with a inputType
property of "insertLineBreak"
is
dispatched when the Return or Enter keys are pressed.
This matches more closely the behavior of the <textarea>
element.
Added new latex-unstyled
output format. Use it with getValue()
to get a
LaTeX representation of the mathfield content, without any color or background
color styling command
\char"0040 4
, or in general any command with an
unbraced numeric argument followed by an ambiguous decimal or hexadecimal
character<mathfield>
element had some hooks and listeners customized,
then was removed from the DOM and reinserted later, the hooks and listener
functions would revert to their default implementationChangelog
0.75.0 2022-06-21
container
and content
CSS part to customize the inside of the
mathfield.makeSharedVirtualKeyboard()
, calling setOptions()
to change the virtual
keyboard mode on those mathfields could cause the keyboards to not be shared.shift
+quote
)
work again=
character was produced in the serialization of \ne
.
The MathML and ASCIIMath serialization of \ne
were incorrect.Changelog
0.74.0 2022-06-06
Improved API/workflow to control the behavior of the virtual keyboard when multiple mathfields are displayed in the page.
In order to get a coordinated behavior between the mathfields, it is now only
necessary to call makeSharedVirtualKeyboard()
.
The use-shared-virtual-keyboard
attribute is now only necessary when using a
mathfield in an iframe.
If the virtual-keyboard-mode
attribute of mathfield is set to auto
or
onfocus
, the virtual keyboard will activate and hide automatically. It is no
longer necessary to set the mode to off
and to listen for focus change event
to show/hide the keyboard manually.
If the virtual keyboard is visible and the focus changes between two mathfields, the virtual keyboard will stay visible (it will not hide with an animation, then get revealed again).
If changing focus between two mathfields with identical keyboard configurations the keyboard will not blink (previously the keyboard would get destructed and reconstructed, even if its configuration was identical between two mathfields).
input
eventChangelog
0.73.7 2022-05-29
$$
as a format
indicator.Changelog
0.73.6 2022-05-28
Changelog
0.73.4 2022-05-27
\colorbox
command, and other text mode commands, to be
more interoperable when they contain math content (use $
and $$
rather
than \\(
and \\[
))