fix: fixed issue with third party editors not loading (#2174)
This commit is contained in:
@@ -5,7 +5,6 @@ describe('note type', () => {
|
||||
it('should return the correct note type for editor identifier', () => {
|
||||
expect(noteTypeForEditorIdentifier(FeatureIdentifier.PlainEditor)).toEqual(NoteType.Plain)
|
||||
expect(noteTypeForEditorIdentifier(FeatureIdentifier.SuperEditor)).toEqual(NoteType.Super)
|
||||
expect(noteTypeForEditorIdentifier(FeatureIdentifier.MarkdownVisualEditor)).toEqual(NoteType.Markdown)
|
||||
expect(noteTypeForEditorIdentifier(FeatureIdentifier.MarkdownProEditor)).toEqual(NoteType.Markdown)
|
||||
expect(noteTypeForEditorIdentifier(FeatureIdentifier.PlusEditor)).toEqual(NoteType.RichText)
|
||||
expect(noteTypeForEditorIdentifier(FeatureIdentifier.CodeEditor)).toEqual(NoteType.Code)
|
||||
|
||||
@@ -30,12 +30,12 @@ export enum FeatureIdentifier {
|
||||
|
||||
CodeEditor = 'org.standardnotes.code-editor',
|
||||
MarkdownProEditor = 'org.standardnotes.advanced-markdown-editor',
|
||||
MarkdownVisualEditor = 'org.standardnotes.markdown-visual-editor',
|
||||
PlusEditor = 'org.standardnotes.plus-editor',
|
||||
SheetsEditor = 'org.standardnotes.standard-sheets',
|
||||
TaskEditor = 'org.standardnotes.simple-task-editor',
|
||||
TokenVaultEditor = 'org.standardnotes.token-vault',
|
||||
|
||||
DeprecatedMarkdownVisualEditor = 'org.standardnotes.markdown-visual-editor',
|
||||
DeprecatedBoldEditor = 'org.standardnotes.bold-editor',
|
||||
DeprecatedMarkdownBasicEditor = 'org.standardnotes.simple-markdown-editor',
|
||||
DeprecatedMarkdownMathEditor = 'org.standardnotes.fancy-markdown-editor',
|
||||
|
||||
@@ -55,6 +55,21 @@ export function GetDeprecatedFeatures(): FeatureDescription[] {
|
||||
availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser],
|
||||
})
|
||||
|
||||
const markdownAlt: EditorFeatureDescription = FillEditorComponentDefaults({
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
name: 'Markdown Alternative',
|
||||
identifier: FeatureIdentifier.DeprecatedMarkdownVisualEditor,
|
||||
note_type: NoteType.Markdown,
|
||||
file_type: 'md',
|
||||
deprecated: true,
|
||||
permission_name: PermissionName.MarkdownVisualEditor,
|
||||
spellcheckControl: true,
|
||||
description:
|
||||
'A WYSIWYG-style Markdown editor that renders Markdown in preview-mode while you type without displaying any syntax.',
|
||||
index_path: 'build/index.html',
|
||||
availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser],
|
||||
})
|
||||
|
||||
const markdownMinimist: EditorFeatureDescription = FillEditorComponentDefaults({
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
name: 'Minimal Markdown',
|
||||
@@ -112,5 +127,5 @@ export function GetDeprecatedFeatures(): FeatureDescription[] {
|
||||
availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser],
|
||||
})
|
||||
|
||||
return [bold, markdownBasic, markdownMinimist, markdownMath, filesafe]
|
||||
return [bold, markdownBasic, markdownMinimist, markdownMath, markdownAlt, filesafe]
|
||||
}
|
||||
|
||||
@@ -52,20 +52,6 @@ export function editors(): EditorFeatureDescription[] {
|
||||
availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser],
|
||||
})
|
||||
|
||||
const markdownAlt: EditorFeatureDescription = FillEditorComponentDefaults({
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
name: 'Markdown Alternative',
|
||||
identifier: FeatureIdentifier.MarkdownVisualEditor,
|
||||
note_type: NoteType.Markdown,
|
||||
file_type: 'md',
|
||||
permission_name: PermissionName.MarkdownVisualEditor,
|
||||
spellcheckControl: true,
|
||||
description:
|
||||
'A WYSIWYG-style Markdown editor that renders Markdown in preview-mode while you type without displaying any syntax.',
|
||||
index_path: 'build/index.html',
|
||||
availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser],
|
||||
})
|
||||
|
||||
const task: EditorFeatureDescription = FillEditorComponentDefaults({
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
name: 'Checklist',
|
||||
@@ -109,5 +95,5 @@ export function editors(): EditorFeatureDescription[] {
|
||||
availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser],
|
||||
})
|
||||
|
||||
return [code, plus, markdown, markdownAlt, task, tokenvault, spreadsheets]
|
||||
return [code, plus, markdown, task, tokenvault, spreadsheets]
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ describe('component model', () => {
|
||||
expect(component.noteType).toEqual(NoteType.Authentication)
|
||||
})
|
||||
|
||||
it('should return plain as noteType if no note type defined in package_info', () => {
|
||||
it('should return unknown as noteType if no note type defined in package_info', () => {
|
||||
const component = new SNComponent(
|
||||
new DecryptedPayload(
|
||||
{
|
||||
@@ -83,6 +83,6 @@ describe('component model', () => {
|
||||
),
|
||||
)
|
||||
|
||||
expect(component.noteType).toEqual(NoteType.Plain)
|
||||
expect(component.noteType).toEqual(NoteType.Unknown)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -180,7 +180,7 @@ export class SNComponent extends DecryptedItem<ComponentContent> implements Comp
|
||||
}
|
||||
|
||||
public get noteType(): NoteType {
|
||||
return this.package_info.note_type || NoteType.Plain
|
||||
return this.package_info.note_type || NoteType.Unknown
|
||||
}
|
||||
|
||||
public get isDeprecated(): boolean {
|
||||
|
||||
@@ -147,7 +147,7 @@ describe('featuresService', () => {
|
||||
|
||||
const manager = createManager(Environment.Desktop, Platform.MacDesktop)
|
||||
expect(
|
||||
manager.areRequestedPermissionsValid(nativeComponent(FeatureIdentifier.MarkdownVisualEditor), permissions),
|
||||
manager.areRequestedPermissionsValid(nativeComponent(FeatureIdentifier.MarkdownProEditor), permissions),
|
||||
).toEqual(true)
|
||||
})
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@ import { IconType } from '@standardnotes/models'
|
||||
|
||||
export function getIconAndTintForNoteType(noteType?: NoteType, subtle?: boolean): [IconType, number] {
|
||||
switch (noteType) {
|
||||
case undefined:
|
||||
case NoteType.Plain:
|
||||
return [PlainEditorMetadata.icon, PlainEditorMetadata.iconTintNumber]
|
||||
case NoteType.RichText:
|
||||
return ['rich-text', 1]
|
||||
case NoteType.Markdown:
|
||||
@@ -21,7 +24,8 @@ export function getIconAndTintForNoteType(noteType?: NoteType, subtle?: boolean)
|
||||
subtle ? (SuperEditorMetadata.subtleIcon as IconType) : SuperEditorMetadata.icon,
|
||||
SuperEditorMetadata.iconTintNumber,
|
||||
]
|
||||
case NoteType.Unknown:
|
||||
default:
|
||||
return [PlainEditorMetadata.icon, PlainEditorMetadata.iconTintNumber]
|
||||
return ['editor', PlainEditorMetadata.iconTintNumber]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user