Merge pull request #701 from AppFlowy-IO/feat/flowy_editor_documentation

chore: update operation documentation
This commit is contained in:
Lucas.Xu 2022-07-26 20:20:07 +08:00 committed by GitHub
commit 92675a1f48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 25 deletions

View File

@ -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"
},

View File

@ -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.
@immutable
class Transaction {
final UnmodifiableListView<Operation> operations;

View File

@ -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;

View File

@ -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> {