Jump to content

Module: Version Control For Text Fields


teppo
 Share

Recommended Posts

Teppo, that error seems to be other way around. Mine was that it didn't work without ckeditor, now it seems to require tinymce :) Not looked at the code yet though.

Very good point! Multitasking isn't my strong point, shouldn't attempt to answer anything during lectures. It really was the same problem other way around and fix was essentially same as last time too.

Sorry folks, this should be fixed in 1.0.3 which is already available from GitHub :)

Link to comment
Share on other sites

Hi Teppo,

Thanks for your efforts. Really appreciate it!

I've updated the module but I'm still hitting the error. I uninstalled the modules and reinstalled them. The version number for VersionControlForTextFields is 1.0.3. When investigating I also found out that also a plain Text field keeps loading when switching history. If I enable TinyMCE both the plain Text field and the Textarea field are working. If I switch the Textarea field to a plain Textarea both fields fail. It seems TinyMCE still has to be enabled on one field in the template.

Link to comment
Share on other sites

@arjen: I've tried to replicate this in my setup without any success. I'm also running PW 2.3.0 and have been testing this with a template with plain textarea, TinyMCE, CKEditor, alone and in all kinds of combinations, but still can't see any problems.

What you're describing there definitely sounds like the bug that was just fixed, but I can't really see why that would still happen, unless you've got an old version of VersionControlForTextFields.js on your site. Could you check that said JS file includes a typeof check for tinyMCE?

If that's not the case, this would probably be the cause of this and solution would be to update that JS file too. If it does seem like latest version, I'll need to do more debugging to find another situation where this could happen :)

  • Like 1
Link to comment
Share on other sites

An option would be to always show the icon. If a user clicks a field with no history a simple message like "There are no earlier versions of this field" would be sufficient.

This has now been implemented (along with a bunch of other tweaks and quite a bit of code rewrite.)

Message should be visible on all fields with no stored history rows. If there's exactly one row of data, it'll be visible in revision list, though naturally it'll be only entry there and always selected.

  • Like 3
Link to comment
Share on other sites

  • 7 months later...

@Macrura: I've just pushed new version to GitHub with "version-control" permission.

This is going to be installed automatically with the module, but if you've already installed and don't want to lose any data, simply add a new permission called "version-control" manually and apply it to appropriate roles.

  • Like 2
Link to comment
Share on other sites

Teppo: have you tried this with the upcoming admin theme yet? I tried few weeks ago and it didn't work (probably just because CSS class name changes). Didn't mention about it then since all is bit experimental still.

Link to comment
Share on other sites

I've updated this module to support the new admin theme. It just required a few changes to the VersionControlForTextFields.js file (I had to rename it to .txt because the forum won't accept a .js attachment). It should support both new and old admin theme. But I'm posting here rather than doing a pull request because I haven't had time to adequately test it beyond my own environments where I'm using it. 

Teppo: I've also attached a patch/diff. 

rc-patch.txt

VersionControlForTextFields.js.txt

  • Like 3
Link to comment
Share on other sites

Antti, that should be fixed now, just pushed another version to GitHub.

Looks like you can't set the value of inline CKEditor the way you'd set it for regular CKEditor, ie. find correct instance and use setData().. not even if you first "force" loading that particular inline editor. On the other hand, inserting value directly to inline CKEditor's container div with .html() seems to work but feels a bit hacky :)

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

Update:

Pushed new version to GitHub just moments ago. This fixes some minor glitches and adds new "quick diff" feature. See attached screenshot for more details. It's very primitive at the moment, but I'm hoping to improve it (and some other parts of this module) soon.

This is first actual "feature update" for this module, so I'm a bit nervous and would very much like to hear how it works for you. Tested it here with multiple browsers and fields etc. but I've probably again overlooked some issues.

Regarding the diff feature, Google did most of the heavy lifting there; all I did was integrate their Diff Match and Patch library (JavaScript version) to my code. For the record I was going to use jQuery PrettyTextDiff, but that really didn't feel necessary considering that it's just an attempt to simplify the (already simple) DMP API.

post-175-0-11796000-1384239085_thumb.jpg

  • Like 11
Link to comment
Share on other sites

Hey Teppo - this looks to be great - thanks!

Only catch is that I can't seem to ever click on the "compare with current". I have tried the default and the new dev admin theme but no matter how careful I am, it disappears before I can click on it.

Link to comment
Share on other sites

@adrian: interesting.. could you tell me a bit about your environment, i.e. browser and OS? Is this behavior specific to certain field or does it happen everywhere?

I can't seem to reproduce this issue here, but I'll try to run some more tests soon. (Just for the record, I had similar issues with long revision lists, i.e. ones with scrollbar, when using IE9.. I'm pretty sure I already fixed that issue, but this sounds like it could be somehow related to that.)

Link to comment
Share on other sites

Hey teppo,

OSX and Chrome with CKEditor, TinyMCE, or plain textarea. I tried on body and summary fields and both have the same issue. I'll try to investigate further when I have a little more time - sorry I don't have anything more useful right now!

Link to comment
Share on other sites

@adrian no worries and thanks for your effort, the information you've provided so far is already very helpful. I don't have any OSX devices myself, but I'll try to find one somewhere (unless I can actually reproduce this with Win Chrome, that is.) :)

Link to comment
Share on other sites

A little more testing - if I move the mouse very slowly onto the "compare with current" it works with some PW admin themes but not all and it is pretty difficult to get right. I actually tried on Win7/Chrome and am actually having more troubles - haven't managed to get it to work at all.

I have tested different versions of PW without any real pattern. Maybe don't worry until someone else confirms it!

Link to comment
Share on other sites

@adrian: finally had a chance to take a closer look and now I'm no longer sure how this could've worked at any point.. there was an issue where moving the mouse cursor over an absolutely positioned element within revision list triggered mouseleave on the parent element, effectively making it disappear.

Should be fixed now in latest version at GitHub. It'd still be nice to hear back from you whether this actually helped :)

Edit: and, again, thanks a lot for helping debug this issue!

Edited by teppo
  • Like 2
Link to comment
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
 Share

×
×
  • Create New...