[fix] exit penmode (#1847)
This PR fixes the "Exit Pen Mode" button (see first commit). There are some other "wrap some stuff in editor.batch" changes in the "follow up changes" commit. ### Change Type - [x] `patch` — Bug fix ### Test Plan 1. Use an ipad / pencil to enter pen mode 2. Click the Exit pen mode button
This commit is contained in:
parent
2e4f1de944
commit
cf00eade9c
1 changed files with 79 additions and 75 deletions
|
@ -273,6 +273,7 @@ export function ActionsProvider({ overrides, children }: ActionsProviderProps) {
|
|||
label: 'action.convert-to-bookmark',
|
||||
readonlyOk: false,
|
||||
onSelect(source) {
|
||||
editor.batch(() => {
|
||||
trackEvent('convert-to-bookmark', { source })
|
||||
const shapes = editor.selectedShapes
|
||||
|
||||
|
@ -305,6 +306,7 @@ export function ActionsProvider({ overrides, children }: ActionsProviderProps) {
|
|||
editor.mark('convert shapes to bookmark')
|
||||
editor.deleteShapes(deleteList)
|
||||
editor.createShapes(createList)
|
||||
})
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -313,6 +315,8 @@ export function ActionsProvider({ overrides, children }: ActionsProviderProps) {
|
|||
readonlyOk: false,
|
||||
onSelect(source) {
|
||||
trackEvent('convert-to-embed', { source })
|
||||
|
||||
editor.batch(() => {
|
||||
const ids = editor.selectedShapeIds
|
||||
const shapes = compact(ids.map((id) => editor.getShape(id)))
|
||||
|
||||
|
@ -355,6 +359,7 @@ export function ActionsProvider({ overrides, children }: ActionsProviderProps) {
|
|||
editor.mark('convert shapes to embed')
|
||||
editor.deleteShapes(deleteList)
|
||||
editor.createShapes(createList)
|
||||
})
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -682,6 +687,7 @@ export function ActionsProvider({ overrides, children }: ActionsProviderProps) {
|
|||
kbd: '$a',
|
||||
readonlyOk: true,
|
||||
onSelect(source) {
|
||||
editor.batch(() => {
|
||||
trackEvent('select-all-shapes', { source })
|
||||
if (editor.currentToolId !== 'select') {
|
||||
editor.cancel()
|
||||
|
@ -690,6 +696,7 @@ export function ActionsProvider({ overrides, children }: ActionsProviderProps) {
|
|||
|
||||
editor.mark('select all kbd')
|
||||
editor.selectAll()
|
||||
})
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -915,12 +922,9 @@ export function ActionsProvider({ overrides, children }: ActionsProviderProps) {
|
|||
readonlyOk: true,
|
||||
onSelect(source) {
|
||||
trackEvent('toggle-debug-mode', { source })
|
||||
editor.updateInstanceState(
|
||||
{
|
||||
editor.updateInstanceState({
|
||||
isDebugMode: !editor.instanceState.isDebugMode,
|
||||
},
|
||||
{ ephemeral: true }
|
||||
)
|
||||
})
|
||||
},
|
||||
checkbox: true,
|
||||
},
|
||||
|
@ -941,7 +945,7 @@ export function ActionsProvider({ overrides, children }: ActionsProviderProps) {
|
|||
readonlyOk: true,
|
||||
onSelect(source) {
|
||||
trackEvent('exit-pen-mode', { source })
|
||||
editor.instanceState.isPenMode = false
|
||||
editor.updateInstanceState({ isPenMode: false })
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue