1 2tinymce.PluginManager.add('youtube_for_bardcanvas', function(ed, url) 3{ 4 var $strings = $('#youtube_for_bardcanvas_tinymce_strings'); 5 var _title = $strings.find('.title').text(); 6 var _caption = $strings.find('.caption').text(); 7 var _invalid = $strings.find('.invalid_link').text(); 8 9 ed.addCommand('youtube_for_bardcanvas', function() 10 { 11 var link = prompt(_caption, ''); 12 13 if( link == null ) return; 14 15 if( link.match(/^((https:\/\/)?(www\.)?youtube\.com\/watch\?v=.*)|((https:\/\/)?youtu\.be\/.*)|((https:\/\/)?(www\.)?youtube\.com\/shorts\/.*)/i) == null ) 16 { 17 alert( _invalid ); 18 return; 19 } 20 21 if( link.match(/^https:\/\//i) == null ) link = 'https://' + link; 22 23 ed.insertContent( 24 '<a class="youtube_link" href="' + link + '">' + link + '</a>' 25 ); 26 }); 27 28 // Register example button 29 ed.addButton('youtube_for_bardcanvas', { 30 title: _title, 31 cmd: 'youtube_for_bardcanvas', 32 image: $_FULL_ROOT_PATH + '/youtube_for_bardcanvas/media/editor_icon.png' 33 }); 34});
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.