Skip to content

Commit f94b79d

Browse files
committed
Improve Tiny MCE Editor, add new custom browse uploads button
1 parent 3db8a3d commit f94b79d

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/Darryldecode/Backend/Public/backend/cb/app/contents/controller.contents.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,31 @@ angular.module('cb.group').controller('ContentsController', ['$scope','$timeout'
303303
$scope.editor.mceConfig = {
304304
theme: "modern",
305305
skin: "light",
306-
plugins: ["autoresize","image"]
306+
plugins: ["autoresize","image"],
307+
toolbar: 'undo redo | bold italic underline | alignleft aligncenter alignright | bullist numlist | BrowseImage',
308+
setup : function(ed) {
309+
ed.addButton('BrowseImage', {
310+
title : 'Browse Uploads',
311+
image : '/darryldecode/backend/cb/images/icons/file-browse-icon.png',
312+
onclick : function() {
313+
314+
var m = $modal.open({
315+
templateUrl: BASE_URL + '/darryldecode/backend/cb/app/contents/modals/gallery.html',
316+
controller: 'GalleryModalController',
317+
size: 'lg'
318+
});
319+
320+
m.result.then(function (selectedFiles) {
321+
for(var prop in selectedFiles) {
322+
if( selectedFiles[prop] == true ) {
323+
var imageSrc = STORAGE_URL + prop;
324+
ed.execCommand('mceInsertContent', false, "<img src='"+imageSrc+"'>");
325+
}
326+
}
327+
});
328+
}
329+
});
330+
}
307331
};
308332
$scope.editor.mode = 'mce'; // ace | mce | md
309333
$scope.editor.changeEditor = function (editor) {
2.14 KB
Loading

0 commit comments

Comments
 (0)