@apollohg/react-native-rich-text-editor 2.0.0 → 2.0.1
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 +1 -1
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/android/build.gradle +3 -0
- package/app.plugin.js +42 -39
- package/dist/AtomHost.js +18 -11
- package/dist/EditorAddon.js +4 -2
- package/dist/EditorAddonNormalization.js +17 -9
- package/dist/EditorMentionThemeNormalization.js +6 -3
- package/dist/EditorMentionThemeValidation.js +28 -11
- package/dist/EditorStyleSheetNormalization.js +84 -37
- package/dist/EditorTheme.d.ts +4 -0
- package/dist/EditorTheme.js +5 -3
- package/dist/EditorToolbarComponent.d.ts +1 -1
- package/dist/EditorToolbarComponent.js +1 -1
- package/dist/EditorToolbarRegistry.js +5 -5
- package/dist/EditorToolbarTypes.d.ts +12 -12
- package/dist/EditorToolbarVisuals.js +1 -1
- package/dist/ExternalTextComposition.js +89 -43
- package/dist/ImageLoadingPolicy.d.ts +1 -1
- package/dist/NativeEditorBoundaryError.d.ts +7 -7
- package/dist/NativeEditorBoundaryError.js +9 -5
- package/dist/NativeEditorCollaborationTransport.d.ts +7 -7
- package/dist/NativeEditorCollaborationTransport.js +28 -15
- package/dist/NativeEditorCreateConfig.js +11 -6
- package/dist/NativeEditorCreateJson.js +51 -25
- package/dist/NativeEditorCreateValidation.js +11 -6
- package/dist/NativeEditorDocumentBridge.d.ts +1 -1
- package/dist/NativeEditorDocumentBridge.js +32 -18
- package/dist/NativeEditorDocumentHandle.d.ts +4 -4
- package/dist/NativeEditorDocumentHandle.js +1 -1
- package/dist/NativeEditorLocalAwareness.js +25 -13
- package/dist/NativeEditorNativeModule.d.ts +8 -1
- package/dist/NativeEditorNativeModule.js +7 -5
- package/dist/NativeEditorRenderNormalization.js +66 -25
- package/dist/NativeEditorResultNormalization.js +53 -29
- package/dist/NativeEditorTypes.d.ts +10 -10
- package/dist/NativeEditorV2Decimal.js +6 -3
- package/dist/NativeProseViewer.js +11 -3
- package/dist/ResourceLimits.d.ts +2 -2
- package/dist/ResourceLimits.js +7 -2
- package/dist/RichTextEditor.js +1 -1
- package/dist/RichTextEditorNativeTypes.d.ts +1 -1
- package/dist/RichTextEditorNativeView.d.ts +1 -3
- package/dist/RichTextEditorSerialization.js +24 -14
- package/dist/RichTextEditorTypes.d.ts +1 -1
- package/dist/YjsCollaboration.d.ts +7 -7
- package/dist/YjsCollaboration.js +42 -26
- package/dist/addons.d.ts +4 -4
- package/dist/addons.js +3 -3
- package/dist/atomInstances.js +6 -3
- package/dist/atomUpdates.js +7 -4
- package/dist/atoms.js +20 -12
- package/dist/attributeValidation.js +55 -24
- package/dist/contentExpression.js +80 -42
- package/dist/listMarkers.d.ts +1 -1
- package/dist/listMarkers.js +1 -1
- package/dist/schemaDefinition.d.ts +1 -1
- package/dist/schemaDefinition.js +23 -14
- package/dist/schemaDocument.js +1 -1
- package/dist/schemaDocumentConstruction.js +25 -14
- package/dist/schemaNormalization.js +51 -29
- package/dist/schemaPresets.d.ts +1 -1
- package/dist/schemaPresets.js +9 -4
- package/dist/schemaResolution.js +46 -25
- package/dist/specs/PreparedProseViewerNativeComponent.d.ts +4 -0
- package/dist/useEditorToolbarInteractions.d.ts +2 -2
- package/dist/useEditorToolbarInteractions.js +45 -23
- package/dist/useEditorToolbarItems.d.ts +1 -1
- package/dist/useEditorToolbarItems.js +4 -3
- package/dist/useEditorToolbarPresentation.d.ts +3 -3
- package/dist/useEditorToolbarPresentation.js +4 -4
- package/dist/useEditorToolbarState.d.ts +1 -1
- package/dist/useEditorToolbarState.js +1 -1
- package/dist/useFocusPreservingFrames.js +11 -8
- package/dist/useNativeEditor.d.ts +1 -1
- package/dist/useNativeEditor.js +21 -11
- package/dist/useRichTextEditorCommands.d.ts +2 -2
- package/dist/useRichTextEditorCommands.js +59 -29
- package/dist/useRichTextEditorEvents.d.ts +3 -3
- package/dist/useRichTextEditorEvents.js +75 -32
- package/dist/useRichTextEditorMentions.d.ts +4 -4
- package/dist/useRichTextEditorMentions.js +48 -29
- package/dist/useRichTextEditorPresentation.d.ts +4 -4
- package/dist/useRichTextEditorPresentation.js +25 -23
- package/dist/useRichTextEditorState.d.ts +3 -3
- package/dist/useRichTextEditorState.js +20 -15
- package/dist/useRichTextEditorUpdates.d.ts +1 -1
- package/dist/useRichTextEditorUpdates.js +99 -41
- package/dist/useViewerAtoms.js +63 -36
- package/ios/EditorCore.xcframework/Info.plist +5 -5
- package/ios/EditorCore.xcframework/ios-arm64/libeditor_core.a +0 -0
- package/ios/EditorCore.xcframework/ios-arm64_x86_64-simulator/libeditor_core.a +0 -0
- package/package.json +11 -3
- package/react-native.config.js +1 -1
- package/rust/android/arm64-v8a/libeditor_core.so +0 -0
- package/rust/android/armeabi-v7a/libeditor_core.so +0 -0
- package/rust/android/x86/libeditor_core.so +0 -0
- package/rust/android/x86_64/libeditor_core.so +0 -0
- package/src/AtomHost.tsx +58 -28
- package/src/EditorAddon.ts +18 -8
- package/src/EditorAddonNormalization.ts +40 -11
- package/src/EditorMentionThemeNormalization.ts +15 -4
- package/src/EditorMentionThemeValidation.ts +51 -14
- package/src/EditorStyleSheet.ts +1 -0
- package/src/EditorStyleSheetNormalization.ts +195 -64
- package/src/EditorTheme.ts +13 -5
- package/src/EditorToolbarComponent.tsx +2 -1
- package/src/EditorToolbarRegistry.tsx +23 -13
- package/src/EditorToolbarTypes.tsx +12 -12
- package/src/EditorToolbarVisuals.tsx +6 -3
- package/src/EditorUpdateRevision.ts +1 -0
- package/src/ExternalTextComposition.ts +259 -49
- package/src/ImageLoadingPolicy.ts +3 -1
- package/src/NativeEditorBoundaryError.ts +38 -11
- package/src/NativeEditorCollaborationTransport.ts +108 -27
- package/src/NativeEditorCreateConfig.ts +92 -19
- package/src/NativeEditorCreateJson.ts +163 -26
- package/src/NativeEditorCreateValidation.ts +33 -12
- package/src/NativeEditorDocumentBridge.ts +111 -19
- package/src/NativeEditorDocumentHandle.ts +9 -4
- package/src/NativeEditorLocalAwareness.ts +70 -15
- package/src/NativeEditorNativeModule.ts +13 -9
- package/src/NativeEditorRenderNormalization.ts +128 -29
- package/src/NativeEditorResultNormalization.ts +143 -32
- package/src/NativeEditorTypes.ts +12 -11
- package/src/NativeEditorV2Decimal.ts +12 -3
- package/src/NativeProseViewer.tsx +46 -16
- package/src/ResourceLimits.ts +15 -8
- package/src/RichTextEditor.tsx +3 -1
- package/src/RichTextEditorNativeTypes.tsx +1 -1
- package/src/RichTextEditorNativeView.tsx +2 -8
- package/src/RichTextEditorSerialization.tsx +70 -24
- package/src/RichTextEditorTypes.tsx +1 -1
- package/src/YjsCollaboration.ts +143 -47
- package/src/addons.ts +12 -8
- package/src/atomInstances.ts +25 -5
- package/src/atomUpdates.ts +23 -6
- package/src/atoms.ts +85 -18
- package/src/attributeValidation.ts +97 -33
- package/src/contentExpression.ts +218 -63
- package/src/listMarkers.ts +1 -1
- package/src/schemaDefinition.ts +82 -20
- package/src/schemaDocument.ts +15 -1
- package/src/schemaDocumentConstruction.ts +80 -16
- package/src/schemaNormalization.ts +155 -41
- package/src/schemaPresets.ts +37 -31
- package/src/schemaResolution.ts +126 -27
- package/src/specs/PreparedProseViewerNativeComponent.ts +4 -2
- package/src/useEditorToolbarInteractions.tsx +85 -36
- package/src/useEditorToolbarItems.tsx +50 -22
- package/src/useEditorToolbarPresentation.tsx +81 -58
- package/src/useEditorToolbarState.tsx +8 -6
- package/src/useFocusPreservingFrames.ts +43 -15
- package/src/useNativeEditor.ts +111 -51
- package/src/useRichTextEditorCommands.tsx +127 -54
- package/src/useRichTextEditorEvents.tsx +144 -42
- package/src/useRichTextEditorMentions.tsx +118 -37
- package/src/useRichTextEditorPresentation.tsx +128 -114
- package/src/useRichTextEditorState.tsx +76 -40
- package/src/useRichTextEditorUpdates.tsx +207 -56
- package/src/useViewerAtoms.tsx +162 -66
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
type EditorToolbarCommand,
|
|
17
17
|
type EditorToolbarListType,
|
|
18
18
|
} from './EditorToolbar';
|
|
19
|
-
import { useRichTextEditorState } from './useRichTextEditorState';
|
|
20
|
-
import { useRichTextEditorMentions } from './useRichTextEditorMentions';
|
|
21
|
-
import { useRichTextEditorCommands } from './useRichTextEditorCommands';
|
|
22
|
-
import { useRichTextEditorEvents } from './useRichTextEditorEvents';
|
|
19
|
+
import { type useRichTextEditorState } from './useRichTextEditorState';
|
|
20
|
+
import { type useRichTextEditorMentions } from './useRichTextEditorMentions';
|
|
21
|
+
import { type useRichTextEditorCommands } from './useRichTextEditorCommands';
|
|
22
|
+
import { type useRichTextEditorEvents } from './useRichTextEditorEvents';
|
|
23
23
|
import {
|
|
24
24
|
useSerializedValue,
|
|
25
25
|
serializeRemoteSelections,
|
|
@@ -185,27 +185,24 @@ export function useRichTextEditorPresentation(
|
|
|
185
185
|
|
|
186
186
|
const themeJson = useMemo(
|
|
187
187
|
() => serializeEditorTheme(theme, mentionSuggestionTheme),
|
|
188
|
-
[mentionSuggestionTheme, theme]
|
|
188
|
+
[ mentionSuggestionTheme, theme ]
|
|
189
189
|
);
|
|
190
190
|
|
|
191
|
-
const addonsJson = useSerializedValue(addons,
|
|
192
|
-
serializeNormalizedEditorAddons(value)
|
|
193
|
-
);
|
|
191
|
+
const addonsJson = useSerializedValue(addons, value =>
|
|
192
|
+
serializeNormalizedEditorAddons(value));
|
|
194
193
|
|
|
195
|
-
const imageLoadingPolicyJson = useSerializedValue(imageLoadingPolicy,
|
|
196
|
-
serializeEditorImageLoadingPolicy(value)
|
|
197
|
-
);
|
|
194
|
+
const imageLoadingPolicyJson = useSerializedValue(imageLoadingPolicy, value =>
|
|
195
|
+
serializeEditorImageLoadingPolicy(value));
|
|
198
196
|
|
|
199
|
-
const androidInputOptionsJson = useSerializedValue(androidInputOptions,
|
|
200
|
-
JSON.stringify(value)
|
|
201
|
-
);
|
|
197
|
+
const androidInputOptionsJson = useSerializedValue(androidInputOptions, value =>
|
|
198
|
+
JSON.stringify(value));
|
|
202
199
|
|
|
203
|
-
const remoteSelectionsJson = useSerializedValue(remoteSelections,
|
|
204
|
-
serializeRemoteSelections(selections)
|
|
205
|
-
);
|
|
200
|
+
const remoteSelectionsJson = useSerializedValue(remoteSelections, selections =>
|
|
201
|
+
serializeRemoteSelections(selections));
|
|
206
202
|
|
|
207
203
|
const atomsJson = useMemo(() => {
|
|
208
204
|
const supplied = serializeEditorAtoms(atoms);
|
|
205
|
+
|
|
209
206
|
const serialized =
|
|
210
207
|
supplied == null
|
|
211
208
|
? { nodeTypes: [] as string[], estimatedHeights: {} as Record<string, number> }
|
|
@@ -213,20 +210,26 @@ export function useRichTextEditorPresentation(
|
|
|
213
210
|
nodeTypes: string[];
|
|
214
211
|
estimatedHeights: Record<string, number>;
|
|
215
212
|
});
|
|
213
|
+
|
|
216
214
|
for (const instance of atomState.instances) {
|
|
217
215
|
if (
|
|
218
216
|
Object.prototype.hasOwnProperty.call(serialized.estimatedHeights, instance.nodeType)
|
|
219
217
|
) {
|
|
220
218
|
continue;
|
|
221
219
|
}
|
|
220
|
+
|
|
222
221
|
serialized.nodeTypes.push(instance.nodeType);
|
|
223
222
|
serialized.estimatedHeights[instance.nodeType] = DEFAULT_ATOM_CHIP_HEIGHT;
|
|
224
223
|
}
|
|
224
|
+
|
|
225
225
|
return serialized.nodeTypes.length === 0 ? undefined : JSON.stringify(serialized);
|
|
226
|
-
}, [atomState.instances, atoms]);
|
|
226
|
+
}, [ atomState.instances, atoms ]);
|
|
227
227
|
|
|
228
228
|
useEffect(() => {
|
|
229
|
-
if (!__DEV__)
|
|
229
|
+
if (!__DEV__) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
|
|
230
233
|
for (const instance of atomState.instances) {
|
|
231
234
|
if (
|
|
232
235
|
atomComponents.has(instance.nodeType) ||
|
|
@@ -234,12 +237,14 @@ export function useRichTextEditorPresentation(
|
|
|
234
237
|
) {
|
|
235
238
|
continue;
|
|
236
239
|
}
|
|
240
|
+
|
|
237
241
|
warnedUnknownAtomTypesRef.current.add(instance.nodeType);
|
|
242
|
+
|
|
238
243
|
console.warn(
|
|
239
244
|
`NativeRichTextEditor: rendering unknown atom type '${instance.nodeType}' as a chip`
|
|
240
245
|
);
|
|
241
246
|
}
|
|
242
|
-
}, [atomComponents, atomState.instances]);
|
|
247
|
+
}, [ atomComponents, atomState.instances, warnedUnknownAtomTypesRef ]);
|
|
243
248
|
|
|
244
249
|
const runAtomActionRef = useRef(runAtomAction);
|
|
245
250
|
|
|
@@ -261,10 +266,12 @@ export function useRichTextEditorPresentation(
|
|
|
261
266
|
documentVersion: string | null,
|
|
262
267
|
attrs: AtomAttrsUpdate
|
|
263
268
|
) => {
|
|
264
|
-
if (owner !== atomOwnerRef.current)
|
|
269
|
+
if (owner !== atomOwnerRef.current) {
|
|
265
270
|
return Promise.reject(
|
|
266
271
|
new AtomUpdateAttrsError('not-ready', 'The editor has rebound.')
|
|
267
272
|
);
|
|
273
|
+
}
|
|
274
|
+
|
|
268
275
|
return updateAtomAttrsRef.current(
|
|
269
276
|
instance.key,
|
|
270
277
|
instance.nodeType,
|
|
@@ -274,114 +281,115 @@ export function useRichTextEditorPresentation(
|
|
|
274
281
|
attrs
|
|
275
282
|
);
|
|
276
283
|
},
|
|
277
|
-
[]
|
|
284
|
+
[ atomOwnerRef ]
|
|
278
285
|
);
|
|
279
286
|
|
|
280
287
|
const atomChildren = useMemo(
|
|
281
288
|
() =>
|
|
282
289
|
atomContentWidth == null
|
|
283
290
|
? null
|
|
284
|
-
: atomState.instances.map(
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
291
|
+
: atomState.instances.map(instance => {
|
|
292
|
+
const Component = atomComponents.get(instance.nodeType) ?? DefaultAtomChip;
|
|
293
|
+
const position = atomPositions.get(instance.key);
|
|
294
|
+
const width = position?.width ?? atomContentWidth;
|
|
295
|
+
|
|
296
|
+
return (
|
|
297
|
+
<View
|
|
298
|
+
key={instance.key}
|
|
299
|
+
nativeID={`${ATOM_NATIVE_ID_PREFIX}${instance.key}`}
|
|
300
|
+
collapsable={false}
|
|
301
|
+
style={{
|
|
302
|
+
position: 'absolute',
|
|
303
|
+
top: Platform.OS === 'android' ? (position?.hostY ?? 0) : 0,
|
|
304
|
+
left: Platform.OS === 'android' ? (position?.hostX ?? 0) : 0,
|
|
305
|
+
width,
|
|
306
|
+
}}
|
|
307
|
+
>
|
|
308
|
+
<AtomHost
|
|
309
|
+
nativeID={`${ATOM_CONTENT_NATIVE_ID_PREFIX}${instance.key}`}
|
|
310
|
+
component={Component}
|
|
311
|
+
width={width}
|
|
312
|
+
estimatedHeight={
|
|
313
|
+
(atoms ?? []).find(atom => atom.name === instance.nodeType)
|
|
314
|
+
?.estimatedHeight ?? DEFAULT_ATOM_CHIP_HEIGHT
|
|
315
|
+
}
|
|
316
|
+
visible={
|
|
317
|
+
!position ||
|
|
309
318
|
atomIsVisible(
|
|
310
319
|
position.y,
|
|
311
320
|
position.height ??
|
|
312
321
|
(atoms ?? []).find(
|
|
313
|
-
|
|
322
|
+
atom => atom.name === instance.nodeType
|
|
314
323
|
)?.estimatedHeight ??
|
|
315
324
|
DEFAULT_ATOM_CHIP_HEIGHT,
|
|
316
325
|
atomViewport ??
|
|
317
326
|
(virtualizeAtoms ? nativeAtomViewport : undefined)
|
|
318
327
|
)
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
[
|
|
328
|
+
}
|
|
329
|
+
atomProps={{
|
|
330
|
+
attrs: instance.attrs,
|
|
331
|
+
selected: selectedKeys.has(instance.key),
|
|
332
|
+
readOnly: !editable,
|
|
333
|
+
interactive: atomsInteractive,
|
|
334
|
+
isViewer: false,
|
|
335
|
+
nodeType: instance.nodeType,
|
|
336
|
+
updateAttrs: attrs =>
|
|
337
|
+
invokeAtomAttrsUpdate(
|
|
338
|
+
documentHandle,
|
|
339
|
+
instance,
|
|
340
|
+
atomState.documentVersion,
|
|
341
|
+
attrs
|
|
342
|
+
),
|
|
343
|
+
editor: {
|
|
344
|
+
select: () =>
|
|
345
|
+
invokeAtomAction(
|
|
346
|
+
documentHandle,
|
|
347
|
+
instance,
|
|
348
|
+
atomState.documentVersion,
|
|
349
|
+
'select'
|
|
350
|
+
),
|
|
351
|
+
delete: () =>
|
|
352
|
+
invokeAtomAction(
|
|
353
|
+
documentHandle,
|
|
354
|
+
instance,
|
|
355
|
+
atomState.documentVersion,
|
|
356
|
+
'delete'
|
|
357
|
+
),
|
|
358
|
+
focusBefore: () =>
|
|
359
|
+
invokeAtomAction(
|
|
360
|
+
documentHandle,
|
|
361
|
+
instance,
|
|
362
|
+
atomState.documentVersion,
|
|
363
|
+
'before'
|
|
364
|
+
),
|
|
365
|
+
focusAfter: () =>
|
|
366
|
+
invokeAtomAction(
|
|
367
|
+
documentHandle,
|
|
368
|
+
instance,
|
|
369
|
+
atomState.documentVersion,
|
|
370
|
+
'after'
|
|
371
|
+
),
|
|
372
|
+
},
|
|
373
|
+
}}
|
|
374
|
+
/>
|
|
375
|
+
</View>
|
|
376
|
+
);
|
|
377
|
+
}),
|
|
378
|
+
[ atomContentWidth,
|
|
379
|
+
atomState.instances,
|
|
380
|
+
atomState.documentVersion,
|
|
381
|
+
atomComponents,
|
|
382
|
+
atomPositions,
|
|
370
383
|
atoms,
|
|
371
384
|
atomViewport,
|
|
372
|
-
documentHandle,
|
|
373
|
-
invokeAtomAction,
|
|
374
385
|
virtualizeAtoms,
|
|
375
386
|
nativeAtomViewport,
|
|
376
|
-
|
|
377
|
-
atomComponents,
|
|
378
|
-
atomContentWidth,
|
|
379
|
-
atomPositions,
|
|
380
|
-
atomState.instances,
|
|
387
|
+
selectedKeys,
|
|
381
388
|
editable,
|
|
389
|
+
atomsInteractive,
|
|
382
390
|
invokeAtomAttrsUpdate,
|
|
383
|
-
|
|
384
|
-
|
|
391
|
+
documentHandle,
|
|
392
|
+
invokeAtomAction ]
|
|
385
393
|
);
|
|
386
394
|
|
|
387
395
|
const isLinkActive = activeState.marks.link === true;
|
|
@@ -417,7 +425,9 @@ export function useRichTextEditorPresentation(
|
|
|
417
425
|
onRequestLink,
|
|
418
426
|
onRequestImage
|
|
419
427
|
);
|
|
428
|
+
|
|
420
429
|
toolbarItemsJson = stringifyCachedJson(mappedItems);
|
|
430
|
+
|
|
421
431
|
toolbarItemsSerializationCacheRef.current = {
|
|
422
432
|
toolbarItems,
|
|
423
433
|
editable,
|
|
@@ -432,7 +442,9 @@ export function useRichTextEditorPresentation(
|
|
|
432
442
|
|
|
433
443
|
// A room document awaiting the server renders nothing (loading), never an
|
|
434
444
|
// unshared fallback paragraph.
|
|
435
|
-
if (!document.isReady)
|
|
445
|
+
if (!document.isReady) {
|
|
446
|
+
return null;
|
|
447
|
+
}
|
|
436
448
|
|
|
437
449
|
const usesNativeKeyboardToolbar =
|
|
438
450
|
toolbarPlacement === 'keyboard' && (Platform.OS === 'ios' || Platform.OS === 'android');
|
|
@@ -462,14 +474,14 @@ export function useRichTextEditorPresentation(
|
|
|
462
474
|
|
|
463
475
|
const currentPushedUpdate = pushedUpdate?.editorId === editorId ? pushedUpdate : null;
|
|
464
476
|
|
|
465
|
-
const focusPreservingFrames = [...registeredToolbarFrames, ...suppliedFocusPreservingFrames];
|
|
477
|
+
const focusPreservingFrames = [ ...registeredToolbarFrames, ...suppliedFocusPreservingFrames ];
|
|
466
478
|
|
|
467
479
|
const toolbarFrameJson = serializeToolbarFrames(
|
|
468
480
|
editable && isFocused ? focusPreservingFrames : undefined
|
|
469
481
|
);
|
|
470
482
|
|
|
471
483
|
return (
|
|
472
|
-
<View style={[styles.container, containerStyle]}>
|
|
484
|
+
<View style={[ styles.container, containerStyle ]}>
|
|
473
485
|
<NativeEditorView
|
|
474
486
|
ref={nativeViewRef}
|
|
475
487
|
style={nativeViewStyle}
|
|
@@ -507,13 +519,15 @@ export function useRichTextEditorPresentation(
|
|
|
507
519
|
onContentHeightChange={handleContentHeightChange}
|
|
508
520
|
onAtomLayout={handleAtomLayout}
|
|
509
521
|
onToolbarAction={handleToolbarAction}
|
|
510
|
-
onAddonEvent={handleAddonEvent}
|
|
522
|
+
onAddonEvent={handleAddonEvent}
|
|
523
|
+
>
|
|
511
524
|
{atomChildren}
|
|
512
525
|
</NativeEditorView>
|
|
513
526
|
{shouldRenderJsToolbar ? (
|
|
514
527
|
<View
|
|
515
|
-
testID='native-editor-js-toolbar'
|
|
516
|
-
style={[styles.inlineToolbar, { marginTop: inlineToolbarMarginTop }]}
|
|
528
|
+
testID={'native-editor-js-toolbar'}
|
|
529
|
+
style={[ styles.inlineToolbar, { marginTop: inlineToolbarMarginTop } ]}
|
|
530
|
+
>
|
|
517
531
|
<EditorToolbarFrameOwnerProvider ownerId={toolbarFrameOwnerId}>
|
|
518
532
|
<EditorToolbar
|
|
519
533
|
activeState={activeState}
|