Skip to content

row td wrong position #185

Closed
Closed

Description

@BennieMeng

Step -1: Before filling an issue check out troubleshooting section

Step 0: Describe your environment

  • diff2html version: 2.5.0

Step 1: Describe the problem:

Steps to reproduce:

  1. use bootstrap modal
  2. put dom in modal-content

diff example:

image

Observed Results:

when scrollBar show, the row td is wrong position

Expected Results:

i find remove td position: absolute, it is ok;

Relevant Code:

// TODO(you): code here to reproduce the problem
.d2h-code-side-linenumber, .d2h-code-linenumber{
position: static !important;
}
.d2h-code-side-line, .d2h-code-line{
margin-left: 0px !important;
}

Activity

  1. BennieMeng commented on Dec 19, 2018

    @BennieMeng
    Author

    should we remove the position: absolute; and padding-right attribute?

  2. rtfpessoa commented on Dec 22, 2018

    @rtfpessoa
    Owner

    @BennieMeng I started doing some work a while ago in https://github.com/rtfpessoa/diff2html/pull/180/files can you try that css?

  3. BennieMeng commented on Dec 24, 2018

    @BennieMeng
    Author

    it looks good by your change, i will try it when package updated.

  4. rtfpessoa commented on Jan 4, 2019

    @rtfpessoa
    Owner

    @BennieMeng please check version 2.6.0

  5. rtfpessoa commented on Jan 5, 2019

    @rtfpessoa
    Owner

    Closing this for now. If needed we can reopen.

  6. ve3 commented on Jul 3, 2021

    @ve3

    This happens again in v3.4.5

    I tried to add position: relative; to the table where contain class d2h-diff-table and it seems to be fixed.
    Maybe consider to add position relative on the <table> itself.

  7. rtfpessoa commented on Jul 9, 2021

    @rtfpessoa
    Owner

    @ve3 can you provide an example to replicate?

  8. ve3 commented on Jul 9, 2021

    @ve3
    <!DOCTYPE html>
    <html>
    	<head>
    		<meta charset="utf-8">
    		<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/diff2html/bundles/css/diff2html.min.css" />
    		<style>
    			.wrapper {
    				height: 400px;
    				overflow: auto;
    			}
    		</style>
    	</head>
    	<body>
    		<div class="wrapper">
    			<div id="destination-elem-id"></div>
    		</div>
    		<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/diff2html/bundles/js/diff2html-ui.min.js"></script>
    		<script>
    			const targetElement = document.getElementById('destination-elem-id');
    			const configuration = { drawFileList: true, matching: 'lines' };
    
    			const diffString = `diff --git a/Libraries/Image.php b/Libraries/Image.php
    index 51f2fb1..02029f9 100644
    --- a/Libraries/Image.php
    +++ b/Libraries/Image.php
    @@ -115,6 +115,7 @@ class Image
          *              but it is not original uploaded file that was created before apply watermark.<br>
          * @param array $options Associative array as options:<br>
          *              \`restrictedFolder\` (array) Set custom restricted folder names to array. For more description please read on \`\Rdb\Modules\RdbCMSA\Libraries\SPLIterators\FilterRestricted->__construct()\`. For default, it is using restricted it \`FilesTrait\`.<br>
    +     *              \`deleteOriginal\` (bool) Set to \`true\` to delete original file, \`false\` to not delete original file. Default is \`true\`.<br>
          * @return bool Return \`true\` for successfully removed watermark, skipped because there is no backup file (never set watermark before).<br>
          *                      Return \`false\` for otherwise.
          */
    @@ -154,21 +155,27 @@ class Image
             }
    
             // only successfully copied file process can goes here.
    -        // delete original (backup) file.
    -        $deleteResult = @unlink($originalFile);
    +        if (!isset($options['deleteOriginal']) || $options['deleteOriginal'] === true) {
    +            // if delete original
    +            // delete original (backup) file.
    +            $deleteResult = @unlink($originalFile);
    
    -        if (true !== $deleteResult) {
    -            if (isset($Logger)) {
    -                $Logger->write(
    -                    'modules/rdbcmsa/libraries/image/removewatermark',
    -                    2,
    -                    'Unable to delete original file. {file}',
    -                    [
    -                        'file' => $originalFile,
    -                    ]
    -                );
    +            if (true !== $deleteResult) {
    +                if (isset($Logger)) {
    +                    $Logger->write(
    +                        'modules/rdbcmsa/libraries/image/removewatermark',
    +                        2,
    +                        'Unable to delete original file. {file}',
    +                        [
    +                            'file' => $originalFile,
    +                        ]
    +                    );
    +                }
                 }
    -        }
    +        } else {
    +            // if not delete original
    +            $deleteResult = true;
    +        }// endif delete original
             unset($Logger, $originalFile);
    
             return ($copyResult === true && $deleteResult === true);
    @@ -241,6 +248,11 @@ class Image
             if (!$this->Container instanceof \Rdb\System\Container) {
                 throw new \RuntimeException('The property \`Container\` must be set.');
             }
    +
    +        if (!is_file($file)) {
    +            // if file was not found.
    +            return false;
    +        }
    
             if (!isset($options['returnFullPath'])) {
                 $options['returnFullPath'] = true;
    @@ -401,8 +413,8 @@ class Image
             $Image->png_quality = (isset($options['png_quality']) && is_int($options['png_quality']) ? $options['png_quality'] : 5);
             unset($originalFile);
    
    -        $doWatermark = $Image->watermarkImage($watermarkFile, 'center', 'middle');
             $doResize = $Image->resize(2000, 2000);
    +        $doWatermark = $Image->watermarkImage($watermarkFile, 'center', 'middle');
             $doSave = $Image->save($file);
             $Image->clear();
             unset($watermarkFile);`;
    
    			const diff2htmlUi = new Diff2HtmlUI(targetElement, diffString, configuration);
    			diff2htmlUi.draw();
    		</script>
    	</body>
    </html>
  9. rtfpessoa commented on Jul 9, 2021

    @rtfpessoa
    Owner

    The problem is that it does not support scroll in the tables. At the moment that seems not to be easy to accomplish.
    If you have a full solution that does not break other parts feel free to send a PR.

    But take into consideration that usually adding relatives will break the line numbers.

  10. ve3 commented on Jul 9, 2021

    @ve3

    I have tried add position relation to d2h-diff-table class and it's working perfectly.

    Just position absolute without relative in the parent is not flexible at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions