/* ArozOS Office - cross-app clipboard bridge (OfficeClipboard) ============================================================= Each Office app keeps its own high-fidelity clipboard format in text/plain (Slides object JSON, Sheets TSV / chart JSON). This helper adds a SHARED text/html representation on copy and parses it on paste, so content moves between apps (and to external editors): Docs picture -> Slides / Sheets(*) as Sheets chart -> Slides / Docs as (SVG snapshot) Sheets cells -> Slides / Docs as Slides image/text/ -> Docs / Sheets as /
/ table/shape
/ (*) Sheets has no floating-image model, so an image pasted into a cell is declined with a hint rather than mangled. On paste an app first honours its OWN text/plain marker (same-app, full fidelity); only when that is absent does it fall back to the shared text/html here. isMarker() lets an app avoid dumping another app's raw JSON marker into itself as plain text. */ var OfficeClipboard = (function () { function escAttr(s) { return String(s == null ? "" : s) .replace(/&/g, "&").replace(/"/g, """) .replace(//g, ">"); } /* ---------- builders (copy side) ---------- */ function imageHtml(src, w, h) { var dim = ""; if (w) dim += ' width="' + Math.round(w) + '"'; if (h) dim += ' height="' + Math.round(h) + '"'; return '"; } // rows: array of rows; each cell is an HTML string (caller pre-sanitizes) function tableHtml(rows, opts) { opts = opts || {}; var out = '
'; rows.forEach(function (row, ri) { out += ""; row.forEach(function (cell) { var tag = (opts.headerRow && ri === 0) ? "th" : "td"; out += "<" + tag + ' style="border:1px solid #b0b4bb;padding:3px 7px;">' + (cell == null || cell === "" ? "
" : cell) + ""; }); out += ""; }); return out + "
"; } // rasterizable SVG -> an -ready data URL function svgImageSrc(svg) { // guarantee the namespace so the data URL renders as an image if (svg.indexOf("xmlns") < 0) { svg = svg.replace("