Skip to content

feat(canvas): expose block/section/content jump to extensions - #1286

Open
mhaack wants to merge 3 commits into
mainfrom
selsec
Open

feat(canvas): expose block/section/content jump to extensions#1286
mhaack wants to merge 3 commits into
mainfrom
selsec

Conversation

@mhaack

@mhaack mhaack commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Extensions (BYO-plugin iframes) can now trigger the same "jump to a block/content item/section" behavior that clicking a row in the ew-page-outline panel already does.
  • Adds a scrollTo action to the existing extension MessageChannel protocol (blocks/canvas/ew-panel-extensions/iframe-protocol.js), relaying onto the existing canvasBus.editorSelectState/editorProseSelectState channels — no new event mechanism.
  • A section has no selectable identity of its own, so it resolves to its first block/content item via a new resolveSectionTarget helper in editor-utils.js.
  • Generalizes ew-editor-doc.js's WYSIWYG-sync broadcast from "outline-sourced only" to "any non-doc source", so extension-triggered jumps also sync the WYSIWYG overlay.
  • Pairs with feat(sdk): add actions.scrollTo(target) for extensions da-nx#700 (adds the actions.scrollTo(target) SDK entry point extensions call) — both sides are additive and inert alone; neither breaks anything shipped independently.

Test:

Test plan

  • Unit tests added for resolveSectionTarget (block target, content target, empty section, out-of-range, cache-clear)
  • Unit tests added for the scrollTo handler in iframe-protocol.js (block, content, section-resolved-to-block, out-of-range section, unrecognized type)
  • Unit tests added for ew-editor-doc.js's _onEditorSelectState (doc/outline/extension sources)
  • Full unit suite green: 2017 passed, 0 failed

🤖 Generated with Claude Code

mhaack and others added 3 commits August 31, 2026 17:04
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@aem-code-sync

aem-code-sync Bot commented Aug 31, 2026

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-sync branch
Commits

_onEditorSelectState({ blockIndex, source }) {
if (source === 'doc') return;
this._scrollDocToBlock(blockIndex);
this._broadcastSelectedNode(true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since this could be coming from an extension, maybe we could validate the blockindex prior to doing the broadcast?

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.

2 participants