diff -r cddc2ba706d6 -r 860ba7141641 scripts/domutils.js --- a/scripts/domutils.js Sun Mar 23 15:24:06 2008 -0400 +++ b/scripts/domutils.js Sun Mar 23 20:24:33 2008 -0400 @@ -11,23 +11,11 @@ this.object = ( typeof(id) == 'object' ) ? id : document.getElementById(id); if ( !this.object ) { - console.warn('Dynano: requested object is bad. id parameter follows.'); - console.debug(id); - console.debug(tinyMCE.getInstanceById(id)); this.object = false; return this; } this.height = __DNObjGetHeight(this.object); this.width = __DNObjGetWidth(this.object); - - if ( this.object.tagName == 'TEXTAREA' && typeof(tinyMCE) == 'object' ) - { - this.object.dnIsMCE = 'no'; - this.switchToMCE = DN_switchToMCE; - this.destroyMCE = DN_destroyMCE; - this.getContent = DN_mceFetchContent; - this.setContent = DN_mceSetContent; - } } function __DNObjGetHeight(o) { return o.offsetHeight; @@ -91,114 +79,6 @@ return left_offset; } -function DN_switchToMCE(performWikiTransform) -{ - if ( !this.object.id ) - this.object.id = 'textarea_' + Math.floor(Math.random() * 1000000); - if ( !this.object.name ) - this.object.name = 'textarea_' + Math.floor(Math.random() * 1000000); - // Updated for TinyMCE 3.x - if ( performWikiTransform ) - { - this.object.value = DN_WikitextToXHTML(this.object.value); - } - // If tinyMCE init hasn't been called yet, do it now. - if ( !tinymce_initted ) - { - enano_tinymce_options.mode = 'exact'; - enano_tinymce_options.elements = this.object.id; - initTinyMCE(); - this.object.dnIsMCE = 'yes'; - return true; - } - else - { - tinyMCE.execCommand("mceAddControl", true, this.object.id); - this.object.dnIsMCE = 'yes'; - } - return this; -} - -function DN_destroyMCE(performWikiTransform) -{ - //if ( !this.object.dn_is_mce ) - // return this; - if ( this.object.id ) - { - // TinyMCE 2.x - // tinyMCE.removeMCEControl(this.object.name); - // TinyMCE 3.x - var ed = tinyMCE.getInstanceById(this.object.id); - if ( ed ) - { - if ( !tinyMCE.execCommand("mceRemoveEditor", false, this.object.id) ) - alert('could not destroy editor'); - if ( performWikiTransform ) - { - this.object.value = DN_XHTMLToWikitext(this.object.value); - } - } - } - this.object.dnIsMCE = 'no'; - return this; -} - -function DN_mceFetchContent() -{ - if ( this.object.name ) - { - var text = this.object.value; - if ( tinyMCE.get(this.object.id) ) - { - var editor = tinyMCE.get(this.object.id); - text = editor.getContent(); - } - return text; - } - else - { - return this.object.value; - } -} - -function DN_mceSetContent(text) -{ - if ( this.object.name ) - { - this.object.value = text; - if ( tinyMCE.get(this.object.id) ) - { - var editor = tinyMCE.get(this.object.id); - editor.setContent(text); - } - } - else - { - this.object.value = text; - } -} - -// A basic Wikitext to XHTML converter -function DN_WikitextToXHTML(text) -{ - text = text.replace(/^===[\s]*(.+?)[\s]*===$/g, '