how to tell ckeditor5 to use my custom heading type by default

Viewed 398

I am using a custom build of @ckeditor/ckeditor5-editor-classic@18.0.0

    heading : {
        options: [
            {
                model            : 'inlineParagraph',
                view             : 'span',
                title            : 'Inline Paragraph',
                class            : 'ck-heading_paragraph_inline',
                converterPriority: 'highest'
            },
            { model: 'paragraph',  title: 'Paragraph', class: 'ck-heading_paragraph' },
            { model: 'heading1', view: 'h1', title: 'Heading 1', class: 'ck-heading_heading1' },
            { model: 'heading2', view: 'h2', title: 'Heading 2', class: 'ck-heading_heading2' },
            { model: 'heading3', view: 'h3', title: 'Heading 3', class: 'ck-heading_heading3' },
            { model: 'heading4', view: 'h4', title: 'Heading 4', class: 'ck-heading_heading4' },
        ]
    }

I want the inlineParagraph to be the default type when there is no text in the editor, by default editor chooses the paragraph.

I also tried this :

    heading : {
        options: [
            {
                model            : 'inlineParagraph',
                view             : 'span',
                title            : 'Inline Paragraph',
                class            : 'ck-heading_paragraph_inline',
                converterPriority: 'highest'
            },
            { model: 'paragraph', view: 'span', title: 'Paragraph', class: 'ck-heading_paragraph' },
            { model: 'div', title: 'Div', class: 'ck-heading_div' },
            { model: 'heading1', view: 'h1', title: 'Heading 1', class: 'ck-heading_heading1' },
            { model: 'heading2', view: 'h2', title: 'Heading 2', class: 'ck-heading_heading2' },
            { model: 'heading3', view: 'h3', title: 'Heading 3', class: 'ck-heading_heading3' },
            { model: 'heading4', view: 'h4', title: 'Heading 4', class: 'ck-heading_heading4' },
        ]
    }

But then it choose div as default ... I think it defaults to a block level element ... but I want to change it to a inline element like span ...

0 Answers
Related