all files / block-manager/renderer/blocks/ callout.js

100% Statements 25/25
100% Branches 0/0
100% Functions 6/6
100% Lines 25/25
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67   1390×   132× 132× 132×       132×       132× 132×       132× 132× 217× 217×   132× 132× 132×   132× 132×                                                   132×        
define(["require", "exports", "../../../common/utils/index", "../../../common/constant", "@syncfusion/ej2-base"], function (require, exports, index_1, constants, ej2_base_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var CalloutRenderer = (function () {
        function CalloutRenderer(manager) {
            this.parent = manager;
        }
        CalloutRenderer.prototype.renderCallout = function (block, blockElement) {
            var _this = this;
            blockElement.classList.add(constants.CALLOUT_BLOCK_CLS);
            var calloutWrapper = ej2_base_1.createElement('div', {
                className: 'e-callout-wrapper',
                attrs: { contenteditable: 'true' }
            });
            var iconContainer = ej2_base_1.createElement('div', {
                className: 'e-callout-icon',
                attrs: { contenteditable: 'false' }
            });
            iconContainer.appendChild(this.renderCalloutIcon());
            var contentContainer = ej2_base_1.createElement('div', {
                className: 'e-callout-content',
                attrs: { contenteditable: 'true' }
            });
            var props = block.properties;
            props.children.forEach(function (childBlock) {
                var childBlockElement = _this.parent.blockRenderer.createBlockElement(childBlock);
                contentContainer.appendChild(childBlockElement);
            });
            calloutWrapper.appendChild(iconContainer);
            calloutWrapper.appendChild(contentContainer);
            return calloutWrapper;
        };
        CalloutRenderer.prototype.renderCalloutIcon = function () {
            var svg = index_1.createBaseSvg();
            svg.append(index_1.createSvgElement('path', {
                d: 'M14 22H10C8.89543 22 8 21.1046 8 20V17H16V20C16 21.1046 15.1046 22 14 22Z',
                fill: '#7DA6FF'
            }), index_1.createSvgElement('circle', {
                cx: '12',
                cy: '9.5',
                r: '7.5',
                stroke: '#4D4B4B',
                'stroke-width': '2'
            }), index_1.createSvgElement('path', {
                d: 'M14 22.5H10C8.89543 22.5 8 21.6046 8 20.5V16H16V20.5C16 21.6046 15.1046 22.5 14 22.5Z',
                stroke: '#4D4B4B',
                'stroke-linecap': 'round',
                'stroke-linejoin': 'round'
            }), index_1.createSvgElement('circle', {
                cx: '12',
                cy: '9.5',
                r: '7.5',
                fill: '#FFCA26'
            }), index_1.createSvgElement('path', {
                d: 'M19.5 9.5C19.5 13.6421 16.1421 17 12 17C12 17 15.5 13.6421 15.5 9.5C15.5 5.35786 12 2 12 2C16.1421 2 19.5 5.35786 19.5 9.5Z',
                fill: '#F39F00'
            }), index_1.createSvgElement('path', {
                d: 'M8 19C10.5 20.5 13 20.5 16 19',
                stroke: '#4D4B4B'
            }));
            return svg;
        };
        return CalloutRenderer;
    }());
    exports.CalloutRenderer = CalloutRenderer;
});