am-editor-002/docs/plugin/plugin-bold.md

1.0 KiB

@aomao/plugin-bold

Bold style plugin

Installation

$ yarn add @aomao/plugin-bold

Add to engine

import Engine, {EngineInterface} from'@aomao/engine';
import Bold from'@aomao/plugin-bold';

new Engine(...,{ plugins:[Bold] })

Optional

hot key

The default shortcut key is mod+b, and multiple shortcut keys are passed in as an array

//hot key,
hotkey?: string | Array<string>;

//Use configuration
new Engine(...,{
    config:{
        "bold":{
            //Modify shortcut keys
            hotkey: "shortcut key"
        }
    }
 })

Markdown

Support markdown by default, pass in false to close

The markdown syntax of the Bold plugin is **

markdown?: boolean;//enabled by default, false off
//Use configuration
new Engine(...,{
    config:{
        "bold":{
            //Close markdown
            markdown:false
        }
    }
 })

Command

engine.command.execute('bold');
//Use command to execute query current status, return boolean | undefined
engine.command.queryState('bold');