Skip to content

Commit 2d4cb57

Browse files
committed
Android: Make text selectable on plaintext page
1 parent 78780d0 commit 2d4cb57

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Changelog
22

3-
## 1.5.1
3+
## 1.6.0
44

5-
- Android: Create todo.txt file in user-accessible location.
5+
- Android: Created todo.txt file in user-accessible location.
6+
- Android: Made text on plaintext page selectable.
67

78
## 1.5.0
89

src/app/plaintext/plaintext.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
</div>
44
<div class="page">
55
<div id="file-content">
6-
<pre>{{ todoFile.content }}</pre>
6+
<pre #fileContent>{{ todoFile.content }}</pre>
77
</div>
88
</div>

src/app/plaintext/plaintext.component.tns.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<ScrollView orientation="horizontal">
2222
<Label
2323
id="file-content"
24+
#fileContent
2425
text="{{ todoFile.content }}"
2526
textWrap="true"
2627
></Label>

src/app/plaintext/plaintext.component.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import { Component, ViewContainerRef } from '@angular/core'
1+
import { Component, ViewContainerRef, AfterViewInit, ViewChild, ElementRef } from '@angular/core'
22

33
import { SideDrawerService } from '../nav/sidedrawer.service'
44
import { RouterService } from '../shared/router.service'
55
import { TodoFileService } from '../shared/todo-file.service'
6+
import { isAndroid } from '../shared/helpers/platform'
67

78
@Component({
89
selector: 'ms-plaintext',
@@ -13,13 +14,24 @@ export class PlainTextComponent {
1314

1415
title = 'Plain text';
1516

17+
@ViewChild('fileContent', {static: false})
18+
fileContent: ElementRef
19+
1620
constructor(
1721
private router: RouterService,
1822
public todoFile: TodoFileService,
1923
private sideDrawer: SideDrawerService,
2024
private viewContainerRef: ViewContainerRef,
2125
) { }
2226

27+
ngAfterViewInit(): void {
28+
setTimeout(() => {
29+
if (isAndroid) {
30+
this.fileContent.nativeElement.android.setTextIsSelectable(true)
31+
}
32+
}, 100)
33+
}
34+
2335
openDrawer() {
2436
this.sideDrawer.open(this.viewContainerRef)
2537
}

0 commit comments

Comments
 (0)