mirror of
https://github.com/laurent22/joplin.git
synced 2024-11-27 08:21:03 +02:00
Docs: Update the Markdown editor plugin tutorial to reflect recent Joplin changes (#10830)
This commit is contained in:
parent
d2ae02d066
commit
1f45252fc6
@ -7,9 +7,7 @@ This guide demonstrates how to create a Markdown editor plugin. It expects you t
|
||||
|
||||
:::note
|
||||
|
||||
This guide describes how to create a plugin for Joplin's [CodeMirror 6](https://codemirror.net/)-based Markdown editor, which is still in beta. It must be enabled in settings > general.
|
||||
|
||||
Plugins for this editor may not work in Joplin 2.13 or earlier.
|
||||
This guide describes how to create a plugin for Joplin's [CodeMirror 6](https://codemirror.net/)-based Markdown editor. The plugin created in this guide should work on both mobile and desktop. However, on Joplin desktop before version 3.1, the beta editor will need to be enabled in settings > general.
|
||||
|
||||
:::
|
||||
|
||||
@ -414,7 +412,9 @@ import { Compartment } from '@codemirror/state';
|
||||
const highlightExtension = new Compartment();
|
||||
codeMirrorWrapper.addExtension(highlightExtension.of([]));
|
||||
|
||||
codeMirrorWrapper.defineExtension('myExtension__setHighlightActiveLine', (highlighted: boolean) => {
|
||||
// Registers a command with name "myExtension__setHighlightActiveLine" that can be
|
||||
// called from the main plugin script with joplin.commands.execute('editor.execCommand', ...).
|
||||
codeMirrorWrapper.registerCommand('myExtension__setHighlightActiveLine', (highlighted: boolean) => {
|
||||
const extension = highlighted ? [ highlightActiveLine() ] : [ ];
|
||||
codeMirrorWrapper.editor.dispatch({
|
||||
effects: [ highlightExtension.reconfigure(extension) ],
|
||||
|
Loading…
Reference in New Issue
Block a user