Skip to content

Commit

Permalink
fix(editor): support old versions in new menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed Dec 26, 2021
1 parent 57d23dc commit 72b605f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 9 deletions.
16 changes: 16 additions & 0 deletions packages/better-write-app/src/use/storage/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,22 @@ export const useStorage = () => {
})
}

// <= 0.11.7
if (!_.editor.actives.global) {
_.editor.actives = {
..._.editor.actives,
global: {
mouse: {
x: 0,
y: 0,
vertical: 'top',
horizontal: 'right',
validLastSelection: false,
},
},
}
}

return _
}

Expand Down
22 changes: 13 additions & 9 deletions packages/better-write-types/src/types/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,21 @@ export interface EditorStateActivesEntity {
index: number;
}

export interface EditorStateActivesGlobalMouse {
x: number;
y: number;
vertical: 'top' | 'bottom';
horizontal: 'right' | 'left';
validLastSelection: boolean;
}

export interface EditorStateActivesGlobal {
mouse: EditorStateActivesGlobalMouse;
}

export interface EditorStateActives {
entity: EditorStateActivesEntity;
global: {
mouse: {
x: number;
y: number;
vertical: 'top' | 'bottom';
horizontal: 'right' | 'left';
validLastSelection: boolean;
};
};
global: EditorStateActivesGlobal;
}

export interface EditorStateConfigurationEntity {
Expand Down

0 comments on commit 72b605f

Please sign in to comment.