refactor(web): dependency management (#2386)

This commit is contained in:
Mo
2023-08-05 12:48:39 -05:00
committed by GitHub
parent b07da5b663
commit d8d4052a52
274 changed files with 4065 additions and 3873 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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