@ckeditor/ckeditor5-utils
Advanced tools
Comparing version 32.0.0 to 33.0.0
{ | ||
"name": "@ckeditor/ckeditor5-utils", | ||
"version": "32.0.0", | ||
"version": "33.0.0", | ||
"description": "Miscellaneous utilities used by CKEditor 5.", | ||
@@ -17,6 +17,6 @@ "keywords": [ | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-build-classic": "^32.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^32.0.0", | ||
"@ckeditor/ckeditor5-core": "^32.0.0", | ||
"@ckeditor/ckeditor5-engine": "^32.0.0" | ||
"@ckeditor/ckeditor5-build-classic": "^33.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^33.0.0", | ||
"@ckeditor/ckeditor5-core": "^33.0.0", | ||
"@ckeditor/ckeditor5-engine": "^33.0.0" | ||
}, | ||
@@ -23,0 +23,0 @@ "engines": { |
@@ -13,3 +13,3 @@ /** | ||
/** | ||
* Checks if the object is a native DOM Comment node. | ||
* Checks whether the object is a native DOM Comment node. | ||
* | ||
@@ -16,0 +16,0 @@ * @param {*} obj |
@@ -11,3 +11,3 @@ /** | ||
/** | ||
* Checks if the element is visible to the user in DOM: | ||
* Checks whether the element is visible to the user in DOM: | ||
* | ||
@@ -14,0 +14,0 @@ * * connected to the root of the document, |
@@ -70,1 +70,38 @@ /** | ||
} | ||
const EMOJI_PATTERN = buildEmojiRegexp(); | ||
/** | ||
* Checks whether given offset in a string is inside multi-character emoji sequence. | ||
* | ||
* @param {String} string String to check. | ||
* @param {Number} offset Offset to check. | ||
* @returns {Boolean} | ||
*/ | ||
export function isInsideEmojiSequence( string, offset ) { | ||
const matches = String( string ).matchAll( EMOJI_PATTERN ); | ||
return Array.from( matches ).some( match => match.index < offset && offset < match.index + match[ 0 ].length ); | ||
} | ||
function buildEmojiRegexp() { | ||
const parts = [ | ||
// Emoji Tag Sequence (ETS) | ||
/\p{Emoji}[\u{E0020}-\u{E007E}]+\u{E007F}/u, | ||
// Emoji Keycap Sequence | ||
/\p{Emoji}\u{FE0F}?\u{20E3}/u, | ||
// Emoji Presentation Sequence | ||
/\p{Emoji}\u{FE0F}/u, | ||
// Single-Character Emoji / Emoji Modifier Sequence | ||
/(?=\p{General_Category=Other_Symbol})\p{Emoji}\p{Emoji_Modifier}*/u | ||
]; | ||
const flagSequence = /\p{Regional_Indicator}{2}/u.source; | ||
const emoji = '(?:' + parts.map( part => part.source ).join( '|' ) + ')'; | ||
const sequence = `${ flagSequence }|${ emoji }(?:\u{200D}${ emoji })*`; | ||
return new RegExp( sequence, 'ug' ); | ||
} |
@@ -14,3 +14,3 @@ /** | ||
const version = '32.0.0'; | ||
const version = '33.0.0'; | ||
@@ -17,0 +17,0 @@ export default version; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
264394
7034