Skip to content

Commit 08d78f9

Browse files
Splaktarandrewseguin
authored andcommitted
docs(cdk/clipboard): fix header anchors and TOC (#17533)
rename headers fix typo
1 parent 77d51ca commit 08d78f9

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

src/cdk/clipboard/clipboard.md

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
The clipboard package provides helpers for working with the system clipboard.
22

3-
## `cdkCopyToClipboard` directive
3+
### Click an element to copy
44

5-
The `cdkCopyToClipboard` directive can be used to easily add copy-on-click
6-
functionality to an existing element. The directive selector doubles as an
7-
`@Input()` for the text to be copied.
5+
The `cdkCopyToClipboard` directive can be used to easily add copy-on-click functionality to an
6+
existing element. The directive selector doubles as an `@Input()` for the text to be copied.
87

98
```html
109
<img src="avatar.jpg" alt="Hero avatar" [cdkCopyToClipboard]="getShortBio()">
1110
```
1211

1312
<!-- example(cdk-clipboard-overview) -->
1413

15-
## `Clipboard` service
14+
### Programmatically copy a string
1615

17-
The `Clipboard` service copies text to the
18-
user's clipboard. It has two methods: `copy` and `beginCopy`. For cases where
19-
you are copying a relatively small amount of text, you can call `copy` directly
20-
to place it on the clipboard.
16+
The `Clipboard` service copies text to the user's clipboard. It has two methods: `copy` and
17+
`beginCopy`. For cases where you are copying a relatively small amount of text, you can call `copy`
18+
directly to place it on the clipboard.
2119

2220
```typescript
2321
class HeroProfile {
@@ -29,13 +27,11 @@ class HeroProfile {
2927
}
3028
```
3129

32-
However, for longer text the browser needs time to fill an intermediate
33-
textarea element and copy the content. Directly calling `copy` may fail
34-
in this case, so you can pre-load the text by calling `beginCopy`. This method
35-
returns a `PendingCopy` object that has a `copy` method to finish copying the
36-
text that was buffered. Please note, if you call `beginCopy`, you must
37-
clean up the `PendingCopy` object by calling `destroy` on it after you are
38-
finished.
30+
However, for longer text the browser needs time to fill an intermediate textarea element and copy
31+
the content. Directly calling `copy` may fail in this case, so you can pre-load the text by calling
32+
`beginCopy`. This method returns a `PendingCopy` object that has a `copy` method to finish copying
33+
the text that was buffered. Please note, if you call `beginCopy`, you must clean up the
34+
`PendingCopy` object by calling `destroy` on it after you are finished.
3935

4036
```typescript
4137
class HeroProfile {
@@ -54,7 +50,7 @@ class HeroProfile {
5450
// Remember to destroy when you're done!
5551
pending.destroy();
5652
}
57-
}
53+
};
5854
setTimeout(attempt);
5955
}
6056
}

0 commit comments

Comments
 (0)