mirror of
https://github.com/silverstripe/silverstripe-versionfeed
synced 2024-10-22 11:05:31 +02:00
FIX Replace Diff class to HtmlDiff (#80)
This commit is contained in:
parent
a753712806
commit
002fbf766c
@ -11,7 +11,7 @@ use SilverStripe\ORM\ArrayList;
|
|||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\FieldType\DBField;
|
use SilverStripe\ORM\FieldType\DBField;
|
||||||
use SilverStripe\SiteConfig\SiteConfig;
|
use SilverStripe\SiteConfig\SiteConfig;
|
||||||
use SilverStripe\View\Parsers\Diff;
|
use SilverStripe\View\Parsers\HtmlDiff;
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
|
|
||||||
class VersionFeed extends SiteTreeExtension
|
class VersionFeed extends SiteTreeExtension
|
||||||
@ -94,7 +94,7 @@ class VersionFeed extends SiteTreeExtension
|
|||||||
if (isset($previous)) {
|
if (isset($previous)) {
|
||||||
// Produce the diff fields for use in the template.
|
// Produce the diff fields for use in the template.
|
||||||
if ($version->Title != $previous->Title) {
|
if ($version->Title != $previous->Title) {
|
||||||
$diffTitle = Diff::compareHTML($version->Title, $previous->Title);
|
$diffTitle = HtmlDiff::compareHTML($version->Title, $previous->Title);
|
||||||
|
|
||||||
$version->DiffTitle = DBField::create_field('HTMLText', null);
|
$version->DiffTitle = DBField::create_field('HTMLText', null);
|
||||||
$version->DiffTitle->setValue(
|
$version->DiffTitle->setValue(
|
||||||
@ -107,7 +107,7 @@ class VersionFeed extends SiteTreeExtension
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($version->Content != $previous->Content) {
|
if ($version->Content != $previous->Content) {
|
||||||
$diffContent = Diff::compareHTML($version->Content, $previous->Content);
|
$diffContent = HtmlDiff::compareHTML($version->Content, $previous->Content);
|
||||||
|
|
||||||
$version->DiffContent = DBField::create_field('HTMLText', null);
|
$version->DiffContent = DBField::create_field('HTMLText', null);
|
||||||
$version->DiffContent->setValue('<div>'.$diffContent.'</div>');
|
$version->DiffContent->setValue('<div>'.$diffContent.'</div>');
|
||||||
|
Loading…
Reference in New Issue
Block a user