define function if the editor is not enabled

This commit is contained in:
Diego Najar 2019-02-03 14:29:37 +01:00
parent d847b58907
commit 8b0ff80efb
3 changed files with 27 additions and 1 deletions

View File

@ -271,7 +271,7 @@ td.child {
padding: 10px 5% !important;
font-size: 16px;
line-height: 1.5em;
border: 1px solid #ced4da;
}
#jseditorSidebar {

View File

@ -382,6 +382,19 @@ echo Bootstrap::formOpen(array(
<script>
$(document).ready(function() {
// Define function if they doesn't exist
// This helps if the user doesn't activate any plugin as editor
if (typeof editorGetContent != "function") {
window.editorGetContent = function(){
return $("#jseditor").val();
};
}
if (typeof editorInsertMedia != "function") {
window.editorInsertMedia = function(filename){
$("#jseditor").val($('#jseditor').val()+'<img src="'+filename+'" alt="">');
};
}
// Button Save
$("#jsbuttonSave").on("click", function() {
// If the switch is setted to "published", get the value from the selector

View File

@ -328,6 +328,19 @@ echo Bootstrap::formOpen(array(
<script>
$(document).ready(function() {
// Define function if they doesn't exist
// This helps if the user doesn't activate any plugin as editor
if (typeof editorGetContent != "function") {
window.editorGetContent = function(){
return $("#jseditor").val();
};
}
if (typeof editorInsertMedia != "function") {
window.editorInsertMedia = function(filename){
$("#jseditor").val($('#jseditor').val()+'<img src="'+filename+'" alt="">');
};
}
// Button Save
$("#jsbuttonSave").on("click", function() {
// If the switch is setted to "published", get the value from the selector