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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
c63d8b64
Commit
c63d8b64
authored
May 09, 2022
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_svg_editor: update gadget to match new version
parent
feb37a47
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
645 additions
and
465 deletions
+645
-465
bt5/erp5_svg_editor/SkinTemplateItem/portal_skins/erp5_svg_editor/method-draw/method-draw.gadget.html.zpt
...s/erp5_svg_editor/method-draw/method-draw.gadget.html.zpt
+635
-444
bt5/erp5_svg_editor/SkinTemplateItem/portal_skins/erp5_svg_editor/method-draw/method-draw.gadget.js.js
...kins/erp5_svg_editor/method-draw/method-draw.gadget.js.js
+10
-21
No files found.
bt5/erp5_svg_editor/SkinTemplateItem/portal_skins/erp5_svg_editor/method-draw/method-draw.gadget.html.zpt
View file @
c63d8b64
This diff is collapsed.
Click to expand it.
bt5/erp5_svg_editor/SkinTemplateItem/portal_skins/erp5_svg_editor/method-draw/method-draw.gadget.js.js
View file @
c63d8b64
/*jslint indent: 2 */
/*global window, rJS, RSVP,
curConfig,
svgCanvas */
/*global window, rJS, RSVP, svgCanvas */
(
function
(
window
,
rJS
,
RSVP
)
{
"
use strict
"
;
curConfig
.
jGraduatePath
=
"
lib/jgraduate/images/
"
;
// XXX images are not loaded at the good place
rJS
(
window
)
.
ready
(
function
(
g
)
{
g
.
props
=
{};
var
deferred
=
RSVP
.
defer
();
svgCanvas
.
ready
(
function
()
{
deferred
.
resolve
();
});
return
deferred
.
promise
;
})
.
declareMethod
(
'
render
'
,
function
(
options
)
{
[].
forEach
.
call
(
window
.
document
.
head
.
querySelectorAll
(
"
base
"
),
function
(
el
)
{
// XXX GadgetField adds <base> tag to fit to the parent page location, it's BAD to remove them.
// In the case of method-draw, all component are loaded dynamicaly through ajax requests in
// method-draw "folder". By setting a <base> tag, we change the url resolution behavior, and
// we break all dynamic links. So, deleting <base> is required.
window
.
document
.
head
.
removeChild
(
el
);
return
this
.
changeState
({
key
:
options
.
key
,
value
:
options
.
value
});
this
.
props
.
key
=
options
.
key
;
svgCanvas
.
setSvgString
(
options
.
value
);
})
.
onStateChange
(
function
()
{
svgCanvas
.
setSvgString
(
this
.
state
.
value
);
})
.
declareService
(
function
()
{
if
(
/
(?:
^
\?
|&
)
auto_focus=
(
true|1
)(?:
&|$
)
/
.
test
(
window
.
location
.
search
))
{
...
...
@@ -32,8 +20,9 @@
})
.
declareMethod
(
'
getContent
'
,
function
()
{
var
form_data
=
{};
form_data
[
this
.
props
.
key
]
=
svgCanvas
.
getSvgString
();
form_data
[
this
.
state
.
key
]
=
svgCanvas
.
getSvgString
();
this
.
state
.
value
=
form_data
[
this
.
state
.
key
]
return
form_data
;
});
}
,
{
mutex
:
'
statechange
'
}
);
}(
window
,
rJS
,
RSVP
));
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