浏览代码

Fix mailto: link creation in auto-link feature.

Maciej Gołaszewski 5 年之前
父节点
当前提交
2dcb5b258b
共有 2 个文件被更改,包括 4 次插入4 次删除
  1. 1 1
      packages/ckeditor5-link/src/autolink.js
  2. 3 3
      packages/ckeditor5-link/tests/autolink.js

+ 1 - 1
packages/ckeditor5-link/src/autolink.js

@@ -221,7 +221,7 @@ export default class AutoLink extends Plugin {
 
 		// Enqueue change to make undo step.
 		model.enqueueChange( writer => {
-			const linkHrefValue = isEmail( url ) ? `mailto://${ url }` : url;
+			const linkHrefValue = isEmail( url ) ? `mailto:${ url }` : url;
 
 			writer.setAttribute( 'linkHref', linkHrefValue, range );
 		} );

+ 3 - 3
packages/ckeditor5-link/tests/autolink.js

@@ -151,17 +151,17 @@ describe( 'AutoLink', () => {
 
 			expect( getData( model ) ).to.equal(
 				'<paragraph>' +
-					'<$text linkHref="https://www.cksource.com">https://www.cksource.com</$text>' +
+				'<$text linkHref="https://www.cksource.com">https://www.cksource.com</$text>' +
 				'</paragraph>' +
 				'<paragraph>[]</paragraph>'
 			);
 		} );
 
-		it( 'adds "mailto://" to link of detected email addresses', () => {
+		it( 'adds "mailto:" to link of detected email addresses', () => {
 			simulateTyping( 'newsletter@cksource.com ' );
 
 			expect( getData( model ) ).to.equal(
-				'<paragraph><$text linkHref="mailto://newsletter@cksource.com">newsletter@cksource.com</$text> []</paragraph>'
+				'<paragraph><$text linkHref="mailto:newsletter@cksource.com">newsletter@cksource.com</$text> []</paragraph>'
 			);
 		} );