How to use the tui-code-snippet.forEach function in tui-code-snippet

To help you get started, we’ve selected a few tui-code-snippet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nhn / tui.editor / src / js / editor.js View on Github external
useCommandShortcut: this.options.useCommandShortcut
    });

    if (this.options.customConvertor) {
      // eslint-disable-next-line new-cap
      this.convertor = new this.options.customConvertor(this.eventManager);
    } else {
      this.convertor = new Convertor(this.eventManager);
    }

    if (this.options.useDefaultHTMLSanitizer) {
      this.convertor.initHtmlSanitizer();
    }

    if (this.options.hooks) {
      util.forEach(this.options.hooks, (fn, key) => this.addHook(key, fn));
    }

    if (this.options.events) {
      util.forEach(this.options.events, (fn, key) => this.on(key, fn));
    }

    this.layout = new Layout(options, this.eventManager);

    this.i18n = i18n;
    this.i18n.setCode(this.options.language);

    this.setUI(this.options.UI || new DefaultUI(this));

    this.mdEditor = MarkdownEditor.factory(this.layout.getMdEditorContainerEl(), this.eventManager, this.options);
    this.preview = new MarkdownPreview(
      this.layout.getPreviewEl(),
github nhn / tui.editor / src / js / editor.js View on Github external
// eslint-disable-next-line new-cap
      this.convertor = new this.options.customConvertor(this.eventManager);
    } else {
      this.convertor = new Convertor(this.eventManager);
    }

    if (this.options.useDefaultHTMLSanitizer) {
      this.convertor.initHtmlSanitizer();
    }

    if (this.options.hooks) {
      util.forEach(this.options.hooks, (fn, key) => this.addHook(key, fn));
    }

    if (this.options.events) {
      util.forEach(this.options.events, (fn, key) => this.on(key, fn));
    }

    this.layout = new Layout(options, this.eventManager);

    this.i18n = i18n;
    this.i18n.setCode(this.options.language);

    this.setUI(this.options.UI || new DefaultUI(this));

    this.mdEditor = MarkdownEditor.factory(this.layout.getMdEditorContainerEl(), this.eventManager, this.options);
    this.preview = new MarkdownPreview(
      this.layout.getPreviewEl(),
      this.eventManager,
      this.convertor,
      false,
      this.options.previewDelayTime);
github nhn / tui.image-editor / src / js / ui.js View on Github external
_makeSubMenu() {
        snippet.forEach(this.options.menu, menuName => {
            const SubComponentClass = SUB_UI_COMPONENT[menuName.replace(/^[a-z]/, $0 => $0.toUpperCase())];

            // make menu element
            this._makeMenuElement(menuName);

            // menu btn element
            this._els[menuName] = this._menuElement.querySelector(`#tie-btn-${menuName}`);

            // submenu ui instance
            this[menuName] = new SubComponentClass(this._subMenuElement, {
                locale: this._locale,
                iconStyle: this.theme.getStyle('submenu.icon'),
                menuBarPosition: this.options.menuBarPosition,
                usageStatistics: this.options.usageStatistics
            });
        });
github nhn / tui.calendar / test / app / controller / viewMixin / week.spec.js View on Github external
beforeEach(function() {
            scheduleList = [];
            idList = [];
            panels = [
                {
                    name: 'time',
                    type: 'timegrid',
                    autoHeight: true,
                    handlers: ['click', 'creation', 'move', 'resize'],
                    show: true
                }
            ]

            util.forEach(mockData, function(data) {
                base.createSchedule(data);
            });

            /*
             * It is different from the actual data structure.
             * Please only refer to the schedule.
             * matrix: {
             * '20150501': [id1],
             * '20150502': [id1, id4],
             * '20150503': [id2, id3, id4]
             * }
             */
        });
github nhn / tui.calendar / src / js / theme / theme.js View on Github external
Theme.prototype.clear = function() {
    var keys = this._map.keys();
    var categories = {};
    util.forEach(keys, function(key) {
        var category = key.split('.')[0];
        if (!categories[category]) {
            categories[category] = category;
        }
    });

    util.forEach(categories, function(child) {
        delete this[child];
    }, this);

    this._map.removeAll();
};
github nhn / tui.chart / src / js / helpers / dataExporter.js View on Github external
function _get2DArrayFromBulletRawData(rawData) {
    const resultArray = [];
    const maxCounts = _calculateMaxCounts(rawData.series.bullet);
    const {maxRangeCount, maxMarkerCount} = maxCounts;

    resultArray.push(_makeTHeadForBullet(maxRangeCount, maxMarkerCount));

    snippet.forEach(rawData.series.bullet, seriesItem => {
        const rangeArray = _makeTCellsFromBulletRanges(seriesItem.ranges, maxRangeCount);
        const markerArray = _makeTCellsFromBulletMarkers(seriesItem.markers, maxMarkerCount);
        const row = [seriesItem.name, seriesItem.data, ...rangeArray, ...markerArray];
        resultArray.push(row);
    });

    return resultArray;
}
github nhn / tui.editor / src / js / wwCodeBlockManager.js View on Github external
_copyCodeblockTypeFromRangeCodeblock(element, range) {
    const blockNode = domUtils.getParentUntil(range.commonAncestorContainer, this.wwe.get$Body()[0]);

    if (domUtils.getNodeName(blockNode) === 'PRE') {
      const attrs = $(blockNode).prop('attributes');

      util.forEach(attrs, attr => {
        $(element).attr(attr.name, attr.value);
      });
    }

    return element;
  }
github nhn / tui.calendar / src / js / handler / month / guide.js View on Github external
MonthGuide.prototype._removeGuideElements = function(yCoords) {
    var guides = this.guideElements;

    util.forEach(yCoords, function(y) {
        domutil.remove(guides[y]);
        delete guides[y];
    });
};
github nhn / tui.chart / src / js / models / data / rawDataHandler.js View on Github external
getChartTypeMap(rawData) {
        const chartTypeMap = {};

        if (snippet.isObject(rawData.series)) {
            snippet.forEach(rawData.series, (data, seriesType) => {
                chartTypeMap[this.findChartType(rawData.seriesAlias, seriesType)] = true;
            });
        }

        return chartTypeMap;
    },
github nhn / tui.chart / src / js / helpers / dataExporter.js View on Github external
function _calculateMaxCounts(bulletSeries) {
    var maxRangeCount = 0;
    var maxMarkerCount = 0;

    snippet.forEach(bulletSeries, function(series) {
        maxRangeCount = Math.max(maxRangeCount, series.ranges.length);
        maxMarkerCount = Math.max(maxMarkerCount, series.markers.length);
    });

    return {
        maxRangeCount: maxRangeCount,
        maxMarkerCount: maxMarkerCount
    };
}