本文整理匯總了TypeScript中tinymce/core/api/util/Tools.inArray函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript inArray函數的具體用法?TypeScript inArray怎麽用?TypeScript inArray使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了inArray函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
suite.asyncTest('target (each editor should have a different target)', function (_, done) {
const maxCount = document.querySelectorAll('.elm-even').length;
const elm1 = document.getElementById('elm-1');
let count = 0;
const targets = [];
EditorManager.init({
selector: '.elm-even',
target: elm1,
skin_url: '/project/js/tinymce/skins/lightgray',
init_instance_callback (ed) {
LegacyUnit.equal(ed.targetElm !== elm1, true, 'target option ignored');
LegacyUnit.equal(Tools.inArray(ed.targetElm, targets), -1);
targets.push(ed.targetElm);
if (++count >= maxCount) {
teardown(done);
}
}
});
});
示例2: function
const isCorsImage = function (editor, img) {
return Tools.inArray(editor.settings.imagetools_cors_hosts, new URI(img.src).host) !== -1;
};
示例3: function
const hasPlugin = function (editor, plugin) {
const plugins = editor.settings.plugins ? editor.settings.plugins : '';
return Tools.inArray(plugins.split(/[ ,]/), plugin) !== -1;
};
示例4:
return rel.filter(function (val) {
return Tools.inArray(rules, val) === -1;
});
示例5: function
Tools.each(obj, function (o) {
if (Tools.inArray(val, o.nodeName.toLowerCase()) !== -1 && o.specified) {
count++;
}
});
示例6: function
const isCorsWithCredentialsImage = function (editor, img) {
return Tools.inArray(Settings.getCredentialsHosts(editor), new URI(img.src).host) !== -1;
};
示例7:
return rels.filter((val) => {
return Tools.inArray(rules, val) === -1;
});
示例8: function
const overrideFormats = function (editor) {
const alignElements = 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img',
fontSizes = Tools.explode(editor.settings.font_size_style_values),
schema = editor.schema;
// Override some internal formats to produce legacy elements and attributes
editor.formatter.register({
// Change alignment formats to use the deprecated align attribute
alignleft: { selector: alignElements, attributes: { align: 'left' } },
aligncenter: { selector: alignElements, attributes: { align: 'center' } },
alignright: { selector: alignElements, attributes: { align: 'right' } },
alignjustify: { selector: alignElements, attributes: { align: 'justify' } },
// Change the basic formatting elements to use deprecated element types
bold: [
{ inline: 'b', remove: 'all' },
{ inline: 'strong', remove: 'all' },
{ inline: 'span', styles: { fontWeight: 'bold' } }
],
italic: [
{ inline: 'i', remove: 'all' },
{ inline: 'em', remove: 'all' },
{ inline: 'span', styles: { fontStyle: 'italic' } }
],
underline: [
{ inline: 'u', remove: 'all' },
{ inline: 'span', styles: { textDecoration: 'underline' }, exact: true }
],
strikethrough: [
{ inline: 'strike', remove: 'all' },
{ inline: 'span', styles: { textDecoration: 'line-through' }, exact: true }
],
// Change font size and font family to use the deprecated font element
fontname: { inline: 'font', attributes: { face: '%value' } },
fontsize: {
inline: 'font',
attributes: {
size (vars) {
return Tools.inArray(fontSizes, vars.value) + 1;
}
}
},
// Setup font elements for colors as well
forecolor: { inline: 'font', attributes: { color: '%value' } },
hilitecolor: { inline: 'font', styles: { backgroundColor: '%value' } }
});
// Check that deprecated elements are allowed if not add them
Tools.each('b,i,u,strike'.split(','), function (name) {
schema.addValidElements(name + '[*]');
});
// Add font element if it's missing
if (!schema.getElementRule('font')) {
schema.addValidElements('font[face|size|color|style]');
}
// Add the missing and depreacted align attribute for the serialization engine
Tools.each(alignElements.split(','), function (name) {
const rule = schema.getElementRule(name);
if (rule) {
if (!rule.attributes.align) {
rule.attributes.align = {};
rule.attributesOrder.push('align');
}
}
});
};