Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Black Zero Posted December 7, 2022 Posted December 7, 2022 (edited) Please move this topic in corect section Can the default font and text size of the CKEditor text box be changed? Tell me how it will happen?? I want to change the CKEditor default font and size in my forum. My forum is hosted on self hosting.Please advise me Edited December 7, 2022 by Black Zero
Solution Nathan Explosion Posted December 7, 2022 Solution Posted December 7, 2022 This post was recognized by Marc! "Much appreciated :)" Nathan Explosion was awarded the badge 'Helpful' and 10 points. edit your globalTemplate template and add the following prior to the closing </body> and save your template. <script> if(typeof CKEDITOR !='undefined'){ CKEDITOR.addCss(".cke_editable{cursor:text; font-size: 20px; font-family: Georgia;}"); CKEDITOR.config.font_defaultLabel='Georgia'; CKEDITOR.config.fontSize_defaultLabel='20px'; } </script> What does it do... If there is a CKEDITOR on the page then... It changes the CSS of the editor to be the font/font-size you want and then... It changes the label of the font dropdown box and... It changes the label of the font size dropdown box. Meddysong and SeNioR- 2
Black Zero Posted December 7, 2022 Author Posted December 7, 2022 (edited) 18 minutes ago, Nathan Explosion said: edit your globalTemplate template and add the following prior to the closing </body> and save your template. <script> if(typeof CKEDITOR !='undefined'){ CKEDITOR.addCss(".cke_editable{cursor:text; font-size: 20px; font-family: Georgia;}"); CKEDITOR.config.font_defaultLabel='Georgia'; CKEDITOR.config.fontSize_defaultLabel='20px'; } </script> What does it do... If there is a CKEDITOR on the page then... It changes the CSS of the editor to be the font/font-size you want and then... It changes the label of the font dropdown box and... It changes the label of the font size dropdown box. Its amazing dear Its working now. Also tell me its left element so that it starts 😀 writing from default left and if set default colour etc ??? Edited December 7, 2022 by Black Zero
Nathan Explosion Posted December 7, 2022 Posted December 7, 2022 Change the addCss line to add the following (changing the code for the color as desired) color:#27ae60 !important; The "!important" is important. Therefore... <script> if(typeof CKEDITOR !='undefined'){ CKEDITOR.addCss(".cke_editable{cursor:text; font-size: 20px; font-family: Georgia; color:#27ae60 !important}"); CKEDITOR.config.font_defaultLabel='Georgia'; CKEDITOR.config.fontSize_defaultLabel='20px'; } </script>
Black Zero Posted December 7, 2022 Author Posted December 7, 2022 I have written it in the text box. There it automatically changes the default font and size. But when the post is submitted, it is post show without size and font.
Nathan Explosion Posted December 7, 2022 Posted December 7, 2022 You're going to need some extra CSS in your theme to change the displayed content to match what you want them to display - the above only controls the defaults used in the Editor, and anything entered will not have any html tags/styles added to them by default, so will need to be handled. Example: The above content is using the defaults on here...it's html code is: <p> You're going to need some extra CSS in your theme to change the displayed content to match what you want them to display - the above only controls the defaults used in the Editor, and anything entered will not have any html tags/styles added to them by default, so will need to be handled. </p> However, if I manually change an element of the font it becomes... <p> You're going to need some extra CSS in your theme to change the displayed content to match what you want them to display - <span style="color:#e74c3c;">the above only controls the def</span>aults used in the Editor, and anything entered will not have any html tags/styles added to them by def<span style="font-family:Comic Sans MS,cursive;">ault, so will need</span> to be handled. </p> ...and that contains the styles that enforce the changes on the displayed content: You'll need something to handle the items that are not styled - I'm not a theme guy, so no idea what specific areas you'll have to modified in your theme.
Black Zero Posted December 7, 2022 Author Posted December 7, 2022 6 minutes ago, Nathan Explosion said: You'll need something to handle the items that are not styled - I'm not a theme guy, so no idea what specific areas you'll have to modified in your theme. I think you can solve it. Can you please find the solution for me. I can wait for that.
Mark H Posted December 7, 2022 Posted December 7, 2022 3 hours ago, Black Zero said: Tell me how it will happen?? I want to change the CKEditor default font and size in my forum. My forum is hosted on self hosting.Please advise me You do not have an active self-hosted license, and your expired self-hosted license is associated to a domain that does not resolve. Please clarify how you are "self-hosting", and at what URL.
Recommended Posts