Replace cell contents with textarea on double click
This commit is contained in:
parent
642ab6465d
commit
c2c8b3d073
@ -325,6 +325,10 @@
|
|||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#results td textarea {
|
||||||
|
color: #000 !important;
|
||||||
|
}
|
||||||
|
|
||||||
#results th:first-child,
|
#results th:first-child,
|
||||||
#results td:first-child {
|
#results td:first-child {
|
||||||
padding-left: 15px;
|
padding-left: 15px;
|
||||||
@ -339,7 +343,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#connection_window {
|
#connection_window {
|
||||||
z-index: 2;
|
z-index: 3;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
background: #ebeef0;
|
background: #ebeef0;
|
||||||
top: 0px;
|
top: 0px;
|
||||||
|
@ -47,6 +47,12 @@ function escapeHtml(str) {
|
|||||||
return "<span class='null'>null</span>";
|
return "<span class='null'>null</span>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function unescapeHtml(str){
|
||||||
|
var e = document.createElement("div");
|
||||||
|
e.innerHTML = str;
|
||||||
|
return e.childNodes.length === 0 ? "" : e.childNodes[0].nodeValue;
|
||||||
|
}
|
||||||
|
|
||||||
function resetTable() {
|
function resetTable() {
|
||||||
$("#results").
|
$("#results").
|
||||||
attr("data-mode", "").
|
attr("data-mode", "").
|
||||||
@ -338,6 +344,26 @@ $(document).ready(function() {
|
|||||||
$(this).addClass("selected");
|
$(this).addClass("selected");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#results").on("dblclick", "td > div", function() {
|
||||||
|
if ($(this).has("textarea").length > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var value = unescapeHtml($(this).html());
|
||||||
|
|
||||||
|
if (!value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var textarea = $("<textarea />").text(value).css("width", $(this).css("width"));
|
||||||
|
|
||||||
|
if (value.split("\n").length >= 3) {
|
||||||
|
textarea.css("height", "200px");
|
||||||
|
}
|
||||||
|
|
||||||
|
$(this).html(textarea).css("max-height", "200px");
|
||||||
|
});
|
||||||
|
|
||||||
$("#tables").on("click", "li", function() {
|
$("#tables").on("click", "li", function() {
|
||||||
$("#tables li.selected").removeClass("selected");
|
$("#tables li.selected").removeClass("selected");
|
||||||
$(this).addClass("selected");
|
$(this).addClass("selected");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user