本文整理匯總了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);
});