Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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(),
// 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);
_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
});
});
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]
* }
*/
});
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();
};
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;
}
_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;
}
MonthGuide.prototype._removeGuideElements = function(yCoords) {
var guides = this.guideElements;
util.forEach(yCoords, function(y) {
domutil.remove(guides[y]);
delete guides[y];
});
};
getChartTypeMap(rawData) {
const chartTypeMap = {};
if (snippet.isObject(rawData.series)) {
snippet.forEach(rawData.series, (data, seriesType) => {
chartTypeMap[this.findChartType(rawData.seriesAlias, seriesType)] = true;
});
}
return chartTypeMap;
},
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
};
}