Mercurial > public > sg101
view static/js/tiny_mce/plugins/noneditable/editor_plugin_src.js @ 943:cf9918328c64
Haystack tweaks for Django 1.7.7.
I had to upgrade to Haystack 2.3.1 to get it to work with Django
1.7.7. I also had to update the Xapian backend. But I ran into
problems.
On my laptop anyway (Ubuntu 14.0.4), xapian gets mad when search terms
are greater than 245 chars (or something) when indexing. So I created
a custom field that would simply omit terms greater than 64 chars and
used this field everywhere I previously used a CharField.
Secondly, the custom search form was broken now. Something changed in
the Xapian backend and exact searches stopped working. Fortunately the
auto_query (which I was using originally and broke during an upgrade)
started working again. So I cut the search form back over to doing an
auto_query. I kept the form the same (3 fields) because I didn't want
to change the form and I think it's better that way.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Wed, 13 May 2015 20:25:07 -0500 |
parents | 6c182ceb7147 |
children |
line wrap: on
line source
/** * editor_plugin_src.js * * Copyright 2009, Moxiecode Systems AB * Released under LGPL License. * * License: http://tinymce.moxiecode.com/license * Contributing: http://tinymce.moxiecode.com/contributing */ (function() { var Event = tinymce.dom.Event; tinymce.create('tinymce.plugins.NonEditablePlugin', { init : function(ed, url) { var t = this, editClass, nonEditClass; t.editor = ed; editClass = ed.getParam("noneditable_editable_class", "mceEditable"); nonEditClass = ed.getParam("noneditable_noneditable_class", "mceNonEditable"); ed.onNodeChange.addToTop(function(ed, cm, n) { var sc, ec; // Block if start or end is inside a non editable element sc = ed.dom.getParent(ed.selection.getStart(), function(n) { return ed.dom.hasClass(n, nonEditClass); }); ec = ed.dom.getParent(ed.selection.getEnd(), function(n) { return ed.dom.hasClass(n, nonEditClass); }); // Block or unblock if (sc || ec) { t._setDisabled(1); return false; } else t._setDisabled(0); }); }, getInfo : function() { return { longname : 'Non editable elements', author : 'Moxiecode Systems AB', authorurl : 'http://tinymce.moxiecode.com', infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/noneditable', version : tinymce.majorVersion + "." + tinymce.minorVersion }; }, _block : function(ed, e) { var k = e.keyCode; // Don't block arrow keys, pg up/down, and F1-F12 if ((k > 32 && k < 41) || (k > 111 && k < 124)) return; return Event.cancel(e); }, _setDisabled : function(s) { var t = this, ed = t.editor; tinymce.each(ed.controlManager.controls, function(c) { c.setDisabled(s); }); if (s !== t.disabled) { if (s) { ed.onKeyDown.addToTop(t._block); ed.onKeyPress.addToTop(t._block); ed.onKeyUp.addToTop(t._block); ed.onPaste.addToTop(t._block); ed.onContextMenu.addToTop(t._block); } else { ed.onKeyDown.remove(t._block); ed.onKeyPress.remove(t._block); ed.onKeyUp.remove(t._block); ed.onPaste.remove(t._block); ed.onContextMenu.remove(t._block); } t.disabled = s; } } }); // Register plugin tinymce.PluginManager.add('noneditable', tinymce.plugins.NonEditablePlugin); })();