本文整理汇总了TypeScript中@ephox/katamari.Arr.last方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Arr.last方法的具体用法?TypeScript Arr.last怎么用?TypeScript Arr.last使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/katamari.Arr
的用法示例。
在下文中一共展示了Arr.last方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const getNewRowCursorPosition = function (editor, table) {
const rows = SelectorFilter.descendants(table, 'tr');
return Arr.last(rows).bind(function (last) {
return SelectorFind.descendant(last, 'td,th').map(function (first) {
return getCellFirstCursorPosition(editor, first);
});
});
};
示例2: createSection
const createJoinedSections = (scope: Document, length: number, listType: ListType): Section[] => {
const sections: Section[] = [];
for (let i = 0; i < length; i++) {
const newSection = createSection(scope, listType);
Arr.last(sections).each((lastSection) => joinSections(lastSection, newSection));
sections.push(newSection);
}
return sections;
};
示例3:
const populateSegments = (segments: Segment[], entry: Entry): void => {
for (let i = 0; i < segments.length - 1; i++) {
Css.set(segments[i].item, 'list-style-type', 'none');
}
Arr.last(segments).each((segment) => {
Attr.setAll(segment.list, entry.listAttributes);
Attr.setAll(segment.item, entry.itemAttributes);
InsertAll.append(segment.item, entry.content);
});
};
示例4: createJoinedSections
const writeDeep = (scope: Document, outline: Section[], entry: Entry): Section[] => {
const newSections = createJoinedSections(scope, entry.depth - outline.length, entry.listType);
populateSections(newSections, entry);
Options.liftN([
Arr.last(outline),
Arr.head(newSections)
], joinSections);
return outline.concat(newSections);
};
示例5: setItem
const writeShallow = (scope: Document, outline: Section[], entry: Entry): Section[] => {
const newOutline = outline.slice(0, entry.depth);
Arr.last(newOutline).each((section) => {
setItem(section, createItem(scope, entry.itemAttributes, entry.content));
normalizeSection(section, entry);
});
return newOutline;
};
示例6: createItem
const writeShallow = (scope: Document, cast: Segment[], entry: Entry): Segment[] => {
const newCast = cast.slice(0, entry.depth);
Arr.last(newCast).each((segment) => {
const item = createItem(scope, entry.itemAttributes, entry.content);
appendItem(segment, item);
normalizeSegment(segment, entry);
});
return newCast;
};
示例7:
AlloyEvents.run<BackwardSlideEvent>(backSlideEvent, (comp, se) => {
Arr.last(stack.get()).each((last) => {
stack.set(stack.get().slice(0, stack.get().length - 1));
AlloyTriggers.emitWith(comp, changeSlideEvent, {
// Because we are using premade, we should have access to the same element
// to give focus (although it isn't working)
contents: GuiFactory.premade(last.bar),
focus: last.focus
});
});
}),
示例8: return
return () => {
const from = forward ? CaretPosition.fromRangeEnd(editor.selection.getRng()) : CaretPosition.fromRangeStart(editor.selection.getRng());
const result = forward ? getPositionsUntilNextLine(editor.getBody(), from) : getPositionsUntilPreviousLine(editor.getBody(), from);
const to = forward ? Arr.last(result.positions) : Arr.head(result.positions);
return to.filter(isCefPosition(forward)).fold(
Fun.constant(false),
(pos) => {
editor.selection.setRng(pos.toRange());
return true;
}
);
};
示例9:
const addContextMenuGroup = (xs: Array<MenuItem>, groupItems: Array<MenuItem>) => {
// Skip if there are no items
if (groupItems.length === 0) {
return xs;
}
// Only add a separator at the beginning if the last item isn't a separator
const lastMenuItem = Arr.last(xs).filter((item) => !isSeparator(item));
const before = lastMenuItem.fold(
() => [],
(_) => [ separator ]
);
return xs.concat(before).concat(groupItems).concat([ separator ]);
};