1 | /*
|
---|
2 | Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
|
---|
3 | For licensing, see LICENSE.html or http://ckeditor.com/license
|
---|
4 | */
|
---|
5 |
|
---|
6 | /**
|
---|
7 | * @fileOverview API initialization code.
|
---|
8 | */
|
---|
9 |
|
---|
10 | (function()
|
---|
11 | {
|
---|
12 | // Disable HC detaction in WebKit. (#5429)
|
---|
13 | if ( CKEDITOR.env.webkit )
|
---|
14 | {
|
---|
15 | CKEDITOR.env.hc = false;
|
---|
16 | return;
|
---|
17 | }
|
---|
18 |
|
---|
19 | // Check is High Contrast is active by creating a temporary element with a
|
---|
20 | // background image.
|
---|
21 |
|
---|
22 | var useSpacer = CKEDITOR.env.ie && CKEDITOR.env.version < 7,
|
---|
23 | useBlank = CKEDITOR.env.ie && CKEDITOR.env.version == 7;
|
---|
24 |
|
---|
25 | var backgroundImageUrl = useSpacer ? ( CKEDITOR.basePath + 'images/spacer.gif' ) :
|
---|
26 | useBlank ? 'about:blank' : 'data:image/png;base64,';
|
---|
27 |
|
---|
28 | var hcDetect = CKEDITOR.dom.element.createFromHtml(
|
---|
29 | '<div style="width:0px;height:0px;' +
|
---|
30 | 'position:absolute;left:-10000px;' +
|
---|
31 | 'background-image:url(' + backgroundImageUrl + ')"></div>', CKEDITOR.document );
|
---|
32 |
|
---|
33 | hcDetect.appendTo( CKEDITOR.document.getHead() );
|
---|
34 |
|
---|
35 | // Update CKEDITOR.env.
|
---|
36 | // Catch exception needed sometimes for FF. (#4230)
|
---|
37 | try
|
---|
38 | {
|
---|
39 | CKEDITOR.env.hc = ( hcDetect.getComputedStyle( 'background-image' ) == 'none' );
|
---|
40 | }
|
---|
41 | catch (e)
|
---|
42 | {
|
---|
43 | CKEDITOR.env.hc = false;
|
---|
44 | }
|
---|
45 |
|
---|
46 | if ( CKEDITOR.env.hc )
|
---|
47 | CKEDITOR.env.cssClass += ' cke_hc';
|
---|
48 |
|
---|
49 | hcDetect.remove();
|
---|
50 | })();
|
---|
51 |
|
---|
52 | // Load core plugins.
|
---|
53 | CKEDITOR.plugins.load( CKEDITOR.config.corePlugins.split( ',' ), function()
|
---|
54 | {
|
---|
55 | CKEDITOR.status = 'loaded';
|
---|
56 | CKEDITOR.fire( 'loaded' );
|
---|
57 |
|
---|
58 | // Process all instances created by the "basic" implementation.
|
---|
59 | var pending = CKEDITOR._.pending;
|
---|
60 | if ( pending )
|
---|
61 | {
|
---|
62 | delete CKEDITOR._.pending;
|
---|
63 |
|
---|
64 | for ( var i = 0 ; i < pending.length ; i++ )
|
---|
65 | CKEDITOR.add( pending[ i ] );
|
---|
66 | }
|
---|
67 | });
|
---|
68 |
|
---|
69 | /*
|
---|
70 | TODO: Enable the following and check if effective.
|
---|
71 |
|
---|
72 | if ( CKEDITOR.env.ie )
|
---|
73 | {
|
---|
74 | // Remove IE mouse flickering on IE6 because of background images.
|
---|
75 | try
|
---|
76 | {
|
---|
77 | document.execCommand( 'BackgroundImageCache', false, true );
|
---|
78 | }
|
---|
79 | catch (e)
|
---|
80 | {
|
---|
81 | // We have been reported about loading problems caused by the above
|
---|
82 | // line. For safety, let's just ignore errors.
|
---|
83 | }
|
---|
84 | }
|
---|
85 | */
|
---|
86 |
|
---|
87 | /**
|
---|
88 | * Fired when a CKEDITOR core object is fully loaded and ready for interaction.
|
---|
89 | * @name CKEDITOR#loaded
|
---|
90 | * @event
|
---|
91 | */
|
---|