摆脱 CKEditor 中的 <p> 换行

Getting rid of <p> wrap in CKEditor

我正在使用 Concrete5 5.7.5.2 作为我的 CMS,并决定尝试使用 CKEditor 而不是随附的 Redactor。我遇到的问题是,每当我尝试插入一个内容块时,它都会在我的内容周围包裹一个段落标签。

我已经在 config.js 中尝试了以下设置,但它们似乎并没有改变问题。

config.autoParagraph = false;
config.enterMode = 2;
config.enterMode = CKEDITOR.ENTER_BR // pressing the ENTER Key puts the <br/> tag
config.shiftEnterMode = CKEDITOR.ENTER_P; //pressing the SHIFT + ENTER Keys puts the <p> tag

我使用 CKEditor 而不是 Redactor 的部分原因是因为这正是我在使用 Redactor 时遇到的问题。我也在 Redactor 中尝试了所有推荐的修复程序,但它也没有在那里修复它。会不会是这两个插件之外的东西?核心?

非常感谢您的帮助。

打开 CKEditor.php (/src/Editor)

寻找这个代码块

$options = array_merge(
$options,
array(
    'plugins' => implode(',', $plugins),
    'stylesSet' => 'concrete5styles',
    'filebrowserBrowseUrl' => 'a',
    'uploadUrl' => (string)URL::to('/ccm/system/file/upload'),
    'language' => $this->getLanguageOption(),
    'customConfig' => '',
    'allowedContent' => true,
    'image2_captionedClass' => 'content-editor-image-captioned',
    'image2_alignClasses' => array(
        'content-editor-image-left',
        'content-editor-image-center',
        'content-editor-image-right'
    )
)
);

添加这两个键值对

'enterMode' => 2,
'shiftEnterMode' => 2

之后的代码应该是这样的

$options = array_merge(
$options,
array(
    'plugins' => implode(',', $plugins),
    'stylesSet' => 'concrete5styles',
    'filebrowserBrowseUrl' => 'a',
    'uploadUrl' => (string)URL::to('/ccm/system/file/upload'),
    'language' => $this->getLanguageOption(),
    'customConfig' => '',
    'allowedContent' => true,
    'image2_captionedClass' => 'content-editor-image-captioned',
    'image2_alignClasses' => array(
        'content-editor-image-left',
        'content-editor-image-center',
        'content-editor-image-right'
    ),
    'enterMode' => 2,
    'shiftEnterMode' => 2
)
);