@openeditor/native 0.0.13 → 0.0.15
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 +9 -5
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
2
|
-
import { createDocument, findBlockSpecForNode, moveTopLevelBlock, textBlock, } from "@openeditor/core";
|
|
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, textBlock, } 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";
|
|
@@ -72,7 +72,7 @@ const openEditorNativeSchema = {
|
|
|
72
72
|
group: "block",
|
|
73
73
|
role: "block",
|
|
74
74
|
htmlTag: "aside",
|
|
75
|
-
attrs: {
|
|
75
|
+
attrs: { emoji: { default: DEFAULT_CALLOUT_EMOJI } },
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
name: "page",
|
|
@@ -82,7 +82,7 @@ const openEditorNativeSchema = {
|
|
|
82
82
|
htmlTag: "p",
|
|
83
83
|
attrs: {
|
|
84
84
|
pageId: { default: null },
|
|
85
|
-
icon: { default:
|
|
85
|
+
icon: { default: DEFAULT_PAGE_EMOJI },
|
|
86
86
|
href: { default: null },
|
|
87
87
|
},
|
|
88
88
|
},
|
|
@@ -360,6 +360,10 @@ const renderNativeViewerNode = (node, key, theme, renderers, onOpenPage, attachm
|
|
|
360
360
|
return _jsx(View, { style: { borderLeftColor: theme.accent, borderLeftWidth: 3, marginBottom: 12, paddingLeft: 12 }, children: children }, key);
|
|
361
361
|
case "codeBlock":
|
|
362
362
|
return _jsx(View, { style: { backgroundColor: theme.codeBackground, borderRadius: 8, marginBottom: 12, padding: 12 }, children: _jsx(Text, { style: { color: theme.codeText }, children: node.content?.map((child) => child.text ?? "").join("") }) }, key);
|
|
363
|
+
case "callout": {
|
|
364
|
+
const emoji = normalizeEmoji(node.attrs?.emoji, DEFAULT_CALLOUT_EMOJI);
|
|
365
|
+
return _jsxs(View, { style: { backgroundColor: theme.codeBackground, borderRadius: 10, flexDirection: "row", gap: 10, marginBottom: 12, padding: 14 }, children: [_jsx(Text, { style: { fontSize: 20 }, children: emoji }), _jsx(View, { style: { flex: 1 }, children: children })] }, key);
|
|
366
|
+
}
|
|
363
367
|
case "divider":
|
|
364
368
|
return _jsx(View, { style: { backgroundColor: theme.border, height: 1, marginVertical: 16 } }, key);
|
|
365
369
|
case "image":
|
|
@@ -371,7 +375,7 @@ const renderNativeViewerNode = (node, key, theme, renderers, onOpenPage, attachm
|
|
|
371
375
|
case "page": {
|
|
372
376
|
const pageId = typeof node.attrs?.pageId === "string" ? node.attrs.pageId : "";
|
|
373
377
|
const title = node.content?.map((child) => child.text ?? "").join("") || "Untitled";
|
|
374
|
-
const icon =
|
|
378
|
+
const icon = normalizeEmoji(node.attrs?.icon, DEFAULT_PAGE_EMOJI);
|
|
375
379
|
const content = _jsxs(_Fragment, { children: [_jsx(Text, { style: { fontSize: 18 }, children: icon }), _jsx(Text, { style: { color: theme.text, flex: 1, fontWeight: "600", textDecorationLine: "underline" }, children: title }), _jsx(Text, { style: { color: theme.muted }, children: "\u2192" })] });
|
|
376
380
|
return onOpenPage && pageId ? (_jsx(Pressable, { accessibilityRole: "button", onPress: () => onOpenPage({ pageId, title, icon, href: typeof node.attrs?.href === "string" ? node.attrs.href : null }), style: { alignItems: "center", borderRadius: 8, flexDirection: "row", gap: 8, marginBottom: 8, padding: 8 }, children: content }, key)) : _jsx(View, { style: { alignItems: "center", flexDirection: "row", gap: 8, marginBottom: 8, padding: 8 }, children: content }, key);
|
|
377
381
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openeditor/native",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"repository": {
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@expo/vector-icons": "15.0.3",
|
|
30
|
-
"@openeditor/core": "0.0.
|
|
31
|
-
"@openeditor/exporters": "0.0.
|
|
32
|
-
"@openeditor/extensions": "0.0.
|
|
30
|
+
"@openeditor/core": "0.0.15",
|
|
31
|
+
"@openeditor/exporters": "0.0.15",
|
|
32
|
+
"@openeditor/extensions": "0.0.15",
|
|
33
33
|
"react": "19.2.3",
|
|
34
34
|
"react-native": "0.85.3"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@openeditor/react-native-prose-editor": "0.0.
|
|
37
|
+
"@openeditor/react-native-prose-editor": "0.0.15",
|
|
38
38
|
"react-native-keyboard-controller": ">=1.21",
|
|
39
39
|
"react": ">=19",
|
|
40
40
|
"react-native": ">=0.85"
|