equal
deleted
inserted
replaced
14 this.object = ( typeof(id) == 'object' ) ? id : document.getElementById(id); |
14 this.object = ( typeof(id) == 'object' ) ? id : document.getElementById(id); |
15 if ( !this.object ) |
15 if ( !this.object ) |
16 { |
16 { |
17 console.warn('Dynano: requested object is bad. id parameter follows.'); |
17 console.warn('Dynano: requested object is bad. id parameter follows.'); |
18 console.debug(id); |
18 console.debug(id); |
19 console.debug(tinyMCE.getInstanceById(id)); |
|
20 this.object = false; |
19 this.object = false; |
21 return this; |
20 return this; |
22 } |
21 } |
23 this.height = __DNObjGetHeight(this.object); |
22 this.height = __DNObjGetHeight(this.object); |
24 this.width = __DNObjGetWidth(this.object); |
23 this.width = __DNObjGetWidth(this.object); |
25 |
24 |
26 if ( this.object.tagName == 'TEXTAREA' && typeof(tinyMCE) == 'object' ) |
25 if ( this.object.tagName == 'TEXTAREA' && ( typeof(tinyMCE) == 'object' || typeof(tinyMCE_GZ) == 'object' ) ) |
27 { |
26 { |
28 this.object.dnIsMCE = 'no'; |
27 this.object.dnIsMCE = 'no'; |
29 this.switchToMCE = DN_switchToMCE; |
28 this.switchToMCE = DN_switchToMCE; |
30 this.destroyMCE = DN_destroyMCE; |
29 this.destroyMCE = DN_destroyMCE; |
31 this.getContent = DN_mceFetchContent; |
30 this.getContent = DN_mceFetchContent; |
106 this.object.value = DN_WikitextToXHTML(this.object.value); |
105 this.object.value = DN_WikitextToXHTML(this.object.value); |
107 } |
106 } |
108 // If tinyMCE init hasn't been called yet, do it now. |
107 // If tinyMCE init hasn't been called yet, do it now. |
109 if ( !tinymce_initted ) |
108 if ( !tinymce_initted ) |
110 { |
109 { |
|
110 console.info('$().switchToMCE(): doing "exact"-type MCE init'); |
111 enano_tinymce_options.mode = 'exact'; |
111 enano_tinymce_options.mode = 'exact'; |
112 enano_tinymce_options.elements = this.object.id; |
112 enano_tinymce_options.elements = this.object.id; |
113 initTinyMCE(); |
113 initTinyMCE(); |
114 this.object.dnIsMCE = 'yes'; |
114 this.object.dnIsMCE = 'yes'; |
115 return true; |
115 return true; |
116 } |
116 } |
117 else |
117 else |
118 { |
118 { |
119 tinyMCE.execCommand("mceAddControl", true, this.object.id); |
119 console.info('$().switchToMCE(): tinyMCE already loaded, calling mceAddControl'); |
|
120 tinymce.EditorManager.execCommand("mceAddControl", true, this.object.id); |
120 this.object.dnIsMCE = 'yes'; |
121 this.object.dnIsMCE = 'yes'; |
121 } |
122 } |
122 return this; |
123 return this; |
123 } |
124 } |
124 |
125 |
127 //if ( !this.object.dn_is_mce ) |
128 //if ( !this.object.dn_is_mce ) |
128 // return this; |
129 // return this; |
129 if ( this.object.id ) |
130 if ( this.object.id ) |
130 { |
131 { |
131 // TinyMCE 2.x |
132 // TinyMCE 2.x |
132 // tinyMCE.removeMCEControl(this.object.name); |
133 // tinymce.EditorManager.removeMCEControl(this.object.name); |
133 // TinyMCE 3.x |
134 // TinyMCE 3.x |
134 var ed = tinyMCE.getInstanceById(this.object.id); |
135 var ed = tinymce.EditorManager.getInstanceById(this.object.id); |
135 if ( ed ) |
136 if ( ed ) |
136 { |
137 { |
137 if ( !tinyMCE.execCommand("mceRemoveEditor", false, this.object.id) ) |
138 if ( !tinymce.EditorManager.execCommand("mceRemoveEditor", false, this.object.id) ) |
138 alert('could not destroy editor'); |
139 alert('could not destroy editor'); |
139 if ( performWikiTransform ) |
140 if ( performWikiTransform ) |
140 { |
141 { |
141 this.object.value = DN_XHTMLToWikitext(this.object.value); |
142 this.object.value = DN_XHTMLToWikitext(this.object.value); |
142 } |
143 } |
149 function DN_mceFetchContent() |
150 function DN_mceFetchContent() |
150 { |
151 { |
151 if ( this.object.name ) |
152 if ( this.object.name ) |
152 { |
153 { |
153 var text = this.object.value; |
154 var text = this.object.value; |
154 if ( tinyMCE.get(this.object.id) ) |
155 if ( tinymce.EditorManager.get(this.object.id) ) |
155 { |
156 { |
156 var editor = tinyMCE.get(this.object.id); |
157 var editor = tinymce.EditorManager.get(this.object.id); |
157 text = editor.getContent(); |
158 text = editor.getContent(); |
158 } |
159 } |
159 return text; |
160 return text; |
160 } |
161 } |
161 else |
162 else |
167 function DN_mceSetContent(text) |
168 function DN_mceSetContent(text) |
168 { |
169 { |
169 if ( this.object.name ) |
170 if ( this.object.name ) |
170 { |
171 { |
171 this.object.value = text; |
172 this.object.value = text; |
172 if ( tinyMCE.get(this.object.id) ) |
173 if ( tinymce.EditorManager.get(this.object.id) ) |
173 { |
174 { |
174 var editor = tinyMCE.get(this.object.id); |
175 var editor = tinymce.EditorManager.get(this.object.id); |
175 editor.setContent(text); |
176 editor.setContent(text); |
176 } |
177 } |
177 } |
178 } |
178 else |
179 else |
179 { |
180 { |