Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
chore: update operation documentation
appflowy2661a6a4ae44
diff --git a/frontend/.vscode/settings.json b/frontend/.vscode/settings.jsonindex 2f5e152d62..d1732c5231 100644--- a/frontend/.vscode/settings.json+++ b/frontend/.vscode/settings.json@@ -2,23 +2,21 @@"[dart]": {"editor.formatOnSave": true,"editor.formatOnType": true,- "editor.rulers": [- 120- ],+ "editor.rulers": [80],"editor.selectionHighlight": false,"editor.suggest.snippetsPreventQuickSuggestions": false,"editor.suggestSelection": "first","editor.tabCompletion": "onlySnippets",- "editor.wordBasedSuggestions": false+ "editor.wordBasedSuggestions": false,},"svgviewer.enableautopreview": true,"svgviewer.previewcolumn": "Active","svgviewer.showzoominout": true,- "editor.wordWrapColumn": 120,+ "editor.wordWrapColumn": 80,"editor.minimap.maxColumn": 140,"prettier.printWidth": 140,"editor.wordWrap": "wordWrapColumn",- "dart.lineLength": 120,+ "dart.lineLength": 80,"files.associations": {"*.log.*": "log"},diff --git a/frontend/app_flowy/packages/flowy_editor/lib/operation/transaction.dart b/frontend/app_flowy/packages/flowy_editor/lib/operation/transaction.dartindex 3de528e868..85bc43f537 100644--- a/frontend/app_flowy/packages/flowy_editor/lib/operation/transaction.dart+++ b/frontend/app_flowy/packages/flowy_editor/lib/operation/transaction.dart@@ -3,19 +3,15 @@ import 'package:flutter/material.dart';import 'package:flowy_editor/document/selection.dart';import './operation.dart';-/// This class to use to store the **changes**-/// will be applied to the editor.+/// A [Transaction] has a list of [Operation] objects that will be applied+/// to the editor. It is an immutable class and used to store and transmit.///-/// This class is immutable version the the class-/// [[Transaction]]. Is used to stored and-/// transmit. If you want to build the transaction,-/// use [[Transaction]] directly.+/// If you want to build a new [Transaction], use [TransactionBuilder] directly.////// There will be several ways to consume the transaction:/// 1. Apply to the state to update the UI./// 2. Send to the backend to store and do operation transforming.-/// 3. Stored by the UndoManager to implement redo/undo.-///+/// 3. Used by the UndoManager to implement redo/undo.@immutableclass Transaction {final UnmodifiableListView<Operation> operations;diff --git a/frontend/app_flowy/packages/flowy_editor/lib/operation/transaction_builder.dart b/frontend/app_flowy/packages/flowy_editor/lib/operation/transaction_builder.dartindex 6fca48f230..319002bd45 100644--- a/frontend/app_flowy/packages/flowy_editor/lib/operation/transaction_builder.dart+++ b/frontend/app_flowy/packages/flowy_editor/lib/operation/transaction_builder.dart@@ -11,16 +11,10 @@ import 'package:flowy_editor/document/selection.dart';import './operation.dart';import './transaction.dart';-///-/// This class is used to-/// build the transaction from the state.-///-/// This class automatically save the-/// cursor from the state.-///-/// When the transaction is undo, the-/// cursor can be restored.-///+/// A [TransactionBuilder] is used to build the transaction from the state.+/// It will save make a snapshot of the cursor selection state automatically.+/// The cursor can be resoted if the transaction is undo.+class TransactionBuilder {final List<Operation> operations = [];EditorState state;diff --git a/frontend/app_flowy/packages/flowy_editor/lib/undo_manager.dart b/frontend/app_flowy/packages/flowy_editor/lib/undo_manager.dartindex d47ec2359a..5b543f03a1 100644--- a/frontend/app_flowy/packages/flowy_editor/lib/undo_manager.dart+++ b/frontend/app_flowy/packages/flowy_editor/lib/undo_manager.dart@@ -7,7 +7,7 @@ import 'package:flowy_editor/operation/transaction.dart';import 'package:flowy_editor/editor_state.dart';import 'package:flutter/foundation.dart';-/// This class contains operations committed by users.+/// A [HistoryItem] contains list of operations committed by users./// If a [HistoryItem] is not sealed, operations can be added sequentially./// Otherwise, the operations should be added to a new [HistoryItem].class HistoryItem extends LinkedListEntry<HistoryItem> {