fix custom-field wysiwyg
parent
b2af789412
commit
2b4fac32f4
|
@ -150,7 +150,7 @@ module.directive("tgCustomAttributesValues", ["$tgTemplate", "$tgStorage", "$tra
|
||||||
CustomAttributesValuesDirective])
|
CustomAttributesValuesDirective])
|
||||||
|
|
||||||
|
|
||||||
CustomAttributeValueDirective = ($template, $selectedText, $compile, $translate, datePickerConfigService) ->
|
CustomAttributeValueDirective = ($template, $selectedText, $compile, $translate, datePickerConfigService, wysiwygService) ->
|
||||||
template = $template.get("custom-attributes/custom-attribute-value.html", true)
|
template = $template.get("custom-attributes/custom-attribute-value.html", true)
|
||||||
templateEdit = $template.get("custom-attributes/custom-attribute-value-edit.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
|
type: attributeValue.type
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scope = $scope.$new()
|
||||||
|
scope.attributeHtml = wysiwygService.getHTML(value)
|
||||||
|
|
||||||
if editable and (edit or not value)
|
if editable and (edit or not value)
|
||||||
html = templateEdit(ctx)
|
html = templateEdit(ctx)
|
||||||
html = $compile(html)($scope)
|
|
||||||
|
html = $compile(html)(scope)
|
||||||
$el.html(html)
|
$el.html(html)
|
||||||
|
|
||||||
if attributeValue.type == DATE_TYPE
|
if attributeValue.type == DATE_TYPE
|
||||||
|
@ -190,7 +194,7 @@ CustomAttributeValueDirective = ($template, $selectedText, $compile, $translate,
|
||||||
$el.picker = new Pikaday(datePickerConfig)
|
$el.picker = new Pikaday(datePickerConfig)
|
||||||
else
|
else
|
||||||
html = template(ctx)
|
html = template(ctx)
|
||||||
html = $compile(html)($scope)
|
html = $compile(html)(scope)
|
||||||
$el.html(html)
|
$el.html(html)
|
||||||
|
|
||||||
isEditable = ->
|
isEditable = ->
|
||||||
|
@ -207,6 +211,8 @@ CustomAttributeValueDirective = ($template, $selectedText, $compile, $translate,
|
||||||
$scope.cancelCustomRichText= () =>
|
$scope.cancelCustomRichText= () =>
|
||||||
render(attributeValue, false)
|
render(attributeValue, false)
|
||||||
|
|
||||||
|
return null
|
||||||
|
|
||||||
submit = debounce 2000, (event) =>
|
submit = debounce 2000, (event) =>
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
||||||
|
@ -270,4 +276,4 @@ CustomAttributeValueDirective = ($template, $selectedText, $compile, $translate,
|
||||||
}
|
}
|
||||||
|
|
||||||
module.directive("tgCustomAttributeValue", ["$tgTemplate", "$selectedText", "$compile", "$translate",
|
module.directive("tgCustomAttributeValue", ["$tgTemplate", "$selectedText", "$compile", "$translate",
|
||||||
"tgDatePickerConfigService", CustomAttributeValueDirective])
|
"tgDatePickerConfigService", "tgWysiwygService", CustomAttributeValueDirective])
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<%- value %>
|
<%- value %>
|
||||||
<% } else if (type=="richtext") { %>
|
<% } else if (type=="richtext") { %>
|
||||||
.custom-field-value.js-value-view-mode.wysiwyg
|
.custom-field-value.js-value-view-mode.wysiwyg
|
||||||
div(ng-bind-html!="\'<%- value %>\'|markdownToHTML")
|
div(ng-bind-html="attributeHtml")
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
.custom-field-value.js-value-view-mode
|
.custom-field-value.js-value-view-mode
|
||||||
span
|
span
|
||||||
|
|
Loading…
Reference in New Issue