ソースを参照

Separated two types of bold and italic autoformatting.

Szymon Kupś 9 年 前
コミット
aeffcda994
1 ファイル変更4 行追加2 行削除
  1. 4 2
      packages/ckeditor5-autoformat/src/autoformat.js

+ 4 - 2
packages/ckeditor5-autoformat/src/autoformat.js

@@ -81,7 +81,9 @@ export default class Autoformat extends Feature {
 	 * @private
 	 */
 	_addInlineAutoformats() {
-		new InlineAutoformatEngine( this.editor, /(\*\*|__)([^\*_]+?)(\*\*|__)$/g, 'bold' );
-		new InlineAutoformatEngine( this.editor, /(?:^|[^\*_])(\*|_)([^\*_]+?)(\*|_)$/g, 'italic' );
+		new InlineAutoformatEngine( this.editor, /(\*\*)([^\*]+?)(\*\*)$/g, 'bold' );
+		new InlineAutoformatEngine( this.editor, /(__)([^_]+?)(__)$/g, 'bold' );
+		new InlineAutoformatEngine( this.editor, /(?:^|[^\*])(\*)([^\*_]+?)(\*)$/g, 'italic' );
+		new InlineAutoformatEngine( this.editor, /(?:^|[^_])(_)([^_]+?)(_)$/g, 'italic' );
 	}
 }