mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Fixed commentbox not injected
This commit is contained in:
parent
eb10f02e5f
commit
1504e84c7e
1 changed files with 8 additions and 10 deletions
|
@ -7,22 +7,20 @@ const ROOT_DIV_ID = 'ghost-comments-root';
|
|||
function addRootDiv() {
|
||||
const scriptTag = document.querySelector('script[data-ghost-comments]');
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
const elem = document.createElement('div');
|
||||
elem.id = ROOT_DIV_ID;
|
||||
document.body.appendChild(elem);
|
||||
} else {
|
||||
// We need to inject the comment box at the same place as the script tag
|
||||
if (scriptTag) {
|
||||
const elem = document.createElement('div');
|
||||
elem.id = ROOT_DIV_ID;
|
||||
scriptTag.parentElement.insertBefore(elem, scriptTag);
|
||||
} else if (process.env.NODE_ENV === 'development') {
|
||||
const elem = document.createElement('div');
|
||||
elem.id = ROOT_DIV_ID;
|
||||
document.body.appendChild(elem);
|
||||
} else {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn('Comment box location was not found: could not load comments box.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getSiteData() {
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue