本文整理汇总了TypeScript中tinymce/core/util/Tools.each函数的典型用法代码示例。如果您正苦于以下问题:TypeScript each函数的具体用法?TypeScript each怎么用?TypeScript each使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了each函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: append
function append(styleSheet, imported?) {
let href = styleSheet.href, rules;
href = removeCacheSuffix(href);
if (!href || !fileFilter(href, imported) || isSkinContentCss(editor, href)) {
return;
}
Tools.each(styleSheet.imports, function (styleSheet) {
append(styleSheet, true);
});
try {
rules = styleSheet.cssRules || styleSheet.rules;
} catch (e) {
// Firefox fails on rules to remote domain for example:
// @import url(//fonts.googleapis.com/css?family=Pathway+Gothic+One);
}
Tools.each(rules, function (cssRule) {
if (cssRule.styleSheet) {
append(cssRule.styleSheet, true);
} else if (cssRule.selectorText) {
Tools.each(cssRule.selectorText.split(','), function (selector) {
selectors.push(Tools.trim(selector));
});
}
});
}
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:30,代码来源:ImportCss.ts
示例2: function
const togglePositionClass = function (panel, relPos) {
relPos = relPos ? relPos.substr(0, 2) : '';
Tools.each({
t: 'down',
b: 'up',
c: 'center'
}, function (cls, pos) {
panel.classes.toggle('arrow-' + cls, pos === relPos.substr(0, 1));
});
if (relPos === 'cr') {
panel.classes.toggle('arrow-left', true);
panel.classes.toggle('arrow-right', false);
} else if (relPos === 'cl') {
panel.classes.toggle('arrow-left', true);
panel.classes.toggle('arrow-right', true);
} else {
Tools.each({
l: 'left',
r: 'right'
}, function (cls, pos) {
panel.classes.toggle('arrow-' + cls, pos === relPos.substr(1, 1));
});
}
};
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:26,代码来源:Panel.ts
示例3: function
const extractDataFromElement = function (editor, elm) {
const dom = editor.dom;
const data: any = {
width: dom.getStyle(elm, 'width') || dom.getAttrib(elm, 'width'),
height: dom.getStyle(elm, 'height') || dom.getAttrib(elm, 'height'),
scope: dom.getAttrib(elm, 'scope'),
class: dom.getAttrib(elm, 'class')
};
data.type = elm.nodeName.toLowerCase();
Tools.each('left center right'.split(' '), function (name) {
if (editor.formatter.matchNode(elm, 'align' + name)) {
data.align = name;
}
});
Tools.each('top middle bottom'.split(' '), function (name) {
if (editor.formatter.matchNode(elm, 'valign' + name)) {
data.valign = name;
}
});
if (editor.settings.table_cell_advtab !== false) {
Tools.extend(data, Helpers.extractAdvancedStyles(dom, elm));
}
return data;
};
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:29,代码来源:CellDialog.ts
示例4: function
editor.on('ObjectResized', function (e) {
if (isTable(e.target)) {
const table = e.target;
if (percentageBasedSizeRegex.test(startRawW)) {
const percentW = parseFloat(percentageBasedSizeRegex.exec(startRawW)[1]);
const targetPercentW = e.width * percentW / startW;
editor.dom.setStyle(table, 'width', targetPercentW + '%');
} else {
const newCellSizes = [];
Tools.each(table.rows, function (row) {
Tools.each(row.cells, function (cell) {
const width = editor.dom.getStyle(cell, 'width', true);
newCellSizes.push({
cell,
width
});
});
});
Tools.each(newCellSizes, function (newCellSize) {
editor.dom.setStyle(newCellSize.cell, 'width', newCellSize.width);
editor.dom.setAttrib(newCellSize.cell, 'width', null);
});
}
}
});
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:27,代码来源:ResizeHandler.ts
示例5: function
editor.on('renderFormatsMenu', function (e) {
const globallyUniqueSelectors = {};
const selectorFilter = compileFilter(Settings.getSelectorFilter(editor)), ctrl = e.control;
const groups = compileUserDefinedGroups(Settings.getCssGroups(editor));
const processSelector = function (selector, group) {
if (isUniqueSelector(editor, selector, group, globallyUniqueSelectors)) {
markUniqueSelector(editor, selector, group, globallyUniqueSelectors);
const format = convertSelectorToFormat(editor, editor.plugins.importcss, selector, group);
if (format) {
const formatName = format.name || DOMUtils.DOM.uniqueId();
editor.formatter.register(formatName, format);
return Tools.extend({}, ctrl.settings.itemDefaults, {
text: format.title,
format: formatName
});
}
}
return null;
};
if (!Settings.shouldAppend(editor)) {
ctrl.items().remove();
}
Tools.each(getSelectors(editor, e.doc || editor.getDoc(), compileFilter(Settings.getFileFilter(editor))), function (selector) {
if (selector.indexOf('.mce-') === -1) {
if (!selectorFilter || selectorFilter(selector)) {
const selectorGroups = getGroupsBySelector(groups, selector);
if (selectorGroups.length > 0) {
Tools.each(selectorGroups, function (group) {
const menuItem = processSelector(selector, group);
if (menuItem) {
group.item.menu.push(menuItem);
}
});
} else {
const menuItem = processSelector(selector, null);
if (menuItem) {
ctrl.add(menuItem);
}
}
}
}
});
Tools.each(groups, function (group) {
if (group.item.menu.length > 0) {
ctrl.add(group.item);
}
});
e.control.renderNew();
});
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:58,代码来源:ImportCss.ts
示例6: function
const createMenu = function (editorMenuItems, menus, removedMenuItems, context) {
let menuButton, menu, namedMenuItems, isUserDefined;
// User defined menu
if (menus) {
menu = menus[context];
isUserDefined = true;
} else {
menu = defaultMenus[context];
}
if (menu) {
menuButton = { text: menu.title };
namedMenuItems = [];
// Default/user defined items
Tools.each((menu.items || '').split(/[ ,]/), function (name) {
const namedMenuItem = createMenuNameItemPair(name, editorMenuItems[name]);
if (namedMenuItem) {
namedMenuItems.push(namedMenuItem);
}
});
// Added though context
if (!isUserDefined) {
Tools.each(editorMenuItems, function (item, name) {
if (item.context === context && !hasItemName(namedMenuItems, name)) {
if (item.separator === 'before') {
namedMenuItems.push(delimiterMenuNamePair());
}
if (item.prependToContext) {
namedMenuItems.unshift(createMenuNameItemPair(name, item));
} else {
namedMenuItems.push(createMenuNameItemPair(name, item));
}
if (item.separator === 'after') {
namedMenuItems.push(delimiterMenuNamePair());
}
}
});
}
menuButton.menu = Arr.map(cleanupMenu(namedMenuItems, removedMenuItems), function (menuItem) {
return menuItem.item;
});
if (!menuButton.menu.length) {
return null;
}
}
return menuButton;
};
开发者ID:howardjing,项目名称:tinymce,代码行数:56,代码来源:Menubar.ts
示例7: function
const hideAllContextToolbars = function () {
Tools.each(getContextToolbars(), function (toolbar) {
if (toolbar.panel) {
toolbar.panel.hide();
}
});
};
开发者ID:howardjing,项目名称:tinymce,代码行数:7,代码来源:ContextToolbars.ts
示例8: function
const teardown = function (editor) {
const notifications = [].concat(editor.notificationManager.getNotifications());
Tools.each(notifications, function (notification) {
notification.close();
});
};
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:7,代码来源:NotificationManagerTest.ts
示例9: function
const register = function (editor) {
editor.addMenuItem('align', {
text: 'Align',
menu: [
{ text: 'Left', icon: 'alignleft', onclick: FormatUtils.toggleFormat(editor, 'alignleft') },
{ text: 'Center', icon: 'aligncenter', onclick: FormatUtils.toggleFormat(editor, 'aligncenter') },
{ text: 'Right', icon: 'alignright', onclick: FormatUtils.toggleFormat(editor, 'alignright') },
{ text: 'Justify', icon: 'alignjustify', onclick: FormatUtils.toggleFormat(editor, 'alignjustify') }
]
});
Tools.each({
alignleft: ['Align left', 'JustifyLeft'],
aligncenter: ['Align center', 'JustifyCenter'],
alignright: ['Align right', 'JustifyRight'],
alignjustify: ['Justify', 'JustifyFull'],
alignnone: ['No alignment', 'JustifyNone']
}, function (item, name) {
editor.addButton(name, {
active: false,
tooltip: item[0],
cmd: item[1],
onPostRender: FormatUtils.postRenderFormat(editor, name)
});
});
};
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:26,代码来源:Align.ts
注:本文中的tinymce/core/util/Tools.each函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论