mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
fix: not raise error when readme might not exist
This commit is contained in:
parent
85d0efbede
commit
e5f0d1b1cb
1 changed files with 8 additions and 3 deletions
|
|
@ -318,9 +318,9 @@ const clippy = createClippy()
|
|||
|
||||
let currentCodeSnippetElement: Element
|
||||
function attachCopySnippet() {
|
||||
const readmeSelector = '.repository-content #readme article'
|
||||
const readmeArticleSelector = '.repository-content #readme article'
|
||||
return $(
|
||||
readmeSelector,
|
||||
readmeArticleSelector,
|
||||
readmeElement =>
|
||||
readmeElement.addEventListener('mouseover', e => {
|
||||
// only move clippy when mouse is over a new snippet(<pre>)
|
||||
|
|
@ -340,7 +340,12 @@ function attachCopySnippet() {
|
|||
}
|
||||
}
|
||||
}),
|
||||
() => raiseError(new Error('cannot mount point for copy snippet button')),
|
||||
() => {
|
||||
const readmeSelector = '.repository-content #readme'
|
||||
$(readmeSelector, undefined, () =>
|
||||
raiseError(new Error('cannot find mount point for copy snippet button while readme exists'))
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue