fix(est): guard cross-table row paste
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
const EstActions = (() => {
|
||||
let pending = null,
|
||||
clipboard = [],
|
||||
clipboardTable = "",
|
||||
restoring = false;
|
||||
const uid = () => globalThis.crypto.randomUUID();
|
||||
function form(title, fields, callback) {
|
||||
@@ -158,9 +159,12 @@ const EstActions = (() => {
|
||||
for (let i = group.start; i < group.start + group.rows.length; i++) indices.add(i);
|
||||
clipboard = [...indices].sort((a, b) => a - b).map((i) => structuredClone(rows[i]));
|
||||
if (!clipboard.length) throw Error("복사할 행을 선택하세요.");
|
||||
clipboardTable = state.view;
|
||||
if (name === "cut-row") deleteRows();
|
||||
} else if (name === "paste-row") {
|
||||
if (!clipboard.length) throw Error("복사한 행이 없습니다.");
|
||||
if (clipboardTable !== state.view)
|
||||
throw Error("복사한 행과 같은 종류의 자료에 붙여넣으세요.");
|
||||
const rows = activeRows();
|
||||
EstApp.change(() => {
|
||||
let at = (selected().at(-1) ?? rows.length - 1) + 1;
|
||||
|
||||
Reference in New Issue
Block a user