chore: update README.MD

This commit is contained in:
Lucas.Xu 2022-10-11 09:36:04 +08:00
parent 06173195c5
commit f469253916
2 changed files with 7 additions and 7 deletions

View File

@ -67,7 +67,7 @@ You can also create an editor from a JSON object in order to configure your init
```dart ```dart
final json = ...; final json = ...;
final editorStyle = EditorStyle.defaultStyle(); final editorStyle = EditorStyle.defaultStyle();
final editorState = EditorState(StateTree.fromJson(data)); final editorState = EditorState(Document.fromJson(data));
final editor = AppFlowyEditor( final editor = AppFlowyEditor(
editorState: editorState, editorState: editorState,
editorStyle: editorStyle, editorStyle: editorStyle,

View File

@ -9,7 +9,7 @@ void main() {
test('create state tree', () async { test('create state tree', () async {
// final String response = await rootBundle.loadString('assets/document.json'); // final String response = await rootBundle.loadString('assets/document.json');
// final data = Map<String, Object>.from(json.decode(response)); // final data = Map<String, Object>.from(json.decode(response));
// final document = StateTree.fromJson(data); // final document = Document.fromJson(data);
// expect(document.root.type, 'root'); // expect(document.root.type, 'root');
// expect(document.root.toJson(), data['document']); // expect(document.root.toJson(), data['document']);
}); });
@ -17,7 +17,7 @@ void main() {
test('search node by Path in state tree', () async { test('search node by Path in state tree', () async {
// final String response = await rootBundle.loadString('assets/document.json'); // final String response = await rootBundle.loadString('assets/document.json');
// final data = Map<String, Object>.from(json.decode(response)); // final data = Map<String, Object>.from(json.decode(response));
// final document = StateTree.fromJson(data); // final document = Document.fromJson(data);
// final checkBoxNode = document.root.childAtPath([1, 0]); // final checkBoxNode = document.root.childAtPath([1, 0]);
// expect(checkBoxNode != null, true); // expect(checkBoxNode != null, true);
// final textType = checkBoxNode!.attributes['text-type']; // final textType = checkBoxNode!.attributes['text-type'];
@ -27,7 +27,7 @@ void main() {
test('search node by Self in state tree', () async { test('search node by Self in state tree', () async {
// final String response = await rootBundle.loadString('assets/document.json'); // final String response = await rootBundle.loadString('assets/document.json');
// final data = Map<String, Object>.from(json.decode(response)); // final data = Map<String, Object>.from(json.decode(response));
// final document = StateTree.fromJson(data); // final document = Document.fromJson(data);
// final checkBoxNode = document.root.childAtPath([1, 0]); // final checkBoxNode = document.root.childAtPath([1, 0]);
// expect(checkBoxNode != null, true); // expect(checkBoxNode != null, true);
// final textType = checkBoxNode!.attributes['text-type']; // final textType = checkBoxNode!.attributes['text-type'];
@ -39,7 +39,7 @@ void main() {
test('insert node in state tree', () async { test('insert node in state tree', () async {
// final String response = await rootBundle.loadString('assets/document.json'); // final String response = await rootBundle.loadString('assets/document.json');
// final data = Map<String, Object>.from(json.decode(response)); // final data = Map<String, Object>.from(json.decode(response));
// final document = StateTree.fromJson(data); // final document = Document.fromJson(data);
// final insertNode = Node.fromJson({ // final insertNode = Node.fromJson({
// 'type': 'text', // 'type': 'text',
// }); // });
@ -51,7 +51,7 @@ void main() {
test('delete node in state tree', () async { test('delete node in state tree', () async {
// final String response = await rootBundle.loadString('assets/document.json'); // final String response = await rootBundle.loadString('assets/document.json');
// final data = Map<String, Object>.from(json.decode(response)); // final data = Map<String, Object>.from(json.decode(response));
// final document = StateTree.fromJson(data); // final document = Document.fromJson(data);
// document.delete([1, 1], 1); // document.delete([1, 1], 1);
// final node = document.nodeAtPath([1, 1]); // final node = document.nodeAtPath([1, 1]);
// expect(node != null, true); // expect(node != null, true);
@ -61,7 +61,7 @@ void main() {
test('update node in state tree', () async { test('update node in state tree', () async {
// final String response = await rootBundle.loadString('assets/document.json'); // final String response = await rootBundle.loadString('assets/document.json');
// final data = Map<String, Object>.from(json.decode(response)); // final data = Map<String, Object>.from(json.decode(response));
// final document = StateTree.fromJson(data); // final document = Document.fromJson(data);
// final test = document.update([1, 1], {'text-type': 'heading1'}); // final test = document.update([1, 1], {'text-type': 'heading1'});
// expect(test, true); // expect(test, true);
// final updatedNode = document.nodeAtPath([1, 1]); // final updatedNode = document.nodeAtPath([1, 1]);