You can add RichText Editor using following way also and it will make Embed Code action enable in ribbon.
Designer
<%@ Register TagPrefix="SharePointPublishing" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<SharePointPublishing:HtmlEditor ID="htmlEditor" runat="server" AllowHtmlSourceEditing="true" PopupEditorMode="true" UseIntranetMode="true"></SharePointPublishing:HtmlEditor>
Code
using Microsoft.SharePoint.Publishing.WebControls;
using Microsoft.SharePoint.WebControls;
using System;
using System.ComponentModel;
using System.Web.UI.WebControls.WebParts;
namespace RichTextFieldInWP.VisualWebPart1
{
[ToolboxItemAttribute(false)]
public partial class VisualWebPart1 : WebPart
{
// Uncomment the following SecurityPermission attribute only when doing Performance Profiling on a farm solution
// using the Instrumentation method, and then remove the SecurityPermission attribute when the code is ready
// for production. Because the SecurityPermission attribute bypasses the security check for callers of
// your constructor, it's not recommended for production purposes.
// [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Assert, UnmanagedCode = true)]
public VisualWebPart1()
{
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
InitializeControl();
SPRibbon ribbon = SPRibbon.GetCurrent(this.Page);
if (ribbon != null)
{
ribbon.TrimById("Ribbon.EditingTools.CPEditTab.Layout");
ribbon.TrimById("Ribbon.EditingTools.CPEditTab.EditAndCheckout");
}
htmlEditor.Field = new RichHtmlField();
htmlEditor.Field.ControlMode = SPControlMode.Edit;
htmlEditor.Field.EnableViewState = true;
htmlEditor.Field.AllowReusableContent = false;
htmlEditor.Field.MinimumEditHeight = "200px";
this.Controls.Add(htmlEditor.Field);
}
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
Page
Note that you need to add reference of following assemblies:
Microsoft.SharePoint.Publishing.dll
Microsoft.Web.CommandUI.dll
Hope it will help to you.