Coverage for lino/modlib/tinymce/__init__.py : 58%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: UTF-8 -*- # Copyright 2015 Luc Saffre # License: BSD (see file COPYING for details)
RichTextFields. See also :attr:`tinymce_root`. See `/blog/2011/0523`. (formerly `use_tinymce`).
"""
#TINYMCE_VERSION = '3.4.8' #TINYMCE_VERSION = '4.1.10'
"""Which version of TinyMCE to use.
With 4.1.10, windows containing a TextField don't open, and the JS console says "TypeError: sp is undefined". That's because we did not yet get Andrew Mayorov's :srcref:`lino/modlib/tinymce/static/byteforce/Ext.ux.TinyMCE.js` to work with TinyMCE 4. It seems that either ControlManager or WindowManager no longer are functions in tinymce4.
"""
return '<script type="text/javascript" src="{0}"></script>'.format(url)
"See :doc:`/dev/plugins`."
# window_width = 600 # window_height = 500
"""When serving static files from a different subdomain, TinyMCE needs to know about this. Typical usage is to specify this in your :file:`djangosite_local.py` file (:ref:`lino.djangosite_local`)::
def setup_site(self): ... from lino.api.ad import configure_plugin configure_plugin('tinymce', document_domain="mydomain.com")
Currently when using this, **you must also manually change** your static `tiny_mce_popup.js` file after each `collectstatic`.
"""
"""The initial width of the window to use when editing in own window.
"""
"""The initial height of the window to use when editing in own window.
"""
"bold,italic,underline,|,justifyleft,justifycenter,justifyright,|," "bullist,numlist,|,outdent,indent,|,undo,redo,|,removeformat,template") """The toolbar buttons when editing a field inside a detail form."""
"save,cancel,|,bold,italic,underline,|,justifyleft,justifycenter," "justifyright,fontselect,fontsizeselect,formatselect,|," "search,replace") """The first row of toolbar buttons when editing in own window.""" "cut,copy,paste,template,|,bullist,numlist,|,outdent,indent,|," "undo,redo,|,link,unlink,anchor,image,|,code,preview,|,forecolor," "backcolor") """The second row of toolbar buttons when editing in own window."""
"insertdate,inserttime,|,spellchecker,advhr,,removeformat,|," "sub,sup,|,charmap,emotions,|,tablecontrols") """The third row of toolbar buttons when editing in own window."""
"""Lino currently includes three versions of TinyMCE, but for production sites we still use the eldest version 3.4.8.
"""
# media_base_url = "http://www.tinymce.com/js/tinymce/jscripts/tiny_mce/" # media_base_url = "http:////tinymce.cachefly.net/4.1/tinymce.min.js"
if html is not None: yield ("TinyMCE", TINYMCE_VERSION, "http://www.tinymce.com/") yield ("Ext.ux.TinyMCE", '0.8.4', "http://www.byte-force.com")
if TINYMCE_VERSION.startswith('3'): yield self.build_lib_url('tiny_mce.js') else: yield self.build_lib_url('tinymce.min.js') yield settings.SITE.build_static_url("byteforce", "Ext.ux.TinyMCE.js")
url(rx + r'templates/(?P<app_label>\w+)/' + r'(?P<actor>\w+)/(?P<pk>\w+)/(?P<fldname>\w+)$', views.Templates.as_view()), url(rx + r'templates/(?P<app_label>\w+)/' + r'(?P<actor>\w+)/(?P<pk>\w+)/(?P<fldname>\w+)/' + r'(?P<tplname>\w+)$', views.Templates.as_view())]
from lino.modlib.extjs.elems import TextFieldElement if isinstance(e, TextFieldElement): if e.format == 'html': yield "%s.refresh();" % e.as_ext()
if site.user_model is not None: mg = site.plugins.office m = m.add_menu(mg.app_label, mg.verbose_name) m.add_action('tinymce.MyTextFieldTemplates')
if site.user_model is not None: mg = site.plugins.office m = m.add_menu(mg.app_label, mg.verbose_name) m.add_action('tinymce.TextFieldTemplates')
|