# all files / src/js/base/core/ env.js

60.47% Statements 26/43
51.35% Branches 19/37
100% Functions 3/3
59.52% Lines 25/42

    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
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    1051×
    1×
    1×
    1×

    2×
    1089×
    1089×
    1089×
    1089×
    1089×
    1089×
    1089×
    1089×
    1089×
    1089×

    1×
    1×
    1×
    1×

    1×
    1×
    1×

    1×

    1×

    1×

     (function(global){global.wrappers['/Users/lqez/Dev/summernote/src/js/base/core/env.js']=[function(require,module,exports,__dirname,__filename){ "use strict";
    exports.__esModule = true;
    var jquery_1 = require("jquery");
    var isSupportAmd = typeof define === 'function' && define.amd; // eslint-disable-line
    /**
     * returns whether font is installed or not.
     *
     * @param {String} fontName
     * @return {Boolean}
     */
    function isFontInstalled(fontName) {
        var testFontName = fontName === 'Comic Sans MS' ? 'Courier New' : 'Comic Sans MS';
        var testText = 'mmmmmmmmmmwwwww';
        var testSize = '200px';
        var canvas = document.createElement('canvas');
        var context = canvas.getContext('2d');
        context.font = testSize + " '" + testFontName + "'";
        var originalWidth = context.measureText(testText).width;
        context.font = testSize + " '" + fontName + "', '" + testFontName + "'";
        var width = context.measureText(testText).width;
        return originalWidth !== width;
    }
    var userAgent = navigator.userAgent;
    var isMSIE = /MSIE|Trident/i.test(userAgent);
    var browserVersion;
    Iif (isMSIE) {
        var matches = /MSIE (\d+[.]\d+)/.exec(userAgent);
        if (matches) {
            browserVersion = parseFloat(matches[1]);
        }
        matches = /Trident\/.*rv:([0-9]{1,}[.0-9]{0,})/.exec(userAgent);
        if (matches) {
            browserVersion = parseFloat(matches[1]);
        }
    }
    var isEdge = /Edge\/\d+/.test(userAgent);
    var hasCodeMirror = !!window.CodeMirror;
    Iif (!hasCodeMirror && isSupportAmd) {
        // Webpack
        if (typeof __webpack_require__ === 'function') { // eslint-disable-line
            try {
                // If CodeMirror can't be resolved, `require.resolve` will throw an
                // exception and `hasCodeMirror` won't be set to `true`.
                require.resolve('codemirror');
                hasCodeMirror = true;
            }
            catch (e) {
                // do nothing
            }
        }
        else if (typeof require !== 'undefined') {
            // Browserify
            if (typeof require.resolve !== 'undefined') {
                try {
                    // If CodeMirror can't be resolved, `require.resolve` will throw an
                    // exception and `hasCodeMirror` won't be set to `true`.
                    require.resolve('codemirror');
                    hasCodeMirror = true;
                }
                catch (e) {
                    // do nothing
                }
                // Almond/Require
            }
            else if (typeof require.specified !== 'undefined') {
                hasCodeMirror = require.specified('codemirror');
            }
        }
    }
    var isSupportTouch = (('ontouchstart' in window) ||
        (navigator.MaxTouchPoints > 0) ||
        (navigator.msMaxTouchPoints > 0));
    // [workaround] IE doesn't have input events for contentEditable
    // - see: https://goo.gl/4bfIvA
    var inputEventName = (isMSIE || isEdge) ? 'DOMCharacterDataModified DOMSubtreeModified DOMNodeInserted' : 'input';
    /**
     * @class core.env
     *
     * Object which check platform and agent
     *
     * @singleton
     * @alternateClassName env
     */
    exports["default"] = {
        isMac: navigator.appVersion.indexOf('Mac') > -1,
        isMSIE: isMSIE,
        isEdge: isEdge,
        isFF: !isEdge && /firefox/i.test(userAgent),
        isPhantom: /PhantomJS/i.test(userAgent),
        isWebkit: !isEdge && /webkit/i.test(userAgent),
        isChrome: !isEdge && /chrome/i.test(userAgent),
        isSafari: !isEdge && /safari/i.test(userAgent),
        browserVersion: browserVersion,
        jqueryVersion: parseFloat(jquery_1["default"].fn.jquery),
        isSupportAmd: isSupportAmd,
        isSupportTouch: isSupportTouch,
        hasCodeMirror: hasCodeMirror,
        isFontInstalled: isFontInstalled,
        isW3CRangeSupport: !!document.createRange,
        inputEventName: inputEventName
    };

    },'src/js/base/core/env.js',{"jquery":"/Users/lqez/Dev/summernote/node_modules/jquery/dist/jquery.js"}];})(this);
    //# sourceMappingURL=data:application/json;charset=utf-8;base64,