Skip to content

Improve presentation, citation, and embed editing - #251

Open
HamptonMakes wants to merge 3 commits into
mainfrom
hampton-content-block-editor
Open

HamptonMakes wants to merge 3 commits into
mainfrom
hampton-content-block-editor

Conversation

@HamptonMakes

Copy link
Copy Markdown
Collaborator

What changed and why

The inline editor treated presentation fences as separate Markdown blocks and hid citation definitions in a large source field. Nested tables could also turn a whole bullet list into a table editor.

Presentations now have one Markdown field, a slide icon, and a preview that uses the existing slideshow renderer. Citations open a centered dialog. Tables inside lists keep their own editing field. A new + menu inserts Presentation or Embed blocks.

Embedded pages use a self-closing Markdown block with URL, accessible title, width, and height. Administrators approve exact HTTPS domains. The sandbox supports external providers while blocking the app's own host, top navigation, and device permissions. Frame redirects remain constrained by the domain policy.

Expired sign-in keeps the draft and explains how to retry. An uncached editor snapshot refreshes the security token after signing in again.

This adds an engine migration and its host copy. Hosts must install and run the engine migrations. No iframe domains are approved by default.

Evidence

Content menu in dark mode

Content menu in light mode

Presentation preview

Citation editor

How to try it

Start bin/dev -p 3107 and edit a plan. Click + → Presentation, edit the slide Markdown, and switch to Preview. Click an inline citation to edit its definition. Click + → Embed to edit a URL and dimensions; unapproved hosts display an unavailable message. Approve the exact host in Administration → Iframe domains, then reload the document to update its frame policy.

The local tryout is http://localhost:3107/hampton/editor-tryout-presentation?edit=1. A second demo at http://localhost:3107/hampton/editor-tryout-embedded-page-and-nested-table shows a table nested in bullets and an OpenStreetMap embed.

Testing

  • Added JavaScript-enabled browser specs for presentation editing and preview, citation dialogs, nested tables, content insertion, undo, and session recovery.
  • Added model, service, helper, and request specs for embed validation, domain administration, authorization, and frame policy.
  • Ran targeted browser and request specs. The earlier full bundle exec rspec run had one macOS Ctrl+A assertion failure; that case passed on rerun. CI runs the full suite on MySQL and PostgreSQL.
  • Exercised the affected UI in the built-in browser in light and dark themes.
  • Attached screenshots of the changed editor.

Generated with Codex

@HamptonMakes
HamptonMakes marked this pull request as ready for review October 9, 2026 16:29
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T17:52:40.478528Z be235a0 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 91d93a6278

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread engine/app/javascript/controllers/coplan/editor_controller.js
Comment thread engine/app/views/coplan/plans/_citations.html.erb
@HamptonMakes

Copy link
Copy Markdown
Collaborator Author

🤖 @codex review

Both prior findings are fixed in be235a0, with passing regression coverage for new-plan sign-in recovery and live citation editing controls.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: be235a0efb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// content, so it must not turn its entire paragraph or list into a source card.
const tokenizer = defaultMarkdownParser.tokenizer
tokenizer.inline.ruler.before("link", "coplan_footnote", (state, silent) => {
const match = /^\[\^([^\]\s]+)\]/.exec(state.src.slice(state.pos))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Normalize footnote labels before matching citations

When existing Markdown uses a fold-equivalent label such as [^STRASSE] with [^straße]: ..., or a valid label containing collapsed whitespace, Commonmarker resolves the citation but this tokenizer either preserves the unmatched case or rejects the marker; citationDefinitions and openCitation then compare literal labels. The first case opens an empty dialog and saving appends a competing definition, while the whitespace case never gets citation controls. Normalize labels using the renderer's case-folding and whitespace rules while preserving the original source spelling.

Useful? React with 👍 / 👎.

Comment on lines +803 to +807
return { dom, update(next) {
if (next.type !== node.type || next.attrs.kind !== "presentation") return false
node = next
const content = presentationContent(node.attrs.source).content
if (input.value !== content) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Refresh an open presentation preview after source updates

When a presentation is showing Preview and its node changes through Undo/Redo or a live merged revision, this update path refreshes only the hidden textarea and neither invalidates nor regenerates the visible preview. An older in-flight preview request can consequently populate stale HTML after the source has changed, leaving the user looking at outdated slides until they toggle back and preview again; invalidate the request and rerender whenever the preview body is visible.

AGENTS.md reference: AGENTS.md:L76-L82

Useful? React with 👍 / 👎.

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