feat(labs): super editor (#2001)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
import { FeatureIdentifier } from './../Feature/FeatureIdentifier'
|
||||
|
||||
type ThirdPartyIdentifier = string
|
||||
|
||||
export type EditorIdentifier = FeatureIdentifier | ThirdPartyIdentifier
|
||||
17
packages/features/src/Domain/Component/NoteType.spec.ts
Normal file
17
packages/features/src/Domain/Component/NoteType.spec.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { FeatureIdentifier } from '@standardnotes/features'
|
||||
import { noteTypeForEditorIdentifier, NoteType } from './NoteType'
|
||||
|
||||
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)
|
||||
expect(noteTypeForEditorIdentifier(FeatureIdentifier.SheetsEditor)).toEqual(NoteType.Spreadsheet)
|
||||
expect(noteTypeForEditorIdentifier(FeatureIdentifier.TaskEditor)).toEqual(NoteType.Task)
|
||||
expect(noteTypeForEditorIdentifier(FeatureIdentifier.TokenVaultEditor)).toEqual(NoteType.Authentication)
|
||||
expect(noteTypeForEditorIdentifier('org.third.party')).toEqual(NoteType.Unknown)
|
||||
})
|
||||
})
|
||||
@@ -1,3 +1,7 @@
|
||||
import { FindNativeFeature } from '../Feature/Features'
|
||||
import { FeatureIdentifier } from './../Feature/FeatureIdentifier'
|
||||
import { EditorIdentifier } from './EditorIdentifier'
|
||||
|
||||
export enum NoteType {
|
||||
Authentication = 'authentication',
|
||||
Code = 'code',
|
||||
@@ -6,6 +10,21 @@ export enum NoteType {
|
||||
Spreadsheet = 'spreadsheet',
|
||||
Task = 'task',
|
||||
Plain = 'plain-text',
|
||||
Blocks = 'blocks',
|
||||
Super = 'super',
|
||||
Unknown = 'unknown',
|
||||
}
|
||||
|
||||
export function noteTypeForEditorIdentifier(identifier: EditorIdentifier): NoteType {
|
||||
if (identifier === FeatureIdentifier.PlainEditor) {
|
||||
return NoteType.Plain
|
||||
} else if (identifier === FeatureIdentifier.SuperEditor) {
|
||||
return NoteType.Super
|
||||
}
|
||||
|
||||
const feature = FindNativeFeature(identifier as FeatureIdentifier)
|
||||
if (feature && feature.note_type) {
|
||||
return feature.note_type
|
||||
}
|
||||
|
||||
return NoteType.Unknown
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ type RoleFields = {
|
||||
|
||||
/** Statically populated. Non-influencing; used as a reference by other static consumers (such as email service) */
|
||||
availableInSubscriptions: SubscriptionName[]
|
||||
availableInRoles?: RoleName[]
|
||||
}
|
||||
|
||||
export type BaseFeatureDescription = RoleFields & {
|
||||
|
||||
@@ -6,7 +6,6 @@ export enum FeatureIdentifier {
|
||||
DailyGDriveBackup = 'org.standardnotes.daily-gdrive-backup',
|
||||
DailyOneDriveBackup = 'org.standardnotes.daily-onedrive-backup',
|
||||
Files = 'org.standardnotes.files',
|
||||
FilesBeta = 'org.standardnotes.files-beta',
|
||||
FilesLowStorageTier = 'org.standardnotes.files-low-storage-tier',
|
||||
FilesMaximumStorageTier = 'org.standardnotes.files-max-storage-tier',
|
||||
ListedCustomDomain = 'org.standardnotes.listed-custom-domain',
|
||||
@@ -28,10 +27,12 @@ export enum FeatureIdentifier {
|
||||
SolarizedDarkTheme = 'org.standardnotes.theme-solarized-dark',
|
||||
TitaniumTheme = 'org.standardnotes.theme-titanium',
|
||||
|
||||
PlainEditor = 'com.standardnotes.plain-text',
|
||||
SuperEditor = 'com.standardnotes.super-editor',
|
||||
|
||||
CodeEditor = 'org.standardnotes.code-editor',
|
||||
MarkdownProEditor = 'org.standardnotes.advanced-markdown-editor',
|
||||
MarkdownVisualEditor = 'org.standardnotes.markdown-visual-editor',
|
||||
PlainTextEditor = 'org.standardnotes.plain-text-editor',
|
||||
PlusEditor = 'org.standardnotes.plus-editor',
|
||||
SheetsEditor = 'org.standardnotes.standard-sheets',
|
||||
TaskEditor = 'org.standardnotes.simple-task-editor',
|
||||
@@ -50,4 +51,4 @@ export enum FeatureIdentifier {
|
||||
*/
|
||||
export const LegacyFileSafeIdentifier = 'org.standardnotes.legacy.file-safe'
|
||||
|
||||
export const ExperimentalFeatures = []
|
||||
export const ExperimentalFeatures = [FeatureIdentifier.SuperEditor]
|
||||
|
||||
@@ -21,18 +21,11 @@ export function clientFeatures(): ClientFeatureDescription[] {
|
||||
},
|
||||
{
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
name: 'Encrypted files (coming soon)',
|
||||
name: 'Encrypted files',
|
||||
identifier: FeatureIdentifier.Files,
|
||||
permission_name: PermissionName.Files,
|
||||
description: '',
|
||||
},
|
||||
{
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
name: 'Encrypted files beta',
|
||||
identifier: FeatureIdentifier.FilesBeta,
|
||||
permission_name: PermissionName.FilesBeta,
|
||||
description: '',
|
||||
},
|
||||
{
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
name: 'Focus Mode',
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
import { FeatureIdentifier } from './../Feature/FeatureIdentifier'
|
||||
import { RoleName, SubscriptionName } from '@standardnotes/common'
|
||||
import { FeatureDescription } from '../Feature/FeatureDescription'
|
||||
import { PermissionName } from '../Permission/PermissionName'
|
||||
|
||||
export function experimentalFeatures(): FeatureDescription[] {
|
||||
return []
|
||||
const superEditor: FeatureDescription = {
|
||||
name: 'Super Notes',
|
||||
identifier: FeatureIdentifier.SuperEditor,
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
permission_name: PermissionName.SuperEditor,
|
||||
description:
|
||||
'A new way to edit notes. Type / to bring up the block selection menu, or @ to embed images or link other tags and notes. Type - then space to start a list, or [] then space to start a checklist. Drag and drop an image or file to embed it in your note.',
|
||||
availableInRoles: [RoleName.PlusUser, RoleName.ProUser],
|
||||
}
|
||||
|
||||
return [superEditor]
|
||||
}
|
||||
|
||||
@@ -39,4 +39,5 @@ export enum PermissionName {
|
||||
TokenVaultEditor = 'editor:token-vault',
|
||||
TwoFactorAuth = 'server:two-factor-auth',
|
||||
SubscriptionSharing = 'server:subscription-sharing',
|
||||
SuperEditor = 'editor:super-editor',
|
||||
}
|
||||
|
||||
@@ -11,3 +11,4 @@ export * from './Component/ComponentFlag'
|
||||
export * from './Component/ComponentPermission'
|
||||
export * from './Component/NoteType'
|
||||
export * from './Component/ThemeDockIcon'
|
||||
export * from './Component/EditorIdentifier'
|
||||
|
||||
Reference in New Issue
Block a user