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

Restore file download UI when OnlyOffice plugin is disabled #718

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
17 changes: 14 additions & 3 deletions server/common/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,24 @@ func (this Get) FrontendOverrides() []string {
return overrides
}

var xdg_open []string
var xdg_open []func() string

func (this Register) XDGOpen(jsString string) {
xdg_open = append(xdg_open, jsString)
xdg_open = append(xdg_open, func() string {
return jsString
})
}

func (this Register) XDGOpenFunc(fn func() string) {
xdg_open = append(xdg_open, fn)
}

func (this Get) XDGOpen() []string {
return xdg_open
var s []string
for i := 0; i < len(xdg_open); i++ {
s = append(s, xdg_open[i]())
}
return s
}

var cssOverride []func() string
Expand Down
9 changes: 7 additions & 2 deletions server/plugin/plg_editor_onlyoffice/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,19 @@ func init() {
).Methods("GET")
return nil
})
Hooks.Register.XDGOpen(`
Hooks.Register.XDGOpenFunc(func() string {
if plugin_enable() == false {
return ""
}
return `
if(mime === "application/word" || mime === "application/msword" ||
mime === "application/vnd.oasis.opendocument.text" || mime === "application/vnd.oasis.opendocument.spreadsheet" ||
mime === "application/excel" || mime === "application/vnd.ms-excel" || mime === "application/powerpoint" ||
mime === "application/vnd.ms-powerpoint" || mime === "application/vnd.oasis.opendocument.presentation" ) {
return ["appframe", {"endpoint": "/api/onlyoffice/iframe"}];
}
`)
`
})
}

func StaticHandler(res http.ResponseWriter, req *http.Request) {
Expand Down