<div
class="rich-text-wrapper"
data-name="{{ name|e('html_attr') }}"
id="rich_text_{{ name|e('html_attr') }}_wrapper"
>
<div class="rich_text_show_one">
<div
class="rich_text_textarea_wrapper"
id="rich_text_{{ name|e('html_attr') }}_text"
>
{% include cargo("rich_text_toolbar") %}
<textarea
class="full-textarea editable{% if readonly %} readonly{% endif %}"
name="{% if input_name %}{{ input_name|e('html_attr') }}{% else %}{{ name|e('html_attr') }}{% endif %}"
id="rich_text_{{ name|e('html_attr') }}"
placeholder="{{ placeholder|e('html_attr') }}"
{% if readonly %}
disabled="disabled"
readonly="readonly"
{% endif %}
>{{
contents|e('html_attr')
}}</textarea>
</div>
<div
id="rich_text_{{ name|e('html_attr') }}_preview"
class="richtext-render"
></div>
</div>
<div
class="rich_text_tab_row"
id="rich_text_{{ name|e('html_attr') }}_tabs"
>
<a id="rich_text_{{ name|e('html_attr') }}_edit_tab">{{ __("Edit") }}</a>
<a id="rich_text_{{ name|e('html_attr') }}_preview_tab">{{ __("Preview") }}</a>
</div>
</div>
<script nonce={{ csp_nonce() }}>
if (typeof window.deferUntilExists !== "function") {
window.deferUntilExists = function (func, poll, delay, counter) {
var counter = counter || 0;
if (counter > 1000) {
return;
}
if (typeof(window[poll]) === "undefined") {
window.setTimeout(
function () {
window.deferUntilExists(func, poll, delay, counter + 1)
},
delay
);
return;
}
return func();
}
}
if (typeof($) === 'undefined') {
/**
* We can't reliably depend on jQuery already being loaded.
*/
window.deferUntilExists(
function () {
window['richTextWrapper'](
{{ name|json_encode|raw }},
"{{ format_element|default("format")|e("html_attr") }}"{#
#}{% if input_name %},
{{ input_name|json_encode|raw }}{% endif %}
);
},
"richTextWrapper",
100 // milliseconds
);
} else {
/**
* If jQuery is already loaded, then just use it.
*/
$(document).ready(function() {
window['richTextWrapper'](
{{ name|json_encode|raw }},
"{{ format_element|default("format")|e("html_attr") }}"
);
});
}
</script>
|