Skip to content

Commit

Permalink
fix nocopy and noheader behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
recrwplay committed Aug 13, 2024
1 parent c5f2ace commit cde549d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
12 changes: 10 additions & 2 deletions preview-src/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -521,23 +521,31 @@ CREATE (n:Node {id: id, test: true, str: 'ing'})
RETURN collect(n) AS ns
----

.noheader
.Codeblock with role=noheader
[source,cypher,role=noheader]
----
UNWIND range(0, 100) AS id
CREATE (n:Node {id: id, test: true, str: 'ing'})
RETURN collect(n) AS ns
----

.nocopy
.Codeblock with role=nocopy
[source,cypher,role=nocopy]
----
UNWIND range(0, 100) AS id
CREATE (n:Node {id: id, test: true, str: 'ing'})
RETURN collect(n) AS ns
----

.Codeblock with role=nocopy noheader
[source,cypher,role=nocopy noheader]
----
UNWIND range(0, 100) AS id
CREATE (n:Node {id: id, test: true, str: 'ing'})
RETURN collect(n) AS ns
----

.Just some pre
....
pom.xml
src/
Expand Down
21 changes: 7 additions & 14 deletions src/js/06-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ document.addEventListener('DOMContentLoaded', function () {

listingBlock.classList.add('has-header')

if (originalTitle) {
if (originalTitle && !listingBlock.classList.contains('noheader')) {
listingBlock.classList.add('has-title')
var titleDiv = document.createElement('div')
titleDiv.className = 'code-title'
Expand All @@ -140,6 +140,8 @@ document.addEventListener('DOMContentLoaded', function () {
headerDivs.push(titleDiv)
}

var inset = createElement('div', 'code-inset')

if (addCopyButton) {
var copyButton = createElement('span', 'btn btn-copy fa fa-copy')

Expand Down Expand Up @@ -168,22 +170,13 @@ document.addEventListener('DOMContentLoaded', function () {
}, 1000)
})

var inset = createElement('div', 'code-inset', copyButton)
if (language !== 'none' && language) inset.dataset.lang = casedLang(language)

inset.appendChild(copyButton)
inset.appendChild(copySuccess)

// if (originalTitle) {
// div.insertBefore(inset, pre)
// } else {
// pre.appendChild(inset)
// }

// pre.appendChild(inset)

headerDivs.push(inset)
}

if (language !== 'none' && language) inset.dataset.lang = casedLang(language)
headerDivs.push(inset)

var header = createElement('div', 'code-header', headerDivs)
div.insertBefore(header, pre)
}
Expand Down

0 comments on commit cde549d

Please sign in to comment.