Some checks failed
Lock Threads / action (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot EE docker images / merge (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot CE docker images / merge (push) Has been cancelled
Run Chatwoot CE spec / lint-backend (push) Has been cancelled
Run Chatwoot CE spec / lint-frontend (push) Has been cancelled
Run Chatwoot CE spec / frontend-tests (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (0, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (1, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (10, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (11, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (12, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (13, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (14, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (15, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (2, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (3, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (4, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (5, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (6, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (7, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (8, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (9, 16) (push) Has been cancelled
Run Linux nightly installer / nightly (push) Has been cancelled
- Add Logistics component with progress tracking - Add OrderDetail component for order information - Support data-driven steps and actions - Add blue color scale to widget SCSS - Fix node overflow and progress bar rendering issues - Add English translations for dashboard components Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
/**
|
|
* Detects support for emoji character sets.
|
|
*
|
|
* Based on the Modernizr emoji detection.
|
|
* https://github.com/Modernizr/Modernizr/blob/347ddb078116cee91b25b6e897e211b023f9dcb4/feature-detects/emoji.js
|
|
*
|
|
* @return {Boolean} true or false
|
|
* @example
|
|
*
|
|
* hasEmojiSupport()
|
|
* // => true|false
|
|
*/
|
|
export const hasEmojiSupport = () => {
|
|
const pixelRatio = window.devicePixelRatio || 1;
|
|
const offset = 12 * pixelRatio;
|
|
const node = document.createElement('canvas');
|
|
|
|
// canvastext support
|
|
if (
|
|
!node.getContext ||
|
|
!node.getContext('2d') ||
|
|
typeof node.getContext('2d').fillText !== 'function'
|
|
) {
|
|
return false;
|
|
}
|
|
|
|
const ctx = node.getContext('2d');
|
|
|
|
ctx.fillStyle = '#f00';
|
|
ctx.textBaseline = 'top';
|
|
ctx.font = '32px Arial';
|
|
ctx.fillText('\ud83d\udc28', 0, 0); // U+1F428 KOALA
|
|
return ctx.getImageData(offset, offset, 1, 1).data[0] !== 0;
|
|
};
|
|
|
|
export const removeEmoji = text => {
|
|
if (text) {
|
|
return text
|
|
.replace(
|
|
/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,
|
|
''
|
|
)
|
|
.replace(/\s+/g, ' ')
|
|
.trim();
|
|
}
|
|
return '';
|
|
};
|