• Stan Hu's avatar
    Fix Markdown table paste not working with GitHub code · cdb267e1
    Stan Hu authored
    In Chrome, copying a block of code GitHub includes an HTML table with
    both the line number and the line itself. This caused the paste function
    to be fooled that a table should be inserted as Markdown instead of
    plain text.
    
    Now, we increase the requirements to determine for pasting a table by
    comparing the HTML and text data:
    
    1. The number of rows have to match
    2. The max number of columns have to match
    
    Note that we use the max number of columns in the tab-delimited text
    because it's possible that a spreadsheet omits empty columns.
    
    Closes https://gitlab.com/gitlab-org/gitlab/issues/195479
    cdb267e1
paste_markdown_table_spec.js 3.36 KB