Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
web-apps
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
web-apps
Commits
fd7468f4
Commit
fd7468f4
authored
Jan 19, 2017
by
Julia Radzhabova
Committed by
GitHub
Jan 19, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #52 from ONLYOFFICE/feature/editor-destroy
Added function for destroy editors.
parents
b5321710
86ea2314
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
9 deletions
+34
-9
apps/api/documents/api.js
apps/api/documents/api.js
+34
-9
No files found.
apps/api/documents/api.js
View file @
fd7468f4
...
...
@@ -363,7 +363,7 @@
if
(
target
&&
_checkConfigParams
())
{
iframe
=
createIframe
(
_config
);
target
.
parentNode
&&
target
.
parentNode
.
replaceChild
(
iframe
,
target
);
this
.
_msgDispatcher
=
new
MessageDispatcher
(
_onMessage
,
this
);
var
_msgDispatcher
=
new
MessageDispatcher
(
_onMessage
,
this
);
}
/*
...
...
@@ -372,6 +372,18 @@
data: <command specific data>
}
*/
var
_destroyEditor
=
function
(
cmd
)
{
var
target
=
document
.
createElement
(
"
div
"
);
target
.
setAttribute
(
'
id
'
,
placeholderId
);
if
(
iframe
)
{
_msgDispatcher
&&
_msgDispatcher
.
unbindEvents
();
_detachMouseEvents
();
iframe
.
parentNode
&&
iframe
.
parentNode
.
replaceChild
(
target
,
iframe
);
}
};
var
_sendCommand
=
function
(
cmd
)
{
if
(
iframe
&&
iframe
.
contentWindow
)
postMessage
(
iframe
.
contentWindow
,
cmd
);
...
...
@@ -538,7 +550,8 @@
downloadAs
:
_downloadAs
,
serviceCommand
:
_serviceCommand
,
attachMouseEvents
:
_attachMouseEvents
,
detachMouseEvents
:
_detachMouseEvents
detachMouseEvents
:
_detachMouseEvents
,
destroyEditor
:
_destroyEditor
}
};
...
...
@@ -563,18 +576,26 @@
MessageDispatcher
=
function
(
fn
,
scope
)
{
var
_fn
=
fn
,
_scope
=
scope
||
window
;
_scope
=
scope
||
window
,
eventFn
=
function
(
msg
)
{
_onMessage
(
msg
);
};
var
_bindEvents
=
function
()
{
if
(
window
.
addEventListener
)
{
window
.
addEventListener
(
"
message
"
,
function
(
msg
)
{
_onMessage
(
msg
);
},
false
)
window
.
addEventListener
(
"
message
"
,
eventFn
,
false
)
}
else
if
(
window
.
attachEvent
)
{
window
.
attachEvent
(
"
onmessage
"
,
function
(
msg
)
{
_onMessage
(
msg
);
});
window
.
attachEvent
(
"
onmessage
"
,
eventFn
);
}
};
var
_unbindEvents
=
function
()
{
if
(
window
.
removeEventListener
)
{
window
.
removeEventListener
(
"
message
"
,
eventFn
,
false
)
}
else
if
(
window
.
detachEvent
)
{
window
.
detachEvent
(
"
onmessage
"
,
eventFn
);
}
};
...
...
@@ -592,6 +613,10 @@
};
_bindEvents
.
call
(
this
);
return
{
unbindEvents
:
_unbindEvents
}
};
function
getBasePath
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment