Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Lenya Wiki" for change 
notification.

The following page has been changed by JörnNettingsmeier:
http://wiki.apache.org/lenya/GenericEditorAPI

------------------------------------------------------------------------------
  
  writeme!
  
+ == WYSIWYG ==
+ 
+ If you're keen to provide true WYSIWYG editing, you must delegate the 
rendering of the page to the publication sitemap, since your editor module 
cannot know about the correct rendering.
+ This can be accomplished by mounting the publication sitemap into the editor 
sitemap.
+ You can then take the output of the publication pipeline and apply 
editor-specific pre-processing (such as adding javascript code or working 
around editor-specific quirks).
+ 
+ Under no circumstances should you hack any workarounds into global sitemaps 
or publication resources.
+ 
+ A possible approach (taken from the tinymce module) is this:
+ 
+ {{{
+     <map:pipeline internal-only="yes">
+ 
+       <!-- when editing, the page should look exactly like the original, and 
since
+            we cannot know anything about the pipelines used for rendering, we 
must
+            delegate the job to the publication's own sitemap. -->
+ 
+       <map:match pattern="tinymce.delegateToPubSitemap/**">
+         <map:mount 
src="{fallback:{page-envelope:publication-id}:sitemap.xmap}" 
uri-prefix="tinymce.delegateToPubSitemap"/>
+       </map:match>
+ 
+       <!-- the usecase framework provides error and info messages. since we 
bypass
+            the jxtemplate view mechanism, we must include them by hand. -->
+ 
+       <map:match pattern="tinymce.getUsecaseMessages">
+         <map:generate type="jx" 
src="fallback://lenya/modules/usecase/templates/messages.jx"/>
+         <map:transform type="i18n">
+           <map:param name="locale" value="[request:locale}"/>
+         </map:transform>
+         <map:transform src="context://lenya/xslt/util/strip_namespaces.xsl"/>
+         <map:serialize type="xml"/>
+       </map:match>
+     </map:pipeline>
+ 
+     <map:pipeline>
+ 
+       <!-- this is the view of the usecase (see 
config/cocoon-xconf/usecases.xconf) -->
+ 
+       <map:match pattern="tinymce.edit">
+         <!-- check if TinyMCE is installed -->
+         <map:select type="resource-exists">
+           <!-- render page with tinymce inserted -->
+           <map:when 
test="fallback://lenya/modules/tinymce/resources/tinymce/jscripts/tiny_mce/tiny_mce.js">
+             <map:aggregate element="tinymceWrapper">
+               <map:part 
src="cocoon:/tinymce.delegateToPubSitemap/authoring{page-envelope:document-url}"/>
+               <map:part src="cocoon:/tinymce.getUsecaseMessages"/>
+             </map:aggregate>
+             <map:transform 
src="fallback://lenya/modules/tinymce/xslt/page2edit.xsl">
+               <map:parameter name="contextPath" value=""/>
+               <map:parameter name="continuationId" 
value="{flow-continuation:id}"/>
+               <map:parameter name="usecaseName" 
value="{request-param:lenya.usecase}"/>
+               <map:parameter name="publicationid" 
value="{page-envelope:publication-id}"/>
+             </map:transform>
+           </map:when>
+           <!-- TinyMCE is not installed - generate info page for the user -->
+           <map:otherwise>
+             <map:generate 
src="fallback://lenya/modules/tinymce/resources/misc/download.xml"/>
+           </map:otherwise>
+         </map:select>
+         <map:call resource="style-cms-page"/>
+         <map:serialize type="xhtml"/>
+       </map:match>
+  
+     </map:pipeline>
+ 
+ }}}
+ 
+ FIXME: This sitemap duplicates the "style-cms-page" resource. It would be 
great if such resources could be provided just once by a global sitemap and 
then included, but resources of other sitemaps are not accessible. If anyone 
has an idea how to factor this out, let me know.
+ 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to