-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Style of navbar fixed for wikitonary #1251
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1251 +/- ##
==========================================
- Coverage 68.80% 68.71% -0.10%
==========================================
Files 25 25
Lines 2199 2199
Branches 420 420
==========================================
- Hits 1513 1511 -2
- Misses 514 515 +1
- Partials 172 173 +1
Continue to review full report at Codecov.
|
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.
This need an in detail explanation why we need to insert custom CSS. Why the CSS of the online version is not sufficient?
As per the discussion on the issue thread and based on my investigation, it seems that either the event handler for toggling the visibility of the navframe is not getting attached or the custom CSS inserted by mwoffliner is causing problems with the visibility. To fix tthe issues, I tried both the approaches mentioned on the issue thread:
|
@bakshiutkarsha We should retrieve any css/js from the online version. If not we need to understand exactly why. This explanation is missing here... you fix a problem which is not even understodd priperly. This should be avoided. |
#1033 (comment) |
I'd be happy to test / troubleshoot the implementation here, but it may take a few days. |
670f538
to
ea41cce
Compare
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.
No, like I said many times, I don’t want dependence to the wiki content in mwoffliner code.
@@ -112,7 +112,7 @@ const renderMCSArticle = (json: any, dump: Dump, articleId: string, articleDetai | |||
const firstTocLevel = json.remaining.sections[0].toclevel; | |||
json.remaining.sections | |||
.forEach((oneSection: any, i: number) => { | |||
if (oneSection.toclevel === firstTocLevel) { | |||
if (oneSection.toclevel === firstTocLevel || oneSection.text.indexOf('class="NavFrame"')) { |
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'm not commenting on the general idea here, but only on your use of indexOf
. The indexOf
method returns -1 if the string you are searching does not contain the search string, not 0. Therefore, unless I've misunderstood what you're trying to do, I think you need:
~oneSection.text.indexOf('class="NavFrame"')
Note the tilde at the start. This converts -1 to 0, and 0 to -1, etc. Therefore, if the text appears at position 0, the tilde converts 0 to -1 and the test will pass. But if indexOf
returns -1 (not found), the tilde converts it to 0, and the test fails.
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.
PS It would probably be better to use the classList.contains()
method for this test. It is supported on IE10+. See https://dev.caniuse.com/classlist .
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.
Also, your test would fail if an editor had written class='NavFrame'
with single quotes or class="dark NavFrame"
, hence why using classList.contains()
is safer.
@bakshiutkarsha Any news here? If our section mgmt code css+js is not able to make the difference between our section code and the content code, then we need to specify our DOM nodes properly, like for example by putting |
This pull request has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions. |
Fixes #1033