本文整理汇总了TypeScript中@ephox/alloy.SystemEvents.postPaste方法的典型用法代码示例。如果您正苦于以下问题:TypeScript SystemEvents.postPaste方法的具体用法?TypeScript SystemEvents.postPaste怎么用?TypeScript SystemEvents.postPaste使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/alloy.SystemEvents
的用法示例。
在下文中一共展示了SystemEvents.postPaste方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const renderTextField = function (spec: TextFieldFoo, providersBackstage: UiFactoryBackstageProviders) {
const pLabel = spec.label.map((label) => renderLabel(label, providersBackstage));
const baseInputBehaviours = [
Keying.config({
mode: 'execution',
useEnter: spec.multiline !== true,
useControlEnter: spec.multiline === true,
execute: (comp) => {
AlloyTriggers.emit(comp, formSubmitEvent);
return Option.some(true);
},
}),
AddEventsBehaviour.config('textfield-change', [
AlloyEvents.run(NativeEvents.input(), (component, _) => {
AlloyTriggers.emitWith(component, formChangeEvent, { name: spec.name } );
}),
AlloyEvents.run(SystemEvents.postPaste(), (component, _) => {
AlloyTriggers.emitWith(component, formChangeEvent, { name: spec.name } );
})
]),
Tabstopping.config({})
];
const validatingBehaviours = spec.validation.map((vl) => {
return Invalidating.config({
getRoot(input) {
return Traverse.parent(input.element());
},
invalidClass: 'tox-invalid',
validator: {
validate(input) {
const v = Representing.getValue(input);
const result = vl.validator(v);
return Future.pure(result === true ? Result.value(v) : Result.error(result));
},
validateOnLoad: vl.validateOnLoad
}
});
}).toArray();
const pField = AlloyFormField.parts().field({
tag: spec.multiline === true ? 'textarea' : 'input',
inputAttributes: spec.placeholder.fold(
() => {},
(placeholder) => ({ placeholder: providersBackstage.translate(placeholder) })
),
inputClasses: [spec.classname],
inputBehaviours: Behaviour.derive(
Arr.flatten<Behaviour.NamedConfiguredBehaviour<Behaviour.BehaviourConfigSpec, Behaviour.BehaviourConfigDetail>>([
baseInputBehaviours,
validatingBehaviours
])
),
selectOnFocus: false,
factory: AlloyInput
});
const extraClasses = spec.flex ? ['tox-form__group--stretched'] : [];
return renderFormFieldWith(pLabel, pField, extraClasses);
};
示例2: 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: {
//.........这里部分代码省略.........