@openeditor/native 0.0.25 → 0.0.27
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/dist/index.js +3 -39
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { DEFAULT_CALLOUT_EMOJI, DEFAULT_PAGE_EMOJI, createDocument, findBlockSpecForNode, moveTopLevelBlock, normalizeEmoji,
|
|
2
|
+
import { DEFAULT_CALLOUT_EMOJI, DEFAULT_PAGE_EMOJI, createDocument, findBlockSpecForNode, moveTopLevelBlock, normalizeEmoji, } from "@openeditor/core";
|
|
3
3
|
import { useMemo, useRef, useState } from "react";
|
|
4
4
|
import { Image as NativeImage, Keyboard, Modal, Platform, Pressable, StyleSheet, Text, TextInput, View } from "react-native";
|
|
5
5
|
import { fromNativeEditorDocument, sanitizeNativeEditorDocument, toNativeEditorDocument, } from "./document.js";
|
|
@@ -332,42 +332,6 @@ const NativeToggleListItem = ({ children, initiallyOpen, theme, }) => {
|
|
|
332
332
|
open ? styles.viewerToggleCaretOpen : null,
|
|
333
333
|
] }) }), _jsx(View, { style: styles.viewerListContent, children: open ? childArray : childArray.slice(0, 1) })] }));
|
|
334
334
|
};
|
|
335
|
-
const nativeSeedDocument = createDocument([
|
|
336
|
-
textBlock("heading", "OpenEditor Native", { level: 1 }),
|
|
337
|
-
textBlock("paragraph", "This native surface is intentionally limited to engine-owned blocks for now."),
|
|
338
|
-
{
|
|
339
|
-
type: "bulletList",
|
|
340
|
-
content: [
|
|
341
|
-
{ type: "listItem", content: [textBlock("paragraph", "Paragraphs and headings")] },
|
|
342
|
-
{ type: "listItem", content: [textBlock("paragraph", "Bullet and numbered lists")] },
|
|
343
|
-
{ type: "listItem", content: [textBlock("paragraph", "Task lists, code blocks, columns, quotes, dividers, and images")] },
|
|
344
|
-
],
|
|
345
|
-
},
|
|
346
|
-
{
|
|
347
|
-
type: "taskList",
|
|
348
|
-
content: [
|
|
349
|
-
{ type: "taskItem", attrs: { checked: true }, content: [textBlock("paragraph", "Engine-owned structural list items")] },
|
|
350
|
-
{ type: "taskItem", attrs: { checked: false }, content: [textBlock("paragraph", "Native task lists now live in the engine")] },
|
|
351
|
-
],
|
|
352
|
-
},
|
|
353
|
-
{
|
|
354
|
-
type: "codeBlock",
|
|
355
|
-
content: [{ type: "text", text: "const native = 'owned by the engine';" }],
|
|
356
|
-
},
|
|
357
|
-
{
|
|
358
|
-
type: "blockquote",
|
|
359
|
-
content: [textBlock("paragraph", "Structural blocks return once the native engine owns them.")],
|
|
360
|
-
},
|
|
361
|
-
{
|
|
362
|
-
type: "columns",
|
|
363
|
-
content: [
|
|
364
|
-
{ type: "column", content: [textBlock("paragraph", "Columns now flow through the native engine.")] },
|
|
365
|
-
{ type: "column", content: [textBlock("paragraph", "Tables stay blocked until the native engine supports them cleanly.")] },
|
|
366
|
-
],
|
|
367
|
-
},
|
|
368
|
-
{ type: "horizontalRule" },
|
|
369
|
-
{ type: "image", attrs: { src: "https://placehold.co/960x420/png", alt: "Placeholder" } },
|
|
370
|
-
]);
|
|
371
335
|
const renderNativeViewerNode = (node, key, theme, renderers, onOpenPage, attachmentRuntime) => {
|
|
372
336
|
if (node.type === "text") {
|
|
373
337
|
return _jsx(Text, { style: { color: theme.text }, children: node.text ?? "" }, key);
|
|
@@ -470,7 +434,7 @@ export const OpenEditorNativeToolbar = ({ actions = [
|
|
|
470
434
|
onActionPress?.(action.key);
|
|
471
435
|
}, style: [styles.toolbarButton, { backgroundColor: resolvedTheme.accent, borderColor: resolvedTheme.borderStrong }], children: _jsx(Text, { style: [styles.toolbarButtonText, { color: resolvedTheme.accentText }], children: action.label }) }, action.key))) }));
|
|
472
436
|
};
|
|
473
|
-
export const OpenEditorNative = ({ document =
|
|
437
|
+
export const OpenEditorNative = ({ document = createDocument(), editable = true, placeholder = "Start writing...", showToolbar = true, theme, toolbarPlacement = "keyboard", onChange, onOpenPage, attachmentRuntime, }) => {
|
|
474
438
|
const editorRef = useRef(null);
|
|
475
439
|
const [currentDocument, setCurrentDocument] = useState(() => normalizeForNativeEditor(document));
|
|
476
440
|
const [selection, setSelection] = useState();
|
|
@@ -659,7 +623,7 @@ export const OpenEditorNative = ({ document = nativeSeedDocument, editable = tru
|
|
|
659
623
|
muted: resolvedTheme.muted,
|
|
660
624
|
}, visible: emojiRequest !== null })] }));
|
|
661
625
|
};
|
|
662
|
-
export const OpenEditorNativeViewer = ({ document =
|
|
626
|
+
export const OpenEditorNativeViewer = ({ document = createDocument(), theme, renderers, onOpenPage, attachmentRuntime, }) => {
|
|
663
627
|
const resolvedTheme = {
|
|
664
628
|
...defaultNativeTheme,
|
|
665
629
|
...theme,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openeditor/native",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.27",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"repository": {
|
|
@@ -28,16 +28,16 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@expo/ui": "~56.0.18",
|
|
30
30
|
"@expo/vector-icons": "15.0.3",
|
|
31
|
-
"@openeditor/core": "0.0.
|
|
32
|
-
"@openeditor/exporters": "0.0.
|
|
33
|
-
"@openeditor/extensions": "0.0.
|
|
31
|
+
"@openeditor/core": "0.0.27",
|
|
32
|
+
"@openeditor/exporters": "0.0.27",
|
|
33
|
+
"@openeditor/extensions": "0.0.27",
|
|
34
34
|
"emojibase": "17.0.0",
|
|
35
35
|
"emojibase-data": "16.0.2",
|
|
36
36
|
"react": "19.2.3",
|
|
37
37
|
"react-native": "0.85.3"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@openeditor/react-native-prose-editor": "0.0.
|
|
40
|
+
"@openeditor/react-native-prose-editor": "0.0.27",
|
|
41
41
|
"react-native-keyboard-controller": ">=1.21",
|
|
42
42
|
"react": ">=19",
|
|
43
43
|
"react-native": ">=0.85"
|