本文整理汇总了TypeScript中tinymce/core/api/util/Tools.map函数的典型用法代码示例。如果您正苦于以下问题:TypeScript map函数的具体用法?TypeScript map怎么用?TypeScript map使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了map函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: toggleVisibility
function toggleVisibility(state) {
let selectors;
selectors = Tools.map(handles, function (handle) {
return '#' + id + '-' + handle.name;
}).concat(Tools.map(blockers, function (blocker) {
return '#' + id + '-' + blocker;
})).join(',');
if (state) {
DomQuery(selectors, containerElm).show();
} else {
DomQuery(selectors, containerElm).hide();
}
}
示例2: function
const toBlockElements = function (text: string, rootTag: string, rootAttrs: RootAttrs) {
const blocks = text.split(/\n\n/);
const tagOpen = openContainer(rootTag, rootAttrs);
const tagClose = '</' + rootTag + '>';
const paragraphs = Tools.map(blocks, function (p) {
return p.split(/\n/).join('<br />');
});
const stitch = function (p) {
return tagOpen + p + tagClose;
};
return paragraphs.length === 1 ? paragraphs[0] : Tools.map(paragraphs, stitch).join('');
};
示例3: function
const createSidebar = function (editor) {
const buttons = Tools.map(editor.sidebars, function (sidebar) {
const settings = sidebar.settings;
return {
type: 'button',
icon: settings.icon,
image: settings.image,
tooltip: settings.tooltip,
onclick: showPanel(editor, sidebar.name, editor.sidebars)
};
});
return {
type: 'panel',
name: 'sidebar',
layout: 'stack',
classes: 'sidebar',
items: [
{
type: 'toolbar',
layout: 'stack',
classes: 'sidebar-toolbar',
items: buttons
}
]
};
};
示例4: function
const getFontItems = function (editor) {
const defaultFontsFormats = (
'Andale Mono=andale mono,monospace;' +
'Arial=arial,helvetica,sans-serif;' +
'Arial Black=arial black,sans-serif;' +
'Book Antiqua=book antiqua,palatino,serif;' +
'Comic Sans MS=comic sans ms,sans-serif;' +
'Courier New=courier new,courier,monospace;' +
'Georgia=georgia,palatino,serif;' +
'Helvetica=helvetica,arial,sans-serif;' +
'Impact=impact,sans-serif;' +
'Symbol=symbol;' +
'Tahoma=tahoma,arial,helvetica,sans-serif;' +
'Terminal=terminal,monaco,monospace;' +
'Times New Roman=times new roman,times,serif;' +
'Trebuchet MS=trebuchet ms,geneva,sans-serif;' +
'Verdana=verdana,geneva,sans-serif;' +
'Webdings=webdings;' +
'Wingdings=wingdings,zapf dingbats'
);
const fonts = createFormats(editor.settings.font_formats || defaultFontsFormats);
return Tools.map(fonts, function (font) {
return {
text: { raw: font[0] },
value: font[1],
textStyle: font[1].indexOf('dings') === -1 ? 'font-family:' + font[1] : ''
};
});
};
示例5: function
colorPickerCallback.call(editor, function (value) {
const tableElm = buttonCtrl.panel.getEl().getElementsByTagName('table')[0];
let customColorCells, div, i;
customColorCells = Tools.map(tableElm.rows[tableElm.rows.length - 1].childNodes, function (elm) {
return elm.firstChild;
});
for (i = 0; i < customColorCells.length; i++) {
div = customColorCells[i];
if (!div.getAttribute('data-mce-color')) {
break;
}
}
// Shift colors to the right
// TODO: Might need to be the left on RTL
if (i === cols) {
for (i = 0; i < cols - 1; i++) {
setDivColor(customColorCells[i], customColorCells[i + 1].getAttribute('data-mce-color'));
}
}
setDivColor(div, value);
selectColor(value);
}, currentColor);
示例6: function
const toMenuItems = function (styles) {
return Tools.map(styles, function (styleValue) {
const text = styleValueToText(styleValue);
const data = styleValue === 'default' ? '' : styleValue;
return { text, data };
});
};
示例7: function
const findParentListItemsNodes = function (editor, elms) {
const listItemsElms = Tools.map(elms, function (elm) {
const parentLi = editor.dom.getParent(elm, 'li,dd,dt', getClosestListRootElm(editor, elm));
return parentLi ? parentLi : elm;
});
return DomQuery.unique(listItemsElms);
};
示例8: function
const createCustomMenuItems = function (editor, names) {
let items, nameList;
if (typeof names === 'string') {
nameList = names.split(' ');
} else if (Tools.isArray(names)) {
return Arr.flatten(Tools.map(names, function (names) {
return createCustomMenuItems(editor, names);
}));
}
items = Tools.grep(nameList, function (name) {
return name === '|' || name in editor.menuItems;
});
return Tools.map(items, function (name) {
return name === '|' ? { text: '-' } : editor.menuItems[name];
});
};
示例9: function
const getItems = function (editor) {
return Tools.map(Settings.getLanguages(editor).split(','), function (langPair) {
langPair = langPair.split('=');
return {
name: langPair[0],
value: langPair[1]
};
});
};
示例10: callback
fetch : (callback) => {
const items = Tools.map(languageMenuItems, (languageItem) => {
return {
type: 'choiceitem',
value: languageItem.data,
text: languageItem.text
};
});
callback(items);
},