Skip to content

Commit

Permalink
Used utils functions to check numerical value, unified domain matcher…
Browse files Browse the repository at this point in the history
…, fixed media embed matcher
  • Loading branch information
psmyrek committed Mar 16, 2021
1 parent 92a18b0 commit c4f3313
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion packages/ckeditor5-font/src/fontsize/fontsizeediting.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import { Plugin } from 'ckeditor5/src/core';
import { CKEditorError } from 'ckeditor5/src/utils';
import { isLength, isPercentage } from 'ckeditor5/src/engine';

import FontSizeCommand from './fontsizecommand';
import { normalizeOptions } from './utils';
Expand Down Expand Up @@ -109,7 +110,9 @@ export default class FontSizeEditing extends Plugin {
const editor = this.editor;

// If `fontSize.supportAllValues=true`, we do not allow to use named presets in the plugin's configuration.
const presets = definition.model.values.filter( value => !String( value ).match( /[\d.][\w%]+/ ) );
const presets = definition.model.values.filter( value => {
return !isLength( String( value ) ) && !isPercentage( String( value ) );
} );

if ( presets.length ) {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/ckeditor5-font/tests/fontsize/fontsizeediting.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe( 'FontSizeEditing', () => {
'10px',
12,
{
model: 14,
model: '14px',
title: '14px'
}
]
Expand Down
2 changes: 1 addition & 1 deletion packages/ckeditor5-link/src/autolink.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const URL_REG_EXP = new RegExp(
// Do not allow `www.foo` - see https://github.com/ckeditor/ckeditor5/issues/8050.
'((?!www\\.)|(www\\.))' +
// Host & domain names.
'(?![-_])(?:[-\\w\\u00a1-\\uffff]{0,63}[^-_]\\.)+' +
'(?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}[a-z0-9\\u00a1-\\uffff]\\.)+' +
// TLD identifier name.
'(?:[a-z\\u00a1-\\uffff]{2,})' +
')' +
Expand Down
2 changes: 1 addition & 1 deletion packages/ckeditor5-media-embed/src/automediaembed.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { global } from 'ckeditor5/src/utils';
import MediaEmbedEditing from './mediaembedediting';
import { insertMedia } from './utils';

const URL_REGEXP = /^(?:http(s)?:\/\/)?[\w.-][\w-.~:/?#[\]@!$&'()*+,;=%]+$/;
const URL_REGEXP = /^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/;

/**
* The auto-media embed plugin. It recognizes media links in the pasted content and embeds
Expand Down

0 comments on commit c4f3313

Please sign in to comment.