Skip to content

Commit

Permalink
Merge pull request #2264 from nextcloud/enh/image-drag-n-drop
Browse files Browse the repository at this point in the history
Add image upload via drag'n'drop and paste event
  • Loading branch information
Julien Veyssier authored Mar 31, 2022
2 parents 3ac82dd + 5bdc049 commit 0db660b
Show file tree
Hide file tree
Showing 25 changed files with 151 additions and 478 deletions.
1 change: 0 additions & 1 deletion appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
return [
'routes' => [
['name' => 'Image#insertImageFile', 'url' => '/image/filepath', 'verb' => 'POST'],
['name' => 'Image#insertImageLink', 'url' => '/image/link', 'verb' => 'POST'],
['name' => 'Image#uploadImage', 'url' => '/image/upload', 'verb' => 'POST'],
['name' => 'Image#getImage', 'url' => '/image', 'verb' => 'GET'],

Expand Down
19 changes: 1 addition & 18 deletions cypress/integration/images.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,23 +139,6 @@ describe('Test all image insertion methods', () => {
})
})

it('Insert an image from a link', () => {
cy.openFile('test.md')
clickOnImageAction(ACTION_INSERT_FROM_LINK, (popoverId) => {
const requestAlias = 'insertLinkRequest'
cy.intercept({ method: 'POST', url: '**/link' }).as(requestAlias)

cy.log('Type and validate')
cy.get('div#' + popoverId + ' li:nth-child(3) input[type=text]')
.type('https://nextcloud.com/wp-content/themes/next/assets/img/headers/engineering-small.jpg', { waitForAnimations: true })
.type('{enter}', { waitForAnimations: true })
// Clicking on the validation button is an alternative to typing {enter}
// cy.get('div#' + popoverId + ' li:nth-child(3) form > label').click()

waitForRequestAndCheckImage(requestAlias)
})
})

it('Upload a local image', () => {
cy.openFile('test.md')
// in this case we almost could just attach the file to the input
Expand All @@ -174,7 +157,7 @@ describe('Test all image insertion methods', () => {

it('test if image files are in the attachment folder', () => {
// check we stored the image names/ids
cy.expect(Object.keys(attachmentFileNameToId)).to.have.lengthOf(3)
cy.expect(Object.keys(attachmentFileNameToId)).to.have.lengthOf(2)

cy.get(`#fileList tr[data-file="test.md"]`, { timeout: 10000 })
.should('have.attr', 'data-id')
Expand Down
4 changes: 2 additions & 2 deletions js/editor-rich.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/editor-rich.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/editor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/editor.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/files-modal.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/files-modal.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions js/text-files.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-files.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-public.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-public.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-text.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-text.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-viewer.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-viewer.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/vendors.js

Large diffs are not rendered by default.

Loading

0 comments on commit 0db660b

Please sign in to comment.