@openeditor/native 0.0.7 → 0.0.8

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 CHANGED
@@ -63,14 +63,54 @@ const openEditorNativeSchema = {
63
63
  content: "column+",
64
64
  group: "block",
65
65
  role: "block",
66
- htmlTag: "section",
67
- attrs: { count: { default: 2 } },
66
+ layoutRole: "columns",
68
67
  },
69
68
  {
70
69
  name: "column",
71
70
  content: "block+",
72
71
  role: "block",
73
- htmlTag: "div",
72
+ layoutRole: "column",
73
+ },
74
+ {
75
+ name: "table",
76
+ content: "tableRow+",
77
+ group: "block",
78
+ role: "block",
79
+ layoutRole: "table",
80
+ htmlTag: "table",
81
+ },
82
+ {
83
+ name: "tableRow",
84
+ content: "(tableCell | tableHeader)+",
85
+ role: "block",
86
+ layoutRole: "tableRow",
87
+ htmlTag: "tr",
88
+ },
89
+ {
90
+ name: "tableCell",
91
+ content: "block+",
92
+ role: "block",
93
+ layoutRole: "tableCell",
94
+ htmlTag: "td",
95
+ attrs: {
96
+ colspan: { default: 1 },
97
+ rowspan: { default: 1 },
98
+ colwidth: { default: null },
99
+ align: { default: null },
100
+ },
101
+ },
102
+ {
103
+ name: "tableHeader",
104
+ content: "block+",
105
+ role: "block",
106
+ layoutRole: "tableHeader",
107
+ htmlTag: "th",
108
+ attrs: {
109
+ colspan: { default: 1 },
110
+ rowspan: { default: 1 },
111
+ colwidth: { default: null },
112
+ align: { default: null },
113
+ },
74
114
  },
75
115
  {
76
116
  name: "image",
@@ -100,7 +140,7 @@ const openEditorNativeSchema = {
100
140
  ],
101
141
  };
102
142
  const toNativeEditorTheme = (theme) => ({
103
- backgroundColor: "transparent",
143
+ backgroundColor: theme.background,
104
144
  borderRadius: 0,
105
145
  placeholderColor: theme.placeholder,
106
146
  contentInsets: {
@@ -234,7 +274,6 @@ const nativeSeedDocument = createDocument([
234
274
  },
235
275
  {
236
276
  type: "columns",
237
- attrs: { count: 2 },
238
277
  content: [
239
278
  { type: "column", content: [textBlock("paragraph", "Columns now flow through the native engine.")] },
240
279
  { type: "column", content: [textBlock("paragraph", "Tables stay blocked until the native engine supports them cleanly.")] },
@@ -376,7 +415,7 @@ export const OpenEditorNative = ({ document = nativeSeedDocument, editable = tru
376
415
  return;
377
416
  }
378
417
  if (key === openEditorNativeToolbarActionKeys.undo) {
379
- const previous = history.undoStack.at(-1);
418
+ const previous = history.undoStack[history.undoStack.length - 1];
380
419
  if (!previous) {
381
420
  return;
382
421
  }
@@ -411,6 +450,14 @@ export const OpenEditorNative = ({ document = nativeSeedDocument, editable = tru
411
450
  editorRef.current?.toggleList("orderedList");
412
451
  return;
413
452
  }
453
+ if (key === openEditorNativeToolbarActionKeys.columns) {
454
+ editorRef.current?.insertColumns();
455
+ return;
456
+ }
457
+ if (key === openEditorNativeToolbarActionKeys.table) {
458
+ editorRef.current?.insertTable();
459
+ return;
460
+ }
414
461
  const actionDocument = defaultDocumentForToolbarAction(key);
415
462
  if (actionDocument) {
416
463
  editorRef.current?.insertContentJson(actionDocument);
package/dist/toolbar.d.ts CHANGED
@@ -4,6 +4,8 @@ export declare const openEditorNativeToolbarActionKeys: {
4
4
  readonly paragraph: "paragraph";
5
5
  readonly bulletList: "bulletList";
6
6
  readonly orderedList: "orderedList";
7
+ readonly columns: "columns";
8
+ readonly table: "table";
7
9
  readonly moveBlockUp: "openeditor:block:moveUp";
8
10
  readonly moveBlockDown: "openeditor:block:moveDown";
9
11
  readonly undo: "openeditor:history:undo";
package/dist/toolbar.js CHANGED
@@ -12,6 +12,8 @@ export const openEditorNativeToolbarActionKeys = {
12
12
  paragraph: "paragraph",
13
13
  bulletList: "bulletList",
14
14
  orderedList: "orderedList",
15
+ columns: "columns",
16
+ table: "table",
15
17
  moveBlockUp: "openeditor:block:moveUp",
16
18
  moveBlockDown: "openeditor:block:moveDown",
17
19
  undo: "openeditor:history:undo",
@@ -73,6 +75,12 @@ export const createOpenEditorNativeToolbarItems = ({ canUndo = true, canRedo = t
73
75
  items: [
74
76
  { type: "blockquote", label: "Quote", icon: defaultIcon("blockquote") },
75
77
  { type: "node", nodeType: "horizontalRule", label: "Divider", icon: defaultIcon("horizontalRule") },
78
+ { type: "action", key: openEditorNativeToolbarActionKeys.columns, label: "Columns", icon: glyphIcon("Cols") },
79
+ { type: "action", key: openEditorNativeToolbarActionKeys.table, label: "Table", icon: glyphIcon("Tbl") },
80
+ { type: "command", command: "insertTableRowAfter", label: "Add Row", icon: glyphIcon("+R") },
81
+ { type: "command", command: "insertTableColumnAfter", label: "Add Column", icon: glyphIcon("+C") },
82
+ { type: "command", command: "deleteTableRow", label: "Delete Row", icon: glyphIcon("-R") },
83
+ { type: "command", command: "deleteTableColumn", label: "Delete Column", icon: glyphIcon("-C") },
76
84
  { type: "image", label: "Image", icon: defaultIcon("image") },
77
85
  ],
78
86
  },
@@ -153,6 +161,7 @@ export const nativeToolbarParityCoverage = () => {
153
161
  ["blockquote", "blockquote"],
154
162
  ["divider", "horizontalRule"],
155
163
  ["image", "image"],
164
+ ["table", openEditorNativeToolbarActionKeys.table],
156
165
  ]);
157
166
  const markControls = new Map([
158
167
  ["bold", "bold"],
@@ -196,6 +205,7 @@ export const defaultDocumentForToolbarAction = (key) => {
196
205
  || key === "taskList"
197
206
  || key === "codeBlock"
198
207
  || key === "columns"
208
+ || key === openEditorNativeToolbarActionKeys.table
199
209
  || key === openEditorNativeToolbarActionKeys.moveBlockUp
200
210
  || key === openEditorNativeToolbarActionKeys.moveBlockDown
201
211
  || key === openEditorNativeToolbarActionKeys.dismissKeyboard) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openeditor/native",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
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.7",
31
- "@openeditor/exporters": "0.0.7",
32
- "@openeditor/extensions": "0.0.7",
30
+ "@openeditor/core": "0.0.8",
31
+ "@openeditor/exporters": "0.0.8",
32
+ "@openeditor/extensions": "0.0.8",
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.7",
37
+ "@openeditor/react-native-prose-editor": "0.0.8",
38
38
  "react-native-keyboard-controller": ">=1.21",
39
39
  "react": ">=19",
40
40
  "react-native": ">=0.85"