Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5-bin
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
nexedi
erp5-bin
Commits
a5af6cbd
Commit
a5af6cbd
authored
Nov 24, 2020
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_notebook: jsmd editor getContent method
parent
8dffd3c2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
8 deletions
+27
-8
bt5/erp5_notebook/SkinTemplateItem/portal_skins/erp5_notebook/gadget_jsmd_viewer.js.js
...eItem/portal_skins/erp5_notebook/gadget_jsmd_viewer.js.js
+27
-8
No files found.
bt5/erp5_notebook/SkinTemplateItem/portal_skins/erp5_notebook/gadget_jsmd_viewer.js.js
View file @
a5af6cbd
/*global window, rJS, console, RSVP, jIO, DOMParser, Blob, document,
URL, loopEventListener
, promiseEventListener
*/
URL, loopEventListener */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(
function
(
window
,
rJS
,
RSVP
,
jIO
,
DOMParser
,
document
,
URL
,
loopEventListener
)
{
...
...
@@ -24,6 +24,10 @@
}
rJS
(
window
)
.
ready
(
function
(
gadget
)
{
gadget
.
property_dict
=
{};
})
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
...
...
@@ -38,6 +42,7 @@
var
gadget
=
this
,
base_url
=
document
.
location
.
toString
(),
doc
;
gadget
.
property_dict
.
deferred
=
RSVP
.
defer
();
return
fetchHTML
(
"
gadget_jsmd_eval.html
"
,
base_url
)
.
push
(
function
(
result
)
{
...
...
@@ -80,19 +85,33 @@
});
})
.
declareJob
(
'
listenMessage
'
,
function
()
{
var
gadget
=
this
;
.
declareMethod
(
'
getContent
'
,
function
()
{
var
gadget
=
this
,
content_dict
=
{},
dict
=
gadget
.
property_dict
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
promiseEventListener
(
window
,
"
message
"
,
true
)
;
return
dict
.
deferred
.
promise
;
})
.
push
(
function
(
event
)
{
.
push
(
function
()
{
content_dict
[
gadget
.
state
.
key
]
=
gadget
.
element
.
querySelector
(
"
iframe
"
)
.
contentDocument
.
firstChild
.
innerHTML
;
return
content_dict
;
});
})
.
declareJob
(
'
listenMessage
'
,
function
()
{
var
gadget
=
this
,
dict
=
gadget
.
property_dict
;
return
loopEventListener
(
window
,
'
message
'
,
false
,
function
(
event
)
{
//only handle jsmd eval child messages
if
((
event
.
origin
!==
window
.
origin
)
||
(
event
.
data
!==
"
jsmd_eval_done
"
))
return
gadget
.
listenMessage
()
;
return
;
console
.
log
(
"
JSMD Eval Done.
"
);
document
.
querySelector
(
'
[id="js-spinner"]
'
).
remove
();
});
return
dict
.
deferred
.
resolve
();
}
);
})
.
declareJob
(
'
listenResize
'
,
function
()
{
...
...
@@ -106,4 +125,4 @@
return
loopEventListener
(
window
,
'
resize
'
,
false
,
resize
);
});
}(
window
,
rJS
,
RSVP
,
jIO
,
DOMParser
,
document
,
URL
,
loopEventListener
,
promiseEventListener
));
\ No newline at end of file
}(
window
,
rJS
,
RSVP
,
jIO
,
DOMParser
,
document
,
URL
,
loopEventListener
));
\ No newline at end of file
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