Skip to content

Commit

Permalink
fix: copy handler migrated to latest api (#192)
Browse files Browse the repository at this point in the history
* fix: copy handler migrated to latest api

* flutter analyze

* code formatted

* fix: test added for copy handler

* more test added for copy handler

* fix:write test for copy handler

* text added for html to nodes

* fix: added more test for html encoder

* fix:removed unused imports

* fix: copyhandler collapse state test added

* added direct event handler in test

* flutter analyze

* revert changes in example.json
  • Loading branch information
alihassan143 authored Jun 20, 2023
1 parent 2d3ab80 commit ad838cf
Show file tree
Hide file tree
Showing 22 changed files with 2,829 additions and 879 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: 6 additions & 4 deletions lib/appflowy_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ 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 @@ -63,8 +62,11 @@ 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/html_document_decoder.dart';
export 'src/plugins/html/html_document_encoder.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.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,5 +1,4 @@
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 @@ -32,11 +31,7 @@ CommandShortcutEventHandler _copyCommandHandler = (editorState) {
// rich text.
// TODO: support rich text. the below code is not working.
final nodes = editorState.getNodesInSelection(selection);
final html = NodesToHTMLConverter(
nodes: nodes,
startOffset: selection.startIndex,
endOffset: selection.endIndex,
).toHTMLString();
final html = nodesToHTML(nodes);

AppFlowyClipboard.setData(
text: text,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
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,6 +1,5 @@
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 ad838cf

Please sign in to comment.