Forum for discussing general topics related to Couch.
6 posts Page 1 of 1
Hi,

As the title suggests I would like to know if anyone has a clue on how and where to edit the double <br><br> that richtext adds to its paragraphs - even if I shift+enter is pressed.

Thanks!
Thanks @SimonWpt that should work indeed. But here nothing happened tbh :(

I've followed the 'solution':
added that code to the bottom of addons/kfunctions.php and then edited my editable richtext field adding a class to it:

<cms:editable type='richtext' name='my_headline' label='Headline' toolbar='custom'
custom_toolbar='bold, italic, strike' class='ck-enter-br' />

I tried different classes and inspected the output code but this doesn't seem to be changing anything at all.
Am I missing something?
francisknightley wrote: Am I missing something?


I am sorry to read this. The following code works for me:

Code: Select all
<cms:editable type='richtext' name='my_headline' label='Headline' toolbar='custom' custom_toolbar='bold, italic, strike' class='ck-enter-br ck-shiftenter-br' />

Which CouchCMS Version are you using?
SimonWpt wrote:
francisknightley wrote: Am I missing something?


I am sorry to read this. The following code works for me:

Code: Select all
<cms:editable type='richtext' name='my_headline' label='Headline' toolbar='custom' custom_toolbar='bold, italic, strike' class='ck-enter-br ck-shiftenter-br' />

Which CouchCMS Version are you using?


My version of the CMS:
CouchCMS Version 2.4 (20231006)

I'm wondering if this has anything to do with kfunctions.php in the folder couch/addons ?
I basically edited the filename from "kfunctions.example.php" to "kfunctions.php" and edited the code to:

Code: Select all
<?php

$FUNCS->add_event_listener( 'ckeditor_alter_config', function(&$config, $f){
   $classes = explode( ' ', $f->class );
   if( count($classes) ){
      $arr_enter = array( 'ck-enter-p'=>'CKEDITOR.ENTER_P',  'ck-enter-br'=>'CKEDITOR.ENTER_BR', 'ck-enter-div'=>'CKEDITOR.ENTER_DIV' );
      $arr_shift_enter = array( 'ck-shiftenter-p'=>'CKEDITOR.ENTER_P',  'ck-shiftenter-br'=>'CKEDITOR.ENTER_BR', 'ck-shiftenter-div'=>'CKEDITOR.ENTER_DIV' );

      foreach( $classes as $class ){
         if( array_key_exists($class, $arr_enter) ){
            $config['enterMode'] = $arr_enter[$class];
         }

         if( array_key_exists($class, $arr_shift_enter) ){
            $config['shiftEnterMode'] = $arr_shift_enter[$class];
         }
      }
   }
});

if ( !defined('K_COUCH_DIR') ) die(); // cannot be loaded directly

//require_once( K_COUCH_DIR.'addons/cart/cart.php' );
//require_once( K_COUCH_DIR.'addons/inline/inline.php' );
//require_once( K_COUCH_DIR.'addons/extended/extended-folders.php' );
//require_once( K_COUCH_DIR.'addons/extended/extended-comments.php' );
//require_once( K_COUCH_DIR.'addons/extended/extended-users.php' );
//require_once( K_COUCH_DIR.'addons/routes/routes.php' );
//require_once( K_COUCH_DIR.'addons/jcropthumb/jcropthumb.php' );
//require_once( K_COUCH_DIR.'addons/page-builder/page-builder.php' );
//require_once( K_COUCH_DIR.'addons/sub-templates/sub-templates.php' );




Is this enough? Doesn't this needs to be actived somewhere or somehow?
I found out what the problem was. On my front-end I was doing:

Code: Select all
<article>
<cms:nl2br><cms:show article /></cms:nl2br>
<cms:show article />
</article>


And the nl2br tag was adding a double paragraph to it ;)
Thank you so much for helping out!
6 posts Page 1 of 1
cron