本文整理汇总了TypeScript中@ephox/alloy.AlloySpec.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript AlloySpec.default方法的具体用法?TypeScript AlloySpec.default怎么用?TypeScript AlloySpec.default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/alloy.AlloySpec
的用法示例。
在下文中一共展示了AlloySpec.default方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: clearTimer
const launchContext = (toolbarApi: Toolbar.ContextToolbar | Toolbar.ContextForm, elem: Option<DomElement>) => {
clearTimer();
const toolbarSpec = buildToolbar(toolbarApi);
const sElem = elem.map(Element.fromDom);
const anchor = getAnchor(toolbarApi.position, sElem);
lastAnchor.set(Option.some((anchor)));
lastElement.set(elem);
InlineView.showWithin(contextbar, anchor, wrapInPopDialog(toolbarSpec), getBoxElement());
Css.remove(contextbar.element(), 'display');
};
示例2: renderSpinner
const toggleThrobber = (comp: AlloyComponent, state: boolean, providerBackstage: UiFactoryBackstageProviders) => {
const element = comp.element();
if (state === true) {
Replacing.set(comp, [ renderSpinner(providerBackstage) ]);
Css.remove(element, 'display');
Attr.remove(element, 'aria-hidden');
} else {
Replacing.set(comp, [ ]);
Css.set(element, 'display', 'none');
Attr.set(element, 'aria-hidden', 'true');
}
};
示例3: renderTitle
const renderModalHeader = (foo: WindowHeaderFoo, providersBackstage: UiFactoryBackstageProviders): AlloySpec => {
const pTitle = ModalDialog.parts().title(
renderTitle(foo, Option.none(), providersBackstage)
);
const pHandle = ModalDialog.parts().draghandle({
dom: DomFactory.fromHtml('<div class="tox-dialog__draghandle"></div>')
});
const pClose = ModalDialog.parts().close(
renderClose(providersBackstage)
);
const components = [ pTitle ].concat(foo.draggable ? [ pHandle ] : []).concat([ pClose ]);
return Container.sketch({
dom: DomFactory.fromHtml('<div class="tox-dialog__header"></div>'),
components
});
};
示例4: renderBody
const renderModalBody = (foo: WindowBodyFoo, backstage: UiFactoryBackstage) => {
const bodySpec = renderBody(foo, Option.none(), backstage, false);
return ModalDialog.parts().body(
bodySpec
);
};
示例5: getItems
export const renderUrlInput = (spec: Types.UrlInput.UrlInput, backstage: UiFactoryBackstage, urlBackstage: UiFactoryBackstageForUrlInput): SketchSpec => {
const providersBackstage = backstage.shared.providers;
const updateHistory = (component: AlloyComponent): void => {
const urlEntry = Representing.getValue(component);
urlBackstage.addToHistory(urlEntry.value, spec.filetype);
};
// TODO: Make alloy's typeahead only swallow enter and escape if menu is open
const pField = AlloyFormField.parts().field({
factory: AlloyTypeahead,
dismissOnBlur: true,
inputClasses: ['tox-textfield'],
sandboxClasses: ['tox-dialog__popups'],
inputAttributes: {
'aria-errormessage': errorId
},
minChars: 0,
responseTime: 0,
fetch: (input: AlloyComponent) => {
const items = getItems(spec.filetype, input, urlBackstage);
const tdata = NestedMenus.build(items, ItemResponse.BUBBLE_TO_SANDBOX, backstage);
return Future.pure(tdata);
},
getHotspot: (comp) => memUrlBox.getOpt(comp),
onSetValue: (comp, newValue) => {
if (comp.hasConfigured(Invalidating)) {
Invalidating.run(comp).get(Fun.noop);
}
},
typeaheadBehaviours: Behaviour.derive(Arr.flatten([
urlBackstage.getValidationHandler().map(
(handler) => Invalidating.config({
getRoot: (comp) => Traverse.parent(comp.element()),
invalidClass: 'tox-control-wrap--status-invalid',
notify: {
onInvalid: (comp: AlloyComponent, err: string) => {
memInvalidIcon.getOpt(comp).each((invalidComp) => {
Attr.set(invalidComp.element(), 'title', providersBackstage.translate(err));
});
}
},
validator: {
validate: (input) => {
const urlEntry = Representing.getValue(input);
return FutureResult.nu((completer) => {
handler({ type: spec.filetype, url: urlEntry.value }, (validation) => {
completer((validation.status === 'invalid' ? Result.error : Result.value)(validation.message));
});
});
},
validateOnLoad: false
}
})
).toArray(),
[
Tabstopping.config({}),
AddEventsBehaviour.config('urlinput-events', Arr.flatten([
// We want to get fast feedback for the link dialog, but not sure about others
spec.filetype === 'file' ? [
AlloyEvents.run(NativeEvents.input(), (comp) => {
AlloyTriggers.emitWith(comp, formChangeEvent, { name: spec.name });
})
] : [ ],
[
AlloyEvents.run(NativeEvents.change(), (comp) => {
AlloyTriggers.emitWith(comp, formChangeEvent, { name: spec.name });
updateHistory(comp);
}),
AlloyEvents.run(SystemEvents.postPaste(), (comp) => {
AlloyTriggers.emitWith(comp, formChangeEvent, { name: spec.name });
updateHistory(comp);
})
]
]))
]
])),
eventOrder: {
[NativeEvents.input()]: [ 'streaming', 'urlinput-events', 'invalidating' ]
},
model: {
getDisplayText: (itemData) => {
return itemData.value;
},
selectsOver: false,
populateFromBrowse: false
},
markers: {
// FIX:
openClass: 'dog'
},
lazySink: backstage.shared.getSink,
parts: {
//.........这里部分代码省略.........