refactor(web): dependency management (#2386)
This commit is contained in:
@@ -37,7 +37,7 @@ export default function FilePlugin({ currentNote }: { currentNote: SNNote }): JS
|
||||
if (uploadedFile) {
|
||||
editor.dispatchCommand(INSERT_FILE_COMMAND, uploadedFile.uuid)
|
||||
void linkingController.linkItemToSelectedItem(uploadedFile)
|
||||
void application.changeAndSaveItem(uploadedFile, (mutator) => {
|
||||
void application.changeAndSaveItem.execute(uploadedFile, (mutator) => {
|
||||
mutator.protected = currentNote.protected
|
||||
})
|
||||
}
|
||||
|
||||
@@ -23,14 +23,16 @@ export const ExportPlugin = () => {
|
||||
const downloadData = useCallback(
|
||||
(data: Blob, fileName: string) => {
|
||||
if (!application.isNativeMobileWeb()) {
|
||||
application.getArchiveService().downloadData(data, fileName)
|
||||
application.archiveService.downloadData(data, fileName)
|
||||
return
|
||||
}
|
||||
|
||||
if (application.platform === Platform.Android) {
|
||||
downloadBlobOnAndroid(application, data, fileName).catch(console.error)
|
||||
downloadBlobOnAndroid(application.mobileDevice, data, fileName).catch(console.error)
|
||||
} else {
|
||||
shareBlobOnMobile(application, data, fileName).catch(console.error)
|
||||
shareBlobOnMobile(application.mobileDevice, application.isNativeMobileWeb(), data, fileName).catch(
|
||||
console.error,
|
||||
)
|
||||
}
|
||||
},
|
||||
[application],
|
||||
|
||||
@@ -9,7 +9,7 @@ const ReadonlyPlugin = ({ note }: { note: SNNote }) => {
|
||||
const [readOnly, setReadOnly] = useState(note.locked)
|
||||
|
||||
useEffect(() => {
|
||||
return application.streamItems<SNNote>(ContentType.TYPES.Note, ({ changed }) => {
|
||||
return application.items.streamItems<SNNote>(ContentType.TYPES.Note, ({ changed }) => {
|
||||
const changedNoteItem = changed.find((changedItem) => changedItem.uuid === note.uuid)
|
||||
|
||||
if (changedNoteItem) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useApplication } from '@/Components/ApplicationProvider'
|
||||
import Icon from '@/Components/Icon/Icon'
|
||||
import Spinner from '@/Components/Spinner/Spinner'
|
||||
import { isDesktopApplication, isIOS } from '@/Utils'
|
||||
import { isDesktopApplication } from '@/Utils'
|
||||
import { BlockWithAlignableContents } from '@lexical/react/LexicalBlockWithAlignableContents'
|
||||
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'
|
||||
import { classNames, Platform } from '@standardnotes/snjs'
|
||||
@@ -9,6 +9,7 @@ import { ElementFormatType, NodeKey } from 'lexical'
|
||||
import { useCallback, useState } from 'react'
|
||||
import { $createFileNode } from '../EncryptedFilePlugin/Nodes/FileUtils'
|
||||
import { RemoteImageNode } from './RemoteImageNode'
|
||||
import { isIOS } from '@standardnotes/ui-services'
|
||||
|
||||
type Props = {
|
||||
src: string
|
||||
@@ -41,7 +42,7 @@ const RemoteImageComponent = ({ className, src, alt, node, format, nodeKey }: Pr
|
||||
const blob = await response.blob()
|
||||
const file = new File([blob], src, { type: blob.type })
|
||||
|
||||
const { filesController, linkingController } = application.controllers
|
||||
const { filesController, linkingController } = application
|
||||
|
||||
const uploadedFile = await filesController.uploadNewFile(file, false)
|
||||
|
||||
|
||||
@@ -94,7 +94,17 @@ const SuperNoteConverter = ({
|
||||
|
||||
const performConvert = useCallback(
|
||||
async (text: string) => {
|
||||
const controller = new NoteViewController(application, note)
|
||||
const controller = new NoteViewController(
|
||||
note,
|
||||
application.items,
|
||||
application.mutator,
|
||||
application.sync,
|
||||
application.sessions,
|
||||
application.preferences,
|
||||
application.componentManager,
|
||||
application.alerts,
|
||||
application.isNativeMobileWebUseCase,
|
||||
)
|
||||
await controller.initialize()
|
||||
await controller.saveAndAwaitLocalPropagation({
|
||||
text,
|
||||
|
||||
@@ -43,7 +43,17 @@ export const SuperNoteImporter: FunctionComponent<Props> = ({ note, application,
|
||||
|
||||
const performConvert = useCallback(
|
||||
async (text: string, previewPlain: string) => {
|
||||
const controller = new NoteViewController(application, note)
|
||||
const controller = new NoteViewController(
|
||||
note,
|
||||
application.items,
|
||||
application.mutator,
|
||||
application.sync,
|
||||
application.sessions,
|
||||
application.preferences,
|
||||
application.componentManager,
|
||||
application.alerts,
|
||||
application.isNativeMobileWebUseCase,
|
||||
)
|
||||
await controller.initialize()
|
||||
await controller.saveAndAwaitLocalPropagation({
|
||||
text: text,
|
||||
|
||||
Reference in New Issue
Block a user