refactor: component manager usecases (#2354)
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user