Skip to content

Add native editor embed blocks#19

Merged
Chefski merged 6 commits into
devfrom
codex/native-editor-embed-blocks
Jul 8, 2026
Merged

Add native editor embed blocks#19
Chefski merged 6 commits into
devfrom
codex/native-editor-embed-blocks

Conversation

@Chefski

@Chefski Chefski commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds native editor embed block presentation and surfaces.
  • Wires embed parsing, rendering, slash-command, and page-reader entry points.
  • Includes CRDT runtime/test updates and the rebuilt bundled runtime.

Validation

  • git diff --cached --check
  • secret-pattern scan over staged files
  • npm test --prefix Tools/CRDTRuntime
  • swiftlint lint --strict --quiet --cache-path /private/tmp/docmostly-swiftlint-cache

Not run: Xcode builds/tests or simulator verification, per repo instruction.

@Chefski Chefski marked this pull request as ready for review July 7, 2026 20:41
@greptile-apps

greptile-apps Bot commented Jul 7, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds native editor embed blocks and related navigation updates. The main changes are:

  • Native rendering for YouTube, Spotify, diagram, and rich editor block previews.
  • URL policy helpers for web links, iframe navigation, and same-origin document resources.
  • Space Settings presentation routed through a fresh spaces load.
  • CRDT runtime updates and tests for empty initial native state.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
docmostly/Features/Editor/NativeEditorWebURLPolicy.swift Adds shared URL checks for generic web links, same-origin document resources, and WebKit navigation.
docmostly/Features/Editor/NativeEditorEmbedBlockView.swift Adds native embed rendering for YouTube, Spotify, and generic embed previews.
docmostly/Features/Editor/NativeEditorBlockSurfaces.swift Adds rich block surfaces, including same-origin diagram image rendering.
docmostly/App/AppState.swift Changes spaces loading to report whether the latest load came from the server.
docmostly/Features/Spaces/MainShellView.swift Uses the fresh spaces-load result before presenting Space Settings.

Reviews (6): Last reviewed commit: "fix: require fresh spaces for settings" | Re-trigger Greptile

Comment thread docmostly/Features/Editor/NativeEditorBlockSurfaces.swift Outdated
Comment thread docmostly/Features/Editor/NativeEditorEmbedBlockView.swift
Comment thread docmostly/Features/Spaces/MainShellView.swift

@cubic-dev-ai cubic-dev-ai 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.

3 issues found across 25 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread docmostly.xcodeproj/project.pbxproj
Comment thread docmostly/Features/Editor/NativeEditorBlockSurfaces.swift Outdated
Comment thread docmostly/Features/Editor/NativeEditorEmbedBlockView.swift

@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: 597eb28320

ℹ️ 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 on lines 106 to 107
#if os(iOS)
.safeAreaInset(edge: .bottom) {

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 Restore the native editor toolbar on macOS

With this #if os(iOS) wrapping the inset, macOS builds of PageReaderView (used by MacMainShellDetailView and MacPageWindowView) never render NativeEditorToolbar; the only other production toolbar call is this block, so focusing an editable block on Mac loses the bold/italic/link/attachment/inline-comment controls and the Done/autosave action. Please keep a macOS toolbar/menu replacement before excluding this view.

Useful? React with 👍 / 👎.


init(source: String) {
self.source = source
self._player = State(initialValue: YouTubePlayer(urlString: source))

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 Reload YouTube player when the embed URL changes

When an existing YouTube embed is edited through the block editor, SwiftUI preserves this child view's identity, so this @State initializer runs only once; because body never uses source to update player, changing the URL leaves YouTubePlayerView attached to the old video until the row is recreated. Recreate the view with .id(source) or update the player when source changes.

Useful? React with 👍 / 👎.

Comment on lines +27 to +29
static func youtubeWatchSource(from source: String?) -> String? {
guard let videoID = youtubeVideoID(from: source) else { return nil }
return "https://www.youtube.com/watch?v=\(videoID)"

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 Preserve YouTube start parameters in player URLs

For user-provided YouTube links such as ...?v=abc&start=90 or &t=90, this rebuilds the player URL from only the video ID, so the native embed silently starts at 0 instead of the timestamp the page author saved. Carry supported time query items through when canonicalizing the player source.

Useful? React with 👍 / 👎.

isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
3FEC0B2EC8EF1D5311589C30 /* YouTubePlayerKit in Frameworks */,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add YouTubePlayerKit to the iOS target dependencies

This links YouTubePlayerKit into the docmostly app's Frameworks phase, but the docmostly target's packageProductDependencies block is still empty while the same product ref is only listed for DocmostlyMacTests. Since NativeEditorEmbedBlockView.swift imports this module from the shared app sources, the iOS app target needs the package product dependency too; otherwise the package product is not made available consistently when building the iOS target.

Useful? React with 👍 / 👎.

}

private func loadSpacesIfNeeded() async {
guard appState.spaces.isEmpty else { return }

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 Retry space loads even when cached spaces exist

When an authenticated session has cached spaces because AppState.loadSpaces() fell back after a transient spaces request failure, this guard prevents later MainShellView appearances from retrying the network load at all. That leaves isOffline, memberships, and the space list stuck on cache until some other explicit refresh happens; keep the duplicate-load avoidance tied to an in-flight task rather than treating any non-empty cache as fresh.

Useful? React with 👍 / 👎.


private var sourceURL: URL? {
guard let source = embed.source else { return nil }
return URL(string: source)

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 Restrict generic embed links to web URLs

For generic embeds imported from page content or typed into the Source field, URL(string:) accepts non-web schemes such as file: or custom app URLs, and the view then exposes them as tappable Links. Since these are web embed sources, guard for http/https and render other values as plain text to avoid dispatching arbitrary document-controlled URLs through the system opener.

Useful? React with 👍 / 👎.

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 8 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread docmostly/Features/Editor/NativeEditorWebURLPolicy.swift Outdated
Consolidates page navigation patterns by introducing PageOpenTarget, a unified type for page navigation across the app. Removes redundant destination views (NotificationDestinationView, PageBrowserDestinationView, SearchResultDestinationView) and replaces NavigationLink usage with PageOpenLink for consistent platform-specific behavior.

Refactors SpaceSettingsDetailFormView to use a tab-based UI with Settings, Members, and Security tabs, and introduces SpaceSettingsDialog for macOS modal presentation. Updates MacDesktopCommandController and command handlers to request space settings presentation instead of direct sidebar selection.

Includes tests for PageOpenTarget initialization and navigation behavior with space switching.
Comment thread docmostly/Features/Spaces/MainShellView.swift

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 28 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread docmostly/Features/Spaces/MainShellView.swift Outdated
Comment thread docmostly/Features/Spaces/MainShellView.swift Outdated
Comment thread docmostly/Features/Spaces/MainShellView.swift Outdated
@Chefski Chefski merged commit 582acab into dev Jul 8, 2026
8 checks passed
@Chefski Chefski deleted the codex/native-editor-embed-blocks branch July 8, 2026 01:34
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