Skip to main content
Topic: Undo plugin (Read 5484 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Undo plugin

Could someone please try this sequence:
1) type something (anything really)
2) hit ctrl+z
3) type something else
4) hit ctrl+z
What do you see?
What I would expect is that the text I typed in 3 is removed, but instead nothing happens. And if I click the "redo" icon then the text I removed with the ctrl+z of 2 appears again, removing the text I types in 3.
Bugs creator.
Features destroyer.
Template killer.

Re: Undo plugin

Reply #1

Behavior seems to depend on how quickly I hit crtl-z but yeah I can reproduce what you said above.

There may have been an editor fix to help with this, not sure.

When the "latest" 1.5.x editor was released, there was still a myriad of issues open, but instead of fixing them in the 1.5.x branch most were pushed to a new 2.X branch, which of course will force us to change just about every plugin and interaction with the editor.   I've been back porting some of the fixes to a 1.X elk branch so we can try that but have mixed feelings about the entire thing.

I'm kind of tired of dealing with the editors development, two many things are left broken in ..x releases, and then fixes do become available they are in a version that requires API changes everywhere breaking the core and addons and not fitting well in any release cycles.
Last Edit: April 07, 2017, 08:40:40 pm by Spuds

Re: Undo plugin

Reply #2

Yeah, it's becoming pretty annoying... :-\
Bugs creator.
Features destroyer.
Template killer.

Re: Undo plugin

Reply #3

Quote from: emanuele – Could someone please try this sequence:
1) type something (anything really)
2) hit ctrl+z
3) type something else
4) hit ctrl+z
What do you see?
What I would expect is that the text I typed in 3 is removed, but instead nothing happens. And if I click the "redo" icon then the text I removed with the ctrl+z of 2 appears again, removing the text I types in 3.

Exactly the same happening here with me.

Re: Undo plugin

Reply #4

I marked them to be removed, now someone just needs to do so.

 

Re: Undo plugin

Reply #5

I'm trying to understand the plugin:
https://github.com/samclarke/SCEditor/blob/master/src/plugins/undo.js#L170
if I'm not entirely wrong, this means:
1) if less than 20 chars added since last stored step, exit,
2) if less than 50 chars added since last stored step and the last char is not a space, exit,
3) otherwise store the undo step

Funny thing, I'm not able to replicate the isse any more on my localhost.
I'll try to update the files here, maybe something was fixed somewhere in the meantime since the last update?
Bugs creator.
Features destroyer.
Template killer.


Re: Undo plugin

Reply #7

We need to make a tweak to fix the editor focus messing up the page scroll to a named link on load.  I'll comment in the gist in a bit.

Re: Undo plugin

Reply #8

O_O
Page scroll?
Bugs creator.
Features destroyer.
Template killer.

Re: Undo plugin

Reply #9

On editor init the undo plugin does an editor focus event to get the initial cursor position in the editor. 

This is not normally a problem unless you have the full editor set in Quick Reply.   In that case the focus event will pull the screen down to the editor area  (as some browsers feel that is in focus)  overriding any #blabla in the url like #new.

Re: Undo plugin

Reply #10

I made the updates to the file on the site since jumping to wrong area on the page was making me very sad  :'(

Now lets hope I did not mess up the changes you were trying  O:-)

Re: Undo plugin

Reply #11

Now the funny part is I have no idea of the changes you made because everything is minified. xD
Bugs creator.
Features destroyer.
Template killer.

Re: Undo plugin

Reply #12

The changes I made are left in a comment in the gist of your updates ;)

Re: Undo plugin

Reply #13

Ohhh... I learned that github doesn't send notifications for comments on gists... or at least I didn't receive any. :-\
Bugs creator.
Features destroyer.
Template killer.

Re: Undo plugin

Reply #14

gist can be strange. 

Anyway the change is simple, it just avoids the editor focus event (needed to get cursor position) when the editor is empty.  When empty the cursor is at 0,0