Skip to content

Enable editing original copyright & license (BL-16859) - #8346

Draft
hatton wants to merge 5 commits into
masterfrom
BL-16859-original-credits
Draft

hatton wants to merge 5 commits into
masterfrom
BL-16859-original-credits

Conversation

@hatton

@hatton hatton commented Sep 10, 2026

Copy link
Copy Markdown
Member

Problem

When a book is a derivative, Bloom generates a sentence on the credits page about the original book's copyright and license, and the user cannot change it. Some publishers need different wording, and until now there was no way to get it.

Fix

A padlock now sits at the top right of that sentence's hint bubble, titled "Unlock to edit". Clicking it turns the sentence into an ordinary editable field, with the caret at the start of it, holding the wording Bloom had generated. From then on Bloom shows what the user typed instead of generating the sentence.

  • The unlock is spent on one rendering. The editable shape exists only in the throwaway copy of the page built for the editor, never in the book. Refreshing, leaving the page, and clicking the open padlock therefore all arrive back at the read-only state by the same route, keeping the user's words. Three call sites enforce it: the page saved back into the book, the page sent to the editor, and the whole-book update.
  • The book stays a derivative. originalCopyright, originalLicenseUrl and originalLicenseNotes are untouched, so the License tab, publishing and upload behave exactly as before.
  • Storage. The user's wording lives in the data div under originalCopyrightAndLicense, and a new meta.json flag, user-edits-original-copyright-notice, says Bloom is no longer generating the sentence. Seeding replaces the <cite data-book="originalTitle"> around the original title with an <em>, so no data-book field ends up nested inside another.
  • Hint bubbles gain a general affordance. data-link-icon puts an icon in a bubble's top right corner, data-link-target says what clicking it does, and data-link-icon-tooltip gives it a title. A bubble containing a link now stays open long enough for the pointer to reach it.
  • Publishing. The two epub selectors that identify the sentence accept either shape, since a book can be saved in either.

Ref: https://issues.bloomlibrary.org/youtrack/issue/BL-16859

Devin review


This change is Reviewable

hatton and others added 3 commits September 10, 2026 17:29
In a derivative book, Bloom generates a sentence on the credits page about
the original book's copyright and license, and the user cannot change it.
Some publishers need different wording.

A padlock in that sentence's hint bubble now hands it over. Clicking it
turns the sentence into an ordinary editable field with the caret in it,
holding the wording Bloom had generated; from then on Bloom shows what the
user typed instead of generating the sentence.

The unlock is spent on one rendering. The editable shape exists only in the
throwaway page DOM built for the editor, so refreshing, leaving the page,
and clicking the open padlock all arrive back at the locked state by the
same route, keeping the user's words. Their wording lives in the data div
under originalCopyrightAndLicense, and a new meta.json flag,
user-edits-original-copyright-notice, says Bloom is no longer generating
the sentence.

The book remains a derivative in every other way: originalCopyright,
originalLicenseUrl and originalLicenseNotes are untouched, so the License
tab, publishing and upload behave as before.

Hint bubbles gain a general affordance for this: data-link-icon puts an
icon in the bubble's top right corner, data-link-target says what clicking
it does, and data-link-icon-tooltip gives it a title.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The editing code takes the attribute off as soon as it has placed the
cursor, but a page shown with focus suppressed still carries it at save
time, and attributes on a bloom-editable are harvested into the data div
along with its text.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…pyright

A book set to use the original copyright as its own already prints that
copyright, so a sentence about the original book prints it twice. Bloom's
generated sentence has been suppressed in that case since BL-7381; the
user's own wording now is too, and waits in the data div in case they turn
the option off again.

Found by Devin on #8346

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Comment thread src/BloomExe/Book/BookCopyrightAndLicense.cs
spot.SetAttribute("lang", "*");
}
SetOriginalCopyrightNoticeHint(spot, !string.IsNullOrEmpty(notice));
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Devin] Bug: Empty notice cannot be edited again

If the user unlocks the sentence, deletes all of it, and leaves the page, the line is gone — and so is the padlock, because the bubble only appears where there is a sentence. Bloom no longer generates the sentence for this book, so there is nothing left to click and no way back to it from the credits page.

Deleting the text is a plausible way to say "I don't want this line", so the disappearance may be exactly right. What is missing is a way to change one's mind.

Left open for a decision: keep it as it is (deleting is final for that book), or keep the padlock on the empty spot so an empty notice can be reopened — which needs the bubble to be reachable on a div with no text in it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@hatton

hatton commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

[Claude Opus 5 from Hatton's machine during preflight] Consulted Devin on 2026-09-10, most recently at c17af2339f3d6db8cd78642c68edf82614ab42aa.

Two bugs across the branch, both non-severe, and no informational flags:

Two later re-reviews, the most recent at the current head, raised nothing new. CI (pr-automation) passes on this commit.

The sentence about the original book is built by pasting in the original
title and copyright holder exactly as the publisher typed them, so a
perfectly ordinary "SIL & LASI" makes it not valid XML. Seeding the data
div with it went straight to InnerXml and threw the moment the user
clicked the padlock.

Put it through HtmlDom.SetElementFromUserStringSafely first, which is the
same filter the locked sentence already goes through: everything is
escaped and only <br> and <cite> stand.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant