fix custom-field wysiwyg

stable
Juanfran 2017-03-16 08:35:55 +01:00
parent b2af789412
commit 2b4fac32f4
2 changed files with 11 additions and 5 deletions

View File

@ -150,7 +150,7 @@ module.directive("tgCustomAttributesValues", ["$tgTemplate", "$tgStorage", "$tra
CustomAttributesValuesDirective])
CustomAttributeValueDirective = ($template, $selectedText, $compile, $translate, datePickerConfigService) ->
CustomAttributeValueDirective = ($template, $selectedText, $compile, $translate, datePickerConfigService, wysiwygService) ->
template = $template.get("custom-attributes/custom-attribute-value.html", true)
templateEdit = $template.get("custom-attributes/custom-attribute-value-edit.html", true)
@ -173,9 +173,13 @@ CustomAttributeValueDirective = ($template, $selectedText, $compile, $translate,
type: attributeValue.type
}
scope = $scope.$new()
scope.attributeHtml = wysiwygService.getHTML(value)
if editable and (edit or not value)
html = templateEdit(ctx)
html = $compile(html)($scope)
html = $compile(html)(scope)
$el.html(html)
if attributeValue.type == DATE_TYPE
@ -190,7 +194,7 @@ CustomAttributeValueDirective = ($template, $selectedText, $compile, $translate,
$el.picker = new Pikaday(datePickerConfig)
else
html = template(ctx)
html = $compile(html)($scope)
html = $compile(html)(scope)
$el.html(html)
isEditable = ->
@ -207,6 +211,8 @@ CustomAttributeValueDirective = ($template, $selectedText, $compile, $translate,
$scope.cancelCustomRichText= () =>
render(attributeValue, false)
return null
submit = debounce 2000, (event) =>
event.preventDefault()
@ -270,4 +276,4 @@ CustomAttributeValueDirective = ($template, $selectedText, $compile, $translate,
}
module.directive("tgCustomAttributeValue", ["$tgTemplate", "$selectedText", "$compile", "$translate",
"tgDatePickerConfigService", CustomAttributeValueDirective])
"tgDatePickerConfigService", "tgWysiwygService", CustomAttributeValueDirective])

View File

@ -14,7 +14,7 @@
<%- value %>
<% } else if (type=="richtext") { %>
.custom-field-value.js-value-view-mode.wysiwyg
div(ng-bind-html!="\'<%- value %>\'|markdownToHTML")
div(ng-bind-html="attributeHtml")
<% } else { %>
.custom-field-value.js-value-view-mode
span