﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - WebTextEditor - MailMerge issues</title><link>http://www.intersoftsolutions.com/Community/WebTextEditor/MailMerge-issues/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>MailMerge issues</title><link>http://www.intersoftsolutions.com/Community/WebTextEditor/MailMerge-issues/</link><pubDate>Tue, 08 Jun 2010 23:28:37 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>&lt;p&gt;You could retrieve the selection of the HTML element the command executed on using the GetSelectionParentNode function. For your scenario, you try using the OnAfterExecCommand event handler and rewrite the HTML element so the style tag will be outside of the SPAN with the type attribute &lt;em&gt;mailmerge&lt;/em&gt;. &lt;/p&gt;&lt;p&gt;Here is the snippet for Bold command:&lt;/p&gt;&lt;pre&gt;function WebTextEditor_OnAfterExecCommand(controlId, action)&lt;br /&gt;{&lt;br /&gt;    var WebTextEditor = ISGetObject(controlId);&lt;br /&gt;    var selection = WebTextEditor.GetSelectionParentNode();&lt;br /&gt;    &lt;br /&gt;    if(selection.parentElement.getAttribute("type") == "mailmerge")&lt;br /&gt;    {&lt;br /&gt;        switch(action)&lt;br /&gt;        {&lt;br /&gt;            case "Bold":&lt;br /&gt;                var oNew = document.createElement("strong");&lt;br /&gt;                selection.parentElement.parentElement.insertBefore(oNew, selection.parentElement);&lt;br /&gt;                oNew.appendChild(selection.parentElement);&lt;br /&gt;&lt;br /&gt;                selection.parentElement.innerHTML = selection.parentElement.innerHTML.replace(/&amp;lt;strong&amp;gt;/i, "").replace(/&amp;lt;\/strong&amp;gt;/i, "");&lt;br /&gt;                break;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>MailMerge issues</title><link>http://www.intersoftsolutions.com/Community/WebTextEditor/MailMerge-issues/</link><pubDate>Tue, 08 Jun 2010 00:25:22 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>&lt;p&gt;I am still disucssing the cusror position selection with the developer. I will inform you in this thread after I have some update regarding the issue. &lt;br /&gt;&lt;/p&gt;</description></item><item><title>MailMerge issues</title><link>http://www.intersoftsolutions.com/Community/WebTextEditor/MailMerge-issues/</link><pubDate>Mon, 07 Jun 2010 18:16:02 GMT</pubDate><dc:creator>cchl</dc:creator><description>&lt;p&gt;Thanks Glenn, that worked perfectly. The only thing I need to figure out now is how to get the current cursor location, so that I can highlight words the user clicks on (just as when you click
 on a merge label), and so that I can overwrite any typing inside a mail merge tag.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Regards&lt;br /&gt;Christian&lt;br /&gt;&lt;/p&gt;</description></item><item><title>MailMerge issues</title><link>http://www.intersoftsolutions.com/Community/WebTextEditor/MailMerge-issues/</link><pubDate>Mon, 07 Jun 2010 00:01:14 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>&lt;p&gt;In order to cancel the command execution you will need to return false in the OnBeforeExecCommand event handler not in the OnToolBarClick event handler. Here is the snippet for OnBeforeExecCommand event handler assuming this is for Bold action command, since I do not have the &lt;em&gt;ltrim&lt;/em&gt; and &lt;em&gt;rtrim&lt;/em&gt; function I only use text selection:&lt;/p&gt;&lt;pre&gt;function WebTextEditor_OnBeforeExecCommand(controlId, action)&lt;br /&gt;{&lt;br /&gt;    var WebTextEditor = ISGetObject(controlId);&lt;br /&gt;    var NewMailMerge = WebTextEditor.MailMergeSettings;&lt;br /&gt;    var NewSelection = WebTextEditor.Selection;&lt;br /&gt;&lt;br /&gt;    //Should remove white spaces before and after the selection&lt;br /&gt;    var text = NewSelection.text;&lt;br /&gt;    &lt;br /&gt;    switch(action)&lt;br /&gt;    {&lt;br /&gt;        case "Bold":&lt;br /&gt;            if (text.indexOf('}') &amp;lt; text.indexOf('{') || &lt;br /&gt;                (text.indexOf('{') &amp;lt; 0 &amp;amp;&amp;amp; text.indexOf('}') &amp;gt; 0) || &lt;br /&gt;                (text.indexOf('{') &amp;gt; 0 &amp;amp;&amp;amp; text.indexOf('}') &amp;lt; 0))&lt;br /&gt;            {&lt;br /&gt;                return false;&lt;br /&gt;            }&lt;br /&gt;            break;&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>MailMerge issues</title><link>http://www.intersoftsolutions.com/Community/WebTextEditor/MailMerge-issues/</link><pubDate>Sun, 06 Jun 2010 06:24:34 GMT</pubDate><dc:creator>cchl</dc:creator><description>&lt;p&gt;Hi Andi,&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;I have just tried to create a check to ensure that the user can't change the formatting of only part of the merge-label. Unfortunately the text is still bold, even if I return false:&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre&gt;var WebTextEditor = ISGetObject(controlId);&lt;br /&gt;                var NewSelection = WebTextEditor.Selection;&lt;br /&gt;                if (NewSelection != null) &lt;br /&gt;                {&lt;br /&gt;                    // Remove white spaces before and after the selection&lt;br /&gt;                    var text = rtrim(ltrim(NewSelection.text));&lt;br /&gt;                    &lt;br /&gt;                    if (text.indexOf('}') &amp;lt; text.indexOf('{') || (text.indexOf('{') &amp;lt;0 &amp;amp;&amp;amp; text.indexOf('}') &amp;gt; 0) || (text.indexOf('{') &amp;gt; 0 &amp;amp;&amp;amp; text.indexOf('}') &amp;lt; 0))&lt;br /&gt;                    {&lt;br /&gt;                        // Only part of mail merge selected opt out&lt;br /&gt;                        return false;&lt;br /&gt;                    }&lt;br /&gt;                }&lt;/pre&gt;
