Skip to content

Commit

Permalink
Revert "fix: copy handler migrated to latest api (#192)" (#236)
Browse files Browse the repository at this point in the history
This reverts commit ad838cf.
  • Loading branch information
LucasXu0 authored Jun 22, 2023
1 parent 5b2ea64 commit 3614cc5
Show file tree
Hide file tree
Showing 22 changed files with 879 additions and 2,829 deletions.
2 changes: 1 addition & 1 deletion example/assets/example.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,4 @@
}
]
}
}
}
10 changes: 4 additions & 6 deletions lib/appflowy_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export 'src/core/document/node_iterator.dart';
export 'src/infra/flowy_svg.dart';
export 'src/extensions/extensions.dart';
export 'src/service/default_text_operations/format_rich_text_style.dart';
export 'src/infra/html_converter.dart';
export 'src/service/internal_key_event_handlers/copy_paste_handler.dart';

export 'src/editor/block_component/block_component.dart';
Expand All @@ -62,11 +63,8 @@ export 'src/service/standard_block_components.dart';

export 'src/core/document/deprecated/node.dart';
export 'src/core/document/deprecated/document.dart';
export 'src/plugins/html/decoder/html_document_decoder.dart';
export 'src/plugins/html/encoder/html_document_encoder.dart';
export 'src/plugins/html/decoder/html_nodes_decoder.dart';
export 'src/plugins/html/encoder/html_nodes_encoder.dart';

export 'src/plugins/html/html_document_decoder.dart';
export 'src/plugins/html/html_document_encoder.dart';
export 'src/plugins/html/html_document.dart';
export 'src/plugins/html/html_nodes.dart';
export 'src/infra/mobile/mobile.dart';
export 'src/infra/clipboard.dart';
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:appflowy_editor/src/infra/clipboard.dart';
import 'package:flutter/material.dart';

/// Copy.
Expand Down Expand Up @@ -31,7 +32,11 @@ CommandShortcutEventHandler _copyCommandHandler = (editorState) {
// rich text.
// TODO: support rich text. the below code is not working.
final nodes = editorState.getNodesInSelection(selection);
final html = nodesToHTML(nodes);
final html = NodesToHTMLConverter(
nodes: nodes,
startOffset: selection.startIndex,
endOffset: selection.endIndex,
).toHTMLString();

AppFlowyClipboard.setData(
text: text,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:appflowy_editor/src/infra/clipboard.dart';
import 'package:flutter/material.dart';

/// Paste.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:appflowy_editor/src/editor/toolbar/desktop/items/link/link_menu.dart';
import 'package:appflowy_editor/src/infra/clipboard.dart';
import 'package:flutter/material.dart';

final linkItem = ToolbarItem(
Expand Down
Loading

0 comments on commit 3614cc5

Please sign in to comment.