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

Font size module misbehaves #1197

Open
cezarypiatek opened this issue Nov 20, 2024 · 1 comment
Open

Font size module misbehaves #1197

cezarypiatek opened this issue Nov 20, 2024 · 1 comment
Labels

Comments

@cezarypiatek
Copy link

cezarypiatek commented Nov 20, 2024

Jodit Version: 4.2.43

Browser: Chrome
OS: Windows
Is React App: True

Issue 1: Incorrectly displayed font size

Jodit config

{
    defaultFontSizePoints: 'pt',
    controls: {
        fontsize: {
            component: 'select',
                list: Jodit.atom([8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72])
        }
    }
}

After changing font size the value is displayed incorrectly on the toolbar (unit duplicated)

chrome_1hmyg4VJK6

Issue 2: After starting new line, the font size in the toolbar has wrong value (14 -> 18 -> 14)

  1. Change font to different size then default
  2. type 3 lines of text - when starting 3rd line the font size on the toolbard has changed by itself

chrome_yvMhFROjUx

Issue 3: Default font size not working correctly

Setting the default font size to 12pt is displayed as 16pt (probably pt <--> px conversion issue)

image

@cezarypiatek
Copy link
Author

cezarypiatek commented Nov 21, 2024

I did some investigation and it looks like the method below has invalid signature and hence is not used at all (typo in name s vs z and secod parameter is never passed)

normalise: (v: string, editor: IJodit): string => {

Another problem with it is that value sometimes comes without unit and it's impossible to tell what is the actual unit (sometimes the values is express in px and sometimes in pt)

The problems might be cause by the fact that here is used totally different implementation responsible for value normalization

fontSize: normalizeSize(

Also calling normalize on the list indices seems to be sth completly wrong

const keys: string[] = Object.keys(button.control.list!).map(

@xdan xdan added the bug label Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants