xdan / jodit

Jodit - Best WYSIWYG Editor for You
https://xdsoft.net/jodit/
MIT License
1.66k stars 350 forks source link

Paragraph configuration not work as expected and shows more options than configration defined in the config file #1110

Open fahry-mohammed opened 5 months ago

fahry-mohammed commented 5 months ago

Jodit Version: 4.0.25 / 1.3.20

Browser: Chrome and Safari (not tested on other browser) OS: Mac (not tested on other OS) Is React App: True

Code

// config.ts

export const joditEditorConfig = {
  readonly: false,
  // ... configrations
  style: {
    // ... styles
  },
  defaultActionOnPaste: 'insert_only_text',
  buttons: [
    // ... other buttons
    'fontsize'
    'paragraph',
  ],
  toolbarAdaptive: false,
  controls: {
    // ... other controls
    fontsize: {
      default: '16',
      list: { '16': '16', '18': '18', '20': '20', '22': '22' },
    },
    paragraph: {
      list: {
        p: 'Pharagraph',
        h1: 'Heading 1',
        h2: 'Heading 2',
        h3: 'Heading 3',
      },
    },
  },
};

// Usage in the component
const config = useMemo(() => joditEditorConfig, []);

return (
   // ... Other components
      <JoditEditor
        value={content}
        config={config as any}
      />
   // ... Other components
)

Expected behavior: The fontsize listed down as expected with 16, 18, 20 and 22. Same as fontsize, I have configured paragraph and expected to show only listed types such as p: 'Pharagraph', h1: 'Heading 1', h2: 'Heading 2', h3: 'Heading 3'

Actual behavior: Even tough the paragraph configuration limited to p: 'Pharagraph', h1: 'Heading 1', h2: 'Heading 2', h3: 'Heading 3', in the editor it shows additionally 'Heading 4', 'Quote', 'Code'.

Screenshot of the behaviour:

Screenshot 2024-04-17 at 09 39 51
xdan commented 5 months ago

This is expected behavior https://xdsoft.net/jodit/pro/docs/how-to/add-custom-font-family.md