本文整理汇总了TypeScript中tinymce/core/util/Tools.inArray函数的典型用法代码示例。如果您正苦于以下问题:TypeScript inArray函数的具体用法?TypeScript inArray怎么用?TypeScript inArray使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了inArray函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
});
});
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:22,代码来源:EditorInitializationTest.ts
示例2:
return rel.filter(function (val) {
return Tools.inArray(rules, val) === -1;
});
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:3,代码来源:Utils.ts
示例3: function
const hasPlugin = function (editor, plugin) {
const plugins = editor.settings.plugins ? editor.settings.plugins : '';
return Tools.inArray(plugins.split(/[ ,]/), plugin) !== -1;
};
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:4,代码来源:Buttons.ts
示例4: function
Tools.each(obj, function (o) {
if (Tools.inArray(val, o.nodeName.toLowerCase()) !== -1 && o.specified) {
count++;
}
});
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:5,代码来源:DomUtilsTest.ts
示例5: 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');
}
}
});
};
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:71,代码来源:Formats.ts
示例6: function
const isCorsImage = function (editor, img) {
return Tools.inArray(editor.settings.imagetools_cors_hosts, new URI(img.src).host) !== -1;
};
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:3,代码来源:Actions.ts
注:本文中的tinymce/core/util/Tools.inArray函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论