From 51df7a286b1d77fb9f34b8fbf15be7e207418a25 Mon Sep 17 00:00:00 2001 From: bidi Date: Fri, 31 Jul 2026 17:35:11 +0300 Subject: [PATCH 1/3] updated js, css for markdown controls Signed-off-by: bidi --- css/docs.css | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++ js/docs.js | 58 ++++++++++++++++++++++++++++++++++ 2 files changed, 146 insertions(+) diff --git a/css/docs.css b/css/docs.css index b4b39b8..ec86547 100644 --- a/css/docs.css +++ b/css/docs.css @@ -651,6 +651,94 @@ i.bi.bi-copy.copy_btn { color: #1361DF; } +.md-actions-bar { + display: flex; + justify-content: flex-end; + margin-bottom: .75rem; +} +.md-actions { + position: relative; +} +.md-actions-toggle, +.md-actions-item { + font: inherit; + font-size: 13px; + color: #3c4257; + background: #ffffff; + cursor: pointer; +} +.md-actions-toggle { + display: inline-flex; + align-items: center; + gap: .5rem; + padding: .35rem .5rem .35rem .65rem; + border: 1px solid #d8dbe3; + border-radius: 6px; +} +.md-actions-toggle:hover, +.md-actions-toggle[aria-expanded="true"] { + border-color: rgba(75, 103, 249, 1); + color: rgba(75, 103, 249, 1); +} +.md-actions-toggle-label { + display: inline-flex; + align-items: center; + gap: .4rem; +} +.md-actions-toggle-chev { + display: inline-flex; + padding-left: .4rem; + border-left: 1px solid #e3e5ec; +} +.md-actions .chev { + transition: transform .15s ease-in-out; +} +.md-actions-toggle[aria-expanded="true"] .chev { + transform: rotate(180deg); +} +.md-actions-menu { + position: absolute; + top: calc(100% + 4px); + right: 0; + z-index: 1020; + display: none; + min-width: 235px; + padding: .25rem; + background: #ffffff; + border: 1px solid #e3e5ec; + border-radius: 8px; + box-shadow: 0 8px 24px rgba(16, 24, 40, .12); +} +.md-actions-menu.show { + display: block; +} +.md-actions-item { + display: flex; + align-items: center; + gap: .5rem; + width: 100%; + padding: .45rem .55rem; + border: 0; + border-radius: 6px; + background: transparent; + text-align: left; + text-decoration: none; + white-space: nowrap; +} +.md-actions-item:hover { + color: rgba(75, 103, 249, 1); + background: #f2f4fb; + text-decoration: none; +} +.md-actions-toggle svg, +.md-actions-item svg { + flex: none; + width: 16px; + height: 16px; + stroke-linecap: round; + stroke-linejoin: round; +} + /*RESPONSIVE*/ @media (max-width: 767.98px) { diff --git a/js/docs.js b/js/docs.js index 7ab474c..fad6757 100644 --- a/js/docs.js +++ b/js/docs.js @@ -25,3 +25,61 @@ document.addEventListener("DOMContentLoaded", function () { document.getElementById("current-year").textContent = new Date().getFullYear().toString(); }); + +function closeMdActionsMenus(except) { + document.querySelectorAll('.md-actions-toggle[aria-expanded="true"]').forEach(function (toggle) { + if (toggle === except) { + return; + } + toggle.setAttribute('aria-expanded', 'false'); + toggle.parentNode.querySelector('.md-actions-menu').classList.remove('show'); + }); +} + +function toggleMdActionsMenu(toggle) { + var expanded = toggle.getAttribute('aria-expanded') === 'true'; + closeMdActionsMenus(toggle); + toggle.setAttribute('aria-expanded', expanded ? 'false' : 'true'); + toggle.parentNode.querySelector('.md-actions-menu').classList.toggle('show', ! expanded); +} + +function copyMarkdownPage(button) { + var label = button.querySelector('.label'); + var original = label.textContent; + + var restore = function (message) { + label.textContent = message; + window.setTimeout(function () { + label.textContent = original; + }, 2000); + }; + + fetch(button.dataset.copyUrl, {headers: {'Accept': 'text/markdown, text/plain'}}) + .then(function (response) { + if (! response.ok) { + throw new Error('HTTP ' + response.status); + } + return response.text(); + }) + .then(function (markdown) { + return navigator.clipboard.writeText(markdown); + }) + .then(function () { + restore('Copied!'); + }) + .catch(function () { + restore('Copy failed'); + }); +} + +document.addEventListener('click', function (event) { + if (! event.target.closest('.md-actions')) { + closeMdActionsMenus(); + } +}); + +document.addEventListener('keydown', function (event) { + if (event.key === 'Escape') { + closeMdActionsMenus(); + } +}); \ No newline at end of file From 31ca13f871d3787292b450b21e82f03311082816 Mon Sep 17 00:00:00 2001 From: bidi Date: Fri, 31 Jul 2026 17:36:11 +0300 Subject: [PATCH 2/3] linting fix Signed-off-by: bidi --- js/docs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/docs.js b/js/docs.js index fad6757..994312c 100644 --- a/js/docs.js +++ b/js/docs.js @@ -82,4 +82,4 @@ document.addEventListener('keydown', function (event) { if (event.key === 'Escape') { closeMdActionsMenus(); } -}); \ No newline at end of file +}); From 7f8d23dcf70508eb43e8375bf6974c73eb616a27 Mon Sep 17 00:00:00 2001 From: bidi Date: Mon, 3 Aug 2026 16:24:59 +0300 Subject: [PATCH 3/3] updated copy md Signed-off-by: bidi --- js/docs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/docs.js b/js/docs.js index 994312c..5c7a44e 100644 --- a/js/docs.js +++ b/js/docs.js @@ -61,8 +61,8 @@ function copyMarkdownPage(button) { } return response.text(); }) - .then(function (markdown) { - return navigator.clipboard.writeText(markdown); + .then(async function (markdown) { + return await navigator.clipboard.writeText(markdown); }) .then(function () { restore('Copied!');