@meowdown/react 0.77.0 → 0.78.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -10
- package/dist/index.d.ts +9 -3
- package/dist/index.js +12 -9
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -58,16 +58,16 @@ export function App() {
|
|
|
58
58
|
|
|
59
59
|
Common `MarkdownEditor` props:
|
|
60
60
|
|
|
61
|
-
| Prop
|
|
62
|
-
|
|
|
63
|
-
| `mode`
|
|
64
|
-
| `searchQuery` / `onSearchChange`
|
|
65
|
-
| `onWikilinkClick` / `onLinkClick` / `onTagClick` / `onImageClick` / `onFileClick` / `onXPostMediaClick` / `onYouTubeVideoClick`
|
|
66
|
-
| `resolveImageUrl` / `resolveWikiEmbed` / `resolveWikilink` / `resolveFileLink` / `resolveFileInfo`
|
|
67
|
-
| `onFilePaste`
|
|
68
|
-
| `onSlashMenuSearch` / `onTagSearch` / `onWikilinkSearch` / `onSelectionMenuSearch`
|
|
69
|
-
| `readOnly` / `placeholder` / `blockHandle` / `caretGlide` / `embedPaste` / `linkPaste` / `bulletAfterHeading`
|
|
70
|
-
| `CodeBlockView`
|
|
61
|
+
| Prop | What it does |
|
|
62
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
63
|
+
| `mode` | `'focus'` (default), `'show'`, or `'hide'`: how much Markdown syntax stays in view |
|
|
64
|
+
| `searchQuery` / `onSearchChange` | Find in document, with `EditorHandle.findNext()` / `findPrevious()` |
|
|
65
|
+
| `onWikilinkClick` / `onLinkClick` / `onTagClick` / `onImageClick` / `onFileClick` / `onXPostMediaClick` / `onYouTubeVideoClick` | Click handling for the rendered atoms |
|
|
66
|
+
| `resolveImageUrl` / `resolveWikiEmbed` / `resolveWikilink` / `resolveFileLink` / `resolveFileInfo` | Resolve and classify local content |
|
|
67
|
+
| `onFilePaste` | Persist pasted or dropped files |
|
|
68
|
+
| `onSlashMenuSearch` / `onTagSearch` / `onWikilinkSearch` / `onSelectionMenuSearch` | Search menus for `/`, `#`, `[[`, and selection commands |
|
|
69
|
+
| `readOnly` / `placeholder` / `blockHandle` / `caretGlide` / `embedPaste` / `linkPaste` / `bulletAfterHeading` / `backspaceDeletesEmptyFirstBlock` | Behavior toggles |
|
|
70
|
+
| `CodeBlockView` | Custom React node view component for code blocks |
|
|
71
71
|
|
|
72
72
|
Every prop, callback, and `EditorHandle` method is documented in the [API reference](https://npmx.dev/package-docs/@meowdown%2Freact/).
|
|
73
73
|
|
package/dist/index.d.ts
CHANGED
|
@@ -495,6 +495,12 @@ interface EditorProps {
|
|
|
495
495
|
* Off by default.
|
|
496
496
|
*/
|
|
497
497
|
bulletAfterHeading?: boolean;
|
|
498
|
+
/**
|
|
499
|
+
* Pressing Backspace in an empty paragraph that is the document's first
|
|
500
|
+
* block deletes that paragraph, so the rest of the document moves up one
|
|
501
|
+
* line. The block after it keeps its type. Off by default.
|
|
502
|
+
*/
|
|
503
|
+
backspaceDeletesEmptyFirstBlock?: boolean;
|
|
498
504
|
/**
|
|
499
505
|
* Replaces typed character sequences with their typographic equivalents,
|
|
500
506
|
* e.g. `->` with `→` and `(c)` with `©`. On by default.
|
|
@@ -577,7 +583,7 @@ interface EditorProps {
|
|
|
577
583
|
*
|
|
578
584
|
* Callbacks and resolvers should be stable; pass them via `useCallback`.
|
|
579
585
|
*/
|
|
580
|
-
export declare function MarkdownEditor({ mode, initialMarkdown, singleParagraph, referenceDefinitions, onDocChange, onSlashMenuSearch, onTagSearch, onWikilinkSearch, onSelectionMenuSearch, selectionMenuAffordance, pendingReplacementActions, onPendingReplacementResolve, onWikilinkClick, onLinkClick, onLinkCopy, resolveLinkPreview, onTagClick, onExitBoundary, resolveImageUrl, resolveFileLink, resolveWikiEmbed, resolveWikilink, resolveFileInfo, resolveXPost, mediaUrlProtocols, resolveYouTubeVideo, onFileClick, onFilePaste, onFileSaveError, onImageClick, onXPostMediaClick, onYouTubeVideoClick, embedPaste, linkPaste, bulletAfterHeading, substitution, frontmatter, blockHandle, caretGlide, placeholder, readOnly, spellCheck, searchQuery, onSearchChange, timeFormat, editorClassName, wrapperClassName, CodeBlockView, handleRef, children }: EditorProps): ReactElement;
|
|
586
|
+
export declare function MarkdownEditor({ mode, initialMarkdown, singleParagraph, referenceDefinitions, onDocChange, onSlashMenuSearch, onTagSearch, onWikilinkSearch, onSelectionMenuSearch, selectionMenuAffordance, pendingReplacementActions, onPendingReplacementResolve, onWikilinkClick, onLinkClick, onLinkCopy, resolveLinkPreview, onTagClick, onExitBoundary, resolveImageUrl, resolveFileLink, resolveWikiEmbed, resolveWikilink, resolveFileInfo, resolveXPost, mediaUrlProtocols, resolveYouTubeVideo, onFileClick, onFilePaste, onFileSaveError, onImageClick, onXPostMediaClick, onYouTubeVideoClick, embedPaste, linkPaste, bulletAfterHeading, backspaceDeletesEmptyFirstBlock, substitution, frontmatter, blockHandle, caretGlide, placeholder, readOnly, spellCheck, searchQuery, onSearchChange, timeFormat, editorClassName, wrapperClassName, CodeBlockView, handleRef, children }: EditorProps): ReactElement;
|
|
581
587
|
//#endregion
|
|
582
588
|
//#region src/components/markdown-view.d.ts
|
|
583
589
|
/**
|
|
@@ -625,7 +631,7 @@ interface MarkdownViewProps {
|
|
|
625
631
|
/**
|
|
626
632
|
* Interpret content as one paragraph, without block syntax.
|
|
627
633
|
*/
|
|
628
|
-
|
|
634
|
+
singleParagraph?: boolean;
|
|
629
635
|
/**
|
|
630
636
|
* Reference definitions available outside this fragment.
|
|
631
637
|
*/
|
|
@@ -737,7 +743,7 @@ interface MarkdownViewProps {
|
|
|
737
743
|
* Callbacks (`onWikilinkClick`, etc.) and resolvers should be stable; pass them via
|
|
738
744
|
* `useCallback` to avoid re-rendering the whole tree.
|
|
739
745
|
*/
|
|
740
|
-
export declare function MarkdownView({ markdown,
|
|
746
|
+
export declare function MarkdownView({ markdown, singleParagraph, referenceDefinitions: suppliedDefinitions, markMode, frontmatter, interactive, expandCollapsed, resolveImageUrl, resolveFileLink, resolveWikiEmbed, resolveWikilink, resolveFileInfo, resolveXPost, mediaUrlProtocols, resolveYouTubeVideo, onWikilinkClick, onLinkClick, onImageClick, onXPostMediaClick, onYouTubeVideoClick, onFileClick, onTaskClick, className }: MarkdownViewProps): ReactElement;
|
|
741
747
|
//#endregion
|
|
742
748
|
//#region src/hooks/use-lightbox.d.ts
|
|
743
749
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1884,7 +1884,7 @@ function findHeadingPosition(doc, fragment) {
|
|
|
1884
1884
|
});
|
|
1885
1885
|
return match;
|
|
1886
1886
|
}
|
|
1887
|
-
function ProseKitEditor({ markMode = "focus", initialMarkdown, singleParagraph = false, referenceDefinitions, onDocChange, onSlashMenuSearch, onTagSearch, onWikilinkSearch, onSelectionMenuSearch, selectionMenuAffordance = true, pendingReplacementActions, onPendingReplacementResolve, onWikilinkClick, onLinkClick, onLinkCopy, resolveLinkPreview, onTagClick, onExitBoundary, resolveImageUrl, resolveFileLink, resolveWikiEmbed, resolveWikilink, resolveFileInfo, resolveXPost, mediaUrlProtocols, resolveYouTubeVideo, onFileClick, onFilePaste, onFileSaveError, onImageClick, onXPostMediaClick, onYouTubeVideoClick, embedPaste, linkPaste, bulletAfterHeading, substitution = true, frontmatter = false, blockHandle = true, placeholder, readOnly, spellCheck, searchQuery = "", onSearchChange, timeFormat, editorClassName, CodeBlockView, ref, children }) {
|
|
1887
|
+
function ProseKitEditor({ markMode = "focus", initialMarkdown, singleParagraph = false, referenceDefinitions, onDocChange, onSlashMenuSearch, onTagSearch, onWikilinkSearch, onSelectionMenuSearch, selectionMenuAffordance = true, pendingReplacementActions, onPendingReplacementResolve, onWikilinkClick, onLinkClick, onLinkCopy, resolveLinkPreview, onTagClick, onExitBoundary, resolveImageUrl, resolveFileLink, resolveWikiEmbed, resolveWikilink, resolveFileInfo, resolveXPost, mediaUrlProtocols, resolveYouTubeVideo, onFileClick, onFilePaste, onFileSaveError, onImageClick, onXPostMediaClick, onYouTubeVideoClick, embedPaste, linkPaste, bulletAfterHeading, backspaceDeletesEmptyFirstBlock, substitution = true, frontmatter = false, blockHandle = true, placeholder, readOnly, spellCheck, searchQuery = "", onSearchChange, timeFormat, editorClassName, CodeBlockView, ref, children }) {
|
|
1888
1888
|
const suppressDocChangeRef = useRef(false);
|
|
1889
1889
|
const handleDocChange = useMemo(() => {
|
|
1890
1890
|
if (!onDocChange) return;
|
|
@@ -1917,6 +1917,7 @@ function ProseKitEditor({ markMode = "focus", initialMarkdown, singleParagraph =
|
|
|
1917
1917
|
embedPaste,
|
|
1918
1918
|
linkPaste,
|
|
1919
1919
|
bulletAfterHeading,
|
|
1920
|
+
backspaceDeletesEmptyFirstBlock,
|
|
1920
1921
|
substitution,
|
|
1921
1922
|
placeholder,
|
|
1922
1923
|
readOnly,
|
|
@@ -1947,6 +1948,7 @@ function ProseKitEditor({ markMode = "focus", initialMarkdown, singleParagraph =
|
|
|
1947
1948
|
embedPaste,
|
|
1948
1949
|
linkPaste,
|
|
1949
1950
|
bulletAfterHeading,
|
|
1951
|
+
backspaceDeletesEmptyFirstBlock,
|
|
1950
1952
|
substitution,
|
|
1951
1953
|
placeholder,
|
|
1952
1954
|
readOnly,
|
|
@@ -2157,7 +2159,7 @@ const CARET_GLIDE_OFF = { "--meowdown-caret-glide": "0ms" };
|
|
|
2157
2159
|
*
|
|
2158
2160
|
* Callbacks and resolvers should be stable; pass them via `useCallback`.
|
|
2159
2161
|
*/
|
|
2160
|
-
function MarkdownEditor({ mode = "focus", initialMarkdown, singleParagraph, referenceDefinitions, onDocChange, onSlashMenuSearch, onTagSearch, onWikilinkSearch, onSelectionMenuSearch, selectionMenuAffordance = true, pendingReplacementActions, onPendingReplacementResolve, onWikilinkClick, onLinkClick, onLinkCopy, resolveLinkPreview, onTagClick, onExitBoundary, resolveImageUrl, resolveFileLink, resolveWikiEmbed, resolveWikilink, resolveFileInfo, resolveXPost, mediaUrlProtocols, resolveYouTubeVideo, onFileClick, onFilePaste, onFileSaveError, onImageClick, onXPostMediaClick, onYouTubeVideoClick, embedPaste = true, linkPaste = true, bulletAfterHeading = false, substitution = true, frontmatter = false, blockHandle = true, caretGlide = true, placeholder, readOnly, spellCheck, searchQuery, onSearchChange, timeFormat, editorClassName, wrapperClassName, CodeBlockView, handleRef, children }) {
|
|
2162
|
+
function MarkdownEditor({ mode = "focus", initialMarkdown, singleParagraph, referenceDefinitions, onDocChange, onSlashMenuSearch, onTagSearch, onWikilinkSearch, onSelectionMenuSearch, selectionMenuAffordance = true, pendingReplacementActions, onPendingReplacementResolve, onWikilinkClick, onLinkClick, onLinkCopy, resolveLinkPreview, onTagClick, onExitBoundary, resolveImageUrl, resolveFileLink, resolveWikiEmbed, resolveWikilink, resolveFileInfo, resolveXPost, mediaUrlProtocols, resolveYouTubeVideo, onFileClick, onFilePaste, onFileSaveError, onImageClick, onXPostMediaClick, onYouTubeVideoClick, embedPaste = true, linkPaste = true, bulletAfterHeading = false, backspaceDeletesEmptyFirstBlock = false, substitution = true, frontmatter = false, blockHandle = true, caretGlide = true, placeholder, readOnly, spellCheck, searchQuery, onSearchChange, timeFormat, editorClassName, wrapperClassName, CodeBlockView, handleRef, children }) {
|
|
2161
2163
|
const childRef = useRef(null);
|
|
2162
2164
|
useImperativeHandle(handleRef, () => {
|
|
2163
2165
|
function getMarkdown() {
|
|
@@ -2295,6 +2297,7 @@ function MarkdownEditor({ mode = "focus", initialMarkdown, singleParagraph, refe
|
|
|
2295
2297
|
embedPaste,
|
|
2296
2298
|
linkPaste,
|
|
2297
2299
|
bulletAfterHeading,
|
|
2300
|
+
backspaceDeletesEmptyFirstBlock,
|
|
2298
2301
|
substitution,
|
|
2299
2302
|
frontmatter,
|
|
2300
2303
|
blockHandle,
|
|
@@ -2875,7 +2878,7 @@ function renderCodeBlock(node, key) {
|
|
|
2875
2878
|
}, key);
|
|
2876
2879
|
}
|
|
2877
2880
|
function renderBlock(node, context, parent, index) {
|
|
2878
|
-
if (!context.
|
|
2881
|
+
if (!context.singleParagraph && isReferenceDefinitionNode(node, parent, index)) return null;
|
|
2879
2882
|
const key = context.keyCounter.value++;
|
|
2880
2883
|
const typeName = node.type.name;
|
|
2881
2884
|
let handleTaskClick;
|
|
@@ -2958,9 +2961,9 @@ const MarkdownBlock = memo(function MarkdownBlock({ node, taskBase, context, ref
|
|
|
2958
2961
|
* Callbacks (`onWikilinkClick`, etc.) and resolvers should be stable; pass them via
|
|
2959
2962
|
* `useCallback` to avoid re-rendering the whole tree.
|
|
2960
2963
|
*/
|
|
2961
|
-
function MarkdownView({ markdown,
|
|
2964
|
+
function MarkdownView({ markdown, singleParagraph = false, referenceDefinitions: suppliedDefinitions, markMode = "hide", frontmatter = false, interactive = true, expandCollapsed = false, resolveImageUrl, resolveFileLink, resolveWikiEmbed, resolveWikilink, resolveFileInfo, resolveXPost, mediaUrlProtocols, resolveYouTubeVideo, onWikilinkClick, onLinkClick, onImageClick, onXPostMediaClick, onYouTubeVideoClick, onFileClick, onTaskClick, className }) {
|
|
2962
2965
|
const context = useMemo(() => ({
|
|
2963
|
-
|
|
2966
|
+
singleParagraph,
|
|
2964
2967
|
interactive,
|
|
2965
2968
|
expandCollapsed,
|
|
2966
2969
|
resolveImageUrl,
|
|
@@ -2977,7 +2980,7 @@ function MarkdownView({ markdown, inline = false, referenceDefinitions: supplied
|
|
|
2977
2980
|
onFileClick: interactive ? onFileClick : void 0,
|
|
2978
2981
|
onTaskClick: interactive ? onTaskClick : void 0
|
|
2979
2982
|
}), [
|
|
2980
|
-
|
|
2983
|
+
singleParagraph,
|
|
2981
2984
|
interactive,
|
|
2982
2985
|
expandCollapsed,
|
|
2983
2986
|
resolveImageUrl,
|
|
@@ -2995,8 +2998,8 @@ function MarkdownView({ markdown, inline = false, referenceDefinitions: supplied
|
|
|
2995
2998
|
onTaskClick
|
|
2996
2999
|
]);
|
|
2997
3000
|
const { blocks, referenceDefinitions, definitionsKey } = useMemo(() => {
|
|
2998
|
-
const doc =
|
|
2999
|
-
const localDefinitions =
|
|
3001
|
+
const doc = singleParagraph ? paragraphMarkdownToDoc(markdown) : markdownToDoc(markdown, { frontmatter });
|
|
3002
|
+
const localDefinitions = singleParagraph ? /* @__PURE__ */ new Map() : collectReferenceDefinitions(doc).definitions;
|
|
3000
3003
|
const referenceDefinitions = suppliedDefinitions ? new Map([...suppliedDefinitions, ...localDefinitions]) : localDefinitions;
|
|
3001
3004
|
return {
|
|
3002
3005
|
blocks: splitBlocks(doc),
|
|
@@ -3006,7 +3009,7 @@ function MarkdownView({ markdown, inline = false, referenceDefinitions: supplied
|
|
|
3006
3009
|
}, [
|
|
3007
3010
|
markdown,
|
|
3008
3011
|
frontmatter,
|
|
3009
|
-
|
|
3012
|
+
singleParagraph,
|
|
3010
3013
|
suppliedDefinitions
|
|
3011
3014
|
]);
|
|
3012
3015
|
const handleXPostMediaClick = interactive ? onXPostMediaClick : void 0;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meowdown/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.78.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@base-ui/react": "^1.8.0",
|
|
25
|
-
"@meowdown/core": "0.
|
|
25
|
+
"@meowdown/core": "0.79.0",
|
|
26
26
|
"@meowdown/embed": "0.3.1",
|
|
27
27
|
"@meowdown/markdown": "0.76.0",
|
|
28
28
|
"@ocavue/utils": "^1.8.0",
|