mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
API Let update interval of tinymce be changed or disabled
This commit is contained in:
parent
87f84039f9
commit
0e78e3f3dc
@ -73,6 +73,7 @@ class HtmlEditorConfig {
|
|||||||
'editor_selector' => "htmleditor",
|
'editor_selector' => "htmleditor",
|
||||||
'width' => "100%",
|
'width' => "100%",
|
||||||
'auto_resize' => false,
|
'auto_resize' => false,
|
||||||
|
'update_interval' => 5000, // Ensure update of this data every 5 seconds to the underlying textarea
|
||||||
'theme' => "advanced",
|
'theme' => "advanced",
|
||||||
|
|
||||||
'theme_advanced_layout_manager' => "SimpleLayout",
|
'theme_advanced_layout_manager' => "SimpleLayout",
|
||||||
|
@ -89,6 +89,7 @@ ss.editorWrappers.tinyMCE = (function() {
|
|||||||
// after an (undetected) inline change. This "blur" causes onChange
|
// after an (undetected) inline change. This "blur" causes onChange
|
||||||
// to trigger, which will change the button markup to show "alternative" styles,
|
// to trigger, which will change the button markup to show "alternative" styles,
|
||||||
// effectively cancelling the original click event.
|
// effectively cancelling the original click event.
|
||||||
|
if(ed.settings.update_interval) {
|
||||||
var interval;
|
var interval;
|
||||||
jQuery(ed.getBody()).on('focus', function() {
|
jQuery(ed.getBody()).on('focus', function() {
|
||||||
interval = setInterval(function() {
|
interval = setInterval(function() {
|
||||||
@ -98,11 +99,12 @@ ss.editorWrappers.tinyMCE = (function() {
|
|||||||
// Set content without triggering editor content cleanup
|
// Set content without triggering editor content cleanup
|
||||||
element.val(ed.getContent({format : 'raw', no_events : 1}));
|
element.val(ed.getContent({format : 'raw', no_events : 1}));
|
||||||
}
|
}
|
||||||
}, 5000);
|
}, ed.settings.update_interval);
|
||||||
});
|
});
|
||||||
jQuery(ed.getBody()).on('blur', function() {
|
jQuery(ed.getBody()).on('blur', function() {
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
this.instance.onChange.add(function(ed, l) {
|
this.instance.onChange.add(function(ed, l) {
|
||||||
// Update underlying textarea on every change, so external handlers
|
// Update underlying textarea on every change, so external handlers
|
||||||
|
Loading…
x
Reference in New Issue
Block a user