OnReturnBase

Build 1501 on 14/Nov/2017  This topic last edited on: 22/Jan/2015, at 10:17

When editing text on page on the Pages main tab or on the WYSIWYG pane of the Articles main tab, the Private Sub OnReturnBase(, assigned in the standard configuration to the RETURN key allows you to:

Maintain the paragraph formatting when the cursor is on the beginning of the paragraph and you press the Return key.

Insert visible empty lines in text if you press Return on the beginning of an empty paragraph and SystemUserOptions.T_AllowBlankLinesTagsHidden is True and tags are hidden,

Duplicate the formatting in the next paragraph if SystemUserOptions.T_KeepFormattingOnReturn is True.

If you edit text in the source pane and the tags are displayed, the OnReturnBase v4 or newer works in the native way.

You can turn off this behavior by creating an override of the OnReturn method in the CustomArticle.vb, as in the following example:

  <ShellCommand(CanExecute:="Ena_TxtEdit")> _

  Public Overrides Sub OnReturn()

    ' On find dialog press [OK], else do standard paragraph insertion

    If TypeOf Text.Host Is TxtSrcControl Then

      Dim c As TxtSrcControl = CType(Text.Host, TxtSrcControl)

      If TypeOf c.Window Is FindReplaceDlg Then

        Dim dlg As FindReplaceDlg = CType(c.Window, FindReplaceDlg)

        dlg.OK()

      End If

 

      If TypeOf c.Window Is TxtSrcDlg Then Text.InsSpecialChar(SpecialChar.HardRet)

      Return

    End If

 

    Text.InsSpecialChar(SpecialChar.HardRet)

  End Sub

Note

OnReturnBase calls the InsHardRetBeforeTags(blankline) supplying the blankline tag >f F< or an empty string, if the personal preferences SystemUserOptions.T_AllowBlankLinesTagsHidden or SystemUserOptions.T_AllowBlankLinesTagsDisplayed are False.