mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-22 06:37:56 +01:00
Add support for text copy and paste.
This commit is contained in:
parent
ad30a9dd94
commit
2f6b681016
@ -404,12 +404,21 @@ class Designer extends Events {
|
||||
}
|
||||
|
||||
pasteClipboard(): void {
|
||||
if (this._clipboard.length === 0) {
|
||||
$notify($msg('CLIPBOARD_IS_EMPTY'));
|
||||
return;
|
||||
// If the no selection has been made, update with the text on the clipboard.
|
||||
if (this._clipboard.length !== 0) {
|
||||
this._actionDispatcher.addTopics(this._clipboard, null);
|
||||
this._clipboard = [];
|
||||
} else {
|
||||
const topics = this.getModel().filterSelectedTopics();
|
||||
if (topics.length > 0) {
|
||||
navigator.clipboard.readText().then((text) => {
|
||||
this._actionDispatcher.changeTextToTopic(
|
||||
topics.map((t) => t.getId()),
|
||||
text.trim(),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
this._actionDispatcher.addTopics(this._clipboard, null);
|
||||
this._clipboard = [];
|
||||
}
|
||||
|
||||
getModel(): DesignerModel {
|
||||
|
Loading…
Reference in New Issue
Block a user