﻿@model CodeEditorSettings

@if (Model.TextArea)
{
    <textarea name="@Model.EditorName" style="display: none"></textarea>
}

<div id="wrapper-@Model.EditorName"></div>
<script>
    function createEditor(text)
    {
        $('#wrapper-@Model.EditorName').html('<pre id="@Model.EditorName">' + (text != null ? text : '') + '</pre>');
        createCodeEditor('@Model.EditorName', @Html.Raw(Model.TextArea ? $"$(\"textarea[name = {@Model.EditorName}]\")" : "undefined"), @Model.MinLines, @Model.MaxLines);
    }

    var initialContents = @Json.Serialize(Model.InitialContents);
    createEditor(initialContents);
</script>

@if (!string.IsNullOrEmpty(Model.RevertContents))
{
    <script>
        function revertCodeEditor() {
            var revertContents = @Json.Serialize(Model.RevertContents);
            createEditor(revertContents);
        }

        $(function() {
            $("#revert").css('display', '').click(revertCodeEditor);
        })
    </script>
}
﻿@model CodeEditorSettings

@if (Model.TextArea)
{
    <textarea name="@Model.EditorName" style="display: none"></textarea>
}

<div id="wrapper-@Model.EditorName"></div>
<script>
    function createEditor(text) {
        $('#wrapper-@Model.EditorName').html('<pre id="@Model.EditorName"></pre>');
        $('#@Model.EditorName').text(text);
        createCodeEditor('@Model.EditorName', @Html.Raw(Model.TextArea ? $"$(\"textarea[name = {@Model.EditorName}]\")" : "undefined"), @Model.MinLines, @Model.MaxLines);
    }

    var initialContents = @Json.Serialize(Model.InitialContents);
    createEditor(initialContents);
</script>

@if (!string.IsNullOrEmpty(Model.RevertContents))
{
    <script>
        function revertCodeEditor() {
            var revertContents = @Json.Serialize(Model.RevertContents);
            createEditor(revertContents);
        }

        $(function() {
            $("#revert").css('display', '').click(revertCodeEditor);
        })
    </script>
}
Fix question submission truncation bug
Fix question submission truncation bug

This change fixes a bug where changes with < or > characters in certain
contexts would be truncated.
