Skip to content

Commit

Permalink
Fix detection of iOS browser (facebook#1719)
Browse files Browse the repository at this point in the history
  • Loading branch information
trueadm authored Apr 14, 2022
1 parent c460505 commit aa9f1e5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/lexical/src/LexicalUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import type {
import type {RootNode} from './nodes/LexicalRootNode';
import type {TextFormatType, TextNode} from './nodes/LexicalTextNode';

import {IS_APPLE, IS_SAFARI} from 'shared/environment';
import {IS_APPLE, IS_IOS, IS_SAFARI} from 'shared/environment';
import getDOMSelection from 'shared/getDOMSelection';
import invariant from 'shared/invariant';

Expand Down Expand Up @@ -536,7 +536,7 @@ export function $updateTextNodeFromDOMContent(
if (compositionEnd || normalizedTextContent !== prevTextContent) {
if (normalizedTextContent === '') {
$setCompositionKey(null);
if (!IS_SAFARI) {
if (!IS_SAFARI && !IS_IOS) {
// For composition (mainly Android), we have to remove the node on a later update
const editor = getActiveEditor();
setTimeout(() => {
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/src/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ export const CAN_USE_BEFORE_INPUT: boolean =
export const IS_SAFARI: boolean =
CAN_USE_DOM && /Version\/[\d\.]+.*Safari/.test(navigator.userAgent);

// Keep these in case we need to use them in the future.
export const IS_IOS: boolean = CAN_USE_DOM && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;

// Keep these in case we need to use them in the future.
// export const IS_WINDOWS: boolean = CAN_USE_DOM && /Win/.test(navigator.platform);
// export const IS_IOS: boolean = CAN_USE_DOM && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
// export const IS_CHROME: boolean = CAN_USE_DOM && /^(?=.*Chrome).*/i.test(navigator.userAgent);
// export const canUseTextInputEvent: boolean = CAN_USE_DOM && 'TextEvent' in window && !documentMode;

0 comments on commit aa9f1e5

Please sign in to comment.