Skip to content

Commit

Permalink
Website: Fixed the Toolbar plusing's overflow issue (#1966)
Browse files Browse the repository at this point in the history
This fixes the overflow issue of all Toolbar related plugins where some button were hidden behind the theme selection.
  • Loading branch information
RunDevelopment committed Sep 3, 2019
1 parent 8403e45 commit 56a8711
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
23 changes: 23 additions & 0 deletions scripts/code.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,27 @@ function listPlugins(ul) {

$$('.plugin-list').forEach(listPlugins);

// small polyfill for Element#matches
if (!Element.prototype.matches) {
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
}

Prism && Prism.hooks.add('complete', function (env) {
var element = env.element;

requestAnimationFrame(function () {
if (!element.matches('div.code-toolbar > pre > code')) {
return;
}

var pre = element.parentElement;
var wrapper = pre.parentElement;

// transfer margin of pre to wrapper
wrapper.style.margin = window.getComputedStyle(pre).margin;
pre.style.margin = "0";

});
});

})();
9 changes: 9 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -414,3 +414,12 @@ label a.owner:not(:hover) {
margin-bottom: 1em;
margin-right: 1em;
}

/*
* Fix for Toolbar's overflow issue
*/

div.code-toolbar {
display: block;
overflow: auto;
}

0 comments on commit 56a8711

Please sign in to comment.