#21718 closed enhancement (fixed)
Remove default_post_edit_rows
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.5 | Priority: | low |
Severity: | normal | Version: | |
Component: | Editor | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
In options-writing, there is a setting for the "Size of the post box". This controls the <textarea> height for all users. It should disappear.
Ideally, in place of it, the HTML editor should retain memory of its previous size (given browser scaling). To do this, we would either need to read and potentially set the same cookie as TinyMCE does for the Visual editor, or use our own user setting in parallel. This will require some changes to editor.js, class-wp-editor.php, and possibly the wp_editor() call in edit-form-advanced.php.
Attachments (7)
Change History (23)
#2
@
13 years ago
- Owner set to azaozz
- Status changed from new to assigned
When a textarea is resized directly in the browser, it sets inline style with the width and height. Shouldn't be hard to get the height, save it in user settings and/or apply it to TinyMCE.
#3
@
13 years ago
In 21718.patch:
- Resize the Text editor when switching Text -> Visual and the Visual editor when switching back (when the user resizes the textarea).
- Store each editor height as user state (only when TinyMCE).
- Save the editor height on unload (only when TinyMCE).
To do:
- Save the Text editor height when no TinyMCE.
#4
@
13 years ago
Also to-do: perhaps do one-time conversion from the TinyMCE cookie to user state. Something like:
set_user_state( 'content_ed_size', $mce_cookie['y'] );
#5
@
13 years ago
Some combination of the patches from me and azaozz should get us about 90% of the way there.
When do we actually save a cookie? setUserSetting is only available in the admin. TinyMCE is only used on the post screen (and that's the only place this option applied to). wp_editor() is additionally used when editing and replying to comments, but TinyMCE isn't loaded. editor.js works, but wouldn't handle quicktag-only editors. quicktags.js is probably better, but it is loaded on the frontend. We could even include it inline in the editor_js() method in the editors class.
What I think would be best is if a TinyMCE plugin handled this for all editors it handles in the admin (so, azaozz's patch), with extra code inline that is outputted only in the admin and only when TinyMCE is not defined for that editor. (Important in case the visual editor is disabled.)
Related bug report: In Chrome, you can't size the textarea smaller than the space the visual editor takes up behind it.
#6
@
13 years ago
The Chrome bug is really annoying. As long as we add style="height: 200px"
on the textarea tag, WebKit would restrict resizing to anything smaller. The same happens when the inline style is set from JS.
The only workaround for now seems to be to use jQuery to remove the inline style and set the textarea height directly (for WebKit browsers).
#7
@
13 years ago
Well, converted the textarea height to rows for Chrome but it still wouldn't allow resizing the textarea to shorter. Not sure what else to try :)
Also discovered that Chrome now adds about 4px "non-removable bottom margin" to all textareas as they are styled as inline-block. Setting display: block
fixes that.
#8
@
13 years ago
21718-4.patch works well. It adds some JS to resize the Text editor and save the height.
Didn't use UI resizable as it tries to do a lot of things that aren't needed. Went with something similar to the JS that resizes the textareas on trac, smaller and works better.
#9
@
13 years ago
- Keywords has-patch commit added; needs-patch removed
Awesome. Marking this as a commit candidate. Needs testing and final review.
The default height of the editor should be increased too. It's tiny by default.