本文整理汇总了TypeScript中@ephox/sugar.TransformFind类的典型用法代码示例。如果您正苦于以下问题:TypeScript TransformFind类的具体用法?TypeScript TransformFind怎么用?TypeScript TransformFind使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TransformFind类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const sketch = function (realm, editor) {
const spec = {
onChange (value) {
editor.execCommand('FormatBlock', null, headings[value].toLowerCase());
},
getInitialValue () {
const node = editor.selection.getStart();
const elem = Element.fromDom(node);
return TransformFind.closest(elem, function (e) {
const nodeName = Node.name(e);
return Arr.indexOf(headings, nodeName);
}, function (e) {
return Compare.eq(e, Element.fromDom(editor.getBody()));
}).getOr(0);
}
};
return ToolbarWidgets.button(realm, 'heading', function () {
return [
UiDomFactory.spec('<span class="${prefix}-toolbar-button ${prefix}-icon-small-heading ${prefix}-icon"></span>'),
makeSlider(spec),
UiDomFactory.spec('<span class="${prefix}-toolbar-button ${prefix}-icon-large-heading ${prefix}-icon"></span>')
];
});
};
示例2: function
return optStart.map(function (start) {
const inline = TransformFind.closest(start, function (elem) {
return Css.getRaw(elem, 'font-size');
}, isRoot);
return inline.getOrThunk(function () {
return Css.get(start, 'font-size');
});
}).getOr('');
示例3: matchTargetWith
return matchTargetWith(startNode, scopes.inEditorScope).orThunk(() => {
return TransformFind.ancestor(startNode, (elem) => {
return matchTargetWith(elem, scopes.inNodeScope);
}, isRoot);
});