Skip to content

Commit

Permalink
Merge pull request #3475 from nextcloud/backport/2757/stable24
Browse files Browse the repository at this point in the history
[stable24] Bring back menubar without formatting on plain text mode
  • Loading branch information
max-nextcloud authored Nov 23, 2022
2 parents 877e32d + 7eb43fd commit a8dda86
Show file tree
Hide file tree
Showing 17 changed files with 49 additions and 31 deletions.
21 changes: 15 additions & 6 deletions cypress/integration/files.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,25 @@
*
*/

import { randHash } from '../utils/'
const randUser = randHash()

describe('Files default view', function() {
beforeEach(function() {
cy.login('admin', 'admin')
before(function() {
cy.nextcloudCreateUser(randUser, 'password')
cy.login(randUser, 'password')
cy.createFile('textfile.txt', '', 'text/plain')
})

it('See the default files list', function() {
cy.get('#fileList tr').should('contain', 'welcome.txt')
beforeEach(function() {
cy.login(randUser, 'password')
})

it('Take screenshot', function() {
cy.screenshot()
it('opens plain text files', function() {
cy.get('#fileList tr').should('contain', 'textfile.txt')
cy.openFile('textfile.txt')
cy.get('.modal-title').should('contain', 'textfile.txt')
cy.get('#editor-session-list').should('contain', 'Saved')
})

})
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.

9 changes: 7 additions & 2 deletions src/components/EditorWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
ref="menubar"
:file-path="relativePath"
:file-id="fileId"
:is-read-only="readOnly"
:is-rich-editor="isRichEditor"
:is-public="isPublic"
:autohide="autohide"
Expand All @@ -68,7 +69,7 @@
</MenuBar>
<div v-if="!menubarLoaded" class="menubar placeholder" />
<div ref="contentWrapper" class="content-wrapper">
<MenuBubble v-if="renderMenus"
<MenuBubble v-if="renderRichEditorMenus"
:content-wrapper="contentWrapper"
:file-path="relativePath" />
<EditorContent v-show="contentLoaded"
Expand Down Expand Up @@ -291,12 +292,16 @@ export default {
displayed() {
return this.currentSession && this.active
},
renderMenus() {
renderRichEditorMenus() {
return this.contentLoaded
&& this.isRichEditor
&& !this.syncError
&& !this.readOnly
},
renderMenus() {
return this.contentLoaded
&& !this.syncError
},
},
watch: {
lastSavedStatus() {
Expand Down
8 changes: 6 additions & 2 deletions src/components/MenuBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
class="hidden-visually"
:multiple="true"
@change="onImageUploadFilePicked">
<div v-if="isRichEditor" ref="menubar" class="menubar-icons">
<div v-if="isRichEditor && !isReadOnly" ref="menubar" class="menubar-icons">
<template v-for="(icon) in icons">
<EmojiPicker v-if="icon.class === 'icon-emoji'"
v-show="icon.priority <= iconCount"
Expand Down Expand Up @@ -154,6 +154,10 @@ export default {
useEditorMixin,
],
props: {
isReadOnly: {
type: Boolean,
default: false,
},
isRichEditor: {
type: Boolean,
default: true,
Expand Down Expand Up @@ -189,7 +193,7 @@ export default {
submenuVisibility: {},
lastImagePath: null,
icons: [...menuBarIcons],
editorHasFocus: false
editorHasFocus: false,
}
},
computed: {
Expand Down

0 comments on commit a8dda86

Please sign in to comment.