本文整理汇总了TypeScript中tinymce/core/util/Tools.toArray函数的典型用法代码示例。如果您正苦于以下问题:TypeScript toArray函数的具体用法?TypeScript toArray怎么用?TypeScript toArray使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了toArray函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const done = function (editor, currentIndexState, keepEditorSelection?) {
let i, nodes, startContainer, endContainer;
nodes = Tools.toArray(editor.getBody().getElementsByTagName('span'));
for (i = 0; i < nodes.length; i++) {
const nodeIndex = getElmIndex(nodes[i]);
if (nodeIndex !== null && nodeIndex.length) {
if (nodeIndex === currentIndexState.get().toString()) {
if (!startContainer) {
startContainer = nodes[i].firstChild;
}
endContainer = nodes[i].firstChild;
}
unwrap(nodes[i]);
}
}
if (startContainer && endContainer) {
const rng = editor.dom.createRng();
rng.setStart(startContainer, 0);
rng.setEnd(endContainer, endContainer.data.length);
if (keepEditorSelection !== false) {
editor.selection.setRng(rng);
}
return rng;
}
};
示例2: function
proto[name] = function () {
const args = Tools.toArray(arguments);
this.each(function (ctrl) {
if (name in ctrl) {
ctrl[name].apply(ctrl, args);
}
});
return this;
};
示例3: function
const load = function (doc, url) {
const linkElements = Tools.toArray(doc.getElementsByTagName('link'));
const matchingLinkElms = Tools.grep(linkElements, function (head) {
return head.id === cssId;
});
if (matchingLinkElms.length === 0) {
const linkElm = DOMUtils.DOM.create('link', {
id: cssId,
rel: 'stylesheet',
href: url
});
doc.getElementsByTagName('head')[0].appendChild(linkElm);
}
};
示例4: each
* @return {tinymce.ui.Collection} Current collection instance.
*/
each (callback) {
Tools.each(this, callback);
return this;
},
/**
* Returns an JavaScript array object of the contents inside the collection.
*
* @method toArray
* @return {Array} Array with all items from collection.
*/
toArray () {
return Tools.toArray(this);
},
/**
* Finds the index of the specified control or return -1 if it isn't in the collection.
*
* @method indexOf
* @param {Control} ctrl Control instance to look for.
* @return {Number} Index of the specified control or -1.
*/
indexOf (ctrl) {
const self = this;
let i = self.length;
while (i--) {
if (self[i] === ctrl) {