Tagged: editor, editor_class, editor_css
- This topic has 5 replies, 2 voices, and was last updated 6 years, 3 months ago by
mcmaster.
-
AuthorPosts
-
-
October 21, 2015 at 4:45 pm #4657
mcmasterMemberI’ve never used the
editor_cssoption before. It’s defined on https://piklist.com/user-guide/docs/fields/editor/ as “Additional CSS styling applied for both visual and HTML editors buttons, needs to include style tags, can use “scoped”.”So, being in a hurry to test something, I tried it:
array( 'type' => 'editor', 'field' => 'newsletter_highlights', 'label' => __( 'Highlights of this issue' ), 'columns' => 12, 'options' => array ( 'media_buttons' => false, 'editor_css' => 'style="height: 240px;"', 'teeny' => true, ), ),But the
editor_cssvalue is output between the elements:<div id="wp-_post_meta_newsletter_archive_0_newsletter_highlights_0-wrap" class="wp-core-ui wp-editor-wrap tmce-active" style="width: 100%;"> style="height: 240px;" <div id="wp-_post_meta_newsletter_archive_0_newsletter_highlights_0-editor-container" class="wp-editor-container">...</div> <div class="uploader-editor">...</div> </div>Am I misunderstanding the usage, or is this a bug?
Thanks,
Donna -
October 21, 2015 at 4:48 pm #4658
mcmasterMemberAlso, is there a better way to limit the height of an editor field? I tried
'attributes' => array ( 'rows' => 3, ),But that doesn’t work.
Thanks!
Donna -
October 21, 2015 at 4:49 pm #4659
mcmasterMemberAnd I know I can use
editor_class. Just wondering if there is a method that doesn’t require setting up a CSS file. Lazy. 😉 -
October 21, 2015 at 5:10 pm #4660
mcmasterMemberOkay, so I defined a CSS class and put it into a file in the parts/css folder:
.mcw-editor-short { height: 140px; }And then I added
editor_classto an editor field:array( 'type' => 'editor', 'field' => 'newsletter_highlights', 'label' => __( 'Highlights of this issue' ), 'columns' => 12, 'options' => array ( 'media_buttons' => false, 'editor_class' => 'mcw-editor-short', 'teeny' => true, ), ),But the class is applied to a textarea that is
display: none, so it doesn’t affect the height of the editor box. See attached Firebug screenshot.Again, could be pilot error … so set me straight if I’m goofing up! 🙂
Donna
Attachments:
You must be logged in to view attached files. -
October 21, 2015 at 8:59 pm #4666
SteveKeymaster@mcmaster– These attributes are core WordPress, not Piklist specific. You can see them listed on the wp_editor() page in the codex.
Here’s an example from WooCommerce:
'editor_css' => '<style>#wp-excerpt-editor-container .wp-editor-area{height:175px; width:100%;}</style>' -
October 21, 2015 at 9:06 pm #4668
mcmasterMemberAh, I see. I’ll play with that. Thanks!
-
-
AuthorPosts
- The topic ‘how to use editor_css?’ is closed to new replies.