refactor(web): dependency management (#2386)
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { ViewControllerManager } from '@/Controllers/ViewControllerManager'
|
||||
import { observer } from 'mobx-react-lite'
|
||||
import { FunctionComponent, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import ChangeEditorMenu from './ChangeEditorMenu'
|
||||
@@ -11,19 +10,14 @@ import { NoteViewController } from '../NoteView/Controller/NoteViewController'
|
||||
import { NoteType, noteTypeForEditorIdentifier } from '@standardnotes/snjs'
|
||||
|
||||
type Props = {
|
||||
viewControllerManager: ViewControllerManager
|
||||
noteViewController?: NoteViewController
|
||||
onClickPreprocessing?: () => Promise<void>
|
||||
}
|
||||
|
||||
const ChangeEditorButton: FunctionComponent<Props> = ({
|
||||
viewControllerManager,
|
||||
noteViewController,
|
||||
onClickPreprocessing,
|
||||
}: Props) => {
|
||||
const ChangeEditorButton: FunctionComponent<Props> = ({ noteViewController, onClickPreprocessing }: Props) => {
|
||||
const application = useApplication()
|
||||
|
||||
const note = viewControllerManager.notesController.firstSelectedNote
|
||||
const note = application.notesController.firstSelectedNote
|
||||
const [isOpen, setIsOpen] = useState(false)
|
||||
const buttonRef = useRef<HTMLButtonElement>(null)
|
||||
const containerRef = useRef<HTMLDivElement>(null)
|
||||
|
||||
@@ -85,14 +85,14 @@ const ChangeEditorMenu: FunctionComponent<ChangeEditorMenuProps> = ({
|
||||
const selectComponent = useCallback(
|
||||
async (uiFeature: UIFeature<EditorFeatureDescription | IframeComponentFeatureDescription>, note: SNNote) => {
|
||||
if (uiFeature.isComponent && uiFeature.asComponent.conflictOf) {
|
||||
void application.changeAndSaveItem(uiFeature.asComponent, (mutator) => {
|
||||
void application.changeAndSaveItem.execute(uiFeature.asComponent, (mutator) => {
|
||||
mutator.conflictOf = undefined
|
||||
})
|
||||
}
|
||||
|
||||
await application.controllers.itemListController.insertCurrentIfTemplate()
|
||||
await application.itemListController.insertCurrentIfTemplate()
|
||||
|
||||
await application.changeAndSaveItem(note, (mutator) => {
|
||||
await application.changeAndSaveItem.execute(note, (mutator) => {
|
||||
const noteMutator = mutator as NoteMutator
|
||||
noteMutator.noteType = uiFeature.noteType
|
||||
noteMutator.editorIdentifier = uiFeature.featureIdentifier
|
||||
|
||||
@@ -42,12 +42,12 @@ const ChangeEditorMultipleMenu = ({ application, notes, setDisableClickOutside }
|
||||
const selectComponent = useCallback(
|
||||
async (uiFeature: UIFeature<EditorFeatureDescription | IframeComponentFeatureDescription>, note: SNNote) => {
|
||||
if (uiFeature.isComponent && uiFeature.asComponent.conflictOf) {
|
||||
void application.changeAndSaveItem(uiFeature.asComponent, (mutator) => {
|
||||
void application.changeAndSaveItem.execute(uiFeature.asComponent, (mutator) => {
|
||||
mutator.conflictOf = undefined
|
||||
})
|
||||
}
|
||||
|
||||
await application.changeAndSaveItem(note, (mutator) => {
|
||||
await application.changeAndSaveItem.execute(note, (mutator) => {
|
||||
const noteMutator = mutator as NoteMutator
|
||||
noteMutator.noteType = uiFeature.noteType
|
||||
noteMutator.editorIdentifier = uiFeature.featureIdentifier
|
||||
|
||||
Reference in New Issue
Block a user