jQWidgets Forums

jQuery UI Widgets Forums Editors Editor Adding and to the editor toolbar

This topic contains 1 reply, has 1 voice, and was last updated by  faycool 10 years, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Adding and to the editor toolbar #60871

    faycool
    Participant

    Hi,
    I’m trying to add two custom toggleButton and insert html tags as action <sup></sub> around selection or at cursor position.
    Here’s what I did so far :

    
    $('#description').jqxEditor({
    	width: 650,
    	height: 333,
    	pasteMode: 'text',
    	tools : 'bold italic underline | sup sub | size color | left center right | outdent indent | ul ol | link | clean | html',
    	createCommand: function (name) {
    		switch (name) {
    			case "sup":
    				return {
    					type: 'toggleButton',
    					tooltip: 'Mettre en exposant',
    					init: function (widget) {
    						widget.jqxButton({ height: 25, width: 20 });
    						widget.html("<span style='line-height: 24px;'>x<sup>2</sup></span>");
    					},
    					refresh: function (widget, style) {
    						// toggle check/uncheck
    					},
    					action: function (widget, editor) {
    						// insert <sup></sup>
    					}
    				}
    			case "sub":
    				return {
    					type: 'toggleButton',
    					tooltip: 'Mettre en indice',
    					init: function (widget) {
    						widget.jqxButton({ height: 25, width: 20 });
    						widget.html("<span style='line-height: 24px;'>x<sub>2</sub></span>");
    					},
    					refresh: function (widget, style) {
    						// toggle check/uncheck
    					},
    					action: function (widget, editor) {
    						// insert <sup></sup>
    					}
    				}
    		}
    	}
    
    });
    

    Did anyone try something like this before ? Can anybody help ?
    Thanks a lot

    Adding and to the editor toolbar #60970

    faycool
    Participant

    Just to update the topic, “Adding ‘sup’ and ‘sub’ to the editor toolbar”

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.