Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
2.3k views
in Plugins by
edited by

I know that the edit history plugin is an early version, however, I really love the revision history (wiki style) to track changes and would like to improve it! ... we already discussed some suggestions here.


What I added to the plugin:

A. /qa/revisions/ page to list revisions of the last 30 days including editor's name

B. today I added a "edit by username" notice to the revision view

here is the source of the changes (github). + here an live example of the revisions-page


Open Bug:

1. "edited" in activity list should be linked, does not work (neither english nor translated)

2. I got two edits of a post in the database (qa_edit_history). On the revision page, first it shows no edits -> probably the "original post", the 2nd entry shows the title that was changed... Now the revision view shows a 3rd entry (same timestamp as 2nd) where non-edits get displayed as edits (because of the <br>tags I assume), see screenshot below. → not a bug, see comment!

Screenshot:

edit-history-revision

Here is the link to the post revision.


Thanks Scott for your support in solving these 2 bugs!

Kai

by
#to add information to the concerned "bug question":

# *qa_edit_history.content* has stored:

ich habe mehrere Fragen

1. Die von der Überschrift

2. Wenn die Miete um 18% erhöt wird und jetzt 802,40 euro kostet.Um wie viel Euro stieg der Mietpreis?

3.Eine Kaufhauskette wirbt mit Preisnachlässen

0,98euro (Vorher 1,09 euro)

149 euro (Vorher 169 euro)

1,38 euro ( 1,48 euro)

0,98 euro (vorher 1,22 euro)

a) wie viel Prozent beträgt der neue Preis jewwils vom alten?

b) Bei welchem Angebot spart man am meisten?

----

# whereas *qa_posts.content* has stored text + tags:

<p>
    ich habe mehrere Fragen<br>
    <br>
    1. <span class="entry-title">Von 1971 bis 2001 stieg die Schülerzahl auf rund 300000. Wie viele Schüler gab es 1971 etwa?</span><br>
    <br>
    2. Wenn die Miete um 18% erhöt wird und jetzt 802,40 euro kostet.Um wie viel Euro stieg der Mietpreis?<br>
    <br>
    3.Eine Kaufhauskette wirbt mit Preisnachlässen<br>
    <br>
    0,98euro (Vorher 1,09 euro)<br>
    <br>
    149 euro (Vorher 169 euro)<br>
    <br>
    1,38 euro ( 1,48 euro)<br>
    <br>
    0,98 euro (vorher 1,22 euro)<br>
    <br>
    a) wie viel Prozent beträgt der neue Preis jewwils vom alten?<br>
    <br>
    b) Bei welchem Angebot spart man am meisten?</p>
by
edited by
Update: N°2 might no be a bug, as another edit of the post above revealed that <br> tags were really added to the edits! Now the version with the tags is stored in qa_edit_history.

Three Questions come up:
1. After edit-button has been pressed, has CKEditor changed the content when loading?
2. Was the initial content stored without <br> tags and CKeditor "converted" the line breaks to <br> ... but how was the user able to insert text in CKeditor without formatting?
3. Does it make sense to ignore <br> tags when comparing? (i doubt)

1 Answer

+1 vote
by

Hi Kai,  thanks for the contributions, I'll take a look and maybe fold them into my version. The main revision page could probably be done in the same file as the individual post revisions, rather than a separate page plugin.

I will set up a language file for all the strings so you can write your own translations, and I can hopefully fix the bug with "edited" not getting linked.

The second issue is strange. I tested myself with the CKeditor and it stored the original post with HTML. Was your post originally plaintext or markdown and you changed it elsewhere?

 

Also note that the diffs will always show the difference between the source code, not the difference between the "rendered output". That's because adding the <ins> and <del> tags in the middle of other tags causes a lot of problems. Source comparisons are fine for me.

BTW you can report issues on the repo here. That way it's easier for me to tick them off as I fix them.

by
Thanks for your reply Scott. I would be happy to see v0.2 coming!

For the issue n°2: All posts on my site are written with ckeditor, there is no plain text or markdown option. I think now I know what happened (I tested right now!): * The user must have copied his text from another site and pasted it in the ckeditor, thus ckeditor did not do any formatting. Text were sent plain to the server. When I loaded the content for editing, ckeditor must have added the line breaks. So these were shown as edits!

So the good news: It is NOT a bug :)

PS: Thanks for pointing out the github-issue-page, I haven't known this before...
by
confused... I wrote an answer this morning (ckeditor), now I edited it and added two lines in the end (nothing else). The revision shows many more edits (see <br> tags): http://www.gute-mathe-fragen.de/revisions/1906

d*mn it .)
by
edited by
UPDATE: It is not a bug of the plugin, but with ckeditor that sets line breaks by default after each starting tag!

Issue solved (!) see: https://github.com/svivian/q2a-edit-history/issues/3
We need to change settings of ckeditor...
by
Hi Scott, I forgot to send you the update of the page: https://github.com/echteinfachtv/q2a-edit-history/blob/master/qa-revision-page.php

It is not-perfectly coded but you might take some lines for the plugin page of yours. Still needs to set the correct answer link to the "live version".
...