本文整理汇总了TypeScript中@ephox/katamari.Arr.each方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Arr.each方法的具体用法?TypeScript Arr.each怎么用?TypeScript Arr.each使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/katamari.Arr
的用法示例。
在下文中一共展示了Arr.each方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const onMousedown = DomEvent.bind(Element.fromDom(document), 'mousedown', function (evt) {
Arr.each([ mothership, uiMothership ], function (ship) {
ship.broadcastOn([ Channels.dismissPopups() ], {
target: evt.target()
});
});
});
示例2: function
editor.serializer.addNodeFilter('details', function (elms) {
Arr.each(elms, function (details) {
const open = details.attr('data-mce-open');
details.attr('open', Type.isString(open) ? open : null);
details.attr('data-mce-open', null);
});
});
示例3:
const getStr = (sections: TestSection[]) => {
const r = { };
Arr.each(sections, (section) => {
r[section.setting.key] = section.setting.value.getOr('{ default }');
});
return JSON.stringify(r, null, 2);
};
示例4: function
const removeTrailingBr = function (elm) {
const allBrs = SelectorFilter.descendants(elm, 'br');
const brs = Arr.filter(getLastChildren(elm).slice(-1), ElementType.isBr);
if (allBrs.length === brs.length) {
Arr.each(brs, Remove.remove);
}
};
示例5: function
const removeDataStyle = (table) => {
const dataStyleCells = SelectorFilter.descendants(table, 'td[data-mce-style],th[data-mce-style]');
Attr.remove(table, 'data-mce-style');
Arr.each(dataStyleCells, function (cell) {
Attr.remove(cell, 'data-mce-style');
});
};
示例6: updateCallbacks
const onNodeChange = Throttler.last(() => {
const callbackMap = changeCallbacks.get();
const annotations = Arr.sort(Obj.keys(callbackMap));
Arr.each(annotations, (name) => {
updateCallbacks(name, (data) => {
const prev = data.previous.get();
identify(editor, Option.some(name)).fold(
() => {
if (prev.isSome()) {
// Changed from something to nothing.
fireNoAnnotation(name);
data.previous.set(Option.none());
}
},
({ uid, name, elements }) => {
// Changed from a different annotation (or nothing)
if (! prev.is(uid)) {
fireCallbacks(name, uid, elements);
data.previous.set(Option.some(uid));
}
}
);
return {
previous: data.previous,
listeners: data.listeners
};
});
});
}, 30);
示例7: function
const hide = function (editor, body) {
const nodeList = editor.dom.select(Data.selector, body);
Arr.each(nodeList, function (node) {
editor.dom.remove(node, 1);
});
};
示例8: identifyParserNode
editor.serializer.addNodeFilter('span', (spans) => {
Arr.each(spans, (span) => {
identifyParserNode(span).each((settings) => {
if (settings.persistent === false) { span.unwrap(); }
});
});
});
示例9: handler
const resetTargets = () => {
// Reset the targets
targets.set(Thunk.cached(findTargets)());
// Trigger change handlers
Arr.each(changeHandlers.get(), (handler) => handler());
};
示例10: fireNewRow
Arr.each(SelectorFilter.descendants(table, 'tr'), (row) => {
fireNewRow(editor, row.dom());
Arr.each(SelectorFilter.descendants(row, 'th,td'), (cell) => {
fireNewCell(editor, cell.dom());
});
});