Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
b265023d
Commit
b265023d
authored
Sep 28, 2016
by
Rafael Ostertag
Browse files
Support for multiple tinyMCE instances with different config options.
parent
caa6e309
Changes
2
Hide whitespace changes
Inline
Side-by-side
javascript/src/Helper/tinyMCE.js
View file @
b265023d
...
...
@@ -31,18 +31,41 @@ QfqNS.Helper = QfqNS.Helper || {};
return
;
}
tinymce
.
init
({
selector
:
"
.qfq-tinymce
"
,
setup
:
function
(
editor
)
{
editor
.
on
(
'
Change
'
,
function
(
e
)
{
console
.
log
(
'
Editor was changed
'
);
var
eventTarget
=
e
.
target
;
var
$parentForm
=
$
(
eventTarget
.
formElement
);
$parentForm
.
trigger
(
"
change
"
);
});
$
(
"
.qfq-tinymce
"
).
each
(
function
()
{
var
config
=
{};
var
$this
=
$
(
this
);
var
tinyMCEId
=
$this
.
attr
(
'
id
'
);
if
(
!
tinyMCEId
)
{
QfqNS
.
Log
.
warning
(
"
TinyMCE container does not have an id attribute. Ignoring.
"
);
return
;
}
var
configData
=
$this
.
data
(
'
config
'
);
if
(
configData
)
{
try
{
config
=
JSON
.
parse
(
configData
);
}
catch
(
e
)
{
QfqNS
.
Log
(
"
Exception while parsing JSON:
"
+
configData
);
QfqNS
.
Log
(
e
);
return
;
}
}
config
.
selector
=
"
#
"
+
tinyMCEId
;
config
.
setup
=
function
(
editor
)
{
editor
.
on
(
'
Change
'
,
function
(
e
)
{
console
.
log
(
'
Editor was changed
'
);
var
eventTarget
=
e
.
target
;
var
$parentForm
=
$
(
eventTarget
.
formElement
);
$parentForm
.
trigger
(
"
change
"
);
});
};
tinymce
.
init
(
config
);
}
}
);
);
};
tinyMce
.
prepareSave
=
function
()
{
...
...
mockup/richtexteditor.html
View file @
b265023d
...
...
@@ -67,6 +67,18 @@
</div>
<div
class=
"form-group"
>
<div
class=
"col-md-2"
>
<label
for=
"text2"
class=
"control-label"
>
Rich Text Editor
</label>
</div>
<div
class=
"col-md-6"
>
<textarea
id=
"text2"
class=
"qfq-tinymce"
name=
"rte"
>
Input
</textarea>
</div>
</div>
<button
type=
"submit"
>
Do
</button>
</form>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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