本文整理汇总了TypeScript中@ephox/boulder.FieldSchema.option方法的典型用法代码示例。如果您正苦于以下问题:TypeScript FieldSchema.option方法的具体用法?TypeScript FieldSchema.option怎么用?TypeScript FieldSchema.option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/boulder.FieldSchema
的用法示例。
在下文中一共展示了FieldSchema.option方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const sTestScenario = function (rawScenario) {
const scenario = ValueSchema.asRawOrDie('Checking scenario', ValueSchema.objOf([
FieldSchema.strict('label'),
FieldSchema.defaulted('content', ''),
FieldSchema.defaulted('node', Element.fromText('')),
FieldSchema.strictObjOf('fields', [
FieldSchema.option('url'),
FieldSchema.option('text'),
FieldSchema.option('title'),
FieldSchema.option('target')
]),
FieldSchema.strict('expected'),
FieldSchema.defaulted('beforeExecute', Step.pass),
FieldSchema.defaulted('mutations', Fun.constant(Step.pass))
]), rawScenario);
return Logger.t(
scenario.label,
GeneralSteps.sequence([
tEditor.sPrepareState(scenario.node.dom(), scenario.content),
sClickLink,
TestUi.sSetFieldOptValue(scenario.fields.url),
sClickNext,
sAssertTextFocused,
TestUi.sSetFieldOptValue(scenario.fields.text),
sClickNext,
sAssertTitleFocused,
TestUi.sSetFieldOptValue(scenario.fields.title),
sClickNext,
sAssertTargetFocused,
TestUi.sSetFieldOptValue(scenario.fields.target),
sClickPrev,
sAssertTitleFocused,
sClickPrev,
sAssertTextFocused,
sClickPrev,
sAssertUrlFocused,
scenario.beforeExecute,
Keyboard.sKeydown(doc, Keys.enter(), { }),
tEditor.sAssertEq('Checking insert content', scenario.expected),
scenario.mutations(scenario.node),
tEditor.sClear
])
);
};
示例2: function
const checkApply = function (rawScenario) {
const schema = ValueSchema.objOfOnly([
FieldSchema.strict('label'),
FieldSchema.strictObjOf('info', [
FieldSchema.option('url'),
FieldSchema.option('text'),
FieldSchema.option('title'),
FieldSchema.option('target'),
FieldSchema.option('link')
]),
FieldSchema.defaulted('mutations', Fun.noop),
FieldSchema.defaulted('expected', [ ])
]);
const scenario = ValueSchema.asRawOrDie(rawScenario.label, schema, rawScenario);
Logger.sync('setInfo ... ' + scenario.label, function () {
store.clear();
LinkBridge.applyInfo(editor, scenario.info);
store.assertEq('Checking store', scenario.expected);
const link = scenario.info.link.bind(Fun.identity);
link.each(scenario.mutations);
});
};
示例3:
}
}],
action: (comp) => {
detail.onAction(comp);
}
})
),
apis
};
};
export const Notification = Sketcher.single<NotificationSketchSpec, NotificationSketchDetail>({
name: 'Notification',
factory,
configFields: [
FieldSchema.option('level'),
FieldSchema.strict('progress'),
FieldSchema.strict('icon'),
FieldSchema.strict('onAction'),
FieldSchema.strict('text'),
FieldSchema.strict('iconProvider'),
FieldSchema.strict('translationProvider'),
],
apis: {
updateProgress: (apis: NotificationSketchApis, comp: AlloyComponent, percent: number) => {
apis.updateProgress(comp, percent);
},
updateText: (apis: NotificationSketchApis, comp: AlloyComponent, text: string) => {
apis.updateText(comp, text);
}
}
示例4:
import { FieldSchema, ValueSchema } from '@ephox/boulder';
import { Fun } from '@ephox/katamari';
import { Element, Traverse } from '@ephox/sugar';
export default ValueSchema.objOf([
FieldSchema.strictObjOf('editor', [
// Maybe have frame as a method, but I doubt it ... I think we pretty much need a frame
FieldSchema.strict('getFrame'),
FieldSchema.option('getBody'),
FieldSchema.option('getDoc'),
FieldSchema.option('getWin'),
FieldSchema.option('getSelection'),
FieldSchema.option('setSelection'),
FieldSchema.option('clearSelection'),
FieldSchema.option('cursorSaver'),
FieldSchema.option('onKeyup'),
FieldSchema.option('onNodeChanged'),
FieldSchema.option('getCursorBox'),
FieldSchema.strict('onDomChanged'),
FieldSchema.defaulted('onTouchContent', Fun.noop),
FieldSchema.defaulted('onTapContent', Fun.noop),
FieldSchema.defaulted('onTouchToolstrip', Fun.noop),
FieldSchema.defaulted('onScrollToCursor', Fun.constant({ unbind: Fun.noop })),
FieldSchema.defaulted('onScrollToElement', Fun.constant({ unbind: Fun.noop })),
FieldSchema.defaulted('onToEditing', Fun.constant({ unbind: Fun.noop })),
FieldSchema.defaulted('onToReading', Fun.constant({ unbind: Fun.noop })),