瀏覽代碼

Fix isLength and isColor regexps.

Maciej Gołaszewski 6 年之前
父節點
當前提交
c2180d3026
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      packages/ckeditor5-engine/src/view/styles/utils.js

+ 2 - 2
packages/ckeditor5-engine/src/view/styles/utils.js

@@ -8,7 +8,7 @@
  */
 
 export function isColor( string ) {
-	return /(^[#0-9A-Fa-f]{3,9}$|rgba?\(|hsla?\(|^currentColor$)/.test( string );
+	return /^([#0-9A-Fa-f]{3,9}$|rgba?\(|hsla?\(|^currentColor|0)$/.test( string );
 }
 
 export function isLineStyle( string ) {
@@ -16,7 +16,7 @@ export function isLineStyle( string ) {
 }
 
 export function isLength( string ) {
-	return /(^[+-]?[0-9]*[.]?[0-9]+([a-z]+|%)$|0)/.test( string );
+	return /^([+-]?[0-9]*[.]?[0-9]+([a-z]+|%)|0)$/.test( string );
 }
 
 export function isRepeat( string ) {