app/Plugin/TabaHtmlEditor2/Resource/template/admin/snippet/editor.twig line 1

Open in your IDE?
  1. {#
  2. Copyright (C) SPREAD WORKS Inc. All Rights Reserved.
  3. For the full copyright and license information, please view the LICENSE
  4. file that was distributed with this source code.
  5. #}
  6. {% set const = TabaHtmlEditor2Constants %}
  7. {% set bind_prefix = constant('ADMIN_BIND_PREFIX',const) %}
  8. {% set trans_prefix = constant('PLUGIN_CODE_LC',const)~'.admin' %}
  9. {% set userConfig = TabaHtmlEditor2UserConfig %}
  10. <script src="{{ path(bind_prefix~'_assets',{file:'js/sw-html-editor.js'}) }}"></script>
  11. {# オリジナルプラグイン読み込み #}
  12. <script src="{{ path(bind_prefix~'_assets',{file:'js/trumbowyg.blocktemplate.js'}) }}"></script>
  13. <script src="{{ path(bind_prefix~'_assets',{file:'js/trumbowyg.formattingset.js'}) }}"></script>
  14. <script>
  15. $(function() {
  16.     {% for selector in selectors %}
  17.         if ($("{{ (selector.name is defined ? selector.name : selector)|raw }}")[0]) {
  18.             $("{{ (selector.name is defined ? selector.name : selector)|raw }}").trumbowyg({
  19.                 lang: 'ja',
  20.                 btns: [
  21.                     ['viewHTML'],
  22.                     ['undo', 'redo'], // Only supported in Blink browsers
  23.                     //['formatting'],
  24.                     ['originalformattingset'], //【オリジナル】オリジナルフォーマット・カスタムHTML
  25.                     ['blocktemplate'],//【オリジナル】ブロックテンプレート追加
  26.                     ['strong', 'em', 'del'],
  27.                     ['superscript', 'subscript'],
  28.                     ['link'],
  29.                     ["insertImage","swfilemanager"],//画像とファイル管理
  30.                     ['justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull'],
  31.                     ['unorderedList', 'orderedList'],
  32.                     ['horizontalRule'],
  33.                     ['removeformat'],
  34.                     ['fullscreen'],
  35.                 ],
  36.                 plugins: {
  37.                     
  38.                     //【オリジナル】オリジナルフォーマット・カスタムHTML
  39.                     originalformattingset: true,
  40.                     //【オリジナル】ブロックテンプレート
  41.                     blocktemplates: [
  42.                         {
  43.                             name: '左画像右テキスト',
  44.                             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>'
  45.                         },
  46.                         {
  47.                             name: '右画像左テキスト',
  48.                             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>'
  49.                         },
  50.                         {
  51.                             name: '表ブロック',
  52.                             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>'
  53.                         }
  54.                     ]
  55.                 },
  56.                 {% if userConfig.get('editor') is empty or userConfig.get('editor').semantic is not defined %}
  57.                     semantic: {'div':'div','i':'i'},
  58.                 {% else %}
  59.                     {% if userConfig.get('editor').semantic is iterable %}
  60.                         semantic: {
  61.                             {% for row in userConfig.get('editor').semantic %}{% for key in row|keys %}
  62.                                 '{{ key }}': '{{ attribute(row,key) }}',
  63.                             {% endfor %}{% endfor %}
  64.                         },
  65.                     {% elseif userConfig.get('editor').semantic == true %}
  66.                         semantic: true,
  67.                     {% else %}
  68.                         semantic: {'div':'div','i':'i'},
  69.                     {% endif %}
  70.                 {% endif %}
  71.                 {% 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 %}
  72.            }){% if selector.config.WYSIWYG is defined and selector.config.WYSIWYG == false %}.trumbowyg('toggle'){% endif %};
  73.         }
  74.     {% endfor %}
  75. });
  76. </script>
  77.         <style>
  78.             
  79.             /*TabaHTMLエディタ用エディタメニュー調整*/
  80.             .trumbowyg-button-pane button.trumbowyg-blocktemplate-button {
  81.                 color: transparent;
  82.             }
  83.             .trumbowyg-button-pane button.trumbowyg-blocktemplate-button:before {
  84.                 color: #000;
  85.                 content: "ブロック追加";
  86.             }
  87.             .trumbowyg-button-pane button.trumbowyg-blocktemplate-button.trumbowyg-open-dropdown.trumbowyg-textual-button::after {
  88.                 top: 27px;
  89.                 right: 3px;
  90.             }
  91. .trumbowyg-button-pane button.trumbowyg-originalformattingset-button:before {
  92.     font-family: Font Awesome\ 5 Free;
  93.     content: "\f1dd";
  94.     font-weight: 900;
  95. }
  96.             /*横並び画像テキスト mediaset*/
  97.             .trumbowyg-editor-box .mediaset {
  98.                 display: flex;
  99.             }
  100.             .trumbowyg-editor-box .mediaset .imgbox {
  101.                 width: 200px;
  102.             }
  103.             .trumbowyg-editor-box .mediaset .imgbox img {
  104.                 width: 100%;
  105.             }
  106.             .trumbowyg-editor-box .mediaset .txtbox .title {
  107.                 font-weight: bold;
  108.                 margin-bottom: 5px;
  109.             }
  110.             .trumbowyg-editor-box .mediaset .txtbox .btn a {
  111.                 display: inline-block;
  112.                 padding: 0 5px;
  113.                 border: solid 1px #333;
  114.             }
  115.             .trumbowyg-editor-box .mediaset.img-right .imgbox {
  116.                 order: 1;
  117.             }
  118.             /*表ブロック tableset*/
  119.             .tableset th,
  120.             .tableset td {
  121.                 padding: 3px;
  122.                 border: solid 1px #333;
  123.             }
  124.             /*フォーマット追加・見出し*/
  125.             .heading1,.heading2,.heading3,.heading4 {
  126.             
  127.             }
  128.             .heading1 h2 {        
  129.                 font-size: 1.5rem;
  130.                 font-weight: bold;
  131.             }
  132.             .heading2 p {        
  133.                 font-size: 1.3rem;
  134.                 font-weight: bold;
  135.             }
  136.             .heading3 p {                
  137.                 font-size: 1.2rem;
  138.                 font-weight: bold;
  139.             }
  140.             .heading4 p {
  141.                 font-size: 1.1rem;
  142.                 font-weight: bold;
  143.             }
  144.         </style>