diff --git a/CHANGELOG.md b/CHANGELOG.md index 975b0a355..b0cb1144c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,12 @@ The release run heads these entries with the version and opens a fresh ## Unreleased +### Text documents and presentations + +- The browser text editor attaches to a page with an addressed paragraph and + no run, as a new odt or docx renders. Typing there went nowhere and said + nothing. + ## v7.5.1 - 2026-10-10 ### Spreadsheets diff --git a/src/odr/internal/html/frontend/document.js b/src/odr/internal/html/frontend/document.js index ca31d42a9..4c32623a0 100644 --- a/src/odr/internal/html/frontend/document.js +++ b/src/odr/internal/html/frontend/document.js @@ -6,9 +6,10 @@ var odr = (window.odr = window.odr || {}); - // A view whose runs carry no address is not this editor's: a sheet's editing - // is an overlay, and its cells state no id. - if (document.querySelector("x-s[data-odr-id]") === null) { + // A view with no addressed paragraph or run is not this editor's: a sheet's + // editing is an overlay, and its cells state no id. A new document has one + // empty paragraph and no run. + if (document.querySelector("x-p[data-odr-id], x-s[data-odr-id]") === null) { return; } diff --git a/test/browser/text/README.md b/test/browser/text/README.md index 573a893f8..696d8503e 100644 --- a/test/browser/text/README.md +++ b/test/browser/text/README.md @@ -6,6 +6,7 @@ so these checks run by hand and not in `odr_test`. ```bash test/browser/text/serve # serves on :8734 open http://localhost:8734/tests.html +open http://localhost:8734/empty.html ``` `serve` serves `document.css`, `editing.js`, `document.js` and `search.js` out @@ -14,6 +15,10 @@ so the checks run the file the library embeds. `editing.js` goes first, as the library writes it. `error-codes.js` is built from `src/odr/error_code.{hpp,cpp}` by `test/browser/serve.py`. +`empty.html` is a new document: one addressed paragraph and no run. The +editor decides on load whether a page is its own, so that shape needs a page +of its own. + `tests.html` holds the shapes the editor handles: two runs beside each other, a run under a link, a run under a style-only wrapper, a paragraph with a picture and no run, and the `` / `
` line box the renderer ends every diff --git a/test/browser/text/empty.html b/test/browser/text/empty.html new file mode 100644 index 000000000..5b73eaf9d --- /dev/null +++ b/test/browser/text/empty.html @@ -0,0 +1,83 @@ + + + + + text editing checks: an empty document + + + + +
+
+
+ +
+ + + + + + + diff --git a/test/browser/text/serve b/test/browser/text/serve index 642c8ffdc..d3e608076 100755 --- a/test/browser/text/serve +++ b/test/browser/text/serve @@ -9,4 +9,4 @@ sys.path.insert(0, str(HERE.parent)) from serve import serve # noqa: E402 -serve(8734, HERE, ("tests.html",)) +serve(8734, HERE, ("tests.html", "empty.html"))