Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: paste from html #391

Merged
merged 1 commit into from
Aug 17, 2023
Merged

Conversation

LucasXu0
Copy link
Collaborator

@LucasXu0 LucasXu0 commented Aug 17, 2023

  • Use the 'html' package to parse the raw HTML string.
  • Parse the result into a document structure.
  • When pasting, replace the current selection with the new nodes.

For a single DOM element, we only need to insert it at the selected position.
For multiple DOM elements, we should split the selected node, merge it into the parsed nodes, and then insert the parsed nodes before removing the selected one.

@codecov
Copy link

codecov bot commented Aug 17, 2023

Codecov Report

Merging #391 (fa1a625) into main (e5a10c4) will decrease coverage by 0.21%.
The diff coverage is 23.46%.

@@            Coverage Diff             @@
##             main     #391      +/-   ##
==========================================
- Coverage   76.09%   75.89%   -0.21%     
==========================================
  Files         252      252              
  Lines       10190    10274      +84     
==========================================
+ Hits         7754     7797      +43     
- Misses       2436     2477      +41     
Files Changed Coverage Δ
...tor_component/service/keyboard_service_widget.dart 89.07% <ø> (ø)
...ortcuts/command_shortcut_events/paste_command.dart 28.31% <0.00%> (-51.69%) ⬇️
lib/src/plugins/html/html_document_decoder.dart 90.53% <94.73%> (+12.40%) ⬆️
lib/src/editor/util/color_util.dart 100.00% <100.00%> (+61.90%) ⬆️

@LucasXu0 LucasXu0 merged commit cf14e0d into AppFlowy-IO:main Aug 17, 2023
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant