Skip to content

Commit 5614a77

Browse files
committed
LUT-26182: insert smileys with the editor
1 parent b0b7560 commit 5614a77

File tree

5 files changed

+49
-6
lines changed

5 files changed

+49
-6
lines changed

β€Žsrc/sql/plugins/wiki/plugin/create_db_wiki.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ CREATE TABLE wiki_topic_version_content (
4343
wiki_content LONG VARCHAR,
4444
html_wiki_content LONG VARCHAR NULL,
4545
PRIMARY KEY (id_topic_version , locale )
46-
);
46+
) CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
4747

4848

4949
--
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
ALTER TABLE wiki_topic_version_content ADD html_wiki_content LONG VARCHAR NULL;
2-
2+
ALTER TABLE wiki_topic_version_content CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;

β€Žwebapp/WEB-INF/templates/skin/plugins/wiki/custom_input_editor.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,5 +135,17 @@
135135
</div>
136136
</div>
137137
</div>
138+
<!------------------ COPY AN EMOJI -------------------------->
139+
<div id="selectEmojiModal" class="toastui-editor-popup" style="display: none;" >
140+
<button class="btn btn-default" type="button" style="position: absolute; right: 0;" onclick="closeToastUiModal()">
141+
<span class="fa fa-times"></span>
142+
</button>
143+
<div class="toastui-editor-popup-header">
144+
<div class="toastui-editor-popup-header-title">Copy an Emoji</div>
145+
</div>
146+
<div class="toastui-editor-popup-content-body" style="margin: 25px;">
147+
<div id="emojiList"></div>
148+
</div>
149+
</div>
138150

139151
<!------------------- END OF CUSTOM INPUTS -------------------------->

β€Žwebapp/js/plugins/wiki/wiki_pages/defaultEditorContent.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
let defaultEditorContent = {
22
"fr":"$$span\n" +
33
"<div class='h-100 p-5 rounded-3 h-100 p-5 text-bg-dark rounded-3 bg-dark'>\n" +
4-
"<h2 class='text-white'> Bienvenue dans le powered by Lutece</h2>\n" +
4+
"<h2 class='text-white'> Bienvenue dans le powered by Lutece πŸ”₯πŸ”₯πŸ”₯</h2>\n" +
55
"<p class='text-light'>Cet outil se veut Γͺtre un outil collaboratif trΓ¨s simple pour votre site Lutece</p>\n" +
66
"<a href='https://lutece.paris.fr/fr/' class='btn btn-outline-light text-white' style='text-decoration: none'>Learn more</a>\n" +
77
"</div>\n" +
@@ -10,7 +10,7 @@ let defaultEditorContent = {
1010
"# FonctionnalitΓ©s principales\n" +
1111
"\n" +
1212
"\n" +
13-
"* Utilisation de la syntaxe standard **Markdown** \n" +
13+
"* Utilisation de la syntaxe standard **Markdown** πŸš€ \n" +
1414
"\n" +
1515
" PossibilitΓ© de personnaliser directement en html pour obtenir des rendus spΓ©cifiques. Les Γ©lΓ©ments html autorisΓ©s sont : les classes de Lutece ou de bootstrap, des paragraphes, les Headings, les ancres, les images et les div, figure, figcaption. Toujours Γ  l'intΓ©rieur des balises custom : \n" +
1616
"\n" +
@@ -96,7 +96,7 @@ let defaultEditorContent = {
9696
"en":
9797
"$$span\n" +
9898
"<div class='h-100 p-5 rounded-3 h-100 p-5 text-bg-dark rounded-3 bg-dark'>\n" +
99-
"<h2 class='text-white'> Welcome to the Wiki powered by Lutece</h2>\n" +
99+
"<h2 class='text-white'> Welcome to the Wiki powered by Lutece πŸ”₯πŸ”₯πŸ”₯</h2>\n" +
100100
"<p class='text-light'>This Wiki aims to be a very simple collaborative tool fully integrated to your Lutece site</p>\n" +
101101
"<a href='https://lutece.paris.fr/fr/' class='btn btn-outline-light text-white' style='text-decoration: none'>Learn more</a>\n" +
102102
"</div>\n" +
@@ -106,7 +106,7 @@ let defaultEditorContent = {
106106
"\n" +
107107
"- [x] Provide a very simple and efficient Wiki editor with removable Help panel\n" +
108108
"- [x] Fully integrated to Lutece platform :\n" +
109-
" - [x] Use standard **Markdown** \n" +
109+
" - [x] Use standard **Markdown** πŸš€ \n" +
110110
"- [x] Can be easily customized with the possiblity to add some html. Allowed html elements are : classes from Lutece, bootstrap or your own, paragraphs, Headings, ancres, images, div, figure, figcaption. Alway inside a custom input :\n" +
111111
"\n" +
112112
"$$span\n" +

β€Žwebapp/js/plugins/wiki/wiki_pages/modify_page.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ editor.insertToolbarItem({ groupIndex: 0, itemIndex: 9 }, {
123123
className: 'fa fa-image editor',
124124
style: { backgroundImage: 'none' },
125125
});
126+
editor.insertToolbarItem({ groupIndex: 0, itemIndex: 10 }, {
127+
name: 'Emoji',
128+
tooltip: 'Emoji',
129+
text: 'Em',
130+
className: 'fa fa-smile editor',
131+
style: { backgroundImage: 'none' },
132+
});
126133

127134

128135
document.getElementsByClassName("toastui-editor-mode-switch")[0].remove();
@@ -144,7 +151,31 @@ window.addEventListener("load", (event) => {
144151
document.getElementsByClassName("toastui-editor-md-container")[0].classList.add("wiki-align-content-val-"+alignmentValue);
145152
}
146153
});
154+
/* -------------- Emojis -------------- */
155+
const emojiButton = document.getElementsByClassName("fa fa-smile editor")[0];
156+
emojiButton.addEventListener('click', function() {
157+
document.getElementById("selectEmojiModal").style.display = "block";
158+
});
147159

160+
window.addEventListener("load", (event) => {
161+
const emojis = ["πŸ˜€", "πŸ˜‚", "😍", "πŸ₯°", "😎", "🀩", "😊", "πŸ™‚", "πŸ˜†", "πŸ₯³", "😁", "πŸ˜„", "πŸ˜‡", "😘", "πŸ˜‹", "πŸ€—", "πŸ™Œ", "πŸ‘", "πŸŽ‰", "πŸ”₯", "πŸ’―", "🌟", "✨", "🌈", "πŸ€", "πŸ‰", "πŸ•", "πŸŽ‚", "🎸", "⚽️", "πŸš€"]
162+
let emojiList = document.getElementById("emojiList");
163+
emojiList.style.display = "grid";
164+
emojiList.style.gridTemplateColumns = "repeat(4, 1fr)";
165+
emojiList.style.gridGap = "0.5rem";
166+
167+
emojis.map(emoji => {
168+
const emojiButton = document.createElement("button");
169+
emojiButton.classList.add("btn", "btn-tertiary", "btn-xs");
170+
emojiButton.innerText = emoji;
171+
emojiButton.addEventListener('click', function() {
172+
navigator.clipboard.writeText(emoji);
173+
closeToastUiModal();
174+
});
175+
emojiList.appendChild(emojiButton);
176+
});
177+
178+
});
148179

149180
/* -------------- ALERT -------------- */
150181
const addAlertButton = document.getElementsByClassName("fa-solid fa-triangle-exclamation editor")[0];

0 commit comments

Comments
Β (0)