News:

Wondering if this will always be free?  See why free is better.

Main Menu

WYSIWYG Editor changes I found.

Started by oOo--STAR--oOo, July 19, 2016, 01:13:09 PM

Previous topic - Next topic

oOo--STAR--oOo

Hey, I don't have 2.1 installed but I have been converting this to work with 2.0.11

Its pretty annoying actually lol.

Anyway as I was editing it, I was checking your functions and realised that the code you have inserts the quote at the end of the message. A simple fix for this would be to inserttext rarther than replace.

Code (find) Select

InsertText: function (text, bClear) {
var bIsSource = this.inSourceMode();

// @TODO make it put the quote close to the current selection

if (!bIsSource)
this.toggleSourceMode();

var current_value = bClear ? text : this.getSourceEditorValue(false) + text;
this.setSourceEditorValue(current_value);

if (!bIsSource)
this.toggleSourceMode();

},


Code (replace) Select

InsertText: function (text, bClear) {
var bIsSource = this.inSourceMode();

// @TODO make it put the quote close to the current selection

if (!bIsSource)
this.toggleSourceMode();

this.sourceEditorInsertText(text);

if (!bIsSource)
this.toggleSourceMode();

}


As it states above you get the previous value and set the value to quoted text and previous.. Simply changing this to insert will insert the quote where your cursor is.
Just need the cursor to stay in the position it left off now lol.. Will post that.

Edit:

I just want to add, I don't know what you are doing a request for a page when the information is right there under the quote link.....

I think I am going to code this so that it doesn't do another page request as I feel this isn't needed.
You can't fool a sufficiently talented fool.

http://www.uniquez-home.com
In Design Phase!

Mods I am designing,  No refresh Collapse Categories , Poll Redesign , Pure CSS Breadcrumb , Profile Statuses, Profile Views.

Illori

then what is the purpose of posting this in the SMF 2.1 board? SMF 2.1 uses a different editor completely, so i really doubt this code still applies.

oOo--STAR--oOo

Quote from: Illori on July 19, 2016, 01:18:06 PM
then what is the purpose of posting this in the SMF 2.1 board? SMF 2.1 uses a different editor completely, so i really doubt this code still applies.

I guess you did not read my post... I was converting the editor you use on 2.1 for 2.0.11 and while I was adding this new WYSIWYG editor to 2.0.11 I noticed something that you need to change so the quotes are inserted where your cursor is and not at the end of the message...

Thanks for taking your time to read :D
You can't fool a sufficiently talented fool.

http://www.uniquez-home.com
In Design Phase!

Mods I am designing,  No refresh Collapse Categories , Poll Redesign , Pure CSS Breadcrumb , Profile Statuses, Profile Views.

Suki

Thank you, will make sure to track this and applied the change.

The reason we add another page request is to make sure the quoted content and related data really does exists on the DB.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

oOo--STAR--oOo

Quote from: Suki on July 19, 2016, 01:22:21 PM
Thank you, will make sure to track this and applied the change.

The reason we add another page request is to make sure the quoted content and related data really does exists on the DB.

That is a good point... I am thinking about the consequences
User edits the HTML has what ever he wants in his quote... But the original message will show the lies.. User edits his post, the quote will still be the same, but you won't know if the quote is a lie... That's the only draw back and I can't really see that being exploited.


Is that to preserve the original context of the message in case it was say edited at a later date, and someone tampered with the quote?
You can't fool a sufficiently talented fool.

http://www.uniquez-home.com
In Design Phase!

Mods I am designing,  No refresh Collapse Categories , Poll Redesign , Pure CSS Breadcrumb , Profile Statuses, Profile Views.

Illori

Quote from: aljo1985 on July 19, 2016, 01:13:09 PM
Hey, I don't have 2.1 installed but I have been converting this to work with 2.0.11


so you say you are not using SMF 2.1 and dont say what exactly you are converting in your post.

i did read the post, but without some details it seemed to be missing the point.

oOo--STAR--oOo

Quote from: Illori on July 19, 2016, 01:31:19 PM
Quote from: aljo1985 on July 19, 2016, 01:13:09 PM
Hey, I don't have 2.1 installed but I have been converting this to work with 2.0.11


so you say you are not using SMF 2.1 and dont say what exactly you are converting in your post.

i did read the post, but without some details it seemed to be missing the point.

Don't worry about it mate. I'm not that great at explaining myself cause I think about too many things at the same time.
But yeah, I have 2.0.11 and have been editing the source heavily to be custom to my desire. I wanted a new WYSIWYG editor and have been implementing it into 2.0.11. I see you have it in 2.1 so I have been looking at how you guys did it with 2.1 and noticed some things you can change as I stripped some of the code from 2.1 and put it into 2.0.11 cause its faster and easy than having to do it all myself :D
You can't fool a sufficiently talented fool.

http://www.uniquez-home.com
In Design Phase!

Mods I am designing,  No refresh Collapse Categories , Poll Redesign , Pure CSS Breadcrumb , Profile Statuses, Profile Views.

Suki

Quote from: aljo1985 on July 19, 2016, 01:26:42 PM
Quote from: Suki on July 19, 2016, 01:22:21 PM
Thank you, will make sure to track this and applied the change.

The reason we add another page request is to make sure the quoted content and related data really does exists on the DB.

That is a good point... I am thinking about the consequences
User edits the HTML has what ever he wants in his quote... But the original message will show the lies.. User edits his post, the quote will still be the same, but you won't know if the quote is a lie... That's the only draw back and I can't really see that being exploited.


Is that to preserve the original context of the message in case it was say edited at a later date, and someone tampered with the quote?

Its more than the message itself, the data associated with it needs to be corroborated, date time, user, message and board  ID, etc etc.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

oOo--STAR--oOo

#8
Quote from: Suki on July 19, 2016, 01:37:08 PM
Quote from: aljo1985 on July 19, 2016, 01:26:42 PM
Quote from: Suki on July 19, 2016, 01:22:21 PM
Thank you, will make sure to track this and applied the change.

The reason we add another page request is to make sure the quoted content and related data really does exists on the DB.

That is a good point... I am thinking about the consequences
User edits the HTML has what ever he wants in his quote... But the original message will show the lies.. User edits his post, the quote will still be the same, but you won't know if the quote is a lie... That's the only draw back and I can't really see that being exploited.


Is that to preserve the original context of the message in case it was say edited at a later date, and someone tampered with the quote?

Its more than the message itself, the data associated with it needs to be corroborated, date time, user, message and board  ID, etc etc.
This is absolutely true! Thanks for input. It could be possible to get this data from the HTML its self, but it wouldn't be accurate and messy. Its better to do a request :)

Thanks for the clarification I will leave that alone then and work on this editor some more lol.

EDIT:

I have got this working nicely on 2.0.11 but when I insert a quote, it inserts extra blank lines, does it do this on 2.1?
After browsing through some of the test subjects I made, I see that its not always happening and I can't find what is triggering it, but on some posts it adds extra blank lines.. I dunno if this is present on 2.1
You can't fool a sufficiently talented fool.

http://www.uniquez-home.com
In Design Phase!

Mods I am designing,  No refresh Collapse Categories , Poll Redesign , Pure CSS Breadcrumb , Profile Statuses, Profile Views.

oOo--STAR--oOo

Solved, sorry was my mistake the extra lines whoops lol..
You can't fool a sufficiently talented fool.

http://www.uniquez-home.com
In Design Phase!

Mods I am designing,  No refresh Collapse Categories , Poll Redesign , Pure CSS Breadcrumb , Profile Statuses, Profile Views.

Advertisement: