Skip to content

Commit

Permalink
chore: add new changeset reason
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentdchan committed Nov 24, 2023
1 parent d0af977 commit 6ec132a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.4.1

- Introduce `CursorStateUpdateReason.beforeChangeset`

## 3.4.0

- Drag and drop blocks
Expand Down
2 changes: 1 addition & 1 deletion packages/blocky-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blocky-core",
"version": "3.4.0",
"version": "3.4.1",
"description": "The core of the blocky editor",
"main": "dist/index.js",
"module": "dist/index.js",
Expand Down
1 change: 1 addition & 0 deletions packages/blocky-core/src/data/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { VersionHistory } from "./versionHistory";
import { type CursorState } from "./cursor";

export enum CursorStateUpdateReason {
beforeChangeset = "beforeChangeset",
/**
* The user changed the cursor manually through the changeset
*/
Expand Down
5 changes: 4 additions & 1 deletion packages/blocky-core/src/view/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,10 @@ export class Editor {
#handleBeforeChangesetApply = (changeset: FinalizedChangeset) => {
const { afterCursor, options } = changeset;
if (!isUndefined(afterCursor) || options.refreshCursor) {
this.state.__setCursorState(null, CursorStateUpdateReason.changeset);
this.state.__setCursorState(
null,
CursorStateUpdateReason.beforeChangeset
);
}
};

Expand Down

1 comment on commit 6ec132a

@vercel
Copy link

@vercel vercel bot commented on 6ec132a Nov 24, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.