Re: [Hypercontent-users] HyperContent 2 content editor
Brought to you by:
alexvigdor
From: Alex V. <av...@co...> - 2005-11-21 18:19:46
|
Carl, Well, here's a stab at it using the built-in callbacks in TinyMCE. Seems to work OK, except when you click an image in the WYSIWYG it disappears. The advantage of this approach is it requires no changes to the core TinyMCE code, which is nice. You can read more about TinyMCE configuration and callbacks at http://tinymce.moxiecode.com/tinymce/docs/reference_configuration.html <script language="javascript" type="text/javascript" src="{$rel-server-base}/js/tiny_mce/tiny_mce.js"></script> <script language="javascript" type="text/javascript"> base_url = '<xsl:value-of select="$abs-project-base"/>'; function HCconvertURL(url, node, on_save) { var index = url.indexOf(base_url); if(on_save && index==0){ url = url.substring(base_url.length); } else if(!on_save && index!=0 && url.indexOf("/")==0){ url = base_url+url; } return url; } function HCCleanup(type, value) { switch (type) { case "get_from_editor": break; case "insert_to_editor": break; case "get_from_editor_dom": var nl = value.getElementsByTagName('img'); for(var i=0;i < nl.length;i++){ nl.item(i).setAttribute('src',HCconvertURL(nl.item(i).getAttribute('src' ),null,true)); } nl = value.getElementsByTagName('a'); for(var i=0;i < nl.length;i++){ nl.item(i).setAttribute('href',HCconvertURL(nl.item(i).getAttribute('hre f'),null,true)); } break; case "insert_to_editor_dom": var nl = value.getElementsByTagName('img'); for(var i=0;i < nl.length;i++){ nl.item(i).setAttribute('src',HCconvertURL(nl.item(i).getAttribute('src' ),null,false)); } nl = value.getElementsByTagName('a'); for(var i=0;i < nl.length;i++){ nl.item(i).setAttribute('href',HCconvertURL(nl.item(i).getAttribute('hre f'),null,false)); } break; } return value; } tinyMCE.init({ mode : "textareas", verify_html : false, urlconverter_callback : "HCconvertURL", cleanup_callback : "HCCleanup" }); </script> On Nov 21, 2005, at 11:58 AM, Carl Barrow wrote: > Thanks very much Alex, > Thats working great. How easy do you think it will be to tweak the > TinyMCE code to get the links and images working and do you have any > pointers as to where we might start? > > Cheers > Carl > > Alex Vigdor wrote: > >> Hi Carl, >> An upgrade to the XML/WYSIWYG editor is definitely on our radar >> at this point, with the 2.0 development cycle coming to its end. >> We're looking probably at a rewrite of the whole thing, not just >> swapping in a new WYSIWYG, so it may take a couple months. You can >> actually swap in TinyMCE very easily - in "/screens/modal-xml.xsl" >> there's an xsl:if block at lines 69-123. You can replace the >> contents of that if block with >> >> <script language="javascript" type="text/javascript" >> src="{$rel-server-base}/js/tiny_mce/tiny_mce.js"></script> >> <script language="javascript" type="text/javascript"> >> tinyMCE.init({ >> mode : "textareas", >> cleanup : false, >> verify_html : false >> }); >> </script> >> >> And that's all it takes to get it to come up. The only problem is >> that it will need some tweaking inside the TinyMCE code to maintain >> links and images the way HC likes them, as the project paths rather >> than full URLs. >> >> Cheers, >> Alex >> >> On Nov 21, 2005, at 10:20 AM, Carl Barrow wrote: >> >>> Hi Alex >>> >>> We have been looking at dropping a new editor into HyperContent 2. >>> TinyMCE seems to do everything we need. Are you looking at adding a >>> new editor in the near future or is it more of a long term feature? >>> >>> Carl >>> >>> -- >>> ************************************ >>> >>> Carl Barrow >>> Systems Integrator >>> e-Services >>> The University of Hull >>> Cottingham Road >>> Hull >>> HU6 7RX >>> Ext. 6838 >>> ************************************ >>> >>> >>> >>> ------------------------------------------------------- >>> This SF.Net email is sponsored by the JBoss Inc. Get Certified Today >>> Register for a JBoss Training Course. Free Certification Exam >>> for All Training Attendees Through End of 2005. For more info visit: >>> http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click >>> _______________________________________________ >>> Hypercontent-users mailing list >>> Hyp...@li... >>> https://lists.sourceforge.net/lists/listinfo/hypercontent-users >> >> >> >> >> ------------------------------------------------------- >> This SF.Net email is sponsored by the JBoss Inc. Get Certified Today >> Register for a JBoss Training Course. Free Certification Exam >> for All Training Attendees Through End of 2005. For more info visit: >> http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click >> _______________________________________________ >> Hypercontent-users mailing list >> Hyp...@li... >> https://lists.sourceforge.net/lists/listinfo/hypercontent-users > > > -- > ************************************ > > Carl Barrow > Systems Integrator > e-Services > The University of Hull > Cottingham Road > Hull > HU6 7RX > Ext. 6838 > ************************************ > > > > ------------------------------------------------------- > This SF.Net email is sponsored by the JBoss Inc. Get Certified Today > Register for a JBoss Training Course. Free Certification Exam > for All Training Attendees Through End of 2005. For more info visit: > http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click > _______________________________________________ > Hypercontent-users mailing list > Hyp...@li... > https://lists.sourceforge.net/lists/listinfo/hypercontent-users |