jodit icon indicating copy to clipboard operation
jodit copied to clipboard

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

Open fahry-mohammed opened this issue 10 months ago • 1 comments

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

fahry-mohammed avatar Apr 18 '24 04:04 fahry-mohammed

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

xdan avatar Apr 22 '24 20:04 xdan