8
0
Просмотр исходного кода

Splitting 'image url regex' into several lines.

Paweł Kwaśnik 5 лет назад
Родитель
Сommit
5c02845d17
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      packages/ckeditor5-image/src/autoimage.js

+ 4 - 2
packages/ckeditor5-image/src/autoimage.js

@@ -16,8 +16,10 @@ import global from '@ckeditor/ckeditor5-utils/src/dom/global';
 import { insertImage } from './image/utils';
 
 // implements pattern: http(s)://(www.)example.com/path/to/resource.ext?query=params&maybe=too
-const IMAGE_URL_REGEXP =
-	/^(http(s)?:\/\/)?[\w-]+(\.[\w-]+)+[\w._~:/?#[\]@!$&'()*+,;=%-]+\.(jpg|jpeg|png|gif|ico|JPG|JPEG|PNG|GIF|ICO)\??[\w._~:/#[\]@!$&'()*+,;=%-]*$/;
+const IMAGE_URL_REGEXP = new RegExp(''
+		+ /^(http(s)?:\/\/)?[\w-]+(\.[\w-]+)+[\w._~:/?#[\]@!$&'()*+,;=%-]+/.source
+		+ /\.(jpg|jpeg|png|gif|ico|JPG|JPEG|PNG|GIF|ICO)\??[\w._~:/#[\]@!$&'()*+,;=%-]*$/.source
+	);
 
 /**
  * The auto-image plugin. It recognizes image links in the pasted content and embeds