Macros in the Wysiwyg editor intimidate users

Create an API to make macros interactive objects in the editor

Perhaps this functionality would ultimately go in WysiwygPlugin, but could be developed in a separate plugin to be merged later if it ever becomes stable.

The idea is that plugins that register macros (such as BibliographyPlugin's %<nop>CITE{"foo"}% and %<nop>BIBLIOGRAPHY{"BibTopic"}%) could also register special javascript and rest services to help these macros become user friendly interactive objects in the editor.

At a minimum, a formalised macro specification should be able to give context sensitive help/autocomplete on the macro itself "for free".

Possibilities

  • WYSIWYG editor might be able to do more than just display bareword macro. Actually the possibilities are fun to think about:
    • At a minimum, should be able to automatically provide useful autocomplete or context sensitive help/doc links/dropdowns similar to common programming IDEs
    • Desirable (ordered roughly by feasibility):
      • Display a list of available (documented) macros and variables to choose from.
      • %INCLUDE{...}% on mouseover might offer an edit link to the included topic, or a button to expand out with the included topic as a read-only div
      • %STARTSECTION{"foo"}% on mouseover might offer a link to jump to the matching %ENDSECTION%
      • BibliographyPlugin might want to auto-complete on %CITE{"ref"}%, not just a drop-down of what refs are already defined but also what they look like, and provide a quick-link to edit the bibligraphy table or automagically add to it
      • %TOC% might want to render the TOC as it looked in the current topic version and also become a complex div/ajax object with user friendly dialogues instead of macro arguments
      • ImagePlugin might want to be a complex ajax div/object in the editor instead of (as well as?) just presenting itself as %IMAGE{...}%, on which somebody can interact with it via useful dialogues
      • %SEARCH{...}% might offer a nice real-time interactive ajax gui which renders either as a plain list of matching topics when editing the search expression or a preview of the formatted output when editing the format strings

Issues

This is hard:
  • Targeting multiple wysiwyg editors in a generic way
  • API to accomdoate macros that want to render read-only or interactive or partial "previews" in an edit context
  • Leverage macro spec as much as possible to avoid too much extra work for plugin authors

See also

-- PaulHarvey - 03 Jan 2010

Discussion

First step is wrapping various TML elements (output of macros, for instance) in specially classed DIVs, Eg, I want something like this done in TML2HTML and Render.pm:

%INCLUDE{"Foo"}%
becomes
<div class="foswikiMacro INCLUDE" (jqMeta about the parameters) id="foswikiPurpleNo1"> (... contents of Foo ...) </div>

And other elements too:
---++ Some Heading
becomes
<h6 class="foswikiTML" id="foswikiPurpleNo241">Some Heading</h6>

and

   * a
   * b
      * ba
becomes
<ul class="foswikiTML" id="foswikiPurpleNo342">
   <li class="foswikiTML" id="foswikiPurpleNo343">a</li>
   <li class="foswikiTML" id="foswikiPurpleNo344">b<ul class="foswikiTML" id="foswikiPurpleNo345">
      <li class="foswikiTML" id="foswikiPurpleNo346">ba</li></ul>
   </li>
</ul>

-- PaulHarvey - 23 Jan 2010
Topic revision: r2 - 23 Jan 2010, PaulHarvey
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy