diff --git a/package.json b/package.json index 732203e..13ff9bd 100755 --- a/package.json +++ b/package.json @@ -71,6 +71,11 @@ "markdown-editor.customCss": { "type": "string", "default": "" + }, + "markdown-editor.autoEnterPluginViewOnMarkdownOpen": { + "type": "boolean", + "default": false, + "description": "Automatically enter the plugin view when opening a markdown file." } } }, diff --git a/src/extension.ts b/src/extension.ts index f1941b4..fbd5276 100755 --- a/src/extension.ts +++ b/src/extension.ts @@ -21,6 +21,16 @@ export function activate(context: vscode.ExtensionContext) { ) ) + // Listen for markdown file open events + vscode.workspace.onDidOpenTextDocument((doc) => { + if (doc.languageId === 'markdown' && doc.uri.scheme === 'file') { + const config = vscode.workspace.getConfiguration('markdown-editor') + if (config.get('autoEnterPluginViewOnMarkdownOpen')) { + EditorPanel.createOrShow(context, doc.uri) + } + } + }) + context.globalState.setKeysForSync([KeyVditorOptions]) }