Prevent all parameters overflow
This commit is contained in:
1 parent
3e455d6cbc
commit
11902fefd1
4 files changed
+58
-21
No files matched your search
@@ -3,6 +3,7 @@
|
|||||||
import m from "mithril";
|
import m from "mithril";
|
||||||
import * as components from "../components";
|
import * as components from "../components";
|
||||||
import * as taskQueue from "../task-queue";
|
import * as taskQueue from "../task-queue";
|
||||||
|
import longTextComponent from "../long-text-component";
|
||||||
|
|
||||||
function escapeRegExp(str) {
|
function escapeRegExp(str) {
|
||||||
return str.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
|
return str.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
|
||||||
@@ -101,7 +102,12 @@ const component = {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
return m("tr", attrs, m("td.left", k), m("td.right", val));
|
return m(
|
||||||
|
"tr",
|
||||||
|
attrs,
|
||||||
|
m("td.left", m(longTextComponent, { text: k })),
|
||||||
|
m("td.right", val)
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
return m(
|
return m(
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import * as store from "../store";
|
|||||||
import * as expression from "../../common/expression";
|
import * as expression from "../../common/expression";
|
||||||
import memoize from "../../common/memoize";
|
import memoize from "../../common/memoize";
|
||||||
import timeAgo from "../timeago";
|
import timeAgo from "../timeago";
|
||||||
|
import longTextComponent from "../long-text-component";
|
||||||
|
|
||||||
const memoizedParse = memoize(expression.parse);
|
const memoizedParse = memoize(expression.parse);
|
||||||
|
|
||||||
@@ -69,9 +70,12 @@ const component = {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const el = m(
|
const el = m(longTextComponent, { text: value });
|
||||||
"span.parameter-value",
|
|
||||||
|
return m(
|
||||||
|
"span",
|
||||||
{
|
{
|
||||||
|
class: "parameter-value",
|
||||||
onmouseover: e => {
|
onmouseover: e => {
|
||||||
e.redraw = false;
|
e.redraw = false;
|
||||||
// Don't update any child element
|
// Don't update any child element
|
||||||
@@ -82,11 +86,9 @@ const component = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
value,
|
el,
|
||||||
edit
|
edit
|
||||||
);
|
);
|
||||||
|
|
||||||
return el;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -538,10 +538,13 @@ span.na {
|
|||||||
|
|
||||||
& > table {
|
& > table {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
table-layout: fixed;
|
||||||
border-spacing: 0;
|
border-spacing: 0;
|
||||||
& > tbody {
|
& > tbody {
|
||||||
& > tr {
|
& > tr {
|
||||||
& > td {
|
& > td {
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
border-bottom: 1px dotted var(--color1);
|
border-bottom: 1px dotted var(--color1);
|
||||||
}
|
}
|
||||||
transition: background-color var(--fade);
|
transition: background-color var(--fade);
|
||||||
@@ -550,6 +553,9 @@ span.na {
|
|||||||
}
|
}
|
||||||
|
|
||||||
& > td.left {
|
& > td.left {
|
||||||
|
& > * {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
& > td.right {
|
& > td.right {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
@@ -644,6 +650,9 @@ span.long-text {
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
max-width: 400px;
|
max-width: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.long-text-overflowed {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
&:hover {
|
&:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
|
|||||||
@@ -8,25 +8,45 @@ const component = {
|
|||||||
const text = vnode.attrs.text;
|
const text = vnode.attrs.text;
|
||||||
const element = vnode.attrs.element || "span";
|
const element = vnode.attrs.element || "span";
|
||||||
|
|
||||||
|
function overflowed(_vnode) {
|
||||||
|
if (_vnode.dom.classList.contains("long-text-overflowed")) return;
|
||||||
|
_vnode.dom.classList.add("long-text-overflowed");
|
||||||
|
_vnode.dom.onclick = e => {
|
||||||
|
overlay.open(() => {
|
||||||
|
return m("textarea.long-text", {
|
||||||
|
value: text,
|
||||||
|
cols: 80,
|
||||||
|
rows: 24,
|
||||||
|
readonly: "",
|
||||||
|
oncreate: vnode2 => {
|
||||||
|
vnode2.dom.focus();
|
||||||
|
vnode2.dom.select();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
// prevent index page selection
|
||||||
|
e.stopPropagation();
|
||||||
|
m.redraw();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return m(
|
return m(
|
||||||
element,
|
element,
|
||||||
{
|
{
|
||||||
|
oncreate: vnode2 => {
|
||||||
|
if (vnode2.dom.clientWidth !== vnode2.dom.scrollWidth)
|
||||||
|
overflowed(vnode2);
|
||||||
|
},
|
||||||
|
onupdate: vnode2 => {
|
||||||
|
if (vnode2.dom.clientWidth === vnode2.dom.scrollWidth) {
|
||||||
|
vnode2.dom.classList.remove("long-text-overflowed");
|
||||||
|
vnode2.dom.onclick = null;
|
||||||
|
} else {
|
||||||
|
overflowed(vnode2);
|
||||||
|
}
|
||||||
|
},
|
||||||
class: "long-text",
|
class: "long-text",
|
||||||
title: text,
|
title: text
|
||||||
onclick: () => {
|
|
||||||
overlay.open(() => {
|
|
||||||
return m("textarea.long-text", {
|
|
||||||
value: text,
|
|
||||||
cols: 80,
|
|
||||||
rows: 24,
|
|
||||||
readonly: "",
|
|
||||||
oncreate: vnode2 => {
|
|
||||||
vnode2.dom.focus();
|
|
||||||
vnode2.dom.select();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
text
|
text
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in new issue
Block a user