Closed arthurevans closed 8 years ago
Also pinging @ebidel @robdodson for good luck...
OK, refactored this:
iron-component-page
is in charge of specifying the fragment prefix for the active component (which is opaque to iron-doc-viewer
). iron-doc-viewer
provides a scrollToAnchor
method that uses this.$$
rather than querySelector with /deep/
. This avoids the warning about /deep/ being deprecated. iron-component-page
is responsible for calling this method on pageload and hash change.iron-doc-property
has an anchor-id
attribute (used by scrollToAnchor
. The anchor tag in its local DOM also retains its id
property, so apps like the catalog that use querySelector with deep can find the right element to scroll to.My idea here, in case it's unclear, is that when running as a standalone page, iron-component-page
should be solely responsible for routing. But iron-doc-viewer
has direct access to the iron-doc-property
elements, so it's responsible for figuring out which element the current hash represents and scrolling it into view.
In my testing, it works correctly in the catalog and in the doc site (for example, a deep link like .../1.0/api/#Polymer.Base:method-importHref should work on the doc site with this change).
Looking over the code, everything looks OK to me. :+1:
This is looking sweet. Thanks!
Awesome! Thanks, @blasten! (Now go on vacation already :smile_cat:)
@arthurevans should we tag a release, so we have this feature?
That would be great—if you can tag iron-doc-viewer and iron-component-page, I can update the doc site with the latest goodies.
sweet. will do :)
Fixes #28.
This may not be ready for prime time, but I'm going to leave it here as a proof-of-concept if nothing else.
Requires coordinating changes in
iron-doc-viewer
PR#73.Supports linking to various bits of the docs using the following URL hash formats:
For example:
#dom-repeat:method.render
@frankiefu @blasten PTAL