{ "info": { "author": "Zope Foundation and Contributors", "author_email": "zope-dev@zope.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Zope3", "Intended Audience :: Developers", "License :: OSI Approved :: Zope Public License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP" ], "description": "This package contains support for editing HTML and XHTML inside a web\npage using the FCKeditor as a widget. This is a fairly simple\napplication of FCKeditor, and simply instantiates a pre-configured\neditor for each widget. There are no options to control the editors\nindividually.\n\n\nDetailed Documentation\n======================\n\n\n\n=========================\nHTML file editing support\n=========================\n\nThis package contains support for editing HTML and XHTML inside a web\npage using the FCKeditor as a widget. This is a fairly simple\napplication of FCKeditor, and simply instantiates a pre-configured\neditor for each widget. There are no options to control the editors\nindividually.\n\nIn creating this, we ran into some limitations of the editor that are\nworth being aware of. Noting these as limitations does not mean that\nother editors do any better; what's available seems to be a mixed bag.\n\n- The editor only deals with what can be contained inside a
\n element; anything that goes outside that, including the and\n tags, get lost or damaged. If there's any way to configure\n FCKeditor to deal with such material, it isn't documented.\n\n- There's no real control of the HTML source; whitespace is not\n preserved as a programmer would expect. That's acceptable in many\n use cases, but not all. Applications should avoid using this widget\n if the original whitespace must be maintained.\n\nImplementation problems\n-----------------------\n\nThese are problems with the widget used to integrate FCKeditor rather\nthan problems with FCKeditor itself. These should be dealt with.\n\n- The width of the editor is hardcoded; this should be either\n configurable or the editor should stretch to fill the available\n space. The sample uses of the FCKeditor don't seem to exhibit this\n problem, so it can be better than it is.\n\n- The height of the editor should be configurable in a way similar to\n the configuration of the basic textarea widget.\n\nIdeas for future development\n----------------------------\n\nThese ideas might be interesting to pursue, but there are no specific\nplans to do so at this time:\n\n- Categorize the applications of the editor and provide alternate\n toolbar configurations for those applications. There's a lot of\n configurability in the editor itself, so it can be made to do\n different things.\n\n- Add support for some of the other fancy client-side HTML editors,\n and allow a user preference to select which to use for what\n applications, including the option of disabling the GUI editors when\n detailed control over the HTML is needed (or for luddite users who\n don't like the GUI editors).\n\n XINHA (http://xinha.python-hosting.com/) appears to be an\n interesting option as well, and may be more usable for applications\n that want more than editing of small HTML fragments, especially if\n the user is fairly HTML-savvy.\n\n HTMLArea (http://www.dynarch.com/projects/htmlarea/) may become\n interesting at some point, but a rough reading at this time\n indicates that XINHA may be a more reasonable route.\n\nMore information about FCKeditor\n--------------------------------\n\n- http://www.fckeditor.net/\n\n- http://discerning.com/topics/software/ttw.html\n\n- http://www.phpsolvent.com/wordpress/?page_id=330\n\n\n======================================\nManagement of supplemental information\n======================================\n\nThe `zope.html` package provides additional views on files containing\nHTML and XHTML data that allow editing the files over the web. The\nfiles may contain either complete documents or fragments that may be\ncomposed into larger documents. Preview views are also provided.\n\nThe editing and preview views rely on getting supplemental information\nabout the file being edited using the `IEditableHtmlInformation`\nadapter for the file. That adapter uses annotations on the content\nobject to store information that needs to be persisted.\n\nThe `IEditableHtmlInformation` interface is very simple; there's only\none field defined, and it's a simple boolean value: whether the file\nshould be treated as a fragment or not. Let's create a simple content\nobject that we can use for testing::\n\n >>> import zope.file.file\n >>> import zope.interface\n >>> import zope.annotation\n\n >>> class File(zope.file.file.File):\n ... zope.interface.implements(\n ... zope.annotation.IAttributeAnnotatable)\n ...\n ... def __init__(self, text=None):\n ... super(File, self).__init__(\"text/html\", {\"charset\": \"utf-8\"})\n ... f = self.open(\"w\")\n ... f.write(text)\n ... f.close()\n\nLet's create a file and the corresponding `IEditableHtmlInformation`\nobject::\n\n >>> import zope.html.docinfo\n\n >>> file = File(\"This is a fragment.\")\n >>> info = zope.html.docinfo.EditableHtmlInformation(file)\n\nWe can now check that the initial value of the `isFragment` attribute\nis computed reasonably::\n\n >>> info.isFragment\n True\n\nThe user can cause the `isFragment` flag to be toggled from the UI, so\nit should remember the current state of the flag::\n\n >>> info.isFragment = False\n >>> info.isFragment\n False\n\nA new instance of the `IEditableHtmlInformation` instance should also remember the last value of the setting::\n\n >>> zope.html.docinfo.EditableHtmlInformation(file).isFragment\n False\n\n\n==============================\n(X)HTML fragment editor widget\n==============================\n\nThe widget included in this package is a simple application of the\nFCKeditor control. It is only expected to work for fragments, not for\narbitrary documents. Let's create a field and a widget::\n\n >>> from zope.html import field\n >>> from zope.html import widget\n >>> from zope.publisher import browser\n\n >>> class Context(object):\n ... sample = u\"\"\n\n >>> myfield = field.XhtmlFragment(\n ... __name__=\"sample\",\n ... title=u\"Sample Field\",\n ... ).bind(Context())\n\n >>> request = browser.TestRequest()\n >>> mywidget = widget.FckeditorWidget(myfield, request)\n >>> mywidget.setPrefix(\"form\")\n\n >>> mywidget.configurationPath = \"/myconfig.js\"\n >>> mywidget.editorWidth = 360\n >>> mywidget.editorHeight = 200\n >>> mywidget.toolbarConfiguration = \"mytoolbars\"\n\n >>> print mywidget()\n