Login

FCKEditor replace all vLargeTextField in admin

Author:
aronchi
Posted:
October 24, 2008
Language:
JavaScript
Version:
Not specified
Tags:
admin textfield rich-text-editor fckeditor vlargtextfield
Score:
0 (after 0 ratings)

If you want to add an fckeditor for every vLargeTextField (the input class used by models.TextField) you can use this javascript.

you can load that in all admin pages overriding templates/admin/base_site.html with this:

{% extends "admin/base.html" %} {% load i18n %}

{% block title %}{{ title }} | {% trans "Administrative Area" %}{% endblock %}

{% block branding %} <h1 id="site-name">{% trans "Administrative Area" %}</h1> {% endblock %}

{% block nav-global %}{% endblock %}

{% block extrahead %}{{ block.super }} <script src="{{media_url}}js/jquery.js" type="text/javascript"></script> <script src="{{media_url}}fckeditor/fckeditor.js" type="text/javascript"></script> <script src="{{media_url}}fckeditor/custom/vTextField.js" type="text/javascript"></script> {% endblock %}

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
window.onload = function () {
	var allPageTags = document.getElementsByTagName("textarea");
	var editors = new Array();
	for (i = 0; i < allPageTags.length; i++) {
		if (allPageTags[i].className == "vLargeTextField") {
			var oFCKeditor = new FCKeditor(allPageTags[i].id);
			oFCKeditor.Config["CustomConfigurationsPath"] = "/static/fckeditor/custom/myconfig.js";
			oFCKeditor.BasePath = "/static/fckeditor/";
			oFCKeditor.Height = "400";
			oFCKeditor.ReplaceTextarea();
			editors.push(oFCKeditor);
		}
	}
};

More like this

  1. Generic CSV Export by zbyte64 7 years, 1 month ago
  2. Unobtrusvie Foldable Admin Interface by whiteinge 7 years, 6 months ago
  3. Add special field lookups to the Admin list_filter display by whiteinge 7 years, 5 months ago
  4. Template tags to integrate with modconcat by matthanger 6 years ago
  5. jsonify template filter by skam 8 years, 3 months ago

Comments

Please login first before commenting.