Skip to content

Commit

Permalink
refactor: use textContent in favor of innerText
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed May 13, 2021
1 parent 0f081cd commit 8fb23d3
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions resources/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,17 @@ window.initializeCodegroups = () => ({
this.$el.classList.add('ready')
}
})
}
},
})

window.initializeCode = () => ({
copyToClipboard() {
const code = this.$el.querySelector('pre').innerText
navigator.clipboard.writeText(code);
const code = this.$el.querySelector('pre').textContent
navigator.clipboard.writeText(code)

this.$refs.copyButton.innerText = 'Copied'
setTimeout(() =>
this.$refs.copyButton.innerText = 'Copy to Clipboard'
, 1000)
}
setTimeout(() => (this.$refs.copyButton.innerText = 'Copy to Clipboard'), 1000)
},
})

function prefixZoneName(title, docUrl) {
Expand Down Expand Up @@ -79,22 +77,24 @@ window.initializeSearch = (apiKey) => ({
mounted() {
Promise.all([
import(/* webpackChunkName: "docsearch" */ '@docsearch/js'),
import(/* webpackChunkName: "docsearch" */ '@docsearch/css')
]).then(([docsearch]) => {
docsearch = docsearch.default
docsearch({
apiKey: apiKey,
indexName: 'adonisjs_next',
container: '#algolia-search-input',
transformItems: (items) => {
return items.map((item) => {
item.hierarchy.lvl0 = prefixZoneName(item.hierarchy.lvl0, item.url)
return item
})
},
import(/* webpackChunkName: "docsearch" */ '@docsearch/css'),
])
.then(([docsearch]) => {
docsearch = docsearch.default
docsearch({
apiKey: apiKey,
indexName: 'adonisjs_next',
container: '#algolia-search-input',
transformItems: (items) => {
return items.map((item) => {
item.hierarchy.lvl0 = prefixZoneName(item.hierarchy.lvl0, item.url)
return item
})
},
})
})
}).catch(console.error)
}
.catch(console.error)
},
})

/**
Expand All @@ -111,7 +111,7 @@ window.selectBoxNavigate = () => ({

navigateTo(e) {
window.location = e.target.value
}
},
})

/**
Expand Down

0 comments on commit 8fb23d3

Please sign in to comment.