本文整理汇总了TypeScript中@ephox/katamari.Arr.contains方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Arr.contains方法的具体用法?TypeScript Arr.contains怎么用?TypeScript Arr.contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/katamari.Arr
的用法示例。
在下文中一共展示了Arr.contains方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const captureInput = DomEvent.bind(page, 'keydown', function (evt) {
// Think about killing the event.
if (! Arr.contains([ 'input', 'textarea' ], Node.name(evt.target()))) {
// FIX: Close the menus
// closeMenus()
toEditing();
}
});
示例2: onUrlChange
const onChange = (getData: () => LinkDialogData, change: { name: string }): Option<Partial<LinkDialogData>> => {
if (change.name === 'url') {
return onUrlChange(getData());
} else if (Arr.contains([ 'anchor', 'link' ], change.name)) {
return onCatalogChange(getData(), change);
} else if (change.name === 'text') {
// Update the persistent text state, as a user has input custom text
persistentText.set(getData().text);
return Option.none();
} else {
return Option.none();
}
};
示例3: Error
const register = (mode: string, api: ModeApi) => {
if (Arr.contains(defaultModes, mode)) {
throw new Error(`Cannot override default mode ${mode}`);
}
availableModes[mode] = {
...api,
deactivate: () => {
// wrap custom deactivate APIs so they can't break the editor
try {
api.deactivate();
} catch (e) {
console.error(`problem while deactivating editor mode ${mode}:`);
console.error(e);
}
},
};
};
示例4: doEnrich
return Arr.map(items, (item) => {
const keys = Obj.keys(item);
// If it is a submenu, enrich all the subitems.
if (Objects.hasKey(item, 'items')) {
const newItems = doEnrich(item.items);
return Merger.deepMerge(
enrichMenu(item),
{
getStyleItems: () => newItems
}
) as FormatItem;
} else if (Objects.hasKey(item, 'format')) {
return enrichSupported(item);
// NOTE: This branch is added from the original StyleFormats in mobile
} else if (keys.length === 1 && Arr.contains(keys, 'title')) {
return Merger.deepMerge(item, { type: 'separator' }) as FormatItem;
} else {
return enrichCustom(item);
}
});
示例5: function
const isRoot = function (element) {
const name = Node.name(element);
return Compare.eq(element, body) || Arr.contains(rootElements, name);
};
示例6: function
const open = function (settings: NotificationSpec, closeCallback: () => void) {
const close = () => {
closeCallback();
InlineView.hide(notificationWrapper);
};
const notification = GuiFactory.build(
Notification.sketch({
text: settings.text,
level: Arr.contains(['success', 'error', 'warning', 'info'], settings.type) ? settings.type : undefined,
progress: settings.progressBar === true,
icon: Option.from(settings.icon),
onAction: close,
iconProvider: backstage.shared.providers.icons,
translationProvider: backstage.shared.providers.translate
})
);
const notificationWrapper = GuiFactory.build(
InlineView.sketch({
dom: {
tag: 'div',
classes: [ 'tox-notifications-container' ]
},
lazySink: extras.backstage.shared.getSink,
fireDismissalEventInstead: { }
})
);
uiMothership.add(notificationWrapper);
if (settings.timeout) {
Delay.setTimeout(() => {
close();
}, settings.timeout);
}
return {
close,
moveTo: (x: number, y: number) => {
InlineView.showAt(notificationWrapper, {
anchor: 'makeshift',
x,
y
}, GuiFactory.premade(notification));
},
moveRel: (element: Element, rel) => {
// TODO: this should stack, TC-TC, BC-TC
InlineView.showAt(notificationWrapper, extras.backstage.shared.anchors.banner(), GuiFactory.premade(notification));
},
text: (nuText: string) => {
// check if component is still mounted
Notification.updateText(notification, nuText);
},
settings,
getEl: () => {
// TODO: this is required to make stacking banners, should refactor getEl when AP-174 is implemented
},
progressBar: {
value: (percent: number) => {
Notification.updateProgress(notification, percent);
}
}
};
};
示例7:
const needRtlClass = I18n.isRtl() && info.iconContent.exists((name) => Arr.contains(rtlTransform, name));
示例8:
const inInput = Focus.active().exists(function (elem) {
return Arr.contains([ 'input', 'textarea' ], Node.name(elem));
});
示例9: function
const result = Obj.bifilter(settings, function (value, key) {
return Arr.contains(keys, key);
});