mirror of
https://github.com/vrana/adminer.git
synced 2026-01-11 01:53:00 +01:00
Executed SQL commands: Add button for copy to clipboard
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
- Display data length and index length for materialized views
|
||||
- Link routines from syntax highlighting
|
||||
- Autofocus added field in alter table
|
||||
- Executed SQL commands: Add button for copy to clipboard
|
||||
- MySQL 5.0-: Do not load partitioning info in alter table (bug #1099)
|
||||
- MariaDB: Parse COLLATE in routine definition (bug #1104)
|
||||
- PostgreSQL: Show structure of inherited tables
|
||||
|
||||
@@ -668,7 +668,7 @@ class Adminer {
|
||||
}
|
||||
$history[$_GET["db"]][] = array($query, time(), $time); // not DB - $_GET["db"] is changed in database.inc.php //! respect $_GET["ns"]
|
||||
$sql_id = "sql-" . count($history[$_GET["db"]]);
|
||||
$return = "<a href='#$sql_id' class='toggle'>" . lang('SQL command') . "</a>\n";
|
||||
$return = "<a href='#$sql_id' class='toggle'>" . lang('SQL command') . "</a> <a href='' class='jsonly copy'>🗐</a>\n";
|
||||
if (!$failed && ($warnings = driver()->warnings())) {
|
||||
$id = "warnings-" . count($history[$_GET["db"]]);
|
||||
$return = "<a href='#$id' class='toggle'>" . lang('Warnings') . "</a>, $return<div id='$id' class='hidden'>\n$warnings</div>\n";
|
||||
|
||||
@@ -93,6 +93,13 @@ function messagesPrint(parent) {
|
||||
for (const el of qsa('.toggle', parent)) {
|
||||
el.onclick = partial(toggle, el.getAttribute('href').substr(1));
|
||||
}
|
||||
for (const el of qsa('.copy', parent)) {
|
||||
el.onclick = () => {
|
||||
navigator.clipboard.writeText(qs('code', el.parentElement).innerText).then(el.textContent = '✓');
|
||||
setTimeout(() => el.textContent = '🗐', 1000);
|
||||
return false;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user