diff --git a/CHANGELOG b/CHANGELOG index 16986281bb8..b806e5e7f80 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -13,7 +13,6 @@ v 8.13.0 (unreleased) - Revoke button in Applications Settings underlines on hover. - Update ruby-prof to 0.16.2. !6026 (Elan Ruusamäe) - Add organization field to user profile - - Added soft wrap option to editor - Optimize GitHub importing for speed and memory v 8.12.2 (unreleased) diff --git a/app/assets/javascripts/blob_edit/edit_blob.js b/app/assets/javascripts/blob_edit/edit_blob.js index de6cdd851be..b846bab0424 100644 --- a/app/assets/javascripts/blob_edit/edit_blob.js +++ b/app/assets/javascripts/blob_edit/edit_blob.js @@ -22,7 +22,6 @@ // submitted textarea })(this)); this.initModePanesAndLinks(); - this.initSoftWrap(); new BlobLicenseSelectors({ editor: this.editor }); @@ -51,7 +50,6 @@ this.$editModePanes.hide(); currentPane.fadeIn(200); if (paneId === "#preview") { - this.$toggleButton.hide(); return $.post(currentLink.data("preview-url"), { content: this.editor.getValue() }, function(response) { @@ -59,23 +57,10 @@ return currentPane.syntaxHighlight(); }); } else { - this.$toggleButton.show(); return this.editor.focus(); } }; - EditBlob.prototype.initSoftWrap = function() { - this.isSoftWrapped = false; - this.$toggleButton = $('.soft-wrap-toggle'); - this.$toggleButton.on('click', this.toggleSoftWrap.bind(this)); - }; - - EditBlob.prototype.toggleSoftWrap = function(e) { - this.isSoftWrapped = !this.isSoftWrapped; - this.$toggleButton.toggleClass('soft-wrap-active', this.isSoftWrapped); - this.editor.getSession().setUseWrapMode(this.isSoftWrapped); - }; - return EditBlob; })(); diff --git a/app/assets/stylesheets/pages/editor.scss b/app/assets/stylesheets/pages/editor.scss index 5ea6ce85019..1aa4e06d975 100644 --- a/app/assets/stylesheets/pages/editor.scss +++ b/app/assets/stylesheets/pages/editor.scss @@ -59,7 +59,6 @@ } .encoding-selector, - .soft-wrap-toggle, .license-selector, .gitignore-selector, .gitlab-ci-yml-selector { @@ -68,26 +67,6 @@ font-family: $regular_font; } - .soft-wrap-toggle { - margin: 0 $btn-side-margin; - - .soft-wrap { - display: block; - } - .no-wrap { - display: none; - } - - &.soft-wrap-active { - .soft-wrap { - display: none; - } - .no-wrap { - display: block; - } - } - } - .gitignore-selector, .license-selector, .gitlab-ci-yml-selector { .dropdown { line-height: 21px; diff --git a/app/views/projects/blob/_editor.html.haml b/app/views/projects/blob/_editor.html.haml index d4f59764a70..0237e152b54 100644 --- a/app/views/projects/blob/_editor.html.haml +++ b/app/views/projects/blob/_editor.html.haml @@ -21,13 +21,6 @@ = dropdown_tag("Choose a .gitignore template", options: { toggle_class: 'js-gitignore-selector', title: "Choose a template", filter: true, placeholder: "Filter", data: { data: gitignore_names } } ) .gitlab-ci-yml-selector.js-gitlab-ci-yml-selector-wrap.hidden = dropdown_tag("Choose a GitLab CI Yaml template", options: { toggle_class: 'js-gitlab-ci-yml-selector', title: "Choose a template", filter: true, placeholder: "Filter", data: { data: gitlab_ci_ymls } } ) - = button_tag class: 'soft-wrap-toggle btn', type: 'button' do - %span.no-wrap - = custom_icon('icon_no_wrap') - No wrap - %span.soft-wrap - = custom_icon('icon_soft_wrap') - Soft wrap .encoding-selector = select_tag :encoding, options_for_select([ "base64", "text" ], "text"), class: 'select2' diff --git a/app/views/shared/icons/_icon_no_wrap.svg b/app/views/shared/icons/_icon_no_wrap.svg deleted file mode 100644 index fe34cada002..00000000000 --- a/app/views/shared/icons/_icon_no_wrap.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/app/views/shared/icons/_icon_soft_wrap.svg b/app/views/shared/icons/_icon_soft_wrap.svg deleted file mode 100644 index ea27a2024b1..00000000000 --- a/app/views/shared/icons/_icon_soft_wrap.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/spec/features/projects/files/edit_file_soft_wrap_spec.rb b/spec/features/projects/files/edit_file_soft_wrap_spec.rb deleted file mode 100644 index 7ad90b4a89c..00000000000 --- a/spec/features/projects/files/edit_file_soft_wrap_spec.rb +++ /dev/null @@ -1,67 +0,0 @@ -require 'spec_helper' - -feature 'User uses soft wrap whilst editing file', feature: true, js: true do - before do - user = create(:user) - project = create(:project) - project.team << [user, :master] - login_as user - visit namespace_project_new_blob_path(project.namespace, project, 'master', file_name: 'test_file-name') - editor = find('.file-editor.code') - editor.click - editor.send_keys 'Touch water with paw then recoil in horror chase dog then - run away chase the pig around the house eat owner\'s food, and knock - dish off table head butt cant eat out of my own dish. Cat is love, cat - is life rub face on everything poop on grasses so meow. Playing with - balls of wool flee in terror at cucumber discovered on floor run in - circles tuxedo cats always looking dapper, but attack dog, run away - and pretend to be victim so all of a sudden cat goes crazy, yet chase - laser. Make muffins sit in window and stare ooo, a bird! yum lick yarn - hanging out of own butt jump off balcony, onto stranger\'s head yet - chase laser. Purr for no reason stare at ceiling hola te quiero.'.squish - end - - let(:toggle_button) { find('.soft-wrap-toggle') } - - scenario 'user clicks the "No wrap" button and then "Soft wrap" button' do - wrapped_content_width = get_content_width - toggle_button.click - expect(toggle_button).to have_content 'Soft wrap' - unwrapped_content_width = get_content_width - expect(unwrapped_content_width).to be > wrapped_content_width - - toggle_button.click - expect(toggle_button).to have_content 'No wrap' - expect(get_content_width).to be < unwrapped_content_width - end - - scenario 'user adds a ".js" extension and then changes to a ".md" extension' do - wrapped_content_width = get_content_width - - fill_in 'file_name', with: 'test_file-name.js' - expect(toggle_button).to have_content 'Soft wrap' - unwrapped_content_width = get_content_width - expect(unwrapped_content_width).to be > wrapped_content_width - - fill_in 'file_name', with: 'test_file-name.md' - expect(toggle_button).to have_content 'No wrap' - expect(get_content_width).to be < unwrapped_content_width - end - - scenario 'user clicks "No wrap" and then changes to a ".md" extension' do - wrapped_content_width = get_content_width - - toggle_button.click - expect(toggle_button).to have_content 'Soft wrap' - unwrapped_content_width = get_content_width - expect(unwrapped_content_width).to be > wrapped_content_width - - fill_in 'file_name', with: 'test_file-name.md' - expect(toggle_button).to have_content 'Soft wrap' - expect(unwrapped_content_width).to be == get_content_width - end - - def get_content_width - find('.ace_content')[:style].slice!(/width: \d+/).slice!(/\d+/) - end -end