refactor: component manager usecases (#2354)

This commit is contained in:
Mo
2023-07-13 05:46:52 -05:00
committed by GitHub
parent ecc5b5e503
commit 2c68ea1d76
52 changed files with 1454 additions and 1078 deletions

View File

@@ -0,0 +1,24 @@
import { EditorFeatureDescription, IframeComponentFeatureDescription } from '@standardnotes/features'
import { UIFeature } from '@standardnotes/models'
export class DoesEditorChangeRequireAlertUseCase {
execute(
from: UIFeature<IframeComponentFeatureDescription | EditorFeatureDescription> | undefined,
to: UIFeature<IframeComponentFeatureDescription | EditorFeatureDescription> | undefined,
): boolean {
if (!from || !to) {
return false
}
const fromFileType = from.fileType
const toFileType = to.fileType
const isEitherMarkdown = fromFileType === 'md' || toFileType === 'md'
const areBothHtml = fromFileType === 'html' && toFileType === 'html'
if (isEitherMarkdown || areBothHtml) {
return false
} else {
return true
}
}
}