EasyUI Forum
April 25, 2024, 03:07:51 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Rich text editing?  (Read 6956 times)
joe
Newbie
*
Posts: 33


View Profile Email
« on: August 28, 2017, 04:22:13 PM »

Is there a way I can use the textbox control for rich text?  I all need is simple formatting like italic or bold.

Thanks...
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: August 29, 2017, 06:23:12 AM »

You can extend the 'texteditor' editor and apply it to the editable datagrid component.
Code:
$.extend($.fn.datagrid.defaults.editors, {
  texteditor: {
    init: function(container,options){
      var ed = $('<div></div>').appendTo(container);
      ed.texteditor(options);
      return ed;
    },
    destroy: function(target){
      $(target).texteditor('destroy');
    },
    getValue: function(target){
      return $(target).texteditor('getValue');
    },
    setValue: function(target, value){
      $(target).texteditor('setValue', value);
    },
    resize: function(target,width){
      $(target).texteditor('resize', {width:width});
    }
  }
})

Usage example:
Code:
editor:{
  type:'texteditor',
  options:{
    height:200,
    //...
  }
}
Logged
joe
Newbie
*
Posts: 33


View Profile Email
« Reply #2 on: October 03, 2017, 05:23:27 PM »

But I am not using a datagrid tho.  I am just using a textbox that is part of a form.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #3 on: October 03, 2017, 05:50:25 PM »

Please download the texteditor plugin from https://www.jeasyui.com/extension/texteditor.php
Logged
joe
Newbie
*
Posts: 33


View Profile Email
« Reply #4 on: October 03, 2017, 08:58:01 PM »

Thank Jerry,

I did download the extension and it works great.  However, can i disable and enable the texteditor using code?  I wanted to use the texteditor as part of a form. so enabling and disabling it needs to be dynamic.  is it even possible?

 
Logged
battlezad
Newbie
*
Posts: 44


View Profile
« Reply #5 on: October 10, 2017, 02:23:47 AM »

Call disable/enable methods.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!