CKEditor之间添加缩进 来自源HTML的标签

问题描述 投票:0回答:1

那么,nodejs project,express,mongodb,有一个函数,它生成一些HTML代码用于保存在DB中,这里就是它

botcfg.body =
    '<h3>Trade amount settings</h3>'
    + '<p># Coin position: <strong>' + req.body.coin_pos + '</strong></p>'
    + '<p># Trade amount: <strong>' + req.body.ta + '</strong></p>'
    + '<p># Template: <strong>' + req.body.template + '</strong></p>'
    + '<p># Fee: <strong>' + req.body.fee + '</strong></p>'
    + '<br>'
    + '<h3>Mad hatter mode</h3>'
    + '<p># Min Price Change To Buy: <strong>' + mh_min_pr_c2b + '</strong></p>'
    + '<br>'
    + '<h3>Safety settings</h3>'
    + '<p># Min Price Change To Buy: <strong>' + req.body.ss_min_pr_c2b + '</strong></p>'
    + '<p># Min Price Change To Sell: <strong>' + req.body.ss_min_pr_c2s + '</strong></p>'
    + '<p># Stop Loss (%): <strong>' + req.body.stoploss + '</strong></p>'
    + '<br>'

在Jade视图中我明白了

h4 Config
            div.botconf-text.no-p-margin!= botcfg.body

(没有标签,如HTML)How i see after saving from node

之后,如果我想编辑这个主体我使用CKEditor 4

script.
    CKEDITOR.replace('botcfg-body-edit', {
        toolbar: 'Full',
        height: '600px'
    })

并且,当我什么也不做,只是保存文本时,我收到P标签之间的缩进文字... qazxsw poi

我尝试以不同的方式添加下面的配置(autoParagraph单,fillEmptyBlocks单,他们在一起等),但没有什么帮助

After ckeditor saving

本文的P风格是

config.autoParagraph = false;
config.fillEmptyBlocks = false;
config.enterMode = CKEDITOR.ENTER_BR;
config.forceEnterMode = true;

尝试为div中的p个孩子添加特别的无边距标签,但不是......不明白设置此填充的内容。

javascript html node.js mongodb ckeditor
1个回答
0
投票

我的错...用于存储数据我使用MongoDB,当我在其中插入数据时它保存原样(使用\ r \ n)所以当我在jade模板中调用.botconf-text { white-space: pre-wrap; color: #99ff99; border-left: 2px dotted #ABABAB; padding: 8px; margin-left: 8px; } .no-p-margin p { margin: 0 0 2px; } 时我收到文本如何存储,我在解析时添加正则表达式参数!= botcfg.body,一切顺利。可能是可以帮助别人的。 CKEditor配置不需要。

© www.soinside.com 2019 - 2024. All rights reserved.