Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit button in docs broken after r96 #15136

Closed
moraxy opened this issue Oct 25, 2018 · 1 comment · Fixed by #15399
Closed

Edit button in docs broken after r96 #15136

moraxy opened this issue Oct 25, 2018 · 1 comment · Fixed by #15399

Comments

@moraxy
Copy link
Contributor

moraxy commented Oct 25, 2018

Description of the problem

#14846 stripped the localization from the [path] placeholder to get the links to the source files working again but the edit button in the top right needed that to point to the localized docs file.

three.js/docs/page.js

Lines 102 to 106 in 12450be

button.addEventListener( 'click', function ( event ) {
window.open( 'https://github.com/mrdoob/three.js/blob/dev/docs/' + section + '/' + path + '.html' );
}, false );

First noticed in #14750 (comment) as far as I can tell. A previous hotfix(hiding the button) was applied in 0c58464, but got removed with the release of r96.

@mrdoob mrdoob added this to the r98 milestone Oct 25, 2018
@Mugen87
Copy link
Collaborator

Mugen87 commented Oct 27, 2018

A simple fix is to add the following line in page.js right before window.open().

if ( section === 'api' ) path = /\/api\/[A-z0-9\/]+/.exec( pathname ).toString().substr( 5 );

window.open( 'https://github.com/mrdoob/three.js/blob/dev/docs/' + section + '/' + path + '.html' );

This should ensure that the path has the localized part which is necessary to build the correct URL.

Any better ideas? 😇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants