Skip to content
Snippets Groups Projects
Commit e2996988 authored by Steinwender, Tamara's avatar Steinwender, Tamara
Browse files

Add clipboard functionality in filehandling

parent 0d6e8ef8
No related branches found
No related tags found
No related merge requests found
Pipeline #17852 failed
...@@ -38,6 +38,7 @@ the version number in its `package.json` is higher than the version number on np ...@@ -38,6 +38,7 @@ the version number in its `package.json` is higher than the version number on np
| `entry-point-url` | Entry point url for all api requests | | `entry-point-url` | Entry point url for all api requests |
| `requested-login-status` | Used by the login buttons to trigger a login in auth components | | `requested-login-status` | Used by the login buttons to trigger a login in auth components |
| `initial-file-handling-state` | Used by the file-handling component to sync file source/sink at first time open | | `initial-file-handling-state` | Used by the file-handling component to sync file source/sink at first time open |
| `clipboard-files` | Used by the file-handling component to use the clipboard source and sink |
| `analytics-event` | Used to send analytics events to the Matomo component | | `analytics-event` | Used to send analytics events to the Matomo component |
## Reserved events ## Reserved events
......
...@@ -217,6 +217,11 @@ export class FileSink extends ScopedElementsMixin(DBPLitElement) { ...@@ -217,6 +217,11 @@ export class FileSink extends ScopedElementsMixin(DBPLitElement) {
saveFilesToClipboard() saveFilesToClipboard()
{ {
//save it //save it
let data = {};
if (this.files.length !== 0) {
data = {"files": this.files};
this.sendSetPropertyEvent('clipboard-files', data);
}
} }
closeDialog(e) { closeDialog(e) {
......
...@@ -55,6 +55,8 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) { ...@@ -55,6 +55,8 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) {
this.firstOpen = true; this.firstOpen = true;
this.initialFileHandlingState = {target: '', path: ''}; this.initialFileHandlingState = {target: '', path: ''};
this.clipBoardFiles = {files: ''};
} }
static get scopedElements() { static get scopedElements() {
...@@ -89,6 +91,8 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) { ...@@ -89,6 +91,8 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) {
nextcloudPath: { type: String, attribute: false }, nextcloudPath: { type: String, attribute: false },
initialFileHandlingState: {type: Object, attribute: 'initial-file-handling-state'}, initialFileHandlingState: {type: Object, attribute: 'initial-file-handling-state'},
clipBoardFiles: {type: Object, attribute: 'clipboard-files'},
}; };
} }
...@@ -400,11 +404,30 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) { ...@@ -400,11 +404,30 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) {
getClipboardFiles() { getClipboardFiles() {
let htmlpath = []; let htmlpath = [];
htmlpath[0] = html`ein file und danach select button`; htmlpath[0] = html`ein file und danach select button<br>`;
console.log("############################", this.clipBoardFiles );
for(let i = 0; i < this.clipBoardFiles.files.length; i ++)
{
console.log("--", this.clipBoardFiles.files[i].name);
console.log("++", i);
htmlpath[i+1] = this.clipBoardFiles.files[i].name;
//htmlpath[i+1] += html`<br>`;
}
return htmlpath; return htmlpath;
} }
async sendClipboardFiles() {
for(let i = 0; i < this.clipBoardFiles.files.length; i ++)
{
await this.sendFileEvent(this.clipBoardFiles.files[i]);
}
this.closeDialog();
}
static get styles() { static get styles() {
// language=css // language=css
return css` return css`
...@@ -536,6 +559,8 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) { ...@@ -536,6 +559,8 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) {
<h2>Von der Zwischenablage auswählen</h2> <h2>Von der Zwischenablage auswählen</h2>
<p>Hier können Sie aus der zuvor temporär abgelegte Dateien auswählen.<br><br></p> <p>Hier können Sie aus der zuvor temporär abgelegte Dateien auswählen.<br><br></p>
<p>${this.getClipboardFiles()}</p> <p>${this.getClipboardFiles()}</p>
<button class="button select-button is-primary"
@click="${() => {this.sendClipboardFiles(); }}">Auswählen</button>
</div> </div>
</div> </div>
</main> </main>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment