File tree 5 files changed +66
-70
lines changed
5 files changed +66
-70
lines changed Original file line number Diff line number Diff line change @@ -29,20 +29,25 @@ export default {
29
29
}
30
30
},
31
31
mounted () {
32
- // Add copy button component in each pre element
33
- setTimeout (function () {
34
- const blocks = document .querySelectorAll (" pre.hljs" )
35
- for (const block of blocks) {
36
- const CopyButton = Vue .extend (AppCopyButton)
37
- const component = new CopyButton ().$mount ()
38
- block .appendChild (component .$el );
39
- }
40
- }, 250 )
32
+ const blocks = document .querySelectorAll (" pre.hljs" )
33
+ for (const block of blocks) {
34
+ const CopyButton = Vue .extend (AppCopyButton)
35
+ const component = new CopyButton ().$mount ()
36
+ block .appendChild (component .$el );
37
+ }
38
+ },
39
+ updated () {
40
+ const blocks = document .querySelectorAll (" pre.hljs" )
41
+ for (const block of blocks) {
42
+ const CopyButton = Vue .extend (AppCopyButton)
43
+ const component = new CopyButton ().$mount ()
44
+ block .appendChild (component .$el );
45
+ }
41
46
},
42
47
computed: {
43
48
markdown () {
44
49
let mode, wrapBody = this .step .body ;
45
- if (process .client == true ) {
50
+ if (process .client === true ) {
46
51
mode = this .detectMode (this .step .title )
47
52
48
53
}
You can’t perform that action at this time.
0 commit comments