-
28 Nov 2012 11:36 PM #1
Answered: HtmlEditor's word wrap when the word is longer than the line
Answered: HtmlEditor's word wrap when the word is longer than the line
Hi!
I'm using Ext.form.field.HtmlEditor as my handmade wiki's page editor. It works great except line wrap:
htmleditor.png
So I wonder if there is any way to make the editor break words as they get longer than the line size?
I looked through the source code of the component but don't get how that funky magic with hidden text area and iframe works. So I don't know how to intervene.
Configuration
doesn't work either (fat chanceCode:style: { 'word-wrap': 'break-word' }
)
-
Best Answer Posted by mitchellsimoens
What you are seeing is an iframe unless you click to be in source edit
-
30 Nov 2012 2:22 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 433
- Answers
- 3101
What you are seeing is an iframe unless you click to be in source edit
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
2 Dec 2012 10:59 PM #3
Thanks a lot! Now it makes sense.
I end up with this solution: override HtmlEditor's method getDocMarkup like this:
Code:getDocMarkup: function() { var me = this, h = me.iframeEl.getHeight() - me.iframePad * 2, oldIE = (Ext.isIE6 || Ext.isIE7 || Ext.isIE8); return Ext.String.format( (oldIE?'':'<!DOCTYPE html>') + '<html><head><style type="text/css">' + (Ext.isOpera?'p{margin:0}':'') + 'body{border:0;margin:0;padding:{0}px;' + 'word-wrap: break-word;' // my line + (oldIE?'':'min-') + 'height:{1}px;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;cursor:text;background-color:white;' + (Ext.isIE?'':'font-size:12px;font-family:{2}') + '}</style></head><body></body></html>' , me.iframePad, h, me.defaultFont); }
-
3 Mar 2013 4:37 PM #4
This is a good tip but..
This is a good tip but..
I got the same thing done with hack code but I do not want the word to break, instead it should move to next line just like what this editor is doing, is that possible?


Reply With Quote