Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): add groups to document actions, introduce paneActions group #5933

Merged
merged 2 commits into from
Mar 11, 2024

Conversation

pedrobonamin
Copy link
Contributor

Description

Introduces groups into DocumentActions allowing plugin developers to add actions and decide where they want this actions to show:

  • default will add the actions to the same position as before, in the footer right next to the publish button.
  • paneActions will add the action in the context menu right next to the inspectors and other pane actions.

This is initially intended to support creating tasks from within a document.

Example of usage

export function ConfirmDialogAction({onComplete}): DocumentActionDescription {
  const [dialogOpen, setDialogOpen] = useState(false)

  return {
    label: 'Show confirm',
    onHandle: () => {
      setDialogOpen(true)
    },
    group: ['paneActions'],
    dialog: dialogOpen && {
      type: 'confirm',
      onCancel: onComplete,
      onConfirm: () => {
        alert('You confirmed!')
        onComplete()
      },
      message: 'Please confirm!',
    },
  }
}

const plugin = definePlugin({
  ...,
  document: {
    actions: (prev) => [...prev, ConfirmDialogAction],
  }
})
Screenshot 2024-03-08 at 10 30 23
Screen.Recording.2024-03-08.at.10.39.52.mov

What to review

Is there other way to simplify this?
Are the changes in GetHookCollectionState correct?

Testing

Create an action from within a plugin, the action should render in the selected group.

Notes for release

Add support for groups in document actions.

@pedrobonamin pedrobonamin requested a review from a team as a code owner March 8, 2024 09:41
@pedrobonamin pedrobonamin requested review from binoy14 and removed request for a team March 8, 2024 09:41
Copy link

vercel bot commented Mar 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
performance-studio ✅ Ready (Inspect) Visit Preview Mar 10, 2024 11:31am
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 10, 2024 11:31am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Mar 10, 2024 11:31am

Copy link
Contributor

github-actions bot commented Mar 8, 2024

No changes to documentation

Copy link
Contributor

github-actions bot commented Mar 8, 2024

Component Testing Report Updated Mar 10, 2024 11:35 AM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 31s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 5s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 12s 3 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 12s 4 2 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 12s 6 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 30s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 59s 15 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 58s 18 0 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 11s 6 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 13s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ❌ Failed (Inspect) 24s 8 0 1

Copy link
Member

@bjoerge bjoerge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall! Just found a few smaller things that would be good to fix before merging.

Copy link
Member

@bjoerge bjoerge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, great work @pedrobonamin

@pedrobonamin pedrobonamin added this pull request to the merge queue Mar 11, 2024
Merged via the queue into next with commit 4e95e09 Mar 11, 2024
36 checks passed
@pedrobonamin pedrobonamin deleted the edx-1154 branch March 11, 2024 14:01
ninaandal pushed a commit that referenced this pull request Mar 12, 2024
…up (#5933)

* feat(core): add groups to document actions, introduce paneActions group

* fix(core): update GetHookCollectionState types
juice49 pushed a commit that referenced this pull request Mar 13, 2024
…up (#5933)

* feat(core): add groups to document actions, introduce paneActions group

* fix(core): update GetHookCollectionState types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants