Skip to content

Commit

Permalink
Merge pull request #4346 from nextcloud/feature/hide-share-and-close-…
Browse files Browse the repository at this point in the history
…buttons-on-direct-editing

Co-authored-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
  • Loading branch information
juliushaertl and nextcloud-command committed Jun 27, 2023
2 parents d19c971 + d0d9535 commit 0defd4d
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 49 deletions.
33 changes: 3 additions & 30 deletions cypress/e2e/directediting.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,68 +53,41 @@ describe('direct editing', function() {
initUserAndFiles(user, 'test.md', 'empty.md', 'empty.txt')
})

it('Open an existing file, edit and close it', () => {
it('Open an existing file, edit it', () => {
createDirectEditingLink(user, 'empty.md')
.then((token) => {
cy.logout()
cy.visit(token)
})
const closeRequestAlias = 'closeRequest'
cy.intercept({ method: 'POST', url: '**/session/close' }).as(closeRequestAlias)
cy.getContent().type('# This is a headline')
cy.getContent().type('{enter}')
cy.getContent().type('Some text')
cy.getContent().type('{enter}')

cy.get('button.icon-close').click()
cy.wait(`@${closeRequestAlias}`).then(() => {
cy.getFileContent('empty.md').then((content) => {
expect(content).to.equal('# This is a headline\n\nSome text')
})
})
})

it('Create a file, edit and close it', () => {
it('Create a file, edit it', () => {
createDirectEditingLinkForNewFile(user, 'newfile.md')
.then((token) => {
cy.logout()
cy.visit(token)
})
const closeRequestAlias = 'closeRequest'
cy.intercept({ method: 'POST', url: '**/session/close' }).as(closeRequestAlias)

cy.getContent().type('# This is a headline')
cy.getContent().type('{enter}')
cy.getContent().type('Some text')
cy.getContent().type('{enter}')

cy.get('button.icon-close').click()
cy.wait(`@${closeRequestAlias}`).then(() => {
cy.getFileContent('newfile.md').then((content) => {
expect(content).to.equal('# This is a headline\n\nSome text')
})
})
})

it('Open an existing plain text file, edit and close it', () => {
it('Open an existing plain text file, edit it', () => {
createDirectEditingLink(user, 'empty.txt')
.then((token) => {
cy.logout()
cy.visit(token)
})
const closeRequestAlias = 'closeRequest'
cy.intercept({ method: 'POST', url: '**/session/close' }).as(closeRequestAlias)

cy.getContent().type('# This is a headline')
cy.getContent().type('{enter}')
cy.getContent().type('Some text')
cy.getContent().type('{enter}')

cy.get('button.icon-close').click()
cy.wait(`@${closeRequestAlias}`).then(() => {
cy.getFileContent('empty.txt').then((content) => {
expect(content).to.equal('# This is a headline\nSome text\n')
})
})
})
})
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/text-editors.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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.

7 changes: 6 additions & 1 deletion src/views/DirectEditing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
:mime="initial.mimetype"
:is-direct-editing="true"
@ready="loaded">
<template #header>
<template v-if="isMobile" #header>
<button class="icon-share" @click="share" />
<button class="icon-close" @click="close" />
</template>
Expand Down Expand Up @@ -103,6 +103,11 @@ export default {
initialSession() {
return JSON.parse(this.initial.session) || null
},
isMobile() {
return (window.DirectEditingMobileInterface || (window.webkit
&& window.webkit.messageHandlers
&& window.webkit.messageHandlers.DirectEditingMobileInterface))
},
},
beforeMount() {
callMobileMessage('loading')
Expand Down

0 comments on commit 0defd4d

Please sign in to comment.