Skip to content

Type Editor


Type Editor / @type-editor/dom-change-util / browser-hacks/looks-likes-enter-key-ios / looksLikesEnterKeyiOS

Function: looksLikesEnterKeyiOS()

ts
function looksLikesEnterKeyiOS(view, inlineChange, addedNodes): boolean;

Defined in: browser-hacks/looks-likes-enter-key-ios.ts:23

Checks if the change looks like the effect of pressing the Enter key.

Sometimes it's better to handle block creation through the Enter key handler rather than as a DOM change. This function detects those cases for iOS:

iOS Enter Detection: iOS specifically tracks Enter key presses. If a recent Enter was detected and either the change is not inline or block elements (DIV/P) were added, treat it as an Enter key press.

Parameters

ParameterTypeDescription
viewPmEditorViewThe editor view containing input state and plugin handlers
inlineChangebooleanWhether the change is within inline content (vs block-level)
addedNodesreadonly Node[]Array of DOM nodes that were added during the mutation

Returns

boolean

True if the change looks like Enter and a key handler accepted it, false if the change should be processed as a normal DOM change