Conversation
tommy230
force-pushed
the
fix/import-unsupported-anchor-target
branch
from
September 28, 2026 23:59
401016f to
a0771ba
Compare
The anchor import rules copied target="" (and _top or a named frame) straight into the node. None of those values is in AnchorTargetSchema, so the publisher's fallback replaced the whole link with module defaults and the page shipped "Click here" pointing at "#". The schema now lives in @core/htmlAttributes with a normalizeAnchorTarget() helper the importer uses for both anchor rules: empty and _top import as _self, a named target as _blank, keywords match case-insensitively, and href and text are kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tommy230
force-pushed
the
fix/import-unsupported-anchor-target
branch
from
September 29, 2026 04:45
a0771ba to
bbf731e
Compare
tommy230
marked this pull request as ready for review
September 29, 2026 04:47
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Importing HTML from a page builder can turn a working call-to-action into "Click here" pointing at
#. Some page builders emittarget=""on links whose target control was reset to default. The import copies that value straight into the node, and at publish time the link's schema rejects it. Because the props validator then falls back to the module defaults for the whole node, the published page loses the authoredhrefand text, with no warning or error.target="_top"and named frame targets have the same effect.The cause is
el.getAttribute('target') ?? '_self'insrc/core/htmlImport/rules.ts:??only replacesnull, so an empty string,_topor a named frame reaches the store as-is, and none of them is inAnchorTargetSchema(_self,_blank,_parent).The fix:
AnchorTargetSchemamoves fromsrc/modules/base/shared/anchorTarget.tsto@core/htmlAttributes(next toresolveHtmlTag, for the same reason: the importer insrc/core/may not importsrc/modules/), with a newnormalizeAnchorTarget()beside it that maps any value outside the schema onto the stored value that navigates the same way. Both anchor rules (aanda.btn) use it; the module-side file keeps the select options and thereldecision.target="", a baretargetand_topimport as_self: outside a frameset they open in the same tab.target="sidebar",_new) imports as_blank: with no frame of that name the browser opens a new tab._blankand_parentimport unchanged, matched case-insensitively as HTML does (_BLANKis_blank).hrefand text are always kept._topand named targets are mapped rather than added to the schema: the editor's target control does not offer them, and without frames they behave like_selfand_blank. A named target loses its tab reuse (a second click on the same name opens another tab instead of reusing the first).Existing nodes that already carry an unsupported
targetare not rewritten by this change; that is the publisher's fallback behaviour, addressed in #574. The AIsite_update_node_propstool can still write an unsupportedtargetdirectly; #574 keeps that from costing the rest of the node.Overlaps with #570 on
shared/anchorTarget.tsanddocs/features/modules.md, and with #571 ondocs/features/html-import.md; whichever lands second gets a small rebase.Verification
bun run buildbun run lintbun test: 7062 pass, 0 failNew tests in
src/__tests__/htmlImport/mapping.test.ts: 8 of 9 fail onmainand pass with this change.Checklist
docs/features/html-import.mdrule table and notes; the schema's new home indocs/features/modules.mdanddocs/reference/module-engine.md.)🤖 Generated with Claude Code