|
|
@@ -79,12 +79,12 @@ export default class Autoformat extends Plugin {
|
|
|
_addListAutoformats() {
|
|
|
const commands = this.editor.commands;
|
|
|
|
|
|
- if ( commands.has( 'bulletedList' ) ) {
|
|
|
+ if ( commands.get( 'bulletedList' ) ) {
|
|
|
// eslint-disable-next-line no-new
|
|
|
new BlockAutoformatEngine( this.editor, /^[*-]\s$/, 'bulletedList' );
|
|
|
}
|
|
|
|
|
|
- if ( commands.has( 'numberedList' ) ) {
|
|
|
+ if ( commands.get( 'numberedList' ) ) {
|
|
|
// eslint-disable-next-line no-new
|
|
|
new BlockAutoformatEngine( this.editor, /^\d+[.|)]?\s$/, 'numberedList' );
|
|
|
}
|
|
|
@@ -105,14 +105,14 @@ export default class Autoformat extends Plugin {
|
|
|
_addBasicStylesAutoformats() {
|
|
|
const commands = this.editor.commands;
|
|
|
|
|
|
- if ( commands.has( 'bold' ) ) {
|
|
|
+ if ( commands.get( 'bold' ) ) {
|
|
|
/* eslint-disable no-new */
|
|
|
new InlineAutoformatEngine( this.editor, /(\*\*)([^*]+)(\*\*)$/g, 'bold' );
|
|
|
new InlineAutoformatEngine( this.editor, /(__)([^_]+)(__)$/g, 'bold' );
|
|
|
/* eslint-enable no-new */
|
|
|
}
|
|
|
|
|
|
- if ( commands.has( 'italic' ) ) {
|
|
|
+ if ( commands.get( 'italic' ) ) {
|
|
|
// The italic autoformatter cannot be triggered by the bold markers, so we need to check the
|
|
|
// text before the pattern (e.g. `(?:^|[^\*])`).
|
|
|
|
|
|
@@ -135,9 +135,7 @@ export default class Autoformat extends Plugin {
|
|
|
* @private
|
|
|
*/
|
|
|
_addHeadingAutoformats() {
|
|
|
- const commands = this.editor.commands;
|
|
|
-
|
|
|
- Array.from( commands.keys() )
|
|
|
+ Array.from( this.editor.commands.names() )
|
|
|
.filter( name => name.match( /^heading[1-6]$/ ) )
|
|
|
.forEach( commandName => {
|
|
|
const level = commandName[ 7 ];
|
|
|
@@ -160,7 +158,7 @@ export default class Autoformat extends Plugin {
|
|
|
* @private
|
|
|
*/
|
|
|
_addBlockQuoteAutoformats() {
|
|
|
- if ( this.editor.commands.has( 'blockQuote' ) ) {
|
|
|
+ if ( this.editor.commands.get( 'blockQuote' ) ) {
|
|
|
// eslint-disable-next-line no-new
|
|
|
new BlockAutoformatEngine( this.editor, /^>\s$/, 'blockQuote' );
|
|
|
}
|