chore: fix super seamless convert
This commit is contained in:
@@ -52,6 +52,7 @@ const ChangeEditorMenu: FunctionComponent<ChangeEditorMenuProps> = ({
|
|||||||
const showSuperNoteImporter =
|
const showSuperNoteImporter =
|
||||||
!!pendingConversionItem &&
|
!!pendingConversionItem &&
|
||||||
note?.noteType !== NoteType.Super &&
|
note?.noteType !== NoteType.Super &&
|
||||||
|
!!note?.text.length &&
|
||||||
pendingConversionItem.uiFeature.noteType === NoteType.Super
|
pendingConversionItem.uiFeature.noteType === NoteType.Super
|
||||||
const showSuperNoteConverter =
|
const showSuperNoteConverter =
|
||||||
!!pendingConversionItem &&
|
!!pendingConversionItem &&
|
||||||
@@ -107,6 +108,20 @@ const ChangeEditorMenu: FunctionComponent<ChangeEditorMenuProps> = ({
|
|||||||
[application],
|
[application],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const handleConversionCompletion = useCallback(
|
||||||
|
(item?: EditorMenuItem) => {
|
||||||
|
const conversionItem = item || pendingConversionItem
|
||||||
|
|
||||||
|
if (!conversionItem || !note) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
selectComponent(conversionItem.uiFeature, note).catch(console.error)
|
||||||
|
closeMenu()
|
||||||
|
},
|
||||||
|
[pendingConversionItem, note, closeMenu, selectComponent],
|
||||||
|
)
|
||||||
|
|
||||||
const handleMenuSelection = useCallback(
|
const handleMenuSelection = useCallback(
|
||||||
async (menuItem: EditorMenuItem) => {
|
async (menuItem: EditorMenuItem) => {
|
||||||
if (!menuItem.isEntitled) {
|
if (!menuItem.isEntitled) {
|
||||||
@@ -124,6 +139,11 @@ const ChangeEditorMenu: FunctionComponent<ChangeEditorMenuProps> = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (menuItem.uiFeature.noteType === NoteType.Super) {
|
if (menuItem.uiFeature.noteType === NoteType.Super) {
|
||||||
|
if (note.text.length === 0) {
|
||||||
|
handleConversionCompletion(menuItem)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (note.noteType === NoteType.Super) {
|
if (note.noteType === NoteType.Super) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -170,20 +190,12 @@ const ChangeEditorMenu: FunctionComponent<ChangeEditorMenuProps> = ({
|
|||||||
application.alerts,
|
application.alerts,
|
||||||
application.componentManager,
|
application.componentManager,
|
||||||
setDisableClickOutside,
|
setDisableClickOutside,
|
||||||
|
handleConversionCompletion,
|
||||||
currentFeature,
|
currentFeature,
|
||||||
selectComponent,
|
selectComponent,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
const handleConversionCompletion = useCallback(() => {
|
|
||||||
if (!pendingConversionItem || !note) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
selectComponent(pendingConversionItem.uiFeature, note).catch(console.error)
|
|
||||||
closeMenu()
|
|
||||||
}, [pendingConversionItem, note, closeMenu, selectComponent])
|
|
||||||
|
|
||||||
const closeSuperNoteImporter = () => {
|
const closeSuperNoteImporter = () => {
|
||||||
setPendingConversionItem(null)
|
setPendingConversionItem(null)
|
||||||
setDisableClickOutside?.(false)
|
setDisableClickOutside?.(false)
|
||||||
|
|||||||
Reference in New Issue
Block a user