Jump to content
 Share

Alexis

Saved Text Font/ Color or Size

Recommended Posts

I'd like for an option or something along the lines that saves your Font or Color of Text/ Text Size that way I don't have to click on it for every forum reply to reselect the Font/ Text size I'd like to use unless I want to change it to something different if it ever comes to that. I am not sure if it's already an option and if it is, correct me if I'm wrong. If it isn't, maybe something that allows you to enable it to remember what Font/ Text Color you use and for those that would rather keep using different ones and don't wanna have it saved for every post to just leave it disabled.

Hopefully I explained it well enough. It's like 9 AM and I hadn't had any sleep!

Share this post


Link to post
Share on other sites


I'll support it.

 

I personally don't like it and find it a little bit annoying, but that's just my own preference...  I think the idea itself is good, and people should be able to choose what they want to do.


PoorWDm.png?width=360&height=152

Share this post


Link to post
Share on other sites


While presets are a nice idea, CKEditor4 does not support that. I looked through currently available CKEditor4 plugins and there's nothing close, I don't I believe we want to hack and slash a custom solution either.

 

You can look through the plugins list here: https://ckeditor.com/cke4/addons/plugins/all If you find something, prove me wrong!

Share this post


Link to post
Share on other sites


Posted  Edited by Joshy

The language doesn't look too bad.  Looks like there's a setCookie and getCookie option?  Can it be used with something like getUiColor and setUiColor... and similarly with the other settings such as size?  I'm not sure how bad that would be I'm sure I'm overly simplifying it.

Edited by Joshy

PoorWDm.png?width=360&height=152

Share this post


Link to post
Share on other sites


https://ckeditor.com/cke4/addon/inlinesave

this could be used as one, technically.

 

Just save the format you want to use as the first line, and it should start writing every post you do with that format, no?

 

 


Former Gmod Prop Hunt Admin

Former Media Team Team Leader

Former Media Team GFX Member

Share this post


Link to post
Share on other sites


After some thought, the best solution IMO would be something like Microsoft Word Styles: https://support.microsoft.com/en-us/office/customize-or-create-new-styles-d38d6e47-f6fc-48eb-a607-1eb120dec563 (something like this does already exist for CKEditor4, though, it doesn't allow users to modify styles and save them and in addition to this I'd like for them to be saved to accounts and not just browsers/devices (making things a little harder)).

 

For example, I could set it so that a button would make all of my text the colour #ecf0f1 and leave the font size, face, family, etc. alone (I could even change what "default" is so I don't have to press the button each time - just like in Microsoft Word). For someone like @Auralanity, a button (or many) could be even more helpful as they change many style settings at once, not just one.

 

Let me know if this idea sounds good to you, I tried my best to get across what I'm envisioning. 

 

P.S.

@Joshy I appreciate you looking into this, but I don't think those few methods would be useful in this application.

@TheSadBandit I appreciate you looking into this as well, but I don't think that is what we're looking for, nor can it really be cannibalised for this either.

However, please let me know if I'm missing the mark on this.

 

P.S.S.

While this is a cool concept, and I'd personally benefit from it, I still don't know if it's a very pressing matter. This may be on the backburner for quite some time, let me know what ya think.

Share this post


Link to post
Share on other sites


44 minutes ago, Liloz01 said:

After some thought, the best solution IMO would be something like Microsoft Word Styles: https://support.microsoft.com/en-us/office/customize-or-create-new-styles-d38d6e47-f6fc-48eb-a607-1eb120dec563 (something like this does already exist for CKEditor4, though, it doesn't allow users to modify styles and save them and in addition to this I'd like for them to be saved to accounts and not just browsers/devices (making things a little harder)).

 

For example, I could set it so that a button would make all of my text the colour #ecf0f1 and leave the font size, face, family, etc. alone (I could even change what "default" is so I don't have to press the button each time - just like in Microsoft Word). For someone like @Auralanity, a button (or many) could be even more helpful as they change many style settings at once, not just one.

 

Let me know if this idea sounds good to you, I tried my best to get across what I'm envisioning. 

 

P.S.

@Joshy I appreciate you looking into this, but I don't think those few methods would be useful in this application.

@TheSadBandit I appreciate you looking into this as well, but I don't think that is what we're looking for, nor can it really be cannibalised for this either.

However, please let me know if I'm missing the mark on this.

 

P.S.S.

While this is a cool concept, and I'd personally benefit from it, I still don't know if it's a very pressing matter. This may be on the backburner for quite some time, let me know what ya think.

The idea sounds good, if only there was a way to make it for saved accounts and such.

Share this post


Link to post
Share on other sites


Turning out to be harder than I expected. Not going to abandon the project, though! Just letting you know.

Share this post


Link to post
Share on other sites


On 11/27/2020 at 11:49 PM, Liloz01 said:

Not going to abandon the project, though! Just letting you know.

I know you're a Busy Bee but, I'd like to know if there was any progress or news about this? I'm just curious, hehe.

Share this post


Link to post
Share on other sites


Posted  Edited by fantastic

Here's something that might help:

 

Option A: save to browser

 

1. Attach a listener onto the dropdowns in CKEditor to listen for a click on a font style or color (this should be done client-side)

2. When either a font style or color are chosen, save it to session or local storage

3. On page load, call the below script

CKEDITOR.on('instanceReady', function(ev) {
	ev.editor.setData(`<span style="font-family:${sessionStorage.getItem('saved-font-family')};font-size:${sessionStorage.getItem('saved-font-size')};">&shy;</span>`);
});

 

Step 3 seems to work so I can't imagine step 1 and 2 isn't do-able. Probably need a check to only run this listener if either item actually exists, otherwise the listener is useless and the default fonts and colors won't be set properly.

 

Option B: save to account

 

1. Create new custom profile fields: one for font style and one for font color

2. Add regex validation to ensure sanitized input (and avoid xss attack). Don't know if this can be done as part of the profile field, but worst-case you can just run it as-needed in the below step

3. Add the above script in step 3 to the bottom of the CKEditor template, replacing the output of the browser-saved font family and font size from the data in the custom profile fields

 

Adapted from https://stackoverflow.com/a/60519978

Edited by fantastic

Share this post


Link to post
Share on other sites


I think I'm just going to abandon this, it was a good idea but in practice it's a bit... breaky. Sorry! My brain can't handle it.

 

Maybe in future someone else can pick this up.

Share this post


Link to post
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...