Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions lib/css/chat-layout-pc.css
Original file line number Diff line number Diff line change
Expand Up @@ -936,12 +936,23 @@ body {
left: 5em;
right: auto;
bottom: 8em;
max-height: 40vh;
min-height: 12rem;
min-width: 42vw;

> .comm-area {
height: calc(100% - (0.5rem * 2) - (3rem + ((2rem * 2) + 0.1rem)));
margin-top: 0.5rem;
margin-bottom: 0.5rem;

textarea {
height: 100%;
overflow-y: auto;
}
}
}
#rewrite-form textarea {
width: 40vw;
max-width: 90vw;
max-height: 80vh;
margin-top: .1rem;
margin: 0;
}
#rewrite-name-form {
top: auto;
Expand Down
2 changes: 1 addition & 1 deletion lib/html/room.html
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ <h2>発言名変更</h2>
<div class="float-box" id="rewrite-form">
<h2>発言編集</h2>
<div class="comm-area">
<textarea class="autosize" id="rewrite-comm" data-comm-pre=""></textarea>
<textarea id="rewrite-comm" data-comm-pre=""></textarea>
<button onclick="formSubmit('rewrite-comm');boxClose('rewrite-form');">送信</button>
</div>

Expand Down
27 changes: 26 additions & 1 deletion lib/js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,33 @@ function rewriteOpen(num){
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>')
obj.value = setValue;
autosizeUpdate(obj);
obj.focus();

{
const sourceMessageNode = document.getElementById(`line-${num}-comm`);

if (sourceMessageNode != null) {
const rewriteForm = document.getElementById('rewrite-form');
const tabGroupNode = sourceMessageNode.closest('.tab-group');
const isMain = tabGroupNode.classList.contains('main');

const rect = sourceMessageNode.getBoundingClientRect();

const x = isMain ? rect.left : rect.right - rewriteForm.getBoundingClientRect().width;
const y = Math.min(rect.bottom + 15, tabGroupNode.getBoundingClientRect().bottom);

const m = rewriteForm.style.inset.match(/^[\d.]+px\s+(\S+)\s+(\S+)\s+[\d.]+px$/);

if (m != null) {
rewriteForm.style.inset = `${y}px ${m[1]} ${m[2]} ${x}px`;
} else {
rewriteForm.style.left = `${x}px`;
rewriteForm.style.right = 'auto';
rewriteForm.style.top = `${y}px`;
rewriteForm.style.bottom = 'auto';
}
}
}
}
function rewriteNameOpen(num,name){
boxOpen('rewrite-name-form');
Expand Down