Commit 2da8ae6b authored by Konstantin Schulz's avatar Konstantin Schulz
Browse files

bug fix: another attempt at displaying the share button for exercises

parent 1b7df747
{
"name": "mc_frontend",
"version": "1.3.7",
"version": "1.3.8",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
......
......@@ -26,20 +26,25 @@
</ion-row>
<ion-row>
<ion-col>
<button class="button-icon-only" (click)="toggleShareLink()">
<button class="button-icon-only" (click)="showShareLink = !showShareLink">
<ion-icon slot="start" name="share"></ion-icon>
<span>{{ "SHARE" | translate}}</span>
<span style="vertical-align: super">{{ "SHARE" | translate}}</span>
</button>
</ion-col>
</ion-row>
<ion-row *ngIf="shareLink">
<ion-row *ngIf="showShareLink">
<ion-col>
<label class="share-link">
<textarea id="shareLink" (focus)="selectLink()" [(ngModel)]="shareLink"></textarea>
<button class="button-copy-link" (click)="copyLink()">
<div>
<label>
<input type="text" (focus)="selectLink()"
value="{{HelperService.baseUrl + '/' + HelperService.config['frontendExercisePage'] + '?eid=' + this.corpusService.annisResponse.exercise_id}}"/>
</label>
</div>
<div>
<button class="button-icon-only" (click)="copyLink()">
<ion-icon name="copy"></ion-icon>
</button>
</label>
</div>
</ion-col>
</ion-row>
<ion-row *ngIf="HelperService.isVocabularyCheck">
......
......@@ -11,6 +11,11 @@ h5 {
display: inline-block;
}
input[type=text] {
padding: 5px;
margin-right: 10px;
min-width: 20em;
}
ol {
text-align: left;
......@@ -21,30 +26,13 @@ textarea {
border: solid lightgrey;
}
.button-copy-link {
-ms-transform: scale(1.5); /* IE */
-moz-transform: scale(1.5); /* FF */
-webkit-transform: scale(1.5); /* Safari and Chrome */
-o-transform: scale(1.5); /* Opera */
vertical-align: super;
}
.button-icon-only {
-ms-transform: scale(1.5); /* IE */
-moz-transform: scale(1.5); /* FF */
-webkit-transform: scale(1.5); /* Safari and Chrome */
-o-transform: scale(1.5); /* Opera */
display: flex;
}
.first {
max-width: 250px;
}
.share-link {
float: left;
}
#shareLink {
margin-right: 10px;
}
......@@ -24,12 +24,12 @@ export class PreviewPage implements OnDestroy, OnInit {
public ExerciseType = ExerciseType;
public FileType = FileType;
public currentSolutions: Solution[];
public inputSelector = 'input[type="text"]';
public maxGapLength = 0;
public shareLink: string;
public showShareLink = false;
public showInstructions = false;
public solutionIndicesString: string;
public solutionNodeIdSet: Set<string> = new Set<string>();
public textareaSelector = '#shareLink';
public urlBase: string;
constructor(public navCtrl: NavController,
......@@ -53,10 +53,10 @@ export class PreviewPage implements OnDestroy, OnInit {
}
async copyLink(): Promise<void> {
const ta: HTMLTextAreaElement = document.querySelector(this.textareaSelector);
ta.select();
const input: HTMLInputElement = document.querySelector(this.inputSelector);
input.select();
document.execCommand('copy');
ta.setSelectionRange(0, 0);
input.setSelectionRange(0, 0);
const toast = await this.toastCtrl.create({
message: this.corpusService.shareLinkCopiedString,
duration: 3000,
......@@ -130,7 +130,7 @@ export class PreviewPage implements OnDestroy, OnInit {
}
selectLink(): void {
const ta: HTMLTextAreaElement = document.querySelector(this.textareaSelector);
const ta: HTMLTextAreaElement = document.querySelector(this.inputSelector);
ta.select();
}
......@@ -155,15 +155,6 @@ export class PreviewPage implements OnDestroy, OnInit {
this.initH5P();
}
toggleShareLink(): void {
if (this.shareLink) {
this.shareLink = '';
} else {
this.shareLink = `${HelperService.baseUrl}/${HelperService.config['frontendExercisePage']}?eid=` +
this.corpusService.annisResponse.exercise_id;
}
}
updateFileUrl(): void {
const fileId: string = this.corpusService.annisResponse.exercise_id;
const fileTypeBase = '&type=';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment