Skip to content

Commit 06590ef

Browse files
committed
Revert "[TEMP] Update OverlayManager story for demo purposes"
This reverts commit 9e3b964.
1 parent 20c1969 commit 06590ef

File tree

2 files changed

+57
-32
lines changed

2 files changed

+57
-32
lines changed

Diff for: stories/Examples/Editor-with-overlay-manager.stories.mdx

+41
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,47 @@ import EditorWithOverlayManagerDemo from "./EditorWithOverlayManagerDemo";
1515
component={Editor}
1616
/>
1717

18+
# With overlay manager
19+
20+
An overlay manager was introduced in neetoUI to handle faulty Webkit animations
21+
on focussed inputs. If neetoEditor is auto focussed within a neetoUI Pane or
22+
neetoUI Modal component, it is likely that you would face similar issues.
23+
Similar to neetoUI you need to use an initialFocusRef to make sure that the
24+
editor is properly focussed.
25+
26+
```jsx
27+
import React, { useRef, useState } from "react";
28+
29+
import { Button, Pane, Typography } from "@bigbinary/neetoui";
30+
31+
import Editor from "@bigbinary/neeto-editor/Editor";
32+
33+
const EditorWithOverlayManager = () => {
34+
const [showPane, setShowPane] = useState(false);
35+
const initialFocusRef = useRef(null);
36+
37+
return (
38+
<>
39+
<Button label="Show Pane" onClick={() => setShowPane(true)} />
40+
<Pane
41+
initialFocusRef={initialFocusRef}
42+
isOpen={showPane}
43+
onClose={() => setShowPane(false)}
44+
>
45+
<Pane.Header>
46+
<Typography style="h2" weight="semibold">
47+
Typography
48+
</Typography>
49+
</Pane.Header>
50+
<Editor ref={initialFocusRef} />
51+
</Pane>
52+
</>
53+
);
54+
};
55+
56+
export default EditorWithOverlayManager;
57+
```
58+
1859
<Canvas>
1960
<EditorWithOverlayManagerDemo />
2061
</Canvas>

Diff for: stories/Examples/EditorWithOverlayManagerDemo.jsx

+16-32
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,27 @@ import React, { useRef, useState } from "react";
22

33
import { Button, Pane, Typography } from "@bigbinary/neetoui";
44

5-
import { Editor, EditorContent } from "../../src";
5+
import { Editor } from "../../src";
66

77
const EditorWithOverlayManager = () => {
8-
const [content, setContent] = useState(
9-
`<pre data-highlighted-lines=""><code class="language-css">mark {
10-
border-radius: var(--neeto-editor-rounded-sm);
11-
padding: 0px;
12-
}
13-
14-
[data-type="mention"] {
15-
color: rgb(var(--neeto-editor-accent-800));
16-
}</code></pre>`
17-
);
8+
const [showPane, setShowPane] = useState(false);
9+
const initialFocusRef = useRef(null);
1810

1911
return (
2012
<>
21-
<Editor
22-
initialValue={content}
23-
onChange={setContent}
24-
addons={[
25-
"highlight",
26-
"emoji",
27-
"code-block",
28-
"block-quote",
29-
"image-upload",
30-
"image-upload-unsplash",
31-
"video-upload",
32-
"video-embed",
33-
"paste-unformatted",
34-
"undo",
35-
"redo",
36-
"attachments",
37-
"table",
38-
"text-color",
39-
]}
40-
/>
41-
<EditorContent content={content} />
13+
<Button label="Show Pane" onClick={() => setShowPane(true)} />
14+
<Pane
15+
initialFocusRef={initialFocusRef}
16+
isOpen={showPane}
17+
onClose={() => setShowPane(false)}
18+
>
19+
<Pane.Header>
20+
<Typography style="h2" weight="semibold">
21+
Typography
22+
</Typography>
23+
</Pane.Header>
24+
<Editor ref={initialFocusRef} />
25+
</Pane>
4226
</>
4327
);
4428
};

0 commit comments

Comments
 (0)