Skip to content

Render identical strings instead of returning null #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mansoorkhan96 opened this issue Mar 4, 2024 · 4 comments · Fixed by #79
Closed

Render identical strings instead of returning null #78

mansoorkhan96 opened this issue Mar 4, 2024 · 4 comments · Fixed by #79
Labels
enhancement New feature or request

Comments

@mansoorkhan96
Copy link

mansoorkhan96 commented Mar 4, 2024

First of all, Thank you so much for working on this amazing package ❤️

I am working on a Versioning plugin that shows the diff for fields like title, content.

Its inspired by WordPress Revisioning system.

Is there any option in this package to render the identical strings as they are instead of returning null. Just like WordPress, it renders both the string as they were not changed.

Here is work around we are using in a package:

if ($old === $new) {
    $diff[$key] = '<table class="diff-wrapper diff diff-html diff-side-by-side"><tbody class="change change-eq"><tr><td class="old">'.$old.'</td><td class="new">'.$new.'</td></tr></tbody></table>';
} else {
    $diff[$key] = str_replace('\n No newline at end of file', '', DiffHelper::calculate($old, $new, $renderer, $differOptions, $renderOptions));
}

Default behaviour of the package is fine. But i wish there is a way to render above by passing a render option maybe?

@jfcherng
Copy link
Owner

jfcherng commented Mar 4, 2024

Could you try PR #79 ?

Just set fullContextIfIdentical to true in differ options.

@jfcherng jfcherng added enhancement New feature or request and removed question Just asking some questions labels Mar 4, 2024
@mansoorkhan96
Copy link
Author

Could you try PR #79 ?

Just set fullContextIfIdentical to true in differ options.

@jfcherng wow man that was quick. I will check in a few.

TYSM.

@mansoorkhan96
Copy link
Author

Could you try PR #79 ?

Just set fullContextIfIdentical to true in differ options.

Works like a charm! Thanks

image

@jfcherng
Copy link
Owner

jfcherng commented Mar 5, 2024

v6.16.0 / v6.10.15 have been released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants