Mercurial Hosting > freedit
comparison src/test/tiny.html @ 23:cdcd1b70c15e
tinymce work
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Mon, 18 Jul 2022 23:50:48 -0600 |
| parents | d87a8f9f43d7 |
| children | fccbe5554fcc |
comparison
equal
deleted
inserted
replaced
| 22:d87a8f9f43d7 | 23:cdcd1b70c15e |
|---|---|
| 15 let html; | 15 let html; |
| 16 let url = data.url; | 16 let url = data.url; |
| 17 url2 = url; | 17 url2 = url; |
| 18 let result; | 18 let result; |
| 19 if( result = url.match(youtubePtn1) || url.match(youtubePtn2) ) { | 19 if( result = url.match(youtubePtn1) || url.match(youtubePtn2) ) { |
| 20 html = '<iframe data-url="'+url+'" width="560" height="315" src="https://www.youtube.com/embed/' + result[1]; | 20 html = '<iframe data-video="'+url+'" width="560" height="315" src="https://www.youtube.com/embed/' + result[1]; |
| 21 if( result[2] ) | 21 if( result[2] ) |
| 22 html += '?start=' + result[2] | 22 html += '?start=' + result[2] |
| 23 html += '" frameborder="0" allowfullscreen></iframe>'; | 23 html += '" frameborder="0" allowfullscreen></iframe>'; |
| 24 } else if( result = url.match(bitchutePtn) ) { | 24 } else if( result = url.match(bitchutePtn) ) { |
| 25 html = '<iframe data-url="'+url+'" width="560" height="315" scrolling="no" frameborder="0" style="border: none;" src="https://www.bitchute.com/embed/' + result[1] + '/"></iframe>'; | 25 html = '<iframe data-video="'+url+'" width="560" height="315" scrolling="no" frameborder="0" style="border: none;" src="https://www.bitchute.com/embed/' + result[1] + '/"></iframe>'; |
| 26 } else { | 26 } else { |
| 27 html = '<a href="'+url+'">'+url+'</a>'; | 27 html = '<a data-video="'+url+'" href="'+url+'">'+url+'</a>'; |
| 28 } | 28 } |
| 29 resolve({ html: html }); | 29 resolve({ html: html }); |
| 30 } | 30 } |
| 31 | 31 |
| 32 function tinymceSetup(editor) { | |
| 33 editor.ui.registry.addButton('styleCode', { | |
| 34 text: 'code', | |
| 35 onAction: () => alert('Button clicked!') | |
| 36 }); | |
| 37 } | |
| 38 | |
| 32 tinymce.init({ | 39 tinymce.init({ |
| 33 selector: 'textarea', | 40 selector: 'textarea', |
| 34 plugins: ['link', 'image', 'media'], | 41 setup: tinymceSetup, |
| 42 plugins: ['link', 'image', 'media', 'lists'], | |
| 35 link_target_list: false, | 43 link_target_list: false, |
| 36 link_title: false, | 44 link_title: false, |
| 37 image_description: false, | 45 image_description: false, |
| 38 image_dimensions: false, | 46 image_dimensions: false, |
| 39 object_resizing: false, | 47 object_resizing: false, |
| 42 media_dimensions: false, | 50 media_dimensions: false, |
| 43 media_poster: false, | 51 media_poster: false, |
| 44 media_url_resolver: media_url_resolver, | 52 media_url_resolver: media_url_resolver, |
| 45 text_patterns: false, | 53 text_patterns: false, |
| 46 content_style: 'img {max-width: 500px;}', | 54 content_style: 'img {max-width: 500px;}', |
| 47 newline_behavior: 'linebreak', | 55 //newline_behavior: 'linebreak', |
| 48 //toolbar: 'image', | 56 toolbar: 'link image media | styleCode bold | numlist bullist', |
| 49 extended_valid_elements: 'b,i', | 57 extended_valid_elements: 'b,i', |
| 50 formats: { | 58 formats: { |
| 51 bold: { inline: 'b' }, | 59 bold: { inline: 'b' }, |
| 52 italic: {inline: 'i'}, | 60 italic: {inline: 'i'}, |
| 53 underline: {inline: 'u'}, | 61 underline: {inline: 'u'}, |
| 58 console.log(tinymce.activeEditor.getContent()); | 66 console.log(tinymce.activeEditor.getContent()); |
| 59 } | 67 } |
| 60 </script> | 68 </script> |
| 61 </head> | 69 </head> |
| 62 <body> | 70 <body> |
| 63 <p>top</p> | 71 <p><a href="https://www.tiny.cloud/">TinyMCE</a></p> |
| 64 <textarea></textarea> | 72 <textarea></textarea> |
| 65 <p><button onclick="log()">log</button></p> | 73 <p><button onclick="log()">log</button></p> |
| 66 <p>bottom</p> | |
| 67 </body> | 74 </body> |
| 68 </html> | 75 </html> |
