-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathCore.UI.RichTextEditor.js
More file actions
752 lines (676 loc) · 28.2 KB
/
Copy pathCore.UI.RichTextEditor.js
File metadata and controls
752 lines (676 loc) · 28.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
// --
// OTOBO is a web-based ticketing system for service organisations.
// --
// Copyright (C) 2001-2020 OTRS AG, https://otrs.com/
// Copyright (C) 2021-2024 Znuny GmbH, https://znuny.org/
// Copyright (C) 2019-2026 Rother OSS GmbH, https://otobo.io/
// --
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation, either version 3 of the License, or (at your option) any later version.
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// --
"use strict";
var Core = Core || {};
Core.UI = Core.UI || {};
var CKEditorInstances = {};
/**
* @namespace Core.UI.RichTextEditor
* @memberof Core.UI
* @author
* @description
* Richtext Editor.
*/
Core.UI.RichTextEditor = (function (TargetNS) {
/**
* @private
* @name $FormID
* @memberof Core.UI.RichTextEditor
* @member {jQueryObject}
* @description
* Hidden input field with name FormID.
*/
var $FormID,
/**
* @private
* @name TimeOutRTEOnChange
* @memberof Core.UI.RichTextEditor
* @member {Object}
* @description
* Object to handle timeout.
*/
TimeOutRTEOnChange;
/**
* @private
* @name CheckFormID
* @memberof Core.UI.RichTextEditor
* @function
* @returns {jQueryObject} FormID element.
* @param {jQueryObject} $EditorArea - The jQuery object of the element that has become a rich text editor.
* @description
* Check in the window which hidden element has a name same to 'FormID' and return it like a JQuery object.
*/
function CheckFormID($EditorArea) {
if (typeof $FormID === 'undefined') {
$FormID = $EditorArea.closest('form').find('input:hidden[name=FormID]');
}
return $FormID;
}
/**
* @name InitEditor
* @memberof Core.UI.RichTextEditor
* @function
* @returns {Boolean} Returns false on error.
* @param {jQueryObject} $EditorArea - The jQuery object of the element that will be a rich text editor.
* @description
* This function initializes the application and executes the needed functions.
*/
TargetNS.InitEditor = function ($EditorArea) {
var EditorID = '',
UserLanguage,
PluginList = Core.Config.Get('RichText.Plugins'),
CustomerInterface = (Core.Config.Get('SessionName') === Core.Config.Get('CustomerPanelSessionName'));
// The format for the language is different between OTOBO and CKEditor (see bug#8024)
// To correct this, we replace "_" with "-" in the language (e.g. zh_CN becomes zh-cn)
UserLanguage = Core.Config.Get('UserLanguage').replace(/_/, '-').toLowerCase();
if (!window.CKEditor5Wrapper) {
return false;
}
// Check if instance is already loaded
if (isJQueryObject($EditorArea) && $EditorArea.hasClass('HasCKEInstance')) {
return false;
}
if (isJQueryObject($EditorArea) && $EditorArea.length === 1) {
EditorID = $EditorArea.attr('id');
}
if (EditorID === '') {
Core.Exception.Throw('RichTextEditor: Need exactly one EditorArea!', 'TypeError');
}
// Common editor label
// use wildcard to include "RichText<ActivityDialogID>"
const $RichTextLabel = $EditorArea.closest('.Field').siblings('label[for="' + EditorID + '"]');
var ToolbarConfig;
if ( CustomerInterface ) {
ToolbarConfig = CheckFormID($EditorArea).length ? Core.Config.Get('RichText.Toolbar') : Core.Config.Get('RichText.ToolbarWithoutImage');
}
else {
ToolbarConfig = CheckFormID($EditorArea).length ? Core.Config.Get('RichText.Toolbar') : Core.Config.Get('RichText.ToolbarWithoutImage');
}
var Integrations;
var removedPlugins = [];
var BlockPasteImg = false;
//Enable picture upload when FormID is present
//If not, load only the url to image function
if ( CheckFormID($EditorArea).length ) {
Integrations = [ 'upload', 'url' ];
} else {
Integrations = [ 'url' ];
BlockPasteImg = true;
removedPlugins = [ 'SimpleUploadAdapter' ];
}
// if this is a RichText DF, disable Image Upload
if($EditorArea.hasClass('DynamicFieldRichText')) {
ToolbarConfig = Core.Config.Get('RichText.ToolbarWithoutImage');
Integrations = [ 'url' ];
removedPlugins = [ 'SimpleUploadAdapter' ];
}
var ClassicEditor = CKEditor5Wrapper.ClassicEditor;
let EnabledPlugins = [];
for (let pluginName of PluginList) {
let Plugin = CKEditor5Wrapper[pluginName];
if (Plugin) {
EnabledPlugins.push(CKEditor5Wrapper[pluginName]);
} else {
Core.Exception.ShowError('Couldn\'t find plugin: ' + pluginName, 'JavaScriptError');
}
}
ClassicEditor.create($($EditorArea).get(0), {
licenseKey: 'GPL',
ui: {
poweredBy: {
position: 'inside',
side: 'right',
label: null,
forceVisible: true,
verticalOffset: 2,
horizontalOffset: 2
}
},
heading: {
options: [
{ model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
{ model: 'heading1', view: 'h1', title: 'Heading 1', class: 'ck-heading_heading1' },
{ model: 'heading2', view: 'h2', title: 'Heading 2', class: 'ck-heading_heading2' },
{ model: 'heading3', view: 'h3', title: 'Heading 3', class: 'ck-heading_heading3' },
{ model: 'heading4', view: 'h4', title: 'Heading 4', class: 'ck-heading_heading4' },
{ model: 'heading5', view: 'h5', title: 'Heading 5', class: 'ck-heading_heading5' },
{ model: 'heading6', view: 'h6', title: 'Heading 6', class: 'ck-heading_heading6' },
]
},
fontSize: {
options: [
'default', 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30
],
supportAllValues: true
},
fontFamily: {
supportAllValues: true
},
toolbar: {
shouldNotGroupWhenFull: true,
items: ToolbarConfig
},
plugins: EnabledPlugins,
removePlugins: removedPlugins,
language: {
ui: UserLanguage,
content: UserLanguage
},
htmlSupport: {
// elements configurable via Frontend::RichText::HtmlSupportAllowedElements
allow: (Core.Config.Get('RichText.HtmlSupportAllowedElements') || ['span', 'cite', 'style', 'table']).map(function (ElementName) {
return {
name: ElementName,
attributes: true,
classes: true,
styles: true
};
}),
disallow: [
{
styles: {
position: /(absolute|sticky|fixed)$/
}
}
]
},
image: {
resizeUnit: 'px',
resizeOptions: [
{
name: 'resizeImage:original',
label: 'Original Image Size',
value: null,
icon: 'original'
},
{
name: 'resizeImage:custom',
label: 'Scale Image',
value: 'custom',
icon: 'custom'
}
],
styles: {
options: [
'alignLeft', 'alignCenter', 'alignRight', 'alignBlockRight',
{
name: 'alignBlockLeft',
isDefault: true
}
]
},
toolbar: [
{
name: 'imageStyle:imagePositioningDropdown',
title: 'Image Positioning',
items: [
'imageStyle:alignLeft',
'imageStyle:alignCenter',
'imageStyle:alignRight',
'imageStyle:alignBlockLeft',
'imageStyle:alignBlockRight'
],
defaultItem: 'imageStyle:alignBlockLeft'
},
'resizeImage'
],
insert: {
type: 'ImageBlock',
integrations: Integrations
}
},
table: {
tableCellProperties: {
defaultProperties: {
horizontalAlignment: 'left',
verticalAlignment: 'top',
}
},
tableProperties: {
defaultProperties: {
alignment: 'center',
width: '100%'
}
},
contentToolbar: [
'tableColumn', 'tableRow', 'mergeTableCells', 'tableProperties', 'tableCellProperties'
]
},
simpleUpload: {
// build URL for image upload
uploadUrl: Core.Config.Get('Baselink')
+ 'Action='
+ Core.Config.Get('RichText.PictureUploadAction', 'PictureUpload')
+ '&FormID='
+ CheckFormID($EditorArea).val()
+ '&' + Core.Config.Get('SessionName')
+ '=' + Core.Config.Get('SessionID'),
// Enable the XMLHttpRequest.withCredentials property.
withCredentials: false,
// Headers sent along with the XMLHttpRequest to the upload server.
headers: {}
},
fontColor: {
colors: [
{
color: '#000000',
label: 'Black'
},
{
color: '#4d4d4d',
label: 'Dim grey'
},
{
color: '#999999',
label: 'Grey'
},
{
color: '#e6e6e6',
label: 'Light grey'
},
{
color: '#ffffff',
label: 'White',
hasBorder: true
},
{
color: '#e64c4c',
label: 'Red'
},
{
color: '#e6994c',
label: 'Orange'
},
{
color: '#e6e64c',
label: 'Yellow'
},
{
color: '#99e64c',
label: 'Light green'
},
{
color: '#4ce64c',
label: 'Green'
},
{
color: '#4ce699',
label: 'Aquamarine'
},
{
color: '#4ce6e6',
label: 'Turquoise'
},
{
color: '#4c99e6',
label: 'Light blue'
},
{
color: '#4c4ce6',
label: 'Blue'
},
{
color: '#994ce6',
label: 'Purple'
}
],
colorPicker: {
format: 'hex'
}
},
fontBackgroundColor: {
colors: [
{
color: '#000000',
label: 'Black'
},
{
color: '#4d4d4d',
label: 'Dim grey'
},
{
color: '#999999',
label: 'Grey'
},
{
color: '#e6e6e6',
label: 'Light grey'
},
{
color: '#ffffff',
label: 'White',
hasBorder: true
},
{
color: '#e64c4c',
label: 'Red'
},
{
color: '#e6994c',
label: 'Orange'
},
{
color: '#e6e64c',
label: 'Yellow'
},
{
color: '#99e64c',
label: 'Light green'
},
{
color: '#4ce64c',
label: 'Green'
},
{
color: '#4ce699',
label: 'Aquamarine'
},
{
color: '#4ce6e6',
label: 'Turquoise'
},
{
color: '#4c99e6',
label: 'Light blue'
},
{
color: '#4c4ce6',
label: 'Blue'
},
{
color: '#994ce6',
label: 'Purple'
}
],
colorPicker: {
format: 'hex'
}
},
translations: [
CKEditor5CoreTranslations,
]
})
.then(editor => {
/* Generate ID for current Editor */
editor.ElementId = EditorID;
CKEditorInstances[$EditorArea.attr('id')] = editor;
window.editor = editor;
// set input field label as placeholder
if (CustomerInterface) {
if (!$RichTextLabel.closest('.Row').hasClass('Row_DynamicField')) {
editor.editing.view.document.getRoot('main').placeholder = $RichTextLabel.text();
$RichTextLabel.hide();
}
}
/* configure permissable html tags */
if (window.editor.plugins.has("DataFilter")) {
let dataFilter = window.editor.plugins.get("DataFilter");
dataFilter.allowElement( "style" );
}
/* Set Container size */
var $domEditableElement = $($EditorArea).closest(".RichTextField");
//Try use RichTextHolder for Customer Interface
if (CustomerInterface) {
$domEditableElement = $($EditorArea).closest(".RichTextHolder");
}
//Set to Readonly mode if required
if ($EditorArea.hasClass('Readonly')) {
editor.enableReadOnlyMode('DF_Readonly');
}
var sourceEditingActive = false;
$domEditableElement.resizable();
$domEditableElement.resizable("option", "minHeight", 200);
$domEditableElement.resizable("option", "handles", "s");
let $resizeHandle = $(".ui-resizable-s", $domEditableElement);
$resizeHandle.append("<i class='ooofo ooofo-more_h'></i>");
$resizeHandle.addClass("RichTextField_resizeHandle");
// Adjust Editor Size to match (resizable) container size
var UpdateEditorSize = function(newSize=null) {
let fieldPadding = parseFloat($domEditableElement.css("padding-top"))
+ parseFloat($domEditableElement.css("padding-bottom"));
let newEditorSize;
if (newSize) {
newEditorSize = newSize.height - fieldPadding;
} else {
newEditorSize = $domEditableElement.innerHeight() - fieldPadding;
}
let toolbarHeight = $domEditableElement.find('.ck-editor__top').outerHeight();
let newEditingAreaSize = newEditorSize - toolbarHeight;
if (sourceEditingActive) {
let $editingArea = $domEditableElement.find('.ck-source-editing-area');
$editingArea.height(newEditingAreaSize);
editor.editing.view.forceRender();
} else {
editor.editing.view.change(writer => {
writer.setStyle(
'height',
newEditingAreaSize + 'px',
editor.editing.view.document.getRoot()
);
});
}
};
// set initial Editor height as defined by the System Configurations
$domEditableElement.css("--InitialHeight", Core.Config.Get("RichText.Height") + "px");
UpdateEditorSize();
// resize editing area when editor is resized with the resizable handle
$domEditableElement.on('resize', function() {
UpdateEditorSize();
});
const resizeObserver = new ResizeObserver(() => {
UpdateEditorSize();
});
// resize editor when resizable container changes size for any reason (e.g. window resize, sidebar toggle)
// currently this leads to the editor growing endlessly if activated for the customer interface or
// RichTextEditors in TableLike forms (e.g. Admin Interface)
let InModularForm = $domEditableElement.closest("fieldset").hasClass("ModularForm");
if (!CustomerInterface && InModularForm) {
resizeObserver.observe($domEditableElement.get(0));
}
//make sure editor size is adjusted as well whenever the toolbar changes size
resizeObserver.observe(editor.ui.view.toolbar.element);
// resize editor on mode change
if ( editor.plugins.has( 'SourceEditing' ) ) {
const sourceEditing = editor.plugins.get( 'SourceEditing' );
editor.listenTo( sourceEditing, 'change:isSourceEditingMode', () => {
sourceEditingActive = sourceEditing.isSourceEditingMode;
UpdateEditorSize();
} );
}
//Block pasting images for ToolbarWithoutImage
editor.editing.view.document.on( 'clipboardInput', ( evt, data ) => {
const dataTransfer = data.dataTransfer;
if ( dataTransfer._files.length > 0 ) {
const imageName = dataTransfer._files[0].name;
if ( /\.(jpe?g|png|gif|bmp)$/i.test(imageName) && BlockPasteImg ) {
evt.stop();
return;
}
}
});
Core.App.Publish('Event.UI.RichTextEditor.InstanceCreated', [editor]);
// workaround for ckeditor not using data filter correctly on pre-filled content
if (editor.ElementId == 'RichText') {
editor.setData(editor.sourceElement.innerText);
}
//Update validation error tooltip while content is added to the editor
editor.model.document.on('change:data', () => {
window.clearTimeout(TimeOutRTEOnChange);
TimeOutRTEOnChange = window.setTimeout(function () {
let EditorAreaContent = editor.getData();
if (EditorAreaContent != "") {
$("#" + editor.ElementId).val(EditorAreaContent);
}
Core.Form.Validate.ValidateElement($EditorArea);
Core.App.Publish('Event.UI.RichTextEditor.ChangeValidationComplete', [editor]);
}, 500);
});
editor.ui.focusTracker.on('change:isFocused', (_evt, _name, isFocused) => {
if (!isFocused) {
$("#" + $EditorArea.attr('id')).val(editor.getData());
Core.Form.Validate.ValidateElement($EditorArea);
Core.Form.ErrorTooltips.RemoveRTETooltip($EditorArea);
}
});
})
.catch(error => {
console.error(error);
});
// mark the editor textarea as linked with an RTE instance to avoid multiple instances
$EditorArea.addClass('HasCKEInstance');
//Remove validation for undefined elements on CKEditor (JQuery validate plugin exception)
$(document).ready(function () {
$('form').each(function () {
if ($(this).data('validator')) {
var ExistingIgnores = ( $(this).data('validator').settings.ignore || '' ).split(', ');
[".ck", ".ck-editor__editable", ".ck-content"].forEach(function(Element) {
if ( ExistingIgnores.indexOf(Element) == -1 ) {
ExistingIgnores.push(Element);
}
});
$(this).data('validator').settings.ignore = ExistingIgnores.join(", ");
return false;
}
});
});
};
/**
* @name InitAllEditors
* @memberof Core.UI.RichTextEditor
* @function
* @description
* This function initializes as a rich text editor every textarea element that containing the RichText class.
*/
TargetNS.InitAllEditors = function () {
if (!window.CKEditor5Wrapper) {
return;
}
$('textarea.RichText').each(function () {
TargetNS.InitEditor($(this));
});
};
/**
* @name Init
* @memberof Core.UI.RichTextEditor
* @function
* @description
* This function initializes JS functionality.
*/
TargetNS.Init = function () {
if (!window.CKEditor5Wrapper || Core.Config.Get('Action') == 'AdminGenericInterfaceMappingXSLT') {
return;
}
var CustomerInterface = (Core.Config.Get('SessionName') === Core.Config.Get('CustomerPanelSessionName'));
$("head").append('<link rel="stylesheet" type="text/css" href="' + Core.Config.Get('WebPath') + Core.Config.Get('RichText.EditorStylesPath') + '">');
$("head").append('<link rel="stylesheet" type="text/css" href="' + Core.Config.Get('WebPath') + Core.Config.Get('RichText.ContentStylesPath') + '">');
if (CustomerInterface) {
$("head").append('<link rel="stylesheet" type="text/css" href="' + Core.Config.Get('WebPath') + '/skins/Customer/default/css/CKEditorCustomStyles.css">');
$("head").append('<link rel="stylesheet" type="text/css" href="' + Core.Config.Get('WebPath') + '/skins/Customer/default/css/RichTextArticleContent.css">');
} else {
$("head").append('<link rel="stylesheet" type="text/css" href="' + Core.Config.Get('WebPath') + '/skins/Agent/default/css/CKEditorCustomStyles.css">');
$("head").append('<link rel="stylesheet" type="text/css" href="' + Core.Config.Get('WebPath') + '/skins/Agent/default/css/RichTextArticleContent.css">');
}
let CustomStyles = Core.Config.Get('RichText.CustomCSS') || '';
if (CustomStyles != '') {
$("head").append('<style type="text/css"> .ck-content {' + CustomStyles + '} </style>');
}
TargetNS.InitAllEditors();
};
/**
* @name GetRTE
* @memberof Core.UI.RichTextEditor
* @function
* @returns {jQueryObject} jQuery object of the corresponding RTE element.
* @param {jQueryObject} $EditorArea - The jQuery object of the element that is a rich text editor.
* @description
* Get RTE jQuery element.
*/
TargetNS.GetRTE = function ($EditorArea) {
var $RTE;
if (isJQueryObject($EditorArea)) {
$RTE = $($EditorArea.attr('id'));
return ($RTE.length ? $RTE : undefined);
}
};
/**
* @name UpdateLinkedField
* @memberof Core.UI.RichTextEditor
* @function
* @param {jQueryObject} $EditorArea - The jQuery object of the element that is a rich text editor.
* @description
* This function updates the linked field for a rich text editor.
*/
TargetNS.UpdateLinkedField = function ($EditorArea) {
var EditorID = '',
Data,
StrippedContent;
if (isJQueryObject($EditorArea) && $EditorArea.length === 1) {
EditorID = $EditorArea.attr('id');
}
if (EditorID === '') {
Core.Exception.Throw('RichTextEditor: Need exactly one EditorArea!', 'TypeError');
}
Data = window.editor.getData();
StrippedContent = Data.replace(/\s+| |<\/?\w+[^>]*\/?>/g, '');
if (StrippedContent.length === 0 && !Data.match(/<img/)) {
$EditorArea.val('');
}
else {
$EditorArea.val(Data);
}
};
/**
* @name IsEnabled
* @memberof Core.UI.RichTextEditor
* @function
* @returns {Boolean} True if RTE is enabled, false otherwise
* @param {jQueryObject} $EditorArea - The jQuery object of the element that is a rich text editor.
* @description
* This function check if a rich text editor is enable in this moment.
*/
TargetNS.IsEnabled = function ($EditorArea) {
if (typeof window.editor === 'undefined') {
return false;
}
if (isJQueryObject($EditorArea) && $EditorArea.length && $EditorArea.hasClass('RichText')) {
return (window.editor ? true : false);
}
return false;
};
/**
* @name Focus
* @memberof Core.UI.RichTextEditor
* @function
* @param {jQueryObject} $EditorArea - The jQuery object of the element that is a rich text editor.
* @description
* This function focusses the given RTE.
*/
TargetNS.Focus = function ($EditorArea) {
var EditorID = '';
if (isJQueryObject($EditorArea) && $EditorArea.length === 1) {
EditorID = $EditorArea.attr('id');
}
if (EditorID === '') {
Core.Exception.Throw('RichTextEditor: Need exactly one EditorArea!', 'TypeError');
}
if (typeof ClassicEditor != 'undefined') {
CKEditorInstances[$EditorArea.attr('id')].focus();
}
};
Core.Init.RegisterNamespace(TargetNS, 'APP_MODULE');
return TargetNS;
}(Core.UI.RichTextEditor || {}));