Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/components/EditorWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ export default {
this.$parent.$emit('error', 'No valid file provided')
return
}
OCA.Text.RichWorkspaceFilePath = this.relativePath
const guestName = localStorage.getItem('nick') ? localStorage.getItem('nick') : getRandomGuestName()
this.syncService = new SyncService({
shareToken: this.shareToken,
Expand Down
4 changes: 4 additions & 0 deletions src/components/MenuBubble.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ export default {
client.getFileInfo(file).then((_status, fileInfo) => {
const path = optimalPath(this.filePath, `${fileInfo.path}/${fileInfo.name}`)
const encodedPath = path.split('/').map(encodeURIComponent).join('/')
// add context to hack around unset OCA.Viewer.file being unset
// when editing Readme.md in "Richworkspace"-mode,
OCA.Text.RichWorkspaceFilePath = this.filePath
command({ href: `${encodedPath}?fileId=${fileInfo.id}` })
OCA.Text.RichWorkspaceFilePath = ''
this.hideLinkMenu()
})
}, false, [], true, undefined, startPath)
Expand Down
1 change: 1 addition & 0 deletions src/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,5 @@ if (workspaceAvailable) {

OCA.Text = {
RichWorkspaceEnabled: workspaceEnabled,
RichWorkspaceFilePath: '',
}
3 changes: 2 additions & 1 deletion src/helpers/links.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ const domHref = function(node) {
const match = ref.match(/^([^?]*)\?fileId=(\d+)/)
if (match) {
const [, relPath, id] = match
const currentDir = basedir(OCA.Viewer.file)
const file = OCA.Viewer.file || OCA.Text.RichWorkspaceFilePath
const currentDir = basedir(file)
const dir = absolutePath(currentDir, basedir(relPath))
return generateUrl(`/apps/files/?dir=${dir}&openfile=${id}#relPath=${relPath}`)
}
Expand Down
1 change: 1 addition & 0 deletions src/public.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,5 @@ documentReady(() => {

OCA.Text = {
RichWorkspaceEnabled: loadState('text', 'workspace_available'),
RichWorkspaceFilePath: '',
}
4 changes: 4 additions & 0 deletions src/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ if (typeof OCA.Viewer === 'undefined') {
theme: 'default',
})
}

OCA.Text = {
RichWorkspaceFilePath: '',
}