Sometimes user input is connected with a native browser/OS behavior, e.g.
- pressing Enter inserts a new line and triggers autocorrection,
- double pressing space inserts a period.
However, RTEs often want to prevent the beforeinput events to be able to customize the input, e.g. preventing beforeinput after pressing Enter to insert a new paragraph. Such prevention disables the native browser behavior. There should be a way to keep the behavior but without the input, e.g.
- pressing Enter does not insert a new line but triggers autocorrection,
- double pressing space insert a period regardless of how many
beforeinput events have been prevented.
Some loose ideas of how such API could work:
- a new parameter to the
event.preventDefault() to allow native behavior – event.preventDefault( { behavior: true } ),
- a new method on the
event to prevent only input – event.preventInput(),
- a new method on the
event to trigger native behavior manually – event.fireConnectedBehavior().
Sometimes user input is connected with a native browser/OS behavior, e.g.
However, RTEs often want to prevent the
beforeinputevents to be able to customize the input, e.g. preventingbeforeinputafter pressing Enter to insert a new paragraph. Such prevention disables the native browser behavior. There should be a way to keep the behavior but without the input, e.g.beforeinputevents have been prevented.Some loose ideas of how such API could work:
event.preventDefault()to allow native behavior –event.preventDefault( { behavior: true } ),eventto prevent only input –event.preventInput(),eventto trigger native behavior manually –event.fireConnectedBehavior().