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

UI fixes for public share links #608

Merged
merged 13 commits into from
Jan 28, 2020
6 changes: 3 additions & 3 deletions css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
position: absolute;
}

.ProseMirror-hideselection *::selection { background: transparent; }
.ProseMirror-hideselection *::-moz-selection { background: transparent; }
.ProseMirror-hideselection { caret-color: transparent; }
.ProseMirror-hideselection *::selection { background: transparent; color: var(--color-main-text); }
.ProseMirror-hideselection *::-moz-selection { background: transparent; color: var(--color-main-text); }
.ProseMirror-hideselection { caret-color: transparent; color: var(--color-main-text); }

.ProseMirror-selectednode {
outline: 2px solid #8cf;
Expand Down
30 changes: 29 additions & 1 deletion cypress/integration/share.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ describe('Open test.md in viewer', function() {
// Upload test files
cy.uploadFile('test.md', 'text/markdown')
cy.uploadFile('test.md', 'text/markdown', 'test2.md')
cy.createFolder('folder')
cy.uploadFile('test.md', 'text/markdown', 'folder/test.md')
cy.visit('/apps/files')
cy.get('#fileList tr[data-file="test.md"]', {timeout: 10000})
.should('contain', 'test.md')
Expand All @@ -51,7 +53,8 @@ describe('Open test.md in viewer', function() {
})

it('Shares the file as a public read only link', function () {
cy.visit('/apps/files')
cy.visit('/apps/files', { timeout: 10000 })
cy.wait(1000)
cy.get('#fileList tr[data-file="test.md"] a.action-share', {timeout: 10000}).trigger('click')
cy.get('#app-sidebar')
.should('be.visible')
Expand All @@ -73,6 +76,7 @@ describe('Open test.md in viewer', function() {

it('Shares the file as a public link with write permissions', function () {
cy.visit('/apps/files')
cy.wait(1000)
cy.get('#fileList tr[data-file="test2.md"] a.action-share', {timeout: 10000}).trigger('click')
cy.get('#app-sidebar')
.should('be.visible')
Expand Down Expand Up @@ -100,6 +104,7 @@ describe('Open test.md in viewer', function() {

it('Opens the editor as guest', function () {
cy.visit('/apps/files')
cy.wait(1000)
cy.get('#fileList tr[data-file="test2.md"] a.action-share', {timeout: 10000}).trigger('click')
cy.get('#app-sidebar')
.should('be.visible')
Expand All @@ -122,5 +127,28 @@ describe('Open test.md in viewer', function() {
})
})

it('Shares a folder as a public read only link', function () {
cy.visit('/apps/files', { timeout: 10000 })
cy.wait(1000)
cy.get('#fileList tr[data-file="folder"] a.action-share', {timeout: 10000}).trigger('click')
cy.get('#app-sidebar')
.should('be.visible')
cy.get('#app-sidebar a#sharing').trigger('click')
cy.get('#app-sidebar button.new-share-link').trigger('click')
cy.get('#app-sidebar a.sharing-entry__copy')
.should('have.attr', 'href').and('include', '/s/')
.then((href) => {
cy.visit(href)
cy.window().then(win => {
win.OC.appswebroots['files_texteditor'] = true
cy.wait(1000)
cy.openFile('test.md')
cy.get('#editor-container', { timeout: 4000 }).should('be.visible')
cy.get('#editor .ProseMirror').should('contain', 'Hello world')
cy.get('#editor .ProseMirror h2').should('contain', 'Hello world')
})
})
})


})
6 changes: 3 additions & 3 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.

8 changes: 4 additions & 4 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.

8 changes: 4 additions & 4 deletions js/files.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions js/preview.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions js/public.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions lib/Service/DocumentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ public function createDocument(File $file): Document {
}

try {
$documentBaseFile = $this->appData->getFolder('documents')->getFile($file->getFileInfo()->getId());
$documentBaseFile = $this->appData->getFolder('documents')->getFile((string)$file->getFileInfo()->getId());
} catch (NotFoundException $e) {
$documentBaseFile = $this->appData->getFolder('documents')->newFile($file->getFileInfo()->getId());
$documentBaseFile = $this->appData->getFolder('documents')->newFile((string)$file->getFileInfo()->getId());
}
$documentBaseFile->putContent($file->fopen('r'));

Expand Down Expand Up @@ -302,7 +302,7 @@ public function resetDocument($documentId, $force = false): void {
$this->documentMapper->delete($document);

try {
$this->appData->getFolder('documents')->getFile($documentId)->delete();
$this->appData->getFolder('documents')->getFile((string)$documentId)->delete();
} catch (NotFoundException $e) {
} catch (NotPermittedException $e) {
}
Expand Down
4 changes: 3 additions & 1 deletion src/EditorFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ const createEditor = ({ content, onInit, onUpdate, extensions, enableRichEditing
new Blockquote(),
new CodeBlock(),
new ListItem(),
new Link(),
new Link({
openOnClick: true,
}),
new Image(),
new Placeholder({
emptyNodeClass: 'is-empty',
Expand Down
1 change: 1 addition & 0 deletions src/components/EditorWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ export default {
max-width: 100%;
height: 100%;
left: 0;
top: 50px;
margin: 0 auto;
position: relative;
background-color: var(--color-main-background);
Expand Down
6 changes: 3 additions & 3 deletions src/components/MenuBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
:class="getIconClasses(isActive, icon)"
@click="clickIcon(commands, icon)" />
<template v-else>
<div v-show="$index < iconCount"
<div v-show="$index < iconCount || !icon.class"
:key="icon.label"
v-click-outside="() => hideChildMenu(icon)"
class="submenu">
Expand All @@ -53,14 +53,14 @@
@click="clickIcon(commands, icon)">
{{ icon.label }}
</ActionButton>
<template v-else-if="!icon.class && isHiddenInMenu($index)">
<!--<template v-else-if="!icon.class && isHiddenInMenu($index)">
<ActionButton v-for="childIcon in icon.children"
:key="childIcon.class"
:icon="childIcon.class"
@click="clickIcon(commands, childIcon)">
{{ childIcon.label }}
</ActionButton>
</template>
</template>-->
</template>
</Actions>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/ListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export default class ListItem extends TiptapListItem {
})
const isListClicked = event.target.tagName.toLowerCase() === 'li'
if (typeof parentList === 'undefined' || parentList.node.attrs.type !== TYPES.CHECKBOX || !isListClicked) {
return true
return
}

const tr = state.tr
Expand Down
16 changes: 15 additions & 1 deletion src/views/DirectEditing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ export default {
beforeMount() {
callMobileMessage('loading')
},
mounted() {
document.querySelector('meta[name="viewport"]').setAttribute('content', 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0')
},
methods: {
async close() {
this.saving = true
Expand All @@ -123,9 +126,20 @@ export default {
</script>

<style scoped lang="scss">
body {
position: fixed;
}

#direct-editor {
width: 100%;
height: 100vh;
height: 100%;
position: fixed;
overflow: hidden;

&::v-deep #editor-container {
height: 100%;
top: 0;
}
&::v-deep #editor-wrapper div.ProseMirror {
margin-top: 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/views/FilesSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-
-->
<template>
<div id="files-setting-showhidden">
<div id="files-setting-richworkspace">
<input id="showRichWorkspacesToggle"
v-model="showWorkspace"
class="checkbox"
Expand Down
5 changes: 3 additions & 2 deletions src/views/RichWorkspace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,12 @@ export default {
this.file = data.file
this.editing = true
this.loaded = true
this.creating = false
}).catch(() => {
this.file = null
this.loaded = true
this.ready = true
this.creating = false
})
},
createNew() {
Expand All @@ -136,7 +138,6 @@ export default {
window.FileList.createFile('Readme.md', { scrollTo: false, animate: false }).then((status, data) => {
this.getFileInfo()
this.autofocus = true
this.creating = false
})
},
},
Expand Down Expand Up @@ -193,7 +194,7 @@ export default {
}

#rich-workspace::v-deep .menubar {
z-index: 90;
z-index: 50;
/* Slightly reduce vertical space */
margin-bottom: -10px;
}
Expand Down