Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
be24b5bf
Commit
be24b5bf
authored
Jul 24, 2018
by
Cecilia Vela Gurovic
Browse files
Bug 1783685: Allow more than 1 TinyMCE field in the same pieform
behatnotneeded Change-Id: I74a97ad84637e32dcc0463a968af09e77b891d0f
parent
09f8cbb4
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/form/elements/wysiwyg.php
View file @
be24b5bf
...
...
@@ -23,7 +23,7 @@ $_PIEFORM_WYSIWYGS = array();
*/
function
pieform_element_wysiwyg
(
Pieform
$form
,
$element
)
{
global
$_PIEFORM_WYSIWYGS
;
$_PIEFORM_WYSIWYGS
[
$form
->
get_name
()]
=
$form
->
get_name
()
.
'_'
.
$element
[
'name'
];
$_PIEFORM_WYSIWYGS
[
$form
->
get_name
()]
[
$element
[
'name'
]]
=
$form
->
get_name
()
.
'_'
.
$element
[
'name'
];
if
(
is_html_editor_enabled
())
{
if
(
!
$form
->
get_property
(
'elementclasses'
))
{
$element
[
'class'
]
=
isset
(
$element
[
'class'
])
&&
$element
[
'class'
]
!==
''
?
$element
[
'class'
]
.
' wysiwyg'
:
'wysiwyg'
;
...
...
@@ -85,18 +85,22 @@ function pieform_element_wysiwyg_get_headdata() {
.
"
\n
var editor_to_focus;"
.
"
\n
PieformManager.connect('onsubmit', null, tinyMCE.triggerSave);"
.
"
\n
PieformManager.connect('onload', null, function() {\n"
;
foreach
(
$_PIEFORM_WYSIWYGS
as
$name
=>
$editor
)
{
foreach
(
$_PIEFORM_WYSIWYGS
as
$name
=>
$editor
s
)
{
$result
.
=
" if (!arguments[0] || arguments[0]=='
{
$name
}
') {\n"
;
$result
.
=
" tinyMCE.execCommand('mceAddEditor', false, '
$editor
');
\n
"
;
$result
.
=
" jQuery('#
{
$editor
}
').on('focus', function() {\n"
;
$result
.
=
" editor_to_focus = '
$editor
';
\n
"
;
$result
.
=
" });
\n
"
;
foreach
(
$editors
as
$editorname
=>
$editor
)
{
$result
.
=
" tinyMCE.execCommand('mceAddEditor', false, '
$editor
');
\n
"
;
$result
.
=
" jQuery('#
{
$editor
}
').on('focus', function() {\n"
;
$result
.
=
" editor_to_focus = '
$editor
';
\n
"
;
$result
.
=
" });
\n
"
;
}
$result
.
=
" };
\n
"
;
}
$result
.
=
"});
\n
PieformManager.connect('onreply', null, function() {\n"
;
foreach
(
$_PIEFORM_WYSIWYGS
as
$name
=>
$editor
)
{
foreach
(
$_PIEFORM_WYSIWYGS
as
$name
=>
$editor
s
)
{
$result
.
=
" if (!arguments[0] || arguments[0]=='
{
$name
}
') {\n"
;
$result
.
=
" tinyMCE.execCommand('mceRemoveEditor', false, '
$editor
');
\n
"
;
foreach
(
$editors
as
$editorname
=>
$editor
)
{
$result
.
=
" tinyMCE.execCommand('mceRemoveEditor', false, '
$editor
');
\n
"
;
}
$result
.
=
" };
\n
"
;
}
$result
.
=
"});</script>"
;
...
...
Write
Preview
Supports
Markdown
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