Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .changeset/fix-markdown-fullscreen-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@churchapps/apphelper": patch
---

Fix fullscreen markdown editor bugs: TRANSFORMERS.splice mutated the shared Lexical export, a formatting-state check was comparing a boolean to a string, and MarkdownModal called onChange on every render instead of only on user edits.
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ export const MarkdownModal: React.FC<Props> = ({ value, onChange, hideModal }) =
setInputVal(value || "");
}, [value, inputVal]);

useEffect(() => { onChange(inputVal); }, [inputVal, onChange]);

return (<Dialog open={true} onClose={() => { hideModal(); }} fullScreen={true}>
<DialogTitle>{Locale.label("markdownEditor.markdownGuide")}</DialogTitle>
<DialogContent>
<Grid container spacing={3}>
<Grid size={6}>
<TextField fullWidth multiline label={<>{Locale.label("markdownEditor.content")} &nbsp; {guideLink}</>} name="modalMarkdown" className="modalMarkdown" InputProps={{ style: { height: "80vh" } }} value={inputVal} onChange={(e) => {
setInputVal(e.target.value);
onChange(e.target.value);
}} placeholder="" />
</Grid>
<Grid size={6}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ function useFloatingTextFormatToolbar(editor: any, anchorElem: any) {

if ($isRangeSelection(selection)) {
const text = selection.getTextContent().trim();
if (text && JSON.stringify(lastFormattingState === "{}")) {
if (text && JSON.stringify(lastFormattingState) === "{}") {
updateFormattingState(editor);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ export const PLAYGROUND_TRANSFORMERS: Array<Transformer> = [
...ELEMENT_TRANSFORMERS,

CUSTOM_LINK_NODE_TRANSFORMER,
...TRANSFORMERS.splice(0, 13),
...TRANSFORMERS.slice(0, 13),
UNDERLINE
];
Loading