/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
(function() {
'use strict';
/**
* sgCkeditor - A component for the CKEditor v4
* Based on https://github.com/jziggas/ng-ck/.
* @memberof SOGo.Common
* @example:
*/
function sgCkeditorConfigProvider() {
// Default plugins that have successfully passed through Angular's $sanitize service
var events = [
'activeEnterModeChange',
'activeFilterChange',
'afterCommandExec',
'afterInsertHtml',
'afterPaste',
'afterPasteFromWord',
'afterSetData',
'afterUndoImage',
'ariaEditorHelpLabel',
'autogrow',
'beforeCommandExec',
'beforeDestroy',
'beforeGetData',
'beforeModeUnload',
'beforeSetMode',
'beforeUndoImage',
'blur',
'change',
'configLoaded',
'contentDirLoaded',
'contentDom',
'contentDomInvalidated',
'contentDomUnload',
'customConfigLoaded',
'dataFiltered',
'dataReady',
'destroy',
'dialogHide',
'dialogShow',
'dirChanged',
'doubleclick',
'dragend',
'dragstart',
'drop',
'elementsPathUpdate',
'fileUploadRequest',
'fileUploadResponse',
'floatingSpaceLayout',
'focus',
'getData',
'getSnapshot',
'insertElement',
'insertHtml',
'insertText',
'instanceReady',
'key',
'langLoaded',
'loadSnapshot',
'loaded',
'lockSnapshot',
'maximize',
'menuShow',
'mode',
'notificationHide',
'notificationShow',
'notificationUpdate',
'paste',
'pasteFromWord',
'pluginsLoaded',
'readOnly',
'removeFormatCleanup',
'required',
'resize',
'save',
'saveSnapshot',
'selectionChange',
'setData',
'stylesSet',
'template',
'toDataFormat',
'toHtml',
'unlockSnapshot',
'updateSnapshot',
'widgetDefinition'
];
var config = {};//angular.copy(defaultConfiguration);
this.$get = function () {
return {
config: config,
events: events
}
};
}
var sgCkeditorComponent = {
controllerAs: 'vm',
require: {
ngModelCtrl: 'ngModel'
},
bindings: {
checkTextLength: '',
config: '',
maxLength: '',
minLength: '',
ckMargin: '@?',
onActiveEnterModeChange: '&?',
onActiveFilterChange: '&?',
onAfterCommandExec: '&?',
onAfterInsertHtml: '&?',
onAfterPaste: '&?',
onAfterPasteFromWord: '&?',
onAfterSetData: '&?',
onAfterUndoImage: '&?',
onAriaEditorHelpLabel: '&?',
onAutogrow: '&?',
onBeforeCommandExec: '&?',
onBeforeDestroy: '&?',
onBeforeGetData: '&?',
onBeforeModeUnload: '&?',
onBeforeSetMode: '&?',
onBeforeUndoImage: '&?',
onBlur: '&?',
onChange: '&?',
onConfigLoaded: '&?',
onContentChanged: '&?', // Not CKEditor API
onContentDirLoaded: '&?',
onContentDom: '&?',
onContentDomInvalidated: '&?',
onContentDomUnload: '&?',
onCustomConfigLoaded: '&?',
onDataFiltered: '&?',
onDataReady: '&?',
onDestroy: '&?', // Not sure if this works because of the cleanup done in $onDestroy. Needs testing.
onDialogHide: '&?',
onDialogShow: '&?',
onDirChanged: '&?',
onDoubleclick: '&?',
onDragend: '&?',
onDragstart: '&?',
onDrop: '&?',
onElementsPathUpdate: '&?',
onFileUploadRequest: '&?',
onFileUploadResponse: '&?',
onFloatingSpaceLayout: '&?',
onFocus: '&?',
onGetData: '&?',
onGetSnapshot: '&?',
onInsertElement: '&?',
onInsertHtml: '&?',
onInsertText: '&?',
onInstanceReady: '&?',
onKey: '&?',
onLangLoaded: '&?',
onLoadSnapshot: '&?',
onLoaded: '&?',
onLockSnapshot: '&?',
onMaximize: '&?',
onMenuShow: '&?',
onMode: '&?',
onNotificationHide: '&?',
onNotificationShow: '&?',
onNotificationUpdate: '&?',
onPaste: '&?',
onPasteFromWord: '&?',
onPluginsLoaded: '&?',
onReadOnly: '&?',
onRemoveFormatCleanup: '&?',
onRequired: '&?',
onResize: '&?',
onSave: '&?',
onSaveSnapshot: '&?',
onSelectionChange: '&?',
onSetData: '&?',
onStylesSet: '&?',
onTemplate: '&?',
onToDataFormat: '&?',
onToHtml: '&?',
onUnlockSnapshot: '&?',
onUpdateSnapshot: '&?',
onWidgetDefinition: '&?',
placeholder: '',
readOnly: '',
required: ''
},
template: '',
controller: sgCkeditorController
};
var emojis = [
{ title: 'Grinning Face', character: '๐' }, { title: 'Grinning Face with Big Eyes', character: '๐' }, { title: 'Grinning Face with Smiling Eyes', character: '๐' }, { title: 'Beaming Face with Smiling Eyes', character: '๐' }, { title: 'Grinning Squinting Face', character: '๐' }, { title: 'Grinning Face with Sweat', character: '๐
' }, { title: 'Rolling on the Floor Laughing', character: '๐คฃ' }, { title: 'Face with Tears of Joy', character: '๐' }, { title: 'Slightly Smiling Face', character: '๐' }, { title: 'Upside-Down Face', character: '๐' }, { title: 'Winking Face', character: '๐' }, { title: 'Smiling Face with Smiling Eyes', character: '๐' }, { title: 'Smiling Face with Halo', character: '๐' }, { title: 'Smiling Face with Hearts', character: '๐ฅฐ' }, { title: 'Smiling Face with Heart-Eyes', character: '๐' }, { title: 'Star-Struck', character: '๐คฉ' }, { title: 'Face Blowing a Kiss', character: '๐' }, { title: 'Kissing Face', character: '๐' }, { title: 'Smiling Face', character: 'โบ๏ธ' }, { title: 'Kissing Face with Closed Eyes', character: '๐' }, { title: 'Kissing Face with Smiling Eyes', character: '๐' }, { title: 'Smiling Face with Tear', character: '๐ฅฒ' }, { title: 'Face Savoring Food', character: '๐' }, { title: 'Face with Tongue', character: '๐' }, { title: 'Winking Face with Tongue', character: '๐' }, { title: 'Zany Face', character: '๐คช' }, { title: 'Squinting Face with Tongue', character: '๐' }, { title: 'Money-Mouth Face', character: '๐ค' }, { title: 'Hugging Face', character: '๐ค' }, { title: 'Face with Hand Over Mouth', character: '๐คญ' }, { title: 'Shushing Face', character: '๐คซ' }, { title: 'Thinking Face', character: '๐ค' }, { title: 'Zipper-Mouth Face', character: '๐ค' }, { title: 'Face with Raised Eyebrow', character: '๐คจ' }, { title: 'Neutral Face', character: '๐' }, { title: 'Expressionless Face', character: '๐' }, { title: 'Face Without Mouth', character: '๐ถ' }, { title: 'Smirking Face', character: '๐' }, { title: 'Unamused Face', character: '๐' }, { title: 'Face with Rolling Eyes', character: '๐' }, { title: 'Grimacing Face', character: '๐ฌ' }, { title: 'Lying Face', character: '๐คฅ' }, { title: 'Relieved Face', character: '๐' }, { title: 'Pensive Face', character: '๐' }, { title: 'Sleepy Face', character: '๐ช' }, { title: 'Drooling Face', character: '๐คค' }, { title: 'Sleeping Face', character: '๐ด' }, { title: 'Face with Medical Mask', character: '๐ท' }, { title: 'Face with Thermometer', character: '๐ค' }, { title: 'Face with Head-Bandage', character: '๐ค' }, { title: 'Nauseated Face', character: '๐คข' }, { title: 'Face Vomiting', character: '๐คฎ' }, { title: 'Sneezing Face', character: '๐คง' }, { title: 'Hot Face', character: '๐ฅต' }, { title: 'Cold Face', character: '๐ฅถ' }, { title: 'Woozy Face', character: '๐ฅด' }, { title: 'Dizzy Face', character: '๐ต' }, { title: 'Exploding Head', character: '๐คฏ' }, { title: 'Cowboy Hat Face', character: '๐ค ' }, { title: 'Partying Face', character: '๐ฅณ' }, { title: 'Disguised Face', character: '๐ฅธ' }, { title: 'Smiling Face with Sunglasses', character: '๐' }, { title: 'Nerd Face', character: '๐ค' }, { title: 'Face with Monocle', character: '๐ง' }, { title: 'Confused Face', character: '๐' }, { title: 'Worried Face', character: '๐' }, { title: 'Slightly Frowning Face', character: '๐' }, { title: 'Frowning Face', character: 'โน๏ธ' }, { title: 'Face with Open Mouth', character: '๐ฎ' }, { title: 'Hushed Face', character: '๐ฏ' }, { title: 'Astonished Face', character: '๐ฒ' }, { title: 'Flushed Face', character: '๐ณ' }, { title: 'Pleading Face', character: '๐ฅบ' }, { title: 'Frowning Face with Open Mouth', character: '๐ฆ' }, { title: 'Anguished Face', character: '๐ง' }, { title: 'Fearful Face', character: '๐จ' }, { title: 'Anxious Face with Sweat', character: '๐ฐ' }, { title: 'Sad but Relieved Face', character: '๐ฅ' }, { title: 'Crying Face', character: '๐ข' }, { title: 'Loudly Crying Face', character: '๐ญ' }, { title: 'Face Screaming in Fear', character: '๐ฑ' }, { title: 'Confounded Face', character: '๐' }, { title: 'Persevering Face', character: '๐ฃ' }, { title: 'Disappointed Face', character: '๐' }, { title: 'Downcast Face with Sweat', character: '๐' }, { title: 'Weary Face', character: '๐ฉ' }, { title: 'Tired Face', character: '๐ซ' }, { title: 'Yawning Face', character: '๐ฅฑ' }, { title: 'Face with Steam From Nose', character: '๐ค' }, { title: 'Pouting Face', character: '๐ก' }, { title: 'Angry Face', character: '๐ ' }, { title: 'Face with Symbols on Mouth', character: '๐คฌ' }, { title: 'Smiling Face with Horns', character: '๐' }, { title: 'Angry Face with Horns', character: '๐ฟ' }, { title: 'Skull', character: '๐' }, { title: 'Skull and Crossbones', character: 'โ ๏ธ' }, { title: 'Pile of Poo', character: '๐ฉ' }, { title: 'Clown Face', character: '๐คก' }, { title: 'Ogre', character: '๐น' }, { title: 'Goblin', character: '๐บ' }, { title: 'Ghost', character: '๐ป' }, { title: 'Alien', character: '๐ฝ' }, { title: 'Alien Monster', character: '๐พ' }, { title: 'Robot', character: '๐ค' }, { title: 'Grinning Cat', character: '๐บ' }, { title: 'Grinning Cat with Smiling Eyes', character: '๐ธ' }, { title: 'Cat with Tears of Joy', character: '๐น' }, { title: 'Smiling Cat with Heart-Eyes', character: '๐ป' }, { title: 'Cat with Wry Smile', character: '๐ผ' }, { title: 'Kissing Cat', character: '๐ฝ' }, { title: 'Weary Cat', character: '๐' }, { title: 'Crying Cat', character: '๐ฟ' }, { title: 'Pouting Cat', character: '๐พ' }, { title: 'Kiss Mark', character: '๐' }, { title: 'Waving Hand', character: '๐' }, { title: 'Raised Back of Hand', character: '๐ค' }, { title: 'Hand with Fingers Splayed', character: '๐๏ธ' }, { title: 'Raised Hand', character: 'โ' }, { title: 'Vulcan Salute', character: '๐' }, { title: 'OK Hand', character: '๐' }, { title: 'Pinched Fingers', character: '๐ค' }, { title: 'Pinching Hand', character: '๐ค' }, { title: 'Victory Hand', character: 'โ๏ธ' }, { title: 'Crossed Fingers', character: '๐ค' }, { title: 'Love-You Gesture', character: '๐ค' }, { title: 'Sign of the Horns', character: '๐ค' }, { title: 'Call Me Hand', character: '๐ค' }, { title: 'Backhand Index Pointing Left', character: '๐' }, { title: 'Backhand Index Pointing Right', character: '๐' }, { title: 'Backhand Index Pointing Up', character: '๐' }, { title: 'Middle Finger', character: '๐' }, { title: 'Backhand Index Pointing Down', character: '๐' }, { title: 'Index Pointing Up', character: 'โ๏ธ' }, { title: 'Thumbs Up', character: '๐' }, { title: 'Thumbs Down', character: '๐' }, { title: 'Raised Fist', character: 'โ' }, { title: 'Oncoming Fist', character: '๐' }, { title: 'Left-Facing Fist', character: '๐ค' }, { title: 'Right-Facing Fist', character: '๐ค' }, { title: 'Clapping Hands', character: '๐' }, { title: 'Raising Hands', character: '๐' }, { title: 'Open Hands', character: '๐' }, { title: 'Palms Up Together', character: '๐คฒ' }, { title: 'Handshake', character: '๐ค' }, { title: 'Folded Hands', character: '๐' }, { title: 'Writing Hand', character: 'โ๏ธ' }, { title: 'Nail Polish', character: '๐
' }, { title: 'Selfie', character: '๐คณ' }, { title: 'Flexed Biceps', character: '๐ช' }, { title: 'Mechanical Arm', character: '๐ฆพ' }, { title: 'Mechanical Leg', character: '๐ฆฟ' }, { title: 'Leg', character: '๐ฆต' }, { title: 'Foot', character: '๐ฆถ' }, { title: 'Ear', character: '๐' }, { title: 'Ear with Hearing Aid', character: '๐ฆป' }, { title: 'Nose', character: '๐' }, { title: 'Brain', character: '๐ง ' }, { title: 'Anatomical Heart', character: '๐ซ' }, { title: 'Lungs', character: '๐ซ' }, { title: 'Tooth', character: '๐ฆท' }, { title: 'Bone', character: '๐ฆด' }, { title: 'Eyes', character: '๐' }, { title: 'Eye', character: '๐๏ธ' }, { title: 'Tongue', character: '๐
' }, { title: 'Mouth', character: '๐' }, { title: 'Baby', character: '๐ถ' }, { title: 'Child', character: '๐ง' }, { title: 'Boy', character: '๐ฆ' }, { title: 'Girl', character: '๐ง' }, { title: 'Person', character: '๐ง' }, { title: 'Person: Blond Hair', character: '๐ฑ' }, { title: 'Man', character: '๐จ' }, { title: 'Person: Beard', character: '๐ง' }, { title: 'Man: Red Hair', character: '๐จโ๐ฆฐ' }, { title: 'Man: Curly Hair', character: '๐จโ๐ฆฑ' }, { title: 'Man: White Hair', character: '๐จโ๐ฆณ' }, { title: 'Man: Bald', character: '๐จโ๐ฆฒ' }, { title: 'Woman', character: '๐ฉ' }, { title: 'Woman: Red Hair', character: '๐ฉโ๐ฆฐ' }, { title: 'Person: Red Hair', character: '๐งโ๐ฆฐ' }, { title: 'Woman: Curly Hair', character: '๐ฉโ๐ฆฑ' }, { title: 'Person: Curly Hair', character: '๐งโ๐ฆฑ' }, { title: 'Woman: White Hair', character: '๐ฉโ๐ฆณ' }, { title: 'Person: White Hair', character: '๐งโ๐ฆณ' }, { title: 'Woman: Bald', character: '๐ฉโ๐ฆฒ' }, { title: 'Person: Bald', character: '๐งโ๐ฆฒ' }, { title: 'Woman: Blond Hair', character: '๐ฑโโ๏ธ' }, { title: 'Man: Blond Hair', character: '๐ฑโโ๏ธ' }, { title: 'Older Person', character: '๐ง' }, { title: 'Old Man', character: '๐ด' }, { title: 'Old Woman', character: '๐ต' }, { title: 'Person Frowning', character: '๐' }, { title: 'Man Frowning', character: '๐โโ๏ธ' }, { title: 'Woman Frowning', character: '๐โโ๏ธ' }, { title: 'Person Pouting', character: '๐' }, { title: 'Man Pouting', character: '๐โโ๏ธ' }, { title: 'Woman Pouting', character: '๐โโ๏ธ' }, { title: 'Person Gesturing No', character: '๐
' }, { title: 'Man Gesturing No', character: '๐
โโ๏ธ' }, { title: 'Woman Gesturing No', character: '๐
โโ๏ธ' }, { title: 'Person Gesturing OK', character: '๐' }, { title: 'Man Gesturing OK', character: '๐โโ๏ธ' }, { title: 'Woman Gesturing OK', character: '๐โโ๏ธ' }, { title: 'Person Tipping Hand', character: '๐' }, { title: 'Man Tipping Hand', character: '๐โโ๏ธ' }, { title: 'Woman Tipping Hand', character: '๐โโ๏ธ' }, { title: 'Person Raising Hand', character: '๐' }, { title: 'Man Raising Hand', character: '๐โโ๏ธ' }, { title: 'Woman Raising Hand', character: '๐โโ๏ธ' }, { title: 'Deaf Person', character: '๐ง' }, { title: 'Deaf Man', character: '๐งโโ๏ธ' }, { title: 'Deaf Woman', character: '๐งโโ๏ธ' }, { title: 'Person Bowing', character: '๐' }, { title: 'Man Bowing', character: '๐โโ๏ธ' }, { title: 'Woman Bowing', character: '๐โโ๏ธ' }, { title: 'Person Facepalming', character: '๐คฆ' }, { title: 'Man Facepalming', character: '๐คฆโโ๏ธ' }, { title: 'Woman Facepalming', character: '๐คฆโโ๏ธ' }, { title: 'Person Shrugging', character: '๐คท' }, { title: 'Man Shrugging', character: '๐คทโโ๏ธ' }, { title: 'Woman Shrugging', character: '๐คทโโ๏ธ' }, { title: 'Health Worker', character: '๐งโโ๏ธ' }, { title: 'Man Health Worker', character: '๐จโโ๏ธ' }, { title: 'Woman Health Worker', character: '๐ฉโโ๏ธ' }, { title: 'Student', character: '๐งโ๐' }, { title: 'Man Student', character: '๐จโ๐' }, { title: 'Woman Student', character: '๐ฉโ๐' }, { title: 'Teacher', character: '๐งโ๐ซ' }, { title: 'Man Teacher', character: '๐จโ๐ซ' }, { title: 'Woman Teacher', character: '๐ฉโ๐ซ' }, { title: 'Judge', character: '๐งโโ๏ธ' }, { title: 'Man Judge', character: '๐จโโ๏ธ' }, { title: 'Woman Judge', character: '๐ฉโโ๏ธ' }, { title: 'Farmer', character: '๐งโ๐พ' }, { title: 'Man Farmer', character: '๐จโ๐พ' }, { title: 'Woman Farmer', character: '๐ฉโ๐พ' }, { title: 'Cook', character: '๐งโ๐ณ' }, { title: 'Man Cook', character: '๐จโ๐ณ' }, { title: 'Woman Cook', character: '๐ฉโ๐ณ' }, { title: 'Mechanic', character: '๐งโ๐ง' }, { title: 'Man Mechanic', character: '๐จโ๐ง' }, { title: 'Woman Mechanic', character: '๐ฉโ๐ง' }, { title: 'Factory Worker', character: '๐งโ๐ญ' }, { title: 'Man Factory Worker', character: '๐จโ๐ญ' }, { title: 'Woman Factory Worker', character: '๐ฉโ๐ญ' }, { title: 'Office Worker', character: '๐งโ๐ผ' }, { title: 'Man Office Worker', character: '๐จโ๐ผ' }, { title: 'Woman Office Worker', character: '๐ฉโ๐ผ' }, { title: 'Scientist', character: '๐งโ๐ฌ' }, { title: 'Man Scientist', character: '๐จโ๐ฌ' }, { title: 'Woman Scientist', character: '๐ฉโ๐ฌ' }, { title: 'Technologist', character: '๐งโ๐ป' }, { title: 'Man Technologist', character: '๐จโ๐ป' }, { title: 'Woman Technologist', character: '๐ฉโ๐ป' }, { title: 'Singer', character: '๐งโ๐ค' }, { title: 'Man Singer', character: '๐จโ๐ค' }, { title: 'Woman Singer', character: '๐ฉโ๐ค' }, { title: 'Artist', character: '๐งโ๐จ' }, { title: 'Man Artist', character: '๐จโ๐จ' }, { title: 'Woman Artist', character: '๐ฉโ๐จ' }, { title: 'Pilot', character: '๐งโโ๏ธ' }, { title: 'Man Pilot', character: '๐จโโ๏ธ' }, { title: 'Woman Pilot', character: '๐ฉโโ๏ธ' }, { title: 'Astronaut', character: '๐งโ๐' }, { title: 'Man Astronaut', character: '๐จโ๐' }, { title: 'Woman Astronaut', character: '๐ฉโ๐' }, { title: 'Firefighter', character: '๐งโ๐' }, { title: 'Man Firefighter', character: '๐จโ๐' }, { title: 'Woman Firefighter', character: '๐ฉโ๐' }, { title: 'Police Officer', character: '๐ฎ' }, { title: 'Man Police Officer', character: '๐ฎโโ๏ธ' }, { title: 'Woman Police Officer', character: '๐ฎโโ๏ธ' }, { title: 'Detective', character: '๐ต๏ธ' }, { title: 'Man Detective', character: '๐ต๏ธโโ๏ธ' }, { title: 'Woman Detective', character: '๐ต๏ธโโ๏ธ' }, { title: 'Guard', character: '๐' }, { title: 'Man Guard', character: '๐โโ๏ธ' }, { title: 'Woman Guard', character: '๐โโ๏ธ' }, { title: 'Ninja', character: '๐ฅท' }, { title: 'Construction Worker', character: '๐ท' }, { title: 'Man Construction Worker', character: '๐ทโโ๏ธ' }, { title: 'Woman Construction Worker', character: '๐ทโโ๏ธ' }, { title: 'Prince', character: '๐คด' }, { title: 'Princess', character: '๐ธ' }, { title: 'Person Wearing Turban', character: '๐ณ' }, { title: 'Man Wearing Turban', character: '๐ณโโ๏ธ' }, { title: 'Woman Wearing Turban', character: '๐ณโโ๏ธ' }, { title: 'Person With Skullcap', character: '๐ฒ' }, { title: 'Woman with Headscarf', character: '๐ง' }, { title: 'Person in Tuxedo', character: '๐คต' }, { title: 'Man in Tuxedo', character: '๐คตโโ๏ธ' }, { title: 'Woman in Tuxedo', character: '๐คตโโ๏ธ' }, { title: 'Person With Veil', character: '๐ฐ' }, { title: 'Man with Veil', character: '๐ฐโโ๏ธ' }, { title: 'Woman with Veil', character: '๐ฐโโ๏ธ' }, { title: 'Pregnant Woman', character: '๐คฐ' }, { title: 'Breast-Feeding', character: '๐คฑ' }, { title: 'Woman Feeding Baby', character: '๐ฉโ๐ผ' }, { title: 'Man Feeding Baby', character: '๐จโ๐ผ' }, { title: 'Person Feeding Baby', character: '๐งโ๐ผ' }, { title: 'Baby Angel', character: '๐ผ' }, { title: 'Santa Claus', character: '๐
' }, { title: 'Mrs. Claus', character: '๐คถ' }, { title: 'Mx Claus', character: '๐งโ๐' }, { title: 'Superhero', character: '๐ฆธ' }, { title: 'Man Superhero', character: '๐ฆธโโ๏ธ' }, { title: 'Woman Superhero', character: '๐ฆธโโ๏ธ' }, { title: 'Supervillain', character: '๐ฆน' }, { title: 'Man Supervillain', character: '๐ฆนโโ๏ธ' }, { title: 'Woman Supervillain', character: '๐ฆนโโ๏ธ' }, { title: 'Mage', character: '๐ง' }, { title: 'Man Mage', character: '๐งโโ๏ธ' }, { title: 'Woman Mage', character: '๐งโโ๏ธ' }, { title: 'Fairy', character: '๐ง' }, { title: 'Man Fairy', character: '๐งโโ๏ธ' }, { title: 'Woman Fairy', character: '๐งโโ๏ธ' }, { title: 'Vampire', character: '๐ง' }, { title: 'Man Vampire', character: '๐งโโ๏ธ' }, { title: 'Woman Vampire', character: '๐งโโ๏ธ' }, { title: 'Merperson', character: '๐ง' }, { title: 'Merman', character: '๐งโโ๏ธ' }, { title: 'Mermaid', character: '๐งโโ๏ธ' }, { title: 'Elf', character: '๐ง' }, { title: 'Man Elf', character: '๐งโโ๏ธ' }, { title: 'Woman Elf', character: '๐งโโ๏ธ' }, { title: 'Genie', character: '๐ง' }, { title: 'Man Genie', character: '๐งโโ๏ธ' }, { title: 'Woman Genie', character: '๐งโโ๏ธ' }, { title: 'Zombie', character: '๐ง' }, { title: 'Man Zombie', character: '๐งโโ๏ธ' }, { title: 'Woman Zombie', character: '๐งโโ๏ธ' }, { title: 'Person Getting Massage', character: '๐' }, { title: 'Man Getting Massage', character: '๐โโ๏ธ' }, { title: 'Woman Getting Massage', character: '๐โโ๏ธ' }, { title: 'Person Getting Haircut', character: '๐' }, { title: 'Man Getting Haircut', character: '๐โโ๏ธ' }, { title: 'Woman Getting Haircut', character: '๐โโ๏ธ' }, { title: 'Person Walking', character: '๐ถ' }, { title: 'Man Walking', character: '๐ถโโ๏ธ' }, { title: 'Woman Walking', character: '๐ถโโ๏ธ' }, { title: 'Person Standing', character: '๐ง' }, { title: 'Man Standing', character: '๐งโโ๏ธ' }, { title: 'Woman Standing', character: '๐งโโ๏ธ' }, { title: 'Person Kneeling', character: '๐ง' }, { title: 'Man Kneeling', character: '๐งโโ๏ธ' }, { title: 'Woman Kneeling', character: '๐งโโ๏ธ' }, { title: 'Person with White Cane', character: '๐งโ๐ฆฏ' }, { title: 'Man with White Cane', character: '๐จโ๐ฆฏ' }, { title: 'Woman with White Cane', character: '๐ฉโ๐ฆฏ' }, { title: 'Person in Motorized Wheelchair', character: '๐งโ๐ฆผ' }, { title: 'Man in Motorized Wheelchair', character: '๐จโ๐ฆผ' }, { title: 'Woman in Motorized Wheelchair', character: '๐ฉโ๐ฆผ' }, { title: 'Person in Manual Wheelchair', character: '๐งโ๐ฆฝ' }, { title: 'Man in Manual Wheelchair', character: '๐จโ๐ฆฝ' }, { title: 'Woman in Manual Wheelchair', character: '๐ฉโ๐ฆฝ' }, { title: 'Person Running', character: '๐' }, { title: 'Man Running', character: '๐โโ๏ธ' }, { title: 'Woman Running', character: '๐โโ๏ธ' }, { title: 'Woman Dancing', character: '๐' }, { title: 'Man Dancing', character: '๐บ' }, { title: 'Person in Suit Levitating', character: '๐ด๏ธ' }, { title: 'People with Bunny Ears', character: '๐ฏ' }, { title: 'Men with Bunny Ears', character: '๐ฏโโ๏ธ' }, { title: 'Women with Bunny Ears', character: '๐ฏโโ๏ธ' }, { title: 'Person in Steamy Room', character: '๐ง' }, { title: 'Man in Steamy Room', character: '๐งโโ๏ธ' }, { title: 'Woman in Steamy Room', character: '๐งโโ๏ธ' }, { title: 'Person in Lotus Position', character: '๐ง' }, { title: 'People Holding Hands', character: '๐งโ๐คโ๐ง' }, { title: 'Women Holding Hands', character: '๐ญ' }, { title: 'Woman and Man Holding Hands', character: '๐ซ' }, { title: 'Men Holding Hands', character: '๐ฌ' }, { title: 'Kiss', character: '๐' }, { title: 'Kiss: Woman, Man', character: '๐ฉโโค๏ธโ๐โ๐จ' }, { title: 'Kiss: Man, Man', character: '๐จโโค๏ธโ๐โ๐จ' }, { title: 'Kiss: Woman, Woman', character: '๐ฉโโค๏ธโ๐โ๐ฉ' }, { title: 'Couple with Heart', character: '๐' }, { title: 'Couple with Heart: Woman, Man', character: '๐ฉโโค๏ธโ๐จ' }, { title: 'Couple with Heart: Man, Man', character: '๐จโโค๏ธโ๐จ' }, { title: 'Couple with Heart: Woman, Woman', character: '๐ฉโโค๏ธโ๐ฉ' }, { title: 'Family', character: '๐ช' }, { title: 'Family: Man, Woman, Boy', character: '๐จโ๐ฉโ๐ฆ' }, { title: 'Family: Man, Woman, Girl', character: '๐จโ๐ฉโ๐ง' }, { title: 'Family: Man, Woman, Girl, Boy', character: '๐จโ๐ฉโ๐งโ๐ฆ' }, { title: 'Family: Man, Woman, Boy, Boy', character: '๐จโ๐ฉโ๐ฆโ๐ฆ' }, { title: 'Family: Man, Woman, Girl, Girl', character: '๐จโ๐ฉโ๐งโ๐ง' }, { title: 'Family: Man, Man, Boy', character: '๐จโ๐จโ๐ฆ' }, { title: 'Family: Man, Man, Girl', character: '๐จโ๐จโ๐ง' }, { title: 'Family: Man, Man, Girl, Boy', character: '๐จโ๐จโ๐งโ๐ฆ' }, { title: 'Family: Man, Man, Boy, Boy', character: '๐จโ๐จโ๐ฆโ๐ฆ' }, { title: 'Family: Man, Man, Girl, Girl', character: '๐จโ๐จโ๐งโ๐ง' }, { title: 'Family: Woman, Woman, Boy', character: '๐ฉโ๐ฉโ๐ฆ' }, { title: 'Family: Woman, Woman, Girl', character: '๐ฉโ๐ฉโ๐ง' }, { title: 'Family: Woman, Woman, Girl, Boy', character: '๐ฉโ๐ฉโ๐งโ๐ฆ' }, { title: 'Family: Woman, Woman, Boy, Boy', character: '๐ฉโ๐ฉโ๐ฆโ๐ฆ' }, { title: 'Family: Woman, Woman, Girl, Girl', character: '๐ฉโ๐ฉโ๐งโ๐ง' }, { title: 'Family: Man, Boy', character: '๐จโ๐ฆ' }, { title: 'Family: Man, Boy, Boy', character: '๐จโ๐ฆโ๐ฆ' }, { title: 'Family: Man, Girl', character: '๐จโ๐ง' }, { title: 'Family: Man, Girl, Boy', character: '๐จโ๐งโ๐ฆ' }, { title: 'Family: Man, Girl, Girl', character: '๐จโ๐งโ๐ง' }, { title: 'Family: Woman, Boy', character: '๐ฉโ๐ฆ' }, { title: 'Family: Woman, Boy, Boy', character: '๐ฉโ๐ฆโ๐ฆ' }, { title: 'Family: Woman, Girl', character: '๐ฉโ๐ง' }, { title: 'Family: Woman, Girl, Boy', character: '๐ฉโ๐งโ๐ฆ' }, { title: 'Family: Woman, Girl, Girl', character: '๐ฉโ๐งโ๐ง' }, { title: 'Speaking Head', character: '๐ฃ๏ธ' }, { title: 'Bust in Silhouette', character: '๐ค' }, { title: 'Busts in Silhouette', character: '๐ฅ' }, { title: 'People Hugging', character: '๐ซ' }, { title: 'Footprints', character: '๐ฃ' }, { title: 'Luggage', character: '๐งณ' }, { title: 'Closed Umbrella', character: '๐' }, { title: 'Umbrella', character: 'โ๏ธ' }, { title: 'Jack-O-Lantern', character: '๐' }, { title: 'Thread', character: '๐งต' }, { title: 'Yarn', character: '๐งถ' }, { title: 'Glasses', character: '๐' }, { title: 'Sunglasses', character: '๐ถ๏ธ' }, { title: 'Goggles', character: '๐ฅฝ' }, { title: 'Lab Coat', character: '๐ฅผ' }, { title: 'Safety Vest', character: '๐ฆบ' }, { title: 'Necktie', character: '๐' }, { title: 'T-Shirt', character: '๐' }, { title: 'Jeans', character: '๐' }, { title: 'Scarf', character: '๐งฃ' }, { title: 'Gloves', character: '๐งค' }, { title: 'Coat', character: '๐งฅ' }, { title: 'Socks', character: '๐งฆ' }, { title: 'Dress', character: '๐' }, { title: 'Kimono', character: '๐' }, { title: 'Sari', character: '๐ฅป' }, { title: 'One-Piece Swimsuit', character: '๐ฉฑ' }, { title: 'Briefs', character: '๐ฉฒ' }, { title: 'Shorts', character: '๐ฉณ' }, { title: 'Bikini', character: '๐' }, { title: 'Womanโs Clothes', character: '๐' }, { title: 'Purse', character: '๐' }, { title: 'Handbag', character: '๐' }, { title: 'Clutch Bag', character: '๐' }, { title: 'Backpack', character: '๐' }, { title: 'Thong Sandal', character: '๐ฉด' }, { title: 'Manโs Shoe', character: '๐' }, { title: 'Running Shoe', character: '๐' }, { title: 'Hiking Boot', character: '๐ฅพ' }, { title: 'Flat Shoe', character: '๐ฅฟ' }, { title: 'High-Heeled Shoe', character: '๐ ' }, { title: 'Womanโs Sandal', character: '๐ก' }, { title: 'Ballet Shoes', character: '๐ฉฐ' }, { title: 'Womanโs Boot', character: '๐ข' }, { title: 'Crown', character: '๐' }, { title: 'Womanโs Hat', character: '๐' }, { title: 'Top Hat', character: '๐ฉ' }, { title: 'Graduation Cap', character: '๐' }, { title: 'Billed Cap', character: '๐งข' }, { title: 'Military Helmet', character: '๐ช' }, { title: 'Rescue Workerโs Helmet', character: 'โ๏ธ' }, { title: 'Lipstick', character: '๐' }, { title: 'Ring', character: '๐' }, { title: 'Briefcase', character: '๐ผ' }, { title: 'Drop of Blood', character: '๐ฉธ' }
];
sgCkeditorController.$inject = ['$element', 'sgCkeditorConfig'];
function sgCkeditorController ($element, sgCkeditorConfig) {
var vm = this;
var config;
var content;
var editor;
var editorChanged = false;
var modelChanged = false;
var editorChangedTimerValue = 2000;
var editorChangedTimer = null;
this.$onInit = function () {
vm.ngModelCtrl.$render = function () {
content = vm.ngModelCtrl.$viewValue;
// Clean message with invalid HTML tags
content = cleanDirtyHTMLElements(content, 50);
if (vm.editor) {
vm.editor.setData(content, {
noSnapshot: true,
callback: function () {
vm.editor.fire('updateSnapshot')
}
})
}
};
config = vm.config ? angular.merge(sgCkeditorConfig.config, vm.config) : sgCkeditorConfig.config;
config.licenseKey = "GPL";
if (!config.toolbar) {
config.toolbar = {
"items": [
"bold", "italic", "underline", "|",
"fontColor", "fontFamily", "fontSize", "removeFormat", "|",
"numberedList", "bulletedList", "|",
"outdent", "indent", "|",
"blockQuote", "|",
"alignment", "|",
"link", "|",
"insertTable", "specialCharacters", "imageUpload", "|",
"undo", "redo", "sourceEditing", "htmlEmbed"
],
"shouldNotGroupWhenFull": true
}
}
config.htmlSupport = {
allow: [
{
name: /.*/,
attributes: true,
classes: true,
styles: true
}
]
};
config.fontFamily = {
supportAllValues: true,
style: {
element: 'span',
attributes: {
style: 'font-family'
}
}
};
config.fontSize = {
options: ['10px', '12px', '14px', '16px', '18px', '20px', '24px'],
supportAllValues: true,
style: {
element: 'span',
attributes: {
style: 'font-size'
}
}
};
config.htmlEmbed = {
showPreviews: true
};
config.mediaEmbed = {
providers: []
};
config.image = {
resizeUnit: "px",
insert: {
type: "inline"
}
};
config.disableNativeSpellChecker = false;
vm.config = config;
};
this.$postLink = function () {
var editorElement = $element[0].children[0];;
ClassicEditor
.create(editorElement, vm.config)
.then(editor => {
vm.editor = editor;
// Add Emoticons
editor.plugins.get('SpecialCharacters').addItems('Emoji', emojis, { label: 'Emoticons' });
vm.editor.model.document.on('pasteState', function () { vm.onEditorChange(false); });
vm.editor.model.document.on('change:data', function () { vm.onEditorChange(false); });
vm.editor.model.document.on('paste', function () { vm.onEditorChange(false); });
vm.editor.editing.view.document.on('blur', function () { vm.onEditorChange(true); });
vm.editor.component = this;
onInstanceReady();
if (content) {
modelChanged = true
vm.editor.setData(content, {
noSnapshot: true,
callback: function () {
vm.editor.fire('updateSnapshot')
}
});
}
})
.catch(error => {
console.error(error);
});
};
this.$onChanges = function (changes) {
if (
changes.ngModel &&
changes.ngModel.currentValue !== changes.ngModel.previousValue
) {
content = changes.ngModel.currentValue;
if (vm.editor && !editorChanged) {
if (content) {
vm.editor.setData(content, {
noSnapshot: true,
callback: function () {
vm.editor.fire('updateSnapshot')
}
});
modelChanged = true;
}
}
editorChanged = false;
}
if (editor && changes.readOnly) {
editor.setReadOnly(changes.readOnly.currentValue);
}
}
this.$onDestroy = function () {
var noUpdate = true;
if (vm.editor)
vm.editor.destroy(noUpdate);
}
this.onEditorChange = function(force) {
if (editorChangedTimer)
clearTimeout(editorChangedTimer);
var refresh = function() {
var html = vm.editor.getData();
var dom = document.createElement("DIV");
dom.innerHTML = html;
var text = (dom.textContent || dom.innerText);
if (text === '\n') {
text = '';
}
if (!modelChanged && html !== vm.ngModelCtrl.$viewValue) {
editorChanged = true;
vm.ngModelCtrl.$setViewValue(html);
validate(vm.checkTextLength ? text : html);
if (vm.onContentChanged) {
vm.onContentChanged({
'editor': vm.editor,
'html': html,
'text': text
});
}
}
modelChanged = false;
editorChangedTimer = null;
};
if (force) {
refresh();
} else {
editorChangedTimer = setTimeout(refresh, editorChangedTimerValue);
}
}
function onEditorPaste (event) {
var html;
if (event.data.type == 'html') {
html = event.data.dataValue;
// Remove images to avoid ghost image in Firefox; images will be handled by the Image Upload plugin
event.data.dataValue = html.replace(/
]*)?>/gi, '');
}
}
function onInstanceReady(event) {
if (vm.onInstanceReady) {
vm.onInstanceReady({
'$event': event,
'$editor': vm.editor
});
}
vm.ngModelCtrl.$render();
}
function validate(body) {
if (vm.maxLength) {
vm.ngModelCtrl.$setValidity('maxlength', body.length > vm.maxLength + 1);
}
if (vm.minLength) {
vm.ngModelCtrl.$setValidity('minlength', body.length <= vm.minLength);
}
if (vm.required) {
vm.ngModelCtrl.$setValidity('required', body.length > 0);
}
}
function cleanDirtyHTMLElements(html, threshold) {
var regex = /(<[^>^/]+>( )*<\/[^>]+>)/gm;
var m;
var duplicates = {};
while ((m = regex.exec(html)) !== null) {
if (m[0]) {
var hash = (m[0]).md5();
if (duplicates[hash]) {
duplicates[hash].counter++;
} else {
duplicates[hash] = {
code: m[0],
counter: 1
};
}
}
}
var i;
var duplicatesKeys = Object.keys(duplicates);
for (i = 0; i < duplicatesKeys.length; i++) {
if (duplicates[duplicatesKeys[i]].counter >= threshold) {
// Remove element
html = html.replaceAll(duplicates[duplicatesKeys[i]].code, '');
console.log("Removed tag for cleaning : ");
console.log(duplicates[duplicatesKeys[i]].code);
}
}
return html;
}
}
angular
.module('sgCkeditor', [])
.provider('sgCkeditorConfig', sgCkeditorConfigProvider)
.component('sgCkeditor', sgCkeditorComponent);
})();