本文整理汇总了TypeScript中@ephox/alloy.Tabstopping.config方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Tabstopping.config方法的具体用法?TypeScript Tabstopping.config怎么用?TypeScript Tabstopping.config使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/alloy.Tabstopping
的用法示例。
在下文中一共展示了Tabstopping.config方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
const renderToolbarGroupCommon = (toolbarGroup: ToolbarGroup) => {
const attributes = toolbarGroup.title.fold(() => {
return {};
},
(title) => {
return { attributes: { title } };
});
return {
dom: {
tag: 'div',
classes: ['tox-toolbar__group'],
...attributes
},
components: [
AlloyToolbarGroup.parts().items({})
],
items: toolbarGroup.items,
markers: {
// nav within a group breaks if disabled buttons are first in their group so skip them
itemSelector: '*:not(.tox-split-button) > .tox-tbtn:not([disabled]), .tox-split-button:not([disabled]), .tox-toolbar-nav-js:not([disabled])'
},
tgroupBehaviours: Behaviour.derive([
Tabstopping.config({}),
Focusing.config({})
])
};
};
示例2:
export const renderHtmlPanel = (spec: HtmlPanelFoo): SketchSpec => {
if (spec.presets === 'presentation') {
return AlloyContainer.sketch({
dom: {
tag: 'div',
classes: [ 'tox-form__group' ],
innerHtml: spec.html
}
});
} else {
return AlloyContainer.sketch({
dom: {
tag: 'div',
classes: [ 'tox-form__group' ],
innerHtml: spec.html,
attributes: {
role: 'document'
}
},
containerBehaviours: Behaviour.derive([
Tabstopping.config({ }),
Focusing.config({ })
])
});
}
};
示例3:
const renderCommonSpec = (spec, actionOpt, extraBehaviours = [], dom, components) => {
const action = actionOpt.fold(() => {
return {};
}, (action) => {
return {
action
};
});
const common = {
buttonBehaviours: Behaviour.derive([
DisablingConfigs.button(spec.disabled),
Tabstopping.config({}),
AddEventsBehaviour.config('button press', [
AlloyEvents.preventDefault('click'),
AlloyEvents.preventDefault('mousedown')
])
].concat(extraBehaviours)),
eventOrder: {
click: ['button press', 'alloy.base.behaviour'],
mousedown: ['button press', 'alloy.base.behaviour']
},
...action
};
const domFinal = Merger.deepMerge(common, { dom });
return Merger.deepMerge(domFinal, { components });
};
示例4: function
const field = function (name, placeholder) {
const inputSpec = Memento.record(Input.sketch({
placeholder,
onSetValue (input, data) {
// If the value changes, inform the container so that it can update whether the "x" is visible
AlloyTriggers.emit(input, NativeEvents.input());
},
inputBehaviours: Behaviour.derive([
Composing.config({
find: Option.some
}),
Tabstopping.config({ }),
Keying.config({
mode: 'execution'
})
]),
selectOnFocus: false
}));
const buttonSpec = Memento.record(
Button.sketch({
dom: UiDomFactory.dom('<button class="${prefix}-input-container-x ${prefix}-icon-cancel-circle ${prefix}-icon"></button>'),
action (button) {
const input = inputSpec.get(button);
Representing.setValue(input, '');
}
})
);
return {
name,
spec: Container.sketch({
dom: UiDomFactory.dom('<div class="${prefix}-input-container"></div>'),
components: [
inputSpec.asSpec(),
buttonSpec.asSpec()
],
containerBehaviours: Behaviour.derive([
Toggling.config({
toggleClass: Styles.resolve('input-container-empty')
}),
Composing.config({
find (comp) {
return Option.some(inputSpec.get(comp));
}
}),
AddEventsBehaviour.config(clearInputBehaviour, [
// INVESTIGATE: Because this only happens on input,
// it won't reset unless it has an initial value
AlloyEvents.run(NativeEvents.input(), function (iContainer) {
const input = inputSpec.get(iContainer);
const val = Representing.getValue(input);
const f = val.length > 0 ? Toggling.off : Toggling.on;
f(iContainer);
})
])
])
})
};
};
示例5: renderLabel
export const renderSelectBox = (spec: Types.SelectBox.SelectBox, providersBackstage: UiFactoryBackstageProviders): SketchSpec => {
const translatedOptions = Arr.map(spec.items, (item) => {
return {
text: providersBackstage.translate(item.text),
value: item.value
};
});
// DUPE with TextField.
const pLabel = spec.label.map((label) => renderLabel(label, providersBackstage));
const pField = AlloyFormField.parts().field({
// TODO: Alloy should not allow dom changing of an HTML select!
dom: { },
selectAttributes: {
size: spec.size
},
options: translatedOptions,
factory: AlloyHtmlSelect,
selectBehaviours: Behaviour.derive([
Tabstopping.config({ }),
AddEventsBehaviour.config('selectbox-change', [
AlloyEvents.run(NativeEvents.change(), (component, _) => {
AlloyTriggers.emitWith(component, formChangeEvent, { name: spec.name } );
})
])
])
});
const chevron = spec.size > 1 ? Option.none() :
Option.some({
dom: {
tag: 'div',
classes: ['tox-selectfield__icon-js'],
innerHtml: Icons.get('chevron-down', providersBackstage.icons)
}
});
const selectWrap: SimpleSpec = {
dom: {
tag: 'div',
classes: ['tox-selectfield']
},
components: Arr.flatten([[pField], chevron.toArray()])
};
return AlloyFormField.sketch({
dom: {
tag: 'div',
classes: ['tox-form__group']
},
components: Arr.flatten<AlloySpec>([pLabel.toArray(), [selectWrap]])
});
};
示例6: createPartialChoiceMenu
export const renderPanelButton = (spec: SwatchPanelButtonFoo, sharedBackstage: UiFactoryBackstageShared): SketchSpec => {
return AlloyDropdown.sketch({
dom: spec.dom,
components: spec.components,
toggleClass: 'mce-active',
dropdownBehaviours: Behaviour.derive([
Unselecting.config({}),
Tabstopping.config({})
]),
// getHotspot: spec.getHotspot,
layouts: spec.layouts,
sandboxClasses: ['tox-dialog__popups'],
lazySink: sharedBackstage.getSink,
fetch: (comp) => {
return Future.nu((callback) => {
return spec.fetch(callback);
}).map((items) => {
return Option.from(createTieredDataFrom(
Merger.deepMerge(
createPartialChoiceMenu(
Id.generate('menu-value'),
items,
(value) => {
spec.onItemAction(comp, value);
},
spec.columns,
spec.presets,
ItemResponse.CLOSE_ON_EXECUTE,
// No colour is ever selected on opening
() => false,
sharedBackstage.providers
),
{
movement: deriveMenuMovement(spec.columns, spec.presets)
}
)
));
});
},
parts: {
menu: MenuParts.part(false, 1, spec.presets)
}
});
};
示例7: function
const getFieldPart = (isField1) => AlloyFormField.parts().field({
factory: AlloyInput,
inputClasses: ['tox-textfield'],
inputBehaviours: Behaviour.derive([
Tabstopping.config({}),
AddEventsBehaviour.config('size-input-events', [
AlloyEvents.run(NativeEvents.focusin(), function (component, simulatedEvent) {
AlloyTriggers.emitWith(component, ratioEvent, { isField1 });
}),
AlloyEvents.run(NativeEvents.change(), function (component, simulatedEvent) {
AlloyTriggers.emitWith(component, formChangeEvent, { name: spec.name });
})
])
]),
selectOnFocus: false
});
示例8:
const pClose = (onClose, providersBackstage: UiFactoryBackstageProviders) => ModalDialog.parts().close(
// Need to find a way to make it clear in the docs whether parts can be sketches
Button.sketch({
dom: {
tag: 'button',
classes: [ 'tox-button', 'tox-button--icon', 'tox-button--naked' ],
attributes: {
'type': 'button',
'aria-label': providersBackstage.translate('Close')
}
},
action: onClose,
buttonBehaviours: Behaviour.derive([
Tabstopping.config({ })
])
})
);
示例9:
const factory = (newSpec: { uid: string }) => {
return NavigableObject.craft(
{
// We need to use the part uid or the label and field won't be linked with ARIA
uid: newSpec.uid,
dom: {
tag: 'iframe',
attributes
},
behaviours: Behaviour.derive([
Tabstopping.config({ }),
Focusing.config({ }),
RepresentingConfigs.withComp(Option.none(), sourcing.getValue, sourcing.setValue)
])
}
);
};
示例10: renderLabel
export const renderListbox = (spec: ListboxFoo, providersBackstage: UiFactoryBackstageProviders): SketchSpec => {
const pLabel = renderLabel(spec.label, providersBackstage);
const pField = AlloyFormField.parts().field({
factory: HtmlSelect,
dom: {
classes: [ 'mce-select-field' ]
},
selectBehaviours: Behaviour.derive([
Tabstopping.config({ })
]),
options: spec.values,
// FIX: Don't use undefined here.
data: spec.initialValue.getOr(undefined)
});
return renderFormField(Option.some(pLabel), pField);
};