mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: Copy to clipboard all text nodes as text (#5014)
* fix: Copy to clipboard all text nodes as text * fix: support copying text even if there are selected elements that are no text * patch: makes paragraphs betwen texts of each element * patch: allow copying text for bound text
This commit is contained in:
parent
670ceafc84
commit
89471094ce
2 changed files with 20 additions and 14 deletions
|
@ -5476,7 +5476,10 @@ class App extends React.Component<AppProps, AppState> {
|
|||
|
||||
const elements = this.scene.getElements();
|
||||
|
||||
const isTextNodesOnly = elements.every((element) => isTextElement(element));
|
||||
const selectedElements = getSelectedElements(
|
||||
this.scene.getElements(),
|
||||
this.state,
|
||||
);
|
||||
|
||||
const options: ContextMenuOption[] = [];
|
||||
if (probablySupportsClipboardBlob && elements.length > 0) {
|
||||
|
@ -5487,11 +5490,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||
options.push(actionCopyAsSvg);
|
||||
}
|
||||
|
||||
if (
|
||||
probablySupportsClipboardWriteText &&
|
||||
elements.length > 0 &&
|
||||
isTextNodesOnly
|
||||
) {
|
||||
if (probablySupportsClipboardWriteText && selectedElements.length > 0) {
|
||||
options.push(copyAllTextNodesAsText);
|
||||
}
|
||||
if (type === "canvas") {
|
||||
|
@ -5538,8 +5537,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||
elements.length > 0 &&
|
||||
actionCopyAsSvg,
|
||||
probablySupportsClipboardWriteText &&
|
||||
elements.length > 0 &&
|
||||
isTextNodesOnly &&
|
||||
selectedElements.length > 0 &&
|
||||
copyAllTextNodesAsText,
|
||||
((probablySupportsClipboardBlob && elements.length > 0) ||
|
||||
(probablySupportsClipboardWriteText && elements.length > 0)) &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue