Commit 940d0e9
Markdown editor with Rich Text preview via MDAST - with cleanup (#2676)
* Lexical Plain Text Editor with Lexical Rich Text preview; custom extensible MDAST transformer for lossless conversions
* wip: Lexical MDAST docs
* enable Lexical reader on items and comments; re-implement distributed migration, debug 1-click migration; adapt interpolator to text -> lexicalState only
* revert Embed node to a classic Lexical node klass; styling bits
* support MD hard breaks, support multiple children in list item nodes and divide with line breaks; efficient transformer search by mdastType rather than blind-search; fix: set the code theme for every CodeNode instead of just the direct descendants; fix: insert default values from formik; add support for new editor item edits; tweaks to styling
* separate content CSS from editor CSS
* migrate to visitor-based MDAST transformations, unist for post-processing; changes to styling
* light cleanup
* fix mentions autocomplete dropdown positioning
* re-implement appendValue
* move lexical-markdown to lib/lexical/mdast
* replace hand-written unist visits with findAndReplace helper, update README
* execute media checks as a background job instead of polluting API response time; cleanup
* change codeblock theme via command instead of mutating the editor
* standardize node creation configs
* cleanup: better code separation and naming; remove upload dead code
* mediaCheck worker db update, mdast math nodes
* styling, add support for every form that used MarkdownInput; don't throw on unrecognized markdown, let it pass
* add BioForm, fix lint
* fix: add lexical state to reader memo deps
* barebones shortcuts extension 1:1 with MarkdownInput, restore ActionTooltip fade, improve structure and apply BEM convention to CSS
* add submit keyboard shortcut
* cleanup SCSS and CSS; fix: preserve list ordering by looking at the start value
* naming changes, seamless upgrade to Lexical from MarkdownInput, implement truncated text for SNInput; fix: trim empty nodes in a separate editor update
* remove spoilers support for stage 1; restructure plugins
* QA: fix HeadingNode replacement not respecting heading depth, fix codeblocks language interpretation, fix block elements not being spread inside listItem, fix spacing inside nodes that can't contain paragraphs; MDAST: enforce actions as sole transformations interface, remove redundant footnote exts, add exts to the Lexical->Markdown pipeline
* add footnotes support to MDAST and Lexical, update MDAST README; bit: full border radius on preview mode
* table alignments; improve list item visitor readability; cleanup
* fix globals.scss contenteditable conflicts; add support for table of contents; re-implement show-full-text if url has an hash
* rewrite Mentions plugin
* remove old Mentions plugin
* cleanup new Mentions plugin
* footnote backref as its own node, add toMarkdown extensions for custom nodes, document custom MDAST nodes, bugfixes
* poc: use DataLoader for lexical state generation on-request; fix territory description rendering
* fix territory form layout and rendering, update reader memo deps
* fix: ensure lexical is always under CarouselProvider
* address console logs, max length plugin and debug plugins
* add comment to memo deps of editor and reader; address invalid imgproxy html customs attributes
* add support for title and alt attributes for images; use Text component for PreviewPlugin; fix: footnote backref json export
* refactor node components; migrate to PlainTextExtension
* improve link fallbacks display via MediaNode: use display:inline for link fallbacks
* move Editor entrypoint to index SNEditor
* improve SNReader structure: Overflow handled in Text preventing re-renders on click; export links instead of media when exporting MediaNode to HTML; always open ToC
* cleanup: remove MediaCheckExtension (unused), complete some comments, multi-exports where necessary
* correct selector for padding rules in text.scss
* fix HTML<->Lexical style and spacings mismatch
* remove mediaCheck and lexicalState/html persistence in DB
* remove manual debug executeConversion md->lexical mutation
* fix imgproxyUrls typo
* FileUploadPlugin code clarity, add support for drag'n'drop uploads
* don't spawn a new preview reader unless the text has changed, conditionally hide rather than conditionally render the preview reader; use HistoryExtension
* derive Table of contents via Lexical with EditorRefPlugin; useCallbackRef for quick ref callbacks
* render bare links as media/embed only if they're standalone in a paragraph
* revert Text component re-export
* update Lexical to 0.39.0
* use Editor instance ref to reset formik form, fix hr html/lexical style mismatch, fix ToC button vertical spacing
* cleanup initializeEditorState function
* cleanup: code consistency
* revert ToC markdown fallback, readerRef is unavailable on first load because of CLS
* simplify EmbedNode and Embed Placeholder (just output a link during html), protect mention toString funcs
* optimize: ToC headings extraction via cached nodesOfType; cleanup: remove checkMedia option from SSR lexicalState generator, add comments
* metaOrCtrl for shortcuts, clean SNReader HTML fallback memo deps
* move DataLoader to Lexical lib group
* fix: enforce github-dark-default default code theme, compute inside useEffect
* fix: bi-directional preview toggle keyboard shortcut, scoped to the active editor; enforce a boolean pattern on commands called by shortcuts
* prevent scroll when focusing preview mode
* fix: override editorInput overflow rules when rendering Preview mode
* GalleryNode for adjacent image/video grid tiling; GalleryExtension for grouping MediaNodes in a GalleryNode; GalleryNode MDAST visitor; restore legacy responsive media sizing
* handle Autolinks in Lexical rather than MDAST, introduce GalleryExtension and AutolinkExtension to SSR lexical generator; tweaks to media styling for 1:1 prod behavior; basic media checks off MediaOrLink
* clickable headings with CSS; cleanup SNHeadingNode
* fix wrong lexical node comparison on LexicalLinkVisitor
* clearer helpers naming on SNHeadingNode
* replace clicks on <a> links with next/router allowing nextjs events (e.g. show full text on hash links); no attributes on internal links
* move MediaComponent useEffect at the top
* add support for lexical->mdast table alignments
* blocks: replace parent instead of link in the case of decorator block nodes (embeds), replace parent instead of TextNode in the case of {:toc} with unist's visit, treat TableOfContentsNode as DecoratorBlockNode
* clarify use-callback-ref utility
* refactor: ItemContextExtension to handle outlawed and imgproxy urls at API level, compute imgproxy-derived styles and urls and pass it to the MediaNode; MediaComponent->MediaOrLink architecture shake-up, imgproxy calculations are now done via Extension and MediaNode, simpler DOM
* remove LexicalItemContext
* remove html customizations
* exhaustive deps on sizes useMemo for useMediaHelper, remove LinkRaw from MediaComponent as we are not using states in stage 1
* fix weird checkbox positioning on checklist item with children checklist items; fix ItemContextExtension transform loop by applying rel to links; add general 66vw size to media with srcset; cleanup: hide unrecognized markdown errors in production
* remove: LegacyText, Markdown Text Components, MarkdownInput
* rehype parity: add support for misleading link transforms; add support for Nostr ID parsing into njump link
* remove: react-markdown, react-syntax-highlighter, react-textarea-autosize, rehype-mathjax, remark-gfm, remark-math; remove: legacy md toc utility
* cleanup and share imgproxy url srcset parsing to MediaOrLink for legacy support, rollback-friendly
* consistent markdown shortcuts command return
* fix lint, remove html from Reader useMemo deps as we don't need re-renders on html change (unlikely)
* fix lint, remove html from Reader useMemo deps as we don't need re-renders on html change (unlikely)
* media: exportDOM with imgproxy media type support
* README: Stacker News Lexical Extensions and /lib walkthrough; prepare for server and editor readmes
* fix: correct selector for code blocks css margins; cleanup: avoid nested editor.update calls, conventional editor.update handling
* fix exhaustive deps on Table of contents component
* performance: remove useMemo from dynamic Reader as dynamic already memoizes
* performance fix: avoid SNReader re-renders on text changes by making PreviewSync read from formik instead of passing text via props
* conditionally serve the style prop for legacy srcset
* check blob existence during paste/dragndrop file upload
* clear editor when canceling a reply
* fix: restore paragraph on enter, normalize imported markdown
* exclude format from srcSet imgproxy object
* performance: avoid recreating the Reader component on each render via dynamic
* cleanup: remove console.log
* ssr fallback with context
* revert Reader onReady
* territories: render description with lexical state
* fix: clear the preview and return to editor on submit
* revert SNFormattingExtension workaround that restored paragraphs on newlines
* remove topLevel from territory header
* fix: synchronize formik and preview to the given field-name; fix: hide heading slug link if heading is itself a link
* support truncated territory descriptions on popovers
* add truncated territory description support to TerritoryDetails
---------
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>1 parent 046a48a commit 940d0e9
File tree
128 files changed
+9217
-2202
lines changed- api
- resolvers
- typeDefs
- components
- editor
- contexts
- nodes
- plugins
- core
- toolbar
- payIn
- fragments
- lib
- lexical
- exts
- mdast
- transforms
- visitors
- nodes
- content
- decorative
- footnote
- mentions
- formatting
- misc
- server
- theme
- utils
- pages
- [name]
- api
- styles
- svgs/editor/toolbar/inserts
- wallets/client/components/form
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
128 files changed
+9217
-2202
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
1507 | 1508 | | |
1508 | 1509 | | |
1509 | 1510 | | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
1510 | 1526 | | |
1511 | 1527 | | |
1512 | 1528 | | |
| |||
1594 | 1610 | | |
1595 | 1611 | | |
1596 | 1612 | | |
| 1613 | + | |
1597 | 1614 | | |
1598 | 1615 | | |
1599 | 1616 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
361 | 362 | | |
362 | 363 | | |
363 | 364 | | |
364 | | - | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
365 | 381 | | |
366 | 382 | | |
367 | 383 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
39 | | - | |
| 40 | + | |
| 41 | + | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
108 | 110 | | |
109 | 111 | | |
110 | 112 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
32 | | - | |
33 | | - | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
| 114 | + | |
113 | 115 | | |
114 | 116 | | |
115 | 117 | | |
| |||
287 | 289 | | |
288 | 290 | | |
289 | 291 | | |
290 | | - | |
| 292 | + | |
291 | 293 | | |
292 | 294 | | |
293 | | - | |
| 295 | + | |
294 | 296 | | |
295 | 297 | | |
296 | 298 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
0 commit comments