Skip to content

Commit

Permalink
SPIKE Inline validation
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Feb 27, 2024
1 parent 136f1ea commit ea3855e
Show file tree
Hide file tree
Showing 5 changed files with 269 additions and 66 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions client/src/boot/registerTransforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import addElementToArea from 'state/editor/addElementMutation';
import ArchiveAction from 'components/ElementActions/ArchiveAction';
import DuplicateAction from 'components/ElementActions/DuplicateAction';
import PublishAction from 'components/ElementActions/PublishAction';
import SaveAction from 'components/ElementActions/SaveAction';
import UnpublishAction from 'components/ElementActions/UnpublishAction';

export default () => {
Expand Down Expand Up @@ -75,7 +74,6 @@ export default () => {

// Add elemental editor actions
Injector.transform('element-actions', (updater) => {
updater.component('ElementActions', SaveAction, 'ElementActionsWithSave');
updater.component('ElementActions', PublishAction, 'ElementActionsWithPublish');
updater.component('ElementActions', UnpublishAction, 'ElementActionsWithUnpublish');
updater.component('ElementActions', DuplicateAction, 'ElementActionsWithDuplicate');
Expand Down
9 changes: 7 additions & 2 deletions client/src/components/ElementEditor/InlineEditForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ class InlineEditForm extends PureComponent {
const classNames = classnames('element-editor-editform', extraClass);
const schemaUrl = loadElementSchemaValue('schemaUrl', elementId);

// formTag needs to be a form rather than a div so that the php FormAction that turns into
// a <button type="submit>" submits this <form>, rather than the <form> for the parent page EditForm
const formTag = 'form';

const formProps = {
formTag: 'div',
formTag,
schemaUrl,
identifier: 'element',
refetchSchemaOnMount: !formHasState,
Expand All @@ -58,7 +62,8 @@ class InlineEditForm extends PureComponent {
// FormBuilder forms, such as LinkField v4+, are themselves submitted
// This FormBuilder form is not submitted in the traditional sense i.e. there is no rendered submit button
// instead the inline save button will do its own submission in SaveAction.js
onSubmit: () => new Promise(resolve => resolve),
// onSubmit: () => new Promise(resolve => resolve),
// ^^ cannot use this if we do actually want to submit the form though :-)
};

if (loadingError) {
Expand Down
Loading

0 comments on commit ea3855e

Please sign in to comment.