Skip to content

Commit

Permalink
Fix markdown editor not updating resource #969
Browse files Browse the repository at this point in the history
  • Loading branch information
Polleps authored and joepio committed Oct 2, 2024
1 parent 4e814ad commit 246fd8f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions browser/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ This changelog covers all five packages, as they are (for now) updated as a whol
- [#952](https://github.com/atomicdata-dev/atomic-server/issues/952) Add templates containing pre made ontologies and resources.
- [#970](https://github.com/atomicdata-dev/atomic-server/issues/970) Add "show commit" button in History
- [#968](https://github.com/atomicdata-dev/atomic-server/issues/968) Allow users to pick files by entering a subject into the file picker search bar.
- [#969](https://github.com/atomicdata-dev/atomic-server/issues/969) Fix markdown editor sometimes doesn't update the value after saving.
- Fix markdown editor closing the edit page when a button is clicked.

### @tomic/lib

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default function AsyncMarkdownEditor({
/>
)}
<EditorContent key='rich-editor' editor={editor}>
<FloatingMenu editor={editor ?? undefined}>
<FloatingMenu editor={editor ?? null}>
<FloatingMenuText>Type &apos;/&apos; for options</FloatingMenuText>
</FloatingMenu>
<BubbleMenu />
Expand Down
6 changes: 6 additions & 0 deletions browser/data-browser/src/chunks/MarkdownEditor/BubbleMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export function BubbleMenu(): React.JSX.Element {
active={!!editor.isActive('bold')}
onClick={() => editor.chain().focus().toggleBold().run()}
disabled={!editor.can().chain().focus().toggleBold().run()}
type='button'
>
<FaBold />
</ToggleButton>
Expand All @@ -44,6 +45,7 @@ export function BubbleMenu(): React.JSX.Element {
active={!!editor.isActive('italic')}
onClick={() => editor.chain().focus().toggleItalic().run()}
disabled={!editor.can().chain().focus().toggleItalic().run()}
type='button'
>
<FaItalic />
</ToggleButton>
Expand All @@ -52,6 +54,7 @@ export function BubbleMenu(): React.JSX.Element {
active={!!editor.isActive('strike')}
onClick={() => editor.chain().focus().toggleStrike().run()}
disabled={!editor.can().chain().focus().toggleStrike().run()}
type='button'
>
<FaStrikethrough />
</ToggleButton>
Expand All @@ -60,6 +63,7 @@ export function BubbleMenu(): React.JSX.Element {
active={!!editor.isActive('blockquote')}
onClick={() => editor.chain().focus().toggleBlockquote().run()}
disabled={!editor.can().chain().focus().toggleBlockquote().run()}
type='button'
>
<FaQuoteLeft />
</ToggleButton>
Expand All @@ -68,6 +72,7 @@ export function BubbleMenu(): React.JSX.Element {
active={!!editor.isActive('code')}
onClick={() => editor.chain().focus().toggleCode().run()}
disabled={!editor.can().chain().focus().toggleCode().run()}
type='button'
>
<FaCode />
</ToggleButton>
Expand All @@ -80,6 +85,7 @@ export function BubbleMenu(): React.JSX.Element {
as={RadixPopover.Trigger}
active={!!editor.isActive('link')}
disabled={!editor.can().chain().focus().toggleCode().run()}
type='button'
>
<FaLink />
</ToggleButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function EditorEvents({ onChange }: EditorEventsProps): null {
editor.off('update', callback);
}
};
}, [editor]);
}, [editor, onChange]);

return null;
}

0 comments on commit 246fd8f

Please sign in to comment.