本文整理匯總了TypeScript中@ephox/sugar.Node.name方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Node.name方法的具體用法?TypeScript Node.name怎麽用?TypeScript Node.name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@ephox/sugar.Node
的用法示例。
在下文中一共展示了Node.name方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: context
const processElement = (elem) => {
const ctx = context(editor, elem, 'span', Node.name(elem));
switch (ctx) {
case ChildContext.InvalidChild: {
finishWrapper();
const children = Traverse.children(elem);
processElements(children);
finishWrapper();
break;
}
case ChildContext.Valid: {
const w = getOrOpenWrapper();
Insert.wrap(elem, w);
break;
}
// INVESTIGATE: Are these sensible things to do?
case ChildContext.Skipping:
case ChildContext.Existing:
case ChildContext.Caret: {
// Do nothing.
}
}
};
示例2:
return table.map((table) => {
if (Node.name(cellOrCaption) === 'caption') {
return TableTargets.notCell(cellOrCaption);
} else {
return TableTargets.forMenu(selections, table, cellOrCaption);
}
});
示例3:
return selectionTargets.targets().fold(() => '', (targets) => {
// If clicking in a caption, then we shouldn't show the cell/row/column options
if (Node.name(targets.element()) === 'caption') {
return 'tableprops deletetable';
} else {
return 'cell row column | tableprops deletetable';
}
});
示例4: function
function (child) {
if (Node.name(child) === 'br') {
return Traverse.prevSibling(child).map(function (sibling) {
return [node].concat(getLastChildren(sibling));
}).getOr([]);
} else {
return [node].concat(getLastChildren(child));
}
}
示例5: if
Chain.op((element) => {
if (element.dom().type === 'checkbox') {
Checked.set(element, value);
} else if (Node.name(element) === 'select' && typeof value === 'number') {
SelectTag.setSelected(element, value);
} else {
Value.set(element, value);
}
})
示例6: 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();
}
});
示例7: cloneItemContent
return Traverse.parent(li).map((list) => {
return {
depth,
isSelected,
content: cloneItemContent(li),
itemAttributes: Attr.clone(li),
listAttributes: Attr.clone(list),
listType: Node.name(list) as ListType
};
});
示例8: switch
const getListType = (list: Element): Option<ListType> => {
switch (Node.name(list)) {
case 'ol':
return Option.some(ListType.OL);
case 'ul':
return Option.some(ListType.UL);
case 'dl':
return Option.some(ListType.DL);
default:
return Option.none();
}
};
示例9: getLast
getLast().each(function (last) {
if (Node.name(last) === 'table') {
if (getForcedRootBlock(editor)) {
editor.dom.add(
editor.getBody(),
getForcedRootBlock(editor),
getForcedRootBlockAttrs(editor),
'<br/>'
);
} else {
editor.dom.add(editor.getBody(), 'br');
}
}
});
示例10: getLast
getLast().each(function (last) {
if (Node.name(last) === 'table') {
if (editor.settings.forced_root_block) {
editor.dom.add(
editor.getBody(),
editor.settings.forced_root_block,
editor.settings.forced_root_block_attrs,
'<br/>'
);
} else {
editor.dom.add(editor.getBody(), 'br');
}
}
});