Sửa được text nằm trong Form XObject (file Canva/Illustrator) + CI chạy test
Build Windows portable / build (push) Canceled after 0s

File Canva gói toàn bộ nội dung trang vào 1 Form XObject nên chế độ sửa
không thấy gì để sửa. Engine giờ liệt kê PHẲNG đệ quy vào form
(FPDFFormObj_CountObjects/GetObject qua pdfium-render), mỗi mục có path
[i,j,...] + tích ma trận form để quy toạ độ/cỡ chữ về trang; index của
ObjectInfo/EditOp = vị trí trong danh sách phẳng (trang không form thì
trùng index trang — tương thích ngược, UI không đổi cách gửi op).

- SetText in-place/substitute + ReflowText + Delete hoạt động với run trong
  form; xoá trong form = set_text chuỗi rỗng (FPDFFormObj_RemoveObject chưa
  mở ở wrapper cho pdfium_7543), object mới vẽ ở cấp trang với matrix đã
  compose.
- Đã xác minh trước: PDFium regenerate stream form khi con bị sửa
  (ProcessForm / HasDirtyStreams) — canary test round-trip kèm theo.
- ObjectInfo thêm nested/expanded; UI bỏ khung form phủ trang + chặn kéo
  run trong form (Transform chưa hỗ trợ).
- 4 test integration mới với fixture Form XObject tự dựng bằng lopdf
  (dev-dependency mới); CI thêm bước cargo test -p ff-engine trước build
  (máy dev không có Rust — CI là nơi duy nhất chạy test), cache thêm target/.
Chi tiết: docs/12-phase4-summary.md (Iteration 4).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-08 01:41:21 +07:00
co-authored by Claude Fable 5
parent 68883b9e75
commit e66252681c
8 changed files with 523 additions and 62 deletions
+9 -1
View File
@@ -2226,6 +2226,10 @@ function buildEditOverlay() {
// Ảnh/form: khung theo từng object như cũ (có resize).
state.editObjects.forEach((o) => {
if (o.kind !== "image" && o.kind !== "form") return;
// Form đã liệt kê con riêng (file Canva gói cả trang vào form): khung của
// form phủ kín trang sẽ che hết con → bỏ. Ảnh/form TRONG form: chưa sửa
// được (di chuyển/thay cần địa chỉ lồng) → cũng bỏ khung.
if (o.expanded || o.nested) return;
const box = document.createElement("div");
box.className = "edit-box kind-" + o.kind;
box.dataset.index = String(o.index);
@@ -2979,8 +2983,12 @@ function promptAddText(pdfX, pdfY) {
function onEditBoxMouseDown(e, o, runs) {
if (state.editArm) return;
if (e.target.classList.contains("ed-handle")) return;
const runIndices = (runs && runs.length ? runs : [o]).map((r) => (typeof r === "number" ? r : r.index));
const runObjs = runs && runs.length ? runs : [o];
const runIndices = runObjs.map((r) => (typeof r === "number" ? r : r.index));
selectEditObject(o.index, runIndices);
// Run TRONG Form XObject (file Canva...): sửa text được nhưng chưa hỗ trợ
// kéo di chuyển/resize — chọn thôi, không bắt đầu drag.
if (runObjs.some((r) => r && typeof r === "object" && r.nested)) return;
const box = e.currentTarget;
const startX = e.clientX, startY = e.clientY;
const left0 = parseFloat(box.style.left), top0 = parseFloat(box.style.top);