Permalink
Browse files

writemaths doesn't insert <p> on inline content

finally discovered TinyMCE's forced_root_block option!
  • Loading branch information...
christianp committed Apr 17, 2018
1 parent 1d173a3 commit c8dd0f54a7c71893a44cbabe60b5b8323adb171a
@@ -1174,6 +1174,7 @@ $(document).ready(function() {

var height = allBindingsAccessor.hasOwnProperty('wmHeight') ? allBindingsAccessor.wmHeight : 200;
var width = allBindingsAccessor.hasOwnProperty('wmWidth') ? allBindingsAccessor.wmWidth : '';
var para = allBindingsAccessor.hasOwnProperty('wmPara') ? allBindingsAccessor.wmPara : true;

var preambleCSSAccessor = allBindingsAccessor.preambleCSS;

@@ -1252,6 +1253,8 @@ $(document).ready(function() {
convert_urls: false,
verify_html: false,

forced_root_block: para ? 'p' : false,

paste_postprocess: function(ed,args) {
remove_empty_spans(args.node);
},
@@ -286,7 +286,7 @@ <h1 class="name-header">
</div>
</label>
<div class="{{form_control_class}}">
<div {% if not editable %}disabled{% endif %} data-bind="writemaths: hint"></div>
<div {% if not editable %}disabled{% endif %} data-bind="writemaths: hint, wmPara: false"></div>
<p class="help-block">
Describe how this setting should be used.
</p>
@@ -47,7 +47,7 @@ <h4>Advanced settings</h4>
<!-- ko foreach: {data: choices, afterAdd: Editor.afterAdd} -->
<li class="choice form-inline list-group-item clearfix">
<div class="col-sm-9">
<div {% if not editable %}disabled{% endif %} id="description" data-bind="writemaths: content, wmHeight: 100, preambleCSS: $root.preamble.css, tinymce_plugins: ['jmevisible','preview']"></div>
<div {% if not editable %}disabled{% endif %} id="description" data-bind="writemaths: content, wmPara: false, wmHeight: 100, preambleCSS: $root.preamble.css, tinymce_plugins: ['jmevisible','preview']"></div>
</div>
<div class="col-sm-3">
{% if editable %}<button type="button" type="button" class="delete btn btn-sm btn-danger btn-block" data-bind="click:remove"><span class="glyphicon glyphicon-remove"></span> Delete this choice</button>{% endif %}
@@ -54,7 +54,7 @@
<span class="percentproperty value" data-bind="text: ko.unwrap(value)+'%'"></span>
</div>
<div data-bind="if: input_type=='html'">
<div {% if not editable %}disabled{% endif %} data-bind="writemaths: value, preambleCSS: $root.preamble.css, tinymce_plugins: ['jmevisible','preview']"></div>
<div {% if not editable %}disabled{% endif %} data-bind="writemaths: value, wmPara: false, preambleCSS: $root.preamble.css, tinymce_plugins: ['jmevisible','preview']"></div>
</div>
<div data-bind="if: input_type=='list_of_strings'">
<listbox params="items: value{% if not editable %}, disabled: true{% endif %}"></listbox>
@@ -66,7 +66,7 @@ <h4>Length restriction</h4>
<label class="{{form_label_class}} control-label">
Warning message
</label>
<div {% if not editable %}disabled{% endif %} class="{{form_control_class}}" data-bind="writemaths: maxlength.message, preambleCSS: $root.preamble.css, tinymce_plugins: ['jmevisible','preview']"></div>
<div {% if not editable %}disabled{% endif %} class="{{form_control_class}}" data-bind="writemaths: maxlength.message, wmPara: false, preambleCSS: $root.preamble.css, tinymce_plugins: ['jmevisible','preview']"></div>
</div>
</div>
</form>
@@ -78,7 +78,7 @@ <h4>Length restriction</h4>
<label class="{{form_label_class}} control-label">
Warning message
</label>
<div {% if not editable %}disabled{% endif %} class="{{form_control_class}}" data-bind="writemaths: maxlength.message, preambleCSS: $root.preamble.css, tinymce_plugins: ['jmevisible','preview']"></div>
<div {% if not editable %}disabled{% endif %} class="{{form_control_class}}" data-bind="writemaths: maxlength.message, wmPara: false, preambleCSS: $root.preamble.css, tinymce_plugins: ['jmevisible','preview']"></div>
</div>
</div>
</form>
@@ -101,7 +101,7 @@ <h4>String restriction</h4>
Warning message
</label>
<div class="{{form_control_class}}">
<div {% if not editable %}disabled{% endif %} data-bind="writemaths: musthave.message, preambleCSS: $root.preamble.css, tinymce_plugins: ['jmevisible','preview']"></div>
<div {% if not editable %}disabled{% endif %} data-bind="writemaths: musthave.message, wmPara: false, preambleCSS: $root.preamble.css, tinymce_plugins: ['jmevisible','preview']"></div>
</div>
</div>
</div>
@@ -124,7 +124,7 @@ <h4>String restriction</h4>
Warning message
</label>
<div class="{{form_control_class}}">
<div {% if not editable %}disabled{% endif %} data-bind="writemaths: notallowed.message, preambleCSS: $root.preamble.css, tinymce_plugins: ['jmevisible','preview']"></div>
<div {% if not editable %}disabled{% endif %} data-bind="writemaths: notallowed.message, wmPara: false, preambleCSS: $root.preamble.css, tinymce_plugins: ['jmevisible','preview']"></div>
</div>
</div>
</div>
@@ -46,7 +46,7 @@ <h4>Advanced settings</h4>
<!-- ko foreach: {data: choices, afterAdd: Editor.afterAdd} -->
<li class="choice form-inline list-group-item clearfix">
<div class="col-sm-9">
<div {% if not editable %}disabled{% endif %} id="description" data-bind="writemaths: content, wmHeight: 100, preambleCSS: $root.preamble.css, tinymce_plugins: ['jmevisible','preview']"></div>
<div {% if not editable %}disabled{% endif %} id="description" data-bind="writemaths: content, wmPara: false, wmHeight: 100, preambleCSS: $root.preamble.css, tinymce_plugins: ['jmevisible','preview']"></div>
</div>
<div class="col-sm-3">
{% if editable %}<button type="button" type="button" class="delete btn btn-sm btn-danger btn-block" data-bind="click:remove"><span class="glyphicon glyphicon-remove"></span> Delete this choice</button>{% endif %}
@@ -67,7 +67,7 @@ <h4>Advanced settings</h4>
<!-- ko foreach: {data: choices, afterAdd: Editor.afterAdd} -->
<li class="choice form-inline list-group-item clearfix">
<div class="col-sm-9">
<div {% if not editable %}disabled{% endif %} id="description" data-bind="writemaths: content, wmHeight: 100, preambleCSS: $root.preamble.css, tinymce_plugins: ['jmevisible','preview']"></div>
<div {% if not editable %}disabled{% endif %} id="description" data-bind="writemaths: content, wmPara: false, wmHeight: 100, preambleCSS: $root.preamble.css, tinymce_plugins: ['jmevisible','preview']"></div>
</div>
<div class="col-sm-3">
{% if editable %}<button type="button" type="button" class="delete btn btn-sm btn-danger btn-block" data-bind="click:remove"><span class="glyphicon glyphicon-remove"></span> Delete this choice</button>{% endif %}
@@ -89,7 +89,7 @@ <h4>Advanced settings</h4>
<!-- ko foreach: {data: answers, afterAdd: Editor.afterAdd} -->
<li class="answer form-inline list-group-item clearfix">
<div class="col-sm-9">
<div {% if not editable %}disabled{% endif %} id="description" data-bind="writemaths: content, wmHeight: 100, preambleCSS: $root.preamble.css, tinymce_plugins: ['jmevisible','preview']"></div>
<div {% if not editable %}disabled{% endif %} id="description" data-bind="writemaths: content, wmPara: false, wmHeight: 100, preambleCSS: $root.preamble.css, tinymce_plugins: ['jmevisible','preview']"></div>
</div>
<div class="col-sm-3">
{% if editable %}<button type="button" type="button" class="delete btn btn-sm btn-danger btn-block" data-bind="click:remove"><span class="glyphicon glyphicon-remove"></span> Delete this answer</button>{% endif %}
@@ -44,7 +44,7 @@ <h4>Advanced settings</h4>
<label class="{{form_label_class}} control-label">
Message if wrong precision
</label>
<div {% if not editable %}disabled{% endif %} class="{{form_control_class}}" data-bind="writemaths: precisionMessage, preambleCSS: $root.preamble.css, tinymce_plugins: ['jmevisible','preview']"></div>
<div {% if not editable %}disabled{% endif %} class="{{form_control_class}}" data-bind="writemaths: precisionMessage, wmPara: false, preambleCSS: $root.preamble.css, tinymce_plugins: ['jmevisible','preview']"></div>
</div>
</div>

@@ -41,7 +41,7 @@ <h4>Advanced settings</h4>
<label class="{{form_label_class}} control-label">
Message if wrong precision
</label>
<div {% if not editable %}disabled{% endif %} class="{{form_control_class}}" data-bind="writemaths: precisionMessage, preambleCSS: $root.preamble.css, tinymce_plugins: ['jmevisible','preview']"></div>
<div {% if not editable %}disabled{% endif %} class="{{form_control_class}}" data-bind="writemaths: precisionMessage, wmPara: false, preambleCSS: $root.preamble.css, tinymce_plugins: ['jmevisible','preview']"></div>
</div>
</div>
<hr>

0 comments on commit c8dd0f5

Please sign in to comment.