&lt;p&gt;How do I ensure that the toolbar-command is cancelled?&lt;br /&gt;&lt;/p&gt;</description></item><item><title>MailMerge issues</title><link>http://www.intersoftsolutions.com/Community/WebTextEditor/MailMerge-issues/</link><pubDate>Sun, 06 Jun 2010 04:52:07 GMT</pubDate><dc:creator>cchl</dc:creator><description>&lt;p&gt;Hi Andi,&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Thank you for your suggestion. It works just fine, however I have a couple of questions:&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;I need this to work for all formatting, is there a more generic way of formatting the whole span instead of rewriting the tag, as I guess I could run into problems if there already exists for instance a style tag and I try to add another one?&lt;/li&gt;&lt;li&gt;Is it possible to find out where in the document the cursor is located, so that I can highlight words the user clicks on (just as when you click on a merge label)?&lt;/li&gt;&lt;/ol&gt;Thank you again.&lt;br /&gt;Christian&lt;br /&gt;</description></item><item><title>MailMerge issues</title><link>http://www.intersoftsolutions.com/Community/WebTextEditor/MailMerge-issues/</link><pubDate>Fri, 04 Jun 2010 17:02:06 GMT</pubDate><dc:creator>andi@intersoftpt.com</dc:creator><description>&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;Hi Christian,&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; Unfortunately, that would be our default behavior. However, I have created a workaround that perhaps might fulfill your scenario. We will need to use "OnToolBarClick" client side event and rewrite the tag format. Here is the snippet:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p /&gt;&lt;pre&gt;&lt;span style="font-size: 9pt; "&gt;      function WebTextEditor_OnToolBarClick(controlId, command, commandSection) {

            var WebTextEditor = ISGetObject(controlId);
            var NewMailMerge = WebTextEditor.MailMergeSettings;
            var NewSelection = WebTextEditor.Selection;
                   
            if (command.Id == "cmdBold") {
                for (var i = 0; i &amp;lt; NewMailMerge.Labels.length; i&amp;#43;&amp;#43;) {
                    if (NewSelection != null) {
                        if (NewMailMerge.Labels[i].Label == NewSelection.text) {
                            var Span = "&amp;lt;strong&amp;gt;";
                            Span = Span.concat(NewSelection.htmlText);
                            Span = Span.concat("&amp;lt;\strong&amp;gt;");
                            NewSelection.pasteHTML(Span);
                        }
                    }
                }
            }
            return true;
        }&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; I hope it can help you. Please let me know if it does not meet your scenario. Thank you and have a nice day.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;Best Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;Andi Santoso&lt;/span&gt;&lt;/p&gt;
&lt;p /&gt;</description></item><item><title>MailMerge issues</title><link>http://www.intersoftsolutions.com/Community/WebTextEditor/MailMerge-issues/</link><pubDate>Fri, 04 Jun 2010 01:05:49 GMT</pubDate><dc:creator>cchl</dc:creator><description>&lt;p&gt;In WebTextEditor I have used the MailMerge function to insert merge-labels in a document. This works fine.&lt;/p&gt;
&lt;p&gt;The problem I am experiencing is: When I select the merge-label I have inserted in the document and mark it as bold, the bold-tags are inserted &lt;em&gt;inside &lt;/em&gt;the mail-merge span instead of &lt;em&gt;outside &lt;/em&gt;the mailmerge span.  &lt;/p&gt;
&lt;p&gt;Is it possible to ensure that when a mail-merge field is selected, the whole mail-merge span is selected instead of just the label text?&lt;/p&gt;
&lt;p&gt;As an alternative, is there a clientside action associated with changing the location in the document (ie clicking to the left of the label text), which would allow me to move the location to the left of the mail-merge span?&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Regards&lt;br /&gt;Christian&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>