Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8e4f27d

Browse files
committed
Add Temp Patch on Focus Text Input UI For Safari Support
1 parent 6c0f5a2 commit 8e4f27d

File tree

1 file changed

+32
-8
lines changed
  • src/components/MainComponent

1 file changed

+32
-8
lines changed

‎src/components/MainComponent/Main.js

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@ import {
5858
//renderBlock, renderMark,
5959
} from "components/SlateJS";
6060

61-
import { BrowserView, isBrowser, isMobile } from "react-device-detect";
61+
import {
62+
BrowserView,
63+
isBrowser,
64+
isMobile,
65+
isSafari
66+
} from "react-device-detect";
6267
import FormControl from "@material-ui/core/FormControl";
6368
import Select from "@material-ui/core/Select";
6469
import MenuItem from "@material-ui/core/MenuItem";
@@ -393,14 +398,33 @@ export class _MainComponent extends React.Component {
393398
// this happens if the user types very quickly and it fires off a lot
394399
// of API requests, then we keep on receiving additional messages
395400
// from previous phrases that no longer apply
396-
if (message.prompt.trim().slice(-10) === text.trim().slice(-10)) {
397-
this.setState(
398-
{
399-
textPrompts: textPrompts
400-
},
401-
this.focusTextInput
402-
);
401+
const properMessage =
402+
message.prompt.trim().slice(-10) === text.trim().slice(-10);
403+
if (!properMessage) {
404+
return;
403405
}
406+
407+
this.setState({
408+
textPrompts: textPrompts
409+
});
410+
411+
// safari has an issue with slatejs race condition where focus is called
412+
// before the message has been fully loaded as slatejs text state
413+
//if (isSafari) {
414+
// this.setState(
415+
// {
416+
// textPrompts: textPrompts
417+
// },
418+
// );
419+
//}
420+
//else {
421+
// this.setState(
422+
// {
423+
// textPrompts: textPrompts
424+
// },
425+
// this.focusTextInput
426+
// );
427+
//}
404428
};
405429

406430
webSocketConnected = () => {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /