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

Line Height dropdown not adding checkmark to whole numbers #4632

Open
6 tasks done
ITensEI opened this issue Apr 16, 2024 · 3 comments
Open
6 tasks done

Line Height dropdown not adding checkmark to whole numbers #4632

ITensEI opened this issue Apr 16, 2024 · 3 comments

Comments

@ITensEI
Copy link

ITensEI commented Apr 16, 2024

Checklist

  • I've looked at the documentation to make sure the behavior isn't documented and expected.
  • I'm sure this is an issue with Summernote, not with my app or other dependencies (Angular, Cordova, React, etc.).
  • I've searched through the current issues to make sure this hasn't been reported yet.
  • My issue is pertinent to this repository of Summernote (jQuery), or I was unable to have my issue resolved from the relevant version I'm using, such as Angular, dJango, Rails or React. Please try your issue at the relevent repository first.
  • I understand that issues without interaction for more than 14 days (2 weeks), may be closed at our discretion. We do this, as sometimes issues are abandoned. We may at our discretion, add issues to the relevant project to be looked at, or for maintainers to work through as time permits. This is to help keep issues relevant to the current version of Summernote, and to reduce clutter.
  • I agree to follow the Code of Conduct that this project adheres to.

Steps to reproduce

  1. Click on the Line Height button
  2. Click on 1.0, 2.0, 3.0

Expected behavior

Add a checkmark next to the selection same as 1.2, 1.4, 1.5....

Current behavior

Line Height options for 1.0, 2.0, 3.0 not getting a checkmark

Minimal example reproducing the issue

No response

Environment

  • Summernote version: Summernote-lite v0.8.20
  • Browser (with version): Chrome 123.0.6312.87 (Official Build) (64-bit)
  • OS/Platform (with version): Windows 11 Pro 23H2
@ITensEI
Copy link
Author

ITensEI commented Apr 16, 2024

Found previous related issue: #368 from 2014

This line looks to be the culprit:

styleInfo['line-height'] = para.style.lineHeight;

Changing it to: styleInfo['line-height'] = parseFloat(para.style.lineHeight).toFixed(1); seems to fix the issue

@1der1
Copy link

1der1 commented Apr 26, 2024

The line height has a decimal point In the toolbar. The list shows whole numbers without decimal parts.
The checkmark gets added when both values are the same.

There are three options to solve the issue:

  1. Present whole numbers without decimal parts in the toolbar.
  2. Present whole numbers with decimal parts in the list.
  3. Make the comparison tolerant for the presentation.

@DennisSuitters
Copy link
Member

Found previous related issue: #368 from 2014

This line looks to be the culprit:

styleInfo['line-height'] = para.style.lineHeight;

Changing it to: styleInfo['line-height'] = parseFloat(para.style.lineHeight).toFixed(1); seems to fix the issue

If you would like to make the source changes and submit a PR, I'd be more than happy to test and merge the changes. However, please keep in mind, that I am currently working in the middle of Potato Harvesting season, and am working 10 hour days most days as I'm needed. I'm not sure when I'll be available more often, so any PR's may take a little longer to test and merge.

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

No branches or pull requests

3 participants