{#
Copyright (C) SPREAD WORKS Inc. All Rights Reserved.
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
{% set const = TabaHtmlEditor2Constants %}
{% set bind_prefix = constant('ADMIN_BIND_PREFIX',const) %}
{% set trans_prefix = constant('PLUGIN_CODE_LC',const)~'.admin' %}
{% set userConfig = TabaHtmlEditor2UserConfig %}
<script src="{{ path(bind_prefix~'_assets',{file:'js/sw-html-editor.js'}) }}"></script>
{# オリジナルプラグイン読み込み #}
<script src="{{ path(bind_prefix~'_assets',{file:'js/trumbowyg.blocktemplate.js'}) }}"></script>
<script src="{{ path(bind_prefix~'_assets',{file:'js/trumbowyg.formattingset.js'}) }}"></script>
<script>
$(function() {
{% for selector in selectors %}
if ($("{{ (selector.name is defined ? selector.name : selector)|raw }}")[0]) {
$("{{ (selector.name is defined ? selector.name : selector)|raw }}").trumbowyg({
lang: 'ja',
btns: [
['viewHTML'],
['undo', 'redo'], // Only supported in Blink browsers
//['formatting'],
['originalformattingset'], //【オリジナル】オリジナルフォーマット・カスタムHTML
['blocktemplate'],//【オリジナル】ブロックテンプレート追加
['strong', 'em', 'del'],
['superscript', 'subscript'],
['link'],
["insertImage","swfilemanager"],//画像とファイル管理
['justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull'],
['unorderedList', 'orderedList'],
['horizontalRule'],
['removeformat'],
['fullscreen'],
],
plugins: {
//【オリジナル】オリジナルフォーマット・カスタムHTML
originalformattingset: true,
//【オリジナル】ブロックテンプレート
blocktemplates: [
{
name: '左画像右テキスト',
html: '<div class="mediaset img-small img-left "><div class="imgbox"><img src="/html/template/kinkodo/assets/assets/images/dummy.jpg" alt=""></div><div class="txtbox"><p class="title">小見出し</p><div class="text"><p>テキストが入ります。テキストが入ります。テキストが入ります。<a href="/">リンク</a><strong>強調</strong><span class="big">大文字</span></p></div><div class="btn"><a href="/">リンクテキスト</a></div></div></div>'
},
{
name: '右画像左テキスト',
html: '<div class="mediaset img-small img-right "><div class="imgbox"><img src="/html/template/kinkodo/assets/assets/images/dummy.jpg" alt=""></div><div class="txtbox"><p class="title">小見出し</p><div class="text"><p>テキストが入ります。テキストが入ります。テキストが入ります。<a href="/">リンク</a><strong>強調</strong><span class="big">大文字</span></p></div><div class="btn"><a href="/">リンクテキスト</a></div></div></div>'
},
{
name: '表ブロック',
html: '<div class="tableset type-normal"><table><tbody><tr><th>項目が入ります</th><td>テキストが入ります。テキストが入ります。テキストが入ります。テキストが入ります。</td></tr><tr><th>項目が入ります</th><td>テキストが入ります。テキストが入ります。テキストが入ります。テキストが入ります。</td></tr><tr><th>項目が入ります</th><td>テキストが入ります。テキストが入ります。テキストが入ります。テキストが入ります。</td></tr><tr><th>項目が入ります</th><td>テキストが入ります。テキストが入ります。テキストが入ります。テキストが入ります。</td></tr></tbody></table></div>'
}
]
},
{% if userConfig.get('editor') is empty or userConfig.get('editor').semantic is not defined %}
semantic: {'div':'div','i':'i'},
{% else %}
{% if userConfig.get('editor').semantic is iterable %}
semantic: {
{% for row in userConfig.get('editor').semantic %}{% for key in row|keys %}
'{{ key }}': '{{ attribute(row,key) }}',
{% endfor %}{% endfor %}
},
{% elseif userConfig.get('editor').semantic == true %}
semantic: true,
{% else %}
semantic: {'div':'div','i':'i'},
{% endif %}
{% endif %}
{% if userConfig.get('editor') is empty or (userConfig.get('editor').script is not defined or (userConfig.get('editor').script is not empty and userConfig.get('editor').script == true)) %}tagsToRemove: ['script'],{% endif %}
}){% if selector.config.WYSIWYG is defined and selector.config.WYSIWYG == false %}.trumbowyg('toggle'){% endif %};
}
{% endfor %}
});
</script>
<style>
/*TabaHTMLエディタ用エディタメニュー調整*/
.trumbowyg-button-pane button.trumbowyg-blocktemplate-button {
color: transparent;
}
.trumbowyg-button-pane button.trumbowyg-blocktemplate-button:before {
color: #000;
content: "ブロック追加";
}
.trumbowyg-button-pane button.trumbowyg-blocktemplate-button.trumbowyg-open-dropdown.trumbowyg-textual-button::after {
top: 27px;
right: 3px;
}
.trumbowyg-button-pane button.trumbowyg-originalformattingset-button:before {
font-family: Font Awesome\ 5 Free;
content: "\f1dd";
font-weight: 900;
}
/*横並び画像テキスト mediaset*/
.trumbowyg-editor-box .mediaset {
display: flex;
}
.trumbowyg-editor-box .mediaset .imgbox {
width: 200px;
}
.trumbowyg-editor-box .mediaset .imgbox img {
width: 100%;
}
.trumbowyg-editor-box .mediaset .txtbox .title {
font-weight: bold;
margin-bottom: 5px;
}
.trumbowyg-editor-box .mediaset .txtbox .btn a {
display: inline-block;
padding: 0 5px;
border: solid 1px #333;
}
.trumbowyg-editor-box .mediaset.img-right .imgbox {
order: 1;
}
/*表ブロック tableset*/
.tableset th,
.tableset td {
padding: 3px;
border: solid 1px #333;
}
/*フォーマット追加・見出し*/
.heading1,.heading2,.heading3,.heading4 {
}
.heading1 h2 {
font-size: 1.5rem;
font-weight: bold;
}
.heading2 p {
font-size: 1.3rem;
font-weight: bold;
}
.heading3 p {
font-size: 1.2rem;
font-weight: bold;
}
.heading4 p {
font-size: 1.1rem;
font-weight: bold;
}
</style>