1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-12 09:34:10 +02:00

Don't edit for Ctrl+click on link

This commit is contained in:
Jakub Vrana
2012-11-01 13:38:03 -07:00
parent cb1d7d459b
commit 697034f329
2 changed files with 8 additions and 3 deletions

View File

@@ -403,7 +403,7 @@ if (!$columns) {
$text = ereg('text|lob', $field["type"]);
echo (($_GET["modify"] && $editable) || $value !== null
? "<td>" . ($text ? "<textarea name='$id' cols='30' rows='" . (substr_count($row[$key], "\n") + 1) . "'>$h_value</textarea>" : "<input name='$id' value='$h_value' size='$lengths[$key]'>")
: "<td id='$id' onclick=\"" . ($editable ? "selectClick(this, event" . ($long ? ", 2" : ($text ? ", 1" : "")) . ")" : "if (event.ctrlKey) alert('" . h(lang('Use edit link to modify this value.')) . "')") . ";\">" . $adminer->selectVal($val, $link, $field)
: "<td id='$id' onclick=\"selectClick(this, event, " . ($long ? 2 : ($text ? 1 : 0)) . ($editable ? "" : ", '" . h(lang('Use edit link to modify this value.')) . "'") . ");\">" . $adminer->selectVal($val, $link, $field)
);
}
}

View File

@@ -412,11 +412,16 @@ function ajaxSetHtml(url) {
* @param HTMLElement
* @param MouseEvent
* @param number display textarea instead of input, 2 - load long text
* @param string warning to display
*/
function selectClick(td, event, text) {
if (!event.ctrlKey || /input|textarea/i.test(td.firstChild.tagName)) {
function selectClick(td, event, text, warning) {
var target = event.target || event.srcElement;
if (!event.ctrlKey || /input|textarea/i.test(td.firstChild.tagName) || /^a$/i.test(target.tagName)) {
return;
}
if (warning) {
return alert(warning);
}
var original = td.innerHTML;
text = text || /\n/.test(original);
var input = document.createElement(text ? 'textarea' : 'input');