diff 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
line wrap: on
line diff
--- a/src/test/tiny.html	Sun Jul 17 21:47:55 2022 -0600
+++ b/src/test/tiny.html	Mon Jul 18 23:50:48 2022 -0600
@@ -17,21 +17,29 @@
 				url2 = url;
 				let result;
 				if( result = url.match(youtubePtn1) || url.match(youtubePtn2) ) {
-					html = '<iframe data-url="'+url+'" width="560" height="315" src="https://www.youtube.com/embed/' + result[1];
+					html = '<iframe data-video="'+url+'" width="560" height="315" src="https://www.youtube.com/embed/' + result[1];
 					if( result[2] )
 						html += '?start=' + result[2]
 					html += '" frameborder="0" allowfullscreen></iframe>';
 				} else if( result = url.match(bitchutePtn) ) {
-					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>';
+					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>';
 				} else {
-					html = '<a href="'+url+'">'+url+'</a>';
+					html = '<a data-video="'+url+'" href="'+url+'">'+url+'</a>';
 				}
 				resolve({ html: html });
 			}
 
+			function tinymceSetup(editor) {
+				editor.ui.registry.addButton('styleCode', {
+					text: 'code',
+					onAction: () => alert('Button clicked!')
+				});
+			}
+
 			tinymce.init({
 				selector: 'textarea',
-				plugins: ['link', 'image', 'media'],
+				setup: tinymceSetup,
+				plugins: ['link', 'image', 'media', 'lists'],
 				link_target_list: false,
 				link_title: false,
 				image_description: false,
@@ -44,8 +52,8 @@
 				media_url_resolver: media_url_resolver,
 				text_patterns: false,
 				content_style: 'img {max-width: 500px;}',
-				newline_behavior: 'linebreak',
-				//toolbar: 'image',
+				//newline_behavior: 'linebreak',
+				toolbar: 'link image media | styleCode bold | numlist bullist',
 				extended_valid_elements: 'b,i',
 				formats: {
 					bold: { inline: 'b' },
@@ -60,9 +68,8 @@
 		</script>
 	</head>
 	<body>
-		<p>top</p>
+		<p><a href="https://www.tiny.cloud/">TinyMCE</a></p>
 		<textarea></textarea>
 		<p><button onclick="log()">log</button></p>
-		<p>bottom</p>
 	</body>
 </html>