1/* 2 micoreMediaInsert Froala editorhoz 3*/ 4 5// Média ikon definiálás 6FroalaEditor.DefineIcon('insertMedia', { 7 NAME: 'plus', 8 SVG_KEY: 'imageManager', 9}); 10 11//Insert média command 12FroalaEditor.RegisterCommand('insertMedia', { 13 title: 'Média beszúrás', 14 focus: true, 15 undo: true, 16 refreshAfterCallback: true, 17 callback: function () { 18 //eredeti textarea id kinyerése 19 let id = $(this.$oel[0]).attr('id'); 20 //aktuális froala editor sorszám/id 21 let editorId = $(this).attr('id'); 22 //aktuális editor objektum 23 let currentEditor = this; 24 25 //megnyitom a modalt és triggerelem az ajax kérést 26 $('#insert_modal-' + id).modal('show'); 27 $('#insert_modal-' + id).on('shown.bs.modal', function (event) { 28 $.ajax({ 29 url: '/files/modalList/image', 30 success: function (data) { 31 //siker esetén a .content megkapja a datatablet 32 $('#insert_modal-' + id + ' .modal-body.content').html( 33 data 34 ); 35 //a loadert meg elrejtem 36 $('#insert_modal-' + id + ' .modal-body.loader').addClass( 37 'd-none' 38 ); 39 dataTablesInit({ 40 drawCallback: function () { 41 $('.modalselect').on('click', function (e) { 42 e.preventDefault(); 43 var url = $(this).data('url'); 44 var name = $(this).data('name'); 45 var ext = $(this).data('ext'); 46 var altText = $(this).data('alt'); 47 48 var $file = { 49 src: name, 50 extension: ext, 51 alt: altText, 52 url: url, 53 }; 54 //itt szúrom be a képet, teljes erasmuszos urlt kap amÃg nem lesz egy saját tka cdn-ünk :) 55 currentEditor.html.insert( 56 '<img src="https://erasmusplusz.hu/' + 57 $file.url + 58 '?w=730&m=rd&d" class="img-fluid" alt="' + 59 $file.alt + 60 '">' 61 ); 62 //a beszúrás visszavonható 63 currentEditor.undo.saveStep(); 64 65 //elrejtem a modalt 66 $('#insert_modal-' + id).modal('hide'); 67 //loadert láthatóvá teszem 68 $( 69 '#insert_modal-' + 70 id + 71 ' .modal-body.loader' 72 ).removeClass('d-none'); 73 //kiűrÃtem a datatablet 74 $( 75 '#insert_modal-' + 76 id + 77 ' .modal-body.content' 78 ).html(''); 79 }); 80 }, 81 }); 82 }, 83 }); 84 }); 85 }, 86}); 87// Video ikon definiálás 88FroalaEditor.DefineIcon('insertMovie', { 89 NAME: 'video-camera', 90 FA5NAME: 'camera', 91 SVG_KEY: 'insertVideo', 92}); 93//Insert videó command 94FroalaEditor.RegisterCommand('insertMovie', { 95 title: 'Videó beszúrás', 96 focus: true, 97 undo: true, 98 refreshAfterCallback: true, 99 callback: function () { 100 //eredeti textarea id kinyerése 101 let id = $(this.$oel[0]).attr('id'); 102 //aktuális froala editor sorszám/id 103 let editorId = $(this).attr('id'); 104 //aktuális editor objektum 105 let currentEditor = this; 106 107 //megnyitom a modalt és triggerelem az ajax kérést 108 $('#insert_modal-' + id).modal('show'); 109 $('#insert_modal-' + id).on('shown.bs.modal', function (event) { 110 $.ajax({ 111 url: '/files/modalList/video', 112 success: function (data) { 113 //siker esetén a .content megkapja a datatablet 114 $('#insert_modal-' + id + ' .modal-body.content').html( 115 data 116 ); 117 //a loadert meg elrejtem 118 $('#insert_modal-' + id + ' .modal-body.loader').addClass( 119 'd-none' 120 ); 121 dataTablesInit({ 122 drawCallback: function () { 123 $('.modalselect').on('click', function (e) { 124 e.preventDefault(); 125 var url = $(this).data('url'); 126 var name = $(this).data('name'); 127 var ext = $(this).data('ext'); 128 var altText = $(this).data('alt'); 129 130 var $file = { 131 src: name, 132 extension: ext, 133 alt: altText, 134 url: url, 135 }; 136 //itt szúrom be a képet, teljes erasmuszos urlt kap amÃg nem lesz egy saját tka cdn-ünk :) 137 currentEditor.html.insert( 138 '<video width="100%" height="auto" controls style="width: 100% !important;height: auto !important;" class="mx-auto"><source src="https://erasmusplusz.hu/' + 139 $file.url + 140 '" type="video/mp4"></video>' 141 ); 142 //a beszúrás visszavonható 143 currentEditor.undo.saveStep(); 144 145 //elrejtem a modalt 146 $('#insert_modal-' + id).modal('hide'); 147 //loadert láthatóvá teszem 148 $( 149 '#insert_modal-' + 150 id + 151 ' .modal-body.loader' 152 ).removeClass('d-none'); 153 //kiűrÃtem a datatablet 154 $( 155 '#insert_modal-' + 156 id + 157 ' .modal-body.content' 158 ).html(''); 159 }); 160 }, 161 }); 162 }, 163 }); 164 }); 165 }, 166}); 167 168var editor = new FroalaEditor('.wysiwygeditor', { 169 entities: '', 170 language: 'hu', 171 key: 'pe1G2wF1H1A2D3A5B6C4oCe1ZSc2XHe1Cd1f1KIWCWMJHXCLSwD1D1D1D1F1I4B8B1D6D4==', 172 toolbarButtons: { 173 moreText: { 174 buttons: [ 175 'bold', 176 'italic', 177 'underline', 178 'strikeThrough', 179 'subscript', 180 'superscript', 181 'inlineClass', 182 'clearFormatting', 183 ], 184 align: 'left', 185 buttonVisible: 3, 186 }, 187 188 moreParagraph: { 189 buttons: [ 190 'alignLeft', 191 'alignCenter', 192 'alignRight', 193 'alignJustify',
194 'formatOL', 195 'formatUL', 196 'paragraphFormat', 197 'paragraphStyle', 198 'lineHeight', 199 'outdent', 200 'indent', 201 'quote', 202 ], 203 align: 'left', 204 buttonsVisible: 4, 205 }, 206 207 moreRich: { 208 buttons: [ 209 'insertLink', 210 'insertMedia', 211 'insertMovie', 212 'video', 213 'insertTable', 214 'emoticons', 215 'specialCharacters', 216 'embedly', 217 'insertFile', 218 'insertHR', 219 'selectAll', 220 ], 221 align: 'left', 222 buttonVisible: 4, 223 }, 224 225 moreMisc: { 226 buttons: ['undo', 'redo', 'trackChanges', 'html'], 227 align: 'right', 228 buttonsVisible: 4, 229 }, 230 }, 231 pluginsEnabled: [ 232 'align', 233 'codeView', 234 'codeBeautifier', 235 'charCounter', 236 'inlineClass', 237 'wordPaste', 238 'paragraphFormat', 239 'quote', 240 'paragraphStyle', 241 'link', 242 'table', 243 'video', 244 'lists', 245 'lineBreaker', 246 'draggable', 247 'entities', 248 'track_changes', 249 'image', 250 'embedly', 251 ], 252 codeBeautifierOptions: { 253 end_with_newline: true, 254 indent_inner_html: true, 255 extra_liners: 256 "['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote', 'pre', 'ul', 'ol', 'table', 'dl']", 257 brace_style: 'expand', 258 indent_char: '\t', 259 indent_size: 1, 260 wrap_line_length: 0, 261 }, 262 inlineClasses: { 263 'text-base-01': 'ElsÅdleges szÃn', 264 'text-base-02': 'Másodlagos szÃn', 265 'text-base-03': 'Harmadlagos szÃn', 266 'text-accent': 'KiegészÃtÅ szÃn', 267 }, 268 charCounterCount: true, 269 charCounterMax: -1, 270 wordAllowedStyleProps: [ 271 'font-weight', 272 'font-style', 273 'text-indent', 274 'quote', 275 ], 276 paragraphStyles: { 277 keretes: 'Keretes bekezdés', 278 }, 279 linkAttributes: { 280 title: 'Title', 281 }, 282 linkAutoPrefix: 'https://', 283 linkList: [ 284 { 285 text: 'Erasmusplusz.hu', 286 href: 'https://erasmusplusz.hu', 287 target: '_blank', 288 }, 289 { 290 displayText: 'Eurodesk.hu', 291 href: 'https://eurodesk.hu', 292 target: '_blank', 293 }, 294 ], 295 linkMultipleStyles: true, 296 linkStyles: { 297 'btn btn-base-01': 'Gomb elsÅdleges szÃnnel', 298 'btn btn-outline-base-01': 'Outline gomb elsÅdleges szÃnnel', 299 'btn btn-base-02': 'Gomb másodlagos szÃnnel', 300 'btn btn-outline-base-02': 'Outline gomb másodlagos szÃnnel', 301 'btn btn-base-03': 'Gomb harmadlagos szÃnnel', 302 'btn btn-outline-base-03': 'Outline gomb harmadlagos szÃnnel', 303 'btn btn-accent': 'Gomb kiegészÃtÅ szÃnnel', 304 'btn btn-outline-accent': 'Outline gomb kiegészÃtÅ szÃnnel', 305 }, 306 tableStyles: { 307 'table table-bordered': 'Keretes', 308 'table table-stripped': 'Változó sorszÃnek', 309 }, 310 tableResizerOffset: 10, 311 tableResizingLimit: 50, 312 videoResponsive: true, 313 listAdvancedTypes: true, 314 toolbarSticky: true, 315 dragInline: false, 316 317 events: { 318 contentChanged: function () { 319 // Ebben a függvényben kezelem le a tartalom megváltozását 320 console.log('A tartalom megváltozott:'); 321 const containers = document.querySelectorAll('.fr-embedly'); 322 323 containers.forEach((container) => { 324 if (container.classList.contains('video-container')) return; 325 container.classList.add('video-container'); 326 }); 327 }, 328 }, 329});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.