<?xml version="1.0" encoding="utf-8"?>
  <finScript version="1.00" exportedUtcDate="2022-07-05T03:26:09.0000000">
    <CreatedUserId>Admin</CreatedUserId>
    <CreatedUtcDate>2022-06-30T22:49:14.4480000</CreatedUtcDate>
    <UpdatedUserId>Admin</UpdatedUserId>
    <UpdatedUtcDate>2022-07-05T00:47:59.2260000</UpdatedUtcDate>
    <ScriptId>HTMLEDITOR</ScriptId>
    <Description>HTML Editor Control for Desktop</Description>
    <ScriptType>HtmlWidget</ScriptType>
    <Active>true</Active>
    <AllowUI>false</AllowUI>
    <Category />
    <Code>' HtmlWidget_HtmlEditorControl
Option Explicit On
Option Strict On

' #################################################################
' HTML Editor Control for Desktop
'
' Version: 1.00 (05/07/2022)
'
' Usage: System-defined HTML Widget
' #################################################################
' Version        Date  User     Job       Description
' -------  ----------  -------  --------  -------------------------
'    1.00  05/07/2022  ISS      J029072   Created
' #################################################################

Public Function Main(eventId As String, parametersJson As String, startUpParametersJson As String, hostingContext As isefinHtmlWidgetHostingContext, requestInfo As finScriptRequestInfo, ByRef returnValue As String) As Boolean

  ' Assume Success
  Main = True

  ' Handle Events
  Select Case eventId
    Case ""
      ' Main event, i.e., return initial HTML content (excluding html and body tags)
      returnValue = ScriptInfo.TemplateText

    Case Else
      finBL.Error.ErrorBeginFormat("Unhandled event '{0}'.", eventId)
      Main = False
  End Select

End Function</Code>
    <Language>VisualBasic</Language>
    <Notes>System defined HTML Widget that is used internally to provide an HTML Editor control for finPOWER Connect desktop.</Notes>
    <PermissionKeyExecute />
    <RunWithoutPrompts>false</RunWithoutPrompts>
    <TemplateText>&lt;div id="frmMain" class="is-widget-content" style="visibility:hidden"&gt;

  &lt;div class="is-widget-form-body"&gt;

    &lt;div style="display:flex; flex-direction:column; flex-grow:1" class="is-dock-fill"&gt;
      &lt;div id="heEmailMessage"&gt;&lt;/div&gt;
    &lt;/div&gt;

  &lt;/div&gt;

&lt;/div&gt;

&lt;script&gt;
// Controls
var C = {
  // General
  heEmailMessage: null,
}

// Form
var frmMain;

// Initialise
$(function() {
  // Controls
  //   General
  C.heEmailMessage = widget.UI.HtmlEditor("heEmailMessage", {
    onChange: heEmailMessage_Change,
  });

  // Create Widget form
  // NOTE: Hide by default for a cleaner startup
  frmMain = new widget.UI.Form("frmMain", { visible: false });

  // Show content
  frmMain.Visible(true);
  
  // Create a proxy object so desktop can communicate with this control
  window.__controlProxy = {
    // SetAllowHtml
    SetAllowHtml: function(value) {
      C.heEmailMessage.PlainText(!value);
    },

    // SetReadOnly
    SetReadOnly: function(value) {
      C.heEmailMessage.ReadOnly(value);
    },

    // SetTags
    SetTags: function(value) {
      if (value) {
        value = JSON.parse(value);
        var tags = [];
        for (var i = 0; i &lt; value.length; i++) {
          var item = value[i];
          tags.push({ caption: item.Description, value: item.Code});
        }
        C.heEmailMessage.TagsListDefine(tags);
      }
      else {
        C.heEmailMessage.TagsListDefine(null);
      }
    },

    // SetText
    SetText: function(value) {
      C.heEmailMessage.Text(value);
    },
  }

  // Notify desktop that this control is ready
  var timer = window.setInterval(function () {
    if(window._widget) {
      window.clearInterval(timer);

      // Notify
      _widget.ControlCallback("Ready", "");
    }
  }, 100);
});

// ==============
// heEmailMessage
// ==============
function heEmailMessage_Change(sender, e) {
  // Handled
  if (e) e.ChangeHandled = true;

  // Notify
  _widget.ControlCallback("TextChanged", C.heEmailMessage.Text());
}
&lt;/script&gt;</TemplateText>
    <TemplateTextBookmarks />
    <TimeoutSeconds>60</TimeoutSeconds>
    <UniqueId>F9OfCb+d6k2igAoMd0tdbQ</UniqueId>
    <AllowRefresh>false</AllowRefresh>
    <Caption />
    <HtmlWidgetMaxHeight>0</HtmlWidgetMaxHeight>
    <HtmlWidgetMaxWidth>0</HtmlWidgetMaxWidth>
    <HtmlWidgetNeverApplyStyling>false</HtmlWidgetNeverApplyStyling>
    <HtmlWidgetResourceCssSummaryPage2>false</HtmlWidgetResourceCssSummaryPage2>
    <HtmlWidgetResourceCssWidget>true</HtmlWidgetResourceCssWidget>
    <HtmlWidgetResourceJQuery>true</HtmlWidgetResourceJQuery>
    <HtmlWidgetResourceJQueryVersion />
    <HtmlWidgetSpecialEventGetFolderCount>false</HtmlWidgetSpecialEventGetFolderCount>
    <Icon />
    <RestrictedOriginsListEnabled>false</RestrictedOriginsListEnabled>
    <RunAsAdministrator>false</RunAsAdministrator>
    <WebServiceName />
    <WebServiceAllowAnonymous>false</WebServiceAllowAnonymous>
    <WebServiceSendDebugInformation>false</WebServiceSendDebugInformation>
    <ShowInMenu>None</ShowInMenu>
    <ParametersType>None</ParametersType>
  </finScript>