-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathckeditor.javascript.txt
3584 lines (2868 loc) · 196 KB
/
ckeditor.javascript.txt
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
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
┏━━━━━━━━━━━━━━┓
┃ CKEDITOR ┃
┗━━━━━━━━━━━━━━┛
ALTERNATIVES ==> # - redactor
# - CKEditor (prefer): more features
VERSION ==> #4.5.4
INSTALLATION ==> #Bower: ckeditor
#No RequireJS
BUILDING ==> #Goal:
# - create release (minify, etc.)
# - pick only needed parts
# - concatenate into one file:
# - presence:
# - source are still present (but can remove with 'ignore' PATH_ARR)
# - non-picked languages/skins are not present
# - load:
# - will still load:
# - at CKEDITOR init:
# - styles.js unless CONF.stylesSet not 'default'
# - config.js unless CONF.customConfig defined
# - at EDITOR init:
# - skin: skin.js, editor.css
# - lang/LANG.js
# - at first plugin init:
# - plugin images, but bundled as two sprite images
# - contents.css, unless CONF.contentsCss defined
# - will not concatenate nor load (must do manually):
# - adapters/jquery.js
# - must define CKEDITOR_BASEPATH global variable before library is loaded,
# in order to change CKEDITOR.basePath to fetch those files loaded at runtime
#Use dev/builder/build.sh:
# - download and launch ckbuilder.jar
# - based on build-config.js, which defines CKBUILDER_CONFIG OBJ:
# - skin 'SKIN'
# - plugins.PLUGIN 1|0 (def: none)
# - languages.LANG (e.g. 'en' or 'en-us') 1|0 (def: all)
# - ignore PATH_ARR
# - js 'PATH[,start|aftercore|end]'_ARR: custom JavaScript added to build
# - create ./release/ckbuilder/ (optimized but not concatenated)
# - options:
# --build-config FILE
# --overwrite
# --leave-js|css-unminified
# --no-zip|tar
#Can use online builder, or online toolbar configurator to do it too.
SUMMARY ==> #Initialization:
# - init
# - inline mode
# - normal mode
# - jquery
# - config
#Base:
# - events
#Environment:
# - env
# - adobeair: Adobe Air support
# - about: credits dialog
#Helpers:
# - XML
# - AJAX
#i18n:
# - i18n: base
# - language: let user change HTML lang|dir attribute
# - bdi
#Design:
# - skins
# - uicolor: allow user change base color
#DOM:
# - editable
#UI:
# - UI: base
# - panel
# - floatpanel
# - menu
# - contextmenu
# - button
# - panelbutton
# - menubutton
# - listblock
# - richcombo
#Dialogs:
# - dialog: base
# - dialogui: base UI elements
# - dialogadvtab: advanced tab (change id|dir|style|class)
# - iframedialog: <iframe> dialog
# - colordialog: color picker dialog
# - popup: window.open()
#Notification:
# - notification
# - notificationaggregator: one notification for several tasks
#Toolbar:
# - wysiwygarea: main editing mode
# - divarea: 'inline mode' alternative
# - toolbar
# - floatingspace: where to place toolbar in 'inline mode'
# - sharedspace: one toolbar, several EDITOR
# - fixed: toolbar always on top (while editor present and 'normal mode')
# - maximize
#UX:
# - keystokes
# - focusmanager
#Styles
#IO base:
# - DTD: HTML correctness
# - htmlparser: HTML raw reader|writer
# - htmlwriter: beautified HTML writer
# - htmlparser nodes: HTML nodes JavaScript representation
# - dataprocessor: I/O base
# - I/O: I/O high-level
#IO:
# - enterkey: typing 'Enter'
# - tab: typing 'Tab'
# - entities: HTML entities
# - lineutils: creating horizontal spaces
# - markdown: edit in Markdown
# - bbcode: BBCode output
# - autosave
# - lite: track changes
#Filters:
# - htmlparser rules: filtering
# - filters
# - feature: command + filter
#Extensions:
# - commands: functions to fire
# - resourcemanager: load scripts/images/etc. on demand
# - plugins: resourcemanager for a set of features (e.g. buttons, widgets, etc.)
# - widget: single entity on the editor
#Basic:
# - readonly
# - undo
# - find
# - newpage: clears page
#Selection:
# - selection: base
# - selectall
#clipboard:
# - clipboard: base
# - pastetext: paste as plain text
# - pasteword: paste from Word
#Font formatting:
# - basicstyles: bold|italic|underline|strike|subscript|superscript
# - removeformat
# - stylescombo: list of predefined styles
# - stylesheetparser: use CSS files for 'stylescombo'
# - font: font-family, font-size
# - ckeditor-gwf-plugin: Google Web Font font families
# - colorbutton: color, background-color
# - texttransform: change case
# - letterspacing: CSS letter-spacing
#Paragraph formatting:
# - indent[block]: indent|outdent button
# - justify
# - lineheight
# - format: list of predefined styles
# - blockquote: <blockquote>
# - div: <div>
#Insert:
# - link
# - autolink: when pasting
# - horizontalrule
# - specialchar
# - forms: <input>, etc.
# - html5validation: form validation
# - templates: predefined 'HTML' chunks
# - placeholder: [[...]] WIDGET
# - token: similar to placeholder
# - footnotes
#List:
# - indenlist: indent|outdent with Tab
# - list
# - liststyles: edit list-style-*
#Tables:
# - table
# - tabletools: add context menu options on <table>
# - tableresize
# - quicktable: like <table>, but also shows quicktable
# - layoutmanager: <table> meant for layout
#Multimedia:
# - image[2]
# - imagerotate: rotate <img>
# - chart: insert charts using chart.js
# - youtube
# - locationmap: Google Maps
# - googledocs
# - audio: <audio>
# - flash: Adobe Flash
# - slideshow: inserting slideshows
# - smiley
# - fontawesome: insert FontAwesome icons
#embed:
# - fakeobjects: replace by <img> when editor idle
# - embedbase: base
# - embed[semantic]: <iframe> oEmbed
# - autoembed: when pasting
# - iframe: <iframe>
# - codesnippet[geshi]: code editor
# - codemirror: code editor
# - mathjax: TeX
# - widgetboostrap: insert Boostrap widgets
#Upload:
# - save: <form> submit
# - filebrowser: filebrowser popup
# - filetools: file upload helpers
# - uploadwidget
# - uploadimage
# - imageuploader
#Size:
# - autogrow
# - resize
# - wordcount: bottom bar word count, and possibility to restrict max length
#Correction:
# - scayt|swc: auto-correction
# - autocorrect: substitute sequences as you type, e.g. <--> to ↔
#Print:
# - print: browser print popup
# - preview: popup with HTML output
# - pagebreak
#a11y:
# - tabindex
# - magicline: easy insert with red line helper
# - a11yhelp: shortcuts popup
#Developers:
# - sourcearea|sourcedialog: editing HTML code
# - docprops: page properties
# - devtools: dialog development visual helpers
# - showborders: table development visual helpers
# - showblocks: visual helpers
# - elementspath: HTML path in bottom bar
┏━━━━━━━━━━━━━━━━━━━━┓
┃ INITIALIZATION ┃
┗━━━━━━━━━━━━━━━━━━━━┛
┌──────────┐
│ INIT │
└──────────┘
CKEDITOR.version|revision #STR
CKEDITOR.status #Can be:
# - 'unloaded'
# - 'basic_loaded|read': before loading core
# - 'loaded': after loading core. Fire 'loaded'.
new CKEDITOR.editor
(CONF, DOM_ELEM, MODE) #Low-level
CKEDITOR.instances.ID #EDITOR
EDITOR.id #
CKEDITOR.currentInstance #EDITOR with focus
#When changed, fire 'currentInstance'
EDITOR.on
('instance', FUNC(null, EDITOR)) #When created but not ready
EDITOR.status #Can be:
# - 'unloaded'
# - 'loaded':
# - logic ready (e.g. plugins loaded)
# - also fire 'loaded', CKEDITOR 'instanceLoaded'
# - sets EDITOR.loaded true
# - 'ready':
# - UI also ready
# - fire 'uiReady', then 'contentDom', then 'instanceReady', CKEDITOR 'instanceReady'
# - EDITOR.instanceReady true
# - 'destroyed'
EDITOR.destroy() #Fires '[before]destroy', CKEDITOR 'instanceDestroyed'
EDITOR.window #DOM_WINDOW
CKEDITOR|EDITOR.document #DOM_DOCUMENT
EDITOR.container|element #ELEM
EDITOR.ui.contentsElement #ELEM. In 'inline mode', EDITOR.container. In 'normal mode', excludes toolbar.
CONF.title #HTML 'title' attribute on the container (def: 'Rich Text Editor, EDITOR_ID', i18n'd)
#Can be false
EDITOR.elementMode #Either:
# - CKEDITOR.ELEMENT_MODE_INLINE ('inline mode')
# - on any[contenteditable="BOOL"]: read-write or read-only
# - CKEDITOR.ELEMENT_MODE_REPLACE|APPENDTO ('normal mode'):
# - with toolbars, etc., in an <iframe>
# - automatically updates element with HTML content
┌─────────────────┐
│ INLINE MODE │
└─────────────────┘
CKEDITOR.inline #Creates new EDITOR in 'inline mode':
(ELEM|'ID', CONF) # - EDITOR.setData(ELEM.getHtml())
# - with textarea, use instead:
# - EDITOR.setData(ELEM.getValue())
# - hide textarea, and use a new sibling <div contenteditable="true"> instead
# - EDITOR.editable(ELEM)
# - ELEM must be among DTD.$editable or be a <textarea>
CKEDITOR.inlineAll() #Does CKEDITOR.inline() on all elements with contenteditable="true"
#Fires 'inline' with CEVENT.data: element ELEM, config CONF:
# - can modify CONF (empty at first)
# - can return false to not instantiate
#Done at DOM ready if CKEDITOR.disableAutoInline false
┌─────────────────┐
│ NORMAL MODE │
└─────────────────┘
CKEDITOR.appendTo #Create new EDITOR in 'normal mode':
(ELEM|'ID'[, CONF[, 'HTML']]) # - ELEM.append()
# - EDITOR.setData('HTML')
CKEDITOR.replace(ELEM|'ID'[,CONF])#Creates new EDITOR in 'normal mode':
# - ELEM.hide() + VAL.insertAfter(ELEM)
# - EDITOR.setData(null)
CKEDITOR.replaceAll(['CLASS'| #CKEDITOR.replace() on all <textarea> (with a name|id)
FUNC(TEXTAREA, CONF)->BOOL]) #Can restrict to only some 'CLASS' or when FUNC() returns true
#With FUNC, CONF is empty at first but can be manipulated.
CONF.width|height #'CSS_LENP'|NUM (def: ''|200)
EDITOR.resize # - BOOL: if true, applied to content area, otherwise to entire editor area
(NUM, NUM2[, BOOL[, BOOL2]]) # - BOOL2: if true, applied to inner area, otherwise to outer area
#Fires 'resize' with CEVENT.data: outerHeight|Width, contentsHeight
EDITOR.getResizable([BOOL]) #Returns container (if false) or container without toolbar (if true)
┌────────────┐
│ JQUERY │
└────────────┘
JQ.ckeditor([CONF]) #Use jQuery adapter to instantiate, calling CKEDITOR.replace|inline(ELEM, CONF)
#(according to whether it is <textarea>)
#Do nothing if already initialized.
#Must load adapters/jquery.js
#Returns a jQuery PROMISE, resolved when loaded, with also property:
# - editor EDITOR
#JQ.val([VAL]):
# - will call EDITOR.getData()->VAL and EDITOR.setData(VAL)->PROMISE
# - unless CONF.jqueryOverrideVal false
# - only in 'normal mode'
#Exposes some CEVENT as JQEVENTs: 'instanceReady|destroy|setData|getData|dataReady.ckeditor'
JQ.ckeditorGet() #EDITOR (throws if not initialized)
┌────────────┐
│ CONFIG │
└────────────┘
CKEDITOR.config #all-EDITOR CONF
EDITOR.config #EDITOR-specific CONF
CKEDITOR.editorConfig(CONF) #Function which, when called, can modify all-EDITOR CONF
#If defines a CONF.customConfig, recursively loads it.
CONF.customConfig #FILE in BASEPATH, which usually define CKEDITOR.editorConfig
#Def: 'config.js'
┌──────────┐
│ MODE │
└──────────┘
EDITOR.mode #'wysiwyg|source' ('source' available with a plugin)
EDITOR.addMode
('MODE', FUNC(FUNC2())) #Adds a mode
EDITOR.setMode('MODE'[, FUNC2()]) #Changes modes
#Fires:
# - 'beforeSetMode' with CEVENT.data 'MODE'
# - 'mode'
COMMAND_DEF.modes #Which modes can execute this commands as OBJ.MODE 0|1
CONF.startupMode #Only for 'normal mode' (def: 'wysiwyg')
┏━━━━━━━━━━┓
┃ BASE ┃
┗━━━━━━━━━━┛
┌────────────┐
│ EVENTS │
└────────────┘
CEVENTEMITTER.fire
('EVENT'[, OBJ[, EDITOR]]) #Returns false if cancelled, VAL otherwise.
CEVENTEMITTER.fireOnce(...) #Same as CEVENTEMITTER.fire(...) followed by removeListener()
CEVENTEMITTER.
on|once('EVENT', FUNC(CEVENT)
[, THIS][, OBJ2][, PRIO_NUM]) #OBJ2 available at CEVENT.listenerData
CEVENTEMITER.hasListeners('EVENT')#
CEVENTEMITTER.removeListener
('EVENT') #
CEVENTEMITTER.removeAllListeners()#
CEVENTEMITTER.define('EVENT', OBJ)#If OBJ.errorProof true, wrap listener in try|catch block
CEVENTEMITTER.capture() #???
CEVENT
CEVENT.data #OBJ
CEVENT.name #STR
CEVENT.editor #EDITOR
CEVENT.sender #OBJ that sends the event
CEVENT.cancel|stop() #fire() will return false|true
CEVENT.removeListener() #Removes current listener
CONF.on.EVENT(...) #Sets event listeners directly in the config
┏━━━━━━━━━━━━━━━━━┓
┃ ENVIRONMENT ┃
┗━━━━━━━━━━━━━━━━━┛
┌─────────┐
│ ENV │
└─────────┘
CKEDITOR.env #ENV
ENV.air|chrome|edge|gecko|ie|
safari|webkit #BOOL
ENV.version #NUM browser version
ENV.iOS|mac #BOOL
ENV.isCompatible #BOOL: supported by CKEditor
#If false, throws at init.
ENV.quirks #BOOL (IE quirks mode)
ENV.needsBr|NbspFiller #BOOL: needs to fix <br> or non-breaking space.
ENV.secure()->BOOL #HTTPS
┌──────────────┐
│ ADOBEAIR │
└──────────────┘
##Plugin 'adobeair'
#Support for Adobe Air
┌───────────┐
│ ABOUT │
└───────────┘
##Plugin 'about' (depends: 'dialog')
COMMAND 'about' #Fires dialog 'about', which shows credits.
#Done by button 'About'
┏━━━━━━━━━━━━━┓
┃ HELPERS ┃
┗━━━━━━━━━━━━━┛
┌─────────┐
│ XML │
└─────────┘
##Plugin 'xml'
new CKEDITOR.xml('XML') #Returns XML
XML.baseXml #XML as OBJ
XML.getInnerXml('XPATH'[,CONTEXT])#
XML.selectNodes('XPATH'[,CONTEXT])#
XML.selectSingleNode
('XPATH'[, CONTEXT]) #
┌──────────┐
│ URLS │
└──────────┘
CKEDITOR.getUrl('PATH|URL') #Function resolving URLs internally used.
#If 'URL', adds CKEDITOR.timestamp (build timestamp) at the end as "?t=TIMESTAMP"
#(to bust browser caching when CKEDITOR is upgraded)
#If 'URL' or absolute 'PATH', returns it
#If relative 'PATH', appends BASEPATH
#Can override with global variable CKEDITOR_GETURL('PATH|URL')
#(if returns false|undefined, use CKEDITOR.getUrl())
CKEDITOR.basePath #BASEPATH:
# - def: where CKEDITOR is loaded (using <script> src)
# - can override with global variable CKEDITOR_BASEPATH:
# - must do it when <script> not present, i.e. when concatenating CKEDITOR library in
# a bundle
┌──────────┐
│ AJAX │
└──────────┘
##Plugin 'ajax' (depends: 'xml')
CKEDITOR.ajax.load[Xml]|post(...) #Ajax helpers used by other plugins
┏━━━━━━━━━━┓
┃ I18N ┃
┗━━━━━━━━━━┛
┌──────────┐
│ I18N │
└──────────┘
EDITOR.langCode #Current 'LANG':
# - def: CONF.language
# - def: CKEDITOR.lang.detect(CONF.defaultLanguage (def: 'en'))))
EDITOR.lang.[PLUGIN.]LANG #OBJ of translations to use
#Done at initialization, so cannot dynamically change.
CKEDITOR.lang.load #Loads BASEPATH/lang/LANG3.js, which fills CKEDITOR.lang.LANG (core translations)
('LANG'[, 'LANG2'], #Done once at initialization.
FUNC('LANG3', OBJ)) #LANG3:
# - 'LANG'
# - if null|undefined: CKEDITOR.lang.detect('LANG2'):
# - by order of priority:
# - NAVIGATOR.userLanguage|language
# - 'LANG2'
# - checks if part of supported languages (CKEDITOR.lang.languages, depends on build)
#OBJ is CKEDITOR.lang.LANG3, with also OBJ.dir 'rtl|ltr'
#Fire 'langLoaded'
PLUGIN_DEF.lang #Languages supported by the PLUGIN, as 'LANG,...'|'LANG'_ARR
#When plugin is initialized, this will load plugin translations into CKEDITOR.lang.PLUGIN.LANG:
# - load BASEPATH/plugins/PLUGIN/lang/LANG.js, which should call
# PLUGINS.setLang('PLUGIN', 'LANG', OBJ):
# - this will CKEDITOR.lang.PLUGIN.LANG = OBJ
┌──────────────┐
│ LANGUAGE │
└──────────────┘
##Plugin 'language' (depends: 'menubutton')
COMMAND 'language' #Toggle settings HTML attributes lang and dir on all <span>
#Done by MENUBUTTON 'Language' and contextMenu (MENUGROUP 'language[_remove]')
CONF.language_list #STR_ARR of 'CODE:LABEL[:rtl|ltr]', e.g. 'fr:French'
┌─────────┐
│ BDI │
└─────────┘
##Plugin 'bdi'
COMMAND 'BidiLtr|Rtl' #Change direction. Done by buttons 'ltr|rtl' (toolbar 'bidi')
EDITOR.on('dirChanged') #Fired with CEVENT.data: node DOM_NODE, dir STR
┏━━━━━━━━━━━━┓
┃ DESIGN ┃
┗━━━━━━━━━━━━┛
┌───────────┐
│ SKINS │
└───────────┘
STRUCTURE ==> #Files:
# - skin.js: logic, which must define:
# - CKEDITOR.skin.name
# - CKEDITOR.skin.ua_editor|dialog 'BROWSER,...'
# - CKEDITOR.skin.chameleon(...)
# - editor[_BROWSER].css: main CSS
# - BROWSER is loaded if ENV[BROWSER] is true
# - dialog[_BROWSER].css:
# - dialogs CSS
# - to support 'dialog' busy state, see online doc on CSS to add
# - PART.css: any other part:
# - notification.css: for 'notification' plugin (can copy from Moono skin)
# - icons/ICON.png: will override default ones provided by plugins
#Available ones depends on build
#Can be packaged (concatenates, minify, sprites) using:
# java -jar ckbuilder.jar --build-skin "SKIN" "SKIN-release"
CKEDITOR.skinName
CONF.skin #'SKIN[,SKINPATH]'
CKEDITOR.skin #SKIN
SKIN.name #'SKIN'
SKIN.path() #Returns BASEPATH/SKINPATH (def SKINPATH: "skins/SKIN/")
SKIN.getPath('PART') #Returns BASEPATH/SKINPATH/PART.css
#If SKIN.ua_PART 'ENV,...' defined, loads PATH_ENV instead, where CKEDITOR.env.ENV true
SKIN.loadPart('PART'[, FUNC()]) #Loads on demand (adds <style> tag) BASEPATH/SKINPATH/PART.css
#and (if not current SKIN) BASEPATH/SKINPATH/skin.js
#At init, does:
# - SKING.loadPart('editor')
SKINS.icons #OBJ
SKIN.addIcon('ICON', 'PATH'[, Y]
[, STR]) #STR is background-size CSS value
SKIN.getIconStyle('ICON'[, BOOL]) #Returns CSS style of 'ICON'. If true, indicates RTL.
EDITOR.uiColor #"CSS_COLOR", which will replace '$color' occurences in chameleon output
CONF.uiColor #SKIN.chameleon('EDITOR', 'PART')->'HTML' must be defined.
#Can use plugin 'uicolor' to let user define it.
EDITOR.getUIColor() #
EDITOR.setUIColor('CSS_COLOR') #
┌─────────┐
│ CSS │
└─────────┘
EXTRA CLASSES ==> #On the editor:
# - .cke_rtl: RTL
# - .cke_hc: High contrast
CSS RESET ==> #.cke_reset_all on 'normal mode', but not 'inline mode' (except toolbar)
CKEDITOR.addCss('CSS') #Adds CSS which will be on root of each EDITABLE (including EDITOR element)
CONF.contentsCss #'PATH'[_ARR] (def: getUrl('contents.css'))
EDITOR.addContentsCss('PATH') #Only in 'normal mode', for the <iframe>, or the UI float elements (in either mode)
#(e.g. buttons dropdowns)
┌─────────────┐
│ UICOLOR │
└─────────────┘
##Plugin 'uicolor' (depends: 'dialog')
COMMAND 'uicolor' #Opens dialog 'uicolor', which let user change toolbar color.
#Done by button 'UIColor' (toolbar 'tools')
┏━━━━━━━━━┓
┃ DOM ┃
┗━━━━━━━━━┛
NOTE ==> #Not all is documented.
#What can be done using jQuery or native DOM is not.
┌───────────────┐
│ DOMOBJECT │
└───────────────┘
DOM_OBJ #Wrapper around generic DOM object. Is EVENTEMITTER
DOM_OBJ.$ #ELEM
DOM_OBJ.setCustomData('KEY', VAL) #Data to be removed when processing HTML (i.e. EDITOR.getData())
#Is actually set in JavaScript, not HTML.
DOM_OBJ.getCustomData('KEY') #
DOM_OBJ.clearCustomData() #
DOM_OBJ.getUniqueId() #
┌───────────────┐
│ DOMWINDOW │
└───────────────┘
DOM_WINDOW #Wrapper around WINDOW. Child of DOM_OBJ
DOM_WINDOW.$ #WINDOW
┌─────────────────┐
│ DOMDOCUMENT │
└─────────────────┘
DOM_DOCUMENT #Wrapper around DOCUMENT. Child of DOM_OBJ
DOM_DOCUMENT.$ #DOCUMENT
DOM_DOCUMENT.getActive() #Get element with focus, or no focus but considered as 'active'
┌──────────────┐
│ DOM_NODE │
└──────────────┘
DOM_NODE #Wrapper around NODE. Child of DOM_OBJ
DOM_NODE.$ #NODE
┌──────────────────┐
│ DOM_NODELIST │
└──────────────────┘
DOM_NODELIST #Wrapper around NODELIST.
DOM_NODELIST.$ #NODELIST
DOM_NODELIST.getItem(NUM) #
DOM_NODELIST.count() #
┌─────────────────┐
│ DOM_COMMENT │
└─────────────────┘
DOM_COMMENT #Wrapper around comment NODE. Child of DOM_NODE
DOM_COMMENT.$ #Comment NODE
DOM_COMMENT.getOuterHtml() #'<!--...-->'
┌──────────────┐
│ DOM_TEXT │
└──────────────┘
DOM_TEXT #Wrapper around text NODE. Child of DOM_NODE
DOM_TEXT.$ #Text NODE
DOM_TEXT.getText() #
DOM_TEXT.setText(STR) #
┌──────────────┐
│ DOM_ELEM │
└──────────────┘
DOM_ELEM #Wrapper around ELEM. Child of DOM_NODE
DOM_ELEM.$ #ELEM
CKEDITOR.dom.element.setMarker #Like DOM_ELEM.setCustomData('KEY', VAL), except can cleanup with
(OBJ, DOM_ELEM, 'KEY', VAL) #CKEDITOR.dom.element.clearMarkers(OBJ, DOM_ELEM, 'KEY') or
#CKEDITOR.dom.element.clearAllMarkers(OBJ)
CKEDITOR.dom.element.
createFromHtml('HTML') #Returns DOM_ELEM
┌──────────────┐
│ EDITABLE │
└──────────────┘
CKEDITOR.editable #EDITABLE, child of DOM_ELEM
#Is a custom <textarea>-like
EDITABLE.editor #EDITOR
EDITABLE.attachClass('CLASS') #Adds temporary CLASS
EDITABLE.changeAttr('ATTR', VAL) #Temporarily change HTML attribute value
EDITABLE.detach() #Makes it not editable anymore, removing temporary things
EDITABLE.setData|getData(...) #See EDITOR.setData|getData(...)
EDITABLE.insertHtml|Text|Element
(...) #See EDITOR.insertHtml|Text|Element(...)
EDITABLE.insertHtmlIntoRange
('HTML', DOM_RANGE) #
EDITABL.insertElementIntoSelection
(DOM_ELEM) #
EDITABL.insertElementIntoRange
(DOM_ELEM, DOM_RANGE) #
DOM_ELEM.isEditable() #
┌──────────────────┐
│ DOM_FRAGMENT │
└──────────────────┘
DOM_FRAGMENT #Wrapper around FRAGMENT
DOM_FRAGMENT.$ #FRAGMENT
DOM_FRAGMENT.getHtml() #'HTML'
┌───────────────┐
│ DOM_EVENT │
└───────────────┘
DOM_EVENT #Wrapper around EVENT
DOM_EVENT.$ #EVENT
┌──────────────┐
│ DOM_PATH │
└──────────────┘
DOM_PATH #List of DOM_ELEM, parents to a given DOM_ELEM
EDITOR.elementPath(DOM_NODE) #DOM_PATH
DOM_PATH.elements #DOM_ELEM_ARR
DOM_PATH.root|lastElement #From DOM_PATH.elements
DOM_PATH.block #First splittable block DOM_ELEM in path
DOM_PATH.blockLimit #First block DOM_ELEM which can contain other blocks
DOM_PATH.direction() #'ltr|rtl'
DOM_PATH.compare(DOM_PATH2) #Do they target same elements (using ===)
DOM_PATH.contains
(DOM_ELEM|'TAG'[_ARR]|{ TAG ... }|
FUNC(DOM_NODE)->BOOL #If BOOL2 true, excludes root node.
[, BOOL2[, BOOL3]]) #If BOOL3 true, start search from top instead of bottom.
┌──────────────────┐
│ DOM_ITERATOR │
└──────────────────┘
new DOM_ITERATOR(DOM_RANGE) #
DOM_ITERATOR.range #DOM_RANGE
DOM_ITERATOR.getNextParagraph #Returns next paragraph-like P_ELEM, or null.
(['TAG']) #In block-less elements, use parent 'TAG' (def: 'p')
DOM_ITERATOR.enforceRealBlocks #If true, create blocks when necessary
DOM_ITERATOR.enlargeBr #If true, create <br> when necessary
DOM_ITERATOR.forceBrBreak #
DOM_ITERATOR.[active]Filter #FILTER
┌────────────────┐
│ DOM_WALKER │
└────────────────┘
DOM_WALKER #Walker along DOM_NODE
┏━━━━━━━━┓
┃ UI ┃
┗━━━━━━━━┛
EDITOR.createRange() #DOM_RANGE
CONF.baseFloatZIndex #Def: 1000
#E.g. used by PANEL
┌────────┐
│ UI │
└────────┘
EDITOR.ui #UI. Is an EVENTEMITTER
UI.editor #EDITOR
UITYPE #Builtin: CKEDITOR.UI_BUTTON|MENUBUTTON|PANEL|PANEL_BUTTON|RICHCOMBO|SEPARATOR,
UI.addHandler(UITYPE, HANDLER_OBJ)#Adds a new UITYPE. HANDLER_OBJ:
# - create(OBJ2[, ...])->DOM_ELEM
UI.add('NAME', UITYPE, OBJ[, ...])#Registers new UI object with UITYPE and definition OBJ:
# - command 'COMMAND': allow tracking COMMAND.uiItems UI_OBJ_ARR
# - args [OBJ, ...]: passed to HANDLER_OBJ.create(...)
#When ready, fires 'ready'
# - contentsElement DOM_ELEM2: container
UI.create('NAME') #Creates new UI object:
# - fires|returns HANDLER_OBJ.create(UI_OBJ.args...)->UI_OBJ (with UI as this)
# - UI_OBJ.type UITYPE automatically set
# - UI_OBJ.render(EDITOR, ARR)->'HTML' should be defined (push 'HTML' to ARR if defined)
UI.get('NAME')->UI_OBJ #
UI.space('bottom|contents|top') #Returns UI container for main UI elements, i.e. bottom|top bars and content.
UI.spaceId('...') #Same but returns ID
┌───────────┐
│ PANEL │
└───────────┘
##Plugin 'panel'
#Lower-level UI used by toolbar
CKEDITOR.PANEL #UITYPE with HANDLER_OBJ.create(PANEL_OBJ)->PANEL
#Is:
# div .cke.cke_reset_all.cke_panel[.PANEL_OBJ.className]
# [<iframe><html>]: see below
PANEL #DOM_ELEM
PANEL.id #
PANEL.document #DOM_DOCUMENT
PANEL_OBJ.forceIFrame #BOOL (def: false). Use an <iframe>
PANEL_OBJ.css #STR_ARR
PANEL.isFramed #
PANEL.addBlock('BLOCK', BLOCK_DEF)#Adds and show BLOCK, i.e:
# div .cke_panel_block
#BLOCK_DEF:
# - attributes: role (def: 'presentation'), 'aria-label', title (def: same as 'aria-label')
#Can navigate through blocks with keyboard.
#Returns BLOCK
PANEL.getBlock('BLOCK')->BLOCK #
PANEL.destroy() #
BLOCK.markItem(NUM) #Mark as activated
BLOCK.onMark(ELEM) #When activated
BLOCK.show|hide() #
BLOCK.onHide(BLOCK)->BOOL #If true, does not hide.
┌────────────────┐
│ FLOATPANEL │
└────────────────┘
##Plugin 'floatpanel' (depends: 'panel')
#Lower-level UI used by dropdowns, PANEL child.
new CKEDITOR.ui.floatPanel(EDITOR,#DOM_ELEM is parent container (def if FLOATPANEL_DEF.toolbarRelated true: toolbar)
DOM_ELEM, FLOATPANEL_DEF, NUM) #Creates new FLOATPANEL (with forceIFrame true)
FLOATPANEL.element #DOM_ELEM2 (actual panel)
FLOATPANEL.showBlock('BLOCK', #DOM_ELEM is offset parent, NUM is 1|2|3|4 for different corners.
DOM_ELEM, NUM[, X][, Y][, FUNC()])#FUNC is done callback.
FLOATPANEL.showAsChild
(FLOATPANEL2, ...) #Using FLOATPANEL2.showBlock(...)
FLOATPANEL.reposition() #Put in same position as last showBlock()
FLOATPANEL.hide[Child]() #
┌───────────────┐
│ LISTBLOCK │
└───────────────┘
##Plugin 'listblock' (depends: 'panel')
#Allow adding lists to FLOATPANEL
FLOATPANEL.addListBlock #Does a FLOATPANEL.addBlock(...), where BLOCK is:
('LIST_BLOCK', LISTBLOCK_DEF) # h1
# ul
# l1
#LISTBLOCK_DEF:
# - multiSelect BOOL
LISTBLOCK.add('ITEM', 'HTML',
'TITLE') #Adds new item
LISTBLOCK.startGroup('GROUP') #
LISTBLOCK.onClick('ITEM', BOOL) #BOOL is whether selected
LISTBLOCK.hideGroup('GROUP') #
LISTBLOCK.hideItem('ITEM') #
LISTBLOCK.showAll() #
LISTBLOCK.toggle('ITEM') #Toggle whether an item is selected
LISTBLOCK.[un]mark('ITEM') #
LISTBLOCK.unmarkAll() #
LISTBLOCK.isMarked() #
LISTBLOCK.focus('ITEM') #
LISTBLOCK.commit() #Appends final HTML to FLOATPANEL.element
┌──────────┐
│ MENU │
└──────────┘
##Plugin 'menu' (depends: 'floatpanel')
#Lower-level UI used by dropdowns
CONF.menu_subMenuDelay #Delay before showing menu options (def: 400)
EDITOR.addMenuGroup('NAME', NUM) #
EDITOR.
new CKEDITOR.menu(EDITOR,MENU_DEF)#MENU_DEF:
# - block.attributes or attributes:
# - role (def: 'menu')
# - used as FLOATPANEL_DEF
MENU.add(MENUITEM) #
MENU.removeAll() #
MENU.show(DOM_ELEM, NUM, X, Y) #See FLOATPANEL.showBlock()
#Fires EDITOR 'menuShow' with CEVENT.data panel [PANEL]
MENU.hide() #
MENU.addListener #Add|remove elements to some context menu
(FUNC(DOM_ELEM, DOM_SELECTION, #Fired when the PANEL is shown, to get list of MENUITEM to show.
DOM_PATH)) #Should return { 'MENUITEM': CKEDITOR.TRISTATE_* }
new CKEDITOR.menuItem #Is:
(EDITOR, 'NAME', MENUITEM_DEF) # span.cke_menuitem
MENUITEM.order #NUM
MENUITEM.group #'MENUGROUP' (like order, but higher priority)
#Order is taken from:
# - CONF.menu_groups 'MENUGROUP,...'
# - EDITOR.addMenuGroup('MENUGROUP'[, NUM])
MENUITEM.name #STR
MENUITEM.label #STR
MENUITEM.className #STR
MENUITEM.icon #'ICON' (def: MENUITEM.name)
MENUITEM.getItems() #MENUITEM_DEF_ARR, for submenu
MENUITEM.onClick() #Def: EDITOR.execCommand(MENUITEM.command)
┌─────────────────┐
│ CONTEXTMENU │
└─────────────────┘
##Plugin 'contextmenu' (depends: 'menu')
EDITOR.contextMenu #Underlying MENU, replacing native context menu.
COMMAND 'contextMenu' #Opens context menu. Also done on Shift-F10
DOM_ELEM.disableContextMenu() #
EDITOR.addMenuItem
('MENUITEM', MENUITEM_DEF) #
EDITOR.addMenuItems
(MENUITEM_DEF_ARR) #
EDITOR.getMenuItem('MENUITEM') #
EDITOR.removeMenuItem('MENUITEM') #
CONF.browserContextMenuOnCtrl #If false, do not show when pressing 'Ctrl' + click
┌────────────┐
│ BUTTON │
└────────────┘
##Plugins 'button'
CKEDITOR.UI_BUTTON #UITYPE, with HANDLER_OBJ.create(BUTTON_DEF)
#Will use SKIN.getIconStyle('BUTTON')
UI.addButton('BUTTON', BUTTON_DEF)#Same as UI.add('BUTTON', CKEDITOR.UI_BUTTON, BUTTON_DEF)
BUTTON_DEF.label #STR
BUTTON_DEF.title #STR (def: BUTTON_DEF.label)
BUTTON_DEF.click(EDITOR) #Def: EDITOR.execCommand(BUTTON_DEF.command)
BUTTON_DEF.toolbar #'BUTTON_GROUP[,NUM]'
BUTTON_DEF.bidirectional #BOOL
BUTTON_DEF.className #STR
BUTTON_DEF.hasArrow #BOOL
BUTTON.setState(STATE) #See COMMAND.setState(STATE)
BUTTON.getState() #
┌─────────────────┐
│ PANELBUTTON │
└─────────────────┘
##Plugin 'panelbutton' (depends: 'button')
#Buttons opening a FLOATPANEL (e.g. 'colorbutton')
#PANELBUTTON is child of BUTTON
CKEDITOR.UI_PANELBUTTON #UITYPE, with HANDLER_OBJ.create(PANELBUTTON_DEF)
#PANELBUTTON_DEF:
# - panel FLOATPANEL_DEF, with also:
# - parent DOM_ELEM (def: <body>)
# - block BLOCK_DEF: only block of the new FLOATPANEL
# - hasArrow is true
# - on click, create FLOATPANEL
PANELBUTTON.onOpen|Close() #
PANELBUTTON.onBlock(PANEL, BLOCK) #
┌────────────────┐
│ MENUBUTTON │
└────────────────┘
##Plugin 'menubutton' (depends: 'menu', 'button')
#Buttons opening a MENU (e.g. 'language')
#MENUBUTTON is child of BUTTON
CKEDITOR.UI_MENUBUTTON #UITYPE, with HANDLER_OBJ.create(MENUBUTTON_DEF)
#MENUBUTTON_DEF:
# - hasArrow is true
# - on click, create MENU
# - onMenu(...): use MENU.addListener(onMenu)
┌───────────────┐
│ RICHCOMBO │
└───────────────┘