<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="MensagemOficios.aspx.vb" Inherits="EnsinoBasico.MensagemOficios"
    EnableSessionState="True" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <script src="Resources.Gizmox.WebGUI.Forms.Skins.CommonSkin.Interfaces.js.wgx" type="text/javascript"></script>
        <title></title>
        <style type="text/css">
            .Esq
            {
                position:relative;
                float :left;
                top: -4px;
                left: -4px;
                width: 450px;
                height: 55px;
            }
            body
            {
                font-family : Trebuchet MS !important; 
                font-size : 10pt !important;
            }
            #form1
            {
                width: 100%;
            }
        </style>
    </head>
    <body>
        <form id="form1" class="Esq" runat="server">
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server" >
                <Scripts>
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js"></asp:ScriptReference>
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js"></asp:ScriptReference>
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js"></asp:ScriptReference>
                </Scripts>
            </telerik:RadScriptManager>
            <telerik:RadEditor ID="RadEditor1" EditModes="Design" runat="server" Width="485" Height="460px"
                OnClientLoad="OnClientLoad" OnClientCommandExecuted="ValidaAlteracaoMensagem" OnClientPasteHtml="OnClientPasteHtml"
                StripFormattingOnPaste="None" NewLineMode="P" StripFormattingOptions="ConvertWordLists, MSWordNoMargins, MSWordNoFonts, Css"
                ContentFilters="DefaultFilters,PdfExportFilter" ContentAreaMode="Div"
                ToolsFile="~/WebComponent/RadEditor_Settings/TelerikReportToolSet.xml" 
                >                
                <Content></Content>

                <TrackChangesSettings CanAcceptTrackChanges="False"></TrackChangesSettings>
            </telerik:RadEditor>
        </form>
        <script type="text/javascript" src="<%=RootPath%>/WebComponent/RadEditor_Settings/RadEditorScripts.js"></script>
        <script type="text/javascript">
            Telerik.Web.UI.Editor.ClipboardImagesProvider.prototype.supportsClipboardData = function (event) {
                return false;
            }    

            function OnClientLoad(editor, args) {
                editor.attachEventHandler("onkeydown", function (e) {
                    handleTabKey(editor, e);
                    ValidaAlteracaoMensagem(editor, args);
                });
                window.addEventListener('resize', function (event) {
                    resizeEditor();
                });

                resizeEditor();
                removeToolTip(editor);
            };

            function OnClientPasteHtml(editor, args) {
                var commandName = args.get_commandName();

                // Paste command is the one that handles plain paste, e.g., when Ctrl+V is used.
                // 2018-10-18: Doesn't work on FireFox!
                if (commandName !== "PastePlainText") {
                    var htmlToBePasted = args.get_value(); // Get the value to be pasted
                    htmlToBePasted = sanitizeHTML(htmlToBePasted);

                    // Set the processed content to the arguments.
                    args.set_value(htmlToBePasted);
                }

                ValidaAlteracaoMensagem(editor, args);
            };

            function ValidaAlteracaoMensagem(editor, args) {
                setTimeout(function () {
                    var objEvent = VWG.Events.CreateEvent("<%= PageContext.ID %>", "TextoMensagem");
                    VWG.Events.SetEventAttribute(objEvent, "messagetext", editor.get_html());
                    VWG.Events.RaiseEvents();
                }, 0);
            };

            function resizeEditor() {
                //$('.reContentCell').height($(window).height() - 46);
                $('#RadEditor1').height($(window).height() - 173);
                //$('.reContentCell').height($('#RadEditor1').height() - 61);
                $('.reLayoutWrapper').height('100%');
                $('.reContentArea').height('100%');
            };

            function removeToolTip(editor) {
                var contentAreaEl = editor.get_contentAreaElement();
                contentAreaEl.removeAttribute("title");
            };
        </script>
    </body>
</html>