diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/CodeMirror.tsx b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/CodeMirror.tsx index e42f51c09..d5fb164ea 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/CodeMirror.tsx +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/CodeMirror.tsx @@ -621,7 +621,7 @@ function CodeMirror(props: NoteBodyEditorProps, ref: any) { contentMaxWidth: props.contentMaxWidth, mapsToLine: true, // Always using useCustomPdfViewer for now, we can add a new setting for it in future if we need to. - useCustomPdfViewer: true, + useCustomPdfViewer: props.useCustomPdfViewer, noteId: props.noteId, vendorDir: bridge().vendorDir(), })); diff --git a/packages/app-desktop/gui/NoteEditor/NoteEditor.tsx b/packages/app-desktop/gui/NoteEditor/NoteEditor.tsx index 40c28c06e..51988a758 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteEditor.tsx +++ b/packages/app-desktop/gui/NoteEditor/NoteEditor.tsx @@ -424,6 +424,7 @@ function NoteEditor(props: NoteEditorProps) { fontSize: Setting.value('style.editor.fontSize'), contentMaxWidth: props.contentMaxWidth, isSafeMode: props.isSafeMode, + useCustomPdfViewer: props.useCustomPdfViewer, // We need it to identify the context for which media is rendered. // It is currently used to remember pdf scroll position for each attacments of each note uniquely. noteId: props.noteId, @@ -630,6 +631,7 @@ const mapStateToProps = (state: AppState) => { ], whenClauseContext)[0], contentMaxWidth: state.settings['style.editor.contentMaxWidth'], isSafeMode: state.settings.isSafeMode, + useCustomPdfViewer: state.settings.useCustomPdfViewer, }; }; diff --git a/packages/app-desktop/gui/NoteEditor/utils/types.ts b/packages/app-desktop/gui/NoteEditor/utils/types.ts index 3682029a9..ced6549c5 100644 --- a/packages/app-desktop/gui/NoteEditor/utils/types.ts +++ b/packages/app-desktop/gui/NoteEditor/utils/types.ts @@ -43,6 +43,7 @@ export interface NoteEditorProps { richTextBannerDismissed: boolean; contentMaxWidth: number; isSafeMode: boolean; + useCustomPdfViewer: boolean; } export interface NoteBodyEditorProps { @@ -76,6 +77,7 @@ export interface NoteBodyEditorProps { contentMaxWidth: number; isSafeMode: boolean; noteId: string; + useCustomPdfViewer: boolean; } export interface FormNote { diff --git a/packages/lib/models/Setting.ts b/packages/lib/models/Setting.ts index cdeb632e8..42c829ff0 100644 --- a/packages/lib/models/Setting.ts +++ b/packages/lib/models/Setting.ts @@ -1382,6 +1382,18 @@ class Setting extends BaseModel { }; } }, + useCustomPdfViewer: { + value: false, + type: SettingItemType.Bool, + public: true, + advanced: true, + appTypes: [AppType.Desktop], + label: () => 'Use custom PDF viewer (Beta)', + description: () => 'The custom PDF viewer remembers the last page that was viewed, however it has some technical issues.', + storage: SettingStorage.File, + isGlobal: true, + }, + 'editor.keyboardMode': { value: '', type: SettingItemType.String,