Score:0

format_p config not working with CKEditor

us flag

I am using D9 and using CKEditor for a formatted long field. Currently enterMode = 1 is set which means by default we will have <p> tag in every new line. We only have 3 enterMode in CKEditor:

enterMode = 1 -> p
enterMode =2 -> br
enterMode = 3 -> div

I have a requirement to convert this <p> tag to <span> tag. I have tried to set achieve this by using

function it_common_editor_js_settings_alter(array &$settings) {
  $settings['editor']['formats']['full_html_restricted_toolbars']['editorSettings']['format_p'] = ['element' => 'span'];
}

but no luck.

Also tried this contrib module https://www.drupal.org/project/ckeditor_config and set this format_p = { "element": "span", "attributes": { "class": "contentTitle2" } }

How can I convert default enterMode = 1 p tag to span tag?

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.