【发布时间】:2018-08-13 04:55:18
【问题描述】:
所以,nodejs 项目,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 标签之间缩进的文本... After ckeditor saving
我尝试以不同的方式添加以下配置(autoParagraph single、fillEmptyBlocks single、它们一起等),但没有任何帮助
config.autoParagraph = false;
config.fillEmptyBlocks = false;
config.enterMode = CKEDITOR.ENTER_BR;
config.forceEnterMode = true;
本文P的风格是
.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;
}
尝试在 div 中为 p 个子项添加专门的 no-p-margin 标签,但不是……不明白这个填充是什么设置。
【问题讨论】:
标签: javascript html node.js mongodb ckeditor