Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return (comp: AlloyComponent) => {
if (buttonType === 'custom') {
AlloyTriggers.emitWith(comp, formActionEvent, {
name,
value: { }
});
} else if (buttonType === 'submit') {
AlloyTriggers.emit(comp, formSubmitEvent);
} else if (buttonType === 'cancel') {
AlloyTriggers.emit(comp, formCancelEvent);
} else {
// tslint:disable-next-line:no-console
console.error('Unknown button type: ', buttonType);
}
};
};
return (comp: AlloyComponent) => {
if (buttonType === 'custom') {
AlloyTriggers.emitWith(comp, formActionEvent, {
name,
value: { }
});
} else if (buttonType === 'submit') {
AlloyTriggers.emit(comp, formSubmitEvent);
} else if (buttonType === 'cancel') {
AlloyTriggers.emit(comp, formCancelEvent);
} else {
// tslint:disable-next-line:no-console
console.error('Unknown button type: ', buttonType);
}
};
};
},
backstage, ariaAttrs
);
const inlineDialogComp = GuiFactory.build(InlineView.sketch({
lazySink: backstage.shared.getSink,
dom: {
tag: 'div',
classes: [ ]
},
// Fires the default dismiss event.
fireDismissalEventInstead: { },
inlineBehaviours: Behaviour.derive([
AddEventsBehaviour.config('window-manager-inline-events', [
// Can't just fireDismissalEvent formCloseEvent, because it is on the parent component of the dialog
AlloyEvents.run(SystemEvents.dismissRequested(), (comp, se) => {
AlloyTriggers.emit(dialogUi.dialog, formCancelEvent);
}),
]),
...inlineAdditionalBehaviours(editor, isStickyToolbar)
])
}));
inlineDialog.set(inlineDialogComp);
// Position the inline dialog
InlineView.showWithin(
inlineDialogComp,
anchor,
GuiFactory.premade(dialogUi.dialog),
Option.some(Body.body())
);
{
dom: {
tag: 'div',
classes: (isTouch ? [ 'tox-dialog-wrap__backdrop', 'tox-dialog-wrap__backdrop--opaque' ] : [ 'tox-dialog-wrap__backdrop' ])
}
}
]
}
},
modalBehaviours: Behaviour.derive([
// Dupe warning.
AddEventsBehaviour.config('basic-dialog-events', [
AlloyEvents.run(formCancelEvent, (comp, se) => {
spec.onCancel();
}),
AlloyEvents.run(formSubmitEvent, (comp, se) => {
spec.onSubmit();
}),
])
])
}
);
};
parts: {
blocker: {
dom: DomFactory.fromHtml('<div class="tox-dialog-wrap"></div>'),
components: [
{
dom: {
tag: 'div',
classes: (isTouch ? [ 'tox-dialog-wrap__backdrop', 'tox-dialog-wrap__backdrop--opaque' ] : [ 'tox-dialog-wrap__backdrop' ])
}
}
]
}
},
modalBehaviours: Behaviour.derive([
// Dupe warning.
AddEventsBehaviour.config('basic-dialog-events', [
AlloyEvents.run(formCancelEvent, (comp, se) => {
spec.onCancel();
}),
AlloyEvents.run(formSubmitEvent, (comp, se) => {
spec.onSubmit();
}),
])
])
}
);
};
closeWindow(dialogUi.instanceApi);
}
},
backstage, ariaAttrs
);
const inlineDialogComp = GuiFactory.build(InlineView.sketch({
lazySink: backstage.shared.getSink,
dom: {
tag: 'div',
classes: [ ]
},
// Fires the default dismiss event.
fireDismissalEventInstead: { },
inlineBehaviours: Behaviour.derive([
AddEventsBehaviour.config('window-manager-inline-events', [
// Can't just fireDismissalEvent formCloseEvent, because it is on the parent component of the dialog
AlloyEvents.run(SystemEvents.dismissRequested(), (comp, se) => {
AlloyTriggers.emit(dialogUi.dialog, formCancelEvent);
}),
]),
...inlineAdditionalBehaviours(editor, isStickyToolbar)
])
}));
inlineDialog.set(inlineDialogComp);
// Position the inline dialog
InlineView.showWithin(
inlineDialogComp,
anchor,
GuiFactory.premade(dialogUi.dialog),
Option.some(Body.body())
const dialogUi = renderInlineDialog(
dialogInit,
{
redial: DialogManager.DialogManager.redial,
closeWindow: () => {
inlineDialog.on(InlineView.hide);
editor.off('ResizeEditor', refreshDocking);
inlineDialog.clear();
closeWindow(dialogUi.instanceApi);
}
},
backstage, ariaAttrs
);
const inlineDialogComp = GuiFactory.build(InlineView.sketch({
lazySink: backstage.shared.getSink,
dom: {
tag: 'div',
classes: [ ]
},
// Fires the default dismiss event.
fireDismissalEventInstead: { },
inlineBehaviours: Behaviour.derive([
AddEventsBehaviour.config('window-manager-inline-events', [
// Can't just fireDismissalEvent formCloseEvent, because it is on the parent component of the dialog
AlloyEvents.run(SystemEvents.dismissRequested(), (comp, se) => {
AlloyTriggers.emit(dialogUi.dialog, formCancelEvent);
}),
]),
...inlineAdditionalBehaviours(editor, isStickyToolbar)
])
tag: 'div',
classes: [ 'tox-dialog__body' ]
},
components: [
{
dom: {
tag: 'div',
classes: ['tox-dialog__body-content']
},
components: [
memForm.asSpec()
]
}
],
behaviours: Behaviour.derive([
Keying.config({
mode: 'acyclic',
useTabstopAt: Fun.not(NavigableObject.isPseudoStop)
}),
ComposingConfigs.memento(memForm),
RepresentingConfigs.memento(memForm, {
postprocess: (formValue) => FormValues.toValidValues(formValue).fold(
(err) => {
// tslint:disable-next-line:no-console
console.error(err);
return { };
},
(vals) => vals
)
})
])
};
}, (rgbForm) => {
Representing.setValue(rgbForm, {
hex: Option.from(m[1]).getOr('')
});
// So not the way to do this.
Form.getField(rgbForm, 'hex').each((hexField) => {
AlloyTriggers.emit(hexField, NativeEvents.input());
});
});
}
value: itemValue
});
}))
];
const pField = AlloyFormField.parts().field({
dom: {
tag: 'div',
// FIX: Read from columns
classes: [ 'tox-collection' ].concat(spec.columns !== 1 ? [ 'tox-collection--grid' ] : [ 'tox-collection--list' ])
},
components: [ ],
factory: { sketch: Fun.identity },
behaviours: Behaviour.derive([
Replacing.config({ }),
Representing.config({
store: {
mode: 'memory',
initialValue: [ ]
},
onSetValue: (comp, items) => {
setContents(comp, items);
if (spec.columns === 'auto') {
detectSize(comp, 5, 'tox-collection__item').each(({ numRows, numColumns }) => {
Keying.setGridSize(comp, numRows, numColumns);
});
}
AlloyTriggers.emit(comp, formResizeEvent);
}
}),
Tabstopping.config({ }),