2

I have an Ext.form.field.HtmlEditor-textfield with really long text inside it and I want to save only the currently visible portion of the text inside a variable.

For example:

var really_long_string = "...";
var html_editor = Ext.create('Ext.form.HtmlEditor', {
    renderTo: Ext.getBody(),
    value: really_long_string 
});

var currently_visible = get_currently_visible_text_from_html_editor();

I don't think there are methods which do this, so I came up with an idea of calculating it myself doing these steps:

1.) get current size of the html_editor inside a 'resize' event-handler
2.) get the current scrollbar position of the html_editor
3.) calculate how many lines are visible, and find them using the scrollbar position

My Questions:

1.) Is there an ExtJs function which gives me the current scrollbar position of the html_editor-textfield?

2.) Does anyone have a better idea, how to get the visible portion of long text?

pstenstrm
  • 6,339
  • 5
  • 41
  • 62
kiltek
  • 3,183
  • 6
  • 47
  • 70
  • That's a really hard thing to figure out... The only solution I can come up with is to use something like http://stackoverflow.com/questions/10464801/javascript-visible-text-of-a-div but it will take some rework. – Ruan Mendes May 26 '15 at 13:41

0 Answers0