Skip to content
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

Implements clipboard feature for markdown areas. #7032

Merged
merged 1 commit into from May 28, 2014

Conversation

erbunao
Copy link
Contributor

@erbunao erbunao commented May 28, 2014

This is our (w/ @nmcalabroso) attempt to extend the drag and drop feature in every markdown area (#7011). We have tested this feature in Mac OSX (Mavericks) and hoping to receive more feedbacks (with different OS) from you. Unfortunately, chrome is the only browser that supports the html5 clipboard.

Note:

  1. This PR doesn't support multiple files in clipboard. In case this event happens, the uploader is just sending the one at the top of the clipboard's list.
  2. Some images during our testing are uploaded incorrectly so we tried these same images in github to see if this is the expected behavior and as far as we know, it is. We're suspecting that the clipboard is OS dependent so further testing will be appreciated.

Samples:

Copy-pasting to upload image in creating issue:
copy_paste_issue

Output:
copy-paste-result

Copy-pasting multiple files:
copy_paste_multiple

Output:
copy-paste-merge-result

Copy-pasting from web browser:
copy_paste_browser

Output:
copy_paste_wiki

Error handling:
copy_paste_error

@@ -11,6 +11,8 @@ class ProjectsController < ApplicationController
layout 'navless', only: [:new, :create, :fork]
before_filter :set_title, only: [:new, :create]

rescue_from CarrierWave::IntegrityError, :with => :invalid_file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the new Ruby 1.9 hash syntax.

@MrKeiKun
Copy link
Contributor

interesting...


if my_event.clipboardData and my_event.clipboardData.items
i = 0
console.log my_event.clipboardData.items[0]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove console.log in this PR

@erbunao
Copy link
Contributor Author

erbunao commented May 28, 2014

@randx I've updated the code :)

@Azaret
Copy link

Azaret commented May 28, 2014

Would be nice to extends to formatted text also no?

@MrKeiKun
Copy link
Contributor

@erbunao

i noticed something with the multiple files,
it just uploaded one instead of both(2 files)

@dblessing
Copy link
Member

@MrKeiKun See point #1 above:
"1. This PR doesn't support multiple files in clipboard. In case this event happens, the uploader is just sending the one at the top of the clipboard's list."

😄

@nmcalabroso
Copy link

@MrKeiKun, chrome's api seems broken on copying multiple files (at least in our environment) so we tried to limit the capability of this feature. You can also notice the same behavior on github. @erbunao


processItem = (e, item) ->
console.log e.clipboardData.items.length
console.log isImage(item)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove console.log!!!

@erbunao
Copy link
Contributor Author

erbunao commented May 28, 2014

@randx Sorry about the console logs. All of it are now deleted :)

@dzaporozhets
Copy link
Member

@erbunao thank you :)

dzaporozhets added a commit that referenced this pull request May 28, 2014
Implements clipboard feature for markdown areas.
@dzaporozhets dzaporozhets merged commit 64b1956 into gitlabhq:master May 28, 2014
@dzaporozhets
Copy link
Member

After this merged I cannot copy-paste formatted text into comment form. Cmd+V just doesnt fork for both Chrome and Safari

@dosire
Copy link
Member

dosire commented Jun 3, 2014

@randx had to revert this to re-enable copy pasting formatted text. If you can fix this please submit a new merge request. Also, please allow drag-and-drop for all file formats (non-images are attached as downloads).

@dosire
Copy link
Member

dosire commented Jun 3, 2014

Also, you might want to remove copy-pasting due to missing browser support dropzone/dropzone#517 (comment)

@nmcalabroso
Copy link

@randx, @dosire, we'll look into it. That's definitely a bug. Thanks.

@nmcalabroso
Copy link

@dosire, yeah, I've also read about the HTML5 clipboard being immature, at least, for now. We submitted this PR nonetheless because we have observed that we're getting the same behavior as others (we thought that it's "okay").

@dosire
Copy link
Member

dosire commented Jun 4, 2014

@nmcalabroso Yeah, I can see where you were coming from. But since it broke stuff please submit the adapted version without it.

@dosire
Copy link
Member

dosire commented Jun 4, 2014

@nmcalabroso Of course, it is awesome that you and @erbunao are working on these usability improvements.

@nmcalabroso
Copy link

@dosire, all right, will update this PR soon 👍

@dosire
Copy link
Member

dosire commented Jun 4, 2014

@nmcalabroso Great, thanks!

@nmcalabroso
Copy link

@dosire, just to clarify, what do you mean by "adapted version"?

@padi
Copy link

padi commented Jun 5, 2014

@nmcalabroso I think he meant the drag-and-drop feature without support for copy-pasting images (since it introduced regressions in current behavior.

@nmcalabroso
Copy link

@padi, great! We submitted a new PR for that: #7078

@dosire
Copy link
Member

dosire commented Jun 5, 2014

@padi That was indeed what I meant, thanks.

@nmcalabroso Thanks for submitting the new PR

@erbunao
Copy link
Contributor Author

erbunao commented Jun 5, 2014

@dosire @randx we've submitted a new PR #7082 for the fix. :)

dzaporozhets pushed a commit that referenced this pull request Aug 8, 2016
dzaporozhets pushed a commit that referenced this pull request Aug 8, 2016
Ignore URLs starting with // in Markdown links

## What does this MR do?

Render `[foo](//bar/baz)` as `<a href="//bar/baz">foo</a>`.

## Why was this MR needed?

`[foo](//bar/baz)` currently renders as `<a href="//bar/gitlab-org/gitlab-ce/master/baz">foo</a>`

## What are the relevant issue numbers?

fixes #7032

See merge request !5677
maxlazio pushed a commit that referenced this pull request Aug 11, 2016
* master: (363 commits)
  Added changelog item for issuable form dropdowns
  Add 'run tests' docs from GDK
  Bump gitlab_git to lazy load compare commits
  Add examples to repository files API (!5465)
  Ignore URLs starting with // (!5677)
  Add failing test for #7032
  Update timeago to shorter representation
  Add missing DOWNTIME constant to the AddTimestampsToMembersAgain migration
  Added guide about migrations and downtime
  Update CHANGELOG for 8.10.4
  Add a data migration to fix some missing timestamps in the members table (again)
  Move abilities by subject class to a dedicated method
  Remove unnecessary empty line after css var
  Set consistency in list text height css
  Add description to text/plain emails
  Fix Rename `add_users_into_project` and `projects_ids`
  fix spec
  Underscore variable to camelCase
  using shared path for project import uploads and refactored gitlab remove export worker
  Structure the development documentation
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
9 participants