mirror of
https://github.com/antos-rde/antosdk-apps.git
synced 2025-01-28 23:52:51 +01:00
enable focus event in OnlyOffice
This commit is contained in:
parent
24719c93a4
commit
b243751aa0
@ -10,6 +10,7 @@ way to work with multiple documents at the same time.
|
|||||||
![https://github.com/lxsang/antosdk-apps/blob/master/OnlyOffice/screenshot.png?raw=true](https://github.com/lxsang/antosdk-apps/blob/master/OnlyOffice/screenshot.png?raw=true)
|
![https://github.com/lxsang/antosdk-apps/blob/master/OnlyOffice/screenshot.png?raw=true](https://github.com/lxsang/antosdk-apps/blob/master/OnlyOffice/screenshot.png?raw=true)
|
||||||
|
|
||||||
## Change log
|
## Change log
|
||||||
|
- v 0.1.4a: If the iframe has the same origin with the parent, enable the focus event
|
||||||
- v 0.1.3a: Let backend generates document key, compatible with doc.iohub.dev/office
|
- v 0.1.3a: Let backend generates document key, compatible with doc.iohub.dev/office
|
||||||
- v 0.1.2a: generate document key based on username, file path and modified time
|
- v 0.1.2a: generate document key based on username, file path and modified time
|
||||||
- v 0.1.1a: generate document key based on username and file path
|
- v 0.1.1a: generate document key based on username and file path
|
||||||
|
Binary file not shown.
@ -4,12 +4,23 @@ class OnlyOffice extends this.OS.application.BaseApplication
|
|||||||
@eid = "id#{Math.random().toString(36).replace(".","")}"
|
@eid = "id#{Math.random().toString(36).replace(".","")}"
|
||||||
|
|
||||||
main: () ->
|
main: () ->
|
||||||
|
@isActive = false
|
||||||
@currfile = undefined
|
@currfile = undefined
|
||||||
|
@iframe = undefined
|
||||||
if @args and @args.length > 0
|
if @args and @args.length > 0
|
||||||
@currfile = @args[0].path.asFileHandle()
|
@currfile = @args[0].path.asFileHandle()
|
||||||
@placeholder = @find "editor-area"
|
@placeholder = @find "editor-area"
|
||||||
@placeholder.id = @eid
|
@placeholder.id = @eid
|
||||||
|
|
||||||
|
@on "focus", (e) =>
|
||||||
|
@isActive = true
|
||||||
|
if @iframe
|
||||||
|
el = $("#id_viewer_overlay", @iframe)
|
||||||
|
el = $("#ws-canvas-graphic-overlay", @iframe) if el.length is 0
|
||||||
|
el.trigger("click") if el.length > 0
|
||||||
|
|
||||||
|
@on "blur", (e) => @isActive = false
|
||||||
|
|
||||||
@find("btn-open-file").onbtclick = (e) =>
|
@find("btn-open-file").onbtclick = (e) =>
|
||||||
@openFile()
|
@openFile()
|
||||||
|
|
||||||
@ -69,10 +80,15 @@ class OnlyOffice extends this.OS.application.BaseApplication
|
|||||||
@open()
|
@open()
|
||||||
|
|
||||||
editorReady: () ->
|
editorReady: () ->
|
||||||
console.log $('iframe[name="frameEditor"]', @scheme).contents()
|
@iframe = $('iframe[name="frameEditor"]', @scheme).contents()[0]
|
||||||
|
return unless @iframe
|
||||||
|
$(@iframe).on "mousedown, mouseup, click", (e) =>
|
||||||
|
return if @isActive
|
||||||
|
@trigger "focus"
|
||||||
|
|
||||||
open: () ->
|
open: () ->
|
||||||
return unless @currfile
|
return unless @currfile
|
||||||
|
@iframe = undefined
|
||||||
@exec("token", {file: @currfile.path})
|
@exec("token", {file: @currfile.path})
|
||||||
.then (d) =>
|
.then (d) =>
|
||||||
console.log(d)
|
console.log(d)
|
||||||
@ -197,3 +213,6 @@ this.OS.register "OnlyOffice", OnlyOffice
|
|||||||
this.extensionParams = {
|
this.extensionParams = {
|
||||||
url: "https://office.iohub.dev/web-apps/"
|
url: "https://office.iohub.dev/web-apps/"
|
||||||
}
|
}
|
||||||
|
# dirty hack that allow subdomain iframes access each other
|
||||||
|
# FIXME: may be the domain should be defined by ATOS API
|
||||||
|
document.domain = "iohub.dev" if document.domain is "os.iohub.dev"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
"author": "Xuan Sang LE",
|
"author": "Xuan Sang LE",
|
||||||
"email": "mrsang@iohub.dev"
|
"email": "mrsang@iohub.dev"
|
||||||
},
|
},
|
||||||
"version":"0.1.3-a",
|
"version":"0.1.4-a",
|
||||||
"category":"Other",
|
"category":"Other",
|
||||||
"icon":"icon.png",
|
"icon":"icon.png",
|
||||||
"mimes":[
|
"mimes":[
|
||||||
|
@ -165,7 +165,7 @@
|
|||||||
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/OnlyOffice/README.md",
|
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/OnlyOffice/README.md",
|
||||||
"category": "Other",
|
"category": "Other",
|
||||||
"author": "Xuan Sang LE",
|
"author": "Xuan Sang LE",
|
||||||
"version": "0.1.3-a",
|
"version": "0.1.4-a",
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/OnlyOffice/build/release/OnlyOffice.zip"
|
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/OnlyOffice/build/release/OnlyOffice.zip"
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user