@fluidframework/react 2.90.0-378676 → 2.91.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/CHANGELOG.md +13 -0
- package/README.md +2 -0
- package/api-report/react.alpha.api.md +8 -8
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/propNode.js.map +1 -1
- package/lib/reactSharedTreeView.d.ts +6 -6
- package/lib/reactSharedTreeView.d.ts.map +1 -1
- package/lib/reactSharedTreeView.js +16 -18
- package/lib/reactSharedTreeView.js.map +1 -1
- package/lib/test/mochaHooks.js +13 -0
- package/lib/test/mochaHooks.js.map +1 -0
- package/lib/test/reactSharedTreeView.spec.js +3 -3
- package/lib/test/reactSharedTreeView.spec.js.map +1 -1
- package/lib/test/text/plainUtils.test.js +75 -0
- package/lib/test/text/plainUtils.test.js.map +1 -0
- package/lib/test/text/textEditor.test.js +760 -0
- package/lib/test/text/textEditor.test.js.map +1 -0
- package/lib/test/undoRedo.test.js +62 -0
- package/lib/test/undoRedo.test.js.map +1 -0
- package/lib/test/useObservation.spec.js +8 -9
- package/lib/test/useObservation.spec.js.map +1 -1
- package/lib/test/useTree.spec.js +15 -16
- package/lib/test/useTree.spec.js.map +1 -1
- package/lib/text/formatted/index.d.ts +6 -0
- package/lib/text/formatted/index.d.ts.map +1 -0
- package/lib/text/formatted/index.js +6 -0
- package/lib/text/formatted/index.js.map +1 -0
- package/lib/text/formatted/quillFormattedView.d.ts +66 -0
- package/lib/text/formatted/quillFormattedView.d.ts.map +1 -0
- package/lib/text/formatted/quillFormattedView.js +520 -0
- package/lib/text/formatted/quillFormattedView.js.map +1 -0
- package/lib/text/index.d.ts +7 -0
- package/lib/text/index.d.ts.map +1 -0
- package/lib/text/index.js +7 -0
- package/lib/text/index.js.map +1 -0
- package/lib/text/plain/index.d.ts +7 -0
- package/lib/text/plain/index.d.ts.map +1 -0
- package/lib/text/plain/index.js +7 -0
- package/lib/text/plain/index.js.map +1 -0
- package/lib/text/plain/plainTextView.d.ts +14 -0
- package/lib/text/plain/plainTextView.d.ts.map +1 -0
- package/lib/text/plain/plainTextView.js +70 -0
- package/lib/text/plain/plainTextView.js.map +1 -0
- package/lib/text/plain/plainUtils.d.ts +23 -0
- package/lib/text/plain/plainUtils.d.ts.map +1 -0
- package/lib/text/plain/plainUtils.js +51 -0
- package/lib/text/plain/plainUtils.js.map +1 -0
- package/lib/text/plain/quillView.d.ts +22 -0
- package/lib/text/plain/quillView.d.ts.map +1 -0
- package/lib/text/plain/quillView.js +106 -0
- package/lib/text/plain/quillView.js.map +1 -0
- package/lib/undoRedo.d.ts +51 -0
- package/lib/undoRedo.d.ts.map +1 -0
- package/lib/undoRedo.js +76 -0
- package/lib/undoRedo.js.map +1 -0
- package/lib/useObservation.js +6 -6
- package/lib/useObservation.js.map +1 -1
- package/lib/useTree.d.ts +7 -7
- package/lib/useTree.d.ts.map +1 -1
- package/lib/useTree.js +6 -6
- package/lib/useTree.js.map +1 -1
- package/package.json +28 -46
- package/react.test-files.tar +0 -0
- package/src/index.ts +10 -0
- package/src/propNode.ts +1 -1
- package/src/reactSharedTreeView.tsx +11 -13
- package/src/text/formatted/index.ts +11 -0
- package/src/text/formatted/quillFormattedView.tsx +627 -0
- package/src/text/index.ts +15 -0
- package/src/text/plain/index.ts +7 -0
- package/src/text/plain/plainTextView.tsx +110 -0
- package/src/text/plain/plainUtils.ts +68 -0
- package/src/text/plain/quillView.tsx +149 -0
- package/src/undoRedo.ts +117 -0
- package/src/useObservation.ts +6 -6
- package/src/useTree.ts +19 -12
- package/tsconfig.json +6 -0
- package/api-extractor/api-extractor-lint-alpha.cjs.json +0 -5
- package/api-extractor/api-extractor-lint-beta.cjs.json +0 -5
- package/api-extractor/api-extractor-lint-public.cjs.json +0 -5
- package/dist/alpha.d.ts +0 -45
- package/dist/beta.d.ts +0 -15
- package/dist/index.d.ts +0 -16
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -26
- package/dist/index.js.map +0 -1
- package/dist/package.json +0 -4
- package/dist/propNode.d.ts +0 -114
- package/dist/propNode.d.ts.map +0 -1
- package/dist/propNode.js +0 -43
- package/dist/propNode.js.map +0 -1
- package/dist/public.d.ts +0 -15
- package/dist/reactSharedTreeView.d.ts +0 -119
- package/dist/reactSharedTreeView.d.ts.map +0 -1
- package/dist/reactSharedTreeView.js +0 -206
- package/dist/reactSharedTreeView.js.map +0 -1
- package/dist/simpleIdentifier.d.ts +0 -19
- package/dist/simpleIdentifier.d.ts.map +0 -1
- package/dist/simpleIdentifier.js +0 -33
- package/dist/simpleIdentifier.js.map +0 -1
- package/dist/useObservation.d.ts +0 -83
- package/dist/useObservation.d.ts.map +0 -1
- package/dist/useObservation.js +0 -295
- package/dist/useObservation.js.map +0 -1
- package/dist/useTree.d.ts +0 -80
- package/dist/useTree.d.ts.map +0 -1
- package/dist/useTree.js +0 -137
- package/dist/useTree.js.map +0 -1
- package/tsconfig.cjs.json +0 -7
|
@@ -20,7 +20,7 @@ import type {
|
|
|
20
20
|
InsertableTreeFieldFromImplicitField,
|
|
21
21
|
} from "@fluidframework/tree";
|
|
22
22
|
import { configuredSharedTree, FormatValidatorBasic } from "@fluidframework/tree/internal";
|
|
23
|
-
import
|
|
23
|
+
import { type FC, type JSX, useCallback, useEffect, useState } from "react";
|
|
24
24
|
|
|
25
25
|
import { toPropTreeNode, type PropTreeValue } from "./propNode.js";
|
|
26
26
|
|
|
@@ -138,7 +138,7 @@ export interface IReactTreeDataObject<TSchema extends ImplicitFieldSchema> {
|
|
|
138
138
|
* and thus making it a member avoids the user of this from having to explicitly provide the type parameter.
|
|
139
139
|
* This is an arrow function not a method so it gets the correct this when not called as a member.
|
|
140
140
|
*/
|
|
141
|
-
readonly TreeViewComponent: (props: TreeViewProps<TSchema>) =>
|
|
141
|
+
readonly TreeViewComponent: (props: TreeViewProps<TSchema>) => JSX.Element;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
/**
|
|
@@ -149,7 +149,7 @@ export interface TreeViewProps<TSchema extends ImplicitFieldSchema> {
|
|
|
149
149
|
/**
|
|
150
150
|
* Component to display the tree content.
|
|
151
151
|
*/
|
|
152
|
-
readonly viewComponent:
|
|
152
|
+
readonly viewComponent: FC<{
|
|
153
153
|
root: PropTreeValue<TreeFieldFromImplicitField<TSchema>>;
|
|
154
154
|
}>;
|
|
155
155
|
|
|
@@ -159,7 +159,7 @@ export interface TreeViewProps<TSchema extends ImplicitFieldSchema> {
|
|
|
159
159
|
*
|
|
160
160
|
* @defaultValue Component which describes the situation (in English) and allows the user to upgrade the schema to match the {@link @fluidframework/tree#TreeViewConfiguration} if possible.
|
|
161
161
|
*/
|
|
162
|
-
readonly errorComponent?:
|
|
162
|
+
readonly errorComponent?: FC<SchemaIncompatibleProps>;
|
|
163
163
|
|
|
164
164
|
// TODO: Once its possible to query the status of individual schema upgrades, provide more options here for handling such cases.
|
|
165
165
|
}
|
|
@@ -203,11 +203,11 @@ export abstract class ReactTreeDataObject<
|
|
|
203
203
|
function useViewCompatibility<TSchema extends ImplicitFieldSchema>(
|
|
204
204
|
view: TreeView<TSchema>,
|
|
205
205
|
): SchemaCompatibilityStatus {
|
|
206
|
-
const [compatibility, setCompatibility] =
|
|
206
|
+
const [compatibility, setCompatibility] = useState<SchemaCompatibilityStatus>(
|
|
207
207
|
view.compatibility,
|
|
208
208
|
);
|
|
209
209
|
|
|
210
|
-
|
|
210
|
+
useEffect(() => {
|
|
211
211
|
const updateCompatibility = (): void => {
|
|
212
212
|
setCompatibility(view.compatibility);
|
|
213
213
|
};
|
|
@@ -222,11 +222,9 @@ function useViewCompatibility<TSchema extends ImplicitFieldSchema>(
|
|
|
222
222
|
function useViewRoot<TSchema extends ImplicitFieldSchema>(
|
|
223
223
|
view: TreeView<TSchema>,
|
|
224
224
|
): TreeFieldFromImplicitField<TSchema> | undefined {
|
|
225
|
-
const [root, setRoot] =
|
|
226
|
-
undefined,
|
|
227
|
-
);
|
|
225
|
+
const [root, setRoot] = useState<TreeFieldFromImplicitField<TSchema> | undefined>(undefined);
|
|
228
226
|
|
|
229
|
-
|
|
227
|
+
useEffect(() => {
|
|
230
228
|
const updateRoot = (): void => {
|
|
231
229
|
if (view.compatibility.canView) {
|
|
232
230
|
setRoot(view.root);
|
|
@@ -253,12 +251,12 @@ export function TreeViewComponent<TSchema extends ImplicitFieldSchema>({
|
|
|
253
251
|
errorComponent,
|
|
254
252
|
}: TreeViewProps<TSchema> & {
|
|
255
253
|
tree: Pick<IReactTreeDataObject<TSchema>, "treeView">;
|
|
256
|
-
}):
|
|
254
|
+
}): JSX.Element {
|
|
257
255
|
const view = tree.treeView;
|
|
258
256
|
|
|
259
257
|
const compatibility = useViewCompatibility(view);
|
|
260
258
|
const root = useViewRoot(view);
|
|
261
|
-
const upgradeSchema =
|
|
259
|
+
const upgradeSchema = useCallback((): void => view.upgradeSchema(), [view]);
|
|
262
260
|
|
|
263
261
|
// Note: this policy is on the stricter side and ensures that clients will only be able to submit edits when their view schema
|
|
264
262
|
// supports exactly the same documents as the stored schema.
|
|
@@ -302,7 +300,7 @@ function TreeErrorComponent({
|
|
|
302
300
|
}: {
|
|
303
301
|
compatibility: SchemaCompatibilityStatus;
|
|
304
302
|
upgradeSchema: () => void;
|
|
305
|
-
}):
|
|
303
|
+
}): JSX.Element {
|
|
306
304
|
// eslint-disable-next-line unicorn/prefer-ternary
|
|
307
305
|
if (compatibility.canUpgrade) {
|
|
308
306
|
return (
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
FormattedTextAsTree,
|
|
8
|
+
FormattedMainView,
|
|
9
|
+
type FormattedMainViewProps,
|
|
10
|
+
type FormattedEditorHandle,
|
|
11
|
+
} from "./quillFormattedView.js";
|