EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: joe on August 28, 2017, 04:22:13 PM



Title: Rich text editing?
Post by: joe 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...


Title: Re: Rich text editing?
Post by: jarry 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,
    //...
  }
}


Title: Re: Rich text editing?
Post by: joe 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.


Title: Re: Rich text editing?
Post by: jarry on October 03, 2017, 05:50:25 PM
Please download the texteditor plugin from https://www.jeasyui.com/extension/texteditor.php


Title: Re: Rich text editing?
Post by: joe 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?

 


Title: Re: Rich text editing?
Post by: battlezad on October 10, 2017, 02:23:47 AM
Call disable/enable methods.