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.
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
Javascript API for toc #1237
Javascript API for toc #1237
Changes from all commits
a3eb4a5
af6b245
08a3080
66591ac
361823d
20c5472
eda3f1a
ad802b8
f5e8d99
b99de3e
40c434e
1c94d3b
c7c6068
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bakshiutkarsha Looking at the Babel usage guide, I think the issue with missing polyfills might be because you haven't specified any browsers in this setup file. E.g. the setup has these entries (NB don't use these, they need to be modified for our needs):
As a minimum we need to support:
I'm not sure what we support for Chrome (e.g. minimum Android version) and Safari for iOS app), but with IE11, most other things are probably covered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Jaifroid I have done that in
package.json
hereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. So any thoughts on why it's not working?
Two random guesses:
package.json
only affects the environment in which mwoffliner runs, i.e.node.js
(I assume)? Whereas we need a config that will load corejs polyfills according to the environment in which-/_api/toc.js
is running, i.e. the detection logic needs to run inside toc.js. That may be completely wrong...babel-preset-env
. I wonder if the breaking change mentioned in Update tocore-js@3
babel/babel#7646 affects this setup:A not great alternative would be to provide our own closest function if
Element.closest
is undefined:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bakshiutkarsha Can you help here or have you left this PR to someone else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I can close this. Will implement the changes suggested by @Jaifroid .
Large diffs are not rendered by default.
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bakshiutkarsha I think this line has to be changed to:
The reason is that often
h3
headings are open in MediaWiki ZIMS, while the parenth2
is closed, so we have to search for the nearest ancestor that is closed and open that one.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bakshiutkarsha This can be changed to:
sectionIdElem.scrollIntoView();