mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[FIX] web_widget_text_markdown : use lexer on text field only (#942)
Fixes #937
This commit is contained in:
@@ -14,8 +14,7 @@ odoo.define("web_widget_text_markdown.bootstrap_markdown",
|
||||
var list_widget_registry = core.list_widget_registry;
|
||||
|
||||
var FieldTextMarkDown = form_common.AbstractField.extend(
|
||||
form_common.ReinitializeFieldMixin,
|
||||
{
|
||||
form_common.ReinitializeFieldMixin, {
|
||||
|
||||
template: 'FieldMarkDown',
|
||||
display_name: _lt('MarkDown'),
|
||||
@@ -70,8 +69,9 @@ odoo.define("web_widget_text_markdown.bootstrap_markdown",
|
||||
},
|
||||
|
||||
_get_raw_value: function() {
|
||||
if (this.$txt === false)
|
||||
if (this.$txt === false) {
|
||||
return '';
|
||||
}
|
||||
return this.$txt.val();
|
||||
},
|
||||
|
||||
@@ -121,6 +121,7 @@ odoo.define("web_widget_text_markdown.bootstrap_markdown",
|
||||
},
|
||||
|
||||
_format: function(row_data, options) {
|
||||
if (this.type === "text") {
|
||||
options = options || {};
|
||||
var markdown_text = marked(
|
||||
formats.format_value(
|
||||
@@ -129,6 +130,8 @@ odoo.define("web_widget_text_markdown.bootstrap_markdown",
|
||||
);
|
||||
return markdown_text;
|
||||
}
|
||||
return this._super(row_data, options)
|
||||
}
|
||||
});
|
||||
|
||||
list_widget_registry.add('field.bootstrap_markdown', ListView.Column);
|
||||
|
||||
Reference in New Issue
Block a user