add emojis on comments and pn

This commit is contained in:
Jakobus Schürz 2023-05-09 22:28:02 +02:00
parent 148f12580b
commit a4df92e962
4 changed files with 41 additions and 14 deletions

View file

@ -941,4 +941,36 @@ function toggleDropdownText(elm) {
function hasClass(elem, cls) {
return (" " + elem.className + " ").indexOf(" " + cls + " ") > -1;
}
function insertEmoji(target, item){
let dest = '';
switch (target) {
case 'comment':
dest='#comment-edit-text-' + item;
break;
case 'jot':
dest='.profile-jot-text';
break;
case 'pn':
dest='#comment-edit-text-input';
}
emojiPicker(dest)
};
function emojiPicker(dest) {
console.log(this);
if (typeof this.EmojiPicker == "undefined") {
new EmojiPicker({
trigger: [
{
selector: '.emojis',
insertInto: dest
}
],
closeButton: true,
});
}
console.log(this);
}
// @license-end

View file

@ -36,6 +36,9 @@
<button type="button" class="btn btn-sm template-icon quote" style="cursor: pointer;" aria-label="{{$edquote}}" title="{{$edquote}}" onclick="insertFormatting('quote',{{$id}});">
<i class="fa fa-quote-left"></i>
</button>
<button type="button" class="btn btn-sm template-icon emojis" style="cursor: pointer;" aria-label="{{$edemojis}}" title="{{$edemojis}}" onclick="insertEmoji('comment',{{$id}});">
<i class="fa fa-smile-o"></i>
</button>
</span>
</p>
<div id="dropzone-{{$id}}" class="dropzone">

View file

@ -108,7 +108,7 @@
<li role="presentation"><button type="button" class="hidden-xs btn-link icon italic" style="cursor: pointer;" aria-label="{{$editalic}}" title="{{$editalic}}" onclick="insertFormattingToPost('i');"><i class="fa fa-italic"></i></button></li>
<li role="presentation"><button type="button" class="hidden-xs btn-link icon bold" style="cursor: pointer;" aria-label="{{$edbold}}" title="{{$edbold}}" onclick="insertFormattingToPost('b');"><i class="fa fa-bold"></i></button></li>
<li role="presentation"><button type="button" class="hidden-xs btn-link icon quote" style="cursor: pointer;" aria-label="{{$edquote}}" title="{{$edquote}}" onclick="insertFormattingToPost('quote');"><i class="fa fa-quote-left"></i></button></li>
<li role="presentation"><button type="button" class="hidden-xs btn-link icon emojis" style="cursor: pointer;" aria-label="{{$edemojis}}" title="{{$edemojis}}"><i class="fa fa-smile-o"></i></button></li>
<li role="presentation"><button type="button" class="hidden-xs btn-link icon emojis" style="cursor: pointer;" aria-label="{{$edemojis}}" title="{{$edemojis}}" onclick="insertEmoji('jot');"><i class="fa fa-smile-o"></i></button></li>
<li role="presentation"><button type="button" class="btn-link icon" style="cursor: pointer;" aria-label="{{$edurl}}" title="{{$edurl}}" onclick="insertFormattingToPost('url');"><i class="fa fa-link"></i></button></li>
<li role="presentation"><button type="button" class="btn-link" id="profile-attach" ondragenter="return linkDropper(event);" ondragover="return linkDropper(event);" ondrop="linkDrop(event);" onclick="jotGetLink();" title="{{$edattach}}"><i class="fa fa-paperclip"></i></button></li>
<li role="presentation"><button type="button" class="btn-link" id="profile-location" onclick="jotGetLocation();" title="{{$setloc}}"><i class="fa fa-map-marker" aria-hidden="true"></i></button></li>
@ -183,16 +183,3 @@ can load different content into the jot modal (e.g. the item edit jot)
<script>
dzFactory.setupDropzone('#jot-text-wrap', 'profile-jot-text');
</script>
<script>
window.onload = function(){
new EmojiPicker({
trigger: [
{
selector: '.emojis',
insertInto: '.profile-jot-text'
}
],
closeButton: true,
});
};
</script>

View file

@ -59,6 +59,11 @@
<i class="fa fa-quote-left" aria-hidden="true"></i>
</button>
</li>
<li>
<button type="button" class="btn-link icton emojis" style="cursor: pointer;" title="{{$edemojis}}" data-role="insert-emoji" data-comment=" " onclick="insertEmoji('pn');">
<i class="fa fa-smile-o"></i>
</button>
</li>
</ul>
<div id="prvmail-text-bb-end"></div>