Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow safe behaviors while syncing
Browse files Browse the repository at this point in the history
This makes it possible to make selections and copy content even while the
editor is syncing.
christianhg committed Jan 27, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 6416dfa commit fcce6f6
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions packages/editor/src/editor/editor-machine.ts
Original file line number Diff line number Diff line change
@@ -548,6 +548,18 @@ export const editorMachine = setup({
states: {
'read only': {
initial: 'determine initial edit mode',
on: {
'behavior event': {
actions: 'handle behavior event',
guard: ({event}) =>
event.behaviorEvent.type === 'copy' ||
event.behaviorEvent.type === 'data transfer.set' ||
event.behaviorEvent.type === 'serialize' ||
event.behaviorEvent.type === 'serialization.failure' ||
event.behaviorEvent.type === 'serialization.success' ||
event.behaviorEvent.type === 'select',
},
},
states: {
'determine initial edit mode': {
on: {
@@ -564,16 +576,6 @@ export const editorMachine = setup({
},
'read only': {
on: {
'behavior event': {
actions: 'handle behavior event',
guard: ({event}) =>
event.behaviorEvent.type === 'copy' ||
event.behaviorEvent.type === 'data transfer.set' ||
event.behaviorEvent.type === 'serialize' ||
event.behaviorEvent.type === 'serialization.failure' ||
event.behaviorEvent.type === 'serialization.success' ||
event.behaviorEvent.type === 'select',
},
'update readOnly': {
guard: ({event}) => !event.readOnly,
target: '#editor.edit mode.editable',

0 comments on commit fcce6f6

Please sign in to comment.