on-codemerge
Version:
A WYSIWYG editor for on-codemerge is a user-friendly interface that allows users to edit and view their code in real time, exactly as it will appear in the final product
3 lines (2 loc) • 1.08 kB
JavaScript
/*! on-codemerge v1.3.1 @author Pavel Kuzmin @license MIT @homepage https://s00d.github.io/on-codemerge/ @repository git+https://github.com/s00d/on-codemerge.git Copyright (c) 2026 Pavel Kuzmin - Built on 2026-07-02T13:39:17.947Z */
;var i=Object.defineProperty;var d=(o,t,e)=>t in o?i(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var r=(o,t,e)=>d(o,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../../../utils/helpers.cjs");class c{constructor(t,e){r(this,"videoUrl");r(this,"editor");this.editor=t,this.videoUrl=e}execute(){const t=this.extractYouTubeVideoId(this.videoUrl);if(!t)return;const e=s.createIframe("max-w-full rounded-lg p-2");e.src=`https://www.youtube.com/embed/${t}`,e.width="800",e.height="400",e.frameBorder="0",e.allowFullscreen=!0,this.editor.insertContent(e)}extractYouTubeVideoId(t){const e=/(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,u=t.match(e);return u?u[1]:null}}exports.YouTubeVideoCommand=c;