Skip to content

Commit

Permalink
Merge pull request #204 from JohnMulligan/tinymce_oct29
Browse files Browse the repository at this point in the history
Tinymce oct29 (fix 2)
  • Loading branch information
derekjkeller authored Oct 30, 2024
2 parents 83e32d6 + b59c2c8 commit f898a39
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion voyages/apps/blog/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class AdvancedEditorManager(forms.Textarea):
class Media:
js = (
'//cdn.tiny.cloud/1/s12zokrfdqicajy5cxdauxuczwq653y00bx98ae9qhwklhh3/tinymce/7/tinymce.min.js',
'scripts/tiny_mce/textareas.js')
'scripts/tiny_mce/textareas.js',)

def __init__(self, language=None, attrs=None):
self.language = language or settings.LANGUAGE_CODE[:2]
Expand Down
33 changes: 21 additions & 12 deletions voyages/sitemedia/scripts/tiny_mce/textareas.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
function FileBrowserPopup(callback, value, type) {
var fbURL = '/admin/filebrowser/browse/?pop=5';
fbURL = fbURL + "&type=" + type.filetype;
if(value)
fbURL += '&input=';
const instanceApi = tinyMCE.activeEditor.windowManager.openUrl({
title: 'Filebrowser image/media/file picker',
url: fbURL,
width: 1280,
height: 800,
onMessage: function(dialogApi, details) {
callback(details.content);
instanceApi.close();
}
});
return false;
}

tinymce.init({
selector: "textarea",
plugins: [
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars code fullscreen",
"insertdatetime media nonbreaking save table contextmenu directionality",
"emoticons template paste textcolor"
],
toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
toolbar2: "print preview media | forecolor backcolor emoticons",
plugins: "link image media",
// images_upload_url: '/documents/blog/images/',
image_advtab: true,
templates: [
{title: 'Test template 1', content: 'Test 1'},
{title: 'Test template 2', content: 'Test 2'}
],
file_picker_callback: FileBrowserPopup,
});

0 comments on commit f898a39

Please sign in to comment.