Skip to content

GitLab

  • Menu
    • Projects Groups Snippets
      Help
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Merge requests
  • !7222

Merged
Created 10 years ago by Administrator@rootOwner

Don't remove trailing newline when editing a file in web UI editor

  • Overview 6
  • Commits 1
  • Changes 2

Created by: jhund

What does this MR do?

It addresses an issue where editing a file through the web UI (ACE editor) removes trailing newlines from the edited file.

The current implementation populates the ACE editor’s contents via the inner text of the pre#editor html tag. Since whitespace is not significant in HTML, any trailing newlines are lost when the ACE editor loads its contents from the HTML element. When the user saves the edits, the new file doesn’t have a trailing newline any more.

This commit changes how the editor’s content is populated to use the editor’s editor.setValue(); Javascript API method. Using the API preserves trailing newlines.

Why was this MR needed?

Because editing content via gitlab’s web UI should not strip the edited file’s trailing newlines.

What are the relevant issue numbers / Feature requests?

  • #5936 (closed)
  • This fix makes the workaround in gitlabhq/app/controllers/projects/edit_tree_controller.rb#preview obsolete.
Loading
Loading

  • Administrator
    Administrator @root · 10 years ago
    Owner

    Created by: TeatroIO

    I've prepared a stage. Click to open.

    By Administrator on 2014-06-27T17:57:18 (imported from GitLab project)

  • Administrator
    Administrator @root · 10 years ago
    Owner

    Created by: MrKeiKun

    👍

    nice

    By Administrator on 2014-06-29T07:02:08 (imported from GitLab project)

  • Administrator
    Administrator @root · 10 years ago
    Owner

    Created by: dosire

    Looks interesting, @jvanbaarsen what do you think?

    By Administrator on 2014-07-07T12:04:17 (imported from GitLab project)

  • Administrator
    Administrator @root · 10 years ago
    Owner

    Created by: jvanbaarsen

    @jhund Thanks for this nice fix, and nicely formatted MR 👍 @randx Looks good to merge!

    -- Edit I've restarted the Mysql Spinach test.. Since that one was failing cause of a time-out

    By Administrator on 2014-07-07T19:39:06 (imported from GitLab project)

  • Administrator
    Administrator @root · 10 years ago
    Owner

    Created by: dzaporozhets

    thanks

    By Administrator on 2014-07-08T06:43:31 (imported from GitLab project)

  • Administrator
    Administrator @root · 10 years ago
    Owner

    Created by: dosire

    @jhund Thanks! Consider sending a PR to add this to the changelog.

    By Administrator on 2014-07-08T07:20:49 (imported from GitLab project)

  • You're only seeing other activity in the feed. To add a comment, switch to one of the following options.
Please register or sign in to reply
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Milestone
No milestone
None
None
Time tracking
No estimate or time spent
1
Labels
Ready for Merge
Assign labels
  • No matching results
  • Manage project labels
Lock merge request
Unlocked
1
1 participant
user avatar
Reference: gpt/large_projects/gitlabhq1!7222
Source branch: github/fork/jhund/fix-5936

    0 pending comments

Menu

Projects Groups Snippets
Help