Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Notebook): enable HTML mode toggle for article notes #4442

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/web/components/patterns/ArticleNotes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export function ArticleNotes(props: NoteSectionProps): JSX.Element {
setText={props.setText}
saveText={saveText}
fillBackground={false}
isExpanded
/>
)
}
Expand Down Expand Up @@ -104,6 +105,7 @@ export function HighlightViewNote(props: HighlightViewNoteProps): JSX.Element {
setText={props.setText}
saveText={saveText}
fillBackground={true}
isExpanded={false}
/>
)
}
Expand All @@ -116,6 +118,7 @@ type MarkdownNote = {
text: string | undefined
setText: (text: string) => void
fillBackground: boolean | undefined
isExpanded: boolean

saveText: (text: string) => void
}
Expand Down Expand Up @@ -204,11 +207,12 @@ export function MarkdownNote(props: MarkdownNote): JSX.Element {
'block-quote',
'link',
'auto-resize',
'mode-toggle',
'save',
]}
style={{
width: '100%',
height: '180px',
height: props.isExpanded ? '360px' : '180px',
}}
renderHTML={(text: string) => mdParser.render(text)}
onChange={handleEditorChange}
Expand Down
9 changes: 8 additions & 1 deletion packages/web/components/patterns/MDEditorSavePlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ export default class MDEditorSavePlugin extends PluginComponent {
return (
<Button
style="plainIcon"
css={{ display: 'flex', pr: '5px' }}
css={{
alignItems: 'center',
display: 'flex',
height: '28px',
justifyContent: 'center',
lineHeight: '28px',
minWidth: '24px',
}}
onClick={(event) => {
document.dispatchEvent(new Event('saveMarkdownNote'))
event.preventDefault()
Expand Down
Loading