(function ($, wp, window) { $(document).ready(function () { console.log(i18n__('gutenberg_editor_enhanced')); var b = wp.blocks, c = wp.components, e = wp.element, ed = wp.blockEditor ? wp.blockEditor : wp.editor, rE = wp.richText.registerFormatType, _data = wp.data, dispatch = _data.dispatch, select = _data.select, _dispatch = dispatch('core/block-editor') ? dispatch('core/block-editor') : dispatch('core/editor'), _select = select('core/block-editor') ? select('core/block-editor') : select('core/editor'), getBlockOrder = _select.getBlockOrder, getBlock = _select.getBlock, insertBlock = _dispatch.insertBlock, removeBlock = _dispatch.removeBlock, updateBlockAttributes = _dispatch.updateBlockAttributes, el = e.createElement, rB = b.registerBlockType, createBlock = b.createBlock, InnerBlocks = ed.InnerBlocks, RichTextToolbarButton = ed.RichTextToolbarButton, Component = e.Component, getRectangleFromRange = wp.dom.getRectangleFromRange, Popover = c.Popover, Button = c.Button, RichText = ed.RichText, PlainText = ed.PlainText, MediaUpload = ed.MediaUpload, Fragment = e.Fragment, InspectorControls = ed.InspectorControls, PanelBody = c.PanelBody, ClipboardButton = c.ClipboardButton, TextControl = c.TextControl, RadioControl = c.RadioControl, Toolbar = c.Toolbar, SelectControl = c.SelectControl, ToggleControl = c.ToggleControl, CheckboxControl = CheckboxControl, RangeControl = c.RangeControl, DropdownMenu = c.DropdownMenu, BlockControls = ed.BlockControls, AlignmentToolbar = ed.AlignmentToolbar, _lodash = window.lodash || window._, wpApiSettings = window.wpApiSettings, times = _lodash.times, debounce = _lodash.debounce; function i18n__(key) { var map = window.aksrt_block_var && window.aksrt_block_var.i18n; if (map && Object.prototype.hasOwnProperty.call(map, key)) { return map[key]; } return key; } function i18n_sprintf(key) { var args = Array.prototype.slice.call(arguments, 1); var str = i18n__(key); var autoIndex = 0; return str.replace(/%(\d+\$)?s/g, function (match, num) { var idx = num ? parseInt(num, 10) - 1 : autoIndex++; return args[idx] !== undefined && args[idx] !== null ? args[idx] : match; }); } var icon = {}; var icon_color = '#1fbc45'; var icon_args = function (viewBox) { viewBox = viewBox || '0 0 1024 1024'; return { viewBox: viewBox, className: 'svg-icon', xmlns: xmlns, }; }; var xmlns = 'http://www.w3.org/2000/svg'; icon.legacy = el( 'svg', { width: '16px', height: '16px', viewBox: '0 0 80 90', className: 'svg-icon mb10', xmlns: xmlns, fillRule: 'evenodd', clipRule: 'evenodd', strokeLinejoin: 'round', strokeMiterlimit: '1.414', }, el( 'g', { fillRule: 'nonzero', transform: 'scale(0.19785394)', }, el('path', { d: 'm 408.68862,333.8044 0.009,0.59315 0.004,0.29795 c 0.18694,71.91774 -59.58485,130.93907 -134.53126,132.29044 -0.85543,0.0154 -1.71097,0.0231 -2.56654,0.0231 H 21.034693 C 11.007191,467.00905 2.5761396,460.42672 0.14656613,451.50411 L 338.63176,215.013 c 45.60925,25.97569 68.96153,65.57282 70.05686,118.7914 z M 231.25625,0 C 278.01331,0 321.188,23.909861 344.73248,62.682399 L 0,303.53751 V 20.793975 C 0,9.3097796 9.6674353,0 21.592821,0 Z', fill: icon_color, }) ) ); icon.productbox = el( 'svg', icon_args(), el('path', { d: 'M975.36 400.64A88.32 88.32 0 0 0 887.68 320h-57.6c0-176.64-142.72-320-318.08-320-175.36 0-318.08 143.36-318.08 320h-57.6c-45.44 0-83.2 34.56-87.68 80.64l-44.16 446.08c-4.48 45.44 10.24 90.88 40.96 124.8 30.08 33.28 72.96 52.48 118.4 52.48h696.32c45.44 0 88.96-19.2 119.04-53.12 30.08-33.92 45.44-79.36 40.96-124.8l-44.8-445.44zM512 64c140.16 0 254.08 114.56 254.08 256H257.92c0-141.44 113.92-256 254.08-256z m419.84 864c-18.56 20.48-44.16 32-71.68 32H163.84c-27.52 0-53.12-11.52-71.68-32-18.56-20.48-27.52-47.36-24.96-75.52l44.16-446.08c1.28-12.8 12.16-22.4 24.96-22.4h57.6v96c0 17.92 14.08 32 32 32 17.28 0 32-14.08 32-32V384h508.8v96c0 17.92 14.08 32 32 32 17.28 0 32-14.08 32-32V384h57.6c12.8 0 23.68 9.6 24.96 22.4l44.16 446.08c1.92 28.16-7.04 54.4-25.6 75.52z', fill: icon_color, }), el('path', { d: 'M752 679.04a536.768 536.768 0 0 1-480 0 31.744 31.744 0 0 0-42.88 14.08c-7.68 16-1.28 35.2 14.08 42.88 83.84 42.24 176.64 63.36 268.8 63.36 92.16 0 184.32-21.12 268.8-63.36 16-7.68 21.76-26.88 14.08-42.88a31.744 31.744 0 0 0-42.88-14.08z', fill: icon_color, }) ); icon.video = el( 'svg', icon_args(), el('path', { d: 'M704 874.666667H128c-46.933333 0-85.333333-38.4-85.333333-85.333334V234.666667c0-46.933333 38.4-85.333333 85.333333-85.333334h576c46.933333 0 85.333333 38.4 85.333333 85.333334v554.666666c0 46.933333-38.4 85.333333-85.333333 85.333334zM128 213.333333c-12.8 0-21.333333 8.533333-21.333333 21.333334v554.666666c0 12.8 8.533333 21.333333 21.333333 21.333334h576c12.8 0 21.333333-8.533333 21.333333-21.333334V234.666667c0-12.8-8.533333-21.333333-21.333333-21.333334H128z', fill: icon_color, }), el('path', { d: 'M277.333333 490.666667c-59.733333 0-106.666667-46.933333-106.666666-106.666667s46.933333-106.666667 106.666666-106.666667 106.666667 46.933333 106.666667 106.666667-46.933333 106.666667-106.666667 106.666667z m0-149.333334c-23.466667 0-42.666667 19.2-42.666666 42.666667s19.2 42.666667 42.666666 42.666667 42.666667-19.2 42.666667-42.666667-19.2-42.666667-42.666667-42.666667zM938.666667 800c-8.533333 0-14.933333-2.133333-21.333334-6.4L725.333333 682.666667V341.333333l192-110.933333c10.666667-6.4 21.333333-6.4 32-4.266667 10.666667 2.133333 21.333333 8.533333 25.6 19.2 4.266667 6.4 6.4 14.933333 6.4 21.333334v490.666666c0 23.466667-19.2 42.666667-42.666666 42.666667z m-149.333334-153.6l128 74.666667V302.933333l-128 74.666667v268.8z', fill: icon_color, }) ); icon.iframe = el( 'svg', icon_args(), el('path', { d: 'M885.76 52.053333h-364.8c-47.786667 0-86.186667 38.826667-86.186667 86.186667v82.346667H139.093333c-48.213333 0-87.466667 39.253333-87.466666 87.04v576.426666c0 48.213333 39.253333 87.466667 87.466666 87.466667h576.426667c48.213333 0 87.04-39.253333 87.04-87.466667v-294.826666h82.773333c47.786667 0 86.186667-38.826667 86.186667-86.186667V138.666667c0.426667-47.786667-37.973333-86.613333-85.76-86.613334z m-151.04 832.426667c0 10.666667-8.533333 19.2-19.2 19.2H139.093333c-10.666667 0-19.2-8.533333-19.2-19.2V308.053333c0-10.666667 8.533333-19.2 19.2-19.2h295.253334v214.186667c0 12.373333 2.56 24.32 7.68 34.986667L255.146667 725.333333v-68.693333c0-18.773333-15.36-34.133333-34.133334-34.133333s-34.133333 15.36-34.133333 34.133333v151.04a33.109333 33.109333 0 0 0 9.386667 23.466667c0.426667 0.426667 0.426667 0.426667 0.426666 0.853333 0.426667 0.426667 0.853333 0.426667 1.28 0.853333 2.986667 2.56 5.973333 5.12 9.813334 6.4 4.266667 1.706667 8.533333 2.56 13.226666 2.56h151.04c18.773333 0 34.133333-15.36 34.133334-34.133333s-15.36-34.133333-34.133334-34.133333H303.36l189.013333-189.013334c8.96 2.986667 18.346667 5.12 28.586667 5.12h213.76v294.826667z m168.96-381.013333c0 9.813333-8.106667 17.92-17.92 17.92h-364.8c-9.813333 0-17.92-8.106667-17.92-17.92V138.666667c0-9.813333 8.106667-17.92 17.92-17.92h364.8c9.813333 0 17.92 8.106667 17.92 17.92v364.8z', fill: icon_color, }) ); icon.iframeseries = el( 'svg', icon_args(), el('path', { d: 'm 662.88377,441.87421 a 42.666667,42.666667 0 0 1 -72.87235,-31.63569 l 7.28782,-180.63176 a 43.235556,43.235556 0 0 1 42.55618,-42.72389 42.666667,42.666667 0 0 1 42.72388,42.55617 l -7.2815,183.84988 a 40.96,40.96 0 0 1 -12.41403,28.58529 z', fill: icon_color, }), el('path', { d: 'm 843.88852,434.27746 a 42.097778,42.097778 0 0 1 -28.53625,12.52636 l -181.00475,7.59675 a 42.666667,42.666667 0 0 1 -4.18877,-84.46761 l 180.60327,-7.19369 a 42.666667,42.666667 0 0 1 32.32355,72.34431 z', fill: icon_color, }), el('path', { d: 'M 873.65726,230.27007 662.88377,441.87421 a 42.666668,42.666668 0 0 1 -60.45832,-60.221 L 813.19894,170.04908 a 42.666667,42.666667 0 0 1 60.45832,60.22099 z', fill: icon_color, }), el('path', { d: 'm 922.2479,554.42362 0.64665,328.81714 a 42.097778,42.097778 0 0 1 -42.58268,42.75049 l -735.00302,1.44546 a 42.097778,42.097778 0 0 1 -42.75049,-42.58267 l -1.17919,-599.60773 a 42.666667,42.666667 0 0 1 42.58268,-42.75049 l 302.6483,-0.59519 a 42.666667,42.666667 0 1 1 0.16782,85.33316 l -259.98172,0.51129 1.00689,511.99901 649.66986,-1.27765 -0.55939,-284.44389 a 42.666667,42.666667 0 1 1 85.33317,-0.16782 z', fill: icon_color, }), el('path', { d: 'm 705.18337,682.28186 a 42.097778,42.097778 0 0 1 -42.58268,42.75049 l -341.33267,0.67126 a 42.666667,42.666667 0 0 1 -0.16782,-85.33316 l 341.33268,-0.67127 a 42.666667,42.666667 0 0 1 42.75049,42.58268 z M 534.15231,497.16007 a 42.097778,42.097778 0 0 1 -42.58268,42.75049 L 320.9033,540.2462 a 42.666667,42.666667 0 1 1 -0.16782,-85.33317 l 170.66634,-0.33564 a 42.666667,42.666667 0 0 1 42.75049,42.58268 z', fill: icon_color, }) ); icon.feature = el( 'svg', icon_args(), el('path', { d: 'M833.176 606.564c37.737-60.688 59.927-131.977 59.927-208.47 0-218.921-178.605-397.021-398.09-397.021-219.534 0-398.178 178.1-398.178 397.021 0 87.873 29.126 168.877 77.787 234.72L30.118 883.48l156.358 11.582L275.333 1024l136.88-237.615c26.767 5.693 54.414 8.782 82.806 8.782 38.717 0 76.062-5.787 111.49-16.139L747.663 1024l88.858-128.938 156.314-11.582-159.659-276.916zM362.37 772.156L271.496 929.8l-57.172-83.017-100.66-7.458 95.25-165.296c0.79 0.832 1.719 1.474 2.509 2.307 9.742 9.86 19.876 19.33 30.555 28.111 2.364 1.917 4.918 3.581 7.283 5.448 8.902 6.966 18.004 13.636 27.45 19.872 3.641 2.401 7.384 4.463 11.07 6.72 9.104 5.542 18.353 10.794 27.9 15.603 3.002 1.57 6.05 2.995 9.154 4.414a397.407 397.407 0 0 0 34.93 14.575c0.885 0.342 1.72 0.782 2.605 1.078z m43.495-39.2a355.38 355.38 0 0 1-51.657-18.007 8.63 8.63 0 0 0-0.79-0.346c-15.4-6.822-30.112-14.916-44.236-23.843-1.62-1.035-3.344-1.967-4.92-2.995-13.377-8.731-26.027-18.592-38.076-29.146a321.702 321.702 0 0 1-7.632-6.916c-11.853-10.988-23.17-22.664-33.55-35.424-48.562-59.66-77.789-135.564-77.789-218.185 0-191.2 156.018-346.781 347.799-346.781 191.737 0 347.704 155.58 347.704 346.781 0 73.108-22.88 140.862-61.749 196.844-8.705 12.509-18.347 24.336-28.633 35.57-2.263 2.503-4.426 5.006-6.74 7.408-11.461 11.826-23.669 22.916-36.655 33.023-1.379 1.078-2.807 2.06-4.185 3.139-28.487 21.441-60.174 38.76-94.022 50.682-1.72 0.587-3.394 1.273-5.115 1.865l-8.611 2.995a347.098 347.098 0 0 1-101.994 15.307c-30.847 0-60.662-4.42-89.149-11.972z m402.807 113.826l-57.17 83.017-96.925-168.19c13.58-5.938 26.711-12.76 39.457-20.167 1.625-0.934 3.198-1.917 4.773-2.895 10.773-6.43 21.154-13.346 31.193-20.703a354.339 354.339 0 0 0 7.971-5.94c8.657-6.67 16.925-13.686 24.992-21.05 3.15-2.843 6.298-5.542 9.345-8.435 7.53-7.313 14.616-15.011 21.507-22.86 2.36-2.654 5.064-5.006 7.327-7.754L909.29 839.324l-100.617 7.458z', fill: icon_color, }), el('path', { d: 'M654.672 637.872l-30.548-177.414 129.3-125.559-178.65-25.904-79.71-161.369-79.95 161.369-178.693 25.904 129.343 125.56-30.503 177.361 159.753-83.753 159.658 83.805z m-309.915-267.94l103.814-15.016 46.398-93.76 46.347 93.76 103.765 15.017L570 442.889l17.76 103.033-92.74-48.671-92.845 48.721 17.713-103.083-75.13-72.956z', fill: icon_color, }) ); icon.biaoti = el( 'svg', icon_args(), el('path', { d: 'M203.127 1023.991a143.334 143.334 0 0 1-109.74-49.27 154.98 154.98 0 0 1-38.073-100.782V160.854A165.73 165.73 0 0 1 225.074 0.052h573.783a165.73 165.73 0 0 1 169.76 160.802V873.94a139.302 139.302 0 0 1-6.718 44.792 137.063 137.063 0 0 1-91.823 92.27 154.532 154.532 0 0 1-143.334-25.978L583.857 873.49a89.584 89.584 0 0 0-105.261-4.479L290.023 997.564a158.115 158.115 0 0 1-86.896 26.427z m21.948-961.23a102.573 102.573 0 0 0-106.605 98.093V873.94a89.584 89.584 0 0 0 22.396 60.021 86.448 86.448 0 0 0 113.771 11.646L443.211 817.5a151.396 151.396 0 0 1 179.167 6.72L763.472 936.2a93.167 93.167 0 0 0 85.552 15.229 77.938 77.938 0 0 0 52.406-51.959 83.76 83.76 0 0 0 3.584-25.53V160.853A102.573 102.573 0 0 0 798.857 62.76zM377.367 152.344h268.75q44.792 0 44.792 44.792 0 44.791-44.792 44.791h-268.75q-44.792 0-44.792-44.791 0-44.792 44.792-44.792z', fill: icon_color, }) ); icon.postsbox = el( 'svg', icon_args(), el('path', { d: 'M544.256 887.97866668c-9.728 0-19.456-2.56-28.16-8.192-16.896-10.24-27.136-28.16-26.624-48.128V269.99466668c0-24.576 13.824-47.616 35.84-58.368 117.76-60.416 260.608-90.112 423.936-87.04 35.84 1.024 65.024 30.208 65.024 66.048V731.30666668c0 33.792-25.088 61.44-58.88 65.024l-20.992 2.56c-141.312 15.36-263.168 29.184-364.032 82.944-8.192 4.096-17.408 6.144-26.112 6.144zM928.768 175.78666668c-146.432 0-274.432 27.648-380.416 81.92-4.608 2.56-7.68 7.168-7.68 12.8v562.688c0 1.536 0.512 2.56 2.048 3.584s2.56 0.512 3.072 0h0.512c109.568-58.368 236.032-72.192 382.976-88.576l20.992-2.56c7.68-0.512 13.312-6.656 13.312-13.824V190.63466668c0-8.192-6.656-14.848-14.848-14.848h-19.968z', fill: icon_color, }), el('path', { d: 'M487.424 889.51466668c-8.704 0-17.408-2.048-25.6-6.656C358.4 827.05066668 232.448 813.73866668 87.04 797.86666668l-13.312-1.536c-33.28-3.072-58.368-30.72-58.368-64.512V191.14666668c0-35.328 29.184-65.024 65.024-66.048 163.84-2.56 306.688 26.624 424.448 87.552 21.504 10.752 35.328 33.792 35.328 57.856V836.26666668c0 18.944-9.728 36.352-26.112 46.08-8.192 4.608-17.408 7.168-26.624 7.168z m-386.56-713.216H81.408c-8.192 0-14.848 6.656-14.848 14.848v540.672c0 7.168 5.632 13.312 12.8 13.824l13.312 1.536c151.04 15.872 281.088 30.208 393.728 90.624h0.512c0.512 0.512 1.024 0.512 1.536 0s1.024-1.024 1.024-1.536V270.50666668c0-5.12-3.072-10.24-7.168-12.288-106.496-54.784-234.496-81.92-381.44-81.92z', fill: icon_color, }), el('path', { d: 'M386.56 416.93866668c-3.072 0-6.656-0.512-9.728-2.048-67.584-27.136-136.704-40.96-204.288-40.96-14.336 0-25.6-11.264-25.6-25.6s11.264-25.6 25.6-25.6c74.24 0 149.504 14.848 223.744 45.056 13.312 5.12 19.456 19.968 14.336 33.28-4.096 9.728-13.824 15.872-24.064 15.872z m0 171.52c-3.072 0-6.656-0.512-9.728-2.048-67.584-27.136-136.704-40.96-204.288-40.96-14.336 0-25.6-11.264-25.6-25.6s11.264-25.6 25.6-25.6c74.24 0 149.504 14.848 223.744 45.056 13.312 5.12 19.456 19.968 14.336 33.28-4.096 9.728-13.824 15.872-24.064 15.872z m256.512-171.52c-10.24 0-19.968-6.144-23.552-15.872-5.12-13.312 1.024-28.16 14.336-33.28 73.728-29.696 148.992-45.056 223.744-45.056 14.336 0 25.6 11.264 25.6 25.6s-11.264 25.6-25.6 25.6c-68.096 0-136.704 13.824-204.288 40.96-3.584 1.536-7.168 2.048-10.24 2.048z m0 171.52c-10.24 0-19.968-6.144-23.552-15.872-5.12-13.312 1.024-28.16 14.336-33.28 73.728-29.696 148.992-45.056 223.744-45.056 14.336 0 25.6 11.264 25.6 25.6s-11.264 25.6-25.6 25.6c-68.096 0-136.704 13.824-204.288 40.96-3.584 1.536-7.168 2.048-10.24 2.048z', fill: icon_color, }) ); icon.postslists = el( 'svg', icon_args(), el('path', { d: 'M154 63c38.585-3.549 87.825-1 131-1h324c21.986 0 46.771-2.819 66 0 11.027 1.617 26.985 22.985 38 34 70.388 70.388 142.474 141.474 215 214 11.001 11.001 31.66 25.64 34 37 4.283 20.798 0 51.069 0 73 0 147.213 2.939 289.276 0 438-1.354 68.465-45.274 104-114 104H265c-47.349 0-105.861 6.086-139-7-35.031-13.833-58.411-40.73-63-83-4.718-43.462-1-90.155-1-144V217c0-22.874-2.529-48.263 1-71 7.309-47.087 44.564-78.729 91-83z m-12 128v598c0 25.297-4.657 76.62 5 87 10.792 11.601 61.731 6 86 6h555c24.86 0 76.86 5.363 88-5 9.054-8.424 6-40.445 6-60V442c0-21.463 3.845-47.044 0-63-2.278-9.453-19.905-22.905-28-31-61.891-61.891-119.072-117.072-180-178-9.53-9.53-21.852-26.199-32-28-16.563-2.939-39.449 0-60 0H219c-20.042 0-48.823-2.389-62 1-18.908 4.862-15 23.169-15 48zM237 249c25.855-3.795 59.35-1 86-1h212c34.246 0 63 4.409 63 40 0 48.994-57.106 40-110 40H311c-52.225 0-111.121 9.443-109-42 0.828-20.071 15.229-34.098 35-37zM237 474c41.5-6.092 97.15-1 142-1h352c23.335 0 50.952-3.611 67 3 31.346 12.914 28.819 62.127 0 74-14.449 5.953-46.639 3-70 3H292c-46.79 0-91.773 4.328-90-42 0.76-19.867 15.16-34.087 35-37zM237 698c41.5-6.092 97.15-1 142-1h352c23.335 0 50.952-3.611 67 3 31.346 12.914 28.819 62.127 0 74-14.449 5.953-46.639 3-70 3H292c-46.79 0-91.773 4.328-90-42 0.76-19.867 15.16-34.088 35-37z', fill: icon_color, }) ); icon.enlighter = el( 'svg', icon_args(), el('path', { d: 'M512 0a512 512 0 1 1 0 1024A512 512 0 0 1 512 0z m0 73.142857a438.857143 438.857143 0 1 0 0 877.714286A438.857143 438.857143 0 0 0 512 73.142857z m50.834286 150.674286a36.571429 36.571429 0 0 1 29.622857 42.422857l-88.868572 504.246857a36.571429 36.571429 0 0 1-72.045714-12.726857l88.868572-504.246857a36.571429 36.571429 0 0 1 42.422857-29.622857zM341.430857 382.317714a36.571429 36.571429 0 0 1 0 51.785143l-77.531428 77.531429 77.531428 77.531428a36.571429 36.571429 0 0 1-51.712 51.785143L186.221714 537.453714a36.571429 36.571429 0 0 1 0-51.712l103.497143-103.497143a36.571429 36.571429 0 0 1 51.712 0z m388.827429-4.169143l5.12 4.169143 103.424 103.497143a36.571429 36.571429 0 0 1 4.242285 46.665143l-4.242285 5.046857-103.424 103.424a36.571429 36.571429 0 0 1-55.954286-46.665143l4.169143-5.12 77.604571-77.531428-77.531428-77.531429a36.571429 36.571429 0 0 1 46.592-55.954286z', fill: icon_color, }) ); icon.buttons = el( 'svg', icon_args(), el('path', { d: 'M769 468.7c5.5-22.1 11.1-49.7 11.1-77.4 0-44.2-11.1-88.4-27.6-127.1-16.6-38.7-38.7-71.9-71.9-105-27.6-27.6-60.8-49.7-99.5-66.3-38.7-16.6-82.9-27.7-127.1-27.7s-88.4 11.1-127.1 27.6-77.4 38.7-105 71.9c-27.6 27.6-55.3 66.3-71.9 105s-22.1 77.4-22.1 127.1c0 38.7 5.5 71.9 16.6 105 11.1 33.2 27.6 60.8 49.7 88.4s44.2 49.7 77.4 71.9c27.6 22.1 60.8 33.2 94 44.2V584.8c-38.7-16.6-66.3-44.2-88.4-77.4-22.1-33.2-33.2-71.9-33.2-110.6 0-27.6 5.5-55.3 16.6-82.9s27.6-49.7 44.2-66.3c16.6-22.1 38.7-33.2 66.3-44.2 27.6-11.1 55.3-16.6 82.9-16.6s55.3 5.5 82.9 16.6c22.1 11.1 44.2 22.1 60.8 44.2 16.6 16.6 33.2 38.7 44.2 66.3 11.1 27.6 16.6 55.3 16.6 82.9v5.5c0 0.1 110.5 66.4 110.5 66.4z', fill: icon_color, }), el('path', { d: 'M426.3 866.7c11.1-16.6 27.6-33.2 44.2-49.7 11.1-11.1 27.6-27.6 49.7-44.2 16.6-16.6 38.7-27.6 60.8-44.2L669.5 922c11.1 16.6 22.1 27.6 44.2 33.2 16.6 5.5 38.7 5.5 55.3-5.5 16.6-11.1 27.6-22.1 33.2-44.2 5.5-16.6 5.5-38.7-5.5-55.3L686.1 684.3c27.6-5.5 49.7-11.1 77.4-16.6 27.6-5.5 49.7-5.5 66.3-5.5h66.3L420.8 291.8l5.5 574.9z', fill: icon_color, }) ); icon.tabs = el( 'svg', icon_args(), el('path', { d: 'M420.608 489.984a15.104 15.104 0 0 1 4.864 11.776 14.848 14.848 0 0 1-4.864 11.776 17.664 17.664 0 0 1-12.288 4.352h-44.288V665.6a15.104 15.104 0 0 1-5.376 12.032 18.176 18.176 0 0 1-13.056 5.12 17.664 17.664 0 0 1-13.056-5.12 15.872 15.872 0 0 1-5.12-12.032v-147.712h-44.032a16.64 16.64 0 0 1-12.288-4.608 14.848 14.848 0 0 1-4.864-11.776 14.848 14.848 0 0 1 4.864-11.52 17.152 17.152 0 0 1 12.288-4.352H409.6a16.384 16.384 0 0 1 11.008 4.352zM557.824 534.016a15.872 15.872 0 0 1 4.864 12.288V665.6a15.616 15.616 0 0 1-4.864 12.032 15.872 15.872 0 0 1-12.032 5.12 16.64 16.64 0 0 1-12.032-4.864 17.664 17.664 0 0 1-4.864-12.032 61.952 61.952 0 0 1-44.032 19.712 64.512 64.512 0 0 1-35.328-9.984 69.376 69.376 0 0 1-25.6-27.904 92.16 92.16 0 0 1 0-80.384 67.072 67.072 0 0 1 25.6-27.904 61.696 61.696 0 0 1 34.304-9.984 66.816 66.816 0 0 1 45.312 17.408 16.64 16.64 0 0 1 4.864-12.288 17.408 17.408 0 0 1 24.064 0zM518.912 640a55.04 55.04 0 0 0 0-67.328 36.864 36.864 0 0 0-29.952-13.568 36.352 36.352 0 0 0-29.44 13.568 51.2 51.2 0 0 0-11.52 33.536 51.2 51.2 0 0 0 11.264 33.792 37.632 37.632 0 0 0 29.696 13.312 38.4 38.4 0 0 0 29.952-13.312zM712.448 539.136a70.4 70.4 0 0 1 25.6 27.648 86.016 86.016 0 0 1 9.216 40.192 87.04 87.04 0 0 1-9.216 40.448 68.608 68.608 0 0 1-25.6 27.904 61.696 61.696 0 0 1-34.304 9.984 57.6 57.6 0 0 1-25.6-5.632 61.952 61.952 0 0 1-19.712-13.312v1.792a16.64 16.64 0 0 1-16.896 17.152 15.616 15.616 0 0 1-12.032-4.864 16.128 16.128 0 0 1-4.864-12.288v-176.64a16.64 16.64 0 0 1 4.864-12.288 17.408 17.408 0 0 1 24.064 0 16.64 16.64 0 0 1 4.864 12.288v58.624a55.296 55.296 0 0 1 18.688-14.592 53.248 53.248 0 0 1 25.6-6.4 64.512 64.512 0 0 1 35.328 9.984z m-9.984 102.4a51.2 51.2 0 0 0 11.52-33.792 51.2 51.2 0 0 0-11.264-33.536 40.192 40.192 0 0 0-59.648 0 55.04 55.04 0 0 0 0 67.328 37.632 37.632 0 0 0 29.952 13.568 37.12 37.12 0 0 0 29.44-15.104zM857.088 337.408V281.6a76.8 76.8 0 0 0-76.8-76.8H402.176a76.8 76.8 0 0 0-57.088-25.6H206.336a76.8 76.8 0 0 0-76.8 76.8v512a76.8 76.8 0 0 0 76.8 76.8h622.592a76.8 76.8 0 0 0 76.8-76.8V409.6a76.8 76.8 0 0 0-48.64-72.192z m-51.2-56.576v51.2h-153.6V281.6a76.8 76.8 0 0 0-4.608-25.6h132.608a25.6 25.6 0 0 1 25.6 25.6z m-230.4-25.6a25.6 25.6 0 0 1 25.6 25.6v51.2h-179.2V256z m279.04 512a25.6 25.6 0 0 1-25.6 25.6H206.336a25.6 25.6 0 0 1-25.6-25.6V256a25.6 25.6 0 0 1 25.6-25.6h138.752a25.6 25.6 0 0 1 25.6 25.6v102.4a25.6 25.6 0 0 0 25.6 25.6h432.64a25.6 25.6 0 0 1 25.6 25.6z', fill: icon_color, }) ); icon.featured = el( 'svg', icon_args(), el('path', { d: 'M879.488423 92.01323c80.158765 0 145.076075 64.91731 145.076075 145.076075v550.385888c0 80.158765-64.91731 145.076075-145.076075 145.076075H145.076075C64.91731 931.98677 0 867.06946 0 786.910695V237.089305c0-80.158765 64.91731-145.076075 145.076075-145.076075h734.412348z m76.207277 284.507167H68.3043v410.954796c0 41.772878 33.305402 75.642778 75.07828 76.207277H878.923925c41.772878 0 75.642778-33.305402 76.207277-75.07828v-1.128997l0.564498-410.954796zM441.437707 461.759647c3.951488 0 7.338479 1.128997 10.725468 2.822492l205.477398 122.496141c10.16097 6.209482 13.54796 18.628445 7.338479 28.789416-1.693495 2.822492-4.515987 5.644983-7.338479 7.338478L452.163175 745.137817c-10.16097 6.209482-23.144432 2.822492-28.789415-7.338479-1.693495-3.38699-2.822492-6.77398-2.822492-10.725468V482.646086c0-11.289967 9.596472-20.886439 20.886439-20.886439zM68.3043 235.39581V307.651599h101.609702L75.642778 204.9129c-4.515987 9.596472-6.77398 20.32194-7.338478 30.48291z m811.184123-75.07828h-95.964718L910.535832 304.829107c0.564498 1.128997 1.693495 1.693495 2.257994 2.822492h43.466372V237.089305c0-41.772878-33.305402-75.642778-75.07828-76.207276l-1.693495-0.564499z m-187.413451 0h-125.318632l125.318632 145.076075c0.564498 0.564498 1.128997 1.693495 1.693495 2.257994h127.576627l-129.270122-147.334069z m-216.202866 0H353.375965l125.318633 145.076075c0.564498 0.564498 1.128997 1.693495 1.693495 2.257994h123.060639c0 0.564498-127.576626-147.334068-127.576626-147.334069z m-212.815877 0H145.076075c-5.080485 0-10.16097 0.564498-15.241455 1.693495l132.092613 143.947079 1.693495 1.693495h127.576626L263.056229 160.31753z', fill: icon_color, }) ); icon.download = el( 'svg', icon_args(), el('path', { d: 'M543.6 825.3H131.3c-28 0-50.7-22.8-50.7-50.7V141c0-29.9 24.3-54.2 54.2-54.2h126.3c25.1 0 46.6 17.9 51.2 42.6l20.9 111.9c11.7 62.6 66.4 108 130.1 108h385.6c29.9 0 54.2 24.3 54.2 54.3V476c0 22.2 18 40.3 40.3 40.3 22.2 0 40.3-18 40.3-40.3v-72.4c0-74.3-60.5-134.8-134.8-134.8H463.3c-24.9 0-46.3-17.8-50.9-42.3l-20.9-111.9C379.8 51.7 324.9 6.2 261.1 6.2H134.8C60.5 6.2 0 66.7 0 141v633.6C0 847 58.9 905.9 131.3 905.9h412.4c22.2 0 40.3-18 40.3-40.3-0.1-22.3-18.1-40.3-40.4-40.3z', fill: icon_color, }), el('path', { d: 'M560.1 140.4h338.3c22.2 0 40.3-18 40.3-40.3 0-22.2-18-40.3-40.3-40.3H560.1c-22.2 0-40.3 18-40.3 40.3 0 22.3 18 40.3 40.3 40.3zM1014.6 828c-12.6-12.6-33-12.6-45.6 0l-95.4 95.4V605.5c0-17.8-14.4-32.2-32.2-32.2s-32.2 14.4-32.2 32.2v317.9L713.8 828c-12.6-12.6-33-12.6-45.6 0s-12.6 33 0 45.6l123.9 123.9c13.1 13.1 30.1 19.8 47.3 20.3 0.6 0 1.3 0.1 1.9 0.1 0.6 0 1.3 0 1.9-0.1 17.2-0.5 34.3-7.2 47.3-20.3l123.9-123.9c12.7-12.7 12.7-33 0.2-45.6z', fill: icon_color, }) ); icon.seamlessimg = el( 'svg', icon_args(), el('path', { d: 'M551.36 124.16a36.608 36.608 0 0 1 0 71.68L544 196.48H132.48v458.24l126.336-303.104 2.24-4.544a36.608 36.608 0 0 1 62.784-0.192l80 133.312 41.152-61.632 5.184-6.272a36.672 36.672 0 0 1 51.072 0.64l73.088 73.152 4.736 5.76a36.544 36.544 0 0 1-50.624 50.624l-5.76-4.672-41.6-41.6-48.384 72.576a36.672 36.672 0 0 1-61.824-1.408L298.496 446.592l-155.008 372.096c-0.704 1.728-1.728 3.328-2.688 4.928h403.2l7.36 0.768a36.672 36.672 0 0 1 0 71.68l-7.36 0.704H131.968A72.576 72.576 0 0 1 59.52 824.32V195.968c0-40.064 32.448-72.512 72.512-72.576H544l7.36 0.768zM921.664 824.32a36.608 36.608 0 0 1 0 71.68l-7.36 0.704h-219.456a36.544 36.544 0 1 1 0-73.088h219.456l7.36 0.768zM921.664 649.344a36.608 36.608 0 0 1 0 71.68l-7.36 0.704h-219.456a36.544 36.544 0 1 1 0-73.152h219.456l7.36 0.768zM921.664 474.368a36.608 36.608 0 0 1 0 71.616l-7.36 0.768h-219.456a36.544 36.544 0 1 1 0-73.152h219.456l7.36 0.768zM921.664 299.328a36.608 36.608 0 0 1 0 71.68l-7.36 0.704h-219.456a36.544 36.544 0 1 1 0-73.088h219.456l7.36 0.704zM921.664 124.352a36.608 36.608 0 0 1 0 71.68l-7.36 0.704h-219.456a36.544 36.544 0 1 1 0-73.152h219.456l7.36 0.768z', fill: icon_color, }) ); icon.modal = el( 'svg', icon_args(), el('path', { d: 'M654.601 708.8a36.965 36.965 0 0 0 26.158-10.843 37.047 37.047 0 0 0 10.843-26.186V434.47H454.555a36.992 36.992 0 0 0-32.594 18.322 37.074 37.074 0 0 0 0 37.422 36.992 36.992 0 0 0 32.594 18.322H565.33l-44.525 44.58L365.239 708.92a37.056 37.056 0 0 0 16.274 62.574 36.955 36.955 0 0 0 36.023-10.222L573.23 605.403l44.489-44.544v110.912A37.01 37.01 0 0 0 654.6 708.8z m313.92-450.834h-0.393V227.84c0-95.131-77.76-172.983-172.846-172.983H227.657c-95.049 0-172.8 77.852-172.8 172.983v568.265c0 95.186 77.751 172.983 172.8 172.983h567.625c95.086 0 172.8-77.833 172.8-172.983v-209.92a38.162 38.162 0 0 0-38.034-37.202 38.162 38.162 0 0 0-38.034 37.211v209.92c-0.247 53.385-43.401 96.604-96.732 96.878H227.657c-53.321-0.274-96.484-43.493-96.731-96.887V331.547H968.53v-73.581z m-76.452 0H130.926V227.84c0.274-53.367 43.42-96.558 96.731-96.832h567.625c53.312 0.274 96.457 43.465 96.732 96.832l0.055 30.126z m-80.951-82.368H475.246c-9.847 0-17.93 8.411-17.93 18.679v3.291c0 10.267 8.083 18.679 17.93 18.679h335.872c9.856 0 17.929-8.412 17.929-18.688v-3.282c0-10.268-8.073-18.68-17.93-18.68z m-488.85-2.643a22.994 22.994 0 0 0-16.22 39.223 22.93 22.93 0 0 0 39.168-16.256 22.967 22.967 0 0 0-22.949-22.967z m69.522 0a22.994 22.994 0 0 0-16.22 39.223 22.93 22.93 0 0 0 39.177-16.256 22.985 22.985 0 0 0-22.976-22.967h0.019z', fill: icon_color, }) ); icon.headingLevel1 = el( 'svg', { xmlns: xmlns, viewBox: '0 0 24 24', }, el('path', { d: 'M17.6 7c-.6.9-1.5 1.7-2.6 2v1h2v7h2V7h-1.4zM11 11H7V7H5v10h2v-4h4v4h2V7h-2v4z', }) ); icon.headingLevel2 = el( 'svg', { xmlns: xmlns, viewBox: '0 0 24 24', }, el('path', { d: 'M9 11.1H5v-4H3v10h2v-4h4v4h2v-10H9v4zm8 4c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6v1.5h8v-2H17z', }) ); icon.headingLevel3 = el( 'svg', { xmlns: xmlns, viewBox: '0 0 24 24', }, el('path', { d: 'M9 11H5V7H3v10h2v-4h4v4h2V7H9v4zm11.3 1.7c-.4-.4-1-.7-1.6-.8v-.1c.6-.2 1.1-.5 1.5-.9.3-.4.5-.8.5-1.3 0-.4-.1-.8-.3-1.1-.2-.3-.5-.6-.8-.8-.4-.2-.8-.4-1.2-.5-.6-.1-1.1-.2-1.6-.2-.6 0-1.3.1-1.8.3s-1.1.5-1.6.9l1.2 1.4c.4-.2.7-.4 1.1-.6.3-.2.7-.3 1.1-.3.4 0 .8.1 1.1.3.3.2.4.5.4.8 0 .4-.2.7-.6.9-.7.3-1.5.5-2.2.4v1.6c.5 0 1 0 1.5.1.3.1.7.2 1 .3.2.1.4.2.5.4s.1.4.1.6c0 .3-.2.7-.5.8-.4.2-.9.3-1.4.3s-1-.1-1.4-.3c-.4-.2-.8-.4-1.2-.7L13 15.6c.5.4 1 .8 1.6 1 .7.3 1.5.4 2.3.4.6 0 1.1-.1 1.6-.2.4-.1.9-.2 1.3-.5.4-.2.7-.5.9-.9.2-.4.3-.8.3-1.2 0-.6-.3-1.1-.7-1.5z', }) ); icon.headingLevel4 = el( 'svg', { xmlns: xmlns, viewBox: '0 0 24 24', }, el('path', { d: 'M20 13V7h-3l-4 6v2h5v2h2v-2h1v-2h-1zm-2 0h-2.8L18 9v4zm-9-2H5V7H3v10h2v-4h4v4h2V7H9v4z', }) ); icon.headingLevel5 = el( 'svg', { xmlns: xmlns, viewBox: '0 0 24 24', }, el('path', { d: 'M9 11H5V7H3v10h2v-4h4v4h2V7H9v4zm11.7 1.2c-.2-.3-.5-.7-.8-.9-.3-.3-.7-.5-1.1-.6-.5-.1-.9-.2-1.4-.2-.2 0-.5.1-.7.1-.2.1-.5.1-.7.2l.1-1.9h4.3V7H14l-.3 5 1 .6.5-.2.4-.1c.1-.1.3-.1.4-.1h.5c.5 0 1 .1 1.4.4.4.2.6.7.6 1.1 0 .4-.2.8-.6 1.1-.4.3-.9.4-1.4.4-.4 0-.9-.1-1.3-.3-.4-.2-.7-.4-1.1-.7 0 0-1.1 1.4-1 1.5.5.4 1 .8 1.6 1 .7.3 1.5.4 2.3.4.5 0 1-.1 1.5-.3s.9-.4 1.3-.7c.4-.3.7-.7.9-1.1s.3-.9.3-1.4-.1-1-.3-1.4z', }) ); var colors = [ { color: '#fb2121', }, { color: '#ef0c7e', }, { color: '#F3AC07', }, { color: '#8CA803', }, { color: '#64BD05', }, { color: '#11C33F', }, { color: '#08B89A', }, { color: '#09ACE2', }, { color: '#1F91F3', }, { color: '#3B6ED5', }, { color: '#664FFA', }, { color: '#A845F7', }, { color: '#333', }, { color: '#666', }, { color: '#999', }, { color: '#f8f8f8', }, ]; function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } function help_link(link, text) { text = text || i18n__('gutenberg_view_official_tutorial'); var url = '""'; //如果传入的是数字 if (typeof link == 'number') { link = url + link + '.html'; } else if (link.indexOf('http') != -1) { link = url + '?s=' + link; } return el( 'div', { className: 'padding-15', }, el( 'a', { className: 'but jb-green em09', href: link, target: 'blank', }, text ) ); } function show_title(title) { return 'legacy:' + title; } var notices = function (type, txte, data) { type = type || 'info'; wp.data.dispatch('core/notices').createNotice( type, // Can be one of: success, info, warning, error. txte, // Text string to display. data ); }; //-------------------------------------------------------------- rB('aksrtblock/download', { title: show_title(i18n__('gutenberg_file_download')), icon: icon.download, supports: { className: false, //保存时候不自动添加根class anchor: true, //允许添加描点 }, description: i18n__('gutenberg_file_download_desc'), category: 'aksrt_block_cat', attributes: { file_id: { type: 'string', source: 'attribute', selector: '.file-download-btn', attribute: 'data-aksrt-file-id', default: 0, }, url: { type: 'string', source: 'attribute', selector: '.file-download-btn', attribute: 'href', default: '', }, icon: { type: 'string', source: 'attribute', selector: '.file-download-icon>img', attribute: 'src', default: '', }, file_name: { type: 'string', selector: '.file-download-name', source: 'text', }, desc: { type: 'array', source: 'query', selector: '.file-download-desc', default: [ { left: '', right: '', }, ], query: { left: { type: 'string', source: 'text', selector: '.desc-left', }, right: { type: 'string', source: 'text', selector: '.desc-right', }, }, }, }, edit: function (props) { var at = props.attributes; var file_id = at.file_id; var file_name = at.file_name; var url = !file_id && at.url != 'javascript:;' ? at.url : ''; var desc = at.desc; var icon = at.icon; var sa = props.setAttributes; var isS = props.isSelected; function getFileExt(name) { return name.substring(name.lastIndexOf('.') + 1); } function formatSize(size, pointLength, units) { var unit; units = units || ['B', 'K', 'M', 'G', 'TB']; while ((unit = units.shift()) && size > 1024) { size = size / 1024; } return (unit === 'B' ? size : size.toFixed(pointLength === undefined ? 1 : pointLength)) + unit; } function get_thumbnail_url(file_data) { if (!file_data || !file_data.type || file_data.type !== 'image') return ''; return file_data.sizes && file_data.sizes.thumbnail && file_data.sizes.thumbnail.url ? file_data.sizes.thumbnail.url : file_data.url; } var media = el(MediaUpload, { title: i18n__('gutenberg_select_or_upload_file'), // allowedTypes: ["video"], onSelect: function onSelect(file_data) { var name = file_data.filename || file_data.name; var desc_1 = i18n_sprintf('gutenberg_ext_file', getFileExt(name)); var desc_2 = file_data.filesizeInBytes ? formatSize(file_data.filesizeInBytes) : ''; if (file_data.type === 'image') { icon = get_thumbnail_url(file_data); } sa({ file_name: name, url: '', icon: icon, file_id: file_data.id, desc: [ { left: desc_1, right: desc_2, }, ], }); }, value: file_id, render: function render(_ref) { var open = _ref.open; return el( 'a', { className: 'but jb-blue is-secondary flex0', onClick: open, }, (!file_id ? i18n__('gutenberg_select_or_upload') : i18n__('gutenberg_replace')) + i18n__('gutenberg_file') ); }, }); return el( 'div', {}, el( 'div', { className: 'muted-box file-download-box', }, el( 'div', { className: 'flex ac jsb', }, el( 'div', { className: 'flex ac flex1', }, el( 'div', { className: 'mr10', }, el( 'div', { className: 'file-download-icon', }, [ icon && el('img', { className: 'fit-cover', src: icon, alt: i18n__('gutenberg_download_icon'), }), ] ) ), el( 'div', { className: 'flex1', }, [ isS ? [ url || file_id ? el(TextControl, { className: '', tagName: 'input', onChange: function (e) { sa({ file_name: e, }); }, value: file_name, placeholder: i18n__('gutenberg_enter_file_name'), }) : i18n__('gutenberg_enter_download_url_or_file'), ] : el( 'div', { className: 'text-ellipsis-2 file-download-name', }, file_name || i18n__('gutenberg_enter_file_name') ), ], [ isS ? el( 'div', { className: 'flex ac', }, [ !file_id ? el(TextControl, { className: 'flex1', tagName: 'input', onChange: function (e) { sa({ url: e, }); }, value: url, placeholder: i18n__('gutenberg_enter_download_url'), }) : el( 'div', { className: 'flex ac', }, el( 'div', { className: 'px12', }, i18n__('gutenberg_local_file_selected') ), el( 'div', { className: 'mb6 ml10', }, el( 'a', { className: 'but c-blue-2', onClick: function () { sa({ file_id: 0, }); }, }, i18n__('gutenberg_enter_url') ) ) ), ], el( 'div', { className: 'mb6 ml6', }, media ) ) : el( 'div', { className: 'px12 opacity5', }, url ? url : file_id ? i18n__('gutenberg_local_file') : '' ), ] ) ), el( 'div', { className: 'flex0 ml20', }, [ isS || el( 'div', { className: 'but c-blue file-download-btn', }, el( 'i', { className: 'fa fas fa-download', }, i18n__('gutenberg_download') ) ), ] ) ), el( 'div', { className: 'mt10', }, desc.map(function (item, index) { if (isS) { return el( 'div', { className: 'flex ab jsb muted-2-color file-download-desc', }, el( 'div', { className: 'desc-left', }, el(TextControl, { className: 'flex1 mr6', tagName: 'input', onChange: function (e) { desc[index].left = e; sa({ desc: _toConsumableArray(desc), }); }, value: item.left, placeholder: i18n__('gutenberg_enter_file_attr'), }) ), el( 'div', { className: 'desc-right flex ac', }, el(TextControl, { className: 'flex1 mr6', tagName: 'input', onChange: function (e) { desc[index].right = e; sa({ desc: _toConsumableArray(desc), }); }, value: item.right, placeholder: i18n__('gutenberg_enter_file_attr'), }), el('button', { className: 'mb6 ml6 c-red fa far fa-trash-alt', type: 'button', onClick: function () { desc.splice(index, 1); sa({ desc: _toConsumableArray(desc), }); }, }) ) ); } else if (item.left || item.right) { return el( 'div', { className: 'flex ab jsb muted-2-color file-download-desc em09', }, el( 'div', { className: 'desc-left', }, item.left ), el( 'div', { className: 'desc-right', }, item.right ) ); } }) ), [ isS && el( 'a', { className: 'but c-blue is-secondary hollow', onClick: function () { let add = { left: '', right: '', }; sa({ desc: [].concat(_toConsumableArray(desc), add), }); }, }, i18n__('gutenberg_add_file_attr') ), ] ), el( InspectorControls, null, help_link(13990), el( PanelBody, { icon: 'image', title: i18n__('gutenberg_file_icon'), }, el( 'div', { className: 'components-base-control', }, [ icon && el( 'div', { className: ' ', }, el('img', { src: icon, }) ), ], el( 'div', { className: 'flex ac', }, el(MediaUpload, { title: i18n__('gutenberg_select_or_upload_file_icon'), allowedTypes: ['image'], onSelect: function onSelect(media) { sa({ icon: get_thumbnail_url(media), }); }, render: function render(_ref) { var open = _ref.open; return el( 'a', { className: 'but jb-blue', onClick: open, }, (icon ? i18n__('gutenberg_replace') : i18n__('gutenberg_add')) + i18n__('gutenberg_icon') ); }, }), [ icon && el( 'a', { className: 'but c-red ml6', onClick: function () { sa({ icon: '', }); }, }, i18n__('gutenberg_remove') ), ] ), el( 'div', { className: 'mt6 em09 opacity5', }, i18n__('gutenberg_file_icon_square_hint') ) ) ) ) ); }, save: function (props) { var at = props.attributes; var file_id = ~~at.file_id; var file_name = at.file_name; var url = at.url || 'javascript:;'; var icon = at.icon; var desc = at.desc; var a_attr = { className: 'but c-blue file-download-btn', href: url, }; if (file_id) { a_attr['data-aksrt-file-id'] = file_id; } var desc_lists = desc.map(function (item) { if (item.left || item.right) { return el( 'div', { className: 'flex ab jsb muted-2-color file-download-desc em09', }, el( 'div', { className: 'desc-left', }, item.left ), el( 'div', { className: 'desc-right', }, item.right ) ); } }); return el( 'div', { contenteditable: 'false', className: 'muted-box file-download-box mb20', }, el( 'div', { className: 'flex ac jsb', }, el( 'div', { className: 'flex ac', }, el( 'div', { className: 'mr10', }, el( 'div', { className: 'file-download-icon', }, [ icon && el('img', { className: 'fit-cover no-imgbox', src: icon, alt: i18n__('gutenberg_download_icon'), }), ] ) ), el( 'div', { className: 'text-ellipsis-2 file-download-name', contenteditable: 'true', }, file_name ) ), el( 'div', { className: 'flex0 ml20', }, el( 'a', a_attr, el('i', { className: 'fa fas fa-download', }), i18n__('gutenberg_download') ) ) ), [ desc_lists && el( 'div', { className: 'mt10', }, desc_lists ), ] ); }, }); //-------------------------------------------------------------- rB('aksrtblock/tabs', { title: show_title(i18n__('gutenberg_tab')), icon: icon.tabs, supports: { className: false, //保存时候不自动添加根class anchor: true, //允许添加描点 }, description: i18n__('gutenberg_tab_desc'), category: 'aksrt_block_cat', attributes: { tabHeaders: { type: 'array', default: [i18n__('gutenberg_tab_col_1'), i18n__('gutenberg_tab_col_2'), i18n__('gutenberg_tab_col_3')], }, tabActive: { type: 'number', default: 0, }, open: { type: 'number', default: 0, }, layout: { type: 'string', default: 'nav-top', }, }, edit: function (props) { var at = props.attributes, isS = props.isSelected, sa = props.setAttributes, tabHeaders = at.tabHeaders, tabActive = at.tabActive, layout = at.layout; var clientId = props.clientId; var get_el = function (_key) { return el( 'div', { className: 'tab-header-item' + (_key == tabActive ? ' active' : ''), onClick: function () { active(_key); }, }, el(TextControl, { // tagName: "p", className: 'tab-header-input', onChange: function (e) { tabHeaders[_key] = e; sa({ tabHeaders: _toConsumableArray(tabHeaders), }); }, value: tabHeaders[_key], placeholder: i18n__('gutenberg_enter_title'), }), el( 'div', { className: 'tab-operation', }, el( 'a', { className: 'but b-red circular', onClick: function () { remove(_key); }, }, el('i', { className: 'fa fas fa-times', }) ) ) ); }; var active = function (_key) { var block = getBlock(clientId); sa({ tabActive: _key, }); times(block.innerBlocks.length, function (n) { updateBlockAttributes(block.innerBlocks[n].clientId, { tabActive: _key, id: n, }); }); }; var add = function () { var tabItemBlock = createBlock('aksrtblock/tab'); insertBlock(tabItemBlock, tabHeaders.length, clientId); sa({ tabHeaders: [].concat(_toConsumableArray(tabHeaders), ''), }); active(tabHeaders.length); }; var remove = function (_key) { if (tabHeaders.length < 2) { return notices('warning', i18n__('gutenberg_cannot_delete_tab_min_one')); } var childBlocks = getBlockOrder(clientId); removeBlock(childBlocks[_key], false); tabHeaders.splice(_key, 1); sa({ tabHeaders: _toConsumableArray(tabHeaders), }); return active(0), !1; }; return el( 'div', { className: 'tab-card theme-card-box ' + layout, }, el( 'div', { className: 'tab-header flex ab', }, tabHeaders.map(function (item, index) { return get_el(index); }), [ isS && el( 'a', { className: 'but jb-blue em09 ml6', onClick: add, }, i18n__('gutenberg_add_plus') ), ] ), el( 'div', { className: 'tab-content', }, el(InnerBlocks, { template: [ [ 'aksrtblock/tab', { id: 0, }, ], [ 'aksrtblock/tab', { id: 1, }, ], [ 'aksrtblock/tab', { id: 2, }, ], ], templateLock: false, allowedBlocks: ['aksrtblock/tab'], }) ), el( InspectorControls, null, help_link(2195), el( PanelBody, { icon: 'admin-generic', title: i18n__('gutenberg_settings'), }, el( 'div', { className: 'components-base-control', }, //侧边设置 el(SelectControl, { label: i18n__('gutenberg_nav_position'), value: layout, onChange: function (e) { sa({ layout: e, }); }, options: [ { label: i18n__('gutenberg_top'), value: 'nav-top', }, { label: i18n__('gutenberg_left'), value: 'nav-left', }, { label: i18n__('gutenberg_right'), value: 'nav-left nav-right', }, ], }) ) ) ) ); }, save: function (props) { var at = props.attributes, tabHeaders = at.tabHeaders, open = at.open, layout = at.layout; var header = function (_key) { return el( 'li', { className: _key == open ? 'active' : '', }, el( 'a', { className: 'post-tab-toggle', href: 'javascript:;', 'tab-id': _key, }, tabHeaders[_key] || i18n_sprintf('gutenberg_tab_col_n', _key + 1) ) ); }; return el( 'div', { className: 'mb20 post-tab ' + layout, }, el( 'div', { className: 'list-inline scroll-x mini-scrollbar tab-nav-theme', }, tabHeaders.map(function (item, index) { return header(index); }) ), el( 'div', { className: 'tab-content', }, el(InnerBlocks.Content, null) ) ); }, }); //-------------------------------------------------------------- rB('aksrtblock/tab', { title: show_title(i18n__('gutenberg_tab')), parent: ['aksrtblock/tabs'], //父级快 icon: icon.tabs, supports: { className: false, //保存时候不自动添加根class reusable: false, }, category: 'aksrt_block_cat', attributes: { id: { type: 'number', default: 0, }, pid: { type: 'string', }, tabActive: { type: 'number', default: 0, }, open: { type: 'number', default: 0, }, }, edit: function (props) { var at = props.attributes, id = at.id, tabActive = at.tabActive; return el( Fragment, null, el( 'div', { className: '', style: { display: id === tabActive ? 'block' : 'none', }, }, el(InnerBlocks, { template: [['core/paragraph']], templateLock: false, }) ) ); }, save: function (props) { var at = props.attributes, id = at.id, open = at.open; return el( 'div', { className: 'tab-pane fade' + (id == open ? ' active in' : ''), 'tab-id': id, }, el(InnerBlocks.Content, null) ); }, }); //-------------------------------------------------------------- rB('aksrtblock/dplayerfeatured', { title: show_title(i18n__('gutenberg_video_series')), icon: icon.featured, supports: { className: false, //保存时候不自动添加根class color: false, //不为块添加背景和颜色设置 }, description: i18n__('gutenberg_video_series_desc'), category: 'aksrt_block_cat', attributes: { featured: { type: 'array', source: 'query', selector: '.switch-video', default: [], query: { text: { type: 'string', source: 'attribute', attribute: 'title', }, url: { type: 'string', source: 'attribute', attribute: 'video-url', }, media_id: { type: 'number', source: 'attribute', attribute: 'media-id', }, }, }, pic: { type: 'string', source: 'attribute', selector: '.new-dplayer', attribute: 'video-pic', default: '', }, loop: { type: 'string', source: 'attribute', selector: '.new-dplayer', attribute: 'data-loop', default: '', }, autoplay: { type: 'string', source: 'attribute', selector: '.new-dplayer', attribute: 'data-autoplay', default: '', }, volume: { type: 'string', source: 'attribute', selector: '.new-dplayer', attribute: 'data-volume', default: 1, }, height: { type: 'string', source: 'attribute', selector: '.new-dplayer', attribute: 'data-scale-height', default: 0, }, hide_controller: { type: 'boolean', default: false, }, }, transforms: { to: [ { type: 'block', blocks: ['aksrtblock/dplayer'], transform: function (e) { var attr = { url: e.featured[0].url, media_id: e.featured[0].media_id, pic: e.pic, loop: e.loop, autoplay: e.autoplay, volume: e.volume, hide_controller: e.hide_controller, }; return createBlock('aksrtblock/dplayer', attr); }, }, { type: 'block', blocks: ['aksrtblock/iframeseries'], transform: function (e) { var attr = { lists: e.featured, }; return createBlock('aksrtblock/iframeseries', attr); }, }, ], }, edit: function (props) { var at = props.attributes, isS = props.isSelected, sa = props.setAttributes, pic = at.pic, loop = at.loop, autoplay = at.autoplay, hide_controller = at.hide_controller, height = at.height || 0, volume = at.volume || 1; var featured = at.featured.length ? at.featured : [ { text: '', url: '', media_id: '', }, { text: '', url: '', media_id: '', }, ]; var get_el = function (_key) { return el( 'div', { className: 'flex featured-item', }, el( 'span', { className: 'mr10 c-red', }, _key + 1 ), el( 'div', { className: 'flex1', }, el( 'div', { className: 'flex ab', }, el(TextControl, { className: 'flex1 mr6', tagName: 'input', onChange: function (e) { featured[_key].text = e; sa({ featured: _toConsumableArray(featured), }); }, value: featured[_key].text, placeholder: i18n_sprintf('gutenberg_episode_title_placeholder', _key + 1), }), [ featured.length > 2 && el('button', { className: 'mb6 ml6 c-red fa far fa-trash-alt', type: 'button', onClick: function () { remove(_key); }, }), ] ), el( 'div', { className: 'flex ab', }, el(TextControl, { className: 'flex1 mr6', tagName: 'input', onChange: function (e) { featured[_key].url = e; featured[_key].media_id = ''; sa({ featured: _toConsumableArray(featured), }); }, value: featured[_key].url, placeholder: i18n__('gutenberg_enter_video_url_or_upload'), }), el(MediaUpload, { title: i18n__('gutenberg_select_or_upload_video'), allowedTypes: ['video'], onSelect: function onSelect(media) { featured[_key].url = media.url; featured[_key].media_id = media.id; sa({ featured: _toConsumableArray(featured), }); }, value: featured[_key].media_id, render: function render(_ref) { var open = _ref.open; return el( 'a', { className: 'but c-blue is-secondary flex0', onClick: open, }, i18n__('gutenberg_local_video') ); }, }) ) ) ); }; var add = function () { let add = { url: '', media_id: '', }; sa({ featured: [].concat(_toConsumableArray(featured), add), }); }; var remove = function (_key) { if (featured.length < 3) { return notices('warning', i18n__('gutenberg_cannot_delete_episode_min_two')); } featured.splice(_key, 1); sa({ featured: _toConsumableArray(featured), }); }; return el( 'div', {}, el( 'div', { className: 'theme-card-box', }, el( 'div', { className: 'em12 mb10 flex ac', }, icon.featured, el( 'span', { className: 'ml10', }, i18n__('gutenberg_video_series_module') ) ), el( 'div', { className: 'opacity8 mb10 px12', }, i18n__('gutenberg_video_series_hint') ), [ isS ? featured.map(function (item, index) { return get_el(index); }) : featured.map(function (item, index) { return el( 'div', { className: 'flex featured-item px12 opacity8', style: { padding: '2px 10px', 'margin-bottom': '-1px', }, }, index + 1 + ':' + item.url ); }), ], [ isS && el( 'a', { className: 'but jb-blue', onClick: add, }, i18n__('gutenberg_add_episode') ), ] ), el( InspectorControls, null, help_link(2223), el( PanelBody, { icon: 'admin-generic', title: i18n__('gutenberg_settings'), }, el( 'div', { className: 'components-base-control', }, [ pic && el( 'div', { className: ' ', }, el('img', { src: pic, }) ), ], el(MediaUpload, { title: i18n__('gutenberg_select_or_upload_poster'), allowedTypes: ['image'], onSelect: function onSelect(media) { sa({ pic: media.url, }); }, render: function render(_ref) { var open = _ref.open; return el( 'a', { className: 'but jb-blue', onClick: open, }, (pic ? i18n__('gutenberg_replace') : i18n__('gutenberg_add')) + i18n__('gutenberg_poster_image') ); }, }) ), el(ToggleControl, { label: i18n__('gutenberg_autoplay'), checked: autoplay, onChange: function (e) { sa({ autoplay: e, }); }, }), el(ToggleControl, { label: i18n__('gutenberg_loop'), checked: loop, onChange: function (e) { sa({ loop: e, }); }, }), el(ToggleControl, { label: i18n__('gutenberg_hide_controller'), checked: hide_controller, onChange: function (e) { sa({ hide_controller: e, }); }, }), el(RangeControl, { label: i18n__('gutenberg_initial_volume'), value: ~~(volume * 100), onChange: function (e) { sa({ volume: e / 100, }); }, allowReset: true, min: '0', max: '100', }), el(RangeControl, { label: i18n__('gutenberg_fixed_aspect_ratio'), help: height > 0 ? i18n_sprintf('gutenberg_height_of_width', height) : i18n__('gutenberg_height_ratio_auto'), value: ~~height, onChange: function (e) { sa({ height: e, }); }, allowReset: true, min: '0', step: '5', max: '200', }) ) ) ); }, save: function (props) { var at = props.attributes, pic = at.pic, loop = at.loop || '', autoplay = at.autoplay || '', hide_controller = at.hide_controller || '', height = at.height || 0, featured = at.featured, volume = at.volume || 1; if (!featured || !featured[0]) return; var url = featured[0].url; var graphic = el( 'div', { className: 'graphic', style: { 'padding-bottom': '50%', }, }, el( 'div', { className: 'abs-center text-center', }, el('i', { className: 'fa fas fa-play-circle fa-4x muted-3-color opacity5', }) ) ); var attr = { className: 'new-dplayer' + (hide_controller ? ' controller-hide' : '') + (height > 0 ? ' dplayer-scale-height' : ''), 'video-url': url, 'video-pic': pic, 'data-loop': loop, 'data-autoplay': autoplay, 'data-volume': volume, }; if (height > 0) { attr.style = '--scale-height:' + height + '%;'; attr['data-scale-height'] = height; } return el( 'div', { className: 'mb20', }, el('div', attr, graphic), el( 'div', { className: 'featured-video-episode mt10 dplayer-featured', }, featured.map(function (item, index) { index = index + 1; var text = item.text || i18n_sprintf('gutenberg_episode_n', index); // if (!item.url) return; return el( 'a', { className: 'switch-video text-ellipsis' + (index == 1 ? ' active' : ''), 'data-index': index, 'video-url': item.url, 'media-id': item.media_id, title: item.text, href: 'javascript:;', }, el( 'span', { className: 'mr6 badg badg-sm', }, index ), el( 'i', { className: 'episode-active-icon', }, '' ), text ); }) ) ); }, }); //-------------------------------------------------------------------- rB('aksrtblock/iframe', { title: show_title(i18n__('gutenberg_super_embed')), icon: icon.iframe, description: i18n__('gutenberg_super_embed_desc'), category: 'aksrt_block_cat', attributes: { url: { source: 'attribute', selector: 'iframe', attribute: 'src', }, aspect: { type: 'attribute', selector: 'iframe', attribute: 'data-aspect', }, allowfullscreen: { type: 'attribute', selector: 'iframe', attribute: 'allowfullscreen', }, }, transforms: { to: [ { type: 'block', blocks: ['aksrtblock/iframeseries'], transform: function (e) { var attr = { lists: [ { url: e.url, title: '', }, ], aspect: e.aspect, allowfullscreen: e.allowfullscreen, }; return createBlock('aksrtblock/iframeseries', attr); }, }, { type: 'block', blocks: ['aksrtblock/dplayer'], transform: function (e) { var attr = { url: e.url, }; return createBlock('aksrtblock/dplayer', attr); }, }, ], }, edit: function (props) { var at = props.attributes, isS = props.isSelected, sa = props.setAttributes, url = at.url, allowfullscreen = at.allowfullscreen, aspect = at.aspect || '56%'; return el( 'div', { className: 'aksrtblock-iframe', }, el( 'div', { className: !url || isS ? 'theme-card-box' : 'nois_selected', }, [ url && el( 'div', { className: 'aksrtblock-iframe-div', style: { 'padding-bottom': aspect, }, }, el('iframe', { className: '', width: '100%', src: url, }), el('div', { className: 'iframe-mask', }) ), ], [ !url && el( 'div', { className: 'components-placeholder__label', style: { width: '95%', height: '27px', 'font-size': '15px', }, }, icon.iframe, i18n__('gutenberg_embed_online_content') ), ], [ (!url || isS) && el( 'div', { className: 'mt20', }, el( 'div', { className: 'opacity8 iframe-label', }, i18n__('gutenberg_embed_url_hint_multi') ), el( 'a', { className: 'block-editor-block-card__description', }, '' ) ), ], [ (!url || isS) && el(TextControl, { style: { width: '95%', }, tagName: 'input', onChange: function (e) { var html = $.parseHTML(e); var src = $(html).attr('src') || e; sa({ url: src, }); }, value: url, placeholder: i18n__('gutenberg_enter_url_or_embed_code'), }), ] ), el( InspectorControls, null, help_link(1934), el( PanelBody, { icon: 'admin-generic', title: i18n__('gutenberg_settings'), }, el(SelectControl, { label: i18n__('gutenberg_aspect_ratio_settings'), value: aspect, onChange: function (e) { sa({ aspect: e, }); }, options: [ { label: i18n__('gutenberg_ratio_landscape_4_1'), value: '25%', }, { label: i18n__('gutenberg_ratio_landscape_3_1'), value: '33%', }, { label: i18n__('gutenberg_ratio_landscape_5_2'), value: '40%', }, { label: i18n__('gutenberg_ratio_landscape_2_1'), value: '50%', }, { label: i18n__('gutenberg_ratio_landscape_16_9'), value: '56%', }, { label: i18n__('gutenberg_ratio_landscape_5_3'), value: '60%', }, { label: i18n__('gutenberg_ratio_landscape_4_3'), value: '75%', }, { label: i18n__('gutenberg_ratio_landscape_5_4'), value: '80%', }, { label: i18n__('gutenberg_ratio_landscape_8_7'), value: '87.5%', }, { label: i18n__('gutenberg_ratio_square_1_1'), value: '100%', }, { label: i18n__('gutenberg_ratio_portrait_7_8'), value: '114%', }, { label: i18n__('gutenberg_ratio_portrait_4_5'), value: '125%', }, { label: i18n__('gutenberg_ratio_portrait_3_4'), value: '133%', }, { label: i18n__('gutenberg_ratio_portrait_3_5'), value: '166%', }, { label: i18n__('gutenberg_ratio_portrait_1_2'), value: '200%', }, { label: i18n__('gutenberg_ratio_portrait_2_5'), value: '250%', }, { label: i18n__('gutenberg_ratio_portrait_1_3'), value: '300%', }, ], }), el(ToggleControl, { label: i18n__('gutenberg_allow_fullscreen'), checked: !!allowfullscreen, onChange: function (e) { sa({ allowfullscreen: e, }); }, }) ) ) ); }, save: function (props) { var at = props.attributes, url = at.url, aspect = at.aspect || '56%'; var iframe_attr = { className: '', 'data-aspect': aspect, framespacing: '0', border: '0', width: '100%', frameborder: 'no', src: url, }; if (at.allowfullscreen) { iframe_attr.allowfullscreen = 'allowfullscreen'; } if (!url) return; return el( 'div', { className: 'wp-block-embed is-type-video mb20', }, el( 'div', { className: '', style: { 'padding-bottom': aspect, }, }, el('iframe', iframe_attr) ) ); }, }); //-------------------------------------------------------------------- rB('aksrtblock/iframeseries', { title: show_title(i18n__('gutenberg_embed_series')), icon: icon.iframeseries, supports: { className: false, //保存时候不自动添加根class color: false, //不为块添加背景和颜色设置 }, description: i18n__('gutenberg_embed_series_desc'), category: 'aksrt_block_cat', attributes: { lists: { type: 'array', source: 'query', selector: '.switch-iframe', default: [ { text: '', url: '', }, { text: '', url: '', }, ], query: { text: { type: 'string', source: 'attribute', attribute: 'title', }, url: { type: 'string', source: 'attribute', attribute: 'iframe-url', }, }, }, aspect: { type: 'attribute', selector: 'iframe', attribute: 'data-aspect', }, allowfullscreen: { type: 'attribute', selector: 'iframe', attribute: 'allowfullscreen', }, }, transforms: { to: [ { type: 'block', blocks: ['aksrtblock/iframe'], transform: function (e) { var attr = { url: e.lists[0].url, aspect: e.aspect, allowfullscreen: e.allowfullscreen, }; return createBlock('aksrtblock/iframe', attr); }, }, { type: 'block', blocks: ['aksrtblock/dplayerfeatured'], transform: function (e) { var attr = { featured: e.lists, }; return createBlock('aksrtblock/dplayerfeatured', attr); }, }, ], }, edit: function (props) { var at = props.attributes, isS = props.isSelected, sa = props.setAttributes, lists = at.lists, allowfullscreen = at.allowfullscreen, aspect = at.aspect || '56%'; var get_el = function (_key) { return el( 'div', { className: 'flex featured-item', }, el( 'span', { className: 'mr10 c-red', }, _key + 1 ), el( 'div', { className: 'flex1', }, el( 'div', { className: 'flex ab', }, el(TextControl, { className: 'flex1 mr6', tagName: 'input', onChange: function (e) { lists[_key].text = e; sa({ lists: _toConsumableArray(lists), }); }, value: lists[_key].text, placeholder: i18n_sprintf('gutenberg_episode_title_placeholder', _key + 1), }), [ lists.length > 2 && el('button', { className: 'mb6 ml6 c-red fa far fa-trash-alt', type: 'button', onClick: function () { remove(_key); }, }), ] ), el(TextControl, { className: 'flex1 mr6', tagName: 'input', onChange: function (e) { var html = $.parseHTML(e); var src = $(html).attr('src') || e; lists[_key].url = src; sa({ lists: _toConsumableArray(lists), }); }, value: lists[_key].url, placeholder: i18n__('gutenberg_enter_embed_url'), }) ) ); }; var add = function () { let add = { url: '', media_id: '', }; sa({ lists: [].concat(_toConsumableArray(lists), add), }); }; var remove = function (_key) { if (lists.length < 3) { return notices('warning', i18n__('gutenberg_cannot_delete_episode_min_two')); } lists.splice(_key, 1); sa({ lists: _toConsumableArray(lists), }); }; return el( 'div', { className: 'aksrtblock-iframe', }, el( 'div', { className: 'theme-card-box', }, el( 'div', { className: 'em12 mb10 flex ac', }, icon.iframeseries, el( 'span', { className: 'ml10', }, i18n__('gutenberg_embed_series_module') ) ), el( 'div', { className: 'opacity8 mb10 px12', }, i18n__('gutenberg_embed_series_hint') ), [ isS ? lists.map(function (item, index) { return get_el(index); }) : lists.map(function (item, index) { return el( 'div', { className: 'flex featured-item px12 opacity8', style: { padding: '2px 10px', 'margin-bottom': '-1px', }, }, index + 1 + ':' + item.url ); }), ], [ isS && el( 'a', { className: 'but jb-blue', onClick: add, }, i18n__('gutenberg_add_episode') ), ] ), el( InspectorControls, null, help_link(1934), el( PanelBody, { icon: 'admin-generic', title: i18n__('gutenberg_settings'), }, el(SelectControl, { label: i18n__('gutenberg_aspect_ratio_settings'), value: aspect, onChange: function (e) { sa({ aspect: e, }); }, options: [ { label: i18n__('gutenberg_ratio_landscape_4_1'), value: '25%', }, { label: i18n__('gutenberg_ratio_landscape_3_1'), value: '33%', }, { label: i18n__('gutenberg_ratio_landscape_5_2'), value: '40%', }, { label: i18n__('gutenberg_ratio_landscape_2_1'), value: '50%', }, { label: i18n__('gutenberg_ratio_landscape_16_9'), value: '56%', }, { label: i18n__('gutenberg_ratio_landscape_5_3'), value: '60%', }, { label: i18n__('gutenberg_ratio_landscape_4_3'), value: '75%', }, { label: i18n__('gutenberg_ratio_landscape_5_4'), value: '80%', }, { label: i18n__('gutenberg_ratio_landscape_8_7'), value: '87.5%', }, { label: i18n__('gutenberg_ratio_square_1_1'), value: '100%', }, { label: i18n__('gutenberg_ratio_portrait_7_8'), value: '114%', }, { label: i18n__('gutenberg_ratio_portrait_4_5'), value: '125%', }, { label: i18n__('gutenberg_ratio_portrait_3_4'), value: '133%', }, { label: i18n__('gutenberg_ratio_portrait_3_5'), value: '166%', }, { label: i18n__('gutenberg_ratio_portrait_1_2'), value: '200%', }, { label: i18n__('gutenberg_ratio_portrait_2_5'), value: '250%', }, { label: i18n__('gutenberg_ratio_portrait_1_3'), value: '300%', }, ], }), el(ToggleControl, { label: i18n__('gutenberg_allow_fullscreen'), checked: !!allowfullscreen, onChange: function (e) { sa({ allowfullscreen: e, }); }, }) ) ) ); }, save: function (props) { var at = props.attributes, lists = at.lists, aspect = at.aspect || '56%'; if (!lists || !lists[0]) return; var iframe_attr = { className: '', 'data-aspect': aspect, framespacing: '0', border: '0', width: '100%', frameborder: 'no', src: lists[0].url, }; if (at.allowfullscreen) { iframe_attr.allowfullscreen = 'allowfullscreen'; } return el( 'div', { className: 'mb20 iframe-series', }, el( 'div', { className: 'wp-block-embed is-type-video', }, el( 'div', { className: 'iframe-series-box', style: { 'padding-bottom': aspect, }, }, el('iframe', iframe_attr) ) ), el( 'div', { className: 'featured-video-episode mt10 dplayer-featured', }, lists.map(function (item, index) { index = index + 1; var text = item.text || i18n_sprintf('gutenberg_episode_n', index); // if (!item.url) return; return el( 'a', { className: 'switch-iframe text-ellipsis' + (index == 1 ? ' active' : ''), 'data-index': index, 'iframe-url': item.url, title: item.text, href: 'javascript:;', }, el( 'span', { className: 'mr6 badg badg-sm', }, index ), el( 'i', { className: 'episode-active-icon', }, '' ), text ); }) ) ); }, }); /////////------------------------------------------------------------ rB('aksrtblock/dplayer', { title: show_title(i18n__('gutenberg_video')), icon: icon.video, description: i18n__('gutenberg_video_desc'), category: 'aksrt_block_cat', attributes: { url: { source: 'attribute', selector: '.new-dplayer', attribute: 'video-url', }, media_id: { source: 'attribute', selector: '.new-dplayer', attribute: 'media-id', }, pic: { source: 'attribute', selector: '.new-dplayer', attribute: 'video-pic', }, loop: { source: 'attribute', selector: '.new-dplayer', attribute: 'data-loop', }, autoplay: { source: 'attribute', selector: '.new-dplayer', attribute: 'data-autoplay', }, volume: { source: 'attribute', selector: '.new-dplayer', attribute: 'data-volume', }, height: { type: 'string', source: 'attribute', selector: '.new-dplayer', attribute: 'data-scale-height', default: 0, }, hide_controller: { source: 'attribute', selector: '.new-dplayer', attribute: 'data-hide', }, }, transforms: { to: [ { type: 'block', blocks: ['aksrtblock/dplayerfeatured'], transform: function (e) { var attr = { featured: [ { text: '', url: e.url, media_id: e.media_id, }, { text: '', url: '', media_id: '', }, ], pic: e.pic, loop: e.loop, autoplay: e.autoplay, volume: e.volume, hide_controller: e.hide_controller, }; return createBlock('aksrtblock/dplayerfeatured', attr); }, }, { type: 'block', blocks: ['aksrtblock/iframe'], transform: function (e) { var attr = { url: e.url, }; return createBlock('aksrtblock/iframe', attr); }, }, ], }, edit: function (props) { var at = props.attributes, isS = props.isSelected, sa = props.setAttributes, url = at.url, media_id = at.media_id, pic = at.pic, loop = at.loop, autoplay = at.autoplay, hide_controller = at.hide_controller, height = at.height || 0, volume = at.volume || 1; return el( 'div', {}, el( 'div', { className: 'theme-card-box', }, el( 'div', { className: 'em12 mb10 flex ac', }, icon.video, el( 'span', { className: 'ml10', }, i18n__('gutenberg_video_module') ) ), el( 'div', { className: 'opacity8 mb10 px12', }, i18n__('gutenberg_video_hint') ), el(TextControl, { style: { width: '95%', }, tagName: 'input', onChange: function (e) { sa({ url: e, media_id: '', }); }, value: url, placeholder: i18n__('gutenberg_enter_video_url_or_upload'), }), el(MediaUpload, { title: i18n__('gutenberg_select_or_upload_video'), allowedTypes: ['video'], onSelect: function onSelect(media) { sa({ url: media.url, media_id: media.id, }); }, value: media_id, render: function render(_ref) { var open = _ref.open; return ( isS && el( 'a', { className: 'but jb-blue', onClick: open, }, i18n__('gutenberg_select_local_video') ) ); }, }) ), el( InspectorControls, null, help_link(1921), el( PanelBody, { icon: 'admin-generic', title: i18n__('gutenberg_settings'), }, el( 'div', { className: 'components-base-control', }, [ pic && el( 'div', { className: ' ', }, el('img', { src: pic, }) ), ], el(MediaUpload, { title: i18n__('gutenberg_select_or_upload_poster'), allowedTypes: ['image'], onSelect: function onSelect(media) { sa({ pic: media.url, }); }, render: function render(_ref) { var open = _ref.open; return el( 'a', { className: 'but jb-blue', onClick: open, }, (pic ? i18n__('gutenberg_replace') : i18n__('gutenberg_add')) + i18n__('gutenberg_poster_image') ); }, }) ), el(ToggleControl, { label: i18n__('gutenberg_autoplay'), checked: autoplay, onChange: function (e) { sa({ autoplay: e, }); }, }), el(ToggleControl, { label: i18n__('gutenberg_loop'), checked: loop, onChange: function (e) { sa({ loop: e, }); }, }), el(ToggleControl, { label: i18n__('gutenberg_hide_controller'), checked: hide_controller, onChange: function (e) { sa({ hide_controller: e, }); }, }), el(RangeControl, { label: i18n__('gutenberg_initial_volume'), value: ~~(volume * 100), onChange: function (e) { sa({ volume: e / 100, }); }, allowReset: true, min: '0', max: '100', }), el(RangeControl, { label: i18n__('gutenberg_fixed_aspect_ratio'), help: height > 0 ? i18n_sprintf('gutenberg_height_of_width', height) : i18n__('gutenberg_height_ratio_auto'), value: ~~height, onChange: function (e) { sa({ height: e, }); }, allowReset: true, min: '0', step: '5', max: '200', }) ) ) ); }, save: function (props) { var at = props.attributes, url = at.url, media_id = at.media_id, pic = at.pic, loop = at.loop || '', autoplay = at.autoplay || '', hide_controller = at.hide_controller || '', height = at.height || 0, volume = at.volume || 1; if (!url) return; var graphic = el( 'div', { className: 'graphic', style: { 'padding-bottom': '50%', }, }, el( 'div', { className: 'abs-center text-center', }, el('i', { className: 'fa fas fa-play-circle fa-4x muted-3-color opacity5', }) ) ); var attr = { className: 'new-dplayer post-dplayer' + (hide_controller ? ' controller-hide' : '') + (height > 0 ? ' dplayer-scale-height' : ''), 'video-url': url, 'media-id': media_id, 'video-pic': pic, 'data-loop': loop, 'data-hide': hide_controller, 'data-autoplay': autoplay, 'data-volume': volume, }; if (height > 0) { attr.style = '--scale-height:' + height + '%;'; attr['data-scale-height'] = height; } return el('div', attr, graphic); }, }); //--------------------------------------------- rB('aksrtblock/feature', { title: show_title(i18n__('gutenberg_feature')), icon: icon.feature, description: i18n__('gutenberg_feature_desc'), category: 'aksrt_block_cat', attributes: { title: { type: 'array', source: 'children', selector: '.feature-title', }, icon: { source: 'attribute', selector: '.feature', attribute: 'data-icon', }, note: { type: 'array', source: 'children', selector: '.feature-note', }, theme: { source: 'attribute', selector: '.feature', attribute: 'class', }, color: { source: 'attribute', selector: '.feature', attribute: 'data-color', }, }, edit: function (props) { var at = props.attributes, isS = props.isSelected, sa = props.setAttributes, bt = at.title, jj = at.note, ic = at.icon || 'fa-flag', icc = at.color || 'feature-icon no1'; let Coc = el(c.ColorPalette, { value: icc || '#444', colors: colors, className: 'q-ColorPalette', onChange: function (e) { sa({ color: e, }); }, }); var rti = el(TextControl, { tagName: 'div', onChange: function (e) { sa({ icon: e, }); }, value: ic, placeholder: i18n__('gutenberg_enter_icon_class'), }), rt = el(RichText, { tagName: 'div', onChange: function (e) { sa({ title: e, }); }, value: bt, placeholder: i18n__('gutenberg_enter_feature_title'), }), rtj = el(RichText, { tagName: 'div', onChange: function (e) { sa({ note: e, }); }, value: jj, placeholder: i18n__('gutenberg_enter_feature_note'), }); return el( 'div', {}, el( 'div', { className: 'feature', }, el( 'div', { className: 'feature-icon', }, el('i', { style: { color: icc, }, className: 'fa ' + ic, }) ), [ isS && el( 'div', { className: 'feature-iconbj', }, el( 'div', { className: 'feature-icont', }, i18n__('gutenberg_enter_fa_icon_class') ), rti ), ], [isS && Coc], el( 'div', { className: 'feature-title', }, rt ), el( 'div', { className: 'feature-note', }, rtj ) ), el( InspectorControls, null, el( 'div', { className: 'modal-ss block-editor-block-card', }, el( 'div', { className: 'components-base-control', }, el('h5', {}, i18n__('gutenberg_icon_usage')), el('p', {}, i18n__('gutenberg_icon_usage_desc')), el( 'a', { href: 'http://fontawesome.dashgame.com', target: 'blank', }, i18n__('gutenberg_font_awesome') ) ) ), el( PanelBody, { icon: 'admin-generic', title: i18n__('gutenberg_settings'), }, el( 'div', { className: 'components-base-control', }, el( 'div', { className: 'feature-icont', }, i18n__('gutenberg_fa_icon_class') ), rti, el( 'div', { className: 'feature-icont', }, i18n__('gutenberg_select_icon_color') ), Coc ) ) ) ); }, save: function (props) { var at = props.attributes, bt = at.title, jj = at.note, icc = at.color || 'feature-icon no1', ic = at.icon || 'fa-flag', zt = at.theme || 'feature feature-default'; return el( 'div', { className: zt, 'data-icon': ic, 'data-color': icc, }, el( 'div', { className: 'feature-icon', }, el('i', { style: { color: icc, }, className: 'fa ' + ic, }) ), el( 'div', { className: 'feature-title', }, bt ), el( 'div', { className: 'feature-note', }, jj ) ); }, }); //--------------------------------------------- rE('aksrtblock/set-color', { title: i18n__('gutenberg_set_color'), tagName: 'qc', className: null, attributes: { style: 'style', block: 'inline-block', }, edit: class extend_Edit extends Component { constructor() { super(...arguments); this.show_modal = this.show_modal.bind(this); this.close_modal = this.close_modal.bind(this); this.words_selected = this.words_selected.bind(this); this.set_popover_rect = this.set_popover_rect.bind(this); this.remove_Format = this.remove_Format.bind(this); this.onChange_cb = this.onChange_cb.bind(this); this.set_color = this.set_color.bind(this); this.set_color2 = this.set_color2.bind(this); this.xsba = this.xsba.bind(this); this.xsba_f = this.xsba_f.bind(this); this.set_background = this.set_background.bind(this); this.set_background2 = this.set_background2.bind(this); this.state = { modal_visibility: false, }; } words_selected() { const { value } = this.props; return value.start !== value.end; } set_popover_rect() { const selection = window.getSelection(); const range = selection.rangeCount > 0 ? selection.getRangeAt(0) : null; var rectangle = getRectangleFromRange(range); this.setState({ popover_rect: rectangle, }); } show_modal() { this.setState({ modal_visibility: true, }); this.set_popover_rect(); } close_modal() { this.setState({ modal_visibility: false, }); } xsba() { this.setState({ xsba: true, }); } xsba_f() { this.setState({ xsba: false, }); } remove_Format() { this.setState({ color: '', background: '', }); this.props.onChange( wp.richText.toggleFormat(this.props.value, { type: 'aksrtblock/set-color', }) ); } onChange_cb() { this.props.onChange( wp.richText.applyFormat(this.props.value, { type: 'aksrtblock/set-color', attributes: { style: 'color:' + this.state.color + ';background:' + this.state.background, }, }) ); } set_color(e) { this.setState({ color: 'rgba(' + e.rgb.r + ',' + e.rgb.g + ',' + e.rgb.b + ',' + e.rgb.a + ')', }); this.onChange_cb(); } set_color2(e) { this.setState({ color: e, }); this.props.onChange( wp.richText.applyFormat(this.props.value, { type: 'aksrtblock/set-color', attributes: { style: 'color:' + e + ';background:' + this.state.background, }, }) ); } set_background2(e) { this.setState({ background: e, }); this.props.onChange( wp.richText.applyFormat(this.props.value, { type: 'aksrtblock/set-color', attributes: { style: 'color:' + this.state.color + ';background:' + e, }, }) ); } set_background(e) { this.setState({ background: 'rgba(' + e.rgb.r + ',' + e.rgb.g + ',' + e.rgb.b + ',' + e.rgb.a + ')', }); this.onChange_cb(); } render() { let { isActive } = this.props; let Co = el(c.ColorPicker, { color: this.state.color || '#444', onChangeComplete: this.set_color, }); let Coc = el(c.ColorPalette, { value: this.state.color || '#444', colors: colors, clearable: false, className: 'q-ColorPalette', disableCustomColors: true, onChange: this.set_color2, }); let Bob = el(c.ColorPalette, { value: this.state.background || '#fff', colors: colors, clearable: false, className: 'q-ColorPalette', disableCustomColors: true, onChange: this.set_background2, }); let Cob = el(c.ColorPicker, { color: this.state.background || '#fff', onChangeComplete: this.set_background, }), cz = el( 'button', { className: 'remove-Format', onClick: this.remove_Format, }, el('span', { className: 'dashicons dashicons-image-rotate', }) ); return el( Fragment, null, el(RichTextToolbarButton, { icon: 'art', title: i18n__('gutenberg_custom_color'), onClick: this.show_modal, isActive: isActive, isDisabled: !this.words_selected(), }), this.state.modal_visibility && el( Popover, { anchorRect: this.state.popover_rect, position: 'bottom', className: 'color_popover', onFocusOutside: this.close_modal, }, el( c.ButtonGroup, {}, el( 'button', { className: 'btn btn-default ' + (!this.state.xsba && 'isS'), onClick: this.xsba_f, }, i18n__('gutenberg_color') ), el( 'button', { className: 'btn btn-default ' + (this.state.xsba && 'isS'), onClick: this.xsba, }, i18n__('gutenberg_bg_color') ) ), cz, !this.state.xsba && el('div', {}, el('p', {}, i18n__('gutenberg_select_text_color')), Coc, Co), this.state.xsba && el('div', {}, el('p', {}, i18n__('gutenberg_select_bg_color')), Bob, Cob) ) ); } }, }); //--------------------------------------------- rB('aksrtblock/modal', { title: show_title(i18n__('gutenberg_modal')), icon: icon.modal, description: i18n__('gutenberg_modal_desc'), category: 'aksrt_block_cat', attributes: { biaoti: { type: 'array', source: 'children', selector: '.modal-title', }, kuandu: { type: 'attribute', selector: '.modal-dialog', attribute: 'data-kd', }, btn1: { type: 'array', source: 'children', selector: 'button.btn1', }, btn2: { type: 'array', source: 'children', selector: 'button.btn2', }, id: { source: 'attribute', selector: '.modal', attribute: 'id', }, btn1kg: { type: 'attribute', attribute: 'data-bkg1', default: true, }, btn2kg: { type: 'attribute', attribute: 'data-bkg2', default: true, }, btntm1: { type: 'attribute', selector: 'button.btn1', attribute: 'class', }, btntm2: { type: 'attribute', selector: 'button.btn2', attribute: 'class', }, oncopy: { source: 'string', }, }, edit: function (props) { var at = props.attributes, bt = at.biaoti, btn1 = at.btn1, btn2 = at.btn2, btntm1 = at.btntm1 || 'btn1 but', btntm2 = at.btntm2 || 'btn2 but c-blue', bkg1 = at.btn1kg, bkg2 = at.btn2kg, onC = at.oncopy, kd = at.kuandu || '', sa = props.setAttributes; var sjs = parseInt((Math.random() + 1) * Math.pow(10, 4)); if (!at.id) { sa({ id: 'modal_' + sjs, }); } function sabt1(e) { var type = e.target.className; sa({ btntm1: 'btn1 ' + type, }); } function sabt2(e) { var type = e.target.className; sa({ btntm2: 'btn2 ' + type, }); } var xzk = el(InnerBlocks, {}, ''), rt = el(RichText, { tagName: 'div', onChange: function (e) { sa({ biaoti: e, }); }, value: bt, placeholder: i18n__('gutenberg_enter_title_dots'), }), b1rt = el(RichText, { tagName: 'div', onChange: function (e) { sa({ btn1: e, }); }, value: btn1, placeholder: i18n__('gutenberg_button_1'), }), b2rt = el(RichText, { tagName: 'div', onChange: function (e) { sa({ btn2: e, }); }, value: btn2, placeholder: i18n__('gutenberg_button_2'), }), ztan1 = el( 'span', { className: 'modal-bu', }, [ el('button', { className: 'but', onClick: sabt1, }), el('button', { className: 'but c-blue', onClick: sabt1, }), el('button', { className: 'but c-red', onClick: sabt1, }), el('button', { className: 'but c-yellow', onClick: sabt1, }), el('button', { className: 'but c-green', onClick: sabt1, }), el('button', { className: 'but c-purple', onClick: sabt1, }), el('button', { className: 'but b-blue', onClick: sabt1, }), el('button', { className: 'but b-red', onClick: sabt1, }), el('button', { className: 'but b-yellow', onClick: sabt1, }), el('button', { className: 'but b-green', onClick: sabt1, }), el('button', { className: 'but b-purple', onClick: sabt1, }), ] ), ztan2 = el( 'span', { className: 'modal-bu', }, [ el('button', { className: 'but', onClick: sabt2, }), el('button', { className: 'but c-blue', onClick: sabt2, }), el('button', { className: 'but c-red', onClick: sabt2, }), el('button', { className: 'but c-yellow', onClick: sabt2, }), el('button', { className: 'but c-green', onClick: sabt2, }), el('button', { className: 'but c-purple', onClick: sabt2, }), el('button', { className: 'but b-blue', onClick: sabt2, }), el('button', { className: 'but b-red', onClick: sabt2, }), el('button', { className: 'but b-yellow', onClick: sabt2, }), el('button', { className: 'but b-green', onClick: sabt2, }), el('button', { className: 'but b-purple', onClick: sabt2, }), ] ); return el( 'div', {}, el( 'div', { className: 'modal ' + kd, }, el( 'div', { className: 'modal-title', }, rt, el( 'button', { className: 'close', }, '×' ) ), el( 'div', { className: 'modal-body', }, xzk ), [ (bkg1 || bkg2) && el( 'div', { className: 'modal-footer', }, [ bkg1 && el( 'span', { className: btntm1, }, b1rt ), ], [ bkg2 && el( 'span', { className: btntm2, }, b2rt ), ] ), ] ), el( InspectorControls, {}, el( 'div', { className: 'modal-ss padding-h', }, el('h5', {}, i18n__('gutenberg_usage_tutorial')), el('p', {}, i18n__('gutenberg_modal_usage_desc')), el( 'p', { className: 'modal-code', }, "javascript:void($('#" + at.id + "').modal('show'));" ), el( 'div', { className: 'Copy', }, el( ClipboardButton, { text: "javascript:void($('#" + at.id + "').modal('show'));", className: 'Copy but jb-blue', onCopy: function () { sa({ oncopy: true, }); }, onFinishCopy: function () { sa({ oncopy: false, }); }, }, onC ? i18n__('gutenberg_code_copied') : i18n__('gutenberg_click_copy_code') ) ) ), el( PanelBody, { title: i18n__('gutenberg_modal_settings'), }, el(SelectControl, { label: i18n__('gutenberg_width_select'), value: kd, onChange: function (e) { sa({ kuandu: e, }); }, options: [ { label: i18n__('gutenberg_width_default'), value: '', }, { label: i18n__('gutenberg_width_xs'), value: 'modal-sm', }, { label: i18n__('gutenberg_width_sm'), value: 'modal-mini', }, { label: i18n__('gutenberg_width_lg'), value: 'modal-lg', }, ], }), el('p', {}, ' '), el(ToggleControl, { label: i18n__('gutenberg_enable_button_1'), checked: bkg1, onChange: function (e) { sa({ btn1kg: e, }); }, }), [bkg1 && ztan1], el(ToggleControl, { label: i18n__('gutenberg_enable_button_2'), checked: bkg2, onChange: function (e) { sa({ btn2kg: e, }); }, }), [bkg2 && ztan2] ) ) ); }, save: function (props) { var at = props.attributes, btn1 = at.btn1, btn2 = at.btn2, btntm1 = at.btntm1 || 'btn1 but', btntm2 = at.btntm2 || 'btn2 but c-blue', bkg1 = at.btn1kg, bkg2 = at.btn2kg, kd = at.kuandu, id = at.id, bt = at.biaoti; var bth = el( 'div', { className: 'modal-header', }, el( 'strong', { className: 'modal-title', }, bt ), el( 'button', { className: 'close', 'data-dismiss': 'modal', }, el( 'div', { 'data-class': 'ic-close', 'data-svg': 'close', 'data-viewbox': '0 0 1024 1024', }, '' ) ) ); var coh = el( 'div', { className: 'modal-body', }, el(InnerBlocks.Content) ); var foo = [ ((bkg1 && btn1) || (bkg2 && btn2)) && el( 'div', { className: 'modal-footer', }, [ bkg1 && btn1 && el( 'button', { className: btntm1, }, btn1 ), ], [ bkg2 && btn2 && el( 'button', { className: btntm2, }, btn2 ), ] ), ]; return el( 'div', {}, el( 'div', { className: 'modal fade', id: id, 'aria-hidden': 'true', 'data-bkg1': bkg1, 'aria-bkg2': bkg2, role: 'dialog', tabindex: '-1', }, el( 'div', { className: 'modal-dialog ' + kd, 'data-kd': kd, }, el( 'div', { className: 'modal-content', }, bth, coh, foo ) ) ) ); }, }); //--------------------------------------------- rB('aksrtblock/collapse', { title: show_title(i18n__('gutenberg_accordion')), icon: { src: 'sort', foreground: icon_color, }, description: i18n__('gutenberg_accordion_desc'), category: 'aksrt_block_cat', attributes: { biaoti: { type: 'array', source: 'children', selector: '.biaoti', }, isshow: { type: 'attribute', selector: '.panel', attribute: 'data-isshow', default: true, }, theme: { source: 'attribute', selector: '.panel', attribute: 'class', }, id: { source: 'attribute', selector: '.collapse', attribute: 'id', }, ffs: { source: 'string', }, }, edit: function (props) { var at = props.attributes, bt = at.biaoti, zt = at.theme || 'panel panel-default', kg = at.isshow, ffs = at.ffs || 'ffshow', sa = props.setAttributes; var sjs = parseInt((Math.random() + 1) * Math.pow(10, 4)); if (!at.id) { sa({ id: 'collapse_' + sjs, }); } function ffshow() { if (ffs == 'ffshow') { sa({ ffs: 'ffhide', }); } else { sa({ ffs: 'ffshow', }); } } function changeType(e) { var type = e.target.className; sa({ theme: 'panel ' + type, }); } var xzk = el(InnerBlocks, {}, ''), rt = el(RichText, { tagName: 'div', onChange: function (e) { sa({ biaoti: e, }); }, value: bt, isSelected: props.isSelected, placeholder: i18n__('gutenberg_enter_accordion_title'), }), ztan = el( 'span', { className: 'g_extend anz panel_b', }, [ el('button', { className: 'panel-default', onClick: changeType, }), el('button', { className: 'panel-info', onClick: changeType, }), el('button', { className: 'panel-success', onClick: changeType, }), el('button', { className: 'panel-warning', onClick: changeType, }), el('button', { className: 'panel-danger', onClick: changeType, }), ] ); return el( 'div', {}, el( 'div', { className: zt, }, el( 'div', { className: 'panel-heading', }, rt ), el('span', { className: ffs + ' isshow dashicons dashicons-arrow-down-alt2', onClick: ffshow, }), el( 'div', { className: ffs + ' panel-body', }, xzk ) ), el( InspectorControls, null, el( PanelBody, { icon: 'admin-generic', title: i18n__('gutenberg_settings'), }, el( 'p', {}, el(ToggleControl, { label: i18n__('gutenberg_default_expand'), checked: kg, onChange: function (e) { sa({ isshow: e, }); }, }) ), el( 'i', { className: '.components-base-control__help', }, kg ? i18n__('gutenberg_default_expanded') : i18n__('gutenberg_default_collapsed') ) ) ) ); }, save: function (props) { var at = props.attributes, zt = at.theme || 'panel', kg = at.isshow, id = at.id, bt = at.biaoti; var bth = el( 'div', { className: 'panel-heading ' + (kg ? '' : 'collapsed'), href: '#' + id, 'data-toggle': 'collapse', 'aria-controls': 'collapseExample', }, el('i', { className: 'fa fas fa-plus', }), el( 'strong', { className: 'biaoti ', }, bt ) ); var coh = el( 'div', { className: 'collapse ' + (kg ? 'in' : ''), id: id, }, el( 'div', { className: 'panel-body', }, el(InnerBlocks.Content) ) ); return el( 'div', {}, el( 'div', { className: zt, 'data-theme': zt, 'data-isshow': kg, }, bth, coh ) ); }, }); //------------------------------------------------------------- rB('aksrtblock/enlighter', { title: show_title(i18n__('gutenberg_code_highlight')), icon: icon.enlighter, category: 'aksrt_block_cat', description: i18n__('gutenberg_code_highlight_desc'), keywords: ['code', 'sourcecode', i18n__('gutenberg_code')], attributes: { content: { type: 'string', selector: 'code.gl', source: 'text', }, c_language: { type: 'attribute', attribute: 'data-enlighter-language', default: 'generic', }, theme: { type: 'attribute', attribute: 'data-enlighter-theme', default: '', }, highlight: { type: 'attribute', attribute: 'data-enlighter-highlight', default: '', }, linenumbers: { type: 'attribute', attribute: 'data-enlighter-linenumbers', default: '', }, lineoffset: { type: 'attribute', attribute: 'data-enlighter-lineoffset', default: '', }, title: { type: 'attribute', attribute: 'data-enlighter-title', default: '', }, group: { type: 'attribute', attribute: 'data-enlighter-group', default: '', }, }, transforms: { from: [ { type: 'raw', priority: 4, isMatch: function (e) { return 'PRE' === e.nodeName && 1 === e.children.length && 'CODE' === e.firstChild.nodeName; }, transform: function (e) { return createBlock('aksrtblock/enlighter', { content: e.textContent, }); }, }, { type: 'raw', priority: 4, isMatch: function (e) { return 'PRE' === e.nodeName && 'EnlighterJSRAW' === e.className; }, transform: function (e) { return createBlock('aksrtblock/enlighter', { content: e.textContent, language: e.dataset.enlighterLanguage || '', theme: e.dataset.enlighterTheme || '', highlight: e.dataset.enlighterHighlight || '', linenumbers: e.dataset.enlighterLinenumbers || '', lineoffset: e.dataset.enlighterLineoffset || '', title: e.dataset.enlighterTitle || '', group: e.dataset.enlighterGroup || '', }); }, }, { type: 'block', blocks: ['core/code', 'core/preformatted', 'core/paragraph'], transform: function (e) { var t = e.content; return createBlock('aksrtblock/enlighter', { content: t, }); }, }, ], to: [ { type: 'block', blocks: ['core/code'], transform: function (e) { var t = e.content; return createBlock('core/code', { content: t, }); }, }, { type: 'block', blocks: ['core/preformatted'], transform: function (e) { var t = e.content; return createBlock('core/preformatted', { content: t, }); }, }, ], }, edit: function (props) { var l = props.attributes, r = props.setAttributes; var sm = el( Toolbar, null, el(DropdownMenu, { className: 'enlighter-dropdownmenu', icon: 'editor-paste-text', label: i18n__('gutenberg_set_code_language'), controls: [ { title: 'yaml', value: 'yaml', onClick: function () { return r({ c_language: 'yaml', }); }, }, { title: 'xml/html', value: 'xml', onClick: function () { return r({ c_language: 'xml', }); }, }, { title: 'visualbasic', value: 'visualbasic', onClick: function () { return r({ c_language: 'visualbasic', }); }, }, { title: 'vhdl', value: 'vhdl', onClick: function () { return r({ c_language: 'vhdl', }); }, }, { title: 'typescript', value: 'typescript', onClick: function () { return r({ c_language: 'typescript', }); }, }, { title: 'swift', value: 'swift', onClick: function () { return r({ c_language: 'swift', }); }, }, { title: 'squirrel', value: 'squirrel', onClick: function () { return r({ c_language: 'squirrel', }); }, }, { title: 'sql', value: 'sql', onClick: function () { return r({ c_language: 'sql', }); }, }, { title: 'shell', value: 'shell', onClick: function () { return r({ c_language: 'shell', }); }, }, { title: 'scss/sass', value: 'scss', onClick: function () { return r({ c_language: 'scss', }); }, }, { title: 'rust', value: 'rust', onClick: function () { return r({ c_language: 'rust', }); }, }, { title: 'ruby', value: 'ruby', onClick: function () { return r({ c_language: 'ruby', }); }, }, { title: 'raw', value: 'raw', onClick: function () { return r({ c_language: 'raw', }); }, }, { title: 'python', value: 'python', onClick: function () { return r({ c_language: 'python', }); }, }, { title: 'prolog', value: 'prolog', onClick: function () { return r({ c_language: 'prolog', }); }, }, { title: 'powershell', value: 'powershell', onClick: function () { return r({ c_language: 'powershell', }); }, }, { title: 'php', value: 'php', onClick: function () { return r({ c_language: 'php', }); }, }, { title: 'nsis', value: 'nsis', onClick: function () { return r({ c_language: 'nsis', }); }, }, { title: 'matlab', value: 'matlab', onClick: function () { return r({ c_language: 'matlab', }); }, }, { title: 'markdown', value: 'markdown', onClick: function () { return r({ c_language: 'markdown', }); }, }, { title: 'lua', value: 'lua', onClick: function () { return r({ c_language: 'lua', }); }, }, { title: 'less', value: 'less', onClick: function () { return r({ c_language: 'less', }); }, }, { title: 'kotlin', value: 'kotlin', onClick: function () { return r({ c_language: 'kotlin', }); }, }, { title: 'json', value: 'json', onClick: function () { return r({ c_language: 'json', }); }, }, { title: 'javascript', value: 'javascript', onClick: function () { return r({ c_language: 'javascript', }); }, }, { title: 'java', value: 'java', onClick: function () { return r({ c_language: 'java', }); }, }, { title: 'ini/conf', value: 'ini', onClick: function () { return r({ c_language: 'ini', }); }, }, { title: 'groovy', value: 'groovy', onClick: function () { return r({ c_language: 'groovy', }); }, }, { title: 'go/golang', value: 'go', onClick: function () { return r({ c_language: 'go', }); }, }, { title: 'docker', value: 'dockerfile', onClick: function () { return r({ c_language: 'dockerfile', }); }, }, { title: 'diff', value: 'diff', onClick: function () { return r({ c_language: 'diff', }); }, }, { title: 'cordpro', value: 'cordpro', onClick: function () { return r({ c_language: 'cordpro', }); }, }, { title: 'cython', value: 'cython', onClick: function () { return r({ c_language: 'cython', }); }, }, { title: 'css', value: 'css', onClick: function () { return r({ c_language: 'css', }); }, }, { title: 'csharp', value: 'csharp', onClick: function () { return r({ c_language: 'csharp', }); }, }, { title: 'Cpp/C++/C', value: 'cpp', onClick: function () { return r({ c_language: 'cpp', }); }, }, { title: 'avrassembly', value: 'avrassembly', onClick: function () { return r({ c_language: 'avrassembly', }); }, }, { title: 'assembly', value: 'assembly', onClick: function () { return r({ c_language: 'assembly', }); }, }, { title: i18n__('gutenberg_auto_detect'), value: 'generic', onClick: function () { return r({ c_language: 'generic', }); }, }, ], }) ), sp = el(PlainText, { value: l.content, onChange: function (e) { return r({ content: e, }); }, placeholder: i18n__('gutenberg_enter_code'), 'aria-label': 'Code', }); var ss = el(SelectControl, { label: i18n__('gutenberg_code_language'), value: l.c_language, options: [ { label: 'yaml', value: 'yaml', }, { label: 'xml/html', value: 'xml', }, { label: 'visualbasic', value: 'visualbasic', }, { label: 'vhdl', value: 'vhdl', }, { label: 'typescript', value: 'typescript', }, { label: 'swift', value: 'swift', }, { label: 'squirrel', value: 'squirrel', }, { label: 'sql', value: 'sql', }, { label: 'shell', value: 'shell', }, { label: 'scss/sass', value: 'scss', }, { label: 'rust', value: 'rust', }, { label: 'ruby', value: 'ruby', }, { label: 'raw', value: 'raw', }, { label: 'python', value: 'python', }, { label: 'prolog', value: 'prolog', }, { label: 'powershell', value: 'powershell', }, { label: 'php', value: 'php', }, { label: 'nsis', value: 'nsis', }, { label: 'matlab', value: 'matlab', }, { label: 'markdown', value: 'markdown', }, { label: 'lua', value: 'lua', }, { label: 'less', value: 'less', }, { label: 'kotlin', value: 'kotlin', }, { label: 'json', value: 'json', }, { label: 'javascript', value: 'javascript', }, { label: 'java', value: 'java', }, { label: 'ini/conf', value: 'ini', }, { label: 'groovy', value: 'groovy', }, { label: 'go/golang', value: 'go', }, { label: 'docker', value: 'dockerfile', }, { label: 'diff', value: 'diff', }, { label: 'cordpro', value: 'cordpro', }, { label: 'cython', value: 'cython', }, { label: 'css', value: 'css', }, { label: 'csharp', value: 'csharp', }, { label: 'Cpp/C++/C', value: 'cpp', }, { label: 'avrassembly', value: 'avrassembly', }, { label: 'assembly', value: 'assembly', }, { label: i18n__('gutenberg_auto_detect'), value: 'generic', }, ], onChange: function (e) { return r({ c_language: e, }); }, }), sz = el( InspectorControls, null, el( PanelBody, { icon: 'admin-appearance', title: i18n__('gutenberg_code_settings'), }, ss, el(SelectControl, { label: i18n__('gutenberg_select_theme'), value: l.theme, options: [ { label: 'enlighter', value: 'enlighter', }, { label: 'classic', value: 'classic', }, { label: 'beyond', value: 'beyond', }, { label: 'mowtwo', value: 'mowtwo', }, { label: 'eclipse', value: 'eclipse', }, { label: 'droide', value: 'droide', }, { label: 'minimal', value: 'minimal', }, { label: 'atomic', value: 'atomic', }, { label: 'dracula', value: 'dracula', }, { label: 'bootstrap4', value: 'bootstrap4', }, { label: 'rowhammer', value: 'rowhammer', }, { label: 'godzilla', value: 'godzilla', }, { label: i18n__('gutenberg_follow_theme'), value: '', }, ], onChange: function (e) { return r({ theme: e, }); }, }), el(RadioControl, { label: i18n__('gutenberg_show_line_numbers'), selected: l.linenumbers, options: [ { label: i18n__('gutenberg_follow_theme'), value: '', }, { label: i18n__('gutenberg_show'), value: 'true', }, { label: i18n__('gutenberg_hide'), value: 'false', }, ], onChange: function (e) { return r({ linenumbers: e, }); }, }), el(TextControl, { label: i18n__('gutenberg_start_line_number'), value: l.lineoffset, onChange: function (e) { return r({ lineoffset: e, }); }, placeholder: i18n__('gutenberg_line_number_example'), }), el(TextControl, { label: i18n__('gutenberg_highlight_lines'), value: l.highlight, onChange: function (e) { return r({ highlight: e, }); }, placeholder: i18n__('gutenberg_highlight_lines_format'), }) ), el( PanelBody, { title: i18n__('gutenberg_code_group'), initialOpen: !1, icon: 'excerpt-view', }, el('p', null, i18n__('gutenberg_code_group_desc')), el(TextControl, { label: i18n__('gutenberg_code_title'), value: l.title, onChange: function (e) { return r({ title: e, }); }, placeholder: i18n__('gutenberg_code_group_title'), }), el(TextControl, { label: i18n__('gutenberg_custom_group_id'), value: l.group, onChange: function (e) { return r({ group: e, }); }, placeholder: i18n__('gutenberg_custom_group_id_placeholder'), }) ) ); return el( 'div', null, el(Fragment, null, el(BlockControls, null, sm)), el( 'div', { className: 'enlighter-block-wrapper', }, el( 'div', { className: 'enlighter-header', }, el('div', { className: 'enlighter-title', }) ), el( 'pre', { tagName: 'pre', className: 'enlighter-pre', }, el( 'div', { className: 'enlighter-label', }, i18n__('gutenberg_language_label'), l.c_language, i18n__('gutenberg_theme_label'), l.theme ? l.theme : i18n__('gutenberg_follow_theme_short') ), sp ), el('div', { className: 'enlighter-footer', }), sz ) ); }, save: function (e) { var t = e.attributes, tt = el( 'code', { className: 'gl', 'data-enlighter-language': t.c_language, 'data-enlighter-theme': t.theme, 'data-enlighter-highlight': t.highlight, 'data-enlighter-linenumbers': t.linenumbers, 'data-enlighter-lineoffset': t.lineoffset, 'data-enlighter-title': t.title, 'data-enlighter-group': t.group, }, t.content ); return el('pre', {}, tt); }, }); //------------------------------------------- rB('aksrtblock/biaoti', { title: show_title(i18n__('gutenberg_heading')), icon: icon.biaoti, category: 'aksrt_block_cat', description: i18n__('gutenberg_heading_desc'), className: false, textdomain: 'default', attributes: { content: { type: 'array', source: 'children', selector: '.title-theme', }, typeClass: { source: 'attribute', selector: '.title-theme', attribute: 'class', }, color: { source: 'attribute', selector: '.title-theme', attribute: 'data-color', }, tag_name: { source: 'tag', selector: '.title-theme', attribute: 'data-color', }, }, transforms: { from: [ { type: 'block', blocks: ['core/heading', 'core/preformatted', 'core/paragraph'], transform: function (e) { var t = e.content; var tag = e.level ? 'h' + e.level : 'h2'; return createBlock('aksrtblock/biaoti', { content: t, tag_name: tag, }); }, }, ], to: [ { type: 'block', blocks: ['core/heading'], transform: function (e) { var t = e.content; var tag = e.tag_name ? e.tag_name.replace('h', '') : 2; return createBlock('core/heading', { content: t, level: ~~tag, }); }, }, { type: 'block', blocks: ['core/paragraph'], transform: function (e) { var t = e.content; return createBlock('core/paragraph', { content: t, }); }, }, { type: 'block', blocks: ['core/preformatted'], transform: function (e) { var t = e.content; return createBlock('core/preformatted', { content: t, }); }, }, ], }, edit: function (props) { var content = props.attributes.content, tag_name = props.attributes.tag_name || 'h2', typeClass = content.typeClass || 'title-theme', color = props.attributes.color; function onChangeContent(newContent) { props.setAttributes({ content: newContent, }); } function changecolor(c) { props.setAttributes({ color: c, }); } var richText = el(RichText, { tagName: 'div', onChange: onChangeContent, value: content, isSelected: props.isSelected, placeholder: i18n__('gutenberg_enter_heading'), disableLineBreaks: true, }); var outerHtml = el( 'div', { className: typeClass, 'data-color': color, style: { color: color, 'border-left-color': color, }, }, el(tag_name, {}, richText) ); const HEADING_LEVELS = [1, 2, 3, 4, 5]; var headingLeve = tag_name.replace('h', ''); var HeadingLevelDropdown = el( Toolbar, {}, el(DropdownMenu, { icon: icon['headingLevel' + headingLeve], label: i18n__('gutenberg_heading_level'), controls: HEADING_LEVELS.map(function (value) { { const value_tag = 'h' + value; const isActive = tag_name === value_tag; return { icon: icon['headingLevel' + value], isActive: isActive, onClick: function () { props.setAttributes({ tag_name: value_tag, }); }, role: 'menuitemradio', }; } }), }) ); var Co = el(c.ColorPalette, { value: color, colors: colors, className: 'q-ColorPalette', onChange: changecolor, }); return el( 'div', {}, outerHtml, el(BlockControls, null, HeadingLevelDropdown), el( InspectorControls, null, el( PanelBody, { title: i18n__('gutenberg_custom_color'), }, el( 'p', { className: 'components-base-control', }, i18n__('gutenberg_heading_color_hint') ), el( 'p', { className: 'components-base-control', }, Co ) ) ) ); }, save: function (props) { var content = props.attributes.content, tag_name = props.attributes.tag_name || 'h2', typeClass = props.attributes.typeClass || 'title-theme', color = props.attributes.color, sty = color && '--theme-color:' + color; var outerHtml = el( tag_name, { 'data-color': color, className: typeClass, style: sty, }, content ); return outerHtml; }, }); //--------------------------------------------- rB('aksrtblock/hide-content', { title: show_title(i18n__('gutenberg_hidden_content')), icon: { src: 'hidden', foreground: icon_color, }, description: i18n__('gutenberg_hidden_content_desc'), category: 'aksrt_block_cat', attributes: { type: { source: 'attribute', selector: 'div', attribute: 'data-type', }, password: { source: 'attribute', selector: '[data-password]', attribute: 'data-password', default: '', }, img_id: { source: 'attribute', selector: '[data-img-id]', attribute: 'data-img-id', default: '', }, img_url: { source: 'attribute', selector: '[data-img-url]', attribute: 'data-img-url', default: '', }, desc: { source: 'attribute', selector: '[data-desc]', attribute: 'data-desc', default: '', }, }, edit: function (props) { var sa = props.setAttributes, pa = props.attributes, type_v = pa.type || 'reply', xzk = el( 'div', { className: 'hide-innerblocks', }, el(InnerBlocks) ), text = { reply: i18n__('gutenberg_comment_visible'), payshow: i18n__('gutenberg_paid_reading'), logged: i18n__('gutenberg_login_visible'), password: i18n__('gutenberg_password_verify'), vip1: i18n__('gutenberg_all_vip_visible'), vip2: i18n__('gutenberg_vip2_visible'), }; var gjl = el( Toolbar, {}, el(DropdownMenu, { icon: 'editor-paste-text', className: 'aksrtblock-buttons-sl', label: i18n__('gutenberg_hidden_mode_select'), controls: [ { title: text.reply, value: 'reply', onClick: function () { sa({ type: 'reply', }); }, }, { title: text.logged, value: 'logged', onClick: function () { sa({ type: 'logged', }); }, }, { title: text.password, value: 'password', onClick: function () { sa({ type: 'password', }); }, }, { title: text.payshow, value: 'payshow', onClick: function () { sa({ type: 'payshow', }); }, }, { title: text.vip1, value: 'vip1', onClick: function () { sa({ type: 'vip1', }); }, }, { title: text.vip2, value: 'vip2', onClick: function () { sa({ type: 'vip2', }); }, }, ], }) ), dqk = el(Fragment, null, el(BlockControls, null, gjl)); return el( 'div', { className: 'hide-content', }, dqk, el( 'div', { className: 'hide-title', }, i18n_sprintf('gutenberg_hidden_content_title', text[type_v]), el('span', { className: 'dashicons dashicons-admin-generic', style: { float: 'right', margin: '5px 10px', }, }) ), xzk, el( InspectorControls, null, help_link(853), el( PanelBody, { title: i18n__('gutenberg_hidden_content_settings'), }, el(SelectControl, { label: i18n__('gutenberg_hidden_visible_mode'), value: type_v, options: [ { label: text.reply, value: 'reply', }, { label: text.logged, value: 'logged', }, { label: text.password, value: 'password', }, { label: text.payshow, value: 'payshow', }, { label: text.vip1, value: 'vip1', }, { label: text.vip2, value: 'vip2', }, ], onChange: function (e) { sa({ type: e, }); }, }), [ type_v == 'payshow' && el( 'div', { className: 'block-editor-block-card__description', }, i18n__('gutenberg_paid_reading_hint'), el( 'a', { href: '""#wznav_3', target: 'blank', }, i18n__('gutenberg_view_official_tutorial_link') ) ), ], [ type_v == 'password' && el( 'div', { className: 'block-editor-block-card__description', }, el(TextControl, { label: i18n__('gutenberg_set_password'), value: pa.password || '', onChange: function (e) { return sa({ password: e, }); }, placeholder: i18n__('gutenberg_enter_password'), }), el(TextControl, { label: i18n__('gutenberg_remind_text'), value: pa.desc || '', onChange: function (e) { return sa({ desc: e, }); }, placeholder: i18n__('gutenberg_enter_remind_content'), }), [ pa.img_id && el( 'div', { className: ' ', }, el('img', { src: pa.img_url, }) ), ], el(MediaUpload, { title: i18n__('gutenberg_remind_image'), allowedTypes: ['image'], onSelect: function onSelect(media) { sa({ img_url: media.url, img_id: media.id, }); }, value: pa.img_id, render: function render(_ref) { var open = _ref.open; return el( Button, { className: 'but jb-blue is-secondary', onClick: open, }, [pa.img_id ? i18n__('gutenberg_replace_remind_image') : i18n__('gutenberg_add_remind_image')] ); }, }), el( 'div', { className: 'mt10 em09', }, i18n__('gutenberg_password_remind_hint') ), el( 'div', { className: 'mt6 em09', }, i18n__('gutenberg_password_unique_hint') ) ), ], el( 'div', { className: 'opacity8 mb10 em09 mt10 c-yellow', }, i18n__('gutenberg_hidden_no_nest_hint') ) ) ) ); }, save: function (props) { var pa = props.attributes; var type = pa.type || 'reply'; var tag = {}; var tag_2 = ''; if (type == 'password') { tag = { 'data-password': pa.password, 'data-img-id': pa.img_id, 'data-img-url': pa.img_url, 'data-desc': pa.desc, }; tag_2 = ' password="' + pa.password + '" img_id="' + pa.img_id + '" img_url="' + pa.img_url + '" desc="' + pa.desc + '"'; } return el( 'div', { 'data-type': type, }, [el('span', {}, '[hidecontent type="' + type + '"' + tag_2 + ']'), el(InnerBlocks.Content), el('span', tag, '[/hidecontent]')] ); }, }); //--------------------------------------------------------------------------------- var debounce_ajax_get = debounce(ajax_get, 600); function ajax_get(data, callback) { var url = data.url || wpApiSettings.root + 'wp/v2/search'; $.get(url, data, callback); } rB('aksrtblock/postslists', { title: show_title(i18n__('gutenberg_post_list')), icon: icon.postslists, attributes: { orderby: { source: 'attribute', selector: '.single-posts-lists', attribute: 'data-orderby', default: 'date', }, cat: { source: 'attribute', selector: '.single-posts-lists', attribute: 'data-cat', default: '', }, topics: { source: 'attribute', selector: '.single-posts-lists', attribute: 'data-topics', default: '', }, style: { source: 'attribute', selector: '.single-posts-lists', attribute: 'data-style', default: 'text', }, count: { source: 'attribute', selector: '.single-posts-lists', attribute: 'data-count', default: 12, }, paginate: { source: 'attribute', selector: '.single-posts-lists', attribute: 'data-paginate', default: '', }, }, description: i18n__('gutenberg_post_list_desc'), category: 'aksrt_block_cat', edit: function (props) { var attr = props.attributes; var setattr = props.setAttributes; var orderby = attr.orderby || 'date'; var cat = attr.cat || ''; var topics = attr.topics || ''; var style = attr.style || 'text'; var count = attr.count || 12; var paginate = attr.paginate || ''; var trem_edit = function (type) { var name = type === 'topics' ? i18n__('gutenberg_topics') : i18n__('gutenberg_category'); var label = i18n_sprintf('gutenberg_taxonomy_id_select', name); return el(TextControl, { label: i18n_sprintf('gutenberg_taxonomy_limit', name), value: type === 'topics' ? topics : cat, help: i18n_sprintf('gutenberg_taxonomy_id_help', name), onChange: function (e) { return type === 'topics' ? setattr({ topics: e, }) : setattr({ cat: e, }); }, placeholder: label, }); }; var edit = el( 'div', {}, trem_edit('cat'), trem_edit('topics'), el(SelectControl, { label: i18n__('gutenberg_orderby'), value: orderby, options: [ { label: i18n__('gutenberg_post_title'), value: 'title', }, { label: i18n__('gutenberg_recent_update'), value: 'modified', }, { label: i18n__('gutenberg_latest_publish'), value: 'date', }, { label: i18n__('gutenberg_by_comments'), value: 'comment_count', }, { label: i18n__('gutenberg_by_likes'), value: 'like', }, { label: i18n__('gutenberg_by_views'), value: 'views', }, { label: i18n__('gutenberg_by_favorites'), value: 'favorite', }, { label: i18n__('gutenberg_sale_price'), value: 'aksrtpay_price', }, { label: i18n__('gutenberg_points_price'), value: 'aksrtpay_points_price', }, { label: i18n__('gutenberg_sales_volume'), value: 'sales_volume', }, { label: i18n__('gutenberg_random_order'), value: 'rand', }, ], onChange: function (e) { return setattr({ orderby: e, }); }, }), el(RadioControl, { label: i18n__('gutenberg_list_style'), selected: style, options: [ { label: i18n__('gutenberg_text_list'), value: 'text', }, { label: i18n__('gutenberg_mini_card'), value: 'minicard', }, ], onChange: function (e) { return setattr({ style: e, }); }, }), el(TextControl, { label: (paginate != '' ? i18n__('gutenberg_per_page') : '') + i18n__('gutenberg_display_count'), value: count, onChange: function (e) { return setattr({ count: e, }); }, placeholder: i18n__('gutenberg_enter_display_count'), }), el(RadioControl, { label: i18n__('gutenberg_pagination'), selected: paginate, options: [ { label: i18n__('gutenberg_not_show'), value: '', }, { label: i18n__('gutenberg_ajax_pagination'), value: 'ajax', }, { label: i18n__('gutenberg_number_pagination'), value: 'number', }, ], onChange: function (e) { return setattr({ paginate: e, }); }, }) ); var panel_edit = el( InspectorControls, null, help_link(22555), el( PanelBody, { title: i18n__('gutenberg_post_list_settings'), }, edit ) ); return el( 'div', { className: 'theme-card-box', }, el( 'div', { className: 'em12 mb10 flex ac', }, icon.postsbox, el( 'span', { className: 'ml10', }, show_title(i18n__('gutenberg_post_list')) ) ), el( 'div', { className: 'opacity8 mb10 em09', }, i18n__('gutenberg_post_list_desc') ), props.isSelected ? el( PanelBody, { initialOpen: false, title: i18n__('gutenberg_post_list_settings'), }, edit ) : el( 'div', { class: 'px12', }, '[cat="' + attr.cat + '" topics="' + attr.topics + '" orderby="' + attr.orderby + '" style="' + attr.style + '" count="' + attr.count + '" paginate="' + attr.paginate + '"]' ), panel_edit ); }, save: function (props) { var attr = props.attributes; return el( 'div', { class: 'single-posts-lists', contenteditable: 'false', 'data-orderby': attr.orderby, 'data-cat': attr.cat, 'data-topics': attr.topics, 'data-style': attr.style, 'data-count': attr.count, 'data-paginate': attr.paginate, }, '[postslists cat="' + attr.cat + '" topics="' + attr.topics + '" orderby="' + attr.orderby + '" style="' + attr.style + '" count="' + attr.count + '" paginate="' + attr.paginate + '"]' ); }, }); //--------------------------------------------------------------------------------- rB('aksrtblock/postsbox', { title: show_title(i18n__('gutenberg_post_card')), icon: icon.postsbox, attributes: { post_id: { source: 'attribute', selector: 'div', attribute: 'data-pid', }, }, description: i18n__('gutenberg_post_card_desc'), category: 'aksrt_block_cat', edit: function (props) { var content = props.attributes.post_id; var that = props.attributes; that.search_lists = that.search_lists || []; function onChangeContent(e) { props.setAttributes({ post_id: e, }); ajax(e); } function ajax(e) { if (e.length < 2 || ~~e || that.loading) { return; } var ajax_data = { per_page: 20, search: e, type: 'post', post_type: ['post', 'forum_post'], order_by: 'post_title', }; props.setAttributes({ loading: true, }); return debounce_ajax_get(ajax_data, function (data) { data = data || []; props.setAttributes({ search_lists: data, }); props.setAttributes({ loading: false, }); }); } function onKeyDown(e) { if (e.keyCode == 13) { ajax(e.target.value); } } var rti = el( 'div', { className: 'rti-container', }, props.isSelected ? el( 'div', {}, el(TextControl, { tagName: 'div', onChange: onChangeContent, required: true, onKeyDown: onKeyDown, value: content, // type: 'number', placeholder: i18n__('gutenberg_search_post_id'), label: i18n__('gutenberg_search_post_id'), }), that.loading && el(c.Spinner, { style: { position: 'absolute', right: '12px', bottom: '30px', }, }) ) : el( 'div', { className: ' ' + (~~content ? 'px12' : 'c-red em09'), }, ~~content ? '[ID:' + content + ']' + (that.post_title ? that.post_title : '') : i18n__('gutenberg_post_id_invalid') ) ); function get_el(index) { return el( 'button', { className: 'components-button components-menu-item__button block-editor-link-control__search-item has-text has-icon', key: index, onClick: function () { props.setAttributes({ post_id: that.search_lists[index].id, post_title: that.search_lists[index].title, }); this.popover_anchor_rect = false; }, }, el( 'span', { className: 'em12 mr6', }, icon.postsbox ), el( 'span', { className: 'components-menu-item__item', }, el( 'span', { className: 'components-menu-item__info-wrapper', }, el( 'span', { className: 'components-menu-item__item', }, '[' + that.search_lists[index].id + ']' + that.search_lists[index].title ) ) ), el( 'span', { className: 'components-menu-item__shortcut', }, that.search_lists[index].subtype ) ); } return el( 'div', { className: 'theme-card-box', }, el( 'div', { className: 'em12 mb10 flex ac', }, icon.postsbox, el( 'span', { className: 'ml10', }, show_title(i18n__('gutenberg_post_card')) ) ), el( 'div', { className: 'opacity8 mb10 em09', }, i18n__('gutenberg_post_card_hint') ), rti, props.isSelected && that.search_lists.length > 0 && el( Popover, { focusOnMount: false, position: 'left middle center ', className: ' ', }, el( 'div', { className: 'block-editor-link-control', }, el( 'div', { className: 'mt6 block-editor-link-control__search-results', }, that.search_lists.map(function (item, index) { return get_el(index); }) ) ) ), el(InspectorControls, null, help_link(860)) ); }, save: function (props) { var post_id = props.attributes.post_id; return el( 'div', { 'data-pid': post_id, }, '[postsbox post_id="' + post_id + '"]' ); }, }); rB('aksrtblock/quote', { title: show_title(i18n__('gutenberg_quote')), icon: { src: 'format-quote', foreground: icon_color, }, description: i18n__('gutenberg_quote_desc'), category: 'aksrt_block_cat', attributes: { content: { type: 'array', source: 'children', selector: '.quote_q p', }, typeClass: { source: 'attribute', selector: '.quote_q', attribute: 'class', }, color: { source: 'attribute', selector: '.quote_q', attribute: 'data-color', }, }, transforms: { from: [ { type: 'block', blocks: ['aksrtblock/alert', 'core/quote', 'core/preformatted', 'core/paragraph'], transform: function (e) { var t = e.content; return createBlock('aksrtblock/quote', { content: t, }); }, }, ], to: [ { type: 'block', blocks: ['core/quote'], transform: function (e) { var t = e.content; return createBlock('core/quote', { content: t, }); }, }, { type: 'block', blocks: ['aksrtblock/alert'], transform: function (e) { var t = e.content; return createBlock('aksrtblock/alert', { content: t, }); }, }, { type: 'block', blocks: ['core/paragraph'], transform: function (e) { var t = e.content; return createBlock('core/paragraph', { content: t, }); }, }, { type: 'block', blocks: ['core/preformatted'], transform: function (e) { var t = e.content; return createBlock('core/preformatted', { content: t, }); }, }, ], }, edit: function (props) { var content = props.attributes.content, typeClass = props.attributes.typeClass || 'quote_q', color = props.attributes.color, sty = color ? color : ''; function changecolor(e) { props.setAttributes({ color: e, }); } function onChangeContent(e) { props.setAttributes({ content: e, }); } var richText = el(RichText, { tagName: 'div', isSelected: props.isSelected, onChange: onChangeContent, value: content, placeholder: i18n__('gutenberg_enter_content'), }); var outerHtml = el( 'div', { className: typeClass, style: { '--quote-color': sty, }, }, el('i', { className: 'fa fas fa-quote-left', }), richText ); var Co = el(c.ColorPalette, { value: color || '#555', colors: colors, className: 'q-ColorPalette', onChange: changecolor, }); return el( 'div', {}, outerHtml, el( 'div', {}, el( InspectorControls, null, el( PanelBody, { title: i18n__('gutenberg_custom_color'), }, el('p', {}, i18n__('gutenberg_quote_color_hint')), el('p', {}, Co) ) ) ) ); }, save: function (props) { var content = props.attributes.content, typeClass = props.attributes.typeClass || 'quote_q', color = props.attributes.color, sty = color && '--quote-color:' + color; var outerHtml = el( 'div', { className: typeClass, 'data-color': color, style: sty, }, el('i', { className: 'fa fas fa-quote-left', }), el('p', {}, content) ); return el('div', {}, outerHtml); }, }); //------------------------------------------------------------- rB('aksrtblock/alert', { title: show_title(i18n__('gutenberg_alert')), icon: { src: 'info', foreground: icon_color, }, description: i18n__('gutenberg_alert_desc'), category: 'aksrt_block_cat', attributes: { content: { type: 'array', source: 'children', selector: 'div.alert', }, typeClass: { source: 'attribute', selector: '.alert', attribute: 'class', }, isChecked: { source: 'attribute', selector: '.alert', attribute: 'data-isclose', }, }, transforms: { from: [ { type: 'block', blocks: ['aksrtblock/quote', 'core/quote', 'core/preformatted', 'core/paragraph'], transform: function (e) { var t = e.content; return createBlock('aksrtblock/alert', { content: t, }); }, }, ], to: [ { type: 'block', blocks: ['core/quote'], transform: function (e) { var t = e.content; return createBlock('core/quote', { content: t, }); }, }, { type: 'block', blocks: ['aksrtblock/quote'], transform: function (e) { var t = e.content; return createBlock('aksrtblock/quote', { content: t, }); }, }, { type: 'block', blocks: ['core/paragraph'], transform: function (e) { var t = e.content; return createBlock('core/paragraph', { content: t, }); }, }, { type: 'block', blocks: ['core/preformatted'], transform: function (e) { var t = e.content; return createBlock('core/preformatted', { content: t, }); }, }, ], }, edit: function (props) { var content = props.attributes.content, typeClass = props.attributes.typeClass || 'alert jb-blue', isChecked = props.attributes.isChecked, isSelected = props.isSelected; function onChangeContent(e) { props.setAttributes({ content: e, }); } function onisChecked(e) { props.setAttributes({ isChecked: e, }); } function changeType(e) { var type = e.target.className; props.setAttributes({ typeClass: 'alert ' + type, }); } var richText = el(RichText, { tagName: 'div', isSelected: props.isSelected, onChange: onChangeContent, value: content, placeholder: i18n__('gutenberg_enter_content'), }); var outerHtml = el( 'div', { className: typeClass, }, richText ); var selector = el( 'span', { className: 'g_extend anz alert_b', }, [ el('button', { className: 'jb-blue', onClick: changeType, }), el('button', { className: 'jb-green', onClick: changeType, }), el('button', { className: 'jb-yellow', onClick: changeType, }), el('button', { className: 'jb-red', onClick: changeType, }), ] ), closebutton = el( 'div', { className: 'close_an', }, el(ToggleControl, { label: i18n__('gutenberg_alert_closable'), checked: isChecked, onChange: onisChecked, }) ); return el( 'div', {}, [ outerHtml, isChecked && el( 'button', { className: 'close', }, '×' ), isSelected && selector, isSelected && closebutton, ], el( InspectorControls, null, el( PanelBody, { icon: 'admin-appearance', title: i18n__('gutenberg_alert_settings'), }, el('div', {}, i18n__('gutenberg_alert_type')), el('div', {}, selector) ), closebutton ) ); }, save: function (props) { var content = props.attributes.content, isChecked = props.attributes.isChecked || '', typeClass = props.attributes.typeClass || 'alert jb-blue'; var Close = el( 'button', { type: 'button', className: 'close', 'data-dismiss': 'alert', 'aria-label': 'Close', }, el('div', { 'data-class': 'ic-close', 'data-svg': 'close', 'data-viewbox': '0 0 1024 1024', }) ); var outerHtml = el( 'div', { className: typeClass, 'data-isclose': isChecked, role: 'alert', }, content ); return el( 'div', { className: 'alert-dismissible fade in', }, [isChecked && Close], outerHtml ); }, }); //------------------------------------------------------------- rB('aksrtblock/buttons', { title: show_title(i18n__('gutenberg_buttons')), description: i18n__('gutenberg_buttons_desc'), icon: icon.buttons, category: 'aksrt_block_cat', attributes: { alignment: { type: 'string', }, quantity: { type: 'attribute', attribute: 'data-quantity', default: 1, }, radius: { type: 'attribute', attribute: 'data-radius', default: true, }, content1: { type: 'array', source: 'children', selector: 'span.an_1', }, typeClass1: { source: 'attribute', selector: '.an_1', attribute: 'class', }, content2: { type: 'array', source: 'children', selector: 'span.an_2', }, typeClass2: { source: 'attribute', selector: '.an_2', attribute: 'class', }, content3: { type: 'array', source: 'children', selector: 'span.an_3', }, typeClass3: { source: 'attribute', selector: '.an_3', attribute: 'class', }, content4: { type: 'array', source: 'children', selector: 'span.an_4', }, typeClass4: { source: 'attribute', selector: '.an_4', attribute: 'class', }, content5: { type: 'array', source: 'children', selector: 'span.an_5', }, typeClass5: { source: 'attribute', selector: '.an_5', attribute: 'class', }, }, transforms: { from: [ { type: 'block', blocks: ['core/paragraph'], transform: function (e) { var t = e.content; return createBlock('aksrtblock/buttons', { content1: t, }); }, }, ], to: [ { type: 'block', blocks: ['core/paragraph'], transform: function (e) { var t = e.content1; return createBlock('core/paragraph', { content: t, }); }, }, ], }, edit: function (props) { var at = props.attributes, sa = props.setAttributes, alignment = at.alignment, isS = props.isSelected, sl = at.quantity, rd = at.radius, c = []; for (let i = 0; i <= 5; i++) { (c['c' + i] = at['content' + i]), (c['cs' + i] = at['typeClass' + i] || 'but b-blue'), (c['rt' + i] = el(RichText, { tagName: 'div', onChange: function (e) { sa({ ['content' + i]: e, }); }, value: c['c' + i], isSelected: props.isS, placeholder: i18n__('gutenberg_button') + '-' + i, })), (c['crt' + i] = el( 'div', { className: c['cs' + i], }, c['rt' + i] )), (c['bk' + i] = el( 'button', { className: 'anz sz', onClick: function () { $('.anz.an.x' + i).slideToggle(200); }, }, el('span', { className: 'dashicons dashicons-admin-appearance', }) )), (c['btt' + i] = el( 'div', { className: 'g_extend anz an x' + i, }, el( 'button', { className: 'but b-red', onClick: function (e) { sa({ ['typeClass' + i]: 'an_' + i + ' ' + e.target.className, }); }, }, '' ), el( 'button', { className: 'but b-yellow', onClick: function (e) { sa({ ['typeClass' + i]: 'an_' + i + ' ' + e.target.className, }); }, }, '' ), el( 'button', { className: 'but b-blue', onClick: function (e) { sa({ ['typeClass' + i]: 'an_' + i + ' ' + e.target.className, }); }, }, '' ), el( 'button', { className: 'but b-green', onClick: function (e) { sa({ ['typeClass' + i]: 'an_' + i + ' ' + e.target.className, }); }, }, '' ), el( 'button', { className: 'but b-purple', onClick: function (e) { sa({ ['typeClass' + i]: 'an_' + i + ' ' + e.target.className, }); }, }, '' ), el( 'button', { className: 'but hollow c-red', onClick: function (e) { sa({ ['typeClass' + i]: 'an_' + i + ' ' + e.target.className, }); }, }, '' ), el( 'button', { className: 'but hollow c-yellow', onClick: function (e) { sa({ ['typeClass' + i]: 'an_' + i + ' ' + e.target.className, }); }, }, '' ), el( 'button', { className: 'but hollow c-blue', onClick: function (e) { sa({ ['typeClass' + i]: 'an_' + i + ' ' + e.target.className, }); }, }, '' ), el( 'button', { className: 'but hollow c-green', onClick: function (e) { sa({ ['typeClass' + i]: 'an_' + i + ' ' + e.target.className, }); }, }, '' ), el( 'button', { className: 'but hollow c-purple', onClick: function (e) { sa({ ['typeClass' + i]: 'an_' + i + ' ' + e.target.className, }); }, }, '' ), el( 'button', { className: 'but jb-red', onClick: function (e) { sa({ ['typeClass' + i]: 'an_' + i + ' ' + e.target.className, }); }, }, '' ), el( 'button', { className: 'but jb-yellow', onClick: function (e) { sa({ ['typeClass' + i]: 'an_' + i + ' ' + e.target.className, }); }, }, '' ), el( 'button', { className: 'but jb-blue', onClick: function (e) { sa({ ['typeClass' + i]: 'an_' + i + ' ' + e.target.className, }); }, }, '' ), el( 'button', { className: 'but jb-green', onClick: function (e) { sa({ ['typeClass' + i]: 'an_' + i + ' ' + e.target.className, }); }, }, '' ), el( 'button', { className: 'but jb-purple', onClick: function (e) { sa({ ['typeClass' + i]: 'an_' + i + ' ' + e.target.className, }); }, }, '' ) )); } var gjl = el( Toolbar, {}, el(DropdownMenu, { icon: 'plus-alt', className: 'aksrtblock-buttons-sl', label: i18n__('gutenberg_button_count'), controls: [ { title: i18n__('gutenberg_count_1'), value: 1, onClick: function () { sa({ quantity: 1, }); }, }, { title: i18n__('gutenberg_count_2'), onClick: function () { sa({ quantity: 2, }); }, }, { title: i18n__('gutenberg_count_3'), value: 3, onClick: function () { sa({ quantity: 3, }); }, }, { title: i18n__('gutenberg_count_4'), value: 4, onClick: function () { sa({ quantity: 4, }); }, }, { title: i18n__('gutenberg_count_5'), value: 5, onClick: function () { sa({ quantity: 5, }); }, }, ], }) ), dqk = el( Fragment, null, el( BlockControls, null, gjl, el(AlignmentToolbar, { value: alignment, onChange: function (e) { sa({ alignment: e, }); }, }) ) ); return el( 'div', { style: { textAlign: alignment, }, className: 'aniuzu ' + (rd && 'radius'), }, dqk, [c.crt1, isS && c.bk1, isS && c.btt1], [sl >= 2 && [c.crt2, isS && c.bk2, isS && c.btt2]], [sl >= 3 && [c.crt3, isS && c.bk3, isS && c.btt3]], [sl >= 4 && [c.crt4, isS && c.bk4, isS && c.btt4]], [sl >= 5 && [c.crt5, isS && c.bk5, isS && c.btt5]], el( InspectorControls, null, el( PanelBody, { icon: 'admin-generic', title: i18n__('gutenberg_button_settings'), }, el(RangeControl, { label: i18n__('gutenberg_button_count'), value: sl, onChange: function (e) { sa({ quantity: e, }); }, min: '1', max: '5', }), el(ToggleControl, { className: 'close_an', label: i18n__('gutenberg_button_radius'), checked: rd, onChange: function (e) { sa({ radius: e, }); }, }) ) ) ); }, save: function (props) { var at = props.attributes, alignment = at.alignment, sl = at.quantity, rd = at.radius, c = []; for (let i = 0; i <= 5; i++) { (c[i] = at['content' + i]), (c['s' + i] = at['typeClass' + i] || 'an_' + i + ' but b-blue'), (c['jg' + i] = el( 'span', { className: c['s' + i], }, c[i] )); } return el( 'div', { 'data-quantity': sl, 'data-radius': rd, style: { textAlign: alignment, }, className: rd && 'radius', }, [sl > 0 && c.jg1], [sl > 1 && c.jg2], [sl > 2 && c.jg3], [sl > 3 && c.jg4], [sl > 4 && c.jg5] ); }, }); //------------------------------------------------------------- rB('aksrtblock/carousel', { title: show_title(i18n__('gutenberg_carousel')), description: i18n__('gutenberg_carousel_desc'), icon: { src: 'images-alt2', foreground: icon_color, }, category: 'aksrt_block_cat', attributes: { center: { type: 'string', selector: 'div', source: 'attribute', attribute: 'data-cen', default: true, }, interval: { type: 'string', selector: '.carousel', source: 'attribute', attribute: 'data-interval', default: 4000, }, limitedwidth: { type: 'string', selector: 'div', source: 'attribute', attribute: 'data-liw', default: true, }, maxwidth: { type: 'string', source: 'attribute', selector: 'div', attribute: 'data-mw', default: 600, }, effect: { type: 'string', selector: '.carousel', source: 'attribute', attribute: 'data-effect', default: '', }, jyloop: { type: 'string', selector: '.carousel', source: 'attribute', attribute: 'data-jyloop', default: true, }, id: { type: 'string', selector: '.carousel', source: 'attribute', attribute: 'id', }, proportion: { type: 'string', selector: '.carousel', source: 'attribute', attribute: 'proportion', default: '0.6', }, }, edit: function (props) { var at = props.attributes, liw = at.limitedwidth, int = at.interval, cn = at.center, mw = at.maxwidth, eff = at.effect, lop = at.jyloop, sa = props.setAttributes; var sjs = parseInt((Math.random() + 1) * Math.pow(10, 4)); if (!at.id) { sa({ id: sjs, }); } const TEMPLATE = [ [ 'core/gallery', { linkTo: 'none', columns: '8', }, ], ]; var xzk = el( InnerBlocks, { allowedBlocks: ['core/gallery'], templateLock: '', template: TEMPLATE, }, '' ), inhg = el(RangeControl, { label: i18n__('gutenberg_switch_interval'), value: int / 1000, onChange: function (e) { sa({ interval: e * 1000, }); }, min: '1', max: '20', }), jzxh = el(ToggleControl, { label: i18n__('gutenberg_loop'), checked: lop, onChange: function (e) { sa({ jyloop: e, }); }, }), wdxz = el(ToggleControl, { label: i18n__('gutenberg_limit_max_width'), checked: liw, onChange: function (e) { sa({ limitedwidth: e, }); }, }), jza = el(ToggleControl, { label: i18n__('gutenberg_center_display'), checked: cn, onChange: function (e) { sa({ center: e, }); }, }), mwhg = el(RangeControl, { label: i18n__('gutenberg_max_width'), value: mw, onChange: function (e) { sa({ maxwidth: e, }); }, min: '200', max: '1500', }), eeff = el(SelectControl, { label: i18n__('gutenberg_switch_animation'), value: eff, onChange: function (e) { sa({ effect: e, }); }, options: [ { label: i18n__('gutenberg_slide'), value: '', }, { label: i18n__('gutenberg_fade'), value: 'fade', }, { label: i18n__('gutenberg_3d_cube'), value: 'cube', }, { label: i18n__('gutenberg_3d_slide'), value: 'coverflow', }, { label: i18n__('gutenberg_3d_flip'), value: 'flip', }, ], }); return el( 'div', { className: 'carousel iss', }, el( 'div', { className: 'leab', }, show_title(i18n__('gutenberg_carousel')), el('span', { className: 'dashicons dashicons-admin-generic', }) ), xzk, el( InspectorControls, null, help_link(675), el( PanelBody, { title: i18n__('gutenberg_carousel_settings'), }, eeff, el(SelectControl, { label: i18n__('gutenberg_keep_aspect_ratio'), value: at.proportion, options: [ { label: i18n__('gutenberg_disabled'), value: '', }, { label: i18n__('gutenberg_ratio_landscape_3_1'), value: '0.333', }, { label: i18n__('gutenberg_ratio_landscape_5_2'), value: '0.4', }, { label: i18n__('gutenberg_ratio_landscape_2_1'), value: '0.5', }, { label: i18n__('gutenberg_ratio_landscape_5_3'), value: '0.6', }, { label: i18n__('gutenberg_ratio_landscape_4_3'), value: '0.75', }, { label: i18n__('gutenberg_ratio_landscape_5_4'), value: '0.75', }, { label: i18n__('gutenberg_ratio_landscape_8_7'), value: '0.875', }, { label: i18n__('gutenberg_ratio_square_1_1'), value: '1', }, { label: i18n__('gutenberg_ratio_portrait_7_8'), value: '1.142', }, { label: i18n__('gutenberg_ratio_portrait_4_5'), value: '1.25', }, { label: i18n__('gutenberg_ratio_portrait_3_4'), value: '1.333', }, { label: i18n__('gutenberg_ratio_portrait_3_5'), value: '1.666', }, { label: i18n__('gutenberg_ratio_portrait_1_2'), value: '2', }, { label: i18n__('gutenberg_ratio_portrait_2_5'), value: '2.5', }, { label: i18n__('gutenberg_ratio_portrait_1_3'), value: '3', }, ], onChange: function (e) { sa({ proportion: e, }); }, }), inhg, jzxh, wdxz, liw && [mwhg, jza], el('p', null, i18n__('gutenberg_carousel_ratio_hint')) ) ) ); }, save: function (props) { var at = props.attributes, liw = at.limitedwidth ? 'true' : '', cn = at.center ? 'true' : '', mw = at.maxwidth, int = at.interval, eff = at.effect, lop = at.jyloop ? 'true' : '', mar = (liw && cn && '10px auto') || '', mww = (liw && mw + 'px') || '', id = at.id; var dhl = el('div', { className: 'swiper-button-next', }), dhr = el('div', { className: 'swiper-button-prev', }), zsq = el('div', { className: 'swiper-pagination', }); return el( 'div', { 'data-mw': mw, 'data-liw': liw, 'data-cen': cn, className: 'wp-block-carousel', }, el( 'div', { className: 'carousel slide', 'data-effect': eff, 'data-jyloop': lop, 'data-interval': int, id: id, proportion: at.proportion, style: { 'max-width': mww, margin: mar, }, }, el(InnerBlocks.Content), dhl, dhr, zsq ) ); }, }); //------------------------------------------------------------- rB('aksrtblock/seamlessimg', { title: show_title(i18n__('gutenberg_seamless_image')), description: i18n__('gutenberg_seamless_image_desc'), className: false, icon: icon.seamlessimg, category: 'aksrt_block_cat', attributes: { full_container: { type: 'string', selector: 'div', source: 'attribute', attribute: 'data-full-container', default: true, }, }, edit: function (props) { var at = props.attributes, full_container = at.full_container, isChecked = props.attributes.isChecked, sa = props.setAttributes; const TEMPLATE = [ [ 'core/gallery', { linkTo: 'none', columns: 1, imageCrop: false, fixedHeight: false, sizeSlug: 'full', }, ], ]; var xzk = el( InnerBlocks, { allowedBlocks: ['core/gallery'], templateLock: '', template: TEMPLATE, }, '' ), jza = el(ToggleControl, { label: i18n__('gutenberg_width_full_container'), checked: full_container, onChange: function (e) { sa({ full_container: e, }); }, }); return el( 'div', { className: 'carousel iss seamless-img' + (full_container ? ' full-container' : ''), }, el( 'div', { className: 'leab', }, show_title(i18n__('gutenberg_seamless_image')), el('span', { className: 'dashicons dashicons-admin-generic', }) ), xzk, el( InspectorControls, null, help_link(675), el( PanelBody, { title: i18n__('gutenberg_seamless_image_settings'), }, jza, el('p', { className: 'px12 opacity5' }, i18n__('gutenberg_seamless_image_full_hint')) ) ) ); }, save: function (props) { var at = props.attributes, full_container = at.full_container ? 'true' : ''; return el( 'div', { 'data-full-container': full_container, className: 'seamless-img' + (full_container ? ' full-container' : ''), }, el(InnerBlocks.Content) ); }, }); //--------------------------------------------------------------------------------- rB('aksrtblock/productbox', { title: show_title(i18n__('gutenberg_product')), icon: icon.productbox, className: false, attributes: { post_id: { source: 'attribute', selector: 'div', attribute: 'data-pid', }, }, description: i18n__('gutenberg_product_desc'), category: 'aksrt_block_cat', edit: function (props) { var content = props.attributes.post_id; var that = props.attributes; var setAttributes = props.setAttributes; that.search_lists = that.search_lists || []; function onChangeContent(e) { setAttributes({ post_id: e, }); ajax(e); } function ajax(e) { if (e.length < 2 || ~~e || that.loading) { return; } var ajax_data = { per_page: 20, search: e, type: 'post', post_type: ['shop_product'], order_by: 'post_title', }; setAttributes({ loading: true, }); return debounce_ajax_get(ajax_data, function (data) { data = data || []; setAttributes({ search_lists: data, loading: false, }); }); } function onKeyDown(e) { if (e.keyCode == 13) { ajax(e.target.value); } } var rti = el( 'div', { className: 'rti-container', }, props.isSelected ? el( 'div', {}, el(TextControl, { tagName: 'div', onChange: onChangeContent, required: true, onKeyDown: onKeyDown, value: content, // type: 'number', placeholder: i18n__('gutenberg_search_product_id'), label: i18n__('gutenberg_search_product_id'), }), that.loading && el(c.Spinner, { style: { position: 'absolute', right: '12px', bottom: '30px', }, }) ) : el( 'div', { className: ' ' + (~~content ? 'px12' : 'c-red em09'), }, ~~content ? '[ID:' + content + ']' + (that.post_title ? that.post_title : '') : i18n__('gutenberg_product_id_invalid') ) ); function get_el(index) { return el( 'button', { className: 'components-button components-menu-item__button block-editor-link-control__search-item has-text has-icon', key: index, onClick: function () { props.setAttributes({ post_id: that.search_lists[index].id, post_title: that.search_lists[index].title, }); this.popover_anchor_rect = false; }, }, el( 'span', { className: 'em12 mr6', }, icon.postsbox ), el( 'span', { className: 'components-menu-item__item', }, el( 'span', { className: 'components-menu-item__info-wrapper', }, el( 'span', { className: 'components-menu-item__item', }, '[' + that.search_lists[index].id + ']' + that.search_lists[index].title ) ) ), el( 'span', { className: 'components-menu-item__shortcut', }, that.search_lists[index].subtype ) ); } return el( 'div', { className: 'theme-card-box', }, el( 'div', { className: 'em12 mb10 flex ac', }, icon.productbox, el( 'span', { className: 'ml10', }, show_title(i18n__('gutenberg_shop_product')) ) ), el( 'div', { className: 'opacity8 mb10 em09', }, i18n__('gutenberg_product_card_desc') ), rti, props.isSelected && that.search_lists.length > 0 && el( Popover, { focusOnMount: false, position: 'left middle center ', className: ' ', }, el( 'div', { className: 'block-editor-link-control', }, el( 'div', { className: 'mt6 block-editor-link-control__search-results', }, that.search_lists.map(function (item, index) { return get_el(index); }) ) ) ), el(InspectorControls, null, help_link(860)) ); }, save: function (props) { var post_id = props.attributes.post_id; return el( 'div', { className: 'post-productbox', contenteditable: 'false', 'data-pid': post_id, }, '[productbox id="' + post_id + '"]' ); }, }); //------------------------------------------------------------- b.updateCategory('aksrt_block_cat', { icon: icon.legacy, }); //------------------------------------------------------------- }); })(jQuery, wp, window);