mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: could not copy and paste the plain text
This commit is contained in:
parent
793d3808ec
commit
d90414a8c1
@ -39,7 +39,10 @@ void _handleCopy(EditorState editorState) async {
|
|||||||
endOffset: selection.end.offset)
|
endOffset: selection.end.offset)
|
||||||
.toHTMLString();
|
.toHTMLString();
|
||||||
Log.keyboard.debug('copy html: $htmlString');
|
Log.keyboard.debug('copy html: $htmlString');
|
||||||
RichClipboard.setData(RichClipboardData(html: htmlString));
|
RichClipboard.setData(RichClipboardData(
|
||||||
|
html: htmlString,
|
||||||
|
text: textNode.toPlainText(),
|
||||||
|
));
|
||||||
} else {
|
} else {
|
||||||
Log.keyboard.debug('unimplemented: copy non-text');
|
Log.keyboard.debug('unimplemented: copy non-text');
|
||||||
}
|
}
|
||||||
@ -55,13 +58,15 @@ void _handleCopy(EditorState editorState) async {
|
|||||||
endNode: endNode,
|
endNode: endNode,
|
||||||
).toList();
|
).toList();
|
||||||
|
|
||||||
final copyString = NodesToHTMLConverter(
|
final html = NodesToHTMLConverter(
|
||||||
nodes: nodes,
|
nodes: nodes,
|
||||||
startOffset: selection.start.offset,
|
startOffset: selection.start.offset,
|
||||||
endOffset: selection.end.offset)
|
endOffset: selection.end.offset,
|
||||||
.toHTMLString();
|
).toHTMLString();
|
||||||
Log.keyboard.debug('copy html: $copyString');
|
final text = nodes
|
||||||
RichClipboard.setData(RichClipboardData(html: copyString));
|
.map((node) => node is TextNode ? node.toPlainText() : '\n')
|
||||||
|
.join('\n');
|
||||||
|
RichClipboard.setData(RichClipboardData(html: html, text: text));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _pasteHTML(EditorState editorState, String html) {
|
void _pasteHTML(EditorState editorState, String html) {
|
||||||
|
Loading…
Reference in New Issue
Block a user