Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
mode: 'special',
focusIn (dialog/*, specialInfo */) {
focusInput(dialog);
},
onTab (dialog/*, specialInfo */) {
navigate(dialog, +1);
return Option.some(true);
},
onShiftTab (dialog/*, specialInfo */) {
navigate(dialog, -1);
return Option.some(true);
}
}),
AddEventsBehaviour.config(formAdhocEvents, [
AlloyEvents.runOnAttached(function (dialog, simulatedEvent) {
// Reset state to first screen.
resetState();
const dotitems = memDots.get(dialog);
Highlighting.highlightFirst(dotitems);
spec.getInitialValue(dialog).each(function (v) {
Representing.setValue(dialog, v);
});
}),
AlloyEvents.runOnExecute(spec.onExecute),
AlloyEvents.run(NativeEvents.transitionend(), function (dialog, simulatedEvent) {
const event = simulatedEvent.event() as any;
if (event.raw().propertyName === 'left') {
focusInput(dialog);
}memBg.asSpec(),
{
dom: {
tag: 'img',
attributes: {
src: initialUrl
}
}
},
{
dom: {
tag: 'div'
},
behaviours: Behaviour.derive([
AddEventsBehaviour.config('image-panel-crop-events', [
AlloyEvents.runOnAttached((comp) => {
memContainer.getOpt(comp).each((container) => {
const el = container.element().dom();
const cRect = CropRect.create(
{ x: 10, y: 10, w: 100, h: 100 },
{ x: 0, y: 0, w: 200, h: 200 },
{ x: 0, y: 0, w: 200, h: 200 },
el,
() => { } // TODO: Add back keyboard handling for cropping
);
cRect.toggleVisibility(false);
cRect.on('updateRect', (e) => {
const rect = e.rect;
const zoom = zoomState.get();
const newRect = {
x: Math.round(rect.x / zoom),
y: Math.round(rect.y / zoom),const smartTabHeight = (() => {
const maxTabHeight = Cell>(Option.none());
const extraEvents = [
AlloyEvents.runOnAttached((comp) => {
const dialog = comp.element();
getTabview(dialog).each((tabview) => {
Css.set(tabview, 'visibility', 'hidden');
// Determine the maximum heights of each tab
comp.getSystem().getByDom(tabview).toOption().each((tabviewComp) => {
const heights = measureHeights(allTabs, tabview, tabviewComp);
// Calculate the maximum tab height and store it
const maxTabHeightOpt = getMaxHeight(heights);
maxTabHeight.set(maxTabHeightOpt);
});
// Set an initial height, based on the current size
updateTabviewHeight(dialog, tabview, maxTabHeight);const memReplaced = Memento.record({
dom: {
tag: spec.tag
}
});
const initialValue = Cell(Option.none());
return {
dom: {
tag: 'div',
classes: [ 'tox-custom-editor' ]
},
behaviours: Behaviour.derive([
AddEventsBehaviour.config('editor-foo-events', [
AlloyEvents.runOnAttached((component) => {
memReplaced.getOpt(component).each((ta) => {
(isOldCustomEditor(spec)
? spec.init(ta.element().dom())
: Resource.load(spec.scriptId, spec.scriptUrl).then(
(init: CustomEditorInitFn) => init(ta.element().dom(), spec.settings)
)
).then((ea) => {
initialValue.get().each((cvalue) => {
ea.setValue(cvalue);
});
initialValue.set(Option.none());
editorApi.set(Option.some(ea));
});
});
})const wrapInPopDialog = (toolbarSpec: AlloySpec) => {
return {
dom: {
tag: 'div',
classes: ['tox-pop__dialog'],
},
components: [toolbarSpec],
behaviours: Behaviour.derive([
Keying.config({
mode: 'acyclic'
}),
AddEventsBehaviour.config('pop-dialog-wrap-events', [
AlloyEvents.runOnAttached((comp) => {
editor.shortcuts.add('ctrl+F9', 'focus statusbar', () => Keying.focusIn(comp));
}),
AlloyEvents.runOnDetached((comp) => {
editor.shortcuts.remove('ctrl+F9');
})
])
])
};
};const onControlAttached = (info: OnControlAttachedType, editorOffCell: Cell>) => {
return AlloyEvents.runOnAttached((comp) => {
const run = runWithApi(info, comp);
run((api) => {
const onDestroy = info.onSetup(api);
if (onDestroy !== null && onDestroy !== undefined) {
editorOffCell.set(onDestroy);
}
});
});
};AlloyForm.sketch((parts) => {
return {
dom: {
tag: 'div',
classes: [ 'tox-form' ]
},
components: Arr.map(tab.items, (item) => interpretInForm(parts, item, backstage)),
formBehaviours: Behaviour.derive([
Keying.config({
mode: 'acyclic',
useTabstopAt: Fun.not(NavigableObject.isPseudoStop)
}),
AddEventsBehaviour.config('TabView.form.events', [
AlloyEvents.runOnAttached(setDataOnForm),
AlloyEvents.runOnDetached(updateDataWithForm)
]),
Receiving.config({
channels: Objects.wrapAll([
{
key: SendDataToSectionChannel,
value: {
onReceive: updateDataWithForm
}
},
{
key: SendDataToViewChannel,
value: {
onReceive: setDataOnForm
}
}],
classes: []
}, {
shared: sharedBackstage
})
);
return {
dom: {
tag: 'div'
},
components: [
memBodyPanel.asSpec(),
],
events: AlloyEvents.derive([
AlloyEvents.runOnAttached((component) => {
const body = memBodyPanel.get(component);
Representing.setValue(body, {
checked: true,
unchecked: false
});
})
])
};
})();AlloyForm.sketch((parts) => {
return {
dom: {
tag: 'div',
classes: [ 'tox-form' ]
},
components: Arr.map(tab.items, (item) => interpretInForm(parts, item, backstage)),
formBehaviours: Behaviour.derive([
Keying.config({
mode: 'acyclic',
useTabstopAt: Fun.not(NavigableObject.isPseudoStop)
}),
AddEventsBehaviour.config('TabView.form.events', [
AlloyEvents.runOnAttached(setDataOnForm),
AlloyEvents.runOnDetached(updateDataWithForm)
]),
Receiving.config({
channels: Objects.wrapAll([
{
key: SendDataToSectionChannel,
value: {
onReceive: updateDataWithForm
}
},
{
key: SendDataToViewChannel,
value: {
onReceive: setDataOnForm
}
}