Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
1
Merge Requests
1
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
Vincent Bechu
erp5
Commits
d38ec55d
Commit
d38ec55d
authored
Dec 06, 2017
by
Vincent Bechu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_core] Add maximize to editor gadget
parent
e2449281
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
9 deletions
+58
-9
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/gadget_editor.js.js
...inTemplateItem/portal_skins/erp5_core/gadget_editor.js.js
+58
-9
No files found.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/gadget_editor.js.js
View file @
d38ec55d
/*jslint nomen: true, indent: 2 */
/*global window, rJS, RSVP, document, FileReader, Blob*/
(
function
(
window
,
rJS
,
RSVP
,
document
,
FileReader
,
Blob
)
{
/*global window, rJS, RSVP, document, FileReader, Blob
, XMLHttpRequest
*/
(
function
(
window
,
rJS
,
RSVP
,
document
,
FileReader
,
Blob
,
XMLHttpRequest
)
{
"
use strict
"
;
/*
...
...
@@ -18,12 +18,26 @@
*/
rJS
(
window
)
.
declareAcquiredMethod
(
'
triggerMaximize
'
,
'
triggerMaximize
'
)
.
allowPublicAcquisition
(
'
triggerMaximize
'
,
function
(
param_list
)
{
var
gadget
=
this
;
if
(
!
this
.
element
.
classList
.
contains
(
'
editor-maximize
'
))
{
this
.
element
.
classList
.
toggle
(
'
editor-maximize
'
);
}
return
this
.
triggerMaximize
.
apply
(
this
,
param_list
)
.
push
(
function
()
{
if
(
gadget
.
element
.
classList
.
contains
(
'
editor-maximize
'
))
{
gadget
.
element
.
classList
.
remove
(
'
editor-maximize
'
);
}
});
})
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
state_dict
=
{
value
:
options
.
value
||
""
,
editor
:
options
.
editor
,
content_type
:
options
.
content_type
,
maximize
:
options
.
maximize
,
portal_type
:
options
.
portal_type
,
editable
:
options
.
editable
||
false
,
key
:
options
.
key
...
...
@@ -40,17 +54,50 @@
gadget
=
this
,
url
,
div
=
document
.
createElement
(
'
div
'
),
queue
=
new
RSVP
.
Queue
();
queue
=
new
RSVP
.
Queue
(),
div_max
;
if
((
modification_dict
.
hasOwnProperty
(
'
editable
'
))
||
(
modification_dict
.
hasOwnProperty
(
'
editor
'
)))
{
(
modification_dict
.
hasOwnProperty
(
'
editor
'
))
||
modification_dict
.
hasOwnProperty
(
'
ojs_editor
'
))
{
// Clear first to DOM, append after to reduce flickering/manip
while
(
element
.
firstChild
)
{
element
.
removeChild
(
element
.
firstChild
);
}
if
(
modification_dict
.
hasOwnProperty
(
'
maximize
'
))
{
if
(
gadget
.
state
.
editable
)
{
div_max
=
document
.
createElement
(
'
div
'
);
element
.
appendChild
(
div_max
);
queue
.
push
(
function
()
{
return
gadget
.
declareGadget
(
"
gadget_erp5_button_maximize.html
"
,
{
scope
:
'
maximize
'
,
element
:
div_max
,
sandbox
:
'
public
'
});
})
.
push
(
undefined
,
function
(
error
)
{
if
(
error
instanceof
XMLHttpRequest
&&
error
.
status
===
404
)
{
return
;
}
throw
error
;
});
}
}
element
.
appendChild
(
div
);
if
(
gadget
.
state
.
editable
&&
if
(
gadget
.
state
.
ojs_editor
)
{
queue
.
push
(
function
()
{
return
gadget
.
declareGadget
(
gadget
.
state
.
ojs_editor
,
{
scope
:
"
editor
"
,
sandbox
:
'
iframe
'
,
element
:
div
}
);
});
}
else
if
(
gadget
.
state
.
editable
&&
(
gadget
.
state
.
editor
===
'
codemirror
'
))
{
queue
.
push
(
function
()
{
...
...
@@ -85,7 +132,8 @@
}
if
(
gadget
.
state
.
editable
&&
((
gadget
.
state
.
editor
===
'
codemirror
'
)
||
(
gadget
.
state
.
editor
===
'
fck_editor
'
)))
{
((
gadget
.
state
.
editor
===
'
codemirror
'
)
||
(
gadget
.
state
.
editor
===
'
fck_editor
'
)
||
gadget
.
state
.
ojs_editor
))
{
queue
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
'
editor
'
);
...
...
@@ -109,7 +157,8 @@
var
argument_list
=
arguments
,
result
;
if
(
this
.
state
.
editable
&&
((
this
.
state
.
editor
===
'
codemirror
'
)
||
(
this
.
state
.
editor
===
'
fck_editor
'
)))
{
((
this
.
state
.
editor
===
'
codemirror
'
)
||
(
this
.
state
.
editor
===
'
fck_editor
'
))
||
this
.
state
.
ojs_editor
)
{
return
this
.
getDeclaredGadget
(
'
editor
'
)
.
push
(
function
(
editor_gadget
)
{
return
editor_gadget
.
getContent
.
apply
(
editor_gadget
,
argument_list
);
...
...
@@ -134,4 +183,4 @@
return
{};
});
}(
window
,
rJS
,
RSVP
,
document
,
FileReader
,
Blob
));
}(
window
,
rJS
,
RSVP
,
document
,
FileReader
,
Blob
,
XMLHttpRequest
));
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