mirror of
https://github.com/friendica/friendica
synced 2025-04-24 18:30:11 +00:00
filebrowser fixs, use it in comment textareas
move filebrowser js to single file document filebrowser usage replace "onclick" for comment style buttons with data-* and move logic to main.js use filebrowser to insert images in comments
This commit is contained in:
parent
70b7de39a7
commit
52f9465578
10 changed files with 210 additions and 108 deletions
27
js/main.js
27
js/main.js
|
@ -51,6 +51,33 @@
|
|||
e.tipTip({defaultPosition: pos, edgeOffset: 8});
|
||||
});*/
|
||||
|
||||
/* setup comment textarea buttons */
|
||||
|
||||
$('[data-role="insert-formatting"]').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
var o = $(this);
|
||||
var comment = o.data('comment');
|
||||
var bbcode = o.data('bbcode');
|
||||
var id = o.data('id');
|
||||
if (bbcode=="img") {
|
||||
$.colorbox({href: baseurl + "/fbrowser/image/?mode=minimal#comment-"+id, iframe:true,innerWidth:'500px',innerHeight:'400px'})
|
||||
return;
|
||||
}
|
||||
|
||||
insertFormatting(comment, bbcode, id);
|
||||
});
|
||||
|
||||
/* event from comment textarea button popups */
|
||||
/* insert returned bbcode at cursor position or replace selected text */
|
||||
$("body").on("fbrowser.image.comment", function(e, filename, bbcode, id) {
|
||||
console.log("on", id);
|
||||
$.colorbox.close();
|
||||
var textarea = document.getElementById("comment-edit-text-" +id);
|
||||
var start = textarea.selectionStart;
|
||||
var end = textarea.selectionEnd;
|
||||
textarea.value = textarea.value.substring(0, start) + bbcode + textarea.value.substring(end, textarea.value.length);
|
||||
});
|
||||
|
||||
|
||||
|
||||
/* setup onoff widgets */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue