Mybb editor fix
techu Offline
Member
***
Posts: 154
Joined: Sep 2010
Post: #1
Mybb editor fix
This is not the one that is available at mybb.com tutorial section.

As everyone knows that the editor once loaded does not get resized if you change the browser windows.

So I have tried to fix it. This modified editor.js does get resized if you change the browser width..

Download the file and replace the original editor.js with this one..

.zip  editor.zip (Size: 8.07 KB / Downloads: 620)


I have not tested it throughly so make sure you test it before using it on live forum..

[Image: banner.png]
(This post was last modified: 03-27-2011 04:13 AM by techu.)
03-27-2011 04:04 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #2
RE: Mybb editor fix
Talking about MyBB editor (codebuttons and etc), I would like to see MyBB use a 'sharable' or 're-usable' editor, so we can use it for our XThreads textarea.

Thanks for sharing, Techu Smile

03-28-2011 02:13 AM
Find all posts by this user Quote this message in a reply
techu Offline
Member
***
Posts: 154
Joined: Sep 2010
Post: #3
RE: Mybb editor fix
I think it can be done. But in order to do that the xthread must be modified to include an id tag in the textarea. and then we can use

Code:
1
2
3
4
5
6
7
8
.
. //language and other stuff
.
	var clickableEditor = new messageEditor("insert the ID of the text area", {lang: editor_language, rtl: 0, theme: "default"});
.
. //language and other stuff
.
 


to load the editor..


[Image: banner.png]
(This post was last modified: 03-28-2011 03:34 AM by techu.)
03-28-2011 03:24 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #4
RE: Mybb editor fix
Very good if this can be done now (1.6). I've tried to 'steal' the editor using 1.4 before, unfortunately I failed to make it work if there is more than one textarea in the same page.
Maybe I'll try it later using 1.6.

03-28-2011 04:30 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #5
RE: Mybb editor fix
I think MyBB didn't properly do the OOP model of the editor, so it was impossible to have more than one instance of it on a page.
Dunno if changed in 1.6 - will need to check.

Javascript Code
textInput.style.width = "99%";

I'm a little critical of relying on a 1% difference.  Is there a way to have some sort of containing div with a more fixed padding width?
You might also want to keep the height setting code in the Javascript, though I'm not sure if it really does much.
Haven't tried your code yet.

Although I don't like it, there's perhaps a reason why it's fixed width - for one, it ensures a minimum dimension so that the buttons don't go haywire.

If you just want it to fill 100% without supporting browser window resizes, it's probably better to do a HTML/CSS edit.

Thanks for sharing though - I also somewhat prefer a more dynamic width to the editor Smile

BTW, you moved the location of the video button - is that so it works better with smaller widths?


My Blog
03-28-2011 08:41 AM
Find all posts by this user Quote this message in a reply
techu Offline
Member
***
Posts: 154
Joined: Sep 2010
Post: #6
RE: Mybb editor fix
(03-28-2011 08:41 AM)ZiNgA BuRgA Wrote:  I think MyBB didn't properly do the OOP model of the editor, so it was impossible to have more than one instance of it on a page.
Dunno if changed in 1.6 - will need to check.

Javascript Code
textInput.style.width = "99%";

I'm a little critical of relying on a 1% difference.  Is there a way to have some sort of containing div with a more fixed padding width?
You might also want to keep the height setting code in the Javascript, though I'm not sure if it really does much.
Haven't tried your code yet.

Although I don't like it, there's perhaps a reason why it's fixed width - for one, it ensures a minimum dimension so that the buttons don't go haywire.

99% was a quick and easy fix and it appears ok on all major browser so I went with that. Div would have be an better solution.
You are right, the height settings code does not do much so I removed the whole thing.

(03-28-2011 08:41 AM)ZiNgA BuRgA Wrote:  Although I don't like it, there's perhaps a reason why it's fixed width - for one, it ensures a minimum dimension so that the buttons don't go haywire.

But minimum width can also be set using a div class. I am not sure why the developers made the editor that way.
BTW I have noticed that editors of other forum or cms script also has a fixed width, not really sure why..

(03-28-2011 08:41 AM)ZiNgA BuRgA Wrote:  If you just want it to fill 100% without supporting browser window resizes, it's probably better to do a HTML/CSS edit.

Thanks for sharing though - I also somewhat prefer a more dynamic width to the editor Smile

BTW, you moved the location of the video button - is that so it works better with smaller widths?
Filling 100% without supporting browser window resizes can be done with the default editor.js all we have to change the values of cols and rows attributes of the textarea in newthread and newreply templates.

I moved the video button because the dropdown menu does not appear properly near the browser border..
(03-28-2011 04:30 AM)RateU Wrote:  Very good if this can be done now (1.6). I've tried to 'steal' the editor using 1.4 before, unfortunately I failed to make it work if there is more than one textarea in the same page.
Maybe I'll try it later using 1.6.

I thought this might work but have`nt tried it myself.

[Image: banner.png]
(This post was last modified: 03-28-2011 01:16 PM by techu.)
03-28-2011 01:14 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #7
RE: Mybb editor fix
(03-28-2011 01:14 PM)techu Wrote:  99% was a quick and easy fix and it appears ok on all major browser so I went with that. Div would have be an better solution.
It may look okay in browsers - the thing is the size of the window.  It may look different on a maximised window on a 3840x2160 resolution screen, as opposed to a 400x300 window, for example.

(03-28-2011 01:14 PM)techu Wrote:  But minimum width can also be set using a div class. I am not sure why the developers made the editor that way.
min-width/height CSS attributes are not supported by IE6.

(03-28-2011 01:14 PM)techu Wrote:  BTW I have noticed that editors of other forum or cms script also has a fixed width, not really sure why..
Possibly so that the editor doesn't get too wide on a high resolution widescreen monitor.

My Blog
03-28-2011 09:51 PM
Find all posts by this user Quote this message in a reply
techu Offline
Member
***
Posts: 154
Joined: Sep 2010
Post: #8
RE: Mybb editor fix
those are also valid points...

[Image: banner.png]
03-28-2011 10:18 PM
Find all posts by this user Quote this message in a reply
Tomm Offline
Junior Member
**
Posts: 3
Joined: Dec 2010
Post: #9
RE: Mybb editor fix
Parts of MyBB's javascript will be updated in the next maintenance release after 1.6.3 to take advantage of Prototype 1.7. It's not jQuery, but it's better. Tongue
(This post was last modified: 03-29-2011 08:32 AM by Tomm.)
03-29-2011 08:32 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: