Bee-plugin-official
Bee-plugin-official copied to clipboard
`onPreview` and `onTogglePreview` callbacks called oddly
Describe the bug
The onPreview and onTogglePreview events/callbacks don't seem to be fired in a consistent way.
To Reproduce
Several scenarios are described below, along with the execution order & values provided to the callbacks:
- Using the Beefree Editor, enable or disable preview mode according to the "Initial State" column.
- Perform the action described in the "Action" column
- ✅ Observe that the preview is enabled/disabled as described in the "Final Preview State" column.
- ❓ Observe that the events/callbacks are fired as described in the "Observed Callbacks" column
| # | Initial State | Action | Final State | Observed Callbacks | |
|---|---|---|---|---|---|
| 1 | false |
Click "Preview" button in editor toolbar | true |
onTogglePreview(true) |
onPreview not called? |
| 2 | true |
Click "X" button in preview header | false |
onTogglePreview(false) |
onPreview not called? |
| 3 | false |
togglePreview() |
true |
onPreview(true) |
✅ |
| 4 | true |
togglePreview() |
false |
onTogglePreview(true) |
onTogglePreview called twice? with incorrect value? |
📚 Documentation
The Beefree docs describe the events as:
| Event | Description | Returned Values |
|---|---|---|
onPreview |
Fired every time the preview button is pressed. | status (boolean) |
onTogglePreview |
Fired every time the preview is opened or closed. | status (boolean) |
Bugs?
The descriptions in the documentation don't seem to describe the observed behaviour of the events:
- If
onPreviewis only meant to be fired when the button is pressed, why does it fire whentogglePreview()is called? (Scenario: 3, 4) - If
onTogglePreviewis only meant to be fired when the preview is opened or closed, why doesn't it fire when the "Preview" button is clicked on the toolbar? (Scenario: 1, 2) - Are the documentation descriptions for the two events swapped?
- Both methods indicate they accept a
statusvariable, but the variable doesn't seem to reflect the current state of the editor? (Scenario 4) - Why does
onTogglePreviewfire twice? (Scenario 4) - Why does
onTogglePreviewfire with the wrong value? (Scenario 4)
Hi there,
Just checking in, has anyone taken a look at this issue?
Hi @BenJenkinson - Thank you for your report. We've opened a ticket in Jira for the dev team to review. Once the Jira task, BBOX-1206, is resolved we'll report back here.