Git Product home page Git Product logo

django-rosetta-tinymce's Introduction

Objective: to handle specific edge cases where translations require HTML as input.

Requirements:

Required variables in settings.py:

ROSETTA_TINYMCE_ENABLED = True
ROSETTA_TINYMCE_JS_URL = '/static/js/tiny_mce/tiny_mce.js'
ROSETTA_TINYMCE_CONFIG_URL = '/static/js/rosetta_tinymce_config.js'

ROSETTA_TINYMCE_ENABLED = ROSETTA_TINYMCE_JS_URL = ROSETTA_TINYMCE_CONFIG_URL =

[simple TinyMCE configuration - refer to http://www.tinymce.com/wiki.php for more details]


tinyMCE.init({ mode : "textareas", width : "350", height : "150", theme_advanced_toolbar_location : "top", plugins : 'preview, searchreplace, paste, table, insertdatetime, media', theme_advanced_buttons1 : 'cut,copy,paste,pastetext,bullist,numlist,blockquote,link,unlink,anchor,image,cleanup,help,code', theme_advanced_buttons2 : 'bold,italic,underline,strikethrough,fontselect,fontsizeselect' });


The example above will enable Rich Text Editor (RTE) across all "textarea" HTML elements on the page. If you need to handle specific field in TinyMCE you need to add additional event handling as add/remove TinyMCE per request. Again look at TinyMCE docs for this - something along these lines:

tinyMCE.execCommand('mceAddControl', false, 'the_textareas_id_here'); tinyMCE.execCommand('mceFocus', false, 'the_textareas_id_here');
tinyMCE.execCommand('mceRemoveControl', false, 'the_textareas_id_here');

Enjoy,

django-rosetta-tinymce's People

Contributors

bertrandbordage avatar henkvos avatar jmoiron avatar kitsunde avatar mbi avatar ngnpope avatar sleepyjames avatar thomasw avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.