mirror of
https://github.com/jgthms/bulma
synced 2026-03-15 10:14:29 -07:00
Fix copy and expand
This commit is contained in:
@@ -35,8 +35,8 @@ jQuery(document).ready(function ($) {
|
||||
|
||||
$highlights.each(function() {
|
||||
var $el = $(this);
|
||||
var copy = '<button class="copy">Copy</button>';
|
||||
var expand = '<button class="expand">Expand</button>';
|
||||
var copy = '<button class="bd-copy">Copy</button>';
|
||||
var expand = '<button class="bd-expand">Expand</button>';
|
||||
$el.append(copy);
|
||||
|
||||
if ($el.find('pre code').innerHeight() > 600) {
|
||||
@@ -44,7 +44,7 @@ jQuery(document).ready(function ($) {
|
||||
}
|
||||
});
|
||||
|
||||
var $highlightButtons = $('.highlight .copy, .highlight .expand');
|
||||
var $highlightButtons = $('.highlight .bd-copy, .highlight .bd-expand');
|
||||
|
||||
$highlightButtons.hover(function() {
|
||||
$(this).parent().css('box-shadow', '0 0 0 1px #ed6c63');
|
||||
@@ -52,11 +52,11 @@ jQuery(document).ready(function ($) {
|
||||
$(this).parent().css('box-shadow', 'none');
|
||||
});
|
||||
|
||||
$('.highlight .expand').click(function() {
|
||||
$('.highlight .bd-expand').click(function() {
|
||||
$(this).parent().children('pre').css('max-height', 'none');
|
||||
});
|
||||
|
||||
new Clipboard('.copy', {
|
||||
new Clipboard('.bd-copy', {
|
||||
target: function(trigger) {
|
||||
return trigger.previousSibling;
|
||||
}
|
||||
|
||||
@@ -103,8 +103,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
if ($highlights.length > 0) {
|
||||
$highlights.forEach($el => {
|
||||
const copy = '<button class="copy">Copy</button>';
|
||||
const expand = '<button class="expand">Expand</button>';
|
||||
const copy = '<button class="bd-copy">Copy</button>';
|
||||
const expand = '<button class="bd-expand">Expand</button>';
|
||||
$el.insertAdjacentHTML('beforeend', copy);
|
||||
|
||||
if ($el.firstElementChild.scrollHeight > 480 && $el.firstElementChild.clientHeight <= 480) {
|
||||
@@ -119,7 +119,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
|
||||
function addHighlightControls() {
|
||||
const $highlightButtons = getAll('.highlight .copy, .highlight .expand');
|
||||
const $highlightButtons = getAll('.highlight .bd-copy, .highlight .bd-expand');
|
||||
|
||||
$highlightButtons.forEach($el => {
|
||||
$el.addEventListener('mouseenter', () => {
|
||||
@@ -131,7 +131,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
});
|
||||
});
|
||||
|
||||
const $highlightExpands = getAll('.highlight .expand');
|
||||
const $highlightExpands = getAll('.highlight .bd-expand');
|
||||
|
||||
$highlightExpands.forEach($el => {
|
||||
$el.addEventListener('click', () => {
|
||||
@@ -140,7 +140,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
});
|
||||
}
|
||||
|
||||
new Clipboard('.copy', {
|
||||
new Clipboard('.bd-copy', {
|
||||
target: function(trigger) {
|
||||
return trigger.previousSibling;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